@deskhero/dh_ui 2.63.0 → 2.63.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dh_ui.umd.js CHANGED
@@ -18,7 +18,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
18
18
  ${n.hasSideBar?n.sideBarPosition:""}
19
19
  ${n.hasBodyScrolling?"":"modal-auto-height"}
20
20
  ${n.fitContent?"modal modal-fit-content":"modal"}
21
- `),role:"dialog",onMousedown:e[1]||(e[1]=c.withModifiers(()=>{},["stop"]))},[n.hasCloseButton?(c.openBlock(),c.createElementBlock("button",{key:0,"aria-label":"Close modal",class:"btn-close",type:"button",onClick:e[0]||(e[0]=(...s)=>n.closed&&n.closed(...s))},[c.createVNode(r,{class:"icon","icon-name":"close",size:24})])):c.createCommentVNode("",!0),c.createElementVNode("div",NH,[n.hasSideBar?(c.openBlock(),c.createElementBlock("aside",PH,[c.renderSlot(n.$slots,"sidebar",{},void 0,!0),n.hasSideBarButtonBottom?c.renderSlot(n.$slots,"sidebar-button-bottom",{key:0},void 0,!0):c.createCommentVNode("",!0)])):c.createCommentVNode("",!0),c.createElementVNode("section",{class:c.normalizeClass(`right-section ${n.hasSideBar?"":"full"}`)},[n.hasHeader?(c.openBlock(),c.createElementBlock("header",RH,[c.renderSlot(n.$slots,"header",{},void 0,!0)])):c.createCommentVNode("",!0),c.createElementVNode("section",{id:"modalDescription",class:c.normalizeClass(["modal-body",[n.bodyClass,n.hasBodyScrolling?"":"modal-body-no-scroll"]])},[c.renderSlot(n.$slots,"body",{},void 0,!0)],2),c.createElementVNode("footer",VH,[n.hasFooter?c.renderSlot(n.$slots,"footer",{key:0},void 0,!0):c.createCommentVNode("",!0),n.hasFooterButtonRight?c.renderSlot(n.$slots,"footer-button-right",{key:1},void 0,!0):c.createCommentVNode("",!0)])],2)])],34)],32)]),_:3})}const zH=pe(Y1,[["render",HH],["__scopeId","data-v-db2339ab"]]),G1=c.defineComponent({components:{DhIcon:Ee},props:{notificationType:{type:String,required:!0,default:"toast",validator:n=>["toast","bottom-message","actionable","modal"].includes(n)},icon:{type:String,required:!0,default:"info"},isActive:{type:Boolean,required:!1,default:!1},title:{type:String,required:!1,default:""},message:{type:String,required:!1,default:""},dismissible:{type:Boolean,required:!1,default:!0},showCloseIcon:{type:Boolean,default:!0},buttonAction:{type:String,default:"Action"},buttonActionE2e:{type:String,default:""},buttonDismiss:{type:String,default:"Dismiss"},buttonDismissE2e:{type:String,default:""},disableClick:{type:Boolean,default:!1},zIndex:{type:Number,default:2},show:{type:Boolean,default:!1},animationEnter:{type:String,default:"animate-enter"},animationUp:{type:String,default:"animate-up"},animationSpeed:{type:String,default:"0.2s"},showDismissButton:{type:Boolean,default:!0},width:{type:String,default:""}},mounted(){this.dismissible&&["toast","bottom-message"].includes(this.notificationType)&&setTimeout(()=>{this.close()},5e3)},emits:["action"],methods:{close(n=!1){this.$emit("action",n)},limitTitle(n,e){return["toast","actionable"].includes(e)&&n.length>=60?`${n.substring(0,60)}..`:["bottom-message"].includes(e)&&n.length>=40?`${n.substring(0,40)}..`:["modal"].includes(e)&&n.length>=80?`${n.substring(0,80)}..`:n}}}),ev=()=>{c.useCssVars(n=>({v5259a62c:n.animationSpeed,v3bec509d:n.width}))},tv=G1.setup;G1.setup=tv?(n,e)=>(ev(),tv(n,e)):ev;const $H="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M17.24%206L6%2017.24M6.15627%206.31252L17.0837%2017.24'%20stroke='%23828282'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",WH={key:0,class:"descriptions"},UH=["data-e2e","disabled"],qH=["data-e2e"];function KH(n,e,t,o,a,i){const r=c.resolveComponent("dh-icon");return c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(`dh-notification-container ${n.notificationType}`),style:c.normalizeStyle({"z-index":n.zIndex})},[n.show?(c.openBlock(),c.createElementBlock("div",{key:0,class:c.normalizeClass(["bottom-message"].includes(n.notificationType)?`${n.animationUp} status status-${n.notificationType}`:`${n.animationEnter} status status-${n.notificationType}`)},[!["modal","bottom-message"].includes(n.notificationType)&&n.showCloseIcon?(c.openBlock(),c.createElementBlock("button",{key:0,class:"close-notification",onClick:e[0]||(e[0]=s=>n.close(!1))},[...e[3]||(e[3]=[c.createElementVNode("img",{alt:"icon",class:"close-icon",src:$H},null,-1)])])):c.createCommentVNode("",!0),c.createElementVNode("div",{class:c.normalizeClass(`content content- ${n.notificationType}`)},[c.createElementVNode("div",{class:c.normalizeClass(`ellipse ellipse-${n.notificationType} ellipse-${n.icon}`)},[c.createVNode(r,{active:n.isActive,class:c.normalizeClass(`icon-${n.icon}`),"icon-name":n.icon,size:33},null,8,["active","class","icon-name"])],2),c.createElementVNode("div",{class:c.normalizeClass(["additional-text",{"fixed-width":n.width}])},[c.createElementVNode("div",{class:c.normalizeClass(`body-section-title title-${n.notificationType}`)},c.toDisplayString(n.limitTitle(n.title,n.notificationType)),3),["bottom-message"].includes(n.notificationType)?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",WH,c.toDisplayString(n.message.length>=280?`${n.message.substring(0,280)}..`:n.message),1))],2),["toast","bottom-message"].includes(n.notificationType)?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",{key:0,class:c.normalizeClass(`buttons ${n.notificationType}`)},[c.createElementVNode("button",{class:c.normalizeClass(["btn btn-normal",n.icon=="delete"?"btn-danger":"btn-primary"]),"data-e2e":n.buttonActionE2e,disabled:n.disableClick,onClick:e[1]||(e[1]=s=>n.close(!0))},c.toDisplayString(n.buttonAction),11,UH),n.showDismissButton?(c.openBlock(),c.createElementBlock("button",{key:0,class:"btn btn-normal btn-secondary dismiss","data-e2e":n.buttonDismissE2e,onClick:e[2]||(e[2]=s=>n.close())},c.toDisplayString(n.buttonDismiss),9,qH)):c.createCommentVNode("",!0)],2))],2)],2)):c.createCommentVNode("",!0)],6)}const ZH=pe(G1,[["render",KH],["__scopeId","data-v-c03c0b15"]]),YH={class:"password__panel"},GH=["placeholder","type"],XH={class:"icon is-right"},JH={key:0,class:"password__tooltip"},QH=pe(c.defineComponent({__name:"PasswordField",props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},tipChars:{type:String,default:"12 Characters"},tipNumbers:{type:String,default:"Numbers"},tipSymbols:{type:String,default:"Symbols"},passwordTooltipDisabled:{type:Boolean,default:!1}},emits:["submit","update:modelValue"],setup(n,{emit:e}){const t=n,o=c.ref(""),a=c.ref(!1),i=c.ref(!1),r=c.ref(!1),s=c.ref(!1),l=c.ref(!1),d=e,u=c.ref(!1);function p(){d("submit",o.value),d("update:modelValue",o.value)}function m(){a.value=!0,u.value=!0}function h(){a.value=!1,u.value=!1}function f(){l.value=!l.value}return c.onMounted(()=>()=>o.value=t.modelValue||""),c.watch(t,()=>(o.value=t.modelValue||"",i.value=o.value.length>11,r.value=/\d/.test(o.value),s.value=/[!@#$%^&*)(+=._-]/.test(o.value))),(g,v)=>(c.openBlock(),c.createElementBlock("div",YH,[c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":v[0]||(v[0]=b=>o.value=b),autocomplete:"current-password",class:"form__input password__panel_input","data-e2e":"password-input",placeholder:t.placeholder,type:l.value?"text":"password",onFocus:m,onFocusout:h,onInput:p},null,40,GH),[[c.vModelDynamic,o.value]]),c.createElementVNode("button",{class:"password__panel_button",type:"button",onClick:f},[c.createElementVNode("span",XH,[c.createVNode(Ee,{active:u.value,"icon-name":l.value?"invisible":"visible",size:20},null,8,["active","icon-name"])])]),a.value&&!t.passwordTooltipDisabled?(c.openBlock(),c.createElementBlock("div",JH,[c.createElementVNode("p",{class:c.normalizeClass(["password__tooltip_text",i.value?"password__tooltip_text--valid":""])},[c.createVNode(Ee,{class:c.normalizeClass(i.value?"password__tooltip_icon--active":"password__tooltip_icon"),"icon-name":i.value?"accept":"close",size:16},null,8,["class","icon-name"]),c.createElementVNode("span",null,c.toDisplayString(t.tipChars),1)],2),c.createElementVNode("p",{class:c.normalizeClass(["password__tooltip_text",r.value?"password__tooltip_text--valid":""])},[c.createVNode(Ee,{class:c.normalizeClass(r.value?"password__tooltip_icon--active":"password__tooltip_icon"),"icon-name":r.value?"accept":"close",size:16},null,8,["class","icon-name"]),c.createElementVNode("span",null,c.toDisplayString(t.tipNumbers),1)],2),c.createElementVNode("p",{class:c.normalizeClass(["password__tooltip_text",s.value?"password__tooltip_text--valid":""])},[c.createVNode(Ee,{class:c.normalizeClass(s.value?"password__tooltip_icon--active":"password__tooltip_icon"),"icon-name":s.value?"accept":"close",size:16},null,8,["class","icon-name"]),c.createElementVNode("span",null,c.toDisplayString(t.tipSymbols),1)],2)])):c.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-86aec833"]]),ez={class:"radio"},tz=["for"],nz=["id","type","value"],oz={class:"radio__label_txt"},nv=pe({__name:"RadioBox",props:{type:{type:String,default:"radio"},value:{type:String,required:!0},label:{type:String,required:!0}},emits:["clickBox"],setup(n,{emit:e}){const t=e;return(o,a)=>(c.openBlock(),c.createElementBlock("div",ez,[c.createElementVNode("label",{class:"radio__label",for:n.value},[c.createElementVNode("input",{id:n.value,class:"radio__input",name:"radiobox",type:n.type,value:n.value,onClick:a[0]||(a[0]=i=>t("clickBox"))},null,8,nz),c.createElementVNode("span",oz,c.toDisplayString(n.label),1)],8,tz)]))}},[["__scopeId","data-v-b8f348d4"]]),az={__name:"RadioBoxGroup",props:{orientation:{type:String,default:"horizontal"},type:{type:String,default:"radio"},list:{type:Array,required:!0}},setup(n){const e=c.ref(null);function t(){const o=document.querySelectorAll("input");for(let a=0;a<o.length;a++)o[a].checked?o[a].parentNode.parentNode.classList.add("radio--checked"):o[a].parentNode.parentNode.classList.remove("radio--checked")}return(o,a)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["radio__grp",n.orientation==="vertical"?"radio__vertical":"radio__horizontal"])},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(n.list,i=>(c.openBlock(),c.createBlock(nv,{key:i.key,ref_for:!0,ref_key:"boxes",ref:e,label:i.label,type:n.type,value:i.value,onClickBox:t},null,8,["label","type","value"]))),128))],2))}},iz={class:"search-panel"},rz=["placeholder"],sz=pe(c.defineComponent({__name:"SearchInput",props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},focus:{type:Boolean,default:!1}},emits:["submit","clean","update:modelValue"],setup(n,{emit:e}){const t=n,o=c.ref(""),a=c.ref(null),i=e;function r(){i("submit",o.value),i("update:modelValue",o.value)}function s(){o.value="",i("clean"),i("update:modelValue",o.value)}return c.onMounted(()=>()=>o.value=t.modelValue||""),c.watch(t,()=>{o.value=t.modelValue||"",t.focus&&a.value&&a.value.focus()}),(l,d)=>(c.openBlock(),c.createElementBlock("div",iz,[c.withDirectives(c.createElementVNode("input",{ref_key:"searchInput",ref:a,"onUpdate:modelValue":d[0]||(d[0]=u=>o.value=u),class:"form-input search-panel-input","data-e2e":"search-input",placeholder:t.placeholder,onKeyup:r},null,40,rz),[[c.vModelText,o.value]]),o.value?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("button",{key:0,class:"search-panel-button","data-e2e":"search-submit",onClick:r},[c.createVNode(Ee,{active:!0,"icon-name":"search",size:24})])),o.value?(c.openBlock(),c.createElementBlock("button",{key:1,class:"search-panel-button close","data-e2e":"search-close",onClick:s},[c.createVNode(Ee,{class:"icon","icon-name":"close",size:24})])):c.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-0ddf3e82"]]),lz={class:"stepper"},cz=pe(c.defineComponent({__name:"Stepper",props:{maxSteps:{type:Number,default:0},currentStep:{type:Number,default:0}},setup(n){let e=n;function t(){return Array.from(Array(e.maxSteps||0).keys())}return(o,a)=>(c.openBlock(),c.createElementBlock("div",lz,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(t(),(i,r)=>(c.openBlock(),c.createElementBlock("div",{key:r,class:"step"},[c.createElementVNode("span",{class:c.normalizeClass(["step-number",{active:i===n.currentStep}])},c.toDisplayString(i+1),3),a[0]||(a[0]=c.createElementVNode("hr",{class:"solid"},null,-1))]))),128))]))}}),[["__scopeId","data-v-36fd763b"]]),dz=c.defineComponent({__name:"Tag",props:{label:{type:String,required:!0},color:{type:String,required:!1,default:"primary"},size:{type:String,required:!1,default:""},isClickable:{type:Boolean,required:!1,default:!0}},setup(n){const e=n;function t(){return e.color?`tag-${e.color}`:""}function o(){return e.size?`tag-${e.size}`:""}return(a,i)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["tag",[t(),o(),{clickable:n.isClickable}]])},c.toDisplayString(n.label),3))}});(function(){try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode(".ce-hint--align-start{text-align:left}.ce-hint--align-center{text-align:center}.ce-hint__description{opacity:.6;margin-top:3px}")),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var Gl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function x0(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function uz(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function o(){return this instanceof o?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(o){var a=Object.getOwnPropertyDescriptor(n,o);Object.defineProperty(t,o,a.get?a:{enumerable:!0,get:function(){return n[o]}})}),t}function X1(){}Object.assign(X1,{default:X1,register:X1,revert:function(){},__esModule:!0}),Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(n){const e=(this.document||this.ownerDocument).querySelectorAll(n);let t=e.length;for(;--t>=0&&e.item(t)!==this;);return t>-1}),Element.prototype.closest||(Element.prototype.closest=function(n){let e=this;if(!document.documentElement.contains(e))return null;do{if(e.matches(n))return e;e=e.parentElement||e.parentNode}while(e!==null);return null}),Element.prototype.prepend||(Element.prototype.prepend=function(n){const e=document.createDocumentFragment();Array.isArray(n)||(n=[n]),n.forEach(t=>{const o=t instanceof Node;e.appendChild(o?t:document.createTextNode(t))}),this.insertBefore(e,this.firstChild)}),Element.prototype.scrollIntoViewIfNeeded||(Element.prototype.scrollIntoViewIfNeeded=function(n){n=arguments.length===0?!0:!!n;const e=this.parentNode,t=window.getComputedStyle(e,null),o=parseInt(t.getPropertyValue("border-top-width")),a=parseInt(t.getPropertyValue("border-left-width")),i=this.offsetTop-e.offsetTop<e.scrollTop,r=this.offsetTop-e.offsetTop+this.clientHeight-o>e.scrollTop+e.clientHeight,s=this.offsetLeft-e.offsetLeft<e.scrollLeft,l=this.offsetLeft-e.offsetLeft+this.clientWidth-a>e.scrollLeft+e.clientWidth,d=i&&!r;(i||r)&&n&&(e.scrollTop=this.offsetTop-e.offsetTop-e.clientHeight/2-o+this.clientHeight/2),(s||l)&&n&&(e.scrollLeft=this.offsetLeft-e.offsetLeft-e.clientWidth/2-a+this.clientWidth/2),(i||r||s||l)&&!n&&this.scrollIntoView(d)}),window.requestIdleCallback=window.requestIdleCallback||function(n){const e=Date.now();return setTimeout(function(){n({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-e))}})},1)},window.cancelIdleCallback=window.cancelIdleCallback||function(n){clearTimeout(n)};let pz=(n=21)=>crypto.getRandomValues(new Uint8Array(n)).reduce((e,t)=>(t&=63,t<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),"");var ov=(n=>(n.VERBOSE="VERBOSE",n.INFO="INFO",n.WARN="WARN",n.ERROR="ERROR",n))(ov||{});const Fe={BACKSPACE:8,TAB:9,ENTER:13,ESC:27,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46},mz={LEFT:0};function Xl(n,e,t="log",o,a="color: inherit"){if(!("console"in window)||!window.console[t])return;const i=["info","log","warn","error"].includes(t),r=[];switch(Xl.logLevel){case"ERROR":if(t!=="error")return;break;case"WARN":if(!["error","warn"].includes(t))return;break;case"INFO":if(!i||n)return;break}o&&r.push(o);const s="Editor.js 2.31.2";n&&(i?(r.unshift(`line-height: 1em;
21
+ `),role:"dialog",onMousedown:e[1]||(e[1]=c.withModifiers(()=>{},["stop"]))},[n.hasCloseButton?(c.openBlock(),c.createElementBlock("button",{key:0,"aria-label":"Close modal",class:"btn-close",type:"button",onClick:e[0]||(e[0]=(...s)=>n.closed&&n.closed(...s))},[c.createVNode(r,{class:"icon","icon-name":"close",size:24})])):c.createCommentVNode("",!0),c.createElementVNode("div",NH,[n.hasSideBar?(c.openBlock(),c.createElementBlock("aside",PH,[c.renderSlot(n.$slots,"sidebar",{},void 0,!0),n.hasSideBarButtonBottom?c.renderSlot(n.$slots,"sidebar-button-bottom",{key:0},void 0,!0):c.createCommentVNode("",!0)])):c.createCommentVNode("",!0),c.createElementVNode("section",{class:c.normalizeClass(`right-section ${n.hasSideBar?"":"full"}`)},[n.hasHeader?(c.openBlock(),c.createElementBlock("header",RH,[c.renderSlot(n.$slots,"header",{},void 0,!0)])):c.createCommentVNode("",!0),c.createElementVNode("section",{id:"modalDescription",class:c.normalizeClass(["modal-body",[n.bodyClass,n.hasBodyScrolling?"":"modal-body-no-scroll"]])},[c.renderSlot(n.$slots,"body",{},void 0,!0)],2),c.createElementVNode("footer",VH,[n.hasFooter?c.renderSlot(n.$slots,"footer",{key:0},void 0,!0):c.createCommentVNode("",!0),n.hasFooterButtonRight?c.renderSlot(n.$slots,"footer-button-right",{key:1},void 0,!0):c.createCommentVNode("",!0)])],2)])],34)],32)]),_:3})}const zH=pe(Y1,[["render",HH],["__scopeId","data-v-db2339ab"]]),G1=c.defineComponent({components:{DhIcon:Ee},props:{notificationType:{type:String,required:!0,default:"toast",validator:n=>["toast","bottom-message","actionable","modal"].includes(n)},icon:{type:String,required:!0,default:"info"},isActive:{type:Boolean,required:!1,default:!1},title:{type:String,required:!1,default:""},message:{type:String,required:!1,default:""},dismissible:{type:Boolean,required:!1,default:!0},showCloseIcon:{type:Boolean,default:!0},buttonAction:{type:String,default:"Action"},buttonActionE2e:{type:String,default:""},buttonDismiss:{type:String,default:"Dismiss"},buttonDismissE2e:{type:String,default:""},disableClick:{type:Boolean,default:!1},zIndex:{type:Number,default:2},show:{type:Boolean,default:!1},animationEnter:{type:String,default:"animate-enter"},animationUp:{type:String,default:"animate-up"},animationSpeed:{type:String,default:"0.2s"},showDismissButton:{type:Boolean,default:!0},width:{type:String,default:""}},mounted(){this.dismissible&&["toast","bottom-message"].includes(this.notificationType)&&setTimeout(()=>{this.close()},5e3)},emits:["action"],methods:{close(n=!1){this.$emit("action",n)},limitTitle(n,e){return["toast","actionable"].includes(e)&&n.length>=60?`${n.substring(0,60)}..`:["bottom-message"].includes(e)&&n.length>=40?`${n.substring(0,40)}..`:["modal"].includes(e)&&n.length>=80?`${n.substring(0,80)}..`:n}}}),ev=()=>{c.useCssVars(n=>({v5259a62c:n.animationSpeed,v3bec509d:n.width}))},tv=G1.setup;G1.setup=tv?(n,e)=>(ev(),tv(n,e)):ev;const $H="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M17.24%206L6%2017.24M6.15627%206.31252L17.0837%2017.24'%20stroke='%23828282'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",WH={key:0,class:"descriptions"},UH=["data-e2e","disabled"],qH=["data-e2e"];function KH(n,e,t,o,a,i){const r=c.resolveComponent("dh-icon");return c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(`dh-notification-container ${n.notificationType}`),style:c.normalizeStyle({"z-index":n.zIndex})},[n.show?(c.openBlock(),c.createElementBlock("div",{key:0,class:c.normalizeClass(["bottom-message"].includes(n.notificationType)?`${n.animationUp} status status-${n.notificationType}`:`${n.animationEnter} status status-${n.notificationType}`)},[!["modal","bottom-message"].includes(n.notificationType)&&n.showCloseIcon?(c.openBlock(),c.createElementBlock("button",{key:0,class:"close-notification",onClick:e[0]||(e[0]=s=>n.close(!1))},[...e[3]||(e[3]=[c.createElementVNode("img",{alt:"icon",class:"close-icon",src:$H},null,-1)])])):c.createCommentVNode("",!0),c.createElementVNode("div",{class:c.normalizeClass(`content content- ${n.notificationType}`)},[c.createElementVNode("div",{class:c.normalizeClass(`ellipse ellipse-${n.notificationType} ellipse-${n.icon}`)},[c.createVNode(r,{active:n.isActive,class:c.normalizeClass(`icon-${n.icon}`),"icon-name":n.icon,size:33},null,8,["active","class","icon-name"])],2),c.createElementVNode("div",{class:c.normalizeClass(["additional-text",{"fixed-width":n.width}])},[c.createElementVNode("div",{class:c.normalizeClass(`body-section-title title-${n.notificationType}`)},c.toDisplayString(n.limitTitle(n.title,n.notificationType)),3),["bottom-message"].includes(n.notificationType)?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",WH,c.toDisplayString(n.message.length>=280?`${n.message.substring(0,280)}..`:n.message),1))],2),["toast","bottom-message"].includes(n.notificationType)?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",{key:0,class:c.normalizeClass(`buttons ${n.notificationType}`)},[c.createElementVNode("button",{class:c.normalizeClass(["btn btn-normal",n.icon=="delete"?"btn-danger":"btn-primary"]),"data-e2e":n.buttonActionE2e,disabled:n.disableClick,onClick:e[1]||(e[1]=s=>n.close(!0))},c.toDisplayString(n.buttonAction),11,UH),n.showDismissButton?(c.openBlock(),c.createElementBlock("button",{key:0,class:"btn btn-normal btn-secondary dismiss","data-e2e":n.buttonDismissE2e,onClick:e[2]||(e[2]=s=>n.close())},c.toDisplayString(n.buttonDismiss),9,qH)):c.createCommentVNode("",!0)],2))],2)],2)):c.createCommentVNode("",!0)],6)}const ZH=pe(G1,[["render",KH],["__scopeId","data-v-c03c0b15"]]),YH={class:"password__panel"},GH=["placeholder","type"],XH={class:"icon is-right"},JH={key:0,class:"password__tooltip"},QH=pe(c.defineComponent({__name:"PasswordField",props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},tipChars:{type:String,default:"12 Characters"},tipNumbers:{type:String,default:"Numbers"},tipSymbols:{type:String,default:"Symbols"},passwordTooltipDisabled:{type:Boolean,default:!1}},emits:["submit","update:modelValue"],setup(n,{emit:e}){const t=n,o=c.ref(""),a=c.ref(!1),i=c.ref(!1),r=c.ref(!1),s=c.ref(!1),l=c.ref(!1),d=e,u=c.ref(!1);function p(){d("submit",o.value),d("update:modelValue",o.value)}function m(){a.value=!0,u.value=!0}function h(){a.value=!1,u.value=!1}function f(){l.value=!l.value}return c.onMounted(()=>()=>o.value=t.modelValue||""),c.watch(t,()=>(o.value=t.modelValue||"",i.value=o.value.length>11,r.value=/\d/.test(o.value),s.value=/[!@#$%^&*)(+=._-]/.test(o.value))),(g,v)=>(c.openBlock(),c.createElementBlock("div",YH,[c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":v[0]||(v[0]=b=>o.value=b),autocomplete:"current-password",class:"form__input password__panel_input","data-e2e":"password-input",placeholder:t.placeholder,type:l.value?"text":"password",onFocus:m,onFocusout:h,onInput:p},null,40,GH),[[c.vModelDynamic,o.value]]),c.createElementVNode("button",{class:"password__panel_button",type:"button",onClick:f},[c.createElementVNode("span",XH,[c.createVNode(Ee,{active:u.value,"icon-name":l.value?"invisible":"visible",size:20},null,8,["active","icon-name"])])]),a.value&&!t.passwordTooltipDisabled?(c.openBlock(),c.createElementBlock("div",JH,[c.createElementVNode("p",{class:c.normalizeClass(["password__tooltip_text",i.value?"password__tooltip_text--valid":""])},[c.createVNode(Ee,{class:c.normalizeClass(i.value?"password__tooltip_icon--active":"password__tooltip_icon"),"icon-name":i.value?"accept":"close",size:16},null,8,["class","icon-name"]),c.createElementVNode("span",null,c.toDisplayString(t.tipChars),1)],2),c.createElementVNode("p",{class:c.normalizeClass(["password__tooltip_text",r.value?"password__tooltip_text--valid":""])},[c.createVNode(Ee,{class:c.normalizeClass(r.value?"password__tooltip_icon--active":"password__tooltip_icon"),"icon-name":r.value?"accept":"close",size:16},null,8,["class","icon-name"]),c.createElementVNode("span",null,c.toDisplayString(t.tipNumbers),1)],2),c.createElementVNode("p",{class:c.normalizeClass(["password__tooltip_text",s.value?"password__tooltip_text--valid":""])},[c.createVNode(Ee,{class:c.normalizeClass(s.value?"password__tooltip_icon--active":"password__tooltip_icon"),"icon-name":s.value?"accept":"close",size:16},null,8,["class","icon-name"]),c.createElementVNode("span",null,c.toDisplayString(t.tipSymbols),1)],2)])):c.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-86aec833"]]),ez={class:"radio"},tz=["for"],nz=["id","type","value"],oz={class:"radio__label_txt"},nv=pe({__name:"RadioBox",props:{type:{type:String,default:"radio"},value:{type:String,required:!0},label:{type:String,required:!0}},emits:["clickBox"],setup(n,{emit:e}){const t=e;return(o,a)=>(c.openBlock(),c.createElementBlock("div",ez,[c.createElementVNode("label",{class:"radio__label",for:n.value},[c.createElementVNode("input",{id:n.value,class:"radio__input",name:"radiobox",type:n.type,value:n.value,onClick:a[0]||(a[0]=i=>t("clickBox"))},null,8,nz),c.createElementVNode("span",oz,c.toDisplayString(n.label),1)],8,tz)]))}},[["__scopeId","data-v-b8f348d4"]]),az={__name:"RadioBoxGroup",props:{orientation:{type:String,default:"horizontal"},type:{type:String,default:"radio"},list:{type:Array,required:!0}},setup(n){const e=c.ref(null);function t(){const o=document.querySelectorAll("input");for(let a=0;a<o.length;a++)o[a].checked?o[a].parentNode.parentNode.classList.add("radio--checked"):o[a].parentNode.parentNode.classList.remove("radio--checked")}return(o,a)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["radio__grp",n.orientation==="vertical"?"radio__vertical":"radio__horizontal"])},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(n.list,i=>(c.openBlock(),c.createBlock(nv,{key:i.key,ref_for:!0,ref_key:"boxes",ref:e,label:i.label,type:n.type,value:i.value,onClickBox:t},null,8,["label","type","value"]))),128))],2))}},iz={class:"search-panel"},rz=["placeholder"],sz=pe(c.defineComponent({__name:"SearchInput",props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},focus:{type:Boolean,default:!1}},emits:["submit","clean","update:modelValue"],setup(n,{emit:e}){const t=n,o=c.ref(""),a=c.ref(null),i=e;function r(){i("submit",o.value),i("update:modelValue",o.value)}function s(){o.value="",i("clean"),i("update:modelValue",o.value)}return c.onMounted(()=>()=>o.value=t.modelValue||""),c.watch(t,()=>{o.value=t.modelValue||"",t.focus&&a.value&&a.value.focus()}),(l,d)=>(c.openBlock(),c.createElementBlock("div",iz,[c.withDirectives(c.createElementVNode("input",{ref_key:"searchInput",ref:a,"onUpdate:modelValue":d[0]||(d[0]=u=>o.value=u),class:"form-input search-panel-input","data-e2e":"search-input",placeholder:t.placeholder,onKeyup:r},null,40,rz),[[c.vModelText,o.value]]),o.value?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("button",{key:0,class:"search-panel-button","data-e2e":"search-submit",onClick:r},[c.createVNode(Ee,{active:!0,"icon-name":"search",size:24})])),o.value?(c.openBlock(),c.createElementBlock("button",{key:1,class:"search-panel-button close","data-e2e":"search-close",onClick:s},[c.createVNode(Ee,{class:"icon","icon-name":"close",size:24})])):c.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-0ddf3e82"]]),lz={class:"stepper"},cz=pe(c.defineComponent({__name:"Stepper",props:{maxSteps:{type:Number,default:0},currentStep:{type:Number,default:0}},setup(n){let e=n;function t(){return Array.from(Array(e.maxSteps||0).keys())}return(o,a)=>(c.openBlock(),c.createElementBlock("div",lz,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(t(),(i,r)=>(c.openBlock(),c.createElementBlock("div",{key:r,class:"step"},[c.createElementVNode("span",{class:c.normalizeClass(["step-number",{active:i===n.currentStep}])},c.toDisplayString(i+1),3),a[0]||(a[0]=c.createElementVNode("hr",{class:"solid"},null,-1))]))),128))]))}}),[["__scopeId","data-v-36fd763b"]]),dz=c.defineComponent({__name:"Tag",props:{label:{type:String,required:!0},color:{type:String,required:!1,default:"primary"},size:{type:String,required:!1,default:""},isClickable:{type:Boolean,required:!1,default:!0}},setup(n){const e=n;function t(){return e.color?`tag-${e.color}`:""}function o(){return e.size?`tag-${e.size}`:""}return(a,i)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["tag",[t(),o(),{clickable:n.isClickable}]])},c.toDisplayString(n.label),3))}});(function(){try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode(".ce-hint--align-start{text-align:left}.ce-hint--align-center{text-align:center}.ce-hint__description{opacity:.6;margin-top:3px}")),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var Gl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function x0(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function uz(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function o(){return this instanceof o?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(o){var a=Object.getOwnPropertyDescriptor(n,o);Object.defineProperty(t,o,a.get?a:{enumerable:!0,get:function(){return n[o]}})}),t}function X1(){}Object.assign(X1,{default:X1,register:X1,revert:function(){},__esModule:!0}),Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(n){const e=(this.document||this.ownerDocument).querySelectorAll(n);let t=e.length;for(;--t>=0&&e.item(t)!==this;);return t>-1}),Element.prototype.closest||(Element.prototype.closest=function(n){let e=this;if(!document.documentElement.contains(e))return null;do{if(e.matches(n))return e;e=e.parentElement||e.parentNode}while(e!==null);return null}),Element.prototype.prepend||(Element.prototype.prepend=function(n){const e=document.createDocumentFragment();Array.isArray(n)||(n=[n]),n.forEach(t=>{const o=t instanceof Node;e.appendChild(o?t:document.createTextNode(t))}),this.insertBefore(e,this.firstChild)}),Element.prototype.scrollIntoViewIfNeeded||(Element.prototype.scrollIntoViewIfNeeded=function(n){n=arguments.length===0?!0:!!n;const e=this.parentNode,t=window.getComputedStyle(e,null),o=parseInt(t.getPropertyValue("border-top-width")),a=parseInt(t.getPropertyValue("border-left-width")),i=this.offsetTop-e.offsetTop<e.scrollTop,r=this.offsetTop-e.offsetTop+this.clientHeight-o>e.scrollTop+e.clientHeight,s=this.offsetLeft-e.offsetLeft<e.scrollLeft,l=this.offsetLeft-e.offsetLeft+this.clientWidth-a>e.scrollLeft+e.clientWidth,d=i&&!r;(i||r)&&n&&(e.scrollTop=this.offsetTop-e.offsetTop-e.clientHeight/2-o+this.clientHeight/2),(s||l)&&n&&(e.scrollLeft=this.offsetLeft-e.offsetLeft-e.clientWidth/2-a+this.clientWidth/2),(i||r||s||l)&&!n&&this.scrollIntoView(d)}),window.requestIdleCallback=window.requestIdleCallback||function(n){const e=Date.now();return setTimeout(function(){n({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-e))}})},1)},window.cancelIdleCallback=window.cancelIdleCallback||function(n){clearTimeout(n)};let pz=(n=21)=>crypto.getRandomValues(new Uint8Array(n)).reduce((e,t)=>(t&=63,t<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),"");var ov=(n=>(n.VERBOSE="VERBOSE",n.INFO="INFO",n.WARN="WARN",n.ERROR="ERROR",n))(ov||{});const Fe={BACKSPACE:8,TAB:9,ENTER:13,ESC:27,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46},mz={LEFT:0};function Xl(n,e,t="log",o,a="color: inherit"){if(!("console"in window)||!window.console[t])return;const i=["info","log","warn","error"].includes(t),r=[];switch(Xl.logLevel){case"ERROR":if(t!=="error")return;break;case"WARN":if(!["error","warn"].includes(t))return;break;case"INFO":if(!i||n)return;break}o&&r.push(o);const s="Editor.js 2.31.3";n&&(i?(r.unshift(`line-height: 1em;
22
22
  color: #006FEA;
23
23
  display: inline-block;
24
24
  font-size: 11px;
@@ -27,7 +27,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
27
27
  padding: 4px 9px;
28
28
  border-radius: 30px;
29
29
  border: 1px solid rgba(56, 138, 229, 0.16);
30
- margin: 4px 5px 4px 0;`,a),e=`%c${s}%c ${e}`):e=`( ${s} )${e}`);try{i?o?console[t](`${e} %o`,...r):console[t](e,...r):console[t](e)}catch{}}Xl.logLevel="VERBOSE";function hz(n){Xl.logLevel=n}const Ue=Xl.bind(window,!1),uo=Xl.bind(window,!0);function rr(n){return Object.prototype.toString.call(n).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}function bt(n){return rr(n)==="function"||rr(n)==="asyncfunction"}function tn(n){return rr(n)==="object"}function xa(n){return rr(n)==="string"}function fz(n){return rr(n)==="boolean"}function av(n){return rr(n)==="number"}function iv(n){return rr(n)==="undefined"}function po(n){return n?Object.keys(n).length===0&&n.constructor===Object:!0}function rv(n){return n>47&&n<58||n===32||n===13||n===229||n>64&&n<91||n>95&&n<112||n>185&&n<193||n>218&&n<223}async function gz(n,e=()=>{},t=()=>{}){async function o(a,i,r){try{await a.function(a.data),await i(iv(a.data)?{}:a.data)}catch{r(iv(a.data)?{}:a.data)}}return n.reduce(async(a,i)=>(await a,o(i,e,t)),Promise.resolve())}function sv(n){return Array.prototype.slice.call(n)}function D0(n,e){return function(){const t=this,o=arguments;window.setTimeout(()=>n.apply(t,o),e)}}function vz(n){return n.name.split(".").pop()}function bz(n){return/^[-\w]+\/([-+\w]+|\*)$/.test(n)}function lv(n,e,t){let o;return(...a)=>{const i=this,r=()=>{o=null,n.apply(i,a)};window.clearTimeout(o),o=window.setTimeout(r,e)}}function J1(n,e,t=void 0){let o,a,i,r=null,s=0;t||(t={});const l=function(){s=t.leading===!1?0:Date.now(),r=null,i=n.apply(o,a),r||(o=a=null)};return function(){const d=Date.now();!s&&t.leading===!1&&(s=d);const u=e-(d-s);return o=this,a=arguments,u<=0||u>e?(r&&(clearTimeout(r),r=null),s=d,i=n.apply(o,a),r||(o=a=null)):!r&&t.trailing!==!1&&(r=setTimeout(l,u)),i}}function yz(){const n={win:!1,mac:!1,x11:!1,linux:!1},e=Object.keys(n).find(t=>window.navigator.appVersion.toLowerCase().indexOf(t)!==-1);return e&&(n[e]=!0),n}function F0(n){return n[0].toUpperCase()+n.slice(1)}function Q1(n,...e){if(!e.length)return n;const t=e.shift();if(tn(n)&&tn(t))for(const o in t)tn(t[o])?(n[o]||Object.assign(n,{[o]:{}}),Q1(n[o],t[o])):Object.assign(n,{[o]:t[o]});return Q1(n,...e)}function em(n){const e=yz();return n=n.replace(/shift/gi,"⇧").replace(/backspace/gi,"⌫").replace(/enter/gi,"⏎").replace(/up/gi,"↑").replace(/left/gi,"→").replace(/down/gi,"↓").replace(/right/gi,"←").replace(/escape/gi,"⎋").replace(/insert/gi,"Ins").replace(/delete/gi,"␡").replace(/\+/gi," + "),e.mac?n=n.replace(/ctrl|cmd/gi,"⌘").replace(/alt/gi,"⌥"):n=n.replace(/cmd/gi,"Ctrl").replace(/windows/gi,"WIN"),n}function Cz(n){try{return new URL(n).href}catch{}return n.substring(0,2)==="//"?window.location.protocol+n:window.location.origin+n}function kz(){return pz(10)}function wz(n){window.open(n,"_blank")}function jz(n=""){return`${n}${Math.floor(Math.random()*1e8).toString(16)}`}function tm(n,e,t){const o=`«${e}» is deprecated and will be removed in the next major release. Please use the «${t}» instead.`;n&&uo(o,"warn")}function us(n,e,t){const o=t.value?"value":"get",a=t[o],i=`#${e}Cache`;if(t[o]=function(...r){return this[i]===void 0&&(this[i]=a.apply(this,...r)),this[i]},o==="get"&&t.set){const r=t.set;t.set=function(s){delete n[i],r.apply(this,s)}}return t}const cv=650;function ps(){return window.matchMedia(`(max-width: ${cv}px)`).matches}const nm=typeof window<"u"&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1);function _z(n,e){const t=Array.isArray(n)||tn(n),o=Array.isArray(e)||tn(e);return t||o?JSON.stringify(n)===JSON.stringify(e):n===e}let Y=class Mn{static isSingleTag(e){return e.tagName&&["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(e.tagName)}static isLineBreakTag(e){return e&&e.tagName&&["BR","WBR"].includes(e.tagName)}static make(e,t=null,o={}){const a=document.createElement(e);if(Array.isArray(t)){const i=t.filter(r=>r!==void 0);a.classList.add(...i)}else t&&a.classList.add(t);for(const i in o)Object.prototype.hasOwnProperty.call(o,i)&&(a[i]=o[i]);return a}static text(e){return document.createTextNode(e)}static append(e,t){Array.isArray(t)?t.forEach(o=>e.appendChild(o)):e.appendChild(t)}static prepend(e,t){Array.isArray(t)?(t=t.reverse(),t.forEach(o=>e.prepend(o))):e.prepend(t)}static swap(e,t){const o=document.createElement("div"),a=e.parentNode;a.insertBefore(o,e),a.insertBefore(e,t),a.insertBefore(t,o),a.removeChild(o)}static find(e=document,t){return e.querySelector(t)}static get(e){return document.getElementById(e)}static findAll(e=document,t){return e.querySelectorAll(t)}static get allInputsSelector(){return"[contenteditable=true], textarea, input:not([type]), "+["text","password","email","number","search","tel","url"].map(e=>`input[type="${e}"]`).join(", ")}static findAllInputs(e){return sv(e.querySelectorAll(Mn.allInputsSelector)).reduce((t,o)=>Mn.isNativeInput(o)||Mn.containsOnlyInlineElements(o)?[...t,o]:[...t,...Mn.getDeepestBlockElements(o)],[])}static getDeepestNode(e,t=!1){const o=t?"lastChild":"firstChild",a=t?"previousSibling":"nextSibling";if(e&&e.nodeType===Node.ELEMENT_NODE&&e[o]){let i=e[o];if(Mn.isSingleTag(i)&&!Mn.isNativeInput(i)&&!Mn.isLineBreakTag(i))if(i[a])i=i[a];else if(i.parentNode[a])i=i.parentNode[a];else return i.parentNode;return this.getDeepestNode(i,t)}return e}static isElement(e){return av(e)?!1:e&&e.nodeType&&e.nodeType===Node.ELEMENT_NODE}static isFragment(e){return av(e)?!1:e&&e.nodeType&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}static isContentEditable(e){return e.contentEditable==="true"}static isNativeInput(e){const t=["INPUT","TEXTAREA"];return e&&e.tagName?t.includes(e.tagName):!1}static canSetCaret(e){let t=!0;if(Mn.isNativeInput(e))switch(e.type){case"file":case"checkbox":case"radio":case"hidden":case"submit":case"button":case"image":case"reset":t=!1;break}else t=Mn.isContentEditable(e);return t}static isNodeEmpty(e,t){let o;return this.isSingleTag(e)&&!this.isLineBreakTag(e)?!1:(this.isElement(e)&&this.isNativeInput(e)?o=e.value:o=e.textContent.replace("​",""),t&&(o=o.replace(new RegExp(t,"g"),"")),o.length===0)}static isLeaf(e){return e?e.childNodes.length===0:!1}static isEmpty(e,t){const o=[e];for(;o.length>0;)if(e=o.shift(),!!e){if(this.isLeaf(e)&&!this.isNodeEmpty(e,t))return!1;e.childNodes&&o.push(...Array.from(e.childNodes))}return!0}static isHTMLString(e){const t=Mn.make("div");return t.innerHTML=e,t.childElementCount>0}static getContentLength(e){return Mn.isNativeInput(e)?e.value.length:e.nodeType===Node.TEXT_NODE?e.length:e.textContent.length}static get blockElements(){return["address","article","aside","blockquote","canvas","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","ruby","section","table","tbody","thead","tr","tfoot","ul","video"]}static containsOnlyInlineElements(e){let t;xa(e)?(t=document.createElement("div"),t.innerHTML=e):t=e;const o=a=>!Mn.blockElements.includes(a.tagName.toLowerCase())&&Array.from(a.children).every(o);return Array.from(t.children).every(o)}static getDeepestBlockElements(e){return Mn.containsOnlyInlineElements(e)?[e]:Array.from(e.children).reduce((t,o)=>[...t,...Mn.getDeepestBlockElements(o)],[])}static getHolder(e){return xa(e)?document.getElementById(e):e}static isAnchor(e){return e.tagName.toLowerCase()==="a"}static offset(e){const t=e.getBoundingClientRect(),o=window.pageXOffset||document.documentElement.scrollLeft,a=window.pageYOffset||document.documentElement.scrollTop,i=t.top+a,r=t.left+o;return{top:i,left:r,bottom:i+t.height,right:r+t.width}}static getNodeByOffset(e,t){let o=0,a=null;const i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null);let r=i.nextNode();for(;r;){const d=r.textContent,u=d===null?0:d.length;if(a=r,o+u>=t)break;o+=u,r=i.nextNode()}if(!a)return{node:null,offset:0};const s=a.textContent;if(s===null||s.length===0)return{node:null,offset:0};const l=Math.min(t-o,s.length);return{node:a,offset:l}}};function xz(n){return!/[^\t\n\r ]/.test(n)}function Dz(n){const e=window.getComputedStyle(n),t=parseFloat(e.fontSize),o=parseFloat(e.lineHeight)||t*1.2,a=parseFloat(e.paddingTop),i=parseFloat(e.borderTopWidth),r=parseFloat(e.marginTop),s=t*.8,l=(o-t)/2;return r+i+a+l+s}function dv(n){n.dataset.empty=Y.isEmpty(n)?"true":"false"}const Fz={blockTunes:{toggler:{"Click to tune":"","or drag to move":""}},inlineToolbar:{converter:{"Convert to":""}},toolbar:{toolbox:{Add:""}},popover:{Filter:"","Nothing found":"","Convert to":""}},Ez={Text:"",Link:"",Bold:"",Italic:""},Sz={link:{"Add a link":""},stub:{"The block can not be displayed correctly.":""}},Iz={delete:{Delete:"","Click to delete":""},moveUp:{"Move up":""},moveDown:{"Move down":""}},uv={ui:Fz,toolNames:Ez,tools:Sz,blockTunes:Iz},pv=class hl{static ui(e,t){return hl._t(e,t)}static t(e,t){return hl._t(e,t)}static setDictionary(e){hl.currentDictionary=e}static _t(e,t){const o=hl.getNamespace(e);return!o||!o[t]?t:o[t]}static getNamespace(e){return e.split(".").reduce((t,o)=>!t||!Object.keys(t).length?{}:t[o],hl.currentDictionary)}};pv.currentDictionary=uv;let jn=pv,mv=class extends Error{},Jl=class{constructor(){this.subscribers={}}on(e,t){e in this.subscribers||(this.subscribers[e]=[]),this.subscribers[e].push(t)}once(e,t){e in this.subscribers||(this.subscribers[e]=[]);const o=a=>{const i=t(a),r=this.subscribers[e].indexOf(o);return r!==-1&&this.subscribers[e].splice(r,1),i};this.subscribers[e].push(o)}emit(e,t){po(this.subscribers)||!this.subscribers[e]||this.subscribers[e].reduce((o,a)=>{const i=a(o);return i!==void 0?i:o},t)}off(e,t){if(this.subscribers[e]===void 0){console.warn(`EventDispatcher .off(): there is no subscribers for event "${e.toString()}". Probably, .off() called before .on()`);return}for(let o=0;o<this.subscribers[e].length;o++)if(this.subscribers[e][o]===t){delete this.subscribers[e][o];break}}destroy(){this.subscribers={}}};function Da(n){Object.setPrototypeOf(this,{get id(){return n.id},get name(){return n.name},get config(){return n.config},get holder(){return n.holder},get isEmpty(){return n.isEmpty},get selected(){return n.selected},set stretched(e){n.stretched=e},get stretched(){return n.stretched},get focusable(){return n.focusable},call(e,t){return n.call(e,t)},save(){return n.save()},validate(e){return n.validate(e)},dispatchChange(){n.dispatchChange()},getActiveToolboxEntry(){return n.getActiveToolboxEntry()}})}let Ql=class{constructor(){this.allListeners=[]}on(e,t,o,a=!1){const i=jz("l"),r={id:i,element:e,eventType:t,handler:o,options:a};if(!this.findOne(e,t,o))return this.allListeners.push(r),e.addEventListener(t,o,a),i}off(e,t,o,a){const i=this.findAll(e,t,o);i.forEach((r,s)=>{const l=this.allListeners.indexOf(i[s]);l>-1&&(this.allListeners.splice(l,1),r.element.removeEventListener(r.eventType,r.handler,r.options))})}offById(e){const t=this.findById(e);t&&t.element.removeEventListener(t.eventType,t.handler,t.options)}findOne(e,t,o){const a=this.findAll(e,t,o);return a.length>0?a[0]:null}findAll(e,t,o){let a;const i=e?this.findByEventTarget(e):[];return e&&t&&o?a=i.filter(r=>r.eventType===t&&r.handler===o):e&&t?a=i.filter(r=>r.eventType===t):a=i,a}removeAll(){this.allListeners.map(e=>{e.element.removeEventListener(e.eventType,e.handler,e.options)}),this.allListeners=[]}destroy(){this.removeAll()}findByEventTarget(e){return this.allListeners.filter(t=>{if(t.element===e)return t})}findByType(e){return this.allListeners.filter(t=>{if(t.eventType===e)return t})}findByHandler(e){return this.allListeners.filter(t=>{if(t.handler===e)return t})}findById(e){return this.allListeners.find(t=>t.id===e)}},Pe=class Fx{constructor({config:e,eventsDispatcher:t}){if(this.nodes={},this.listeners=new Ql,this.readOnlyMutableListeners={on:(o,a,i,r=!1)=>{this.mutableListenerIds.push(this.listeners.on(o,a,i,r))},clearAll:()=>{for(const o of this.mutableListenerIds)this.listeners.offById(o);this.mutableListenerIds=[]}},this.mutableListenerIds=[],new.target===Fx)throw new TypeError("Constructors for abstract class Module are not allowed.");this.config=e,this.eventsDispatcher=t}set state(e){this.Editor=e}removeAllNodes(){for(const e in this.nodes){const t=this.nodes[e];t instanceof HTMLElement&&t.remove()}}get isRtl(){return this.config.i18n.direction==="rtl"}},_e=class Pi{constructor(){this.instance=null,this.selection=null,this.savedSelectionRange=null,this.isFakeBackgroundEnabled=!1,this.commandBackground="backColor",this.commandRemoveFormat="removeFormat"}static get CSS(){return{editorWrapper:"codex-editor",editorZone:"codex-editor__redactor"}}static get anchorNode(){const e=window.getSelection();return e?e.anchorNode:null}static get anchorElement(){const e=window.getSelection();if(!e)return null;const t=e.anchorNode;return t?Y.isElement(t)?t:t.parentElement:null}static get anchorOffset(){const e=window.getSelection();return e?e.anchorOffset:null}static get isCollapsed(){const e=window.getSelection();return e?e.isCollapsed:null}static get isAtEditor(){return this.isSelectionAtEditor(Pi.get())}static isSelectionAtEditor(e){if(!e)return!1;let t=e.anchorNode||e.focusNode;t&&t.nodeType===Node.TEXT_NODE&&(t=t.parentNode);let o=null;return t&&t instanceof Element&&(o=t.closest(`.${Pi.CSS.editorZone}`)),o?o.nodeType===Node.ELEMENT_NODE:!1}static isRangeAtEditor(e){if(!e)return;let t=e.startContainer;t&&t.nodeType===Node.TEXT_NODE&&(t=t.parentNode);let o=null;return t&&t instanceof Element&&(o=t.closest(`.${Pi.CSS.editorZone}`)),o?o.nodeType===Node.ELEMENT_NODE:!1}static get isSelectionExists(){return!!Pi.get().anchorNode}static get range(){return this.getRangeFromSelection(this.get())}static getRangeFromSelection(e){return e&&e.rangeCount?e.getRangeAt(0):null}static get rect(){let e=document.selection,t,o={x:0,y:0,width:0,height:0};if(e&&e.type!=="Control")return e=e,t=e.createRange(),o.x=t.boundingLeft,o.y=t.boundingTop,o.width=t.boundingWidth,o.height=t.boundingHeight,o;if(!window.getSelection)return Ue("Method window.getSelection is not supported","warn"),o;if(e=window.getSelection(),e.rangeCount===null||isNaN(e.rangeCount))return Ue("Method SelectionUtils.rangeCount is not supported","warn"),o;if(e.rangeCount===0)return o;if(t=e.getRangeAt(0).cloneRange(),t.getBoundingClientRect&&(o=t.getBoundingClientRect()),o.x===0&&o.y===0){const a=document.createElement("span");if(a.getBoundingClientRect){a.appendChild(document.createTextNode("​")),t.insertNode(a),o=a.getBoundingClientRect();const i=a.parentNode;i.removeChild(a),i.normalize()}}return o}static get text(){return window.getSelection?window.getSelection().toString():""}static get(){return window.getSelection()}static setCursor(e,t=0){const o=document.createRange(),a=window.getSelection();return Y.isNativeInput(e)?Y.canSetCaret(e)?(e.focus(),e.selectionStart=e.selectionEnd=t,e.getBoundingClientRect()):void 0:(o.setStart(e,t),o.setEnd(e,t),a.removeAllRanges(),a.addRange(o),o.getBoundingClientRect())}static isRangeInsideContainer(e){const t=Pi.range;return t===null?!1:e.contains(t.startContainer)}static addFakeCursor(){const e=Pi.range;if(e===null)return;const t=Y.make("span","codex-editor__fake-cursor");t.dataset.mutationFree="true",e.collapse(),e.insertNode(t)}static isFakeCursorInsideContainer(e){return Y.find(e,".codex-editor__fake-cursor")!==null}static removeFakeCursor(e=document.body){const t=Y.find(e,".codex-editor__fake-cursor");t&&t.remove()}removeFakeBackground(){this.isFakeBackgroundEnabled&&(this.isFakeBackgroundEnabled=!1,document.execCommand(this.commandRemoveFormat))}setFakeBackground(){document.execCommand(this.commandBackground,!1,"#a8d6ff"),this.isFakeBackgroundEnabled=!0}save(){this.savedSelectionRange=Pi.range}restore(){if(!this.savedSelectionRange)return;const e=window.getSelection();e.removeAllRanges(),e.addRange(this.savedSelectionRange)}clearSaved(){this.savedSelectionRange=null}collapseToEnd(){const e=window.getSelection(),t=document.createRange();t.selectNodeContents(e.focusNode),t.collapse(!1),e.removeAllRanges(),e.addRange(t)}findParentTag(e,t,o=10){const a=window.getSelection();let i=null;return!a||!a.anchorNode||!a.focusNode?null:([a.anchorNode,a.focusNode].forEach(r=>{let s=o;for(;s>0&&r.parentNode&&!(r.tagName===e&&(i=r,t&&r.classList&&!r.classList.contains(t)&&(i=null),i));)r=r.parentNode,s--}),i)}expandToTag(e){const t=window.getSelection();t.removeAllRanges();const o=document.createRange();o.selectNodeContents(e),t.addRange(o)}};function Mz(n,e){const{type:t,target:o,addedNodes:a,removedNodes:i}=n;return n.type==="attributes"&&n.attributeName==="data-empty"?!1:!!(e.contains(o)||t==="childList"&&(Array.from(a).some(r=>r===e)||Array.from(i).some(r=>r===e)))}const om="redactor dom changed",hv="block changed",fv="fake cursor is about to be toggled",gv="fake cursor have been set",ec="editor mobile layout toggled";function am(n,e){if(!n.conversionConfig)return!1;const t=n.conversionConfig[e];return bt(t)||xa(t)}function E0(n,e){return am(n.tool,e)}function vv(n,e){return Object.entries(n).some(([t,o])=>e[t]&&_z(e[t],o))}async function bv(n,e){const t=(await n.save()).data,o=e.find(a=>a.name===n.name);return o!==void 0&&!am(o,"export")?[]:e.reduce((a,i)=>{if(!am(i,"import")||i.toolbox===void 0)return a;const r=i.toolbox.filter(s=>{if(po(s)||s.icon===void 0)return!1;if(s.data!==void 0){if(vv(s.data,t))return!1}else if(i.name===n.name)return!1;return!0});return a.push({...i,toolbox:r}),a},[])}function yv(n,e){return n.mergeable?n.name===e.name?!0:E0(e,"export")&&E0(n,"import"):!1}function Bz(n,e){const t=e?.export;return bt(t)?t(n):xa(t)?n[t]:(t!==void 0&&Ue("Conversion «export» property must be a string or function. String means key of saved data object to export. Function should export processed string to export."),"")}function Cv(n,e,t){const o=e?.import;return bt(o)?o(n,t):xa(o)?{[o]:n}:(o!==void 0&&Ue("Conversion «import» property must be a string or function. String means key of tool data to import. Function accepts a imported string and return composed tool data."),{})}var ut=(n=>(n.Default="default",n.Separator="separator",n.Html="html",n))(ut||{}),Fa=(n=>(n.APPEND_CALLBACK="appendCallback",n.RENDERED="rendered",n.MOVED="moved",n.UPDATED="updated",n.REMOVED="removed",n.ON_PASTE="onPaste",n))(Fa||{});let Ea=class Ri extends Jl{constructor({id:e=kz(),data:t,tool:o,readOnly:a,tunesData:i},r){super(),this.cachedInputs=[],this.toolRenderedElement=null,this.tunesInstances=new Map,this.defaultTunesInstances=new Map,this.unavailableTunesData={},this.inputIndex=0,this.editorEventBus=null,this.handleFocus=()=>{this.dropInputsCache(),this.updateCurrentInput()},this.didMutated=(s=void 0)=>{const l=s===void 0,d=s instanceof InputEvent;!l&&!d&&this.detectToolRootChange(s);let u;l||d?u=!0:u=!(s.length>0&&s.every(p=>{const{addedNodes:m,removedNodes:h,target:f}=p;return[...Array.from(m),...Array.from(h),f].some(g=>(Y.isElement(g)||(g=g.parentElement),g&&g.closest('[data-mutation-free="true"]')!==null))})),u&&(this.dropInputsCache(),this.updateCurrentInput(),this.toggleInputsEmptyMark(),this.call("updated"),this.emit("didMutated",this))},this.name=o.name,this.id=e,this.settings=o.settings,this.config=o.settings.config||{},this.editorEventBus=r||null,this.blockAPI=new Da(this),this.tool=o,this.toolInstance=o.create(t,this.blockAPI,a),this.tunes=o.tunes,this.composeTunes(i),this.holder=this.compose(),window.requestIdleCallback(()=>{this.watchBlockMutations(),this.addInputEvents(),this.toggleInputsEmptyMark()})}static get CSS(){return{wrapper:"ce-block",wrapperStretched:"ce-block--stretched",content:"ce-block__content",selected:"ce-block--selected",dropTarget:"ce-block--drop-target"}}get inputs(){if(this.cachedInputs.length!==0)return this.cachedInputs;const e=Y.findAllInputs(this.holder);return this.inputIndex>e.length-1&&(this.inputIndex=e.length-1),this.cachedInputs=e,e}get currentInput(){return this.inputs[this.inputIndex]}set currentInput(e){const t=this.inputs.findIndex(o=>o===e||o.contains(e));t!==-1&&(this.inputIndex=t)}get firstInput(){return this.inputs[0]}get lastInput(){const e=this.inputs;return e[e.length-1]}get nextInput(){return this.inputs[this.inputIndex+1]}get previousInput(){return this.inputs[this.inputIndex-1]}get data(){return this.save().then(e=>e&&!po(e.data)?e.data:{})}get sanitize(){return this.tool.sanitizeConfig}get mergeable(){return bt(this.toolInstance.merge)}get focusable(){return this.inputs.length!==0}get isEmpty(){const e=Y.isEmpty(this.pluginsContent,"/"),t=!this.hasMedia;return e&&t}get hasMedia(){const e=["img","iframe","video","audio","source","input","textarea","twitterwidget"];return!!this.holder.querySelector(e.join(","))}set selected(e){var t,o;this.holder.classList.toggle(Ri.CSS.selected,e);const a=e===!0&&_e.isRangeInsideContainer(this.holder),i=e===!1&&_e.isFakeCursorInsideContainer(this.holder);(a||i)&&((t=this.editorEventBus)==null||t.emit(fv,{state:e}),a?_e.addFakeCursor():_e.removeFakeCursor(this.holder),(o=this.editorEventBus)==null||o.emit(gv,{state:e}))}get selected(){return this.holder.classList.contains(Ri.CSS.selected)}set stretched(e){this.holder.classList.toggle(Ri.CSS.wrapperStretched,e)}get stretched(){return this.holder.classList.contains(Ri.CSS.wrapperStretched)}set dropTarget(e){this.holder.classList.toggle(Ri.CSS.dropTarget,e)}get pluginsContent(){return this.toolRenderedElement}call(e,t){if(bt(this.toolInstance[e])){e==="appendCallback"&&Ue("`appendCallback` hook is deprecated and will be removed in the next major release. Use `rendered` hook instead","warn");try{this.toolInstance[e].call(this.toolInstance,t)}catch(o){Ue(`Error during '${e}' call: ${o.message}`,"error")}}}async mergeWith(e){await this.toolInstance.merge(e)}async save(){const e=await this.toolInstance.save(this.pluginsContent),t=this.unavailableTunesData;[...this.tunesInstances.entries(),...this.defaultTunesInstances.entries()].forEach(([i,r])=>{if(bt(r.save))try{t[i]=r.save()}catch(s){Ue(`Tune ${r.constructor.name} save method throws an Error %o`,"warn",s)}});const o=window.performance.now();let a;return Promise.resolve(e).then(i=>(a=window.performance.now(),{id:this.id,tool:this.name,data:i,tunes:t,time:a-o})).catch(i=>{Ue(`Saving process for ${this.name} tool failed due to the ${i}`,"log","red")})}async validate(e){let t=!0;return this.toolInstance.validate instanceof Function&&(t=await this.toolInstance.validate(e)),t}getTunes(){const e=[],t=[],o=typeof this.toolInstance.renderSettings=="function"?this.toolInstance.renderSettings():[];return Y.isElement(o)?e.push({type:ut.Html,element:o}):Array.isArray(o)?e.push(...o):e.push(o),[...this.tunesInstances.values(),...this.defaultTunesInstances.values()].map(a=>a.render()).forEach(a=>{Y.isElement(a)?t.push({type:ut.Html,element:a}):Array.isArray(a)?t.push(...a):t.push(a)}),{toolTunes:e,commonTunes:t}}updateCurrentInput(){this.currentInput=Y.isNativeInput(document.activeElement)||!_e.anchorNode?document.activeElement:_e.anchorNode}dispatchChange(){this.didMutated()}destroy(){this.unwatchBlockMutations(),this.removeInputEvents(),super.destroy(),bt(this.toolInstance.destroy)&&this.toolInstance.destroy()}async getActiveToolboxEntry(){const e=this.tool.toolbox;if(e.length===1)return Promise.resolve(this.tool.toolbox[0]);const t=await this.data,o=e;return o?.find(a=>vv(a.data,t))}async exportDataAsString(){const e=await this.data;return Bz(e,this.tool.conversionConfig)}compose(){const e=Y.make("div",Ri.CSS.wrapper),t=Y.make("div",Ri.CSS.content),o=this.toolInstance.render();e.dataset.id=this.id,this.toolRenderedElement=o,t.appendChild(this.toolRenderedElement);let a=t;return[...this.tunesInstances.values(),...this.defaultTunesInstances.values()].forEach(i=>{if(bt(i.wrap))try{a=i.wrap(a)}catch(r){Ue(`Tune ${i.constructor.name} wrap method throws an Error %o`,"warn",r)}}),e.appendChild(a),e}composeTunes(e){Array.from(this.tunes.values()).forEach(t=>{(t.isInternal?this.defaultTunesInstances:this.tunesInstances).set(t.name,t.create(e[t.name],this.blockAPI))}),Object.entries(e).forEach(([t,o])=>{this.tunesInstances.has(t)||(this.unavailableTunesData[t]=o)})}addInputEvents(){this.inputs.forEach(e=>{e.addEventListener("focus",this.handleFocus),Y.isNativeInput(e)&&e.addEventListener("input",this.didMutated)})}removeInputEvents(){this.inputs.forEach(e=>{e.removeEventListener("focus",this.handleFocus),Y.isNativeInput(e)&&e.removeEventListener("input",this.didMutated)})}watchBlockMutations(){var e;this.redactorDomChangedCallback=t=>{const{mutations:o}=t;o.some(a=>Mz(a,this.toolRenderedElement))&&this.didMutated(o)},(e=this.editorEventBus)==null||e.on(om,this.redactorDomChangedCallback)}unwatchBlockMutations(){var e;(e=this.editorEventBus)==null||e.off(om,this.redactorDomChangedCallback)}detectToolRootChange(e){e.forEach(t=>{if(Array.from(t.removedNodes).includes(this.toolRenderedElement)){const o=t.addedNodes[t.addedNodes.length-1];this.toolRenderedElement=o}})}dropInputsCache(){this.cachedInputs=[]}toggleInputsEmptyMark(){this.inputs.forEach(dv)}};class Tz extends Pe{constructor(){super(...arguments),this.insert=(e=this.config.defaultBlock,t={},o={},a,i,r,s)=>{const l=this.Editor.BlockManager.insert({id:s,tool:e,data:t,index:a,needToFocus:i,replace:r});return new Da(l)},this.composeBlockData=async e=>{const t=this.Editor.Tools.blockTools.get(e);return new Ea({tool:t,api:this.Editor.API,readOnly:!0,data:{},tunesData:{}}).data},this.update=async(e,t,o)=>{const{BlockManager:a}=this.Editor,i=a.getBlockById(e);if(i===void 0)throw new Error(`Block with id "${e}" not found`);const r=await a.update(i,t,o);return new Da(r)},this.convert=async(e,t,o)=>{var a,i;const{BlockManager:r,Tools:s}=this.Editor,l=r.getBlockById(e);if(!l)throw new Error(`Block with id "${e}" not found`);const d=s.blockTools.get(l.name),u=s.blockTools.get(t);if(!u)throw new Error(`Block Tool with type "${t}" not found`);const p=((a=d?.conversionConfig)==null?void 0:a.export)!==void 0,m=((i=u.conversionConfig)==null?void 0:i.import)!==void 0;if(p&&m){const h=await r.convert(l,t,o);return new Da(h)}else{const h=[p?!1:F0(l.name),m?!1:F0(t)].filter(Boolean).join(" and ");throw new Error(`Conversion from "${l.name}" to "${t}" is not possible. ${h} tool(s) should provide a "conversionConfig"`)}},this.insertMany=(e,t=this.Editor.BlockManager.blocks.length-1)=>{this.validateIndex(t);const o=e.map(({id:a,type:i,data:r})=>this.Editor.BlockManager.composeBlock({id:a,tool:i||this.config.defaultBlock,data:r}));return this.Editor.BlockManager.insertMany(o,t),o.map(a=>new Da(a))}}get methods(){return{clear:()=>this.clear(),render:e=>this.render(e),renderFromHTML:e=>this.renderFromHTML(e),delete:e=>this.delete(e),swap:(e,t)=>this.swap(e,t),move:(e,t)=>this.move(e,t),getBlockByIndex:e=>this.getBlockByIndex(e),getById:e=>this.getById(e),getCurrentBlockIndex:()=>this.getCurrentBlockIndex(),getBlockIndex:e=>this.getBlockIndex(e),getBlocksCount:()=>this.getBlocksCount(),getBlockByElement:e=>this.getBlockByElement(e),stretchBlock:(e,t=!0)=>this.stretchBlock(e,t),insertNewBlock:()=>this.insertNewBlock(),insert:this.insert,insertMany:this.insertMany,update:this.update,composeBlockData:this.composeBlockData,convert:this.convert}}getBlocksCount(){return this.Editor.BlockManager.blocks.length}getCurrentBlockIndex(){return this.Editor.BlockManager.currentBlockIndex}getBlockIndex(e){const t=this.Editor.BlockManager.getBlockById(e);if(!t){uo("There is no block with id `"+e+"`","warn");return}return this.Editor.BlockManager.getBlockIndex(t)}getBlockByIndex(e){const t=this.Editor.BlockManager.getBlockByIndex(e);if(t===void 0){uo("There is no block at index `"+e+"`","warn");return}return new Da(t)}getById(e){const t=this.Editor.BlockManager.getBlockById(e);return t===void 0?(uo("There is no block with id `"+e+"`","warn"),null):new Da(t)}getBlockByElement(e){const t=this.Editor.BlockManager.getBlock(e);if(t===void 0){uo("There is no block corresponding to element `"+e+"`","warn");return}return new Da(t)}swap(e,t){Ue("`blocks.swap()` method is deprecated and will be removed in the next major release. Use `block.move()` method instead","info"),this.Editor.BlockManager.swap(e,t)}move(e,t){this.Editor.BlockManager.move(e,t)}delete(e=this.Editor.BlockManager.currentBlockIndex){try{const t=this.Editor.BlockManager.getBlockByIndex(e);this.Editor.BlockManager.removeBlock(t)}catch(t){uo(t,"warn");return}this.Editor.BlockManager.blocks.length===0&&this.Editor.BlockManager.insert(),this.Editor.BlockManager.currentBlock&&this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock,this.Editor.Caret.positions.END),this.Editor.Toolbar.close()}async clear(){await this.Editor.BlockManager.clear(!0),this.Editor.InlineToolbar.close()}async render(e){if(e===void 0||e.blocks===void 0)throw new Error("Incorrect data passed to the render() method");this.Editor.ModificationsObserver.disable(),await this.Editor.BlockManager.clear(),await this.Editor.Renderer.render(e.blocks),this.Editor.ModificationsObserver.enable()}async renderFromHTML(e){return await this.Editor.BlockManager.clear(),this.Editor.Paste.processText(e,!0)}stretchBlock(e,t=!0){tm(!0,"blocks.stretchBlock()","BlockAPI");const o=this.Editor.BlockManager.getBlockByIndex(e);o&&(o.stretched=t)}insertNewBlock(){Ue("Method blocks.insertNewBlock() is deprecated and it will be removed in the next major release. Use blocks.insert() instead.","warn"),this.insert()}validateIndex(e){if(typeof e!="number")throw new Error("Index should be a number");if(e<0)throw new Error("Index should be greater than or equal to 0");if(e===null)throw new Error("Index should be greater than or equal to 0")}}function Az(n,e){return typeof n=="number"?e.BlockManager.getBlockByIndex(n):typeof n=="string"?e.BlockManager.getBlockById(n):e.BlockManager.getBlockById(n.id)}class Oz extends Pe{constructor(){super(...arguments),this.setToFirstBlock=(e=this.Editor.Caret.positions.DEFAULT,t=0)=>this.Editor.BlockManager.firstBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.firstBlock,e,t),!0):!1,this.setToLastBlock=(e=this.Editor.Caret.positions.DEFAULT,t=0)=>this.Editor.BlockManager.lastBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.lastBlock,e,t),!0):!1,this.setToPreviousBlock=(e=this.Editor.Caret.positions.DEFAULT,t=0)=>this.Editor.BlockManager.previousBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.previousBlock,e,t),!0):!1,this.setToNextBlock=(e=this.Editor.Caret.positions.DEFAULT,t=0)=>this.Editor.BlockManager.nextBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.nextBlock,e,t),!0):!1,this.setToBlock=(e,t=this.Editor.Caret.positions.DEFAULT,o=0)=>{const a=Az(e,this.Editor);return a===void 0?!1:(this.Editor.Caret.setToBlock(a,t,o),!0)},this.focus=(e=!1)=>e?this.setToLastBlock(this.Editor.Caret.positions.END):this.setToFirstBlock(this.Editor.Caret.positions.START)}get methods(){return{setToFirstBlock:this.setToFirstBlock,setToLastBlock:this.setToLastBlock,setToPreviousBlock:this.setToPreviousBlock,setToNextBlock:this.setToNextBlock,setToBlock:this.setToBlock,focus:this.focus}}}class Lz extends Pe{get methods(){return{emit:(e,t)=>this.emit(e,t),off:(e,t)=>this.off(e,t),on:(e,t)=>this.on(e,t)}}on(e,t){this.eventsDispatcher.on(e,t)}emit(e,t){this.eventsDispatcher.emit(e,t)}off(e,t){this.eventsDispatcher.off(e,t)}}let Nz=class Ex extends Pe{static getNamespace(e,t){return t?`blockTunes.${e}`:`tools.${e}`}get methods(){return{t:()=>{uo("I18n.t() method can be accessed only from Tools","warn")}}}getMethodsForTool(e,t){return Object.assign(this.methods,{t:o=>jn.t(Ex.getNamespace(e,t),o)})}};class Pz extends Pe{get methods(){return{blocks:this.Editor.BlocksAPI.methods,caret:this.Editor.CaretAPI.methods,tools:this.Editor.ToolsAPI.methods,events:this.Editor.EventsAPI.methods,listeners:this.Editor.ListenersAPI.methods,notifier:this.Editor.NotifierAPI.methods,sanitizer:this.Editor.SanitizerAPI.methods,saver:this.Editor.SaverAPI.methods,selection:this.Editor.SelectionAPI.methods,styles:this.Editor.StylesAPI.classes,toolbar:this.Editor.ToolbarAPI.methods,inlineToolbar:this.Editor.InlineToolbarAPI.methods,tooltip:this.Editor.TooltipAPI.methods,i18n:this.Editor.I18nAPI.methods,readOnly:this.Editor.ReadOnlyAPI.methods,ui:this.Editor.UiAPI.methods}}getMethodsForTool(e,t){return Object.assign(this.methods,{i18n:this.Editor.I18nAPI.getMethodsForTool(e,t)})}}class Rz extends Pe{get methods(){return{close:()=>this.close(),open:()=>this.open()}}open(){this.Editor.InlineToolbar.tryToShow()}close(){this.Editor.InlineToolbar.close()}}class Vz extends Pe{get methods(){return{on:(e,t,o,a)=>this.on(e,t,o,a),off:(e,t,o,a)=>this.off(e,t,o,a),offById:e=>this.offById(e)}}on(e,t,o,a){return this.listeners.on(e,t,o,a)}off(e,t,o,a){this.listeners.off(e,t,o,a)}offById(e){this.listeners.offById(e)}}var kv={exports:{}};(function(n,e){(function(t,o){n.exports=o()})(window,function(){return(function(t){var o={};function a(i){if(o[i])return o[i].exports;var r=o[i]={i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,a),r.l=!0,r.exports}return a.m=t,a.c=o,a.d=function(i,r,s){a.o(i,r)||Object.defineProperty(i,r,{enumerable:!0,get:s})},a.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},a.t=function(i,r){if(1&r&&(i=a(i)),8&r||4&r&&typeof i=="object"&&i&&i.__esModule)return i;var s=Object.create(null);if(a.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:i}),2&r&&typeof i!="string")for(var l in i)a.d(s,l,(function(d){return i[d]}).bind(null,l));return s},a.n=function(i){var r=i&&i.__esModule?function(){return i.default}:function(){return i};return a.d(r,"a",r),r},a.o=function(i,r){return Object.prototype.hasOwnProperty.call(i,r)},a.p="/",a(a.s=0)})([function(t,o,a){a(1),t.exports=(function(){var i=a(6),r="cdx-notify--bounce-in",s=null;return{show:function(l){if(l.message){(function(){if(s)return!0;s=i.getWrapper(),document.body.appendChild(s)})();var d=null,u=l.time||8e3;switch(l.type){case"confirm":d=i.confirm(l);break;case"prompt":d=i.prompt(l);break;default:d=i.alert(l),window.setTimeout(function(){d.remove()},u)}s.appendChild(d),d.classList.add(r)}}}})()},function(t,o,a){var i=a(2);typeof i=="string"&&(i=[[t.i,i,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};a(4)(i,r),i.locals&&(t.exports=i.locals)},function(t,o,a){(t.exports=a(3)(!1)).push([t.i,`.cdx-notify--error{background:#fffbfb!important}.cdx-notify--error::before{background:#fb5d5d!important}.cdx-notify__input{max-width:130px;padding:5px 10px;background:#f7f7f7;border:0;border-radius:3px;font-size:13px;color:#656b7c;outline:0}.cdx-notify__input:-ms-input-placeholder{color:#656b7c}.cdx-notify__input::placeholder{color:#656b7c}.cdx-notify__input:focus:-ms-input-placeholder{color:rgba(101,107,124,.3)}.cdx-notify__input:focus::placeholder{color:rgba(101,107,124,.3)}.cdx-notify__button{border:none;border-radius:3px;font-size:13px;padding:5px 10px;cursor:pointer}.cdx-notify__button:last-child{margin-left:10px}.cdx-notify__button--cancel{background:#f2f5f7;box-shadow:0 2px 1px 0 rgba(16,19,29,0);color:#656b7c}.cdx-notify__button--cancel:hover{background:#eee}.cdx-notify__button--confirm{background:#34c992;box-shadow:0 1px 1px 0 rgba(18,49,35,.05);color:#fff}.cdx-notify__button--confirm:hover{background:#33b082}.cdx-notify__btns-wrapper{display:-ms-flexbox;display:flex;-ms-flex-flow:row nowrap;flex-flow:row nowrap;margin-top:5px}.cdx-notify__cross{position:absolute;top:5px;right:5px;width:10px;height:10px;padding:5px;opacity:.54;cursor:pointer}.cdx-notify__cross::after,.cdx-notify__cross::before{content:'';position:absolute;left:9px;top:5px;height:12px;width:2px;background:#575d67}.cdx-notify__cross::before{transform:rotate(-45deg)}.cdx-notify__cross::after{transform:rotate(45deg)}.cdx-notify__cross:hover{opacity:1}.cdx-notifies{position:fixed;z-index:2;bottom:20px;left:20px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif}.cdx-notify{position:relative;width:220px;margin-top:15px;padding:13px 16px;background:#fff;box-shadow:0 11px 17px 0 rgba(23,32,61,.13);border-radius:5px;font-size:14px;line-height:1.4em;word-wrap:break-word}.cdx-notify::before{content:'';position:absolute;display:block;top:0;left:0;width:3px;height:calc(100% - 6px);margin:3px;border-radius:5px;background:0 0}@keyframes bounceIn{0%{opacity:0;transform:scale(.3)}50%{opacity:1;transform:scale(1.05)}70%{transform:scale(.9)}100%{transform:scale(1)}}.cdx-notify--bounce-in{animation-name:bounceIn;animation-duration:.6s;animation-iteration-count:1}.cdx-notify--success{background:#fafffe!important}.cdx-notify--success::before{background:#41ffb1!important}`,""])},function(t,o){t.exports=function(a){var i=[];return i.toString=function(){return this.map(function(r){var s=(function(l,d){var u=l[1]||"",p=l[3];if(!p)return u;if(d&&typeof btoa=="function"){var m=(f=p,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(f))))+" */"),h=p.sources.map(function(g){return"/*# sourceURL="+p.sourceRoot+g+" */"});return[u].concat(h).concat([m]).join(`
30
+ margin: 4px 5px 4px 0;`,a),e=`%c${s}%c ${e}`):e=`( ${s} )${e}`);try{i?o?console[t](`${e} %o`,...r):console[t](e,...r):console[t](e)}catch{}}Xl.logLevel="VERBOSE";function hz(n){Xl.logLevel=n}const Ue=Xl.bind(window,!1),uo=Xl.bind(window,!0);function rr(n){return Object.prototype.toString.call(n).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}function bt(n){return rr(n)==="function"||rr(n)==="asyncfunction"}function tn(n){return rr(n)==="object"}function xa(n){return rr(n)==="string"}function fz(n){return rr(n)==="boolean"}function av(n){return rr(n)==="number"}function iv(n){return rr(n)==="undefined"}function po(n){return n?Object.keys(n).length===0&&n.constructor===Object:!0}function rv(n){return n>47&&n<58||n===32||n===13||n===229||n>64&&n<91||n>95&&n<112||n>185&&n<193||n>218&&n<223}async function gz(n,e=()=>{},t=()=>{}){async function o(a,i,r){try{await a.function(a.data),await i(iv(a.data)?{}:a.data)}catch{r(iv(a.data)?{}:a.data)}}return n.reduce(async(a,i)=>(await a,o(i,e,t)),Promise.resolve())}function sv(n){return Array.prototype.slice.call(n)}function D0(n,e){return function(){const t=this,o=arguments;window.setTimeout(()=>n.apply(t,o),e)}}function vz(n){return n.name.split(".").pop()}function bz(n){return/^[-\w]+\/([-+\w]+|\*)$/.test(n)}function lv(n,e,t){let o;return(...a)=>{const i=this,r=()=>{o=null,n.apply(i,a)};window.clearTimeout(o),o=window.setTimeout(r,e)}}function J1(n,e,t=void 0){let o,a,i,r=null,s=0;t||(t={});const l=function(){s=t.leading===!1?0:Date.now(),r=null,i=n.apply(o,a),r||(o=a=null)};return function(){const d=Date.now();!s&&t.leading===!1&&(s=d);const u=e-(d-s);return o=this,a=arguments,u<=0||u>e?(r&&(clearTimeout(r),r=null),s=d,i=n.apply(o,a),r||(o=a=null)):!r&&t.trailing!==!1&&(r=setTimeout(l,u)),i}}function yz(){const n={win:!1,mac:!1,x11:!1,linux:!1},e=Object.keys(n).find(t=>window.navigator.appVersion.toLowerCase().indexOf(t)!==-1);return e&&(n[e]=!0),n}function F0(n){return n[0].toUpperCase()+n.slice(1)}function Q1(n,...e){if(!e.length)return n;const t=e.shift();if(tn(n)&&tn(t))for(const o in t)tn(t[o])?(n[o]||Object.assign(n,{[o]:{}}),Q1(n[o],t[o])):Object.assign(n,{[o]:t[o]});return Q1(n,...e)}function em(n){const e=yz();return n=n.replace(/shift/gi,"⇧").replace(/backspace/gi,"⌫").replace(/enter/gi,"⏎").replace(/up/gi,"↑").replace(/left/gi,"→").replace(/down/gi,"↓").replace(/right/gi,"←").replace(/escape/gi,"⎋").replace(/insert/gi,"Ins").replace(/delete/gi,"␡").replace(/\+/gi," + "),e.mac?n=n.replace(/ctrl|cmd/gi,"⌘").replace(/alt/gi,"⌥"):n=n.replace(/cmd/gi,"Ctrl").replace(/windows/gi,"WIN"),n}function Cz(n){try{return new URL(n).href}catch{}return n.substring(0,2)==="//"?window.location.protocol+n:window.location.origin+n}function kz(){return pz(10)}function wz(n){window.open(n,"_blank")}function jz(n=""){return`${n}${Math.floor(Math.random()*1e8).toString(16)}`}function tm(n,e,t){const o=`«${e}» is deprecated and will be removed in the next major release. Please use the «${t}» instead.`;n&&uo(o,"warn")}function us(n,e,t){const o=t.value?"value":"get",a=t[o],i=`#${e}Cache`;if(t[o]=function(...r){return this[i]===void 0&&(this[i]=a.apply(this,...r)),this[i]},o==="get"&&t.set){const r=t.set;t.set=function(s){delete n[i],r.apply(this,s)}}return t}const cv=650;function ps(){return window.matchMedia(`(max-width: ${cv}px)`).matches}const nm=typeof window<"u"&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1);function _z(n,e){const t=Array.isArray(n)||tn(n),o=Array.isArray(e)||tn(e);return t||o?JSON.stringify(n)===JSON.stringify(e):n===e}let Y=class Mn{static isSingleTag(e){return e.tagName&&["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(e.tagName)}static isLineBreakTag(e){return e&&e.tagName&&["BR","WBR"].includes(e.tagName)}static make(e,t=null,o={}){const a=document.createElement(e);if(Array.isArray(t)){const i=t.filter(r=>r!==void 0);a.classList.add(...i)}else t&&a.classList.add(t);for(const i in o)Object.prototype.hasOwnProperty.call(o,i)&&(a[i]=o[i]);return a}static text(e){return document.createTextNode(e)}static append(e,t){Array.isArray(t)?t.forEach(o=>e.appendChild(o)):e.appendChild(t)}static prepend(e,t){Array.isArray(t)?(t=t.reverse(),t.forEach(o=>e.prepend(o))):e.prepend(t)}static swap(e,t){const o=document.createElement("div"),a=e.parentNode;a.insertBefore(o,e),a.insertBefore(e,t),a.insertBefore(t,o),a.removeChild(o)}static find(e=document,t){return e.querySelector(t)}static get(e){return document.getElementById(e)}static findAll(e=document,t){return e.querySelectorAll(t)}static get allInputsSelector(){return"[contenteditable=true], textarea, input:not([type]), "+["text","password","email","number","search","tel","url"].map(e=>`input[type="${e}"]`).join(", ")}static findAllInputs(e){return sv(e.querySelectorAll(Mn.allInputsSelector)).reduce((t,o)=>Mn.isNativeInput(o)||Mn.containsOnlyInlineElements(o)?[...t,o]:[...t,...Mn.getDeepestBlockElements(o)],[])}static getDeepestNode(e,t=!1){const o=t?"lastChild":"firstChild",a=t?"previousSibling":"nextSibling";if(e&&e.nodeType===Node.ELEMENT_NODE&&e[o]){let i=e[o];if(Mn.isSingleTag(i)&&!Mn.isNativeInput(i)&&!Mn.isLineBreakTag(i))if(i[a])i=i[a];else if(i.parentNode[a])i=i.parentNode[a];else return i.parentNode;return this.getDeepestNode(i,t)}return e}static isElement(e){return av(e)?!1:e&&e.nodeType&&e.nodeType===Node.ELEMENT_NODE}static isFragment(e){return av(e)?!1:e&&e.nodeType&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}static isContentEditable(e){return e.contentEditable==="true"}static isNativeInput(e){const t=["INPUT","TEXTAREA"];return e&&e.tagName?t.includes(e.tagName):!1}static canSetCaret(e){let t=!0;if(Mn.isNativeInput(e))switch(e.type){case"file":case"checkbox":case"radio":case"hidden":case"submit":case"button":case"image":case"reset":t=!1;break}else t=Mn.isContentEditable(e);return t}static isNodeEmpty(e,t){let o;return this.isSingleTag(e)&&!this.isLineBreakTag(e)?!1:(this.isElement(e)&&this.isNativeInput(e)?o=e.value:o=e.textContent.replace("​",""),t&&(o=o.replace(new RegExp(t,"g"),"")),o.length===0)}static isLeaf(e){return e?e.childNodes.length===0:!1}static isEmpty(e,t){const o=[e];for(;o.length>0;)if(e=o.shift(),!!e){if(this.isLeaf(e)&&!this.isNodeEmpty(e,t))return!1;e.childNodes&&o.push(...Array.from(e.childNodes))}return!0}static isHTMLString(e){const t=Mn.make("div");return t.innerHTML=e,t.childElementCount>0}static getContentLength(e){return Mn.isNativeInput(e)?e.value.length:e.nodeType===Node.TEXT_NODE?e.length:e.textContent.length}static get blockElements(){return["address","article","aside","blockquote","canvas","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","ruby","section","table","tbody","thead","tr","tfoot","ul","video"]}static containsOnlyInlineElements(e){let t;xa(e)?(t=document.createElement("div"),t.innerHTML=e):t=e;const o=a=>!Mn.blockElements.includes(a.tagName.toLowerCase())&&Array.from(a.children).every(o);return Array.from(t.children).every(o)}static getDeepestBlockElements(e){return Mn.containsOnlyInlineElements(e)?[e]:Array.from(e.children).reduce((t,o)=>[...t,...Mn.getDeepestBlockElements(o)],[])}static getHolder(e){return xa(e)?document.getElementById(e):e}static isAnchor(e){return e.tagName.toLowerCase()==="a"}static offset(e){const t=e.getBoundingClientRect(),o=window.pageXOffset||document.documentElement.scrollLeft,a=window.pageYOffset||document.documentElement.scrollTop,i=t.top+a,r=t.left+o;return{top:i,left:r,bottom:i+t.height,right:r+t.width}}static getNodeByOffset(e,t){let o=0,a=null;const i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null);let r=i.nextNode();for(;r;){const d=r.textContent,u=d===null?0:d.length;if(a=r,o+u>=t)break;o+=u,r=i.nextNode()}if(!a)return{node:null,offset:0};const s=a.textContent;if(s===null||s.length===0)return{node:null,offset:0};const l=Math.min(t-o,s.length);return{node:a,offset:l}}};function xz(n){return!/[^\t\n\r ]/.test(n)}function Dz(n){const e=window.getComputedStyle(n),t=parseFloat(e.fontSize),o=parseFloat(e.lineHeight)||t*1.2,a=parseFloat(e.paddingTop),i=parseFloat(e.borderTopWidth),r=parseFloat(e.marginTop),s=t*.8,l=(o-t)/2;return r+i+a+l+s}function dv(n){n.dataset.empty=Y.isEmpty(n)?"true":"false"}const Fz={blockTunes:{toggler:{"Click to tune":"","or drag to move":""}},inlineToolbar:{converter:{"Convert to":""}},toolbar:{toolbox:{Add:""}},popover:{Filter:"","Nothing found":"","Convert to":""}},Ez={Text:"",Link:"",Bold:"",Italic:""},Sz={link:{"Add a link":""},stub:{"The block can not be displayed correctly.":""}},Iz={delete:{Delete:"","Click to delete":""},moveUp:{"Move up":""},moveDown:{"Move down":""}},uv={ui:Fz,toolNames:Ez,tools:Sz,blockTunes:Iz},pv=class hl{static ui(e,t){return hl._t(e,t)}static t(e,t){return hl._t(e,t)}static setDictionary(e){hl.currentDictionary=e}static _t(e,t){const o=hl.getNamespace(e);return!o||!o[t]?t:o[t]}static getNamespace(e){return e.split(".").reduce((t,o)=>!t||!Object.keys(t).length?{}:t[o],hl.currentDictionary)}};pv.currentDictionary=uv;let jn=pv,mv=class extends Error{},Jl=class{constructor(){this.subscribers={}}on(e,t){e in this.subscribers||(this.subscribers[e]=[]),this.subscribers[e].push(t)}once(e,t){e in this.subscribers||(this.subscribers[e]=[]);const o=a=>{const i=t(a),r=this.subscribers[e].indexOf(o);return r!==-1&&this.subscribers[e].splice(r,1),i};this.subscribers[e].push(o)}emit(e,t){po(this.subscribers)||!this.subscribers[e]||this.subscribers[e].reduce((o,a)=>{const i=a(o);return i!==void 0?i:o},t)}off(e,t){if(this.subscribers[e]===void 0){console.warn(`EventDispatcher .off(): there is no subscribers for event "${e.toString()}". Probably, .off() called before .on()`);return}for(let o=0;o<this.subscribers[e].length;o++)if(this.subscribers[e][o]===t){delete this.subscribers[e][o];break}}destroy(){this.subscribers={}}};function Da(n){Object.setPrototypeOf(this,{get id(){return n.id},get name(){return n.name},get config(){return n.config},get holder(){return n.holder},get isEmpty(){return n.isEmpty},get selected(){return n.selected},set stretched(e){n.stretched=e},get stretched(){return n.stretched},get focusable(){return n.focusable},call(e,t){return n.call(e,t)},save(){return n.save()},validate(e){return n.validate(e)},dispatchChange(){n.dispatchChange()},getActiveToolboxEntry(){return n.getActiveToolboxEntry()}})}let Ql=class{constructor(){this.allListeners=[]}on(e,t,o,a=!1){const i=jz("l"),r={id:i,element:e,eventType:t,handler:o,options:a};if(!this.findOne(e,t,o))return this.allListeners.push(r),e.addEventListener(t,o,a),i}off(e,t,o,a){const i=this.findAll(e,t,o);i.forEach((r,s)=>{const l=this.allListeners.indexOf(i[s]);l>-1&&(this.allListeners.splice(l,1),r.element.removeEventListener(r.eventType,r.handler,r.options))})}offById(e){const t=this.findById(e);t&&t.element.removeEventListener(t.eventType,t.handler,t.options)}findOne(e,t,o){const a=this.findAll(e,t,o);return a.length>0?a[0]:null}findAll(e,t,o){let a;const i=e?this.findByEventTarget(e):[];return e&&t&&o?a=i.filter(r=>r.eventType===t&&r.handler===o):e&&t?a=i.filter(r=>r.eventType===t):a=i,a}removeAll(){this.allListeners.map(e=>{e.element.removeEventListener(e.eventType,e.handler,e.options)}),this.allListeners=[]}destroy(){this.removeAll()}findByEventTarget(e){return this.allListeners.filter(t=>{if(t.element===e)return t})}findByType(e){return this.allListeners.filter(t=>{if(t.eventType===e)return t})}findByHandler(e){return this.allListeners.filter(t=>{if(t.handler===e)return t})}findById(e){return this.allListeners.find(t=>t.id===e)}},Pe=class Fx{constructor({config:e,eventsDispatcher:t}){if(this.nodes={},this.listeners=new Ql,this.readOnlyMutableListeners={on:(o,a,i,r=!1)=>{this.mutableListenerIds.push(this.listeners.on(o,a,i,r))},clearAll:()=>{for(const o of this.mutableListenerIds)this.listeners.offById(o);this.mutableListenerIds=[]}},this.mutableListenerIds=[],new.target===Fx)throw new TypeError("Constructors for abstract class Module are not allowed.");this.config=e,this.eventsDispatcher=t}set state(e){this.Editor=e}removeAllNodes(){for(const e in this.nodes){const t=this.nodes[e];t instanceof HTMLElement&&t.remove()}}get isRtl(){return this.config.i18n.direction==="rtl"}},_e=class Pi{constructor(){this.instance=null,this.selection=null,this.savedSelectionRange=null,this.isFakeBackgroundEnabled=!1,this.commandBackground="backColor"}static get CSS(){return{editorWrapper:"codex-editor",editorZone:"codex-editor__redactor"}}static get anchorNode(){const e=window.getSelection();return e?e.anchorNode:null}static get anchorElement(){const e=window.getSelection();if(!e)return null;const t=e.anchorNode;return t?Y.isElement(t)?t:t.parentElement:null}static get anchorOffset(){const e=window.getSelection();return e?e.anchorOffset:null}static get isCollapsed(){const e=window.getSelection();return e?e.isCollapsed:null}static get isAtEditor(){return this.isSelectionAtEditor(Pi.get())}static isSelectionAtEditor(e){if(!e)return!1;let t=e.anchorNode||e.focusNode;t&&t.nodeType===Node.TEXT_NODE&&(t=t.parentNode);let o=null;return t&&t instanceof Element&&(o=t.closest(`.${Pi.CSS.editorZone}`)),o?o.nodeType===Node.ELEMENT_NODE:!1}static isRangeAtEditor(e){if(!e)return;let t=e.startContainer;t&&t.nodeType===Node.TEXT_NODE&&(t=t.parentNode);let o=null;return t&&t instanceof Element&&(o=t.closest(`.${Pi.CSS.editorZone}`)),o?o.nodeType===Node.ELEMENT_NODE:!1}static get isSelectionExists(){return!!Pi.get().anchorNode}static get range(){return this.getRangeFromSelection(this.get())}static getRangeFromSelection(e){return e&&e.rangeCount?e.getRangeAt(0):null}static get rect(){let e=document.selection,t,o={x:0,y:0,width:0,height:0};if(e&&e.type!=="Control")return e=e,t=e.createRange(),o.x=t.boundingLeft,o.y=t.boundingTop,o.width=t.boundingWidth,o.height=t.boundingHeight,o;if(!window.getSelection)return Ue("Method window.getSelection is not supported","warn"),o;if(e=window.getSelection(),e.rangeCount===null||isNaN(e.rangeCount))return Ue("Method SelectionUtils.rangeCount is not supported","warn"),o;if(e.rangeCount===0)return o;if(t=e.getRangeAt(0).cloneRange(),t.getBoundingClientRect&&(o=t.getBoundingClientRect()),o.x===0&&o.y===0){const a=document.createElement("span");if(a.getBoundingClientRect){a.appendChild(document.createTextNode("​")),t.insertNode(a),o=a.getBoundingClientRect();const i=a.parentNode;i.removeChild(a),i.normalize()}}return o}static get text(){return window.getSelection?window.getSelection().toString():""}static get(){return window.getSelection()}static setCursor(e,t=0){const o=document.createRange(),a=window.getSelection();return Y.isNativeInput(e)?Y.canSetCaret(e)?(e.focus(),e.selectionStart=e.selectionEnd=t,e.getBoundingClientRect()):void 0:(o.setStart(e,t),o.setEnd(e,t),a.removeAllRanges(),a.addRange(o),o.getBoundingClientRect())}static isRangeInsideContainer(e){const t=Pi.range;return t===null?!1:e.contains(t.startContainer)}static addFakeCursor(){const e=Pi.range;if(e===null)return;const t=Y.make("span","codex-editor__fake-cursor");t.dataset.mutationFree="true",e.collapse(),e.insertNode(t)}static isFakeCursorInsideContainer(e){return Y.find(e,".codex-editor__fake-cursor")!==null}static removeFakeCursor(e=document.body){const t=Y.find(e,".codex-editor__fake-cursor");t&&t.remove()}removeFakeBackground(){this.isFakeBackgroundEnabled&&(document.execCommand(this.commandBackground,!1,"transparent"),this.isFakeBackgroundEnabled=!1)}setFakeBackground(){document.execCommand(this.commandBackground,!1,"#a8d6ff"),this.isFakeBackgroundEnabled=!0}save(){this.savedSelectionRange=Pi.range}restore(){if(!this.savedSelectionRange)return;const e=window.getSelection();e.removeAllRanges(),e.addRange(this.savedSelectionRange)}clearSaved(){this.savedSelectionRange=null}collapseToEnd(){const e=window.getSelection(),t=document.createRange();t.selectNodeContents(e.focusNode),t.collapse(!1),e.removeAllRanges(),e.addRange(t)}findParentTag(e,t,o=10){const a=window.getSelection();let i=null;return!a||!a.anchorNode||!a.focusNode?null:([a.anchorNode,a.focusNode].forEach(r=>{let s=o;for(;s>0&&r.parentNode&&!(r.tagName===e&&(i=r,t&&r.classList&&!r.classList.contains(t)&&(i=null),i));)r=r.parentNode,s--}),i)}expandToTag(e){const t=window.getSelection();t.removeAllRanges();const o=document.createRange();o.selectNodeContents(e),t.addRange(o)}};function Mz(n,e){const{type:t,target:o,addedNodes:a,removedNodes:i}=n;return n.type==="attributes"&&n.attributeName==="data-empty"?!1:!!(e.contains(o)||t==="childList"&&(Array.from(a).some(r=>r===e)||Array.from(i).some(r=>r===e)))}const om="redactor dom changed",hv="block changed",fv="fake cursor is about to be toggled",gv="fake cursor have been set",ec="editor mobile layout toggled";function am(n,e){if(!n.conversionConfig)return!1;const t=n.conversionConfig[e];return bt(t)||xa(t)}function E0(n,e){return am(n.tool,e)}function vv(n,e){return Object.entries(n).some(([t,o])=>e[t]&&_z(e[t],o))}async function bv(n,e){const t=(await n.save()).data,o=e.find(a=>a.name===n.name);return o!==void 0&&!am(o,"export")?[]:e.reduce((a,i)=>{if(!am(i,"import")||i.toolbox===void 0)return a;const r=i.toolbox.filter(s=>{if(po(s)||s.icon===void 0)return!1;if(s.data!==void 0){if(vv(s.data,t))return!1}else if(i.name===n.name)return!1;return!0});return a.push({...i,toolbox:r}),a},[])}function yv(n,e){return n.mergeable?n.name===e.name?!0:E0(e,"export")&&E0(n,"import"):!1}function Bz(n,e){const t=e?.export;return bt(t)?t(n):xa(t)?n[t]:(t!==void 0&&Ue("Conversion «export» property must be a string or function. String means key of saved data object to export. Function should export processed string to export."),"")}function Cv(n,e,t){const o=e?.import;return bt(o)?o(n,t):xa(o)?{[o]:n}:(o!==void 0&&Ue("Conversion «import» property must be a string or function. String means key of tool data to import. Function accepts a imported string and return composed tool data."),{})}var ut=(n=>(n.Default="default",n.Separator="separator",n.Html="html",n))(ut||{}),Fa=(n=>(n.APPEND_CALLBACK="appendCallback",n.RENDERED="rendered",n.MOVED="moved",n.UPDATED="updated",n.REMOVED="removed",n.ON_PASTE="onPaste",n))(Fa||{});let Ea=class Ri extends Jl{constructor({id:e=kz(),data:t,tool:o,readOnly:a,tunesData:i},r){super(),this.cachedInputs=[],this.toolRenderedElement=null,this.tunesInstances=new Map,this.defaultTunesInstances=new Map,this.unavailableTunesData={},this.inputIndex=0,this.editorEventBus=null,this.handleFocus=()=>{this.dropInputsCache(),this.updateCurrentInput()},this.didMutated=(s=void 0)=>{const l=s===void 0,d=s instanceof InputEvent;!l&&!d&&this.detectToolRootChange(s);let u;l||d?u=!0:u=!(s.length>0&&s.every(p=>{const{addedNodes:m,removedNodes:h,target:f}=p;return[...Array.from(m),...Array.from(h),f].some(g=>(Y.isElement(g)||(g=g.parentElement),g&&g.closest('[data-mutation-free="true"]')!==null))})),u&&(this.dropInputsCache(),this.updateCurrentInput(),this.toggleInputsEmptyMark(),this.call("updated"),this.emit("didMutated",this))},this.name=o.name,this.id=e,this.settings=o.settings,this.config=o.settings.config||{},this.editorEventBus=r||null,this.blockAPI=new Da(this),this.tool=o,this.toolInstance=o.create(t,this.blockAPI,a),this.tunes=o.tunes,this.composeTunes(i),this.holder=this.compose(),window.requestIdleCallback(()=>{this.watchBlockMutations(),this.addInputEvents(),this.toggleInputsEmptyMark()})}static get CSS(){return{wrapper:"ce-block",wrapperStretched:"ce-block--stretched",content:"ce-block__content",selected:"ce-block--selected",dropTarget:"ce-block--drop-target"}}get inputs(){if(this.cachedInputs.length!==0)return this.cachedInputs;const e=Y.findAllInputs(this.holder);return this.inputIndex>e.length-1&&(this.inputIndex=e.length-1),this.cachedInputs=e,e}get currentInput(){return this.inputs[this.inputIndex]}set currentInput(e){const t=this.inputs.findIndex(o=>o===e||o.contains(e));t!==-1&&(this.inputIndex=t)}get firstInput(){return this.inputs[0]}get lastInput(){const e=this.inputs;return e[e.length-1]}get nextInput(){return this.inputs[this.inputIndex+1]}get previousInput(){return this.inputs[this.inputIndex-1]}get data(){return this.save().then(e=>e&&!po(e.data)?e.data:{})}get sanitize(){return this.tool.sanitizeConfig}get mergeable(){return bt(this.toolInstance.merge)}get focusable(){return this.inputs.length!==0}get isEmpty(){const e=Y.isEmpty(this.pluginsContent,"/"),t=!this.hasMedia;return e&&t}get hasMedia(){const e=["img","iframe","video","audio","source","input","textarea","twitterwidget"];return!!this.holder.querySelector(e.join(","))}set selected(e){var t,o;this.holder.classList.toggle(Ri.CSS.selected,e);const a=e===!0&&_e.isRangeInsideContainer(this.holder),i=e===!1&&_e.isFakeCursorInsideContainer(this.holder);(a||i)&&((t=this.editorEventBus)==null||t.emit(fv,{state:e}),a?_e.addFakeCursor():_e.removeFakeCursor(this.holder),(o=this.editorEventBus)==null||o.emit(gv,{state:e}))}get selected(){return this.holder.classList.contains(Ri.CSS.selected)}set stretched(e){this.holder.classList.toggle(Ri.CSS.wrapperStretched,e)}get stretched(){return this.holder.classList.contains(Ri.CSS.wrapperStretched)}set dropTarget(e){this.holder.classList.toggle(Ri.CSS.dropTarget,e)}get pluginsContent(){return this.toolRenderedElement}call(e,t){if(bt(this.toolInstance[e])){e==="appendCallback"&&Ue("`appendCallback` hook is deprecated and will be removed in the next major release. Use `rendered` hook instead","warn");try{this.toolInstance[e].call(this.toolInstance,t)}catch(o){Ue(`Error during '${e}' call: ${o.message}`,"error")}}}async mergeWith(e){await this.toolInstance.merge(e)}async save(){const e=await this.toolInstance.save(this.pluginsContent),t=this.unavailableTunesData;[...this.tunesInstances.entries(),...this.defaultTunesInstances.entries()].forEach(([i,r])=>{if(bt(r.save))try{t[i]=r.save()}catch(s){Ue(`Tune ${r.constructor.name} save method throws an Error %o`,"warn",s)}});const o=window.performance.now();let a;return Promise.resolve(e).then(i=>(a=window.performance.now(),{id:this.id,tool:this.name,data:i,tunes:t,time:a-o})).catch(i=>{Ue(`Saving process for ${this.name} tool failed due to the ${i}`,"log","red")})}async validate(e){let t=!0;return this.toolInstance.validate instanceof Function&&(t=await this.toolInstance.validate(e)),t}getTunes(){const e=[],t=[],o=typeof this.toolInstance.renderSettings=="function"?this.toolInstance.renderSettings():[];return Y.isElement(o)?e.push({type:ut.Html,element:o}):Array.isArray(o)?e.push(...o):e.push(o),[...this.tunesInstances.values(),...this.defaultTunesInstances.values()].map(a=>a.render()).forEach(a=>{Y.isElement(a)?t.push({type:ut.Html,element:a}):Array.isArray(a)?t.push(...a):t.push(a)}),{toolTunes:e,commonTunes:t}}updateCurrentInput(){this.currentInput=Y.isNativeInput(document.activeElement)||!_e.anchorNode?document.activeElement:_e.anchorNode}dispatchChange(){this.didMutated()}destroy(){this.unwatchBlockMutations(),this.removeInputEvents(),super.destroy(),bt(this.toolInstance.destroy)&&this.toolInstance.destroy()}async getActiveToolboxEntry(){const e=this.tool.toolbox;if(e.length===1)return Promise.resolve(this.tool.toolbox[0]);const t=await this.data,o=e;return o?.find(a=>vv(a.data,t))}async exportDataAsString(){const e=await this.data;return Bz(e,this.tool.conversionConfig)}compose(){const e=Y.make("div",Ri.CSS.wrapper),t=Y.make("div",Ri.CSS.content),o=this.toolInstance.render();e.dataset.id=this.id,this.toolRenderedElement=o,t.appendChild(this.toolRenderedElement);let a=t;return[...this.tunesInstances.values(),...this.defaultTunesInstances.values()].forEach(i=>{if(bt(i.wrap))try{a=i.wrap(a)}catch(r){Ue(`Tune ${i.constructor.name} wrap method throws an Error %o`,"warn",r)}}),e.appendChild(a),e}composeTunes(e){Array.from(this.tunes.values()).forEach(t=>{(t.isInternal?this.defaultTunesInstances:this.tunesInstances).set(t.name,t.create(e[t.name],this.blockAPI))}),Object.entries(e).forEach(([t,o])=>{this.tunesInstances.has(t)||(this.unavailableTunesData[t]=o)})}addInputEvents(){this.inputs.forEach(e=>{e.addEventListener("focus",this.handleFocus),Y.isNativeInput(e)&&e.addEventListener("input",this.didMutated)})}removeInputEvents(){this.inputs.forEach(e=>{e.removeEventListener("focus",this.handleFocus),Y.isNativeInput(e)&&e.removeEventListener("input",this.didMutated)})}watchBlockMutations(){var e;this.redactorDomChangedCallback=t=>{const{mutations:o}=t;o.some(a=>Mz(a,this.toolRenderedElement))&&this.didMutated(o)},(e=this.editorEventBus)==null||e.on(om,this.redactorDomChangedCallback)}unwatchBlockMutations(){var e;(e=this.editorEventBus)==null||e.off(om,this.redactorDomChangedCallback)}detectToolRootChange(e){e.forEach(t=>{if(Array.from(t.removedNodes).includes(this.toolRenderedElement)){const o=t.addedNodes[t.addedNodes.length-1];this.toolRenderedElement=o}})}dropInputsCache(){this.cachedInputs=[]}toggleInputsEmptyMark(){this.inputs.forEach(dv)}};class Tz extends Pe{constructor(){super(...arguments),this.insert=(e=this.config.defaultBlock,t={},o={},a,i,r,s)=>{const l=this.Editor.BlockManager.insert({id:s,tool:e,data:t,index:a,needToFocus:i,replace:r});return new Da(l)},this.composeBlockData=async e=>{const t=this.Editor.Tools.blockTools.get(e);return new Ea({tool:t,api:this.Editor.API,readOnly:!0,data:{},tunesData:{}}).data},this.update=async(e,t,o)=>{const{BlockManager:a}=this.Editor,i=a.getBlockById(e);if(i===void 0)throw new Error(`Block with id "${e}" not found`);const r=await a.update(i,t,o);return new Da(r)},this.convert=async(e,t,o)=>{var a,i;const{BlockManager:r,Tools:s}=this.Editor,l=r.getBlockById(e);if(!l)throw new Error(`Block with id "${e}" not found`);const d=s.blockTools.get(l.name),u=s.blockTools.get(t);if(!u)throw new Error(`Block Tool with type "${t}" not found`);const p=((a=d?.conversionConfig)==null?void 0:a.export)!==void 0,m=((i=u.conversionConfig)==null?void 0:i.import)!==void 0;if(p&&m){const h=await r.convert(l,t,o);return new Da(h)}else{const h=[p?!1:F0(l.name),m?!1:F0(t)].filter(Boolean).join(" and ");throw new Error(`Conversion from "${l.name}" to "${t}" is not possible. ${h} tool(s) should provide a "conversionConfig"`)}},this.insertMany=(e,t=this.Editor.BlockManager.blocks.length-1)=>{this.validateIndex(t);const o=e.map(({id:a,type:i,data:r})=>this.Editor.BlockManager.composeBlock({id:a,tool:i||this.config.defaultBlock,data:r}));return this.Editor.BlockManager.insertMany(o,t),o.map(a=>new Da(a))}}get methods(){return{clear:()=>this.clear(),render:e=>this.render(e),renderFromHTML:e=>this.renderFromHTML(e),delete:e=>this.delete(e),swap:(e,t)=>this.swap(e,t),move:(e,t)=>this.move(e,t),getBlockByIndex:e=>this.getBlockByIndex(e),getById:e=>this.getById(e),getCurrentBlockIndex:()=>this.getCurrentBlockIndex(),getBlockIndex:e=>this.getBlockIndex(e),getBlocksCount:()=>this.getBlocksCount(),getBlockByElement:e=>this.getBlockByElement(e),stretchBlock:(e,t=!0)=>this.stretchBlock(e,t),insertNewBlock:()=>this.insertNewBlock(),insert:this.insert,insertMany:this.insertMany,update:this.update,composeBlockData:this.composeBlockData,convert:this.convert}}getBlocksCount(){return this.Editor.BlockManager.blocks.length}getCurrentBlockIndex(){return this.Editor.BlockManager.currentBlockIndex}getBlockIndex(e){const t=this.Editor.BlockManager.getBlockById(e);if(!t){uo("There is no block with id `"+e+"`","warn");return}return this.Editor.BlockManager.getBlockIndex(t)}getBlockByIndex(e){const t=this.Editor.BlockManager.getBlockByIndex(e);if(t===void 0){uo("There is no block at index `"+e+"`","warn");return}return new Da(t)}getById(e){const t=this.Editor.BlockManager.getBlockById(e);return t===void 0?(uo("There is no block with id `"+e+"`","warn"),null):new Da(t)}getBlockByElement(e){const t=this.Editor.BlockManager.getBlock(e);if(t===void 0){uo("There is no block corresponding to element `"+e+"`","warn");return}return new Da(t)}swap(e,t){Ue("`blocks.swap()` method is deprecated and will be removed in the next major release. Use `block.move()` method instead","info"),this.Editor.BlockManager.swap(e,t)}move(e,t){this.Editor.BlockManager.move(e,t)}delete(e=this.Editor.BlockManager.currentBlockIndex){try{const t=this.Editor.BlockManager.getBlockByIndex(e);this.Editor.BlockManager.removeBlock(t)}catch(t){uo(t,"warn");return}this.Editor.BlockManager.blocks.length===0&&this.Editor.BlockManager.insert(),this.Editor.BlockManager.currentBlock&&this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock,this.Editor.Caret.positions.END),this.Editor.Toolbar.close()}async clear(){await this.Editor.BlockManager.clear(!0),this.Editor.InlineToolbar.close()}async render(e){if(e===void 0||e.blocks===void 0)throw new Error("Incorrect data passed to the render() method");this.Editor.ModificationsObserver.disable(),await this.Editor.BlockManager.clear(),await this.Editor.Renderer.render(e.blocks),this.Editor.ModificationsObserver.enable()}async renderFromHTML(e){return await this.Editor.BlockManager.clear(),this.Editor.Paste.processText(e,!0)}stretchBlock(e,t=!0){tm(!0,"blocks.stretchBlock()","BlockAPI");const o=this.Editor.BlockManager.getBlockByIndex(e);o&&(o.stretched=t)}insertNewBlock(){Ue("Method blocks.insertNewBlock() is deprecated and it will be removed in the next major release. Use blocks.insert() instead.","warn"),this.insert()}validateIndex(e){if(typeof e!="number")throw new Error("Index should be a number");if(e<0)throw new Error("Index should be greater than or equal to 0");if(e===null)throw new Error("Index should be greater than or equal to 0")}}function Az(n,e){return typeof n=="number"?e.BlockManager.getBlockByIndex(n):typeof n=="string"?e.BlockManager.getBlockById(n):e.BlockManager.getBlockById(n.id)}class Oz extends Pe{constructor(){super(...arguments),this.setToFirstBlock=(e=this.Editor.Caret.positions.DEFAULT,t=0)=>this.Editor.BlockManager.firstBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.firstBlock,e,t),!0):!1,this.setToLastBlock=(e=this.Editor.Caret.positions.DEFAULT,t=0)=>this.Editor.BlockManager.lastBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.lastBlock,e,t),!0):!1,this.setToPreviousBlock=(e=this.Editor.Caret.positions.DEFAULT,t=0)=>this.Editor.BlockManager.previousBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.previousBlock,e,t),!0):!1,this.setToNextBlock=(e=this.Editor.Caret.positions.DEFAULT,t=0)=>this.Editor.BlockManager.nextBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.nextBlock,e,t),!0):!1,this.setToBlock=(e,t=this.Editor.Caret.positions.DEFAULT,o=0)=>{const a=Az(e,this.Editor);return a===void 0?!1:(this.Editor.Caret.setToBlock(a,t,o),!0)},this.focus=(e=!1)=>e?this.setToLastBlock(this.Editor.Caret.positions.END):this.setToFirstBlock(this.Editor.Caret.positions.START)}get methods(){return{setToFirstBlock:this.setToFirstBlock,setToLastBlock:this.setToLastBlock,setToPreviousBlock:this.setToPreviousBlock,setToNextBlock:this.setToNextBlock,setToBlock:this.setToBlock,focus:this.focus}}}class Lz extends Pe{get methods(){return{emit:(e,t)=>this.emit(e,t),off:(e,t)=>this.off(e,t),on:(e,t)=>this.on(e,t)}}on(e,t){this.eventsDispatcher.on(e,t)}emit(e,t){this.eventsDispatcher.emit(e,t)}off(e,t){this.eventsDispatcher.off(e,t)}}let Nz=class Ex extends Pe{static getNamespace(e,t){return t?`blockTunes.${e}`:`tools.${e}`}get methods(){return{t:()=>{uo("I18n.t() method can be accessed only from Tools","warn")}}}getMethodsForTool(e,t){return Object.assign(this.methods,{t:o=>jn.t(Ex.getNamespace(e,t),o)})}};class Pz extends Pe{get methods(){return{blocks:this.Editor.BlocksAPI.methods,caret:this.Editor.CaretAPI.methods,tools:this.Editor.ToolsAPI.methods,events:this.Editor.EventsAPI.methods,listeners:this.Editor.ListenersAPI.methods,notifier:this.Editor.NotifierAPI.methods,sanitizer:this.Editor.SanitizerAPI.methods,saver:this.Editor.SaverAPI.methods,selection:this.Editor.SelectionAPI.methods,styles:this.Editor.StylesAPI.classes,toolbar:this.Editor.ToolbarAPI.methods,inlineToolbar:this.Editor.InlineToolbarAPI.methods,tooltip:this.Editor.TooltipAPI.methods,i18n:this.Editor.I18nAPI.methods,readOnly:this.Editor.ReadOnlyAPI.methods,ui:this.Editor.UiAPI.methods}}getMethodsForTool(e,t){return Object.assign(this.methods,{i18n:this.Editor.I18nAPI.getMethodsForTool(e,t)})}}class Rz extends Pe{get methods(){return{close:()=>this.close(),open:()=>this.open()}}open(){this.Editor.InlineToolbar.tryToShow()}close(){this.Editor.InlineToolbar.close()}}class Vz extends Pe{get methods(){return{on:(e,t,o,a)=>this.on(e,t,o,a),off:(e,t,o,a)=>this.off(e,t,o,a),offById:e=>this.offById(e)}}on(e,t,o,a){return this.listeners.on(e,t,o,a)}off(e,t,o,a){this.listeners.off(e,t,o,a)}offById(e){this.listeners.offById(e)}}var kv={exports:{}};(function(n,e){(function(t,o){n.exports=o()})(window,function(){return(function(t){var o={};function a(i){if(o[i])return o[i].exports;var r=o[i]={i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,a),r.l=!0,r.exports}return a.m=t,a.c=o,a.d=function(i,r,s){a.o(i,r)||Object.defineProperty(i,r,{enumerable:!0,get:s})},a.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},a.t=function(i,r){if(1&r&&(i=a(i)),8&r||4&r&&typeof i=="object"&&i&&i.__esModule)return i;var s=Object.create(null);if(a.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:i}),2&r&&typeof i!="string")for(var l in i)a.d(s,l,(function(d){return i[d]}).bind(null,l));return s},a.n=function(i){var r=i&&i.__esModule?function(){return i.default}:function(){return i};return a.d(r,"a",r),r},a.o=function(i,r){return Object.prototype.hasOwnProperty.call(i,r)},a.p="/",a(a.s=0)})([function(t,o,a){a(1),t.exports=(function(){var i=a(6),r="cdx-notify--bounce-in",s=null;return{show:function(l){if(l.message){(function(){if(s)return!0;s=i.getWrapper(),document.body.appendChild(s)})();var d=null,u=l.time||8e3;switch(l.type){case"confirm":d=i.confirm(l);break;case"prompt":d=i.prompt(l);break;default:d=i.alert(l),window.setTimeout(function(){d.remove()},u)}s.appendChild(d),d.classList.add(r)}}}})()},function(t,o,a){var i=a(2);typeof i=="string"&&(i=[[t.i,i,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};a(4)(i,r),i.locals&&(t.exports=i.locals)},function(t,o,a){(t.exports=a(3)(!1)).push([t.i,`.cdx-notify--error{background:#fffbfb!important}.cdx-notify--error::before{background:#fb5d5d!important}.cdx-notify__input{max-width:130px;padding:5px 10px;background:#f7f7f7;border:0;border-radius:3px;font-size:13px;color:#656b7c;outline:0}.cdx-notify__input:-ms-input-placeholder{color:#656b7c}.cdx-notify__input::placeholder{color:#656b7c}.cdx-notify__input:focus:-ms-input-placeholder{color:rgba(101,107,124,.3)}.cdx-notify__input:focus::placeholder{color:rgba(101,107,124,.3)}.cdx-notify__button{border:none;border-radius:3px;font-size:13px;padding:5px 10px;cursor:pointer}.cdx-notify__button:last-child{margin-left:10px}.cdx-notify__button--cancel{background:#f2f5f7;box-shadow:0 2px 1px 0 rgba(16,19,29,0);color:#656b7c}.cdx-notify__button--cancel:hover{background:#eee}.cdx-notify__button--confirm{background:#34c992;box-shadow:0 1px 1px 0 rgba(18,49,35,.05);color:#fff}.cdx-notify__button--confirm:hover{background:#33b082}.cdx-notify__btns-wrapper{display:-ms-flexbox;display:flex;-ms-flex-flow:row nowrap;flex-flow:row nowrap;margin-top:5px}.cdx-notify__cross{position:absolute;top:5px;right:5px;width:10px;height:10px;padding:5px;opacity:.54;cursor:pointer}.cdx-notify__cross::after,.cdx-notify__cross::before{content:'';position:absolute;left:9px;top:5px;height:12px;width:2px;background:#575d67}.cdx-notify__cross::before{transform:rotate(-45deg)}.cdx-notify__cross::after{transform:rotate(45deg)}.cdx-notify__cross:hover{opacity:1}.cdx-notifies{position:fixed;z-index:2;bottom:20px;left:20px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif}.cdx-notify{position:relative;width:220px;margin-top:15px;padding:13px 16px;background:#fff;box-shadow:0 11px 17px 0 rgba(23,32,61,.13);border-radius:5px;font-size:14px;line-height:1.4em;word-wrap:break-word}.cdx-notify::before{content:'';position:absolute;display:block;top:0;left:0;width:3px;height:calc(100% - 6px);margin:3px;border-radius:5px;background:0 0}@keyframes bounceIn{0%{opacity:0;transform:scale(.3)}50%{opacity:1;transform:scale(1.05)}70%{transform:scale(.9)}100%{transform:scale(1)}}.cdx-notify--bounce-in{animation-name:bounceIn;animation-duration:.6s;animation-iteration-count:1}.cdx-notify--success{background:#fafffe!important}.cdx-notify--success::before{background:#41ffb1!important}`,""])},function(t,o){t.exports=function(a){var i=[];return i.toString=function(){return this.map(function(r){var s=(function(l,d){var u=l[1]||"",p=l[3];if(!p)return u;if(d&&typeof btoa=="function"){var m=(f=p,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(f))))+" */"),h=p.sources.map(function(g){return"/*# sourceURL="+p.sourceRoot+g+" */"});return[u].concat(h).concat([m]).join(`
31
31
  `)}var f;return[u].join(`
32
32
  `)})(r,a);return r[2]?"@media "+r[2]+"{"+s+"}":s}).join("")},i.i=function(r,s){typeof r=="string"&&(r=[[null,r,""]]);for(var l={},d=0;d<this.length;d++){var u=this[d][0];typeof u=="number"&&(l[u]=!0)}for(d=0;d<r.length;d++){var p=r[d];typeof p[0]=="number"&&l[p[0]]||(s&&!p[2]?p[2]=s:s&&(p[2]="("+p[2]+") and ("+s+")"),i.push(p))}},i}},function(t,o,a){var i,r,s={},l=(i=function(){return window&&document&&document.all&&!window.atob},function(){return r===void 0&&(r=i.apply(this,arguments)),r}),d=(function(_){var M={};return function(I){if(typeof I=="function")return I();if(M[I]===void 0){var j=(function(x){return document.querySelector(x)}).call(this,I);if(window.HTMLIFrameElement&&j instanceof window.HTMLIFrameElement)try{j=j.contentDocument.head}catch{j=null}M[I]=j}return M[I]}})(),u=null,p=0,m=[],h=a(5);function f(_,M){for(var I=0;I<_.length;I++){var j=_[I],x=s[j.id];if(x){x.refs++;for(var B=0;B<x.parts.length;B++)x.parts[B](j.parts[B]);for(;B<j.parts.length;B++)x.parts.push(S(j.parts[B],M))}else{var A=[];for(B=0;B<j.parts.length;B++)A.push(S(j.parts[B],M));s[j.id]={id:j.id,refs:1,parts:A}}}}function g(_,M){for(var I=[],j={},x=0;x<_.length;x++){var B=_[x],A=M.base?B[0]+M.base:B[0],E={css:B[1],media:B[2],sourceMap:B[3]};j[A]?j[A].parts.push(E):I.push(j[A]={id:A,parts:[E]})}return I}function v(_,M){var I=d(_.insertInto);if(!I)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var j=m[m.length-1];if(_.insertAt==="top")j?j.nextSibling?I.insertBefore(M,j.nextSibling):I.appendChild(M):I.insertBefore(M,I.firstChild),m.push(M);else if(_.insertAt==="bottom")I.appendChild(M);else{if(typeof _.insertAt!="object"||!_.insertAt.before)throw new Error(`[Style Loader]
33
33
 
@@ -38,8 +38,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
38
38
  /*# sourceMappingURL=data:application/json;base64,`+btoa(unescape(encodeURIComponent(JSON.stringify(R))))+" */");var H=new Blob([O],{type:"text/css"}),q=E.href;E.href=URL.createObjectURL(H),q&&URL.revokeObjectURL(q)}).bind(null,I,M),x=function(){b(I),I.href&&URL.revokeObjectURL(I.href)}):(I=y(M),j=(function(E,T){var C=T.css,O=T.media;if(O&&E.setAttribute("media",O),E.styleSheet)E.styleSheet.cssText=C;else{for(;E.firstChild;)E.removeChild(E.firstChild);E.appendChild(document.createTextNode(C))}}).bind(null,I),x=function(){b(I)});return j(_),function(E){if(E){if(E.css===_.css&&E.media===_.media&&E.sourceMap===_.sourceMap)return;j(_=E)}else x()}}t.exports=function(_,M){if(typeof DEBUG<"u"&&DEBUG&&typeof document!="object")throw new Error("The style-loader cannot be used in a non-browser environment");(M=M||{}).attrs=typeof M.attrs=="object"?M.attrs:{},M.singleton||typeof M.singleton=="boolean"||(M.singleton=l()),M.insertInto||(M.insertInto="head"),M.insertAt||(M.insertAt="bottom");var I=g(_,M);return f(I,M),function(j){for(var x=[],B=0;B<I.length;B++){var A=I[B];(E=s[A.id]).refs--,x.push(E)}for(j&&f(g(j,M),M),B=0;B<x.length;B++){var E;if((E=x[B]).refs===0){for(var T=0;T<E.parts.length;T++)E.parts[T]();delete s[E.id]}}}};var F,D=(F=[],function(_,M){return F[_]=M,F.filter(Boolean).join(`
39
39
  `)});function w(_,M,I,j){var x=I?"":j.css;if(_.styleSheet)_.styleSheet.cssText=D(M,x);else{var B=document.createTextNode(x),A=_.childNodes;A[M]&&_.removeChild(A[M]),A.length?_.insertBefore(B,A[M]):_.appendChild(B)}}},function(t,o){t.exports=function(a){var i=typeof window<"u"&&window.location;if(!i)throw new Error("fixUrls requires window.location");if(!a||typeof a!="string")return a;var r=i.protocol+"//"+i.host,s=r+i.pathname.replace(/\/[^\/]*$/,"/");return a.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(l,d){var u,p=d.trim().replace(/^"(.*)"$/,function(m,h){return h}).replace(/^'(.*)'$/,function(m,h){return h});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(p)?l:(u=p.indexOf("//")===0?p:p.indexOf("/")===0?r+p:s+p.replace(/^\.\//,""),"url("+JSON.stringify(u)+")")})}},function(t,o,a){var i,r,s,l,d,u,p,m,h;t.exports=(i="cdx-notifies",r="cdx-notify",s="cdx-notify__cross",l="cdx-notify__button--confirm",d="cdx-notify__button--cancel",u="cdx-notify__input",p="cdx-notify__button",m="cdx-notify__btns-wrapper",{alert:h=function(f){var g=document.createElement("DIV"),v=document.createElement("DIV"),b=f.message,y=f.style;return g.classList.add(r),y&&g.classList.add(r+"--"+y),g.innerHTML=b,v.classList.add(s),v.addEventListener("click",g.remove.bind(g)),g.appendChild(v),g},confirm:function(f){var g=h(f),v=document.createElement("div"),b=document.createElement("button"),y=document.createElement("button"),k=g.querySelector("."+s),S=f.cancelHandler,F=f.okHandler;return v.classList.add(m),b.innerHTML=f.okText||"Confirm",y.innerHTML=f.cancelText||"Cancel",b.classList.add(p),y.classList.add(p),b.classList.add(l),y.classList.add(d),S&&typeof S=="function"&&(y.addEventListener("click",S),k.addEventListener("click",S)),F&&typeof F=="function"&&b.addEventListener("click",F),b.addEventListener("click",g.remove.bind(g)),y.addEventListener("click",g.remove.bind(g)),v.appendChild(b),v.appendChild(y),g.appendChild(v),g},prompt:function(f){var g=h(f),v=document.createElement("div"),b=document.createElement("button"),y=document.createElement("input"),k=g.querySelector("."+s),S=f.cancelHandler,F=f.okHandler;return v.classList.add(m),b.innerHTML=f.okText||"Ok",b.classList.add(p),b.classList.add(l),y.classList.add(u),f.placeholder&&y.setAttribute("placeholder",f.placeholder),f.default&&(y.value=f.default),f.inputType&&(y.type=f.inputType),S&&typeof S=="function"&&k.addEventListener("click",S),F&&typeof F=="function"&&b.addEventListener("click",function(){F(y.value)}),b.addEventListener("click",g.remove.bind(g)),v.appendChild(y),v.appendChild(b),g.appendChild(v),g},getWrapper:function(){var f=document.createElement("DIV");return f.classList.add(i),f}})}])})})(kv);var Hz=kv.exports;const zz=x0(Hz);class $z{show(e){zz.show(e)}}class Wz extends Pe{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t}),this.notifier=new $z}get methods(){return{show:e=>this.show(e)}}show(e){return this.notifier.show(e)}}class Uz extends Pe{get methods(){const e=()=>this.isEnabled;return{toggle:t=>this.toggle(t),get isEnabled(){return e()}}}toggle(e){return this.Editor.ReadOnly.toggle(e)}get isEnabled(){return this.Editor.ReadOnly.isEnabled}}var wv={exports:{}};(function(n,e){(function(t,o){n.exports=o()})(Gl,function(){function t(p){var m=p.tags,h=Object.keys(m),f=h.map(function(g){return typeof m[g]}).every(function(g){return g==="object"||g==="boolean"||g==="function"});if(!f)throw new Error("The configuration was invalid");this.config=p}var o=["P","LI","TD","TH","DIV","H1","H2","H3","H4","H5","H6","PRE"];function a(p){return o.indexOf(p.nodeName)!==-1}var i=["A","B","STRONG","I","EM","SUB","SUP","U","STRIKE"];function r(p){return i.indexOf(p.nodeName)!==-1}t.prototype.clean=function(p){const m=document.implementation.createHTMLDocument(),h=m.createElement("div");return h.innerHTML=p,this._sanitize(m,h),h.innerHTML},t.prototype._sanitize=function(p,m){var h=s(p,m),f=h.firstChild();if(f)do{if(f.nodeType===Node.TEXT_NODE)if(f.data.trim()===""&&(f.previousElementSibling&&a(f.previousElementSibling)||f.nextElementSibling&&a(f.nextElementSibling))){m.removeChild(f),this._sanitize(p,m);break}else continue;if(f.nodeType===Node.COMMENT_NODE){m.removeChild(f),this._sanitize(p,m);break}var g=r(f),v;g&&(v=Array.prototype.some.call(f.childNodes,a));var b=!!m.parentNode,y=a(m)&&a(f)&&b,k=f.nodeName.toLowerCase(),S=l(this.config,k,f),F=g&&v;if(F||d(f,S)||!this.config.keepNestedBlockElements&&y){if(!(f.nodeName==="SCRIPT"||f.nodeName==="STYLE"))for(;f.childNodes.length>0;)m.insertBefore(f.childNodes[0],f);m.removeChild(f),this._sanitize(p,m);break}for(var D=0;D<f.attributes.length;D+=1){var w=f.attributes[D];u(w,S,f)&&(f.removeAttribute(w.name),D=D-1)}this._sanitize(p,f)}while(f=h.nextSibling())};function s(p,m){return p.createTreeWalker(m,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT,null,!1)}function l(p,m,h){return typeof p.tags[m]=="function"?p.tags[m](h):p.tags[m]}function d(p,m){return typeof m>"u"?!0:typeof m=="boolean"?!m:!1}function u(p,m,h){var f=p.name.toLowerCase();return m===!0?!1:typeof m[f]=="function"?!m[f](p.value,h):typeof m[f]>"u"||m[f]===!1?!0:typeof m[f]=="string"?m[f]!==p.value:!1}return t})})(wv);var qz=wv.exports;const Kz=x0(qz);function im(n,e){return n.map(t=>{const o=bt(e)?e(t.tool):e;return po(o)||(t.data=rm(t.data,o)),t})}function ea(n,e={}){const t={tags:e};return new Kz(t).clean(n)}function rm(n,e){return Array.isArray(n)?Zz(n,e):tn(n)?Yz(n,e):xa(n)?Gz(n,e):n}function Zz(n,e){return n.map(t=>rm(t,e))}function Yz(n,e){const t={};for(const o in n){if(!Object.prototype.hasOwnProperty.call(n,o))continue;const a=n[o],i=Xz(e[o])?e[o]:e;t[o]=rm(a,i)}return t}function Gz(n,e){return tn(e)?ea(n,e):e===!1?ea(n,{}):n}function Xz(n){return tn(n)||fz(n)||bt(n)}class Jz extends Pe{get methods(){return{clean:(e,t)=>this.clean(e,t)}}clean(e,t){return ea(e,t)}}class Qz extends Pe{get methods(){return{save:()=>this.save()}}save(){const e="Editor's content can not be saved in read-only mode";return this.Editor.ReadOnly.isEnabled?(uo(e,"warn"),Promise.reject(new Error(e))):this.Editor.Saver.save()}}class e$ extends Pe{constructor(){super(...arguments),this.selectionUtils=new _e}get methods(){return{findParentTag:(e,t)=>this.findParentTag(e,t),expandToTag:e=>this.expandToTag(e),save:()=>this.selectionUtils.save(),restore:()=>this.selectionUtils.restore(),setFakeBackground:()=>this.selectionUtils.setFakeBackground(),removeFakeBackground:()=>this.selectionUtils.removeFakeBackground()}}findParentTag(e,t){return this.selectionUtils.findParentTag(e,t)}expandToTag(e){this.selectionUtils.expandToTag(e)}}class t$ extends Pe{get methods(){return{getBlockTools:()=>Array.from(this.Editor.Tools.blockTools.values())}}}class n$ extends Pe{get classes(){return{block:"cdx-block",inlineToolButton:"ce-inline-tool",inlineToolButtonActive:"ce-inline-tool--active",input:"cdx-input",loader:"cdx-loader",button:"cdx-button",settingsButton:"cdx-settings-button",settingsButtonActive:"cdx-settings-button--active"}}}class o$ extends Pe{get methods(){return{close:()=>this.close(),open:()=>this.open(),toggleBlockSettings:e=>this.toggleBlockSettings(e),toggleToolbox:e=>this.toggleToolbox(e)}}open(){this.Editor.Toolbar.moveAndOpen()}close(){this.Editor.Toolbar.close()}toggleBlockSettings(e){if(this.Editor.BlockManager.currentBlockIndex===-1){uo("Could't toggle the Toolbar because there is no block selected ","warn");return}e??!this.Editor.BlockSettings.opened?(this.Editor.Toolbar.moveAndOpen(),this.Editor.BlockSettings.open()):this.Editor.BlockSettings.close()}toggleToolbox(e){if(this.Editor.BlockManager.currentBlockIndex===-1){uo("Could't toggle the Toolbox because there is no block selected ","warn");return}e??!this.Editor.Toolbar.toolbox.opened?(this.Editor.Toolbar.moveAndOpen(),this.Editor.Toolbar.toolbox.open()):this.Editor.Toolbar.toolbox.close()}}var jv={exports:{}};(function(n,e){(function(t,o){n.exports=o()})(window,function(){return(function(t){var o={};function a(i){if(o[i])return o[i].exports;var r=o[i]={i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,a),r.l=!0,r.exports}return a.m=t,a.c=o,a.d=function(i,r,s){a.o(i,r)||Object.defineProperty(i,r,{enumerable:!0,get:s})},a.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},a.t=function(i,r){if(1&r&&(i=a(i)),8&r||4&r&&typeof i=="object"&&i&&i.__esModule)return i;var s=Object.create(null);if(a.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:i}),2&r&&typeof i!="string")for(var l in i)a.d(s,l,(function(d){return i[d]}).bind(null,l));return s},a.n=function(i){var r=i&&i.__esModule?function(){return i.default}:function(){return i};return a.d(r,"a",r),r},a.o=function(i,r){return Object.prototype.hasOwnProperty.call(i,r)},a.p="",a(a.s=0)})([function(t,o,a){t.exports=a(1)},function(t,o,a){a.r(o),a.d(o,"default",function(){return i});class i{constructor(){this.nodes={wrapper:null,content:null},this.showed=!1,this.offsetTop=10,this.offsetLeft=10,this.offsetRight=10,this.hidingDelay=0,this.handleWindowScroll=()=>{this.showed&&this.hide(!0)},this.loadStyles(),this.prepare(),window.addEventListener("scroll",this.handleWindowScroll,{passive:!0})}get CSS(){return{tooltip:"ct",tooltipContent:"ct__content",tooltipShown:"ct--shown",placement:{left:"ct--left",bottom:"ct--bottom",right:"ct--right",top:"ct--top"}}}show(s,l,d){this.nodes.wrapper||this.prepare(),this.hidingTimeout&&clearTimeout(this.hidingTimeout);const u=Object.assign({placement:"bottom",marginTop:0,marginLeft:0,marginRight:0,marginBottom:0,delay:70,hidingDelay:0},d);if(u.hidingDelay&&(this.hidingDelay=u.hidingDelay),this.nodes.content.innerHTML="",typeof l=="string")this.nodes.content.appendChild(document.createTextNode(l));else{if(!(l instanceof Node))throw Error("[CodeX Tooltip] Wrong type of «content» passed. It should be an instance of Node or String. But "+typeof l+" given.");this.nodes.content.appendChild(l)}switch(this.nodes.wrapper.classList.remove(...Object.values(this.CSS.placement)),u.placement){case"top":this.placeTop(s,u);break;case"left":this.placeLeft(s,u);break;case"right":this.placeRight(s,u);break;default:this.placeBottom(s,u)}u&&u.delay?this.showingTimeout=setTimeout(()=>{this.nodes.wrapper.classList.add(this.CSS.tooltipShown),this.showed=!0},u.delay):(this.nodes.wrapper.classList.add(this.CSS.tooltipShown),this.showed=!0)}hide(s=!1){if(this.hidingDelay&&!s)return this.hidingTimeout&&clearTimeout(this.hidingTimeout),void(this.hidingTimeout=setTimeout(()=>{this.hide(!0)},this.hidingDelay));this.nodes.wrapper.classList.remove(this.CSS.tooltipShown),this.showed=!1,this.showingTimeout&&clearTimeout(this.showingTimeout)}onHover(s,l,d){s.addEventListener("mouseenter",()=>{this.show(s,l,d)}),s.addEventListener("mouseleave",()=>{this.hide()})}destroy(){this.nodes.wrapper.remove(),window.removeEventListener("scroll",this.handleWindowScroll)}prepare(){this.nodes.wrapper=this.make("div",this.CSS.tooltip),this.nodes.content=this.make("div",this.CSS.tooltipContent),this.append(this.nodes.wrapper,this.nodes.content),this.append(document.body,this.nodes.wrapper)}loadStyles(){const s="codex-tooltips-style";if(document.getElementById(s))return;const l=a(2),d=this.make("style",null,{textContent:l.toString(),id:s});this.prepend(document.head,d)}placeBottom(s,l){const d=s.getBoundingClientRect(),u=d.left+s.clientWidth/2-this.nodes.wrapper.offsetWidth/2,p=d.bottom+window.pageYOffset+this.offsetTop+l.marginTop;this.applyPlacement("bottom",u,p)}placeTop(s,l){const d=s.getBoundingClientRect(),u=d.left+s.clientWidth/2-this.nodes.wrapper.offsetWidth/2,p=d.top+window.pageYOffset-this.nodes.wrapper.clientHeight-this.offsetTop;this.applyPlacement("top",u,p)}placeLeft(s,l){const d=s.getBoundingClientRect(),u=d.left-this.nodes.wrapper.offsetWidth-this.offsetLeft-l.marginLeft,p=d.top+window.pageYOffset+s.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("left",u,p)}placeRight(s,l){const d=s.getBoundingClientRect(),u=d.right+this.offsetRight+l.marginRight,p=d.top+window.pageYOffset+s.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("right",u,p)}applyPlacement(s,l,d){this.nodes.wrapper.classList.add(this.CSS.placement[s]),this.nodes.wrapper.style.left=l+"px",this.nodes.wrapper.style.top=d+"px"}make(s,l=null,d={}){const u=document.createElement(s);Array.isArray(l)?u.classList.add(...l):l&&u.classList.add(l);for(const p in d)d.hasOwnProperty(p)&&(u[p]=d[p]);return u}append(s,l){Array.isArray(l)?l.forEach(d=>s.appendChild(d)):s.appendChild(l)}prepend(s,l){Array.isArray(l)?(l=l.reverse()).forEach(d=>s.prepend(d)):s.prepend(l)}}},function(t,o){t.exports=`.ct{z-index:999;opacity:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;-webkit-transition:opacity 50ms ease-in,-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,transform 70ms cubic-bezier(.215,.61,.355,1),-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);will-change:opacity,top,left;-webkit-box-shadow:0 8px 12px 0 rgba(29,32,43,.17),0 4px 5px -3px rgba(5,6,12,.49);box-shadow:0 8px 12px 0 rgba(29,32,43,.17),0 4px 5px -3px rgba(5,6,12,.49);border-radius:9px}.ct,.ct:before{position:absolute;top:0;left:0}.ct:before{content:"";bottom:0;right:0;background-color:#1d202b;z-index:-1;border-radius:4px}@supports(-webkit-mask-box-image:url("")){.ct:before{border-radius:0;-webkit-mask-box-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M10.71 0h2.58c3.02 0 4.64.42 6.1 1.2a8.18 8.18 0 013.4 3.4C23.6 6.07 24 7.7 24 10.71v2.58c0 3.02-.42 4.64-1.2 6.1a8.18 8.18 0 01-3.4 3.4c-1.47.8-3.1 1.21-6.11 1.21H10.7c-3.02 0-4.64-.42-6.1-1.2a8.18 8.18 0 01-3.4-3.4C.4 17.93 0 16.3 0 13.29V10.7c0-3.02.42-4.64 1.2-6.1a8.18 8.18 0 013.4-3.4C6.07.4 7.7 0 10.71 0z"/></svg>') 48% 41% 37.9% 53.3%}}@media (--mobile){.ct{display:none}}.ct__content{padding:6px 10px;color:#cdd1e0;font-size:12px;text-align:center;letter-spacing:.02em;line-height:1em}.ct:after{content:"";width:8px;height:8px;position:absolute;background-color:#1d202b;z-index:-1}.ct--bottom{-webkit-transform:translateY(5px);transform:translateY(5px)}.ct--bottom:after{top:-3px;left:50%;-webkit-transform:translateX(-50%) rotate(-45deg);transform:translateX(-50%) rotate(-45deg)}.ct--top{-webkit-transform:translateY(-5px);transform:translateY(-5px)}.ct--top:after{top:auto;bottom:-3px;left:50%;-webkit-transform:translateX(-50%) rotate(-45deg);transform:translateX(-50%) rotate(-45deg)}.ct--left{-webkit-transform:translateX(-5px);transform:translateX(-5px)}.ct--left:after{top:50%;left:auto;right:0;-webkit-transform:translate(41.6%,-50%) rotate(-45deg);transform:translate(41.6%,-50%) rotate(-45deg)}.ct--right{-webkit-transform:translateX(5px);transform:translateX(5px)}.ct--right:after{top:50%;left:0;-webkit-transform:translate(-41.6%,-50%) rotate(-45deg);transform:translate(-41.6%,-50%) rotate(-45deg)}.ct--shown{opacity:1;-webkit-transform:none;transform:none}`}]).default})})(jv);var a$=jv.exports;const i$=x0(a$);let Io=null;function sm(){Io||(Io=new i$)}function r$(n,e,t){sm(),Io?.show(n,e,t)}function S0(n=!1){sm(),Io?.hide(n)}function I0(n,e,t){sm(),Io?.onHover(n,e,t)}function s$(){Io?.destroy(),Io=null}class l$ extends Pe{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t})}get methods(){return{show:(e,t,o)=>this.show(e,t,o),hide:()=>this.hide(),onHover:(e,t,o)=>this.onHover(e,t,o)}}show(e,t,o){r$(e,t,o)}hide(){S0()}onHover(e,t,o){I0(e,t,o)}}class c$ extends Pe{get methods(){return{nodes:this.editorNodes}}get editorNodes(){return{wrapper:this.Editor.UI.nodes.wrapper,redactor:this.Editor.UI.nodes.redactor}}}function _v(n,e){const t={};return Object.entries(n).forEach(([o,a])=>{if(tn(a)){const i=e?`${e}.${o}`:o;Object.values(a).every(r=>xa(r))?t[o]=i:t[o]=_v(a,i);return}t[o]=a}),t}const Un=_v(uv);function d$(n,e){const t={};return Object.keys(n).forEach(o=>{const a=e[o];a!==void 0?t[a]=n[o]:t[o]=n[o]}),t}const xv=class w2{constructor(e,t){this.cursor=-1,this.items=[],this.items=e||[],this.focusedCssClass=t}get currentItem(){return this.cursor===-1?null:this.items[this.cursor]}setCursor(e){e<this.items.length&&e>=-1&&(this.dropCursor(),this.cursor=e,this.items[this.cursor].classList.add(this.focusedCssClass))}setItems(e){this.items=e}next(){this.cursor=this.leafNodesAndReturnIndex(w2.directions.RIGHT)}previous(){this.cursor=this.leafNodesAndReturnIndex(w2.directions.LEFT)}dropCursor(){this.cursor!==-1&&(this.items[this.cursor].classList.remove(this.focusedCssClass),this.cursor=-1)}leafNodesAndReturnIndex(e){if(this.items.length===0)return this.cursor;let t=this.cursor;return t===-1?t=e===w2.directions.RIGHT?-1:0:this.items[t].classList.remove(this.focusedCssClass),e===w2.directions.RIGHT?t=(t+1)%this.items.length:t=(this.items.length+t-1)%this.items.length,Y.canSetCaret(this.items[t])&&D0(()=>_e.setCursor(this.items[t]),50)(),this.items[t].classList.add(this.focusedCssClass),t}};xv.directions={RIGHT:"right",LEFT:"left"};let tc=xv,M0=class s6{constructor(e){this.iterator=null,this.activated=!1,this.flipCallbacks=[],this.onKeyDown=t=>{if(!(!this.isEventReadyForHandling(t)||t.shiftKey===!0))switch(s6.usedKeys.includes(t.keyCode)&&t.preventDefault(),t.keyCode){case Fe.TAB:this.handleTabPress(t);break;case Fe.LEFT:case Fe.UP:this.flipLeft();break;case Fe.RIGHT:case Fe.DOWN:this.flipRight();break;case Fe.ENTER:this.handleEnterPress(t);break}},this.iterator=new tc(e.items,e.focusedItemClass),this.activateCallback=e.activateCallback,this.allowedKeys=e.allowedKeys||s6.usedKeys}get isActivated(){return this.activated}static get usedKeys(){return[Fe.TAB,Fe.LEFT,Fe.RIGHT,Fe.ENTER,Fe.UP,Fe.DOWN]}activate(e,t){this.activated=!0,e&&this.iterator.setItems(e),t!==void 0&&this.iterator.setCursor(t),document.addEventListener("keydown",this.onKeyDown,!0)}deactivate(){this.activated=!1,this.dropCursor(),document.removeEventListener("keydown",this.onKeyDown)}focusFirst(){this.dropCursor(),this.flipRight()}flipLeft(){this.iterator.previous(),this.flipCallback()}flipRight(){this.iterator.next(),this.flipCallback()}hasFocus(){return!!this.iterator.currentItem}onFlip(e){this.flipCallbacks.push(e)}removeOnFlip(e){this.flipCallbacks=this.flipCallbacks.filter(t=>t!==e)}dropCursor(){this.iterator.dropCursor()}isEventReadyForHandling(e){return this.activated&&this.allowedKeys.includes(e.keyCode)}handleTabPress(e){switch(e.shiftKey?tc.directions.LEFT:tc.directions.RIGHT){case tc.directions.RIGHT:this.flipRight();break;case tc.directions.LEFT:this.flipLeft();break}}handleEnterPress(e){this.activated&&(this.iterator.currentItem&&(e.stopPropagation(),e.preventDefault(),this.iterator.currentItem.click()),bt(this.activateCallback)&&this.activateCallback(this.iterator.currentItem))}flipCallback(){this.iterator.currentItem&&this.iterator.currentItem.scrollIntoViewIfNeeded(),this.flipCallbacks.forEach(e=>e())}};const u$='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9 12L9 7.1C9 7.04477 9.04477 7 9.1 7H10.4C11.5 7 14 7.1 14 9.5C14 9.5 14 12 11 12M9 12V16.8C9 16.9105 9.08954 17 9.2 17H12.5C14 17 15 16 15 14.5C15 11.7046 11 12 11 12M9 12H11"/></svg>',p$='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7 10L11.8586 14.8586C11.9367 14.9367 12.0633 14.9367 12.1414 14.8586L17 10"/></svg>',m$='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M14.5 17.5L9.64142 12.6414C9.56331 12.5633 9.56331 12.4367 9.64142 12.3586L14.5 7.5"/></svg>',h$='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9.58284 17.5L14.4414 12.6414C14.5195 12.5633 14.5195 12.4367 14.4414 12.3586L9.58284 7.5"/></svg>',f$='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7 15L11.8586 10.1414C11.9367 10.0633 12.0633 10.0633 12.1414 10.1414L17 15"/></svg>',g$='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 8L12 12M12 12L16 16M12 12L16 8M12 12L8 16"/></svg>',v$='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><circle cx="12" cy="12" r="4" stroke="currentColor" stroke-width="2"/></svg>',b$='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M13.34 10C12.4223 12.7337 11 17 11 17"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M14.21 7H14.2"/></svg>',Dv='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7.69998 12.6L7.67896 12.62C6.53993 13.7048 6.52012 15.5155 7.63516 16.625V16.625C8.72293 17.7073 10.4799 17.7102 11.5712 16.6314L13.0263 15.193C14.0703 14.1609 14.2141 12.525 13.3662 11.3266L13.22 11.12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16.22 11.12L16.3564 10.9805C17.2895 10.0265 17.3478 8.5207 16.4914 7.49733V7.49733C15.5691 6.39509 13.9269 6.25143 12.8271 7.17675L11.3901 8.38588C10.0935 9.47674 9.95706 11.4241 11.0888 12.6852L11.12 12.72"/></svg>',y$='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.40999 7.29999H9.4"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 7.29999H14.59"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.30999 12H9.3"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 12H14.59"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.40999 16.7H9.4"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 16.7H14.59"/></svg>',C$='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12 7V12M12 17V12M17 12H12M12 12H7"/></svg>',Fv='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M11.5 17.5L5 11M5 11V15.5M5 11H9.5"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12.5 6.5L19 13M19 13V8.5M19 13H14.5"/></svg>',k$='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><circle cx="10.5" cy="10.5" r="5.5" stroke="currentColor" stroke-width="2"/><line x1="15.4142" x2="19" y1="15" y2="18.5858" stroke="currentColor" stroke-linecap="round" stroke-width="2"/></svg>',w$='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M15.7795 11.5C15.7795 11.5 16.053 11.1962 16.5497 10.6722C17.4442 9.72856 17.4701 8.2475 16.5781 7.30145V7.30145C15.6482 6.31522 14.0873 6.29227 13.1288 7.25073L11.8796 8.49999"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8.24517 12.3883C8.24517 12.3883 7.97171 12.6922 7.47504 13.2161C6.58051 14.1598 6.55467 15.6408 7.44666 16.5869V16.5869C8.37653 17.5731 9.93744 17.5961 10.8959 16.6376L12.1452 15.3883"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M17.7802 15.1032L16.597 14.9422C16.0109 14.8624 15.4841 15.3059 15.4627 15.8969L15.4199 17.0818"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6.39064 9.03238L7.58432 9.06668C8.17551 9.08366 8.6522 8.58665 8.61056 7.99669L8.5271 6.81397"/><line x1="12.1142" x2="11.7" y1="12.2" y2="11.7858" stroke="currentColor" stroke-linecap="round" stroke-width="2"/></svg>',j$='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/><line x1="12" x2="12" y1="9" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12 15.02V15.01"/></svg>',_$="__",x$="--";function di(n){return(e,t)=>[[n,e].filter(o=>!!o).join(_$),t].filter(o=>!!o).join(x$)}const nc=di("ce-hint"),oc={root:nc(),alignedStart:nc(null,"align-left"),alignedCenter:nc(null,"align-center"),title:nc("title"),description:nc("description")};class D${constructor(e){this.nodes={root:Y.make("div",[oc.root,e.alignment==="center"?oc.alignedCenter:oc.alignedStart]),title:Y.make("div",oc.title,{textContent:e.title})},this.nodes.root.appendChild(this.nodes.title),e.description!==void 0&&(this.nodes.description=Y.make("div",oc.description,{textContent:e.description}),this.nodes.root.appendChild(this.nodes.description))}getElement(){return this.nodes.root}}let lm=class{constructor(e){this.params=e}get name(){if(this.params!==void 0&&"name"in this.params)return this.params.name}destroy(){S0()}onChildrenOpen(){var e;this.params!==void 0&&"children"in this.params&&typeof((e=this.params.children)==null?void 0:e.onOpen)=="function"&&this.params.children.onOpen()}onChildrenClose(){var e;this.params!==void 0&&"children"in this.params&&typeof((e=this.params.children)==null?void 0:e.onClose)=="function"&&this.params.children.onClose()}handleClick(){var e,t;this.params!==void 0&&"onActivate"in this.params&&((t=(e=this.params).onActivate)==null||t.call(e,this.params))}addHint(e,t){const o=new D$(t);I0(e,o.getElement(),{placement:t.position,hidingDelay:100})}get children(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.items)!==void 0?this.params.children.items:[]}get hasChildren(){return this.children.length>0}get isChildrenOpen(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.isOpen)===!0}get isChildrenFlippable(){var e;return!(this.params===void 0||!("children"in this.params)||((e=this.params.children)==null?void 0:e.isFlippable)===!1)}get isChildrenSearchable(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.searchable)===!0}get closeOnActivate(){return this.params!==void 0&&"closeOnActivate"in this.params&&this.params.closeOnActivate}get isActive(){return this.params===void 0||!("isActive"in this.params)?!1:typeof this.params.isActive=="function"?this.params.isActive():this.params.isActive===!0}};const qn=di("ce-popover-item"),kt={container:qn(),active:qn(null,"active"),disabled:qn(null,"disabled"),focused:qn(null,"focused"),hidden:qn(null,"hidden"),confirmationState:qn(null,"confirmation"),noHover:qn(null,"no-hover"),noFocus:qn(null,"no-focus"),title:qn("title"),secondaryTitle:qn("secondary-title"),icon:qn("icon"),iconTool:qn("icon","tool"),iconChevronRight:qn("icon","chevron-right"),wobbleAnimation:di("wobble")()};let sr=class extends lm{constructor(e,t){super(e),this.params=e,this.nodes={root:null,icon:null},this.confirmationState=null,this.removeSpecialFocusBehavior=()=>{var o;(o=this.nodes.root)==null||o.classList.remove(kt.noFocus)},this.removeSpecialHoverBehavior=()=>{var o;(o=this.nodes.root)==null||o.classList.remove(kt.noHover)},this.onErrorAnimationEnd=()=>{var o,a;(o=this.nodes.icon)==null||o.classList.remove(kt.wobbleAnimation),(a=this.nodes.icon)==null||a.removeEventListener("animationend",this.onErrorAnimationEnd)},this.nodes.root=this.make(e,t)}get isDisabled(){return this.params.isDisabled===!0}get toggle(){return this.params.toggle}get title(){return this.params.title}get isConfirmationStateEnabled(){return this.confirmationState!==null}get isFocused(){return this.nodes.root===null?!1:this.nodes.root.classList.contains(kt.focused)}getElement(){return this.nodes.root}handleClick(){if(this.isConfirmationStateEnabled&&this.confirmationState!==null){this.activateOrEnableConfirmationMode(this.confirmationState);return}this.activateOrEnableConfirmationMode(this.params)}toggleActive(e){var t;(t=this.nodes.root)==null||t.classList.toggle(kt.active,e)}toggleHidden(e){var t;(t=this.nodes.root)==null||t.classList.toggle(kt.hidden,e)}reset(){this.isConfirmationStateEnabled&&this.disableConfirmationMode()}onFocus(){this.disableSpecialHoverAndFocusBehavior()}make(e,t){var o,a;const i=t?.wrapperTag||"div",r=Y.make(i,kt.container,{type:i==="button"?"button":void 0});return e.name&&(r.dataset.itemName=e.name),this.nodes.icon=Y.make("div",[kt.icon,kt.iconTool],{innerHTML:e.icon||v$}),r.appendChild(this.nodes.icon),e.title!==void 0&&r.appendChild(Y.make("div",kt.title,{innerHTML:e.title||""})),e.secondaryLabel&&r.appendChild(Y.make("div",kt.secondaryTitle,{textContent:e.secondaryLabel})),this.hasChildren&&r.appendChild(Y.make("div",[kt.icon,kt.iconChevronRight],{innerHTML:h$})),this.isActive&&r.classList.add(kt.active),e.isDisabled&&r.classList.add(kt.disabled),e.hint!==void 0&&((o=t?.hint)==null?void 0:o.enabled)!==!1&&this.addHint(r,{...e.hint,position:((a=t?.hint)==null?void 0:a.position)||"right"}),r}enableConfirmationMode(e){if(this.nodes.root===null)return;const t={...this.params,...e,confirmation:"confirmation"in e?e.confirmation:void 0},o=this.make(t);this.nodes.root.innerHTML=o.innerHTML,this.nodes.root.classList.add(kt.confirmationState),this.confirmationState=e,this.enableSpecialHoverAndFocusBehavior()}disableConfirmationMode(){if(this.nodes.root===null)return;const e=this.make(this.params);this.nodes.root.innerHTML=e.innerHTML,this.nodes.root.classList.remove(kt.confirmationState),this.confirmationState=null,this.disableSpecialHoverAndFocusBehavior()}enableSpecialHoverAndFocusBehavior(){var e,t,o;(e=this.nodes.root)==null||e.classList.add(kt.noHover),(t=this.nodes.root)==null||t.classList.add(kt.noFocus),(o=this.nodes.root)==null||o.addEventListener("mouseleave",this.removeSpecialHoverBehavior,{once:!0})}disableSpecialHoverAndFocusBehavior(){var e;this.removeSpecialFocusBehavior(),this.removeSpecialHoverBehavior(),(e=this.nodes.root)==null||e.removeEventListener("mouseleave",this.removeSpecialHoverBehavior)}activateOrEnableConfirmationMode(e){var t;if(!("confirmation"in e)||e.confirmation===void 0)try{(t=e.onActivate)==null||t.call(e,e),this.disableConfirmationMode()}catch{this.animateError()}else this.enableConfirmationMode(e.confirmation)}animateError(){var e,t,o;(e=this.nodes.icon)!=null&&e.classList.contains(kt.wobbleAnimation)||((t=this.nodes.icon)==null||t.classList.add(kt.wobbleAnimation),(o=this.nodes.icon)==null||o.addEventListener("animationend",this.onErrorAnimationEnd))}};const cm=di("ce-popover-item-separator"),dm={container:cm(),line:cm("line"),hidden:cm(null,"hidden")};class Ev extends lm{constructor(){super(),this.nodes={root:Y.make("div",dm.container),line:Y.make("div",dm.line)},this.nodes.root.appendChild(this.nodes.line)}getElement(){return this.nodes.root}toggleHidden(e){var t;(t=this.nodes.root)==null||t.classList.toggle(dm.hidden,e)}}var ta=(n=>(n.Closed="closed",n.ClosedOnActivate="closed-on-activate",n))(ta||{});const _n=di("ce-popover"),Mt={popover:_n(),popoverContainer:_n("container"),popoverOpenTop:_n(null,"open-top"),popoverOpenLeft:_n(null,"open-left"),popoverOpened:_n(null,"opened"),search:_n("search"),nothingFoundMessage:_n("nothing-found-message"),nothingFoundMessageDisplayed:_n("nothing-found-message","displayed"),items:_n("items"),overlay:_n("overlay"),overlayHidden:_n("overlay","hidden"),popoverNested:_n(null,"nested"),getPopoverNestedClass:n=>_n(null,`nested-level-${n.toString()}`),popoverInline:_n(null,"inline"),popoverHeader:_n("header")};var ms=(n=>(n.NestingLevel="--nesting-level",n.PopoverHeight="--popover-height",n.InlinePopoverWidth="--inline-popover-width",n.TriggerItemLeft="--trigger-item-left",n.TriggerItemTop="--trigger-item-top",n))(ms||{});const Sv=di("ce-popover-item-html"),Iv={root:Sv(),hidden:Sv(null,"hidden")};let ac=class extends lm{constructor(e,t){var o,a;super(e),this.nodes={root:Y.make("div",Iv.root)},this.nodes.root.appendChild(e.element),e.name&&(this.nodes.root.dataset.itemName=e.name),e.hint!==void 0&&((o=t?.hint)==null?void 0:o.enabled)!==!1&&this.addHint(this.nodes.root,{...e.hint,position:((a=t?.hint)==null?void 0:a.position)||"right"})}getElement(){return this.nodes.root}toggleHidden(e){var t;(t=this.nodes.root)==null||t.classList.toggle(Iv.hidden,e)}getControls(){const e=this.nodes.root.querySelectorAll(`button, ${Y.allInputsSelector}`);return Array.from(e)}};class Mv extends Jl{constructor(e,t={}){super(),this.params=e,this.itemsRenderParams=t,this.listeners=new Ql,this.messages={nothingFound:"Nothing found",search:"Search"},this.items=this.buildItems(e.items),e.messages&&(this.messages={...this.messages,...e.messages}),this.nodes={},this.nodes.popoverContainer=Y.make("div",[Mt.popoverContainer]),this.nodes.nothingFoundMessage=Y.make("div",[Mt.nothingFoundMessage],{textContent:this.messages.nothingFound}),this.nodes.popoverContainer.appendChild(this.nodes.nothingFoundMessage),this.nodes.items=Y.make("div",[Mt.items]),this.items.forEach(o=>{const a=o.getElement();a!==null&&this.nodes.items.appendChild(a)}),this.nodes.popoverContainer.appendChild(this.nodes.items),this.listeners.on(this.nodes.popoverContainer,"click",o=>this.handleClick(o)),this.nodes.popover=Y.make("div",[Mt.popover,this.params.class]),this.nodes.popover.appendChild(this.nodes.popoverContainer)}get itemsDefault(){return this.items.filter(e=>e instanceof sr)}getElement(){return this.nodes.popover}show(){this.nodes.popover.classList.add(Mt.popoverOpened),this.search!==void 0&&this.search.focus()}hide(){this.nodes.popover.classList.remove(Mt.popoverOpened),this.nodes.popover.classList.remove(Mt.popoverOpenTop),this.itemsDefault.forEach(e=>e.reset()),this.search!==void 0&&this.search.clear(),this.emit(ta.Closed)}destroy(){var e;this.items.forEach(t=>t.destroy()),this.nodes.popover.remove(),this.listeners.removeAll(),(e=this.search)==null||e.destroy()}activateItemByName(e){const t=this.items.find(o=>o.name===e);this.handleItemClick(t)}buildItems(e){return e.map(t=>{switch(t.type){case ut.Separator:return new Ev;case ut.Html:return new ac(t,this.itemsRenderParams[ut.Html]);default:return new sr(t,this.itemsRenderParams[ut.Default])}})}getTargetItem(e){return this.items.filter(t=>t instanceof sr||t instanceof ac).find(t=>{const o=t.getElement();return o===null?!1:e.composedPath().includes(o)})}handleItemClick(e){if(!("isDisabled"in e&&e.isDisabled)){if(e.hasChildren){this.showNestedItems(e),"handleClick"in e&&typeof e.handleClick=="function"&&e.handleClick();return}this.itemsDefault.filter(t=>t!==e).forEach(t=>t.reset()),"handleClick"in e&&typeof e.handleClick=="function"&&e.handleClick(),this.toggleItemActivenessIfNeeded(e),e.closeOnActivate&&(this.hide(),this.emit(ta.ClosedOnActivate))}}handleClick(e){const t=this.getTargetItem(e);t!==void 0&&this.handleItemClick(t)}toggleItemActivenessIfNeeded(e){if(e instanceof sr&&(e.toggle===!0&&e.toggleActive(),typeof e.toggle=="string")){const t=this.itemsDefault.filter(o=>o.toggle===e.toggle);if(t.length===1){e.toggleActive();return}t.forEach(o=>{o.toggleActive(o===e)})}}}var B0=(n=>(n.Search="search",n))(B0||{});const um=di("cdx-search-field"),pm={wrapper:um(),icon:um("icon"),input:um("input")};class F$ extends Jl{constructor({items:e,placeholder:t}){super(),this.listeners=new Ql,this.items=e,this.wrapper=Y.make("div",pm.wrapper);const o=Y.make("div",pm.icon,{innerHTML:k$});this.input=Y.make("input",pm.input,{placeholder:t,tabIndex:-1}),this.wrapper.appendChild(o),this.wrapper.appendChild(this.input),this.listeners.on(this.input,"input",()=>{this.searchQuery=this.input.value,this.emit(B0.Search,{query:this.searchQuery,items:this.foundItems})})}getElement(){return this.wrapper}focus(){this.input.focus()}clear(){this.input.value="",this.searchQuery="",this.emit(B0.Search,{query:"",items:this.foundItems})}destroy(){this.listeners.removeAll()}get foundItems(){return this.items.filter(e=>this.checkItem(e))}checkItem(e){var t,o;const a=((t=e.title)==null?void 0:t.toLowerCase())||"",i=(o=this.searchQuery)==null?void 0:o.toLowerCase();return i!==void 0?a.includes(i):!1}}var E$=Object.defineProperty,S$=Object.getOwnPropertyDescriptor,I$=(n,e,t,o)=>{for(var a=S$(e,t),i=n.length-1,r;i>=0;i--)(r=n[i])&&(a=r(e,t,a)||a);return a&&E$(e,t,a),a};const Bv=class Sx extends Mv{constructor(e,t){super(e,t),this.nestingLevel=0,this.nestedPopoverTriggerItem=null,this.previouslyHoveredItem=null,this.scopeElement=document.body,this.hide=()=>{var o;super.hide(),this.destroyNestedPopoverIfExists(),(o=this.flipper)==null||o.deactivate(),this.previouslyHoveredItem=null},this.onFlip=()=>{const o=this.itemsDefault.find(a=>a.isFocused);o?.onFocus()},this.onSearch=o=>{var a;const i=o.query==="",r=o.items.length===0;this.items.forEach(l=>{let d=!1;l instanceof sr?d=!o.items.includes(l):(l instanceof Ev||l instanceof ac)&&(d=r||!i),l.toggleHidden(d)}),this.toggleNothingFoundMessage(r);const s=o.query===""?this.flippableElements:o.items.map(l=>l.getElement());(a=this.flipper)!=null&&a.isActivated&&(this.flipper.deactivate(),this.flipper.activate(s))},e.nestingLevel!==void 0&&(this.nestingLevel=e.nestingLevel),this.nestingLevel>0&&this.nodes.popover.classList.add(Mt.popoverNested),e.scopeElement!==void 0&&(this.scopeElement=e.scopeElement),this.nodes.popoverContainer!==null&&this.listeners.on(this.nodes.popoverContainer,"mouseover",o=>this.handleHover(o)),e.searchable&&this.addSearch(),e.flippable!==!1&&(this.flipper=new M0({items:this.flippableElements,focusedItemClass:kt.focused,allowedKeys:[Fe.TAB,Fe.UP,Fe.DOWN,Fe.ENTER]}),this.flipper.onFlip(this.onFlip))}hasFocus(){return this.flipper===void 0?!1:this.flipper.hasFocus()}get scrollTop(){return this.nodes.items===null?0:this.nodes.items.scrollTop}get offsetTop(){return this.nodes.popoverContainer===null?0:this.nodes.popoverContainer.offsetTop}show(){var e;this.nodes.popover.style.setProperty(ms.PopoverHeight,this.size.height+"px"),this.shouldOpenBottom||this.nodes.popover.classList.add(Mt.popoverOpenTop),this.shouldOpenRight||this.nodes.popover.classList.add(Mt.popoverOpenLeft),super.show(),(e=this.flipper)==null||e.activate(this.flippableElements)}destroy(){this.hide(),super.destroy()}showNestedItems(e){this.nestedPopover!==null&&this.nestedPopover!==void 0||(this.nestedPopoverTriggerItem=e,this.showNestedPopoverForItem(e))}handleHover(e){const t=this.getTargetItem(e);t!==void 0&&this.previouslyHoveredItem!==t&&(this.destroyNestedPopoverIfExists(),this.previouslyHoveredItem=t,t.hasChildren&&this.showNestedPopoverForItem(t))}setTriggerItemPosition(e,t){const o=t.getElement(),a=(o?o.offsetTop:0)-this.scrollTop,i=this.offsetTop+a;e.style.setProperty(ms.TriggerItemTop,i+"px")}destroyNestedPopoverIfExists(){var e,t;this.nestedPopover===void 0||this.nestedPopover===null||(this.nestedPopover.off(ta.ClosedOnActivate,this.hide),this.nestedPopover.hide(),this.nestedPopover.destroy(),this.nestedPopover.getElement().remove(),this.nestedPopover=null,(e=this.flipper)==null||e.activate(this.flippableElements),(t=this.nestedPopoverTriggerItem)==null||t.onChildrenClose())}showNestedPopoverForItem(e){var t;this.nestedPopover=new Sx({searchable:e.isChildrenSearchable,items:e.children,nestingLevel:this.nestingLevel+1,flippable:e.isChildrenFlippable,messages:this.messages}),e.onChildrenOpen(),this.nestedPopover.on(ta.ClosedOnActivate,this.hide);const o=this.nestedPopover.getElement();return this.nodes.popover.appendChild(o),this.setTriggerItemPosition(o,e),o.style.setProperty(ms.NestingLevel,this.nestedPopover.nestingLevel.toString()),this.nestedPopover.show(),(t=this.flipper)==null||t.deactivate(),this.nestedPopover}get shouldOpenBottom(){if(this.nodes.popover===void 0||this.nodes.popover===null)return!1;const e=this.nodes.popoverContainer.getBoundingClientRect(),t=this.scopeElement.getBoundingClientRect(),o=this.size.height,a=e.top+o,i=e.top-o,r=Math.min(window.innerHeight,t.bottom);return i<t.top||a<=r}get shouldOpenRight(){if(this.nodes.popover===void 0||this.nodes.popover===null)return!1;const e=this.nodes.popover.getBoundingClientRect(),t=this.scopeElement.getBoundingClientRect(),o=this.size.width,a=e.right+o,i=e.left-o,r=Math.min(window.innerWidth,t.right);return i<t.left||a<=r}get size(){var e;const t={height:0,width:0};if(this.nodes.popover===null)return t;const o=this.nodes.popover.cloneNode(!0);o.style.visibility="hidden",o.style.position="absolute",o.style.top="-1000px",o.classList.add(Mt.popoverOpened),(e=o.querySelector("."+Mt.popoverNested))==null||e.remove(),document.body.appendChild(o);const a=o.querySelector("."+Mt.popoverContainer);return t.height=a.offsetHeight,t.width=a.offsetWidth,o.remove(),t}get flippableElements(){return this.items.map(e=>{if(e instanceof sr)return e.getElement();if(e instanceof ac)return e.getControls()}).flat().filter(e=>e!=null)}addSearch(){this.search=new F$({items:this.itemsDefault,placeholder:this.messages.search}),this.search.on(B0.Search,this.onSearch);const e=this.search.getElement();e.classList.add(Mt.search),this.nodes.popoverContainer.insertBefore(e,this.nodes.popoverContainer.firstChild)}toggleNothingFoundMessage(e){this.nodes.nothingFoundMessage.classList.toggle(Mt.nothingFoundMessageDisplayed,e)}};I$([us],Bv.prototype,"size");let mm=Bv;class M$ extends mm{constructor(e){const t=!ps();super({...e,class:Mt.popoverInline},{[ut.Default]:{wrapperTag:"button",hint:{position:"top",alignment:"center",enabled:t}},[ut.Html]:{hint:{position:"top",alignment:"center",enabled:t}}}),this.items.forEach(o=>{!(o instanceof sr)&&!(o instanceof ac)||o.hasChildren&&o.isChildrenOpen&&this.showNestedItems(o)})}get offsetLeft(){return this.nodes.popoverContainer===null?0:this.nodes.popoverContainer.offsetLeft}show(){this.nestingLevel===0&&this.nodes.popover.style.setProperty(ms.InlinePopoverWidth,this.size.width+"px"),super.show()}handleHover(){}setTriggerItemPosition(e,t){const o=t.getElement(),a=o?o.offsetLeft:0,i=this.offsetLeft+a;e.style.setProperty(ms.TriggerItemLeft,i+"px")}showNestedItems(e){if(this.nestedPopoverTriggerItem===e){this.destroyNestedPopoverIfExists(),this.nestedPopoverTriggerItem=null;return}super.showNestedItems(e)}showNestedPopoverForItem(e){const t=super.showNestedPopoverForItem(e);return t.getElement().classList.add(Mt.getPopoverNestedClass(t.nestingLevel)),t}handleItemClick(e){var t;e!==this.nestedPopoverTriggerItem&&((t=this.nestedPopoverTriggerItem)==null||t.handleClick(),super.destroyNestedPopoverIfExists()),super.handleItemClick(e)}}const Tv=class j2{constructor(){this.scrollPosition=null}lock(){nm?this.lockHard():document.body.classList.add(j2.CSS.scrollLocked)}unlock(){nm?this.unlockHard():document.body.classList.remove(j2.CSS.scrollLocked)}lockHard(){this.scrollPosition=window.pageYOffset,document.documentElement.style.setProperty("--window-scroll-offset",`${this.scrollPosition}px`),document.body.classList.add(j2.CSS.scrollLockedHard)}unlockHard(){document.body.classList.remove(j2.CSS.scrollLockedHard),this.scrollPosition!==null&&window.scrollTo(0,this.scrollPosition),this.scrollPosition=null}};Tv.CSS={scrollLocked:"ce-scroll-locked",scrollLockedHard:"ce-scroll-locked--hard"};let B$=Tv;const hm=di("ce-popover-header"),fm={root:hm(),text:hm("text"),backButton:hm("back-button")};class T${constructor({text:e,onBackButtonClick:t}){this.listeners=new Ql,this.text=e,this.onBackButtonClick=t,this.nodes={root:Y.make("div",[fm.root]),backButton:Y.make("button",[fm.backButton]),text:Y.make("div",[fm.text])},this.nodes.backButton.innerHTML=m$,this.nodes.root.appendChild(this.nodes.backButton),this.listeners.on(this.nodes.backButton,"click",this.onBackButtonClick),this.nodes.text.innerText=this.text,this.nodes.root.appendChild(this.nodes.text)}getElement(){return this.nodes.root}destroy(){this.nodes.root.remove(),this.listeners.destroy()}}class A${constructor(){this.history=[]}push(e){this.history.push(e)}pop(){return this.history.pop()}get currentTitle(){return this.history.length===0?"":this.history[this.history.length-1].title}get currentItems(){return this.history.length===0?[]:this.history[this.history.length-1].items}reset(){for(;this.history.length>1;)this.pop()}}let Av=class extends Mv{constructor(e){super(e,{[ut.Default]:{hint:{enabled:!1}},[ut.Html]:{hint:{enabled:!1}}}),this.scrollLocker=new B$,this.history=new A$,this.isHidden=!0,this.nodes.overlay=Y.make("div",[Mt.overlay,Mt.overlayHidden]),this.nodes.popover.insertBefore(this.nodes.overlay,this.nodes.popover.firstChild),this.listeners.on(this.nodes.overlay,"click",()=>{this.hide()}),this.history.push({items:e.items})}show(){this.nodes.overlay.classList.remove(Mt.overlayHidden),super.show(),this.scrollLocker.lock(),this.isHidden=!1}hide(){this.isHidden||(super.hide(),this.nodes.overlay.classList.add(Mt.overlayHidden),this.scrollLocker.unlock(),this.history.reset(),this.isHidden=!0)}destroy(){super.destroy(),this.scrollLocker.unlock()}showNestedItems(e){this.updateItemsAndHeader(e.children,e.title),this.history.push({title:e.title,items:e.children})}updateItemsAndHeader(e,t){if(this.header!==null&&this.header!==void 0&&(this.header.destroy(),this.header=null),t!==void 0){this.header=new T$({text:t,onBackButtonClick:()=>{this.history.pop(),this.updateItemsAndHeader(this.history.currentItems,this.history.currentTitle)}});const o=this.header.getElement();o!==null&&this.nodes.popoverContainer.insertBefore(o,this.nodes.popoverContainer.firstChild)}this.items.forEach(o=>{var a;return(a=o.getElement())==null?void 0:a.remove()}),this.items=this.buildItems(e),this.items.forEach(o=>{var a;const i=o.getElement();i!==null&&((a=this.nodes.items)==null||a.appendChild(i))})}};class O$ extends Pe{constructor(){super(...arguments),this.opened=!1,this.hasMobileLayoutToggleListener=!1,this.selection=new _e,this.popover=null,this.close=()=>{this.opened&&(this.opened=!1,_e.isAtEditor||this.selection.restore(),this.selection.clearSaved(),!this.Editor.CrossBlockSelection.isCrossBlockSelectionStarted&&this.Editor.BlockManager.currentBlock&&this.Editor.BlockSelection.unselectBlock(this.Editor.BlockManager.currentBlock),this.eventsDispatcher.emit(this.events.closed),this.popover&&(this.popover.off(ta.Closed,this.onPopoverClose),this.popover.destroy(),this.popover.getElement().remove(),this.popover=null))},this.onPopoverClose=()=>{this.close()}}get events(){return{opened:"block-settings-opened",closed:"block-settings-closed"}}get CSS(){return{settings:"ce-settings"}}get flipper(){var e;if(this.popover!==null)return"flipper"in this.popover?(e=this.popover)==null?void 0:e.flipper:void 0}make(){this.nodes.wrapper=Y.make("div",[this.CSS.settings]),this.eventsDispatcher.on(ec,this.close),this.hasMobileLayoutToggleListener=!0}destroy(){this.removeAllNodes(),this.listeners.destroy(),this.hasMobileLayoutToggleListener&&(this.eventsDispatcher.off(ec,this.close),this.hasMobileLayoutToggleListener=!1)}async open(e=this.Editor.BlockManager.currentBlock){var t;this.opened=!0,this.selection.save(),this.Editor.BlockSelection.selectBlock(e),this.Editor.BlockSelection.clearCache();const{toolTunes:o,commonTunes:a}=e.getTunes();this.eventsDispatcher.emit(this.events.opened);const i=ps()?Av:mm;this.popover=new i({searchable:!0,items:await this.getTunesItems(e,a,o),scopeElement:this.Editor.API.methods.ui.nodes.redactor,messages:{nothingFound:jn.ui(Un.ui.popover,"Nothing found"),search:jn.ui(Un.ui.popover,"Filter")}}),this.popover.on(ta.Closed,this.onPopoverClose),(t=this.nodes.wrapper)==null||t.append(this.popover.getElement()),this.popover.show()}getElement(){return this.nodes.wrapper}async getTunesItems(e,t,o){const a=[];o!==void 0&&o.length>0&&(a.push(...o),a.push({type:ut.Separator}));const i=Array.from(this.Editor.Tools.blockTools.values()),r=(await bv(e,i)).reduce((s,l)=>(l.toolbox.forEach(d=>{s.push({icon:d.icon,title:jn.t(Un.toolNames,d.title),name:l.name,closeOnActivate:!0,onActivate:async()=>{const{BlockManager:u,Caret:p,Toolbar:m}=this.Editor,h=await u.convert(e,l.name,d.data);m.close(),p.setToBlock(h,p.positions.END)}})}),s),[]);return r.length>0&&(a.push({icon:Fv,name:"convert-to",title:jn.ui(Un.ui.popover,"Convert to"),children:{searchable:!0,items:r}}),a.push({type:ut.Separator})),a.push(...t),a.map(s=>this.resolveTuneAliases(s))}resolveTuneAliases(e){if(e.type===ut.Separator||e.type===ut.Html)return e;const t=d$(e,{label:"title"});return e.confirmation&&(t.confirmation=this.resolveTuneAliases(e.confirmation)),t}}var Ov={exports:{}};(function(n,e){(function(t,o){n.exports=o()})(window,function(){return(function(t){var o={};function a(i){if(o[i])return o[i].exports;var r=o[i]={i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,a),r.l=!0,r.exports}return a.m=t,a.c=o,a.d=function(i,r,s){a.o(i,r)||Object.defineProperty(i,r,{enumerable:!0,get:s})},a.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},a.t=function(i,r){if(1&r&&(i=a(i)),8&r||4&r&&typeof i=="object"&&i&&i.__esModule)return i;var s=Object.create(null);if(a.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:i}),2&r&&typeof i!="string")for(var l in i)a.d(s,l,(function(d){return i[d]}).bind(null,l));return s},a.n=function(i){var r=i&&i.__esModule?function(){return i.default}:function(){return i};return a.d(r,"a",r),r},a.o=function(i,r){return Object.prototype.hasOwnProperty.call(i,r)},a.p="",a(a.s=0)})([function(t,o,a){function i(l,d){for(var u=0;u<d.length;u++){var p=d[u];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(l,p.key,p)}}function r(l,d,u){return d&&i(l.prototype,d),u&&i(l,u),l}a.r(o);var s=(function(){function l(d){var u=this;(function(p,m){if(!(p instanceof m))throw new TypeError("Cannot call a class as a function")})(this,l),this.commands={},this.keys={},this.name=d.name,this.parseShortcutName(d.name),this.element=d.on,this.callback=d.callback,this.executeShortcut=function(p){u.execute(p)},this.element.addEventListener("keydown",this.executeShortcut,!1)}return r(l,null,[{key:"supportedCommands",get:function(){return{SHIFT:["SHIFT"],CMD:["CMD","CONTROL","COMMAND","WINDOWS","CTRL"],ALT:["ALT","OPTION"]}}},{key:"keyCodes",get:function(){return{0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,BACKSPACE:8,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DELETE:46,".":190}}}]),r(l,[{key:"parseShortcutName",value:function(d){d=d.split("+");for(var u=0;u<d.length;u++){d[u]=d[u].toUpperCase();var p=!1;for(var m in l.supportedCommands)if(l.supportedCommands[m].includes(d[u])){p=this.commands[m]=!0;break}p||(this.keys[d[u]]=!0)}for(var h in l.supportedCommands)this.commands[h]||(this.commands[h]=!1)}},{key:"execute",value:function(d){var u,p={CMD:d.ctrlKey||d.metaKey,SHIFT:d.shiftKey,ALT:d.altKey},m=!0;for(u in this.commands)this.commands[u]!==p[u]&&(m=!1);var h,f=!0;for(h in this.keys)f=f&&d.keyCode===l.keyCodes[h];m&&f&&this.callback(d)}},{key:"remove",value:function(){this.element.removeEventListener("keydown",this.executeShortcut)}}]),l})();o.default=s}]).default})})(Ov);var L$=Ov.exports;const N$=x0(L$);class P${constructor(){this.registeredShortcuts=new Map}add(e){if(this.findShortcut(e.on,e.name))throw Error(`Shortcut ${e.name} is already registered for ${e.on}. Please remove it before add a new handler.`);const t=new N$({name:e.name,on:e.on,callback:e.handler}),o=this.registeredShortcuts.get(e.on)||[];this.registeredShortcuts.set(e.on,[...o,t])}remove(e,t){const o=this.findShortcut(e,t);if(!o)return;o.remove();const a=this.registeredShortcuts.get(e).filter(i=>i!==o);if(a.length===0){this.registeredShortcuts.delete(e);return}this.registeredShortcuts.set(e,a)}findShortcut(e,t){return(this.registeredShortcuts.get(e)||[]).find(({name:o})=>o===t)}}const hs=new P$;var R$=Object.defineProperty,V$=Object.getOwnPropertyDescriptor,Lv=(n,e,t,o)=>{for(var a=V$(e,t),i=n.length-1,r;i>=0;i--)(r=n[i])&&(a=r(e,t,a)||a);return a&&R$(e,t,a),a},T0=(n=>(n.Opened="toolbox-opened",n.Closed="toolbox-closed",n.BlockAdded="toolbox-block-added",n))(T0||{});const gm=class Ix extends Jl{constructor({api:e,tools:t,i18nLabels:o}){super(),this.opened=!1,this.listeners=new Ql,this.popover=null,this.handleMobileLayoutToggle=()=>{this.destroyPopover(),this.initPopover()},this.onPopoverClose=()=>{this.opened=!1,this.emit("toolbox-closed")},this.api=e,this.tools=t,this.i18nLabels=o,this.enableShortcuts(),this.nodes={toolbox:Y.make("div",Ix.CSS.toolbox)},this.initPopover(),this.api.events.on(ec,this.handleMobileLayoutToggle)}get isEmpty(){return this.toolsToBeDisplayed.length===0}static get CSS(){return{toolbox:"ce-toolbox"}}getElement(){return this.nodes.toolbox}hasFocus(){if(this.popover!==null)return"hasFocus"in this.popover?this.popover.hasFocus():void 0}destroy(){var e;super.destroy(),this.nodes&&this.nodes.toolbox&&this.nodes.toolbox.remove(),this.removeAllShortcuts(),(e=this.popover)==null||e.off(ta.Closed,this.onPopoverClose),this.listeners.destroy(),this.api.events.off(ec,this.handleMobileLayoutToggle)}toolButtonActivated(e,t){this.insertNewBlock(e,t)}open(){var e;this.isEmpty||((e=this.popover)==null||e.show(),this.opened=!0,this.emit("toolbox-opened"))}close(){var e;(e=this.popover)==null||e.hide(),this.opened=!1,this.emit("toolbox-closed")}toggle(){this.opened?this.close():this.open()}initPopover(){var e;const t=ps()?Av:mm;this.popover=new t({scopeElement:this.api.ui.nodes.redactor,searchable:!0,messages:{nothingFound:this.i18nLabels.nothingFound,search:this.i18nLabels.filter},items:this.toolboxItemsToBeDisplayed}),this.popover.on(ta.Closed,this.onPopoverClose),(e=this.nodes.toolbox)==null||e.append(this.popover.getElement())}destroyPopover(){this.popover!==null&&(this.popover.hide(),this.popover.off(ta.Closed,this.onPopoverClose),this.popover.destroy(),this.popover=null),this.nodes.toolbox!==null&&(this.nodes.toolbox.innerHTML="")}get toolsToBeDisplayed(){const e=[];return this.tools.forEach(t=>{t.toolbox&&e.push(t)}),e}get toolboxItemsToBeDisplayed(){const e=(t,o,a=!0)=>({icon:t.icon,title:jn.t(Un.toolNames,t.title||F0(o.name)),name:o.name,onActivate:()=>{this.toolButtonActivated(o.name,t.data)},secondaryLabel:o.shortcut&&a?em(o.shortcut):""});return this.toolsToBeDisplayed.reduce((t,o)=>(Array.isArray(o.toolbox)?o.toolbox.forEach((a,i)=>{t.push(e(a,o,i===0))}):o.toolbox!==void 0&&t.push(e(o.toolbox,o)),t),[])}enableShortcuts(){this.toolsToBeDisplayed.forEach(e=>{const t=e.shortcut;t&&this.enableShortcutForTool(e.name,t)})}enableShortcutForTool(e,t){hs.add({name:t,on:this.api.ui.nodes.redactor,handler:async o=>{o.preventDefault();const a=this.api.blocks.getCurrentBlockIndex(),i=this.api.blocks.getBlockByIndex(a);if(i)try{const r=await this.api.blocks.convert(i.id,e);this.api.caret.setToBlock(r,"end");return}catch{}this.insertNewBlock(e)}})}removeAllShortcuts(){this.toolsToBeDisplayed.forEach(e=>{const t=e.shortcut;t&&hs.remove(this.api.ui.nodes.redactor,t)})}async insertNewBlock(e,t){const o=this.api.blocks.getCurrentBlockIndex(),a=this.api.blocks.getBlockByIndex(o);if(!a)return;const i=a.isEmpty?o:o+1;let r;if(t){const l=await this.api.blocks.composeBlockData(e);r=Object.assign(l,t)}const s=this.api.blocks.insert(e,r,void 0,i,void 0,a.isEmpty);s.call(Fa.APPEND_CALLBACK),this.api.caret.setToBlock(i),this.emit("toolbox-block-added",{block:s}),this.api.toolbar.close()}};Lv([us],gm.prototype,"toolsToBeDisplayed"),Lv([us],gm.prototype,"toolboxItemsToBeDisplayed");let H$=gm;const Nv="block hovered";async function z$(n,e){const t=navigator.keyboard;if(!t)return e;try{return(await t.getLayoutMap()).get(n)||e}catch(o){return console.error(o),e}}class $$ extends Pe{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t}),this.toolboxInstance=null}get CSS(){return{toolbar:"ce-toolbar",content:"ce-toolbar__content",actions:"ce-toolbar__actions",actionsOpened:"ce-toolbar__actions--opened",toolbarOpened:"ce-toolbar--opened",openedToolboxHolderModifier:"codex-editor--toolbox-opened",plusButton:"ce-toolbar__plus",plusButtonShortcut:"ce-toolbar__plus-shortcut",settingsToggler:"ce-toolbar__settings-btn",settingsTogglerHidden:"ce-toolbar__settings-btn--hidden"}}get opened(){return this.nodes.wrapper.classList.contains(this.CSS.toolbarOpened)}get toolbox(){var e;return{opened:(e=this.toolboxInstance)==null?void 0:e.opened,close:()=>{var t;(t=this.toolboxInstance)==null||t.close()},open:()=>{if(this.toolboxInstance===null){Ue("toolbox.open() called before initialization is finished","warn");return}this.Editor.BlockManager.currentBlock=this.hoveredBlock,this.toolboxInstance.open()},toggle:()=>{if(this.toolboxInstance===null){Ue("toolbox.toggle() called before initialization is finished","warn");return}this.toolboxInstance.toggle()},hasFocus:()=>{var t;return(t=this.toolboxInstance)==null?void 0:t.hasFocus()}}}get blockActions(){return{hide:()=>{this.nodes.actions.classList.remove(this.CSS.actionsOpened)},show:()=>{this.nodes.actions.classList.add(this.CSS.actionsOpened)}}}get blockTunesToggler(){return{hide:()=>this.nodes.settingsToggler.classList.add(this.CSS.settingsTogglerHidden),show:()=>this.nodes.settingsToggler.classList.remove(this.CSS.settingsTogglerHidden)}}toggleReadOnly(e){e?(this.destroy(),this.Editor.BlockSettings.destroy(),this.disableModuleBindings()):window.requestIdleCallback(()=>{this.drawUI(),this.enableModuleBindings()},{timeout:2e3})}moveAndOpen(e=this.Editor.BlockManager.currentBlock){if(this.toolboxInstance===null){Ue("Can't open Toolbar since Editor initialization is not finished yet","warn");return}if(this.toolboxInstance.opened&&this.toolboxInstance.close(),this.Editor.BlockSettings.opened&&this.Editor.BlockSettings.close(),!e)return;this.hoveredBlock=e;const t=e.holder,{isMobile:o}=this.Editor.UI;let a;const i=20,r=e.firstInput,s=t.getBoundingClientRect(),l=r!==void 0?r.getBoundingClientRect():null,d=l!==null?l.top-s.top:null,u=d!==null?d>i:void 0;if(o)a=t.offsetTop+t.offsetHeight;else if(r===void 0||u){const p=parseInt(window.getComputedStyle(e.pluginsContent).paddingTop);a=t.offsetTop+p}else{const p=Dz(r),m=parseInt(window.getComputedStyle(this.nodes.plusButton).height,10);a=t.offsetTop+p-m+8+d}this.nodes.wrapper.style.top=`${Math.floor(a)}px`,this.Editor.BlockManager.blocks.length===1&&e.isEmpty?this.blockTunesToggler.hide():this.blockTunesToggler.show(),this.open()}close(){var e,t;this.Editor.ReadOnly.isEnabled||((e=this.nodes.wrapper)==null||e.classList.remove(this.CSS.toolbarOpened),this.blockActions.hide(),(t=this.toolboxInstance)==null||t.close(),this.Editor.BlockSettings.close(),this.reset())}reset(){this.nodes.wrapper.style.top="unset"}open(e=!0){this.nodes.wrapper.classList.add(this.CSS.toolbarOpened),e?this.blockActions.show():this.blockActions.hide()}async make(){this.nodes.wrapper=Y.make("div",this.CSS.toolbar),["content","actions"].forEach(i=>{this.nodes[i]=Y.make("div",this.CSS[i])}),Y.append(this.nodes.wrapper,this.nodes.content),Y.append(this.nodes.content,this.nodes.actions),this.nodes.plusButton=Y.make("div",this.CSS.plusButton,{innerHTML:C$}),Y.append(this.nodes.actions,this.nodes.plusButton),this.readOnlyMutableListeners.on(this.nodes.plusButton,"click",()=>{S0(!0),this.plusButtonClicked()},!1);const e=Y.make("div");e.appendChild(document.createTextNode(jn.ui(Un.ui.toolbar.toolbox,"Add"))),e.appendChild(Y.make("div",this.CSS.plusButtonShortcut,{textContent:"/"})),I0(this.nodes.plusButton,e,{hidingDelay:400}),this.nodes.settingsToggler=Y.make("span",this.CSS.settingsToggler,{innerHTML:y$}),Y.append(this.nodes.actions,this.nodes.settingsToggler);const t=Y.make("div"),o=Y.text(jn.ui(Un.ui.blockTunes.toggler,"Click to tune")),a=await z$("Slash","/");t.appendChild(o),t.appendChild(Y.make("div",this.CSS.plusButtonShortcut,{textContent:em(`CMD + ${a}`)})),I0(this.nodes.settingsToggler,t,{hidingDelay:400}),Y.append(this.nodes.actions,this.makeToolbox()),Y.append(this.nodes.actions,this.Editor.BlockSettings.getElement()),Y.append(this.Editor.UI.nodes.wrapper,this.nodes.wrapper)}makeToolbox(){return this.toolboxInstance=new H$({api:this.Editor.API.methods,tools:this.Editor.Tools.blockTools,i18nLabels:{filter:jn.ui(Un.ui.popover,"Filter"),nothingFound:jn.ui(Un.ui.popover,"Nothing found")}}),this.toolboxInstance.on(T0.Opened,()=>{this.Editor.UI.nodes.wrapper.classList.add(this.CSS.openedToolboxHolderModifier)}),this.toolboxInstance.on(T0.Closed,()=>{this.Editor.UI.nodes.wrapper.classList.remove(this.CSS.openedToolboxHolderModifier)}),this.toolboxInstance.on(T0.BlockAdded,({block:e})=>{const{BlockManager:t,Caret:o}=this.Editor,a=t.getBlockById(e.id);a.inputs.length===0&&(a===t.lastBlock?(t.insertAtEnd(),o.setToBlock(t.lastBlock)):o.setToBlock(t.nextBlock))}),this.toolboxInstance.getElement()}plusButtonClicked(){var e;this.Editor.BlockManager.currentBlock=this.hoveredBlock,(e=this.toolboxInstance)==null||e.toggle()}enableModuleBindings(){this.readOnlyMutableListeners.on(this.nodes.settingsToggler,"mousedown",e=>{var t;e.stopPropagation(),this.settingsTogglerClicked(),(t=this.toolboxInstance)!=null&&t.opened&&this.toolboxInstance.close(),S0(!0)},!0),ps()||this.eventsDispatcher.on(Nv,e=>{var t;this.Editor.BlockSettings.opened||(t=this.toolboxInstance)!=null&&t.opened||this.moveAndOpen(e.block)})}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}settingsTogglerClicked(){this.Editor.BlockManager.currentBlock=this.hoveredBlock,this.Editor.BlockSettings.opened?this.Editor.BlockSettings.close():this.Editor.BlockSettings.open(this.hoveredBlock)}drawUI(){this.Editor.BlockSettings.make(),this.make()}destroy(){this.removeAllNodes(),this.toolboxInstance&&this.toolboxInstance.destroy()}}var lr=(n=>(n[n.Block=0]="Block",n[n.Inline=1]="Inline",n[n.Tune=2]="Tune",n))(lr||{}),A0=(n=>(n.Shortcut="shortcut",n.Toolbox="toolbox",n.EnabledInlineTools="inlineToolbar",n.EnabledBlockTunes="tunes",n.Config="config",n))(A0||{}),Pv=(n=>(n.Shortcut="shortcut",n.SanitizeConfig="sanitize",n))(Pv||{}),fs=(n=>(n.IsEnabledLineBreaks="enableLineBreaks",n.Toolbox="toolbox",n.ConversionConfig="conversionConfig",n.IsReadOnlySupported="isReadOnlySupported",n.PasteConfig="pasteConfig",n))(fs||{}),O0=(n=>(n.IsInline="isInline",n.Title="title",n.IsReadOnlySupported="isReadOnlySupported",n))(O0||{}),vm=(n=>(n.IsTune="isTune",n))(vm||{});let bm=class{constructor({name:e,constructable:t,config:o,api:a,isDefault:i,isInternal:r=!1,defaultPlaceholder:s}){this.api=a,this.name=e,this.constructable=t,this.config=o,this.isDefault=i,this.isInternal=r,this.defaultPlaceholder=s}get settings(){const e=this.config.config||{};return this.isDefault&&!("placeholder"in e)&&this.defaultPlaceholder&&(e.placeholder=this.defaultPlaceholder),e}reset(){if(bt(this.constructable.reset))return this.constructable.reset()}prepare(){if(bt(this.constructable.prepare))return this.constructable.prepare({toolName:this.name,config:this.settings})}get shortcut(){const e=this.constructable.shortcut;return this.config.shortcut||e}get sanitizeConfig(){return this.constructable.sanitize||{}}isInline(){return this.type===lr.Inline}isBlock(){return this.type===lr.Block}isTune(){return this.type===lr.Tune}};class W$ extends Pe{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t}),this.CSS={inlineToolbar:"ce-inline-toolbar"},this.opened=!1,this.popover=null,this.toolbarVerticalMargin=ps()?20:6,this.tools=new Map,window.requestIdleCallback(()=>{this.make()},{timeout:2e3})}async tryToShow(e=!1){e&&this.close(),this.allowedToShow()&&(await this.open(),this.Editor.Toolbar.close())}close(){var e,t;if(this.opened){for(const[o,a]of this.tools){const i=this.getToolShortcut(o.name);i!==void 0&&hs.remove(this.Editor.UI.nodes.redactor,i),bt(a.clear)&&a.clear()}this.tools=new Map,this.reset(),this.opened=!1,(e=this.popover)==null||e.hide(),(t=this.popover)==null||t.destroy(),this.popover=null}}containsNode(e){return this.nodes.wrapper===void 0?!1:this.nodes.wrapper.contains(e)}destroy(){var e;this.removeAllNodes(),(e=this.popover)==null||e.destroy(),this.popover=null}make(){this.nodes.wrapper=Y.make("div",[this.CSS.inlineToolbar,...this.isRtl?[this.Editor.UI.CSS.editorRtlFix]:[]]),Y.append(this.Editor.UI.nodes.wrapper,this.nodes.wrapper)}async open(){var e;if(this.opened)return;this.opened=!0,this.popover!==null&&this.popover.destroy(),this.createToolsInstances();const t=await this.getPopoverItems();this.popover=new M$({items:t,scopeElement:this.Editor.API.methods.ui.nodes.redactor,messages:{nothingFound:jn.ui(Un.ui.popover,"Nothing found"),search:jn.ui(Un.ui.popover,"Filter")}}),this.move(this.popover.size.width),(e=this.nodes.wrapper)==null||e.append(this.popover.getElement()),this.popover.show()}move(e){const t=_e.rect,o=this.Editor.UI.nodes.wrapper.getBoundingClientRect(),a={x:t.x-o.x,y:t.y+t.height-o.top+this.toolbarVerticalMargin};a.x+e+o.x>this.Editor.UI.contentRect.right&&(a.x=this.Editor.UI.contentRect.right-e-o.x),this.nodes.wrapper.style.left=Math.floor(a.x)+"px",this.nodes.wrapper.style.top=Math.floor(a.y)+"px"}reset(){this.nodes.wrapper.style.left="0",this.nodes.wrapper.style.top="0"}allowedToShow(){const e=["IMG","INPUT"],t=_e.get(),o=_e.text;if(!t||!t.anchorNode||t.isCollapsed||o.length<1)return!1;const a=Y.isElement(t.anchorNode)?t.anchorNode:t.anchorNode.parentElement;if(a===null||t!==null&&e.includes(a.tagName))return!1;const i=this.Editor.BlockManager.getBlock(t.anchorNode);return!i||this.getTools().some(r=>i.tool.inlineTools.has(r.name))===!1?!1:a.closest("[contenteditable]")!==null}getTools(){const e=this.Editor.BlockManager.currentBlock;return e?Array.from(e.tool.inlineTools.values()).filter(t=>!(this.Editor.ReadOnly.isEnabled&&t.isReadOnlySupported!==!0)):[]}createToolsInstances(){this.tools=new Map,this.getTools().forEach(e=>{const t=e.create();this.tools.set(e,t)})}async getPopoverItems(){const e=[];let t=0;for(const[o,a]of this.tools){const i=await a.render(),r=this.getToolShortcut(o.name);if(r!==void 0)try{this.enableShortcuts(o.name,r)}catch{}const s=r!==void 0?em(r):void 0,l=jn.t(Un.toolNames,o.title||F0(o.name));[i].flat().forEach(d=>{var u,p;const m={name:o.name,onActivate:()=>{this.toolClicked(a)},hint:{title:l,description:s}};if(Y.isElement(d)){const h={...m,element:d,type:ut.Html};if(bt(a.renderActions)){const f=a.renderActions();h.children={isOpen:(u=a.checkState)==null?void 0:u.call(a,_e.get()),isFlippable:!1,items:[{type:ut.Html,element:f}]}}else(p=a.checkState)==null||p.call(a,_e.get());e.push(h)}else if(d.type===ut.Html)e.push({...m,...d,type:ut.Html});else if(d.type===ut.Separator)e.push({type:ut.Separator});else{const h={...m,...d,type:ut.Default};"children"in h&&t!==0&&e.push({type:ut.Separator}),e.push(h),"children"in h&&t<this.tools.size-1&&e.push({type:ut.Separator})}}),t++}return e}getToolShortcut(e){const{Tools:t}=this.Editor,o=t.inlineTools.get(e),a=t.internal.inlineTools;return Array.from(a.keys()).includes(e)?this.inlineTools[e][Pv.Shortcut]:o?.shortcut}enableShortcuts(e,t){hs.add({name:t,handler:o=>{var a;const{currentBlock:i}=this.Editor.BlockManager;i&&i.tool.enabledInlineTools&&(o.preventDefault(),(a=this.popover)==null||a.activateItemByName(e))},on:document})}toolClicked(e){var t;const o=_e.range;(t=e.surround)==null||t.call(e,o),this.checkToolsState()}checkToolsState(){var e;(e=this.tools)==null||e.forEach(t=>{var o;(o=t.checkState)==null||o.call(t,_e.get())})}get inlineTools(){const e={};return Array.from(this.Editor.Tools.inlineTools.entries()).forEach(([t,o])=>{e[t]=o.create()}),e}}function Rv(){const n=window.getSelection();if(n===null)return[null,0];let e=n.focusNode,t=n.focusOffset;return e===null?[null,0]:(e.nodeType!==Node.TEXT_NODE&&e.childNodes.length>0&&(e.childNodes[t]?(e=e.childNodes[t],t=0):(e=e.childNodes[t-1],t=e.textContent.length)),[e,t])}function Vv(n,e,t,o){const a=document.createRange();o==="left"?(a.setStart(n,0),a.setEnd(e,t)):(a.setStart(e,t),a.setEnd(n,n.childNodes.length));const i=a.cloneContents(),r=document.createElement("div");r.appendChild(i);const s=r.textContent||"";return xz(s)}function L0(n){const e=Y.getDeepestNode(n);if(e===null||Y.isEmpty(n))return!0;if(Y.isNativeInput(e))return e.selectionEnd===0;if(Y.isEmpty(n))return!0;const[t,o]=Rv();return t===null?!1:Vv(n,t,o,"left")}function N0(n){const e=Y.getDeepestNode(n,!0);if(e===null)return!0;if(Y.isNativeInput(e))return e.selectionEnd===e.value.length;const[t,o]=Rv();return t===null?!1:Vv(n,t,o,"right")}var Hv={},ym={},P0={},cr={},Cm={},km={};Object.defineProperty(km,"__esModule",{value:!0}),km.allInputsSelector=U$;function U$(){var n=["text","password","email","number","search","tel","url"];return"[contenteditable=true], textarea, input:not([type]), "+n.map(function(e){return'input[type="'.concat(e,'"]')}).join(", ")}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.allInputsSelector=void 0;var e=km;Object.defineProperty(n,"allInputsSelector",{enumerable:!0,get:function(){return e.allInputsSelector}})})(Cm);var dr={},wm={};Object.defineProperty(wm,"__esModule",{value:!0}),wm.isNativeInput=q$;function q$(n){var e=["INPUT","TEXTAREA"];return n&&n.tagName?e.includes(n.tagName):!1}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isNativeInput=void 0;var e=wm;Object.defineProperty(n,"isNativeInput",{enumerable:!0,get:function(){return e.isNativeInput}})})(dr);var zv={},jm={};Object.defineProperty(jm,"__esModule",{value:!0}),jm.append=K$;function K$(n,e){Array.isArray(e)?e.forEach(function(t){n.appendChild(t)}):n.appendChild(e)}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.append=void 0;var e=jm;Object.defineProperty(n,"append",{enumerable:!0,get:function(){return e.append}})})(zv);var _m={},xm={};Object.defineProperty(xm,"__esModule",{value:!0}),xm.blockElements=Z$;function Z$(){return["address","article","aside","blockquote","canvas","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","ruby","section","table","tbody","thead","tr","tfoot","ul","video"]}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.blockElements=void 0;var e=xm;Object.defineProperty(n,"blockElements",{enumerable:!0,get:function(){return e.blockElements}})})(_m);var $v={},Dm={};Object.defineProperty(Dm,"__esModule",{value:!0}),Dm.calculateBaseline=Y$;function Y$(n){var e=window.getComputedStyle(n),t=parseFloat(e.fontSize),o=parseFloat(e.lineHeight)||t*1.2,a=parseFloat(e.paddingTop),i=parseFloat(e.borderTopWidth),r=parseFloat(e.marginTop),s=t*.8,l=(o-t)/2,d=r+i+a+l+s;return d}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.calculateBaseline=void 0;var e=Dm;Object.defineProperty(n,"calculateBaseline",{enumerable:!0,get:function(){return e.calculateBaseline}})})($v);var Wv={},Fm={},Em={},Sm={};Object.defineProperty(Sm,"__esModule",{value:!0}),Sm.isContentEditable=G$;function G$(n){return n.contentEditable==="true"}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isContentEditable=void 0;var e=Sm;Object.defineProperty(n,"isContentEditable",{enumerable:!0,get:function(){return e.isContentEditable}})})(Em),Object.defineProperty(Fm,"__esModule",{value:!0}),Fm.canSetCaret=Q$;var X$=dr,J$=Em;function Q$(n){var e=!0;if((0,X$.isNativeInput)(n))switch(n.type){case"file":case"checkbox":case"radio":case"hidden":case"submit":case"button":case"image":case"reset":e=!1;break}else e=(0,J$.isContentEditable)(n);return e}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.canSetCaret=void 0;var e=Fm;Object.defineProperty(n,"canSetCaret",{enumerable:!0,get:function(){return e.canSetCaret}})})(Wv);var R0={},Im={};function eW(n,e,t){const o=t.value!==void 0?"value":"get",a=t[o],i=`#${e}Cache`;if(t[o]=function(...r){return this[i]===void 0&&(this[i]=a.apply(this,r)),this[i]},o==="get"&&t.set){const r=t.set;t.set=function(s){delete n[i],r.apply(this,s)}}return t}function Uv(){const n={win:!1,mac:!1,x11:!1,linux:!1},e=Object.keys(n).find(t=>window.navigator.appVersion.toLowerCase().indexOf(t)!==-1);return e!==void 0&&(n[e]=!0),n}function Mm(n){return n!=null&&n!==""&&(typeof n!="object"||Object.keys(n).length>0)}function tW(n){return!Mm(n)}const nW=()=>typeof window<"u"&&window.navigator!==null&&Mm(window.navigator.platform)&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1);function oW(n){const e=Uv();return n=n.replace(/shift/gi,"⇧").replace(/backspace/gi,"⌫").replace(/enter/gi,"⏎").replace(/up/gi,"↑").replace(/left/gi,"→").replace(/down/gi,"↓").replace(/right/gi,"←").replace(/escape/gi,"⎋").replace(/insert/gi,"Ins").replace(/delete/gi,"␡").replace(/\+/gi,"+"),e.mac?n=n.replace(/ctrl|cmd/gi,"⌘").replace(/alt/gi,"⌥"):n=n.replace(/cmd/gi,"Ctrl").replace(/windows/gi,"WIN"),n}function aW(n){return n[0].toUpperCase()+n.slice(1)}function iW(n){const e=document.createElement("div");e.style.position="absolute",e.style.left="-999px",e.style.bottom="-999px",e.innerHTML=n,document.body.appendChild(e);const t=window.getSelection(),o=document.createRange();if(o.selectNode(e),t===null)throw new Error("Cannot copy text to clipboard");t.removeAllRanges(),t.addRange(o),document.execCommand("copy"),document.body.removeChild(e)}function rW(n,e,t){let o;return(...a)=>{const i=this,r=()=>{o=void 0,t!==!0&&n.apply(i,a)},s=t===!0&&o!==void 0;window.clearTimeout(o),o=window.setTimeout(r,e),s&&n.apply(i,a)}}function ui(n){return Object.prototype.toString.call(n).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}function sW(n){return ui(n)==="boolean"}function qv(n){return ui(n)==="function"||ui(n)==="asyncfunction"}function lW(n){return qv(n)&&/^\s*class\s+/.test(n.toString())}function cW(n){return ui(n)==="number"}function V0(n){return ui(n)==="object"}function dW(n){return Promise.resolve(n)===n}function uW(n){return ui(n)==="string"}function pW(n){return ui(n)==="undefined"}function Bm(n,...e){if(!e.length)return n;const t=e.shift();if(V0(n)&&V0(t))for(const o in t)V0(t[o])?(n[o]===void 0&&Object.assign(n,{[o]:{}}),Bm(n[o],t[o])):Object.assign(n,{[o]:t[o]});return Bm(n,...e)}function mW(n,e,t){const o=`«${e}» is deprecated and will be removed in the next major release. Please use the «${t}» instead.`;n&&console.warn(o)}function hW(n){try{return new URL(n).href}catch{}return n.substring(0,2)==="//"?window.location.protocol+n:window.location.origin+n}function fW(n){return n>47&&n<58||n===32||n===13||n===229||n>64&&n<91||n>95&&n<112||n>185&&n<193||n>218&&n<223}const gW={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46,META:91,SLASH:191},vW={LEFT:0,WHEEL:1,RIGHT:2,BACKWARD:3,FORWARD:4};let bW=class{constructor(){this.completed=Promise.resolve()}add(n){return new Promise((e,t)=>{this.completed=this.completed.then(n).then(e).catch(t)})}};function yW(n,e,t=void 0){let o,a,i,r=null,s=0;t||(t={});const l=function(){s=t.leading===!1?0:Date.now(),r=null,i=n.apply(o,a),r===null&&(o=a=null)};return function(){const d=Date.now();!s&&t.leading===!1&&(s=d);const u=e-(d-s);return o=this,a=arguments,u<=0||u>e?(r&&(clearTimeout(r),r=null),s=d,i=n.apply(o,a),r===null&&(o=a=null)):!r&&t.trailing!==!1&&(r=setTimeout(l,u)),i}}const CW=Object.freeze(Object.defineProperty({__proto__:null,PromiseQueue:bW,beautifyShortcut:oW,cacheable:eW,capitalize:aW,copyTextToClipboard:iW,debounce:rW,deepMerge:Bm,deprecationAssert:mW,getUserOS:Uv,getValidUrl:hW,isBoolean:sW,isClass:lW,isEmpty:tW,isFunction:qv,isIosDevice:nW,isNumber:cW,isObject:V0,isPrintableKey:fW,isPromise:dW,isString:uW,isUndefined:pW,keyCodes:gW,mouseButtons:vW,notEmpty:Mm,throttle:yW,typeOf:ui},Symbol.toStringTag,{value:"Module"})),Tm=uz(CW);Object.defineProperty(Im,"__esModule",{value:!0}),Im.containsOnlyInlineElements=jW;var kW=Tm,wW=_m;function jW(n){var e;(0,kW.isString)(n)?(e=document.createElement("div"),e.innerHTML=n):e=n;var t=function(o){return!(0,wW.blockElements)().includes(o.tagName.toLowerCase())&&Array.from(o.children).every(t)};return Array.from(e.children).every(t)}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.containsOnlyInlineElements=void 0;var e=Im;Object.defineProperty(n,"containsOnlyInlineElements",{enumerable:!0,get:function(){return e.containsOnlyInlineElements}})})(R0);var Kv={},Am={},H0={},Om={};Object.defineProperty(Om,"__esModule",{value:!0}),Om.make=_W;function _W(n,e,t){var o;e===void 0&&(e=null),t===void 0&&(t={});var a=document.createElement(n);if(Array.isArray(e)){var i=e.filter(function(s){return s!==void 0});(o=a.classList).add.apply(o,i)}else e!==null&&a.classList.add(e);for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(a[r]=t[r]);return a}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.make=void 0;var e=Om;Object.defineProperty(n,"make",{enumerable:!0,get:function(){return e.make}})})(H0),Object.defineProperty(Am,"__esModule",{value:!0}),Am.fragmentToString=DW;var xW=H0;function DW(n){var e=(0,xW.make)("div");return e.appendChild(n),e.innerHTML}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.fragmentToString=void 0;var e=Am;Object.defineProperty(n,"fragmentToString",{enumerable:!0,get:function(){return e.fragmentToString}})})(Kv);var Zv={},Lm={};Object.defineProperty(Lm,"__esModule",{value:!0}),Lm.getContentLength=EW;var FW=dr;function EW(n){var e,t;return(0,FW.isNativeInput)(n)?n.value.length:n.nodeType===Node.TEXT_NODE?n.length:(t=(e=n.textContent)===null||e===void 0?void 0:e.length)!==null&&t!==void 0?t:0}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.getContentLength=void 0;var e=Lm;Object.defineProperty(n,"getContentLength",{enumerable:!0,get:function(){return e.getContentLength}})})(Zv);var Nm={},Pm={},Yv=Gl&&Gl.__spreadArray||function(n,e,t){if(t||arguments.length===2)for(var o=0,a=e.length,i;o<a;o++)(i||!(o in e))&&(i||(i=Array.prototype.slice.call(e,0,o)),i[o]=e[o]);return n.concat(i||Array.prototype.slice.call(e))};Object.defineProperty(Pm,"__esModule",{value:!0}),Pm.getDeepestBlockElements=Gv;var SW=R0;function Gv(n){return(0,SW.containsOnlyInlineElements)(n)?[n]:Array.from(n.children).reduce(function(e,t){return Yv(Yv([],e,!0),Gv(t),!0)},[])}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.getDeepestBlockElements=void 0;var e=Pm;Object.defineProperty(n,"getDeepestBlockElements",{enumerable:!0,get:function(){return e.getDeepestBlockElements}})})(Nm);var Xv={},Rm={},z0={},Vm={};Object.defineProperty(Vm,"__esModule",{value:!0}),Vm.isLineBreakTag=IW;function IW(n){return["BR","WBR"].includes(n.tagName)}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isLineBreakTag=void 0;var e=Vm;Object.defineProperty(n,"isLineBreakTag",{enumerable:!0,get:function(){return e.isLineBreakTag}})})(z0);var $0={},Hm={};Object.defineProperty(Hm,"__esModule",{value:!0}),Hm.isSingleTag=MW;function MW(n){return["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(n.tagName)}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isSingleTag=void 0;var e=Hm;Object.defineProperty(n,"isSingleTag",{enumerable:!0,get:function(){return e.isSingleTag}})})($0),Object.defineProperty(Rm,"__esModule",{value:!0}),Rm.getDeepestNode=Jv;var BW=dr,TW=z0,AW=$0;function Jv(n,e){e===void 0&&(e=!1);var t=e?"lastChild":"firstChild",o=e?"previousSibling":"nextSibling";if(n.nodeType===Node.ELEMENT_NODE&&n[t]){var a=n[t];if((0,AW.isSingleTag)(a)&&!(0,BW.isNativeInput)(a)&&!(0,TW.isLineBreakTag)(a))if(a[o])a=a[o];else if(a.parentNode!==null&&a.parentNode[o])a=a.parentNode[o];else return a.parentNode;return Jv(a,e)}return n}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.getDeepestNode=void 0;var e=Rm;Object.defineProperty(n,"getDeepestNode",{enumerable:!0,get:function(){return e.getDeepestNode}})})(Xv);var Qv={},zm={},W0=Gl&&Gl.__spreadArray||function(n,e,t){if(t||arguments.length===2)for(var o=0,a=e.length,i;o<a;o++)(i||!(o in e))&&(i||(i=Array.prototype.slice.call(e,0,o)),i[o]=e[o]);return n.concat(i||Array.prototype.slice.call(e))};Object.defineProperty(zm,"__esModule",{value:!0}),zm.findAllInputs=RW;var OW=R0,LW=Nm,NW=Cm,PW=dr;function RW(n){return Array.from(n.querySelectorAll((0,NW.allInputsSelector)())).reduce(function(e,t){return(0,PW.isNativeInput)(t)||(0,OW.containsOnlyInlineElements)(t)?W0(W0([],e,!0),[t],!1):W0(W0([],e,!0),(0,LW.getDeepestBlockElements)(t),!0)},[])}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.findAllInputs=void 0;var e=zm;Object.defineProperty(n,"findAllInputs",{enumerable:!0,get:function(){return e.findAllInputs}})})(Qv);var e8={},$m={};Object.defineProperty($m,"__esModule",{value:!0}),$m.isCollapsedWhitespaces=VW;function VW(n){return!/[^\t\n\r ]/.test(n)}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isCollapsedWhitespaces=void 0;var e=$m;Object.defineProperty(n,"isCollapsedWhitespaces",{enumerable:!0,get:function(){return e.isCollapsedWhitespaces}})})(e8);var Wm={},Um={};Object.defineProperty(Um,"__esModule",{value:!0}),Um.isElement=zW;var HW=Tm;function zW(n){return(0,HW.isNumber)(n)?!1:!!n&&!!n.nodeType&&n.nodeType===Node.ELEMENT_NODE}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isElement=void 0;var e=Um;Object.defineProperty(n,"isElement",{enumerable:!0,get:function(){return e.isElement}})})(Wm);var t8={},qm={},Km={},Zm={};Object.defineProperty(Zm,"__esModule",{value:!0}),Zm.isLeaf=$W;function $W(n){return n===null?!1:n.childNodes.length===0}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isLeaf=void 0;var e=Zm;Object.defineProperty(n,"isLeaf",{enumerable:!0,get:function(){return e.isLeaf}})})(Km);var Ym={},Gm={};Object.defineProperty(Gm,"__esModule",{value:!0}),Gm.isNodeEmpty=ZW;var WW=z0,UW=Wm,qW=dr,KW=$0;function ZW(n,e){var t="";return(0,KW.isSingleTag)(n)&&!(0,WW.isLineBreakTag)(n)?!1:((0,UW.isElement)(n)&&(0,qW.isNativeInput)(n)?t=n.value:n.textContent!==null&&(t=n.textContent.replace("​","")),e!==void 0&&(t=t.replace(new RegExp(e,"g"),"")),t.trim().length===0)}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isNodeEmpty=void 0;var e=Gm;Object.defineProperty(n,"isNodeEmpty",{enumerable:!0,get:function(){return e.isNodeEmpty}})})(Ym),Object.defineProperty(qm,"__esModule",{value:!0}),qm.isEmpty=XW;var YW=Km,GW=Ym;function XW(n,e){n.normalize();for(var t=[n];t.length>0;){var o=t.shift();if(o){if(n=o,(0,YW.isLeaf)(n)&&!(0,GW.isNodeEmpty)(n,e))return!1;t.push.apply(t,Array.from(n.childNodes))}}return!0}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isEmpty=void 0;var e=qm;Object.defineProperty(n,"isEmpty",{enumerable:!0,get:function(){return e.isEmpty}})})(t8);var n8={},Xm={};Object.defineProperty(Xm,"__esModule",{value:!0}),Xm.isFragment=QW;var JW=Tm;function QW(n){return(0,JW.isNumber)(n)?!1:!!n&&!!n.nodeType&&n.nodeType===Node.DOCUMENT_FRAGMENT_NODE}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isFragment=void 0;var e=Xm;Object.defineProperty(n,"isFragment",{enumerable:!0,get:function(){return e.isFragment}})})(n8);var o8={},Jm={};Object.defineProperty(Jm,"__esModule",{value:!0}),Jm.isHTMLString=tU;var eU=H0;function tU(n){var e=(0,eU.make)("div");return e.innerHTML=n,e.childElementCount>0}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isHTMLString=void 0;var e=Jm;Object.defineProperty(n,"isHTMLString",{enumerable:!0,get:function(){return e.isHTMLString}})})(o8);var a8={},Qm={};Object.defineProperty(Qm,"__esModule",{value:!0}),Qm.offset=nU;function nU(n){var e=n.getBoundingClientRect(),t=window.pageXOffset||document.documentElement.scrollLeft,o=window.pageYOffset||document.documentElement.scrollTop,a=e.top+o,i=e.left+t;return{top:a,left:i,bottom:a+e.height,right:i+e.width}}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.offset=void 0;var e=Qm;Object.defineProperty(n,"offset",{enumerable:!0,get:function(){return e.offset}})})(a8);var i8={},eh={};Object.defineProperty(eh,"__esModule",{value:!0}),eh.prepend=oU;function oU(n,e){Array.isArray(e)?(e=e.reverse(),e.forEach(function(t){return n.prepend(t)})):n.prepend(e)}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.prepend=void 0;var e=eh;Object.defineProperty(n,"prepend",{enumerable:!0,get:function(){return e.prepend}})})(i8),(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.prepend=n.offset=n.make=n.isLineBreakTag=n.isSingleTag=n.isNodeEmpty=n.isLeaf=n.isHTMLString=n.isFragment=n.isEmpty=n.isElement=n.isContentEditable=n.isCollapsedWhitespaces=n.findAllInputs=n.isNativeInput=n.allInputsSelector=n.getDeepestNode=n.getDeepestBlockElements=n.getContentLength=n.fragmentToString=n.containsOnlyInlineElements=n.canSetCaret=n.calculateBaseline=n.blockElements=n.append=void 0;var e=Cm;Object.defineProperty(n,"allInputsSelector",{enumerable:!0,get:function(){return e.allInputsSelector}});var t=dr;Object.defineProperty(n,"isNativeInput",{enumerable:!0,get:function(){return t.isNativeInput}});var o=zv;Object.defineProperty(n,"append",{enumerable:!0,get:function(){return o.append}});var a=_m;Object.defineProperty(n,"blockElements",{enumerable:!0,get:function(){return a.blockElements}});var i=$v;Object.defineProperty(n,"calculateBaseline",{enumerable:!0,get:function(){return i.calculateBaseline}});var r=Wv;Object.defineProperty(n,"canSetCaret",{enumerable:!0,get:function(){return r.canSetCaret}});var s=R0;Object.defineProperty(n,"containsOnlyInlineElements",{enumerable:!0,get:function(){return s.containsOnlyInlineElements}});var l=Kv;Object.defineProperty(n,"fragmentToString",{enumerable:!0,get:function(){return l.fragmentToString}});var d=Zv;Object.defineProperty(n,"getContentLength",{enumerable:!0,get:function(){return d.getContentLength}});var u=Nm;Object.defineProperty(n,"getDeepestBlockElements",{enumerable:!0,get:function(){return u.getDeepestBlockElements}});var p=Xv;Object.defineProperty(n,"getDeepestNode",{enumerable:!0,get:function(){return p.getDeepestNode}});var m=Qv;Object.defineProperty(n,"findAllInputs",{enumerable:!0,get:function(){return m.findAllInputs}});var h=e8;Object.defineProperty(n,"isCollapsedWhitespaces",{enumerable:!0,get:function(){return h.isCollapsedWhitespaces}});var f=Em;Object.defineProperty(n,"isContentEditable",{enumerable:!0,get:function(){return f.isContentEditable}});var g=Wm;Object.defineProperty(n,"isElement",{enumerable:!0,get:function(){return g.isElement}});var v=t8;Object.defineProperty(n,"isEmpty",{enumerable:!0,get:function(){return v.isEmpty}});var b=n8;Object.defineProperty(n,"isFragment",{enumerable:!0,get:function(){return b.isFragment}});var y=o8;Object.defineProperty(n,"isHTMLString",{enumerable:!0,get:function(){return y.isHTMLString}});var k=Km;Object.defineProperty(n,"isLeaf",{enumerable:!0,get:function(){return k.isLeaf}});var S=Ym;Object.defineProperty(n,"isNodeEmpty",{enumerable:!0,get:function(){return S.isNodeEmpty}});var F=z0;Object.defineProperty(n,"isLineBreakTag",{enumerable:!0,get:function(){return F.isLineBreakTag}});var D=$0;Object.defineProperty(n,"isSingleTag",{enumerable:!0,get:function(){return D.isSingleTag}});var w=H0;Object.defineProperty(n,"make",{enumerable:!0,get:function(){return w.make}});var _=a8;Object.defineProperty(n,"offset",{enumerable:!0,get:function(){return _.offset}});var M=i8;Object.defineProperty(n,"prepend",{enumerable:!0,get:function(){return M.prepend}})})(cr);var U0={};Object.defineProperty(U0,"__esModule",{value:!0}),U0.getContenteditableSlice=iU;var aU=cr;function iU(n,e,t,o,a){var i;a===void 0&&(a=!1);var r=document.createRange();if(o==="left"?(r.setStart(n,0),r.setEnd(e,t)):(r.setStart(e,t),r.setEnd(n,n.childNodes.length)),a===!0){var s=r.extractContents();return(0,aU.fragmentToString)(s)}var l=r.cloneContents(),d=document.createElement("div");d.appendChild(l);var u=(i=d.textContent)!==null&&i!==void 0?i:"";return u}Object.defineProperty(P0,"__esModule",{value:!0}),P0.checkContenteditableSliceForEmptiness=lU;var rU=cr,sU=U0;function lU(n,e,t,o){var a=(0,sU.getContenteditableSlice)(n,e,t,o);return(0,rU.isCollapsedWhitespaces)(a)}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.checkContenteditableSliceForEmptiness=void 0;var e=P0;Object.defineProperty(n,"checkContenteditableSliceForEmptiness",{enumerable:!0,get:function(){return e.checkContenteditableSliceForEmptiness}})})(ym);var r8={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.getContenteditableSlice=void 0;var e=U0;Object.defineProperty(n,"getContenteditableSlice",{enumerable:!0,get:function(){return e.getContenteditableSlice}})})(r8);var s8={},th={};Object.defineProperty(th,"__esModule",{value:!0}),th.focus=dU;var cU=cr;function dU(n,e){var t,o;if(e===void 0&&(e=!0),(0,cU.isNativeInput)(n)){n.focus();var a=e?0:n.value.length;n.setSelectionRange(a,a)}else{var i=document.createRange(),r=window.getSelection();if(!r)return;var s=function(m){var h=document.createTextNode("");m.appendChild(h),i.setStart(h,0),i.setEnd(h,0)},l=function(m){return m!=null},d=n.childNodes,u=e?d[0]:d[d.length-1];if(l(u)){for(;l(u)&&u.nodeType!==Node.TEXT_NODE;)u=e?u.firstChild:u.lastChild;if(l(u)&&u.nodeType===Node.TEXT_NODE){var p=(o=(t=u.textContent)===null||t===void 0?void 0:t.length)!==null&&o!==void 0?o:0,a=e?0:p;i.setStart(u,a),i.setEnd(u,a)}else s(n)}else s(n);r.removeAllRanges(),r.addRange(i)}}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.focus=void 0;var e=th;Object.defineProperty(n,"focus",{enumerable:!0,get:function(){return e.focus}})})(s8);var nh={},q0={};Object.defineProperty(q0,"__esModule",{value:!0}),q0.getCaretNodeAndOffset=uU;function uU(){var n=window.getSelection();if(n===null)return[null,0];var e=n.focusNode,t=n.focusOffset;return e===null?[null,0]:(e.nodeType!==Node.TEXT_NODE&&e.childNodes.length>0&&(e.childNodes[t]!==void 0?(e=e.childNodes[t],t=0):(e=e.childNodes[t-1],e.textContent!==null&&(t=e.textContent.length))),[e,t])}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.getCaretNodeAndOffset=void 0;var e=q0;Object.defineProperty(n,"getCaretNodeAndOffset",{enumerable:!0,get:function(){return e.getCaretNodeAndOffset}})})(nh);var l8={},K0={};Object.defineProperty(K0,"__esModule",{value:!0}),K0.getRange=pU;function pU(){var n=window.getSelection();return n&&n.rangeCount?n.getRangeAt(0):null}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.getRange=void 0;var e=K0;Object.defineProperty(n,"getRange",{enumerable:!0,get:function(){return e.getRange}})})(l8);var c8={},oh={};Object.defineProperty(oh,"__esModule",{value:!0}),oh.isCaretAtEndOfInput=fU;var d8=cr,mU=nh,hU=ym;function fU(n){var e=(0,d8.getDeepestNode)(n,!0);if(e===null)return!0;if((0,d8.isNativeInput)(e))return e.selectionEnd===e.value.length;var t=(0,mU.getCaretNodeAndOffset)(),o=t[0],a=t[1];return o===null?!1:(0,hU.checkContenteditableSliceForEmptiness)(n,o,a,"right")}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isCaretAtEndOfInput=void 0;var e=oh;Object.defineProperty(n,"isCaretAtEndOfInput",{enumerable:!0,get:function(){return e.isCaretAtEndOfInput}})})(c8);var u8={},ah={};Object.defineProperty(ah,"__esModule",{value:!0}),ah.isCaretAtStartOfInput=bU;var Z0=cr,gU=q0,vU=P0;function bU(n){var e=(0,Z0.getDeepestNode)(n);if(e===null||(0,Z0.isEmpty)(n))return!0;if((0,Z0.isNativeInput)(e))return e.selectionEnd===0;if((0,Z0.isEmpty)(n))return!0;var t=(0,gU.getCaretNodeAndOffset)(),o=t[0],a=t[1];return o===null?!1:(0,vU.checkContenteditableSliceForEmptiness)(n,o,a,"left")}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isCaretAtStartOfInput=void 0;var e=ah;Object.defineProperty(n,"isCaretAtStartOfInput",{enumerable:!0,get:function(){return e.isCaretAtStartOfInput}})})(u8);var p8={},ih={};Object.defineProperty(ih,"__esModule",{value:!0}),ih.save=kU;var yU=cr,CU=K0;function kU(){var n=(0,CU.getRange)(),e=(0,yU.make)("span");if(e.id="cursor",e.hidden=!0,!!n)return n.insertNode(e),function(){var t=window.getSelection();t&&(n.setStartAfter(e),n.setEndAfter(e),t.removeAllRanges(),t.addRange(n),setTimeout(function(){e.remove()},150))}}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.save=void 0;var e=ih;Object.defineProperty(n,"save",{enumerable:!0,get:function(){return e.save}})})(p8),(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.save=n.isCaretAtStartOfInput=n.isCaretAtEndOfInput=n.getRange=n.getCaretNodeAndOffset=n.focus=n.getContenteditableSlice=n.checkContenteditableSliceForEmptiness=void 0;var e=ym;Object.defineProperty(n,"checkContenteditableSliceForEmptiness",{enumerable:!0,get:function(){return e.checkContenteditableSliceForEmptiness}});var t=r8;Object.defineProperty(n,"getContenteditableSlice",{enumerable:!0,get:function(){return t.getContenteditableSlice}});var o=s8;Object.defineProperty(n,"focus",{enumerable:!0,get:function(){return o.focus}});var a=nh;Object.defineProperty(n,"getCaretNodeAndOffset",{enumerable:!0,get:function(){return a.getCaretNodeAndOffset}});var i=l8;Object.defineProperty(n,"getRange",{enumerable:!0,get:function(){return i.getRange}});var r=c8;Object.defineProperty(n,"isCaretAtEndOfInput",{enumerable:!0,get:function(){return r.isCaretAtEndOfInput}});var s=u8;Object.defineProperty(n,"isCaretAtStartOfInput",{enumerable:!0,get:function(){return s.isCaretAtStartOfInput}});var l=p8;Object.defineProperty(n,"save",{enumerable:!0,get:function(){return l.save}})})(Hv);class wU extends Pe{keydown(e){switch(this.beforeKeydownProcessing(e),e.keyCode){case Fe.BACKSPACE:this.backspace(e);break;case Fe.DELETE:this.delete(e);break;case Fe.ENTER:this.enter(e);break;case Fe.DOWN:case Fe.RIGHT:this.arrowRightAndDown(e);break;case Fe.UP:case Fe.LEFT:this.arrowLeftAndUp(e);break;case Fe.TAB:this.tabPressed(e);break}e.key==="/"&&!e.ctrlKey&&!e.metaKey&&this.slashPressed(e),e.code==="Slash"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.commandSlashPressed())}beforeKeydownProcessing(e){this.needToolbarClosing(e)&&rv(e.keyCode)&&(this.Editor.Toolbar.close(),e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||this.Editor.BlockSelection.clearSelection(e))}keyup(e){e.shiftKey||this.Editor.UI.checkEmptiness()}dragOver(e){const t=this.Editor.BlockManager.getBlockByChildNode(e.target);t.dropTarget=!0}dragLeave(e){const t=this.Editor.BlockManager.getBlockByChildNode(e.target);t.dropTarget=!1}handleCommandC(e){const{BlockSelection:t}=this.Editor;t.anyBlockSelected&&t.copySelectedBlocks(e)}handleCommandX(e){const{BlockSelection:t,BlockManager:o,Caret:a}=this.Editor;t.anyBlockSelected&&t.copySelectedBlocks(e).then(()=>{const i=o.removeSelectedBlocks(),r=o.insertDefaultBlockAtIndex(i,!0);a.setToBlock(r,a.positions.START),t.clearSelection(e)})}tabPressed(e){const{InlineToolbar:t,Caret:o}=this.Editor;t.opened||(e.shiftKey?o.navigatePrevious(!0):o.navigateNext(!0))&&e.preventDefault()}commandSlashPressed(){this.Editor.BlockSelection.selectedBlocks.length>1||this.activateBlockSettings()}slashPressed(e){!this.Editor.UI.nodes.wrapper.contains(e.target)||!this.Editor.BlockManager.currentBlock.isEmpty||(e.preventDefault(),this.Editor.Caret.insertContentAtCaretPosition("/"),this.activateToolbox())}enter(e){const{BlockManager:t,UI:o}=this.Editor,a=t.currentBlock;if(a===void 0||a.tool.isLineBreaksEnabled||o.someToolbarOpened&&o.someFlipperButtonFocused||e.shiftKey&&!nm)return;let i=a;a.currentInput!==void 0&&L0(a.currentInput)&&!a.hasMedia?this.Editor.BlockManager.insertDefaultBlockAtIndex(this.Editor.BlockManager.currentBlockIndex):a.currentInput&&N0(a.currentInput)?i=this.Editor.BlockManager.insertDefaultBlockAtIndex(this.Editor.BlockManager.currentBlockIndex+1):i=this.Editor.BlockManager.split(),this.Editor.Caret.setToBlock(i),this.Editor.Toolbar.moveAndOpen(i),e.preventDefault()}backspace(e){const{BlockManager:t,Caret:o}=this.Editor,{currentBlock:a,previousBlock:i}=t;if(!(a===void 0||!_e.isCollapsed||!a.currentInput||!L0(a.currentInput))){if(e.preventDefault(),this.Editor.Toolbar.close(),a.currentInput!==a.firstInput){o.navigatePrevious();return}if(i!==null){if(i.isEmpty){t.removeBlock(i);return}if(a.isEmpty){t.removeBlock(a);const r=t.currentBlock;o.setToBlock(r,o.positions.END);return}yv(i,a)?this.mergeBlocks(i,a):o.setToBlock(i,o.positions.END)}}}delete(e){const{BlockManager:t,Caret:o}=this.Editor,{currentBlock:a,nextBlock:i}=t;if(!(!_e.isCollapsed||!N0(a.currentInput))){if(e.preventDefault(),this.Editor.Toolbar.close(),a.currentInput!==a.lastInput){o.navigateNext();return}if(i!==null){if(i.isEmpty){t.removeBlock(i);return}if(a.isEmpty){t.removeBlock(a),o.setToBlock(i,o.positions.START);return}yv(a,i)?this.mergeBlocks(a,i):o.setToBlock(i,o.positions.START)}}}mergeBlocks(e,t){const{BlockManager:o,Toolbar:a}=this.Editor;e.lastInput!==void 0&&(Hv.focus(e.lastInput,!1),o.mergeBlocks(e,t).then(()=>{a.close()}))}arrowRightAndDown(e){const t=M0.usedKeys.includes(e.keyCode)&&(!e.shiftKey||e.keyCode===Fe.TAB);if(this.Editor.UI.someToolbarOpened&&t)return;this.Editor.Toolbar.close();const{currentBlock:o}=this.Editor.BlockManager,a=(o?.currentInput!==void 0?N0(o.currentInput):void 0)||this.Editor.BlockSelection.anyBlockSelected;if(e.shiftKey&&e.keyCode===Fe.DOWN&&a){this.Editor.CrossBlockSelection.toggleBlockSelectedState();return}if(e.keyCode===Fe.DOWN||e.keyCode===Fe.RIGHT&&!this.isRtl?this.Editor.Caret.navigateNext():this.Editor.Caret.navigatePrevious()){e.preventDefault();return}D0(()=>{this.Editor.BlockManager.currentBlock&&this.Editor.BlockManager.currentBlock.updateCurrentInput()},20)(),this.Editor.BlockSelection.clearSelection(e)}arrowLeftAndUp(e){if(this.Editor.UI.someToolbarOpened){if(M0.usedKeys.includes(e.keyCode)&&(!e.shiftKey||e.keyCode===Fe.TAB))return;this.Editor.UI.closeAllToolbars()}this.Editor.Toolbar.close();const{currentBlock:t}=this.Editor.BlockManager,o=(t?.currentInput!==void 0?L0(t.currentInput):void 0)||this.Editor.BlockSelection.anyBlockSelected;if(e.shiftKey&&e.keyCode===Fe.UP&&o){this.Editor.CrossBlockSelection.toggleBlockSelectedState(!1);return}if(e.keyCode===Fe.UP||e.keyCode===Fe.LEFT&&!this.isRtl?this.Editor.Caret.navigatePrevious():this.Editor.Caret.navigateNext()){e.preventDefault();return}D0(()=>{this.Editor.BlockManager.currentBlock&&this.Editor.BlockManager.currentBlock.updateCurrentInput()},20)(),this.Editor.BlockSelection.clearSelection(e)}needToolbarClosing(e){const t=e.keyCode===Fe.ENTER&&this.Editor.Toolbar.toolbox.opened,o=e.keyCode===Fe.ENTER&&this.Editor.BlockSettings.opened,a=e.keyCode===Fe.ENTER&&this.Editor.InlineToolbar.opened,i=e.keyCode===Fe.TAB;return!(e.shiftKey||i||t||o||a)}activateToolbox(){this.Editor.Toolbar.opened||this.Editor.Toolbar.moveAndOpen(),this.Editor.Toolbar.toolbox.open()}activateBlockSettings(){this.Editor.Toolbar.opened||this.Editor.Toolbar.moveAndOpen(),this.Editor.BlockSettings.opened||this.Editor.BlockSettings.open()}}let rh=class{constructor(e){this.blocks=[],this.workingArea=e}get length(){return this.blocks.length}get array(){return this.blocks}get nodes(){return sv(this.workingArea.children)}static set(e,t,o){return isNaN(Number(t))?(Reflect.set(e,t,o),!0):(e.insert(+t,o),!0)}static get(e,t){return isNaN(Number(t))?Reflect.get(e,t):e.get(+t)}push(e){this.blocks.push(e),this.insertToDOM(e)}swap(e,t){const o=this.blocks[t];Y.swap(this.blocks[e].holder,o.holder),this.blocks[t]=this.blocks[e],this.blocks[e]=o}move(e,t){const o=this.blocks.splice(t,1)[0],a=e-1,i=Math.max(0,a),r=this.blocks[i];e>0?this.insertToDOM(o,"afterend",r):this.insertToDOM(o,"beforebegin",r),this.blocks.splice(e,0,o);const s=this.composeBlockEvent("move",{fromIndex:t,toIndex:e});o.call(Fa.MOVED,s)}insert(e,t,o=!1){if(!this.length){this.push(t);return}e>this.length&&(e=this.length),o&&(this.blocks[e].holder.remove(),this.blocks[e].call(Fa.REMOVED));const a=o?1:0;if(this.blocks.splice(e,a,t),e>0){const i=this.blocks[e-1];this.insertToDOM(t,"afterend",i)}else{const i=this.blocks[e+1];i?this.insertToDOM(t,"beforebegin",i):this.insertToDOM(t)}}replace(e,t){if(this.blocks[e]===void 0)throw Error("Incorrect index");this.blocks[e].holder.replaceWith(t.holder),this.blocks[e]=t}insertMany(e,t){const o=new DocumentFragment;for(const a of e)o.appendChild(a.holder);if(this.length>0){if(t>0){const a=Math.min(t-1,this.length-1);this.blocks[a].holder.after(o)}else t===0&&this.workingArea.prepend(o);this.blocks.splice(t,0,...e)}else this.blocks.push(...e),this.workingArea.appendChild(o);e.forEach(a=>a.call(Fa.RENDERED))}remove(e){isNaN(e)&&(e=this.length-1),this.blocks[e].holder.remove(),this.blocks[e].call(Fa.REMOVED),this.blocks.splice(e,1)}removeAll(){this.workingArea.innerHTML="",this.blocks.forEach(e=>e.call(Fa.REMOVED)),this.blocks.length=0}insertAfter(e,t){const o=this.blocks.indexOf(e);this.insert(o+1,t)}get(e){return this.blocks[e]}indexOf(e){return this.blocks.indexOf(e)}insertToDOM(e,t,o){t?o.holder.insertAdjacentElement(t,e.holder):this.workingArea.appendChild(e.holder),e.call(Fa.RENDERED)}composeBlockEvent(e,t){return new CustomEvent(e,{detail:t})}};const m8="block-removed",h8="block-added",jU="block-moved",f8="block-changed";class _U{constructor(){this.completed=Promise.resolve()}add(e){return new Promise((t,o)=>{this.completed=this.completed.then(e).then(t).catch(o)})}}class xU extends Pe{constructor(){super(...arguments),this._currentBlockIndex=-1,this._blocks=null}get currentBlockIndex(){return this._currentBlockIndex}set currentBlockIndex(e){this._currentBlockIndex=e}get firstBlock(){return this._blocks[0]}get lastBlock(){return this._blocks[this._blocks.length-1]}get currentBlock(){return this._blocks[this.currentBlockIndex]}set currentBlock(e){this.currentBlockIndex=this.getBlockIndex(e)}get nextBlock(){return this.currentBlockIndex===this._blocks.length-1?null:this._blocks[this.currentBlockIndex+1]}get nextContentfulBlock(){return this.blocks.slice(this.currentBlockIndex+1).find(e=>!!e.inputs.length)}get previousContentfulBlock(){return this.blocks.slice(0,this.currentBlockIndex).reverse().find(e=>!!e.inputs.length)}get previousBlock(){return this.currentBlockIndex===0?null:this._blocks[this.currentBlockIndex-1]}get blocks(){return this._blocks.array}get isEditorEmpty(){return this.blocks.every(e=>e.isEmpty)}prepare(){const e=new rh(this.Editor.UI.nodes.redactor);this._blocks=new Proxy(e,{set:rh.set,get:rh.get}),this.listeners.on(document,"copy",t=>this.Editor.BlockEvents.handleCommandC(t))}toggleReadOnly(e){e?this.disableModuleBindings():this.enableModuleBindings()}composeBlock({tool:e,data:t={},id:o=void 0,tunes:a={}}){const i=this.Editor.ReadOnly.isEnabled,r=this.Editor.Tools.blockTools.get(e),s=new Ea({id:o,data:t,tool:r,api:this.Editor.API,readOnly:i,tunesData:a},this.eventsDispatcher);return i||window.requestIdleCallback(()=>{this.bindBlockEvents(s)},{timeout:2e3}),s}insert({id:e=void 0,tool:t=this.config.defaultBlock,data:o={},index:a,needToFocus:i=!0,replace:r=!1,tunes:s={}}={}){let l=a;l===void 0&&(l=this.currentBlockIndex+(r?0:1));const d=this.composeBlock({id:e,tool:t,data:o,tunes:s});return r&&this.blockDidMutated(m8,this.getBlockByIndex(l),{index:l}),this._blocks.insert(l,d,r),this.blockDidMutated(h8,d,{index:l}),i?this.currentBlockIndex=l:l<=this.currentBlockIndex&&this.currentBlockIndex++,d}insertMany(e,t=0){this._blocks.insertMany(e,t)}async update(e,t,o){if(!t&&!o)return e;const a=await e.data,i=this.composeBlock({id:e.id,tool:e.name,data:Object.assign({},a,t??{}),tunes:o??e.tunes}),r=this.getBlockIndex(e);return this._blocks.replace(r,i),this.blockDidMutated(f8,i,{index:r}),i}replace(e,t,o){const a=this.getBlockIndex(e);return this.insert({tool:t,data:o,index:a,replace:!0})}paste(e,t,o=!1){const a=this.insert({tool:e,replace:o});try{window.requestIdleCallback(()=>{a.call(Fa.ON_PASTE,t)})}catch(i){Ue(`${e}: onPaste callback call is failed`,"error",i)}return a}insertDefaultBlockAtIndex(e,t=!1){const o=this.composeBlock({tool:this.config.defaultBlock});return this._blocks[e]=o,this.blockDidMutated(h8,o,{index:e}),t?this.currentBlockIndex=e:e<=this.currentBlockIndex&&this.currentBlockIndex++,o}insertAtEnd(){return this.currentBlockIndex=this.blocks.length-1,this.insert()}async mergeBlocks(e,t){let o;if(e.name===t.name&&e.mergeable){const a=await t.data;if(po(a)){console.error("Could not merge Block. Failed to extract original Block data.");return}const[i]=im([a],e.tool.sanitizeConfig);o=i}else if(e.mergeable&&E0(t,"export")&&E0(e,"import")){const a=await t.exportDataAsString(),i=ea(a,e.tool.sanitizeConfig);o=Cv(i,e.tool.conversionConfig)}o!==void 0&&(await e.mergeWith(o),this.removeBlock(t),this.currentBlockIndex=this._blocks.indexOf(e))}removeBlock(e,t=!0){return new Promise(o=>{const a=this._blocks.indexOf(e);if(!this.validateIndex(a))throw new Error("Can't find a Block to remove");this._blocks.remove(a),e.destroy(),this.blockDidMutated(m8,e,{index:a}),this.currentBlockIndex>=a&&this.currentBlockIndex--,this.blocks.length?a===0&&(this.currentBlockIndex=0):(this.unsetCurrentBlock(),t&&this.insert()),o()})}removeSelectedBlocks(){let e;for(let t=this.blocks.length-1;t>=0;t--)this.blocks[t].selected&&(this.removeBlock(this.blocks[t]),e=t);return e}removeAllBlocks(){for(let e=this.blocks.length-1;e>=0;e--)this._blocks.remove(e);this.unsetCurrentBlock(),this.insert(),this.currentBlock.firstInput.focus()}split(){const e=this.Editor.Caret.extractFragmentFromCaretPosition(),t=Y.make("div");t.appendChild(e);const o={text:Y.isEmpty(t)?"":t.innerHTML};return this.insert({data:o})}getBlockByIndex(e){return e===-1&&(e=this._blocks.length-1),this._blocks[e]}getBlockIndex(e){return this._blocks.indexOf(e)}getBlockById(e){return this._blocks.array.find(t=>t.id===e)}getBlock(e){Y.isElement(e)||(e=e.parentNode);const t=this._blocks.nodes,o=e.closest(`.${Ea.CSS.wrapper}`),a=t.indexOf(o);if(a>=0)return this._blocks[a]}setCurrentBlockByChildNode(e){Y.isElement(e)||(e=e.parentNode);const t=e.closest(`.${Ea.CSS.wrapper}`);if(!t)return;const o=t.closest(`.${this.Editor.UI.CSS.editorWrapper}`);if(o!=null&&o.isEqualNode(this.Editor.UI.nodes.wrapper))return this.currentBlockIndex=this._blocks.nodes.indexOf(t),this.currentBlock.updateCurrentInput(),this.currentBlock}getBlockByChildNode(e){if(!e||!(e instanceof Node))return;Y.isElement(e)||(e=e.parentNode);const t=e.closest(`.${Ea.CSS.wrapper}`);return this.blocks.find(o=>o.holder===t)}swap(e,t){this._blocks.swap(e,t),this.currentBlockIndex=t}move(e,t=this.currentBlockIndex){if(isNaN(e)||isNaN(t)){Ue("Warning during 'move' call: incorrect indices provided.","warn");return}if(!this.validateIndex(e)||!this.validateIndex(t)){Ue("Warning during 'move' call: indices cannot be lower than 0 or greater than the amount of blocks.","warn");return}this._blocks.move(e,t),this.currentBlockIndex=e,this.blockDidMutated(jU,this.currentBlock,{fromIndex:t,toIndex:e})}async convert(e,t,o){if(!await e.save())throw new Error("Could not convert Block. Failed to extract original Block data.");const a=this.Editor.Tools.blockTools.get(t);if(!a)throw new Error(`Could not convert Block. Tool «${t}» not found.`);const i=await e.exportDataAsString(),r=ea(i,a.sanitizeConfig);let s=Cv(r,a.conversionConfig,a.settings);return o&&(s=Object.assign(s,o)),this.replace(e,a.name,s)}unsetCurrentBlock(){this.currentBlockIndex=-1}async clear(e=!1){const t=new _U;[...this.blocks].forEach(o=>{t.add(async()=>{await this.removeBlock(o,!1)})}),await t.completed,this.unsetCurrentBlock(),e&&this.insert(),this.Editor.UI.checkEmptiness()}async destroy(){await Promise.all(this.blocks.map(e=>e.destroy()))}bindBlockEvents(e){const{BlockEvents:t}=this.Editor;this.readOnlyMutableListeners.on(e.holder,"keydown",o=>{t.keydown(o)}),this.readOnlyMutableListeners.on(e.holder,"keyup",o=>{t.keyup(o)}),this.readOnlyMutableListeners.on(e.holder,"dragover",o=>{t.dragOver(o)}),this.readOnlyMutableListeners.on(e.holder,"dragleave",o=>{t.dragLeave(o)}),e.on("didMutated",o=>this.blockDidMutated(f8,o,{index:this.getBlockIndex(o)}))}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}enableModuleBindings(){this.readOnlyMutableListeners.on(document,"cut",e=>this.Editor.BlockEvents.handleCommandX(e)),this.blocks.forEach(e=>{this.bindBlockEvents(e)})}validateIndex(e){return!(e<0||e>=this._blocks.length)}blockDidMutated(e,t,o){const a=new CustomEvent(e,{detail:{target:new Da(t),...o}});return this.eventsDispatcher.emit(hv,{event:a}),t}}class DU extends Pe{constructor(){super(...arguments),this.anyBlockSelectedCache=null,this.needToSelectAll=!1,this.nativeInputSelected=!1,this.readyToBlockSelection=!1}get sanitizerConfig(){return{p:{},h1:{},h2:{},h3:{},h4:{},h5:{},h6:{},ol:{},ul:{},li:{},br:!0,img:{src:!0,width:!0,height:!0},a:{href:!0},b:{},i:{},u:{}}}get allBlocksSelected(){const{BlockManager:e}=this.Editor;return e.blocks.every(t=>t.selected===!0)}set allBlocksSelected(e){const{BlockManager:t}=this.Editor;t.blocks.forEach(o=>{o.selected=e}),this.clearCache()}get anyBlockSelected(){const{BlockManager:e}=this.Editor;return this.anyBlockSelectedCache===null&&(this.anyBlockSelectedCache=e.blocks.some(t=>t.selected===!0)),this.anyBlockSelectedCache}get selectedBlocks(){return this.Editor.BlockManager.blocks.filter(e=>e.selected)}prepare(){this.selection=new _e,hs.add({name:"CMD+A",handler:e=>{const{BlockManager:t,ReadOnly:o}=this.Editor;if(o.isEnabled){e.preventDefault(),this.selectAllBlocks();return}t.currentBlock&&this.handleCommandA(e)},on:this.Editor.UI.nodes.redactor})}toggleReadOnly(){_e.get().removeAllRanges(),this.allBlocksSelected=!1}unSelectBlockByIndex(e){const{BlockManager:t}=this.Editor;let o;isNaN(e)?o=t.currentBlock:o=t.getBlockByIndex(e),o.selected=!1,this.clearCache()}clearSelection(e,t=!1){const{BlockManager:o,Caret:a,RectangleSelection:i}=this.Editor;this.needToSelectAll=!1,this.nativeInputSelected=!1,this.readyToBlockSelection=!1;const r=e&&e instanceof KeyboardEvent,s=r&&rv(e.keyCode);if(this.anyBlockSelected&&r&&s&&!_e.isSelectionExists){const l=o.removeSelectedBlocks();o.insertDefaultBlockAtIndex(l,!0),a.setToBlock(o.currentBlock),D0(()=>{const d=e.key;a.insertContentAtCaretPosition(d.length>1?"":d)},20)()}if(this.Editor.CrossBlockSelection.clear(e),!this.anyBlockSelected||i.isRectActivated()){this.Editor.RectangleSelection.clearSelection();return}t&&this.selection.restore(),this.allBlocksSelected=!1}copySelectedBlocks(e){e.preventDefault();const t=Y.make("div");this.selectedBlocks.forEach(i=>{const r=ea(i.holder.innerHTML,this.sanitizerConfig),s=Y.make("p");s.innerHTML=r,t.appendChild(s)});const o=Array.from(t.childNodes).map(i=>i.textContent).join(`
40
40
 
41
- `),a=t.innerHTML;return e.clipboardData.setData("text/plain",o),e.clipboardData.setData("text/html",a),Promise.all(this.selectedBlocks.map(i=>i.save())).then(i=>{try{e.clipboardData.setData(this.Editor.Paste.MIME_TYPE,JSON.stringify(i))}catch{}})}selectBlockByIndex(e){const{BlockManager:t}=this.Editor,o=t.getBlockByIndex(e);o!==void 0&&this.selectBlock(o)}selectBlock(e){this.selection.save(),_e.get().removeAllRanges(),e.selected=!0,this.clearCache(),this.Editor.InlineToolbar.close()}unselectBlock(e){e.selected=!1,this.clearCache()}clearCache(){this.anyBlockSelectedCache=null}destroy(){hs.remove(this.Editor.UI.nodes.redactor,"CMD+A")}handleCommandA(e){if(this.Editor.RectangleSelection.clearSelection(),Y.isNativeInput(e.target)&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}const t=this.Editor.BlockManager.getBlock(e.target),o=t.inputs;if(o.length>1&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}if(o.length===1&&!this.needToSelectAll){this.needToSelectAll=!0;return}this.needToSelectAll?(e.preventDefault(),this.selectAllBlocks(),this.needToSelectAll=!1,this.readyToBlockSelection=!1):this.readyToBlockSelection&&(e.preventDefault(),this.selectBlock(t),this.needToSelectAll=!0)}selectAllBlocks(){this.selection.save(),_e.get().removeAllRanges(),this.allBlocksSelected=!0,this.Editor.InlineToolbar.close()}}let FU=class l6 extends Pe{get positions(){return{START:"start",END:"end",DEFAULT:"default"}}static get CSS(){return{shadowCaret:"cdx-shadow-caret"}}setToBlock(e,t=this.positions.DEFAULT,o=0){var a;const{BlockManager:i,BlockSelection:r}=this.Editor;if(r.clearSelection(),!e.focusable){(a=window.getSelection())==null||a.removeAllRanges(),r.selectBlock(e),i.currentBlock=e;return}let s;switch(t){case this.positions.START:s=e.firstInput;break;case this.positions.END:s=e.lastInput;break;default:s=e.currentInput}if(!s)return;let l,d=o;if(t===this.positions.START)l=Y.getDeepestNode(s,!1),d=0;else if(t===this.positions.END)l=Y.getDeepestNode(s,!0),d=Y.getContentLength(l);else{const{node:u,offset:p}=Y.getNodeByOffset(s,o);u?(l=u,d=p):(l=Y.getDeepestNode(s,!1),d=0)}this.set(l,d),i.setCurrentBlockByChildNode(e.holder),i.currentBlock.currentInput=s}setToInput(e,t=this.positions.DEFAULT,o=0){const{currentBlock:a}=this.Editor.BlockManager,i=Y.getDeepestNode(e);switch(t){case this.positions.START:this.set(i,0);break;case this.positions.END:this.set(i,Y.getContentLength(i));break;default:o&&this.set(i,o)}a.currentInput=e}set(e,t=0){const{top:o,bottom:a}=_e.setCursor(e,t),{innerHeight:i}=window;o<0?window.scrollBy(0,o-30):a>i&&window.scrollBy(0,a-i+30)}setToTheLastBlock(){const e=this.Editor.BlockManager.lastBlock;if(e)if(e.tool.isDefault&&e.isEmpty)this.setToBlock(e);else{const t=this.Editor.BlockManager.insertAtEnd();this.setToBlock(t)}}extractFragmentFromCaretPosition(){const e=_e.get();if(e.rangeCount){const t=e.getRangeAt(0),o=this.Editor.BlockManager.currentBlock.currentInput;if(t.deleteContents(),o)if(Y.isNativeInput(o)){const a=o,i=document.createDocumentFragment(),r=a.value.substring(0,a.selectionStart),s=a.value.substring(a.selectionStart);return i.textContent=s,a.value=r,i}else{const a=t.cloneRange();return a.selectNodeContents(o),a.setStart(t.endContainer,t.endOffset),a.extractContents()}}}navigateNext(e=!1){const{BlockManager:t}=this.Editor,{currentBlock:o,nextBlock:a}=t;if(o===void 0)return!1;const{nextInput:i,currentInput:r}=o,s=r!==void 0?N0(r):void 0;let l=a;const d=e||s||!o.focusable;if(i&&d)return this.setToInput(i,this.positions.START),!0;if(l===null){if(o.tool.isDefault||!d)return!1;l=t.insertAtEnd()}return d?(this.setToBlock(l,this.positions.START),!0):!1}navigatePrevious(e=!1){const{currentBlock:t,previousBlock:o}=this.Editor.BlockManager;if(!t)return!1;const{previousInput:a,currentInput:i}=t,r=i!==void 0?L0(i):void 0,s=e||r||!t.focusable;return a&&s?(this.setToInput(a,this.positions.END),!0):o!==null&&s?(this.setToBlock(o,this.positions.END),!0):!1}createShadow(e){const t=document.createElement("span");t.classList.add(l6.CSS.shadowCaret),e.insertAdjacentElement("beforeend",t)}restoreCaret(e){const t=e.querySelector(`.${l6.CSS.shadowCaret}`);if(!t)return;new _e().expandToTag(t);const o=document.createRange();o.selectNode(t),o.extractContents()}insertContentAtCaretPosition(e){const t=document.createDocumentFragment(),o=document.createElement("div"),a=_e.get(),i=_e.range;o.innerHTML=e,Array.from(o.childNodes).forEach(d=>t.appendChild(d)),t.childNodes.length===0&&t.appendChild(new Text);const r=t.lastChild;i.deleteContents(),i.insertNode(t);const s=document.createRange(),l=r.nodeType===Node.TEXT_NODE?r:r.firstChild;l!==null&&l.textContent!==null&&s.setStart(l,l.textContent.length),a.removeAllRanges(),a.addRange(s)}};class EU extends Pe{constructor(){super(...arguments),this.onMouseUp=()=>{this.listeners.off(document,"mouseover",this.onMouseOver),this.listeners.off(document,"mouseup",this.onMouseUp)},this.onMouseOver=e=>{const{BlockManager:t,BlockSelection:o}=this.Editor;if(e.relatedTarget===null&&e.target===null)return;const a=t.getBlockByChildNode(e.relatedTarget)||this.lastSelectedBlock,i=t.getBlockByChildNode(e.target);if(!(!a||!i)&&i!==a){if(a===this.firstSelectedBlock){_e.get().removeAllRanges(),a.selected=!0,i.selected=!0,o.clearCache();return}if(i===this.firstSelectedBlock){a.selected=!1,i.selected=!1,o.clearCache();return}this.Editor.InlineToolbar.close(),this.toggleBlocksSelectedState(a,i),this.lastSelectedBlock=i}}}async prepare(){this.listeners.on(document,"mousedown",e=>{this.enableCrossBlockSelection(e)})}watchSelection(e){if(e.button!==mz.LEFT)return;const{BlockManager:t}=this.Editor;this.firstSelectedBlock=t.getBlock(e.target),this.lastSelectedBlock=this.firstSelectedBlock,this.listeners.on(document,"mouseover",this.onMouseOver),this.listeners.on(document,"mouseup",this.onMouseUp)}get isCrossBlockSelectionStarted(){return!!this.firstSelectedBlock&&!!this.lastSelectedBlock&&this.firstSelectedBlock!==this.lastSelectedBlock}toggleBlockSelectedState(e=!0){const{BlockManager:t,BlockSelection:o}=this.Editor;this.lastSelectedBlock||(this.lastSelectedBlock=this.firstSelectedBlock=t.currentBlock),this.firstSelectedBlock===this.lastSelectedBlock&&(this.firstSelectedBlock.selected=!0,o.clearCache(),_e.get().removeAllRanges());const a=t.blocks.indexOf(this.lastSelectedBlock)+(e?1:-1),i=t.blocks[a];i&&(this.lastSelectedBlock.selected!==i.selected?(i.selected=!0,o.clearCache()):(this.lastSelectedBlock.selected=!1,o.clearCache()),this.lastSelectedBlock=i,this.Editor.InlineToolbar.close(),i.holder.scrollIntoView({block:"nearest"}))}clear(e){const{BlockManager:t,BlockSelection:o,Caret:a}=this.Editor,i=t.blocks.indexOf(this.firstSelectedBlock),r=t.blocks.indexOf(this.lastSelectedBlock);if(o.anyBlockSelected&&i>-1&&r>-1&&e&&e instanceof KeyboardEvent)switch(e.keyCode){case Fe.DOWN:case Fe.RIGHT:a.setToBlock(t.blocks[Math.max(i,r)],a.positions.END);break;case Fe.UP:case Fe.LEFT:a.setToBlock(t.blocks[Math.min(i,r)],a.positions.START);break;default:a.setToBlock(t.blocks[Math.max(i,r)],a.positions.END)}this.firstSelectedBlock=this.lastSelectedBlock=null}enableCrossBlockSelection(e){const{UI:t}=this.Editor;_e.isCollapsed||this.Editor.BlockSelection.clearSelection(e),t.nodes.redactor.contains(e.target)?this.watchSelection(e):this.Editor.BlockSelection.clearSelection(e)}toggleBlocksSelectedState(e,t){const{BlockManager:o,BlockSelection:a}=this.Editor,i=o.blocks.indexOf(e),r=o.blocks.indexOf(t),s=e.selected!==t.selected;for(let l=Math.min(i,r);l<=Math.max(i,r);l++){const d=o.blocks[l];d!==this.firstSelectedBlock&&d!==(s?e:t)&&(o.blocks[l].selected=!o.blocks[l].selected,a.clearCache())}}}class SU extends Pe{constructor(){super(...arguments),this.isStartedAtEditor=!1}toggleReadOnly(e){e?this.disableModuleBindings():this.enableModuleBindings()}enableModuleBindings(){const{UI:e}=this.Editor;this.readOnlyMutableListeners.on(e.nodes.holder,"drop",async t=>{await this.processDrop(t)},!0),this.readOnlyMutableListeners.on(e.nodes.holder,"dragstart",()=>{this.processDragStart()}),this.readOnlyMutableListeners.on(e.nodes.holder,"dragover",t=>{this.processDragOver(t)},!0)}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}async processDrop(e){const{BlockManager:t,Paste:o,Caret:a}=this.Editor;e.preventDefault(),t.blocks.forEach(r=>{r.dropTarget=!1}),_e.isAtEditor&&!_e.isCollapsed&&this.isStartedAtEditor&&document.execCommand("delete"),this.isStartedAtEditor=!1;const i=t.setCurrentBlockByChildNode(e.target);if(i)this.Editor.Caret.setToBlock(i,a.positions.END);else{const r=t.setCurrentBlockByChildNode(t.lastBlock.holder);this.Editor.Caret.setToBlock(r,a.positions.END)}await o.processDataTransfer(e.dataTransfer,!0)}processDragStart(){_e.isAtEditor&&!_e.isCollapsed&&(this.isStartedAtEditor=!0),this.Editor.InlineToolbar.close()}processDragOver(e){e.preventDefault()}}const IU=180,MU=400;class BU extends Pe{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t}),this.disabled=!1,this.batchingTimeout=null,this.batchingOnChangeQueue=new Map,this.batchTime=MU,this.mutationObserver=new MutationObserver(o=>{this.redactorChanged(o)}),this.eventsDispatcher.on(hv,o=>{this.particularBlockChanged(o.event)}),this.eventsDispatcher.on(fv,()=>{this.disable()}),this.eventsDispatcher.on(gv,()=>{this.enable()})}enable(){this.mutationObserver.observe(this.Editor.UI.nodes.redactor,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),this.disabled=!1}disable(){this.mutationObserver.disconnect(),this.disabled=!0}particularBlockChanged(e){this.disabled||!bt(this.config.onChange)||(this.batchingOnChangeQueue.set(`block:${e.detail.target.id}:event:${e.type}`,e),this.batchingTimeout&&clearTimeout(this.batchingTimeout),this.batchingTimeout=setTimeout(()=>{let t;this.batchingOnChangeQueue.size===1?t=this.batchingOnChangeQueue.values().next().value:t=Array.from(this.batchingOnChangeQueue.values()),this.config.onChange&&this.config.onChange(this.Editor.API.methods,t),this.batchingOnChangeQueue.clear()},this.batchTime))}redactorChanged(e){this.eventsDispatcher.emit(om,{mutations:e})}}const g8=class Mx extends Pe{constructor(){super(...arguments),this.MIME_TYPE="application/x-editor-js",this.toolsTags={},this.tagsByTool={},this.toolsPatterns=[],this.toolsFiles={},this.exceptionList=[],this.processTool=e=>{try{const t=e.create({},{},!1);if(e.pasteConfig===!1){this.exceptionList.push(e.name);return}if(!bt(t.onPaste))return;this.getTagsConfig(e),this.getFilesConfig(e),this.getPatternsConfig(e)}catch(t){Ue(`Paste handling for «${e.name}» Tool hasn't been set up because of the error`,"warn",t)}},this.handlePasteEvent=async e=>{const{BlockManager:t,Toolbar:o}=this.Editor,a=t.setCurrentBlockByChildNode(e.target);!a||this.isNativeBehaviour(e.target)&&!e.clipboardData.types.includes("Files")||a&&this.exceptionList.includes(a.name)||(e.preventDefault(),this.processDataTransfer(e.clipboardData),o.close())}}async prepare(){this.processTools()}toggleReadOnly(e){e?this.unsetCallback():this.setCallback()}async processDataTransfer(e,t=!1){const{Tools:o}=this.Editor,a=e.types;if((a.includes?a.includes("Files"):a.contains("Files"))&&!po(this.toolsFiles)){await this.processFiles(e.files);return}const i=e.getData(this.MIME_TYPE),r=e.getData("text/plain");let s=e.getData("text/html");if(i)try{this.insertEditorJSData(JSON.parse(i));return}catch{}t&&r.trim()&&s.trim()&&(s="<p>"+(s.trim()?s:r)+"</p>");const l=Object.keys(this.toolsTags).reduce((p,m)=>(p[m.toLowerCase()]=this.toolsTags[m].sanitizationConfig??{},p),{}),d=Object.assign({},l,o.getAllInlineToolsSanitizeConfig(),{br:{}}),u=ea(s,d);!u.trim()||u.trim()===r||!Y.isHTMLString(u)?await this.processText(r):await this.processText(u,!0)}async processText(e,t=!1){const{Caret:o,BlockManager:a}=this.Editor,i=t?this.processHTML(e):this.processPlain(e);if(!i.length)return;if(i.length===1){i[0].isBlock?this.processSingleBlock(i.pop()):this.processInlinePaste(i.pop());return}const r=a.currentBlock&&a.currentBlock.tool.isDefault&&a.currentBlock.isEmpty;i.map(async(s,l)=>this.insertBlock(s,l===0&&r)),a.currentBlock&&o.setToBlock(a.currentBlock,o.positions.END)}setCallback(){this.listeners.on(this.Editor.UI.nodes.holder,"paste",this.handlePasteEvent)}unsetCallback(){this.listeners.off(this.Editor.UI.nodes.holder,"paste",this.handlePasteEvent)}processTools(){const e=this.Editor.Tools.blockTools;Array.from(e.values()).forEach(this.processTool)}collectTagNames(e){return xa(e)?[e]:tn(e)?Object.keys(e):[]}getTagsConfig(e){if(e.pasteConfig===!1)return;const t=e.pasteConfig.tags||[],o=[];t.forEach(a=>{const i=this.collectTagNames(a);o.push(...i),i.forEach(r=>{if(Object.prototype.hasOwnProperty.call(this.toolsTags,r)){Ue(`Paste handler for «${e.name}» Tool on «${r}» tag is skipped because it is already used by «${this.toolsTags[r].tool.name}» Tool.`,"warn");return}const s=tn(a)?a[r]:null;this.toolsTags[r.toUpperCase()]={tool:e,sanitizationConfig:s}})}),this.tagsByTool[e.name]=o.map(a=>a.toUpperCase())}getFilesConfig(e){if(e.pasteConfig===!1)return;const{files:t={}}=e.pasteConfig;let{extensions:o,mimeTypes:a}=t;!o&&!a||(o&&!Array.isArray(o)&&(Ue(`«extensions» property of the onDrop config for «${e.name}» Tool should be an array`),o=[]),a&&!Array.isArray(a)&&(Ue(`«mimeTypes» property of the onDrop config for «${e.name}» Tool should be an array`),a=[]),a&&(a=a.filter(i=>bz(i)?!0:(Ue(`MIME type value «${i}» for the «${e.name}» Tool is not a valid MIME type`,"warn"),!1))),this.toolsFiles[e.name]={extensions:o||[],mimeTypes:a||[]})}getPatternsConfig(e){e.pasteConfig===!1||!e.pasteConfig.patterns||po(e.pasteConfig.patterns)||Object.entries(e.pasteConfig.patterns).forEach(([t,o])=>{o instanceof RegExp||Ue(`Pattern ${o} for «${e.name}» Tool is skipped because it should be a Regexp instance.`,"warn"),this.toolsPatterns.push({key:t,pattern:o,tool:e})})}isNativeBehaviour(e){return Y.isNativeInput(e)}async processFiles(e){const{BlockManager:t}=this.Editor;let o;o=await Promise.all(Array.from(e).map(i=>this.processFile(i))),o=o.filter(i=>!!i);const a=t.currentBlock.tool.isDefault&&t.currentBlock.isEmpty;o.forEach((i,r)=>{t.paste(i.type,i.event,r===0&&a)})}async processFile(e){const t=vz(e),o=Object.entries(this.toolsFiles).find(([i,{mimeTypes:r,extensions:s}])=>{const[l,d]=e.type.split("/"),u=s.find(m=>m.toLowerCase()===t.toLowerCase()),p=r.find(m=>{const[h,f]=m.split("/");return h===l&&(f===d||f==="*")});return!!u||!!p});if(!o)return;const[a]=o;return{event:this.composePasteEvent("file",{file:e}),type:a}}processHTML(e){const{Tools:t}=this.Editor,o=Y.make("DIV");return o.innerHTML=e,this.getNodes(o).map(a=>{let i,r=t.defaultTool,s=!1;switch(a.nodeType){case Node.DOCUMENT_FRAGMENT_NODE:i=Y.make("div"),i.appendChild(a);break;case Node.ELEMENT_NODE:i=a,s=!0,this.toolsTags[i.tagName]&&(r=this.toolsTags[i.tagName].tool);break}const{tags:l}=r.pasteConfig||{tags:[]},d=l.reduce((m,h)=>(this.collectTagNames(h).forEach(f=>{const g=tn(h)?h[f]:null;m[f.toLowerCase()]=g||{}}),m),{}),u=Object.assign({},d,r.baseSanitizeConfig);if(i.tagName.toLowerCase()==="table"){const m=ea(i.outerHTML,u);i=Y.make("div",void 0,{innerHTML:m}).firstChild}else i.innerHTML=ea(i.innerHTML,u);const p=this.composePasteEvent("tag",{data:i});return{content:i,isBlock:s,tool:r.name,event:p}}).filter(a=>{const i=Y.isEmpty(a.content),r=Y.isSingleTag(a.content);return!i||r})}processPlain(e){const{defaultBlock:t}=this.config;if(!e)return[];const o=t;return e.split(/\r?\n/).filter(a=>a.trim()).map(a=>{const i=Y.make("div");i.textContent=a;const r=this.composePasteEvent("tag",{data:i});return{content:i,tool:o,isBlock:!1,event:r}})}async processSingleBlock(e){const{Caret:t,BlockManager:o}=this.Editor,{currentBlock:a}=o;if(!a||e.tool!==a.name||!Y.containsOnlyInlineElements(e.content.innerHTML)){this.insertBlock(e,a?.tool.isDefault&&a.isEmpty);return}t.insertContentAtCaretPosition(e.content.innerHTML)}async processInlinePaste(e){const{BlockManager:t,Caret:o}=this.Editor,{content:a}=e;if(t.currentBlock&&t.currentBlock.tool.isDefault&&a.textContent.length<Mx.PATTERN_PROCESSING_MAX_LENGTH){const i=await this.processPattern(a.textContent);if(i){const r=t.currentBlock&&t.currentBlock.tool.isDefault&&t.currentBlock.isEmpty,s=t.paste(i.tool,i.event,r);o.setToBlock(s,o.positions.END);return}}if(t.currentBlock&&t.currentBlock.currentInput){const i=t.currentBlock.tool.baseSanitizeConfig;document.execCommand("insertHTML",!1,ea(a.innerHTML,i))}else this.insertBlock(e)}async processPattern(e){const t=this.toolsPatterns.find(o=>{const a=o.pattern.exec(e);return a?e===a.shift():!1});return t?{event:this.composePasteEvent("pattern",{key:t.key,data:e}),tool:t.tool.name}:void 0}insertBlock(e,t=!1){const{BlockManager:o,Caret:a}=this.Editor,{currentBlock:i}=o;let r;if(t&&i&&i.isEmpty){r=o.paste(e.tool,e.event,!0),a.setToBlock(r,a.positions.END);return}r=o.paste(e.tool,e.event),a.setToBlock(r,a.positions.END)}insertEditorJSData(e){const{BlockManager:t,Caret:o,Tools:a}=this.Editor;im(e,i=>a.blockTools.get(i).sanitizeConfig).forEach(({tool:i,data:r},s)=>{let l=!1;s===0&&(l=t.currentBlock&&t.currentBlock.tool.isDefault&&t.currentBlock.isEmpty);const d=t.insert({tool:i,data:r,replace:l});o.setToBlock(d,o.positions.END)})}processElementNode(e,t,o){const a=Object.keys(this.toolsTags),i=e,{tool:r}=this.toolsTags[i.tagName]||{},s=this.tagsByTool[r?.name]||[],l=a.includes(i.tagName),d=Y.blockElements.includes(i.tagName.toLowerCase()),u=Array.from(i.children).some(({tagName:m})=>a.includes(m)&&!s.includes(m)),p=Array.from(i.children).some(({tagName:m})=>Y.blockElements.includes(m.toLowerCase()));if(!d&&!l&&!u)return o.appendChild(i),[...t,o];if(l&&!u||d&&!p&&!u)return[...t,o,i]}getNodes(e){const t=Array.from(e.childNodes);let o;const a=(i,r)=>{if(Y.isEmpty(r)&&!Y.isSingleTag(r))return i;const s=i[i.length-1];let l=new DocumentFragment;switch(s&&Y.isFragment(s)&&(l=i.pop()),r.nodeType){case Node.ELEMENT_NODE:if(o=this.processElementNode(r,i,l),o)return o;break;case Node.TEXT_NODE:return l.appendChild(r),[...i,l];default:return[...i,l]}return[...i,...Array.from(r.childNodes).reduce(a,[])]};return t.reduce(a,[])}composePasteEvent(e,t){return new CustomEvent(e,{detail:t})}};g8.PATTERN_PROCESSING_MAX_LENGTH=450;let TU=g8;class AU extends Pe{constructor(){super(...arguments),this.toolsDontSupportReadOnly=[],this.readOnlyEnabled=!1}get isEnabled(){return this.readOnlyEnabled}async prepare(){const{Tools:e}=this.Editor,{blockTools:t}=e,o=[];Array.from(t.entries()).forEach(([a,i])=>{i.isReadOnlySupported||o.push(a)}),this.toolsDontSupportReadOnly=o,this.config.readOnly&&o.length>0&&this.throwCriticalError(),this.toggle(this.config.readOnly,!0)}async toggle(e=!this.readOnlyEnabled,t=!1){e&&this.toolsDontSupportReadOnly.length>0&&this.throwCriticalError();const o=this.readOnlyEnabled;this.readOnlyEnabled=e;for(const i in this.Editor)this.Editor[i].toggleReadOnly&&this.Editor[i].toggleReadOnly(e);if(o===e)return this.readOnlyEnabled;if(t)return this.readOnlyEnabled;this.Editor.ModificationsObserver.disable();const a=await this.Editor.Saver.save();return await this.Editor.BlockManager.clear(),await this.Editor.Renderer.render(a.blocks),this.Editor.ModificationsObserver.enable(),this.readOnlyEnabled}throwCriticalError(){throw new mv(`To enable read-only mode all connected tools should support it. Tools ${this.toolsDontSupportReadOnly.join(", ")} don't support read-only mode.`)}}let OU=class vp extends Pe{constructor(){super(...arguments),this.isRectSelectionActivated=!1,this.SCROLL_SPEED=3,this.HEIGHT_OF_SCROLL_ZONE=40,this.BOTTOM_SCROLL_ZONE=1,this.TOP_SCROLL_ZONE=2,this.MAIN_MOUSE_BUTTON=0,this.mousedown=!1,this.isScrolling=!1,this.inScrollZone=null,this.startX=0,this.startY=0,this.mouseX=0,this.mouseY=0,this.stackOfSelected=[],this.listenerIds=[]}static get CSS(){return{overlay:"codex-editor-overlay",overlayContainer:"codex-editor-overlay__container",rect:"codex-editor-overlay__rectangle",topScrollZone:"codex-editor-overlay__scroll-zone--top",bottomScrollZone:"codex-editor-overlay__scroll-zone--bottom"}}prepare(){this.enableModuleBindings()}startSelection(e,t){const o=document.elementFromPoint(e-window.pageXOffset,t-window.pageYOffset);o.closest(`.${this.Editor.Toolbar.CSS.toolbar}`)||(this.Editor.BlockSelection.allBlocksSelected=!1,this.clearSelection(),this.stackOfSelected=[]);const a=[`.${Ea.CSS.content}`,`.${this.Editor.Toolbar.CSS.toolbar}`,`.${this.Editor.InlineToolbar.CSS.inlineToolbar}`],i=o.closest("."+this.Editor.UI.CSS.editorWrapper),r=a.some(s=>!!o.closest(s));!i||r||(this.mousedown=!0,this.startX=e,this.startY=t)}endSelection(){this.mousedown=!1,this.startX=0,this.startY=0,this.overlayRectangle.style.display="none"}isRectActivated(){return this.isRectSelectionActivated}clearSelection(){this.isRectSelectionActivated=!1}enableModuleBindings(){const{container:e}=this.genHTML();this.listeners.on(e,"mousedown",t=>{this.processMouseDown(t)},!1),this.listeners.on(document.body,"mousemove",J1(t=>{this.processMouseMove(t)},10),{passive:!0}),this.listeners.on(document.body,"mouseleave",()=>{this.processMouseLeave()}),this.listeners.on(window,"scroll",J1(t=>{this.processScroll(t)},10),{passive:!0}),this.listeners.on(document.body,"mouseup",()=>{this.processMouseUp()},!1)}processMouseDown(e){e.button===this.MAIN_MOUSE_BUTTON&&(e.target.closest(Y.allInputsSelector)!==null||this.startSelection(e.pageX,e.pageY))}processMouseMove(e){this.changingRectangle(e),this.scrollByZones(e.clientY)}processMouseLeave(){this.clearSelection(),this.endSelection()}processScroll(e){this.changingRectangle(e)}processMouseUp(){this.clearSelection(),this.endSelection()}scrollByZones(e){if(this.inScrollZone=null,e<=this.HEIGHT_OF_SCROLL_ZONE&&(this.inScrollZone=this.TOP_SCROLL_ZONE),document.documentElement.clientHeight-e<=this.HEIGHT_OF_SCROLL_ZONE&&(this.inScrollZone=this.BOTTOM_SCROLL_ZONE),!this.inScrollZone){this.isScrolling=!1;return}this.isScrolling||(this.scrollVertical(this.inScrollZone===this.TOP_SCROLL_ZONE?-this.SCROLL_SPEED:this.SCROLL_SPEED),this.isScrolling=!0)}genHTML(){const{UI:e}=this.Editor,t=e.nodes.holder.querySelector("."+e.CSS.editorWrapper),o=Y.make("div",vp.CSS.overlay,{}),a=Y.make("div",vp.CSS.overlayContainer,{}),i=Y.make("div",vp.CSS.rect,{});return a.appendChild(i),o.appendChild(a),t.appendChild(o),this.overlayRectangle=i,{container:t,overlay:o}}scrollVertical(e){if(!(this.inScrollZone&&this.mousedown))return;const t=window.pageYOffset;window.scrollBy(0,e),this.mouseY+=window.pageYOffset-t,setTimeout(()=>{this.scrollVertical(e)},0)}changingRectangle(e){if(!this.mousedown)return;e.pageY!==void 0&&(this.mouseX=e.pageX,this.mouseY=e.pageY);const{rightPos:t,leftPos:o,index:a}=this.genInfoForMouseSelection(),i=this.startX>t&&this.mouseX>t,r=this.startX<o&&this.mouseX<o;this.rectCrossesBlocks=!(i||r),this.isRectSelectionActivated||(this.rectCrossesBlocks=!1,this.isRectSelectionActivated=!0,this.shrinkRectangleToPoint(),this.overlayRectangle.style.display="block"),this.updateRectangleSize(),this.Editor.Toolbar.close(),a!==void 0&&(this.trySelectNextBlock(a),this.inverseSelection(),_e.get().removeAllRanges())}shrinkRectangleToPoint(){this.overlayRectangle.style.left=`${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.top=`${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.bottom=`calc(100% - ${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.right=`calc(100% - ${this.startX-window.pageXOffset}px`}inverseSelection(){const e=this.Editor.BlockManager.getBlockByIndex(this.stackOfSelected[0]).selected;if(this.rectCrossesBlocks&&!e)for(const t of this.stackOfSelected)this.Editor.BlockSelection.selectBlockByIndex(t);if(!this.rectCrossesBlocks&&e)for(const t of this.stackOfSelected)this.Editor.BlockSelection.unSelectBlockByIndex(t)}updateRectangleSize(){this.mouseY>=this.startY?(this.overlayRectangle.style.top=`${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.bottom=`calc(100% - ${this.mouseY-window.pageYOffset}px`):(this.overlayRectangle.style.bottom=`calc(100% - ${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.top=`${this.mouseY-window.pageYOffset}px`),this.mouseX>=this.startX?(this.overlayRectangle.style.left=`${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.right=`calc(100% - ${this.mouseX-window.pageXOffset}px`):(this.overlayRectangle.style.right=`calc(100% - ${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.left=`${this.mouseX-window.pageXOffset}px`)}genInfoForMouseSelection(){const e=document.body.offsetWidth/2,t=this.mouseY-window.pageYOffset,o=document.elementFromPoint(e,t),a=this.Editor.BlockManager.getBlockByChildNode(o);let i;a!==void 0&&(i=this.Editor.BlockManager.blocks.findIndex(u=>u.holder===a.holder));const r=this.Editor.BlockManager.lastBlock.holder.querySelector("."+Ea.CSS.content),s=Number.parseInt(window.getComputedStyle(r).width,10)/2,l=e-s,d=e+s;return{index:i,leftPos:l,rightPos:d}}addBlockInSelection(e){this.rectCrossesBlocks&&this.Editor.BlockSelection.selectBlockByIndex(e),this.stackOfSelected.push(e)}trySelectNextBlock(e){const t=this.stackOfSelected[this.stackOfSelected.length-1]===e,o=this.stackOfSelected.length,a=1,i=-1,r=0;if(t)return;const s=this.stackOfSelected[o-1]-this.stackOfSelected[o-2]>0;let l=r;o>1&&(l=s?a:i);const d=e>this.stackOfSelected[o-1]&&l===a,u=e<this.stackOfSelected[o-1]&&l===i,p=!(d||u||l===r);if(!p&&(e>this.stackOfSelected[o-1]||this.stackOfSelected[o-1]===void 0)){let f=this.stackOfSelected[o-1]+1||e;for(f;f<=e;f++)this.addBlockInSelection(f);return}if(!p&&e<this.stackOfSelected[o-1]){for(let f=this.stackOfSelected[o-1]-1;f>=e;f--)this.addBlockInSelection(f);return}if(!p)return;let m=o-1,h;for(e>this.stackOfSelected[o-1]?h=()=>e>this.stackOfSelected[m]:h=()=>e<this.stackOfSelected[m];h();)this.rectCrossesBlocks&&this.Editor.BlockSelection.unSelectBlockByIndex(this.stackOfSelected[m]),this.stackOfSelected.pop(),m--}};class LU extends Pe{async render(e){return new Promise(t=>{const{Tools:o,BlockManager:a}=this.Editor;if(e.length===0)a.insert();else{const i=e.map(({type:r,data:s,tunes:l,id:d})=>{o.available.has(r)===!1&&(uo(`Tool «${r}» is not found. Check 'tools' property at the Editor.js config.`,"warn"),s=this.composeStubDataForTool(r,s,d),r=o.stubTool);let u;try{u=a.composeBlock({id:d,tool:r,data:s,tunes:l})}catch(p){Ue(`Block «${r}» skipped because of plugins error`,"error",{data:s,error:p}),s=this.composeStubDataForTool(r,s,d),r=o.stubTool,u=a.composeBlock({id:d,tool:r,data:s,tunes:l})}return u});a.insertMany(i)}window.requestIdleCallback(()=>{t()},{timeout:2e3})})}composeStubDataForTool(e,t,o){const{Tools:a}=this.Editor;let i=e;if(a.unavailable.has(e)){const r=a.unavailable.get(e).toolbox;r!==void 0&&r[0].title!==void 0&&(i=r[0].title)}return{savedData:{id:o,type:e,data:t},title:i}}}class NU extends Pe{async save(){const{BlockManager:e,Tools:t}=this.Editor,o=e.blocks,a=[];try{o.forEach(s=>{a.push(this.getSavedData(s))});const i=await Promise.all(a),r=await im(i,s=>t.blockTools.get(s).sanitizeConfig);return this.makeOutput(r)}catch(i){uo("Saving failed due to the Error %o","error",i)}}async getSavedData(e){const t=await e.save(),o=t&&await e.validate(t.data);return{...t,isValid:o}}makeOutput(e){const t=[];return e.forEach(({id:o,tool:a,data:i,tunes:r,isValid:s})=>{if(!s){Ue(`Block «${a}» skipped because saved data is invalid`);return}if(a===this.Editor.Tools.stubTool){t.push(i);return}const l={id:o,type:a,data:i,...!po(r)&&{tunes:r}};t.push(l)}),{time:+new Date,blocks:t,version:"2.31.2"}}}(function(){try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode(".ce-paragraph{line-height:1.6em;outline:none}.ce-block:only-of-type .ce-paragraph[data-placeholder-active]:empty:before,.ce-block:only-of-type .ce-paragraph[data-placeholder-active][data-empty=true]:before{content:attr(data-placeholder-active)}.ce-paragraph p:first-of-type{margin-top:0}.ce-paragraph p:last-of-type{margin-bottom:0}")),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const PU='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 9V7.2C8 7.08954 8.08954 7 8.2 7L12 7M16 9V7.2C16 7.08954 15.9105 7 15.8 7L12 7M12 7L12 17M12 17H10M12 17H14"/></svg>';function RU(n){const e=document.createElement("div");e.innerHTML=n.trim();const t=document.createDocumentFragment();return t.append(...Array.from(e.childNodes)),t}let VU=class Bx{static get DEFAULT_PLACEHOLDER(){return""}constructor({data:e,config:t,api:o,readOnly:a}){this.api=o,this.readOnly=a,this._CSS={block:this.api.styles.block,wrapper:"ce-paragraph"},this.readOnly||(this.onKeyUp=this.onKeyUp.bind(this)),this._placeholder=t.placeholder?t.placeholder:Bx.DEFAULT_PLACEHOLDER,this._data=e??{},this._element=null,this._preserveBlank=t.preserveBlank??!1}onKeyUp(e){if(e.code!=="Backspace"&&e.code!=="Delete"||!this._element)return;const{textContent:t}=this._element;t===""&&(this._element.innerHTML="")}drawView(){const e=document.createElement("DIV");return e.classList.add(this._CSS.wrapper,this._CSS.block),e.contentEditable="false",e.dataset.placeholderActive=this.api.i18n.t(this._placeholder),this._data.text&&(e.innerHTML=this._data.text),this.readOnly||(e.contentEditable="true",e.addEventListener("keyup",this.onKeyUp)),e}render(){return this._element=this.drawView(),this._element}merge(e){if(!this._element)return;this._data.text+=e.text;const t=RU(e.text);this._element.appendChild(t),this._element.normalize()}validate(e){return!(e.text.trim()===""&&!this._preserveBlank)}save(e){return{text:e.innerHTML}}onPaste(e){const t={text:e.detail.data.innerHTML};this._data=t,window.requestAnimationFrame(()=>{this._element&&(this._element.innerHTML=this._data.text||"")})}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{text:{br:!0}}}static get isReadOnlySupported(){return!0}static get pasteConfig(){return{tags:["P"]}}static get toolbox(){return{icon:PU,title:"Text"}}},sh=class{constructor(){this.commandName="bold"}static get sanitize(){return{b:{}}}render(){return{icon:u$,name:"bold",onActivate:()=>{document.execCommand(this.commandName)},isActive:()=>document.queryCommandState(this.commandName)}}get shortcut(){return"CMD+B"}};sh.isInline=!0,sh.title="Bold";let lh=class{constructor(){this.commandName="italic",this.CSS={button:"ce-inline-tool",buttonActive:"ce-inline-tool--active",buttonModifier:"ce-inline-tool--italic"},this.nodes={button:null}}static get sanitize(){return{i:{}}}render(){return this.nodes.button=document.createElement("button"),this.nodes.button.type="button",this.nodes.button.classList.add(this.CSS.button,this.CSS.buttonModifier),this.nodes.button.innerHTML=b$,this.nodes.button}surround(){document.execCommand(this.commandName)}checkState(){const e=document.queryCommandState(this.commandName);return this.nodes.button.classList.toggle(this.CSS.buttonActive,e),e}get shortcut(){return"CMD+I"}};lh.isInline=!0,lh.title="Italic";let ch=class{constructor({api:e}){this.commandLink="createLink",this.commandUnlink="unlink",this.ENTER_KEY=13,this.CSS={button:"ce-inline-tool",buttonActive:"ce-inline-tool--active",buttonModifier:"ce-inline-tool--link",buttonUnlink:"ce-inline-tool--unlink",input:"ce-inline-tool-input",inputShowed:"ce-inline-tool-input--showed"},this.nodes={button:null,input:null},this.inputOpened=!1,this.toolbar=e.toolbar,this.inlineToolbar=e.inlineToolbar,this.notifier=e.notifier,this.i18n=e.i18n,this.selection=new _e}static get sanitize(){return{a:{href:!0,target:"_blank",rel:"nofollow"}}}render(){return this.nodes.button=document.createElement("button"),this.nodes.button.type="button",this.nodes.button.classList.add(this.CSS.button,this.CSS.buttonModifier),this.nodes.button.innerHTML=Dv,this.nodes.button}renderActions(){return this.nodes.input=document.createElement("input"),this.nodes.input.placeholder=this.i18n.t("Add a link"),this.nodes.input.enterKeyHint="done",this.nodes.input.classList.add(this.CSS.input),this.nodes.input.addEventListener("keydown",e=>{e.keyCode===this.ENTER_KEY&&this.enterPressed(e)}),this.nodes.input}surround(e){if(e){this.inputOpened?(this.selection.restore(),this.selection.removeFakeBackground()):(this.selection.setFakeBackground(),this.selection.save());const t=this.selection.findParentTag("A");if(t){this.inputOpened?(this.closeActions(!1),this.checkState()):(this.selection.expandToTag(t),this.unlink(),this.closeActions(),this.checkState(),this.toolbar.close());return}}this.toggleActions()}checkState(){const e=this.selection.findParentTag("A");if(e){this.nodes.button.innerHTML=w$,this.nodes.button.classList.add(this.CSS.buttonUnlink),this.nodes.button.classList.add(this.CSS.buttonActive),this.openActions();const t=e.getAttribute("href");this.nodes.input.value=t!=="null"?t:"",this.selection.save()}else this.nodes.button.innerHTML=Dv,this.nodes.button.classList.remove(this.CSS.buttonUnlink),this.nodes.button.classList.remove(this.CSS.buttonActive);return!!e}clear(){this.closeActions()}get shortcut(){return"CMD+K"}toggleActions(){this.inputOpened?this.closeActions(!1):this.openActions(!0)}openActions(e=!1){this.nodes.input.classList.add(this.CSS.inputShowed),e&&this.nodes.input.focus(),this.inputOpened=!0}closeActions(e=!0){if(this.selection.isFakeBackgroundEnabled){const t=new _e;t.save(),this.selection.restore(),this.selection.removeFakeBackground(),t.restore()}this.nodes.input.classList.remove(this.CSS.inputShowed),this.nodes.input.value="",e&&this.selection.clearSaved(),this.inputOpened=!1}enterPressed(e){let t=this.nodes.input.value||"";if(!t.trim()){this.selection.restore(),this.unlink(),e.preventDefault(),this.closeActions();return}if(!this.validateURL(t)){this.notifier.show({message:"Pasted link is not valid.",style:"error"}),Ue("Incorrect Link pasted","warn",t);return}t=this.prepareLink(t),this.selection.restore(),this.selection.removeFakeBackground(),this.insertLink(t),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.selection.collapseToEnd(),this.inlineToolbar.close()}validateURL(e){return!/\s/.test(e)}prepareLink(e){return e=e.trim(),e=this.addProtocol(e),e}addProtocol(e){if(/^(\w+):(\/\/)?/.test(e))return e;const t=/^\/[^/\s]/.test(e),o=e.substring(0,1)==="#",a=/^\/\/[^/\s]/.test(e);return!t&&!o&&!a&&(e="http://"+e),e}insertLink(e){const t=this.selection.findParentTag("A");t&&this.selection.expandToTag(t),document.execCommand(this.commandLink,!1,e)}unlink(){document.execCommand(this.commandUnlink)}};ch.isInline=!0,ch.title="Link";class v8{constructor({api:e}){this.i18nAPI=e.i18n,this.blocksAPI=e.blocks,this.selectionAPI=e.selection,this.toolsAPI=e.tools,this.caretAPI=e.caret}async render(){const e=_e.get(),t=this.blocksAPI.getBlockByElement(e.anchorNode);if(t===void 0)return[];const o=this.toolsAPI.getBlockTools(),a=await bv(t,o);if(a.length===0)return[];const i=a.reduce((d,u)=>{var p;return(p=u.toolbox)==null||p.forEach(m=>{d.push({icon:m.icon,title:jn.t(Un.toolNames,m.title),name:u.name,closeOnActivate:!0,onActivate:async()=>{const h=await this.blocksAPI.convert(t.id,u.name,m.data);this.caretAPI.setToBlock(h,"end")}})}),d},[]),r=await t.getActiveToolboxEntry(),s=r!==void 0?r.icon:Fv,l=!ps();return{icon:s,name:"convert-to",hint:{title:this.i18nAPI.t("Convert to")},children:{searchable:l,items:i,onOpen:()=>{l&&(this.selectionAPI.setFakeBackground(),this.selectionAPI.save())},onClose:()=>{l&&(this.selectionAPI.restore(),this.selectionAPI.removeFakeBackground())}}}}}v8.isInline=!0;let b8=class{constructor({data:e,api:t}){this.CSS={wrapper:"ce-stub",info:"ce-stub__info",title:"ce-stub__title",subtitle:"ce-stub__subtitle"},this.api=t,this.title=e.title||this.api.i18n.t("Error"),this.subtitle=this.api.i18n.t("The block can not be displayed correctly."),this.savedData=e.savedData,this.wrapper=this.make()}render(){return this.wrapper}save(){return this.savedData}make(){const e=Y.make("div",this.CSS.wrapper),t=j$,o=Y.make("div",this.CSS.info),a=Y.make("div",this.CSS.title,{textContent:this.title}),i=Y.make("div",this.CSS.subtitle,{textContent:this.subtitle});return e.innerHTML=t,o.appendChild(a),o.appendChild(i),e.appendChild(o),e}};b8.isReadOnlySupported=!0;class HU extends bm{constructor(){super(...arguments),this.type=lr.Inline}get title(){return this.constructable[O0.Title]}create(){return new this.constructable({api:this.api,config:this.settings})}get isReadOnlySupported(){return this.constructable[O0.IsReadOnlySupported]??!1}}class zU extends bm{constructor(){super(...arguments),this.type=lr.Tune}create(e,t){return new this.constructable({api:this.api,config:this.settings,block:t,data:e})}}let na=class fl extends Map{get blockTools(){const e=Array.from(this.entries()).filter(([,t])=>t.isBlock());return new fl(e)}get inlineTools(){const e=Array.from(this.entries()).filter(([,t])=>t.isInline());return new fl(e)}get blockTunes(){const e=Array.from(this.entries()).filter(([,t])=>t.isTune());return new fl(e)}get internalTools(){const e=Array.from(this.entries()).filter(([,t])=>t.isInternal);return new fl(e)}get externalTools(){const e=Array.from(this.entries()).filter(([,t])=>!t.isInternal);return new fl(e)}};var $U=Object.defineProperty,WU=Object.getOwnPropertyDescriptor,y8=(n,e,t,o)=>{for(var a=WU(e,t),i=n.length-1,r;i>=0;i--)(r=n[i])&&(a=r(e,t,a)||a);return a&&$U(e,t,a),a};let dh=class extends bm{constructor(){super(...arguments),this.type=lr.Block,this.inlineTools=new na,this.tunes=new na}create(e,t,o){return new this.constructable({data:e,block:t,readOnly:o,api:this.api,config:this.settings})}get isReadOnlySupported(){return this.constructable[fs.IsReadOnlySupported]===!0}get isLineBreaksEnabled(){return this.constructable[fs.IsEnabledLineBreaks]}get toolbox(){const e=this.constructable[fs.Toolbox],t=this.config[A0.Toolbox];if(!po(e)&&t!==!1)return t?Array.isArray(e)?Array.isArray(t)?t.map((o,a)=>{const i=e[a];return i?{...i,...o}:o}):[t]:Array.isArray(t)?t:[{...e,...t}]:Array.isArray(e)?e:[e]}get conversionConfig(){return this.constructable[fs.ConversionConfig]}get enabledInlineTools(){return this.config[A0.EnabledInlineTools]||!1}get enabledBlockTunes(){return this.config[A0.EnabledBlockTunes]}get pasteConfig(){return this.constructable[fs.PasteConfig]??{}}get sanitizeConfig(){const e=super.sanitizeConfig,t=this.baseSanitizeConfig;if(po(e))return t;const o={};for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)){const i=e[a];tn(i)?o[a]=Object.assign({},t,i):o[a]=i}return o}get baseSanitizeConfig(){const e={};return Array.from(this.inlineTools.values()).forEach(t=>Object.assign(e,t.sanitizeConfig)),Array.from(this.tunes.values()).forEach(t=>Object.assign(e,t.sanitizeConfig)),e}};y8([us],dh.prototype,"sanitizeConfig"),y8([us],dh.prototype,"baseSanitizeConfig");class UU{constructor(e,t,o){this.api=o,this.config=e,this.editorConfig=t}get(e){const{class:t,isInternal:o=!1,...a}=this.config[e],i=this.getConstructor(t),r=t[vm.IsTune];return new i({name:e,constructable:t,config:a,api:this.api.getMethodsForTool(e,r),isDefault:e===this.editorConfig.defaultBlock,defaultPlaceholder:this.editorConfig.placeholder,isInternal:o})}getConstructor(e){switch(!0){case e[O0.IsInline]:return HU;case e[vm.IsTune]:return zU;default:return dh}}}class C8{constructor({api:e}){this.CSS={animation:"wobble"},this.api=e}render(){return{icon:p$,title:this.api.i18n.t("Move down"),onActivate:()=>this.handleClick(),name:"move-down"}}handleClick(){const e=this.api.blocks.getCurrentBlockIndex(),t=this.api.blocks.getBlockByIndex(e+1);if(!t)throw new Error("Unable to move Block down since it is already the last");const o=t.holder,a=o.getBoundingClientRect();let i=Math.abs(window.innerHeight-o.offsetHeight);a.top<window.innerHeight&&(i=window.scrollY+o.offsetHeight),window.scrollTo(0,i),this.api.blocks.move(e+1),this.api.toolbar.toggleBlockSettings(!0)}}C8.isTune=!0;class k8{constructor({api:e}){this.api=e}render(){return{icon:g$,title:this.api.i18n.t("Delete"),name:"delete",confirmation:{title:this.api.i18n.t("Click to delete"),onActivate:()=>this.handleClick()}}}handleClick(){this.api.blocks.delete()}}k8.isTune=!0;class w8{constructor({api:e}){this.CSS={animation:"wobble"},this.api=e}render(){return{icon:f$,title:this.api.i18n.t("Move up"),onActivate:()=>this.handleClick(),name:"move-up"}}handleClick(){const e=this.api.blocks.getCurrentBlockIndex(),t=this.api.blocks.getBlockByIndex(e),o=this.api.blocks.getBlockByIndex(e-1);if(e===0||!t||!o)throw new Error("Unable to move Block up since it is already the first");const a=t.holder,i=o.holder,r=a.getBoundingClientRect(),s=i.getBoundingClientRect();let l;s.top>0?l=Math.abs(r.top)-Math.abs(s.top):l=Math.abs(r.top)+s.height,window.scrollBy(0,-1*l),this.api.blocks.move(e-1),this.api.toolbar.toggleBlockSettings(!0)}}w8.isTune=!0;var qU=Object.defineProperty,KU=Object.getOwnPropertyDescriptor,ZU=(n,e,t,o)=>{for(var a=KU(e,t),i=n.length-1,r;i>=0;i--)(r=n[i])&&(a=r(e,t,a)||a);return a&&qU(e,t,a),a};class j8 extends Pe{constructor(){super(...arguments),this.stubTool="stub",this.toolsAvailable=new na,this.toolsUnavailable=new na}get available(){return this.toolsAvailable}get unavailable(){return this.toolsUnavailable}get inlineTools(){return this.available.inlineTools}get blockTools(){return this.available.blockTools}get blockTunes(){return this.available.blockTunes}get defaultTool(){return this.blockTools.get(this.config.defaultBlock)}get internal(){return this.available.internalTools}async prepare(){if(this.validateTools(),this.config.tools=Q1({},this.internalTools,this.config.tools),!Object.prototype.hasOwnProperty.call(this.config,"tools")||Object.keys(this.config.tools).length===0)throw Error("Can't start without tools");const e=this.prepareConfig();this.factory=new UU(e,this.config,this.Editor.API);const t=this.getListOfPrepareFunctions(e);if(t.length===0)return Promise.resolve();await gz(t,o=>{this.toolPrepareMethodSuccess(o)},o=>{this.toolPrepareMethodFallback(o)}),this.prepareBlockTools()}getAllInlineToolsSanitizeConfig(){const e={};return Array.from(this.inlineTools.values()).forEach(t=>{Object.assign(e,t.sanitizeConfig)}),e}destroy(){Object.values(this.available).forEach(async e=>{bt(e.reset)&&await e.reset()})}get internalTools(){return{convertTo:{class:v8,isInternal:!0},link:{class:ch,isInternal:!0},bold:{class:sh,isInternal:!0},italic:{class:lh,isInternal:!0},paragraph:{class:VU,inlineToolbar:!0,isInternal:!0},stub:{class:b8,isInternal:!0},moveUp:{class:w8,isInternal:!0},delete:{class:k8,isInternal:!0},moveDown:{class:C8,isInternal:!0}}}toolPrepareMethodSuccess(e){const t=this.factory.get(e.toolName);if(t.isInline()){const o=["render"].filter(a=>!t.create()[a]);if(o.length){Ue(`Incorrect Inline Tool: ${t.name}. Some of required methods is not implemented %o`,"warn",o),this.toolsUnavailable.set(t.name,t);return}}this.toolsAvailable.set(t.name,t)}toolPrepareMethodFallback(e){this.toolsUnavailable.set(e.toolName,this.factory.get(e.toolName))}getListOfPrepareFunctions(e){const t=[];return Object.entries(e).forEach(([o,a])=>{t.push({function:bt(a.class.prepare)?a.class.prepare:()=>{},data:{toolName:o,config:a.config}})}),t}prepareBlockTools(){Array.from(this.blockTools.values()).forEach(e=>{this.assignInlineToolsToBlockTool(e),this.assignBlockTunesToBlockTool(e)})}assignInlineToolsToBlockTool(e){if(this.config.inlineToolbar!==!1){if(e.enabledInlineTools===!0){e.inlineTools=new na(Array.isArray(this.config.inlineToolbar)?this.config.inlineToolbar.map(t=>[t,this.inlineTools.get(t)]):Array.from(this.inlineTools.entries()));return}Array.isArray(e.enabledInlineTools)&&(e.inlineTools=new na(["convertTo",...e.enabledInlineTools].map(t=>[t,this.inlineTools.get(t)])))}}assignBlockTunesToBlockTool(e){if(e.enabledBlockTunes!==!1){if(Array.isArray(e.enabledBlockTunes)){const t=new na(e.enabledBlockTunes.map(o=>[o,this.blockTunes.get(o)]));e.tunes=new na([...t,...this.blockTunes.internalTools]);return}if(Array.isArray(this.config.tunes)){const t=new na(this.config.tunes.map(o=>[o,this.blockTunes.get(o)]));e.tunes=new na([...t,...this.blockTunes.internalTools]);return}e.tunes=this.blockTunes.internalTools}}validateTools(){for(const e in this.config.tools)if(Object.prototype.hasOwnProperty.call(this.config.tools,e)){if(e in this.internalTools)return;const t=this.config.tools[e];if(!bt(t)&&!bt(t.class))throw Error(`Tool «${e}» must be a constructor function or an object with function in the «class» property`)}}prepareConfig(){const e={};for(const t in this.config.tools)tn(this.config.tools[t])?e[t]=this.config.tools[t]:e[t]={class:this.config.tools[t]};return e}}ZU([us],j8.prototype,"getAllInlineToolsSanitizeConfig");const YU=`:root{--selectionColor: #e1f2ff;--inlineSelectionColor: #d4ecff;--bg-light: #eff2f5;--grayText: #707684;--color-dark: #1D202B;--color-active-icon: #388AE5;--color-gray-border: rgba(201, 201, 204, .48);--content-width: 650px;--narrow-mode-right-padding: 50px;--toolbox-buttons-size: 26px;--toolbox-buttons-size--mobile: 36px;--icon-size: 20px;--icon-size--mobile: 28px;--block-padding-vertical: .4em;--color-line-gray: #EFF0F1 }.codex-editor{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;z-index:1}.codex-editor .hide{display:none}.codex-editor__redactor [contenteditable]:empty:after{content:"\\feff"}@media (min-width: 651px){.codex-editor--narrow .codex-editor__redactor{margin-right:50px}}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .codex-editor__redactor{margin-left:50px;margin-right:0}}@media (min-width: 651px){.codex-editor--narrow .ce-toolbar__actions{right:-5px}}.codex-editor-copyable{position:absolute;height:1px;width:1px;top:-400%;opacity:.001}.codex-editor-overlay{position:fixed;top:0;left:0;right:0;bottom:0;z-index:999;pointer-events:none;overflow:hidden}.codex-editor-overlay__container{position:relative;pointer-events:auto;z-index:0}.codex-editor-overlay__rectangle{position:absolute;pointer-events:none;background-color:#2eaadc33;border:1px solid transparent}.codex-editor svg{max-height:100%}.codex-editor path{stroke:currentColor}.codex-editor ::-moz-selection{background-color:#d4ecff}.codex-editor ::selection{background-color:#d4ecff}.codex-editor--toolbox-opened [contentEditable=true][data-placeholder]:focus:before{opacity:0!important}.ce-scroll-locked{overflow:hidden}.ce-scroll-locked--hard{overflow:hidden;top:calc(-1 * var(--window-scroll-offset));position:fixed;width:100%}.ce-toolbar{position:absolute;left:0;right:0;top:0;-webkit-transition:opacity .1s ease;transition:opacity .1s ease;will-change:opacity,top;display:none}.ce-toolbar--opened{display:block}.ce-toolbar__content{max-width:650px;margin:0 auto;position:relative}.ce-toolbar__plus{color:#1d202b;cursor:pointer;width:26px;height:26px;border-radius:7px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-flex-negative:0;flex-shrink:0}@media (max-width: 650px){.ce-toolbar__plus{width:36px;height:36px}}@media (hover: hover){.ce-toolbar__plus:hover{background-color:#eff2f5}}.ce-toolbar__plus--active{background-color:#eff2f5;-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}.ce-toolbar__plus-shortcut{opacity:.6;word-spacing:-2px;margin-top:5px}@media (max-width: 650px){.ce-toolbar__plus{position:absolute;background-color:#fff;border:1px solid #E8E8EB;-webkit-box-shadow:0 3px 15px -3px rgba(13,20,33,.13);box-shadow:0 3px 15px -3px #0d142121;border-radius:6px;z-index:2;position:static}.ce-toolbar__plus--left-oriented:before{left:15px;margin-left:0}.ce-toolbar__plus--right-oriented:before{left:auto;right:15px;margin-left:0}}.ce-toolbar__actions{position:absolute;right:100%;opacity:0;display:-webkit-box;display:-ms-flexbox;display:flex;padding-right:5px}.ce-toolbar__actions--opened{opacity:1}@media (max-width: 650px){.ce-toolbar__actions{right:auto}}.ce-toolbar__settings-btn{color:#1d202b;width:26px;height:26px;border-radius:7px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;margin-left:3px;cursor:pointer;user-select:none}@media (max-width: 650px){.ce-toolbar__settings-btn{width:36px;height:36px}}@media (hover: hover){.ce-toolbar__settings-btn:hover{background-color:#eff2f5}}.ce-toolbar__settings-btn--active{background-color:#eff2f5;-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}@media (min-width: 651px){.ce-toolbar__settings-btn{width:24px}}.ce-toolbar__settings-btn--hidden{display:none}@media (max-width: 650px){.ce-toolbar__settings-btn{position:absolute;background-color:#fff;border:1px solid #E8E8EB;-webkit-box-shadow:0 3px 15px -3px rgba(13,20,33,.13);box-shadow:0 3px 15px -3px #0d142121;border-radius:6px;z-index:2;position:static}.ce-toolbar__settings-btn--left-oriented:before{left:15px;margin-left:0}.ce-toolbar__settings-btn--right-oriented:before{left:auto;right:15px;margin-left:0}}.ce-toolbar__plus svg,.ce-toolbar__settings-btn svg{width:24px;height:24px}@media (min-width: 651px){.codex-editor--narrow .ce-toolbar__plus{left:5px}}@media (min-width: 651px){.codex-editor--narrow .ce-toolbox .ce-popover{right:0;left:auto;left:initial}}.ce-inline-toolbar{--y-offset: 8px;--color-background-icon-active: rgba(56, 138, 229, .1);--color-text-icon-active: #388AE5;--color-text-primary: black;position:absolute;visibility:hidden;-webkit-transition:opacity .25s ease;transition:opacity .25s ease;will-change:opacity,left,top;top:0;left:0;z-index:3;opacity:1;visibility:visible}.ce-inline-toolbar [hidden]{display:none!important}.ce-inline-toolbar__toggler-and-button-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;padding:0 6px}.ce-inline-toolbar__buttons{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-inline-toolbar__dropdown{display:-webkit-box;display:-ms-flexbox;display:flex;padding:6px;margin:0 6px 0 -6px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;cursor:pointer;border-right:1px solid rgba(201,201,204,.48);-webkit-box-sizing:border-box;box-sizing:border-box}@media (hover: hover){.ce-inline-toolbar__dropdown:hover{background:#eff2f5}}.ce-inline-toolbar__dropdown--hidden{display:none}.ce-inline-toolbar__dropdown-content,.ce-inline-toolbar__dropdown-arrow{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-inline-toolbar__dropdown-content svg,.ce-inline-toolbar__dropdown-arrow svg{width:20px;height:20px}.ce-inline-toolbar__shortcut{opacity:.6;word-spacing:-3px;margin-top:3px}.ce-inline-tool{color:var(--color-text-primary);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border:0;border-radius:4px;line-height:normal;height:100%;padding:0;width:28px;background-color:transparent;cursor:pointer}@media (max-width: 650px){.ce-inline-tool{width:36px;height:36px}}@media (hover: hover){.ce-inline-tool:hover{background-color:#f8f8f8}}.ce-inline-tool svg{display:block;width:20px;height:20px}@media (max-width: 650px){.ce-inline-tool svg{width:28px;height:28px}}.ce-inline-tool--link .icon--unlink,.ce-inline-tool--unlink .icon--link{display:none}.ce-inline-tool--unlink .icon--unlink{display:inline-block;margin-bottom:-1px}.ce-inline-tool-input{background:#F8F8F8;border:1px solid rgba(226,226,229,.2);border-radius:6px;padding:4px 8px;font-size:14px;line-height:22px;outline:none;margin:0;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;display:none;font-weight:500;-webkit-appearance:none;font-family:inherit}@media (max-width: 650px){.ce-inline-tool-input{font-size:15px;font-weight:500}}.ce-inline-tool-input::-webkit-input-placeholder{color:#707684}.ce-inline-tool-input::-moz-placeholder{color:#707684}.ce-inline-tool-input:-ms-input-placeholder{color:#707684}.ce-inline-tool-input::-ms-input-placeholder{color:#707684}.ce-inline-tool-input::placeholder{color:#707684}.ce-inline-tool-input--showed{display:block}.ce-inline-tool--active{background:var(--color-background-icon-active);color:var(--color-text-icon-active)}@-webkit-keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.ce-block{-webkit-animation:fade-in .3s ease;animation:fade-in .3s ease;-webkit-animation-fill-mode:none;animation-fill-mode:none;-webkit-animation-fill-mode:initial;animation-fill-mode:initial}.ce-block:first-of-type{margin-top:0}.ce-block--selected .ce-block__content{background:#e1f2ff}.ce-block--selected .ce-block__content [contenteditable]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ce-block--selected .ce-block__content img,.ce-block--selected .ce-block__content .ce-stub{opacity:.55}.ce-block--stretched .ce-block__content{max-width:none}.ce-block__content{position:relative;max-width:650px;margin:0 auto;-webkit-transition:background-color .15s ease;transition:background-color .15s ease}.ce-block--drop-target .ce-block__content:before{content:"";position:absolute;top:100%;left:-20px;margin-top:-1px;height:8px;width:8px;border:solid #388AE5;border-width:1px 1px 0 0;-webkit-transform-origin:right;transform-origin:right;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.ce-block--drop-target .ce-block__content:after{content:"";position:absolute;top:100%;height:1px;width:100%;color:#388ae5;background:repeating-linear-gradient(90deg,#388AE5,#388AE5 1px,#fff 1px,#fff 6px)}.ce-block a{cursor:pointer;-webkit-text-decoration:underline;text-decoration:underline}.ce-block b{font-weight:700}.ce-block i{font-style:italic}@-webkit-keyframes bounceIn{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}20%{-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}60%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes bounceIn{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}20%{-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}60%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@-webkit-keyframes selectionBounce{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}50%{-webkit-transform:scale3d(1.01,1.01,1.01);transform:scale3d(1.01,1.01,1.01)}70%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes selectionBounce{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}50%{-webkit-transform:scale3d(1.01,1.01,1.01);transform:scale3d(1.01,1.01,1.01)}70%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@-webkit-keyframes buttonClicked{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.95,.95,.95);transform:scale3d(.95,.95,.95)}60%{-webkit-transform:scale3d(1.02,1.02,1.02);transform:scale3d(1.02,1.02,1.02)}80%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes buttonClicked{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.95,.95,.95);transform:scale3d(.95,.95,.95)}60%{-webkit-transform:scale3d(1.02,1.02,1.02);transform:scale3d(1.02,1.02,1.02)}80%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}.cdx-block{padding:.4em 0}.cdx-block::-webkit-input-placeholder{line-height:normal!important}.cdx-input{border:1px solid rgba(201,201,204,.48);-webkit-box-shadow:inset 0 1px 2px 0 rgba(35,44,72,.06);box-shadow:inset 0 1px 2px #232c480f;border-radius:3px;padding:10px 12px;outline:none;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.cdx-input[data-placeholder]:before{position:static!important}.cdx-input[data-placeholder]:before{display:inline-block;width:0;white-space:nowrap;pointer-events:none}.cdx-settings-button{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;border-radius:3px;cursor:pointer;border:0;outline:none;background-color:transparent;vertical-align:bottom;color:inherit;margin:0;min-width:26px;min-height:26px}.cdx-settings-button--focused{background:rgba(34,186,255,.08)!important}.cdx-settings-button--focused{-webkit-box-shadow:inset 0 0 0px 1px rgba(7,161,227,.08);box-shadow:inset 0 0 0 1px #07a1e314}.cdx-settings-button--focused-animated{-webkit-animation-name:buttonClicked;animation-name:buttonClicked;-webkit-animation-duration:.25s;animation-duration:.25s}.cdx-settings-button--active{color:#388ae5}.cdx-settings-button svg{width:auto;height:auto}@media (max-width: 650px){.cdx-settings-button svg{width:28px;height:28px}}@media (max-width: 650px){.cdx-settings-button{width:36px;height:36px;border-radius:8px}}@media (hover: hover){.cdx-settings-button:hover{background-color:#eff2f5}}.cdx-loader{position:relative;border:1px solid rgba(201,201,204,.48)}.cdx-loader:before{content:"";position:absolute;left:50%;top:50%;width:18px;height:18px;margin:-11px 0 0 -11px;border:2px solid rgba(201,201,204,.48);border-left-color:#388ae5;border-radius:50%;-webkit-animation:cdxRotation 1.2s infinite linear;animation:cdxRotation 1.2s infinite linear}@-webkit-keyframes cdxRotation{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes cdxRotation{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.cdx-button{padding:13px;border-radius:3px;border:1px solid rgba(201,201,204,.48);font-size:14.9px;background:#fff;-webkit-box-shadow:0 2px 2px 0 rgba(18,30,57,.04);box-shadow:0 2px 2px #121e390a;color:#707684;text-align:center;cursor:pointer}@media (hover: hover){.cdx-button:hover{background:#FBFCFE;-webkit-box-shadow:0 1px 3px 0 rgba(18,30,57,.08);box-shadow:0 1px 3px #121e3914}}.cdx-button svg{height:20px;margin-right:.2em;margin-top:-2px}.ce-stub{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:12px 18px;margin:10px 0;border-radius:10px;background:#eff2f5;border:1px solid #EFF0F1;color:#707684;font-size:14px}.ce-stub svg{width:20px;height:20px}.ce-stub__info{margin-left:14px}.ce-stub__title{font-weight:500;text-transform:capitalize}.codex-editor.codex-editor--rtl{direction:rtl}.codex-editor.codex-editor--rtl .cdx-list{padding-left:0;padding-right:40px}.codex-editor.codex-editor--rtl .ce-toolbar__plus{right:-26px;left:auto}.codex-editor.codex-editor--rtl .ce-toolbar__actions{right:auto;left:-26px}@media (max-width: 650px){.codex-editor.codex-editor--rtl .ce-toolbar__actions{margin-left:0;margin-right:auto;padding-right:0;padding-left:10px}}.codex-editor.codex-editor--rtl .ce-settings{left:5px;right:auto}.codex-editor.codex-editor--rtl .ce-settings:before{right:auto;left:25px}.codex-editor.codex-editor--rtl .ce-settings__button:not(:nth-child(3n+3)){margin-left:3px;margin-right:0}.codex-editor.codex-editor--rtl .ce-conversion-tool__icon{margin-right:0;margin-left:10px}.codex-editor.codex-editor--rtl .ce-inline-toolbar__dropdown{border-right:0px solid transparent;border-left:1px solid rgba(201,201,204,.48);margin:0 -6px 0 6px}.codex-editor.codex-editor--rtl .ce-inline-toolbar__dropdown .icon--toggler-down{margin-left:0;margin-right:4px}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .ce-toolbar__plus{left:0;right:5px}}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .ce-toolbar__actions{left:-5px}}.cdx-search-field{--icon-margin-right: 10px;background:#F8F8F8;border:1px solid rgba(226,226,229,.2);border-radius:6px;padding:2px;display:grid;grid-template-columns:auto auto 1fr;grid-template-rows:auto}.cdx-search-field__icon{width:26px;height:26px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-right:var(--icon-margin-right)}.cdx-search-field__icon svg{width:20px;height:20px;color:#707684}.cdx-search-field__input{font-size:14px;outline:none;font-weight:500;font-family:inherit;border:0;background:transparent;margin:0;padding:0;line-height:22px;min-width:calc(100% - 26px - var(--icon-margin-right))}.cdx-search-field__input::-webkit-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::-moz-placeholder{color:#707684;font-weight:500}.cdx-search-field__input:-ms-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::-ms-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::placeholder{color:#707684;font-weight:500}.ce-popover{--border-radius: 6px;--width: 200px;--max-height: 270px;--padding: 6px;--offset-from-target: 8px;--color-border: #EFF0F1;--color-shadow: rgba(13, 20, 33, .1);--color-background: white;--color-text-primary: black;--color-text-secondary: #707684;--color-border-icon: rgba(201, 201, 204, .48);--color-border-icon-disabled: #EFF0F1;--color-text-icon-active: #388AE5;--color-background-icon-active: rgba(56, 138, 229, .1);--color-background-item-focus: rgba(34, 186, 255, .08);--color-shadow-item-focus: rgba(7, 161, 227, .08);--color-background-item-hover: #F8F8F8;--color-background-item-confirm: #E24A4A;--color-background-item-confirm-hover: #CE4343;--popover-top: calc(100% + var(--offset-from-target));--popover-left: 0;--nested-popover-overlap: 4px;--icon-size: 20px;--item-padding: 3px;--item-height: calc(var(--icon-size) + 2 * var(--item-padding))}.ce-popover__container{min-width:var(--width);width:var(--width);max-height:var(--max-height);border-radius:var(--border-radius);overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-box-shadow:0px 3px 15px -3px var(--color-shadow);box-shadow:0 3px 15px -3px var(--color-shadow);position:absolute;left:var(--popover-left);top:var(--popover-top);background:var(--color-background);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;z-index:4;opacity:0;max-height:0;pointer-events:none;padding:0;border:none}.ce-popover--opened>.ce-popover__container{opacity:1;padding:var(--padding);max-height:var(--max-height);pointer-events:auto;-webkit-animation:panelShowing .1s ease;animation:panelShowing .1s ease;border:1px solid var(--color-border)}@media (max-width: 650px){.ce-popover--opened>.ce-popover__container{-webkit-animation:panelShowingMobile .25s ease;animation:panelShowingMobile .25s ease}}.ce-popover--open-top .ce-popover__container{--popover-top: calc(-1 * (var(--offset-from-target) + var(--popover-height)))}.ce-popover--open-left .ce-popover__container{--popover-left: calc(-1 * var(--width) + 100%)}.ce-popover__items{overflow-y:auto;-ms-scroll-chaining:none;overscroll-behavior:contain}@media (max-width: 650px){.ce-popover__overlay{position:fixed;top:0;bottom:0;left:0;right:0;background:#1D202B;z-index:3;opacity:.5;-webkit-transition:opacity .12s ease-in;transition:opacity .12s ease-in;will-change:opacity;visibility:visible}}.ce-popover__overlay--hidden{display:none}@media (max-width: 650px){.ce-popover .ce-popover__container{--offset: 5px;position:fixed;max-width:none;min-width:calc(100% - var(--offset) * 2);left:var(--offset);right:var(--offset);bottom:calc(var(--offset) + env(safe-area-inset-bottom));top:auto;border-radius:10px}}.ce-popover__search{margin-bottom:5px}.ce-popover__nothing-found-message{color:#707684;display:none;cursor:default;padding:3px;font-size:14px;line-height:20px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ce-popover__nothing-found-message--displayed{display:block}.ce-popover--nested .ce-popover__container{--popover-left: calc(var(--nesting-level) * (var(--width) - var(--nested-popover-overlap)));top:calc(var(--trigger-item-top) - var(--nested-popover-overlap));position:absolute}.ce-popover--open-top.ce-popover--nested .ce-popover__container{top:calc(var(--trigger-item-top) - var(--popover-height) + var(--item-height) + var(--offset-from-target) + var(--nested-popover-overlap))}.ce-popover--open-left .ce-popover--nested .ce-popover__container{--popover-left: calc(-1 * (var(--nesting-level) + 1) * var(--width) + 100%)}.ce-popover-item-separator{padding:4px 3px}.ce-popover-item-separator--hidden{display:none}.ce-popover-item-separator__line{height:1px;background:var(--color-border);width:100%}.ce-popover-item-html--hidden{display:none}.ce-popover-item{--border-radius: 6px;border-radius:var(--border-radius);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:var(--item-padding);color:var(--color-text-primary);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:none;background:transparent}@media (max-width: 650px){.ce-popover-item{padding:4px}}.ce-popover-item:not(:last-of-type){margin-bottom:1px}.ce-popover-item__icon{width:26px;height:26px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.ce-popover-item__icon svg{width:20px;height:20px}@media (max-width: 650px){.ce-popover-item__icon{width:36px;height:36px;border-radius:8px}.ce-popover-item__icon svg{width:28px;height:28px}}.ce-popover-item__icon--tool{margin-right:4px}.ce-popover-item__title{font-size:14px;line-height:20px;font-weight:500;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-right:auto}@media (max-width: 650px){.ce-popover-item__title{font-size:16px}}.ce-popover-item__secondary-title{color:var(--color-text-secondary);font-size:12px;white-space:nowrap;letter-spacing:-.1em;padding-right:5px;opacity:.6}@media (max-width: 650px){.ce-popover-item__secondary-title{display:none}}.ce-popover-item--active{background:var(--color-background-icon-active);color:var(--color-text-icon-active)}.ce-popover-item--disabled{color:var(--color-text-secondary);cursor:default;pointer-events:none}.ce-popover-item--focused:not(.ce-popover-item--no-focus){background:var(--color-background-item-focus)!important}.ce-popover-item--hidden{display:none}@media (hover: hover){.ce-popover-item:hover{cursor:pointer}.ce-popover-item:hover:not(.ce-popover-item--no-hover){background-color:var(--color-background-item-hover)}}.ce-popover-item--confirmation{background:var(--color-background-item-confirm)}.ce-popover-item--confirmation .ce-popover-item__title,.ce-popover-item--confirmation .ce-popover-item__icon{color:#fff}@media (hover: hover){.ce-popover-item--confirmation:not(.ce-popover-item--no-hover):hover{background:var(--color-background-item-confirm-hover)}}.ce-popover-item--confirmation:not(.ce-popover-item--no-focus).ce-popover-item--focused{background:var(--color-background-item-confirm-hover)!important}@-webkit-keyframes panelShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes panelShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes panelShowingMobile{0%{opacity:0;-webkit-transform:translateY(14px) scale(.98);transform:translateY(14px) scale(.98)}70%{opacity:1;-webkit-transform:translateY(-4px);transform:translateY(-4px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes panelShowingMobile{0%{opacity:0;-webkit-transform:translateY(14px) scale(.98);transform:translateY(14px) scale(.98)}70%{opacity:1;-webkit-transform:translateY(-4px);transform:translateY(-4px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}.wobble{-webkit-animation-name:wobble;animation-name:wobble;-webkit-animation-duration:.4s;animation-duration:.4s}@-webkit-keyframes wobble{0%{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}15%{-webkit-transform:translate3d(-9%,0,0);transform:translate3d(-9%,0,0)}30%{-webkit-transform:translate3d(9%,0,0);transform:translate3d(9%,0,0)}45%{-webkit-transform:translate3d(-4%,0,0);transform:translate3d(-4%,0,0)}60%{-webkit-transform:translate3d(4%,0,0);transform:translate3d(4%,0,0)}75%{-webkit-transform:translate3d(-1%,0,0);transform:translate3d(-1%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}}@keyframes wobble{0%{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}15%{-webkit-transform:translate3d(-9%,0,0);transform:translate3d(-9%,0,0)}30%{-webkit-transform:translate3d(9%,0,0);transform:translate3d(9%,0,0)}45%{-webkit-transform:translate3d(-4%,0,0);transform:translate3d(-4%,0,0)}60%{-webkit-transform:translate3d(4%,0,0);transform:translate3d(4%,0,0)}75%{-webkit-transform:translate3d(-1%,0,0);transform:translate3d(-1%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}}.ce-popover-header{margin-bottom:8px;margin-top:4px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.ce-popover-header__text{font-size:18px;font-weight:600}.ce-popover-header__back-button{border:0;background:transparent;width:36px;height:36px;color:var(--color-text-primary)}.ce-popover-header__back-button svg{display:block;width:28px;height:28px}.ce-popover--inline{--height: 38px;--height-mobile: 46px;--container-padding: 4px;position:relative}.ce-popover--inline .ce-popover__custom-content{margin-bottom:0}.ce-popover--inline .ce-popover__items{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-popover--inline .ce-popover__container{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;padding:var(--container-padding);height:var(--height);top:0;min-width:-webkit-max-content;min-width:-moz-max-content;min-width:max-content;width:-webkit-max-content;width:-moz-max-content;width:max-content;-webkit-animation:none;animation:none}@media (max-width: 650px){.ce-popover--inline .ce-popover__container{height:var(--height-mobile);position:absolute}}.ce-popover--inline .ce-popover-item-separator{padding:0 4px}.ce-popover--inline .ce-popover-item-separator__line{height:100%;width:1px}.ce-popover--inline .ce-popover-item{border-radius:4px;padding:4px}.ce-popover--inline .ce-popover-item__icon--tool{-webkit-box-shadow:none;box-shadow:none;background:transparent;margin-right:0}.ce-popover--inline .ce-popover-item__icon{width:auto;width:initial;height:auto;height:initial}.ce-popover--inline .ce-popover-item__icon svg{width:20px;height:20px}@media (max-width: 650px){.ce-popover--inline .ce-popover-item__icon svg{width:28px;height:28px}}.ce-popover--inline .ce-popover-item:not(:last-of-type){margin-bottom:0;margin-bottom:initial}.ce-popover--inline .ce-popover-item-html{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.ce-popover--inline .ce-popover-item__icon--chevron-right{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.ce-popover--inline .ce-popover--nested-level-1 .ce-popover__container{--offset: 3px;left:0;top:calc(var(--height) + var(--offset))}@media (max-width: 650px){.ce-popover--inline .ce-popover--nested-level-1 .ce-popover__container{top:calc(var(--height-mobile) + var(--offset))}}.ce-popover--inline .ce-popover--nested .ce-popover__container{min-width:var(--width);width:var(--width);height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;padding:6px;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.ce-popover--inline .ce-popover--nested .ce-popover__items{display:block;width:100%}.ce-popover--inline .ce-popover--nested .ce-popover-item{border-radius:6px;padding:3px}@media (max-width: 650px){.ce-popover--inline .ce-popover--nested .ce-popover-item{padding:4px}}.ce-popover--inline .ce-popover--nested .ce-popover-item__icon--tool{margin-right:4px}.ce-popover--inline .ce-popover--nested .ce-popover-item__icon{width:26px;height:26px}.ce-popover--inline .ce-popover--nested .ce-popover-item-separator{padding:4px 3px}.ce-popover--inline .ce-popover--nested .ce-popover-item-separator__line{width:100%;height:1px}.codex-editor [data-placeholder]:empty:before,.codex-editor [data-placeholder][data-empty=true]:before{pointer-events:none;color:#707684;cursor:text;content:attr(data-placeholder)}.codex-editor [data-placeholder-active]:empty:before,.codex-editor [data-placeholder-active][data-empty=true]:before{pointer-events:none;color:#707684;cursor:text}.codex-editor [data-placeholder-active]:empty:focus:before,.codex-editor [data-placeholder-active][data-empty=true]:focus:before{content:attr(data-placeholder-active)}
42
- `;class GU extends Pe{constructor(){super(...arguments),this.isMobile=!1,this.contentRectCache=null,this.resizeDebouncer=lv(()=>{this.windowResize()},200),this.selectionChangeDebounced=lv(()=>{this.selectionChanged()},IU),this.documentTouchedListener=e=>{this.documentTouched(e)}}get CSS(){return{editorWrapper:"codex-editor",editorWrapperNarrow:"codex-editor--narrow",editorZone:"codex-editor__redactor",editorZoneHidden:"codex-editor__redactor--hidden",editorEmpty:"codex-editor--empty",editorRtlFix:"codex-editor--rtl"}}get contentRect(){if(this.contentRectCache!==null)return this.contentRectCache;const e=this.nodes.wrapper.querySelector(`.${Ea.CSS.content}`);return e?(this.contentRectCache=e.getBoundingClientRect(),this.contentRectCache):{width:650,left:0,right:0}}async prepare(){this.setIsMobile(),this.make(),this.loadStyles()}toggleReadOnly(e){e?this.unbindReadOnlySensitiveListeners():window.requestIdleCallback(()=>{this.bindReadOnlySensitiveListeners()},{timeout:2e3})}checkEmptiness(){const{BlockManager:e}=this.Editor;this.nodes.wrapper.classList.toggle(this.CSS.editorEmpty,e.isEditorEmpty)}get someToolbarOpened(){const{Toolbar:e,BlockSettings:t,InlineToolbar:o}=this.Editor;return!!(t.opened||o.opened||e.toolbox.opened)}get someFlipperButtonFocused(){return this.Editor.Toolbar.toolbox.hasFocus()?!0:Object.entries(this.Editor).filter(([e,t])=>t.flipper instanceof M0).some(([e,t])=>t.flipper.hasFocus())}destroy(){this.nodes.holder.innerHTML="",this.unbindReadOnlyInsensitiveListeners()}closeAllToolbars(){const{Toolbar:e,BlockSettings:t,InlineToolbar:o}=this.Editor;t.close(),o.close(),e.toolbox.close()}setIsMobile(){const e=window.innerWidth<cv;e!==this.isMobile&&this.eventsDispatcher.emit(ec,{isEnabled:this.isMobile}),this.isMobile=e}make(){this.nodes.holder=Y.getHolder(this.config.holder),this.nodes.wrapper=Y.make("div",[this.CSS.editorWrapper,...this.isRtl?[this.CSS.editorRtlFix]:[]]),this.nodes.redactor=Y.make("div",this.CSS.editorZone),this.nodes.holder.offsetWidth<this.contentRect.width&&this.nodes.wrapper.classList.add(this.CSS.editorWrapperNarrow),this.nodes.redactor.style.paddingBottom=this.config.minHeight+"px",this.nodes.wrapper.appendChild(this.nodes.redactor),this.nodes.holder.appendChild(this.nodes.wrapper),this.bindReadOnlyInsensitiveListeners()}loadStyles(){const e="editor-js-styles";if(Y.get(e))return;const t=Y.make("style",null,{id:e,textContent:YU.toString()});this.config.style&&!po(this.config.style)&&this.config.style.nonce&&t.setAttribute("nonce",this.config.style.nonce),Y.prepend(document.head,t)}bindReadOnlyInsensitiveListeners(){this.listeners.on(document,"selectionchange",this.selectionChangeDebounced),this.listeners.on(window,"resize",this.resizeDebouncer,{passive:!0}),this.listeners.on(this.nodes.redactor,"mousedown",this.documentTouchedListener,{capture:!0,passive:!0}),this.listeners.on(this.nodes.redactor,"touchstart",this.documentTouchedListener,{capture:!0,passive:!0})}unbindReadOnlyInsensitiveListeners(){this.listeners.off(document,"selectionchange",this.selectionChangeDebounced),this.listeners.off(window,"resize",this.resizeDebouncer),this.listeners.off(this.nodes.redactor,"mousedown",this.documentTouchedListener),this.listeners.off(this.nodes.redactor,"touchstart",this.documentTouchedListener)}bindReadOnlySensitiveListeners(){this.readOnlyMutableListeners.on(this.nodes.redactor,"click",e=>{this.redactorClicked(e)},!1),this.readOnlyMutableListeners.on(document,"keydown",e=>{this.documentKeydown(e)},!0),this.readOnlyMutableListeners.on(document,"mousedown",e=>{this.documentClicked(e)},!0),this.watchBlockHoveredEvents(),this.enableInputsEmptyMark()}watchBlockHoveredEvents(){let e;this.readOnlyMutableListeners.on(this.nodes.redactor,"mousemove",J1(t=>{const o=t.target.closest(".ce-block");this.Editor.BlockSelection.anyBlockSelected||o&&e!==o&&(e=o,this.eventsDispatcher.emit(Nv,{block:this.Editor.BlockManager.getBlockByChildNode(o)}))},20),{passive:!0})}unbindReadOnlySensitiveListeners(){this.readOnlyMutableListeners.clearAll()}windowResize(){this.contentRectCache=null,this.setIsMobile()}documentKeydown(e){switch(e.keyCode){case Fe.ENTER:this.enterPressed(e);break;case Fe.BACKSPACE:case Fe.DELETE:this.backspacePressed(e);break;case Fe.ESC:this.escapePressed(e);break;default:this.defaultBehaviour(e);break}}defaultBehaviour(e){const{currentBlock:t}=this.Editor.BlockManager,o=e.target.closest(`.${this.CSS.editorWrapper}`),a=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;if(t!==void 0&&o===null){this.Editor.BlockEvents.keydown(e);return}o||t&&a||(this.Editor.BlockManager.unsetCurrentBlock(),this.Editor.Toolbar.close())}backspacePressed(e){const{BlockManager:t,BlockSelection:o,Caret:a}=this.Editor;if(o.anyBlockSelected&&!_e.isSelectionExists){const i=t.removeSelectedBlocks(),r=t.insertDefaultBlockAtIndex(i,!0);a.setToBlock(r,a.positions.START),o.clearSelection(e),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()}}escapePressed(e){this.Editor.BlockSelection.clearSelection(e),this.Editor.Toolbar.toolbox.opened?(this.Editor.Toolbar.toolbox.close(),this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock,this.Editor.Caret.positions.END)):this.Editor.BlockSettings.opened?this.Editor.BlockSettings.close():this.Editor.InlineToolbar.opened?this.Editor.InlineToolbar.close():this.Editor.Toolbar.close()}enterPressed(e){const{BlockManager:t,BlockSelection:o}=this.Editor;if(this.someToolbarOpened)return;const a=t.currentBlockIndex>=0;if(o.anyBlockSelected&&!_e.isSelectionExists){o.clearSelection(e),e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation();return}if(!this.someToolbarOpened&&a&&e.target.tagName==="BODY"){const i=this.Editor.BlockManager.insert();e.preventDefault(),this.Editor.Caret.setToBlock(i),this.Editor.Toolbar.moveAndOpen(i)}this.Editor.BlockSelection.clearSelection(e)}documentClicked(e){var t,o;if(!e.isTrusted)return;const a=e.target;this.nodes.holder.contains(a)||_e.isAtEditor||(this.Editor.BlockManager.unsetCurrentBlock(),this.Editor.Toolbar.close());const i=(t=this.Editor.BlockSettings.nodes.wrapper)==null?void 0:t.contains(a),r=(o=this.Editor.Toolbar.nodes.settingsToggler)==null?void 0:o.contains(a),s=i||r;if(this.Editor.BlockSettings.opened&&!s){this.Editor.BlockSettings.close();const l=this.Editor.BlockManager.getBlockByChildNode(a);this.Editor.Toolbar.moveAndOpen(l)}this.Editor.BlockSelection.clearSelection(e)}documentTouched(e){let t=e.target;if(t===this.nodes.redactor){const o=e instanceof MouseEvent?e.clientX:e.touches[0].clientX,a=e instanceof MouseEvent?e.clientY:e.touches[0].clientY;t=document.elementFromPoint(o,a)}try{this.Editor.BlockManager.setCurrentBlockByChildNode(t)}catch{this.Editor.RectangleSelection.isRectActivated()||this.Editor.Caret.setToTheLastBlock()}this.Editor.ReadOnly.isEnabled||this.Editor.Toolbar.moveAndOpen()}redactorClicked(e){if(!_e.isCollapsed)return;const t=e.target,o=e.metaKey||e.ctrlKey;if(Y.isAnchor(t)&&o){e.stopImmediatePropagation(),e.stopPropagation();const a=t.getAttribute("href"),i=Cz(a);wz(i);return}this.processBottomZoneClick(e)}processBottomZoneClick(e){const t=this.Editor.BlockManager.getBlockByIndex(-1),o=Y.offset(t.holder).bottom,a=e.pageY,{BlockSelection:i}=this.Editor;if(e.target instanceof Element&&e.target.isEqualNode(this.nodes.redactor)&&!i.anyBlockSelected&&o<a){e.stopImmediatePropagation(),e.stopPropagation();const{BlockManager:r,Caret:s,Toolbar:l}=this.Editor;(!r.lastBlock.tool.isDefault||!r.lastBlock.isEmpty)&&r.insertAtEnd(),s.setToTheLastBlock(),l.moveAndOpen(r.lastBlock)}}selectionChanged(){const{CrossBlockSelection:e,BlockSelection:t}=this.Editor,o=_e.anchorElement;if(e.isCrossBlockSelectionStarted&&t.anyBlockSelected&&_e.get().removeAllRanges(),!o){_e.range||this.Editor.InlineToolbar.close();return}const a=o.closest(`.${Ea.CSS.content}`);(a===null||a.closest(`.${_e.CSS.editorWrapper}`)!==this.nodes.wrapper)&&(this.Editor.InlineToolbar.containsNode(o)||this.Editor.InlineToolbar.close(),o.dataset.inlineToolbar!=="true")||(this.Editor.BlockManager.currentBlock||this.Editor.BlockManager.setCurrentBlockByChildNode(o),this.Editor.InlineToolbar.tryToShow(!0))}enableInputsEmptyMark(){function e(t){const o=t.target;dv(o)}this.readOnlyMutableListeners.on(this.nodes.wrapper,"input",e),this.readOnlyMutableListeners.on(this.nodes.wrapper,"focusin",e),this.readOnlyMutableListeners.on(this.nodes.wrapper,"focusout",e)}}const XU={BlocksAPI:Tz,CaretAPI:Oz,EventsAPI:Lz,I18nAPI:Nz,API:Pz,InlineToolbarAPI:Rz,ListenersAPI:Vz,NotifierAPI:Wz,ReadOnlyAPI:Uz,SanitizerAPI:Jz,SaverAPI:Qz,SelectionAPI:e$,ToolsAPI:t$,StylesAPI:n$,ToolbarAPI:o$,TooltipAPI:l$,UiAPI:c$,BlockSettings:O$,Toolbar:$$,InlineToolbar:W$,BlockEvents:wU,BlockManager:xU,BlockSelection:DU,Caret:FU,CrossBlockSelection:EU,DragNDrop:SU,ModificationsObserver:BU,Paste:TU,ReadOnly:AU,RectangleSelection:OU,Renderer:LU,Saver:NU,Tools:j8,UI:GU};class JU{constructor(e){this.moduleInstances={},this.eventsDispatcher=new Jl;let t,o;this.isReady=new Promise((a,i)=>{t=a,o=i}),Promise.resolve().then(async()=>{this.configuration=e,this.validate(),this.init(),await this.start(),await this.render();const{BlockManager:a,Caret:i,UI:r,ModificationsObserver:s}=this.moduleInstances;r.checkEmptiness(),s.enable(),this.configuration.autofocus===!0&&this.configuration.readOnly!==!0&&i.setToBlock(a.blocks[0],i.positions.START),t()}).catch(a=>{Ue(`Editor.js is not ready because of ${a}`,"error"),o(a)})}set configuration(e){var t,o;tn(e)?this.config={...e}:this.config={holder:e},tm(!!this.config.holderId,"config.holderId","config.holder"),this.config.holderId&&!this.config.holder&&(this.config.holder=this.config.holderId,this.config.holderId=null),this.config.holder==null&&(this.config.holder="editorjs"),this.config.logLevel||(this.config.logLevel=ov.VERBOSE),hz(this.config.logLevel),tm(!!this.config.initialBlock,"config.initialBlock","config.defaultBlock"),this.config.defaultBlock=this.config.defaultBlock||this.config.initialBlock||"paragraph",this.config.minHeight=this.config.minHeight!==void 0?this.config.minHeight:300;const a={type:this.config.defaultBlock,data:{}};this.config.placeholder=this.config.placeholder||!1,this.config.sanitizer=this.config.sanitizer||{p:!0,b:!0,a:!0},this.config.hideToolbar=this.config.hideToolbar?this.config.hideToolbar:!1,this.config.tools=this.config.tools||{},this.config.i18n=this.config.i18n||{},this.config.data=this.config.data||{blocks:[]},this.config.onReady=this.config.onReady||(()=>{}),this.config.onChange=this.config.onChange||(()=>{}),this.config.inlineToolbar=this.config.inlineToolbar!==void 0?this.config.inlineToolbar:!0,(po(this.config.data)||!this.config.data.blocks||this.config.data.blocks.length===0)&&(this.config.data={blocks:[a]}),this.config.readOnly=this.config.readOnly||!1,(t=this.config.i18n)!=null&&t.messages&&jn.setDictionary(this.config.i18n.messages),this.config.i18n.direction=((o=this.config.i18n)==null?void 0:o.direction)||"ltr"}get configuration(){return this.config}validate(){const{holderId:e,holder:t}=this.config;if(e&&t)throw Error("«holderId» and «holder» param can't assign at the same time.");if(xa(t)&&!Y.get(t))throw Error(`element with ID «${t}» is missing. Pass correct holder's ID.`);if(t&&tn(t)&&!Y.isElement(t))throw Error("«holder» value must be an Element node")}init(){this.constructModules(),this.configureModules()}async start(){await["Tools","UI","BlockManager","Paste","BlockSelection","RectangleSelection","CrossBlockSelection","ReadOnly"].reduce((e,t)=>e.then(async()=>{try{await this.moduleInstances[t].prepare()}catch(o){if(o instanceof mv)throw new Error(o.message);Ue(`Module ${t} was skipped because of %o`,"warn",o)}}),Promise.resolve())}render(){return this.moduleInstances.Renderer.render(this.config.data.blocks)}constructModules(){Object.entries(XU).forEach(([e,t])=>{try{this.moduleInstances[e]=new t({config:this.configuration,eventsDispatcher:this.eventsDispatcher})}catch(o){Ue("[constructModules]",`Module ${e} skipped because`,"error",o)}})}configureModules(){for(const e in this.moduleInstances)Object.prototype.hasOwnProperty.call(this.moduleInstances,e)&&(this.moduleInstances[e].state=this.getModulesDiff(e))}getModulesDiff(e){const t={};for(const o in this.moduleInstances)o!==e&&(t[o]=this.moduleInstances[o]);return t}}class QU{static get version(){return"2.31.2"}constructor(e){let t=()=>{};tn(e)&&bt(e.onReady)&&(t=e.onReady);const o=new JU(e);this.isReady=o.isReady.then(()=>{this.exportAPI(o),t()})}exportAPI(e){const t=["configuration"],o=()=>{Object.values(e.moduleInstances).forEach(a=>{bt(a.destroy)&&a.destroy(),a.listeners.removeAll()}),s$(),e=null;for(const a in this)Object.prototype.hasOwnProperty.call(this,a)&&delete this[a];Object.setPrototypeOf(this,null)};t.forEach(a=>{this[a]=e[a]}),this.destroy=o,Object.setPrototypeOf(this,e.moduleInstances.API.methods),delete this.exportAPI,Object.entries({blocks:{clear:"clear",render:"render"},caret:{focus:"focus"},events:{on:"on",off:"off",emit:"emit"},saver:{save:"save"}}).forEach(([a,i])=>{Object.entries(i).forEach(([r,s])=>{this[s]=e.moduleInstances.API.methods[a][r]})})}}(function(){try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode(".ce-paragraph{line-height:1.6em;outline:none}.ce-block:only-of-type .ce-paragraph[data-placeholder-active]:empty:before,.ce-block:only-of-type .ce-paragraph[data-placeholder-active][data-empty=true]:before{content:attr(data-placeholder-active)}.ce-paragraph p:first-of-type{margin-top:0}.ce-paragraph p:last-of-type{margin-bottom:0}")),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const eq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 9V7.2C8 7.08954 8.08954 7 8.2 7L12 7M16 9V7.2C16 7.08954 15.9105 7 15.8 7L12 7M12 7L12 17M12 17H10M12 17H14"/></svg>';function tq(n){const e=document.createElement("div");e.innerHTML=n.trim();const t=document.createDocumentFragment();return t.append(...Array.from(e.childNodes)),t}let nq=class Tx{static get DEFAULT_PLACEHOLDER(){return""}constructor({data:e,config:t,api:o,readOnly:a}){this.api=o,this.readOnly=a,this._CSS={block:this.api.styles.block,wrapper:"ce-paragraph"},this.readOnly||(this.onKeyUp=this.onKeyUp.bind(this)),this._placeholder=t.placeholder?t.placeholder:Tx.DEFAULT_PLACEHOLDER,this._data=e??{},this._element=null,this._preserveBlank=t.preserveBlank??!1}onKeyUp(e){if(e.code!=="Backspace"&&e.code!=="Delete"||!this._element)return;const{textContent:t}=this._element;t===""&&(this._element.innerHTML="")}drawView(){const e=document.createElement("DIV");return e.classList.add(this._CSS.wrapper,this._CSS.block),e.contentEditable="false",e.dataset.placeholderActive=this.api.i18n.t(this._placeholder),this._data.text&&(e.innerHTML=this._data.text),this.readOnly||(e.contentEditable="true",e.addEventListener("keyup",this.onKeyUp)),e}render(){return this._element=this.drawView(),this._element}merge(e){if(!this._element)return;this._data.text+=e.text;const t=tq(e.text);this._element.appendChild(t),this._element.normalize()}validate(e){return!(e.text.trim()===""&&!this._preserveBlank)}save(e){return{text:e.innerHTML}}onPaste(e){const t={text:e.detail.data.innerHTML};this._data=t,window.requestAnimationFrame(()=>{this._element&&(this._element.innerHTML=this._data.text||"")})}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{text:{br:!0}}}static get isReadOnlySupported(){return!0}static get pasteConfig(){return{tags:["P"]}}static get toolbox(){return{icon:eq,title:"Text"}}};(function(){try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode(".ce-header{padding:.6em 0 3px;margin:0;line-height:1.25em;outline:none}.ce-header p,.ce-header div{padding:0!important;margin:0!important}")),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const oq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19 17V10.2135C19 10.1287 18.9011 10.0824 18.836 10.1367L16 12.5"/></svg>',aq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 11C16 10 19 9.5 19 12C19 13.9771 16.0684 13.9997 16.0012 16.8981C15.9999 16.9533 16.0448 17 16.1 17L19.3 17"/></svg>',iq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 11C16 10.5 16.8323 10 17.6 10C18.3677 10 19.5 10.311 19.5 11.5C19.5 12.5315 18.7474 12.9022 18.548 12.9823C18.5378 12.9864 18.5395 13.0047 18.5503 13.0063C18.8115 13.0456 20 13.3065 20 14.8C20 16 19.5 17 17.8 17C17.8 17 16 17 16 16.3"/></svg>',rq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M18 10L15.2834 14.8511C15.246 14.9178 15.294 15 15.3704 15C16.8489 15 18.7561 15 20.2 15M19 17C19 15.7187 19 14.8813 19 13.6"/></svg>',sq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 15.9C16 15.9 16.3768 17 17.8 17C19.5 17 20 15.6199 20 14.7C20 12.7323 17.6745 12.0486 16.1635 12.9894C16.094 13.0327 16 12.9846 16 12.9027V10.1C16 10.0448 16.0448 10 16.1 10H19.8"/></svg>',lq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19.5 10C16.5 10.5 16 13.3285 16 15M16 15V15C16 16.1046 16.8954 17 18 17H18.3246C19.3251 17 20.3191 16.3492 20.2522 15.3509C20.0612 12.4958 16 12.6611 16 15Z"/></svg>',cq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9 7L9 12M9 17V12M9 12L15 12M15 7V12M15 17L15 12"/></svg>';let dq=class{constructor({data:e,config:t,api:o,readOnly:a}){this.api=o,this.readOnly=a,this._settings=t,this._data=this.normalizeData(e),this._element=this.getTag()}get _CSS(){return{block:this.api.styles.block,wrapper:"ce-header"}}isHeaderData(e){return e.text!==void 0}normalizeData(e){const t={text:"",level:this.defaultLevel.number};return this.isHeaderData(e)&&(t.text=e.text||"",e.level!==void 0&&!isNaN(parseInt(e.level.toString()))&&(t.level=parseInt(e.level.toString()))),t}render(){return this._element}renderSettings(){return this.levels.map(e=>({icon:e.svg,label:this.api.i18n.t(`Heading ${e.number}`),onActivate:()=>this.setLevel(e.number),closeOnActivate:!0,isActive:this.currentLevel.number===e.number,render:()=>document.createElement("div")}))}setLevel(e){this.data={level:e,text:this.data.text}}merge(e){this._element.insertAdjacentHTML("beforeend",e.text)}validate(e){return e.text.trim()!==""}save(e){return{text:e.innerHTML,level:this.currentLevel.number}}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{level:!1,text:{}}}static get isReadOnlySupported(){return!0}get data(){return this._data.text=this._element.innerHTML,this._data.level=this.currentLevel.number,this._data}set data(e){if(this._data=this.normalizeData(e),e.level!==void 0&&this._element.parentNode){const t=this.getTag();t.innerHTML=this._element.innerHTML,this._element.parentNode.replaceChild(t,this._element),this._element=t}e.text!==void 0&&(this._element.innerHTML=this._data.text||"")}getTag(){const e=document.createElement(this.currentLevel.tag);return e.innerHTML=this._data.text||"",e.classList.add(this._CSS.wrapper),e.contentEditable=this.readOnly?"false":"true",e.dataset.placeholder=this.api.i18n.t(this._settings.placeholder||""),e}get currentLevel(){let e=this.levels.find(t=>t.number===this._data.level);return e||(e=this.defaultLevel),e}get defaultLevel(){if(this._settings.defaultLevel){const e=this.levels.find(t=>t.number===this._settings.defaultLevel);if(e)return e;console.warn("(ง'̀-'́)ง Heading Tool: the default level specified was not found in available levels")}return this.levels[1]}get levels(){const e=[{number:1,tag:"H1",svg:oq},{number:2,tag:"H2",svg:aq},{number:3,tag:"H3",svg:iq},{number:4,tag:"H4",svg:rq},{number:5,tag:"H5",svg:sq},{number:6,tag:"H6",svg:lq}];return this._settings.levels?e.filter(t=>this._settings.levels.includes(t.number)):e}onPaste(e){const t=e.detail;if("data"in t){const o=t.data;let a=this.defaultLevel.number;switch(o.tagName){case"H1":a=1;break;case"H2":a=2;break;case"H3":a=3;break;case"H4":a=4;break;case"H5":a=5;break;case"H6":a=6;break}this._settings.levels&&(a=this._settings.levels.reduce((i,r)=>Math.abs(r-a)<Math.abs(i-a)?r:i)),this.data={level:a,text:o.innerHTML}}}static get pasteConfig(){return{tags:["H1","H2","H3","H4","H5","H6"]}}static get toolbox(){return{icon:cq,title:"Heading"}}};(function(){try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode('.cdx-nested-list{margin:0;padding:0;outline:none;counter-reset:item;list-style:none}.cdx-nested-list__item{line-height:1.6em;display:flex;margin:2px 0}.cdx-nested-list__item [contenteditable]{outline:none}.cdx-nested-list__item-body{flex-grow:2}.cdx-nested-list__item-content,.cdx-nested-list__item-children{flex-basis:100%}.cdx-nested-list__item-content{word-break:break-word;white-space:pre-wrap}.cdx-nested-list__item:before{counter-increment:item;margin-right:5px;white-space:nowrap}.cdx-nested-list--ordered>.cdx-nested-list__item:before{content:counters(item,".") ". "}.cdx-nested-list--unordered>.cdx-nested-list__item:before{content:"•"}.cdx-nested-list__settings{display:flex}.cdx-nested-list__settings .cdx-settings-button{width:50%}')),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();function Sa(n){return n.nodeType===Node.ELEMENT_NODE}function gs(n,e=null,t){const o=document.createElement(n);Array.isArray(e)?o.classList.add(...e):e&&o.classList.add(e);for(const a in t)o[a]=t[a];return o}function _8(n){const e=gs("div");return e.appendChild(n),e.innerHTML}function x8(n){let e;return n.nodeType!==Node.ELEMENT_NODE?e=n.textContent:(e=n.innerHTML,e=e.replaceAll("<br>","")),e?.trim().length===0}let vs=class c6{constructor(){this.savedFakeCaret=void 0}save(){const e=c6.range,t=gs("span");t.hidden=!0,e&&(e.insertNode(t),this.savedFakeCaret=t)}restore(){if(!this.savedFakeCaret)return;const e=window.getSelection();if(!e)return;const t=new Range;t.setStartAfter(this.savedFakeCaret),t.setEndAfter(this.savedFakeCaret),e.removeAllRanges(),e.addRange(t),setTimeout(()=>{var o;(o=this.savedFakeCaret)==null||o.remove()},150)}static get range(){const e=window.getSelection();return e&&e.rangeCount?e.getRangeAt(0):null}static extractFragmentFromCaretPositionTillTheEnd(){const e=window.getSelection();if(!e||!e.rangeCount)return;const t=e.getRangeAt(0);let o=t.startContainer;if(o.nodeType!==Node.ELEMENT_NODE){if(!o.parentNode)return;o=o.parentNode}if(!Sa(o))return;const a=o.closest("[contenteditable]");if(!a)return;t.deleteContents();const i=t.cloneRange();return i.selectNodeContents(a),i.setStart(t.endContainer,t.endOffset),i.extractContents()}static focus(e,t=!0){const o=document.createRange(),a=window.getSelection();a&&(o.selectNodeContents(e),o.collapse(t),a.removeAllRanges(),a.addRange(o))}static isAtStart(){const e=window.getSelection();if(!e||e.focusOffset>0)return!1;const t=e.focusNode;return!t||!Sa(t)?!1:c6.getHigherLevelSiblings(t,"left").every(o=>x8(o))}static getHigherLevelSiblings(e,t="left"){let o=e;const a=[];for(;o.parentNode&&o.parentNode.contentEditable!=="true";)o=o.parentNode;const i=t==="left"?"previousSibling":"nextSibling";for(;o[i];)o=o[i],a.push(o);return a}};const uq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="9" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 17H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 12H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 7H4.99002"/></svg>',D8='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="12" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7.79999 14L7.79999 7.2135C7.79999 7.12872 7.7011 7.0824 7.63597 7.13668L4.79999 9.5"/></svg>';let pq=class d6{static get isReadOnlySupported(){return!0}static get enableLineBreaks(){return!0}static get toolbox(){return{icon:D8,title:"List"}}constructor({data:e,config:t,api:o,readOnly:a}){var i;this.nodes={wrapper:null},this.api=o,this.readOnly=a,this.config=t,this.defaultListStyle=((i=this.config)==null?void 0:i.defaultStyle)==="ordered"?"ordered":"unordered";const r={style:this.defaultListStyle,items:[]};this.data=e&&Object.keys(e).length?e:r,this.caret=new vs}render(){return this.nodes.wrapper=this.makeListWrapper(this.data.style,[this.CSS.baseBlock]),this.data.items.length?this.appendItems(this.data.items,this.nodes.wrapper):this.appendItems([{content:"",items:[]}],this.nodes.wrapper),this.readOnly||this.nodes.wrapper.addEventListener("keydown",e=>{switch(e.key){case"Enter":this.enterPressed(e);break;case"Backspace":this.backspace(e);break;case"Tab":e.shiftKey?this.shiftTab(e):this.addTab(e);break}},!1),this.nodes.wrapper}renderSettings(){return[{name:"unordered",label:this.api.i18n.t("Unordered"),icon:uq},{name:"ordered",label:this.api.i18n.t("Ordered"),icon:D8}].map(e=>({name:e.name,icon:e.icon,label:e.label,isActive:this.data.style===e.name,closeOnActivate:!0,onActivate:()=>{this.listStyle=e.name}}))}static get pasteConfig(){return{tags:["OL","UL","LI"]}}onPaste(e){const t=e.detail.data;this.data=this.pasteHandler(t);const o=this.nodes.wrapper;o&&o.parentNode&&o.parentNode.replaceChild(this.render(),o)}pasteHandler(e){const{tagName:t}=e;let o="unordered",a;switch(t){case"OL":o="ordered",a="ol";break;case"UL":case"LI":o="unordered",a="ul"}const i={style:o,items:[]},r=s=>Array.from(s.querySelectorAll(":scope > li")).map(l=>{var d;const u=l.querySelector(`:scope > ${a}`),p=u?r(u):[];return{content:((d=l?.firstChild)==null?void 0:d.textContent)||"",items:p}});return i.items=r(e),i}appendItems(e,t){e.forEach(o=>{const a=this.createItem(o.content,o.items);t.appendChild(a)})}createItem(e,t=[]){const o=gs("li",this.CSS.item),a=gs("div",this.CSS.itemBody),i=gs("div",this.CSS.itemContent,{innerHTML:e,contentEditable:(!this.readOnly).toString()});return a.appendChild(i),o.appendChild(a),t&&t.length>0&&this.addChildrenList(o,t),o}save(){const e=t=>Array.from(t.querySelectorAll(`:scope > .${this.CSS.item}`)).map(o=>{const a=o.querySelector(`.${this.CSS.itemChildren}`),i=this.getItemContent(o),r=a?e(a):[];return{content:i,items:r}});return{style:this.data.style,items:this.nodes.wrapper?e(this.nodes.wrapper):[]}}addChildrenList(e,t){const o=e.querySelector(`.${this.CSS.itemBody}`),a=this.makeListWrapper(void 0,[this.CSS.itemChildren]);this.appendItems(t,a),o&&o.appendChild(a)}makeListWrapper(e=this.listStyle,t=[]){const o=e==="ordered"?"ol":"ul",a=e==="ordered"?this.CSS.wrapperOrdered:this.CSS.wrapperUnordered;return t.push(a),gs(o,[this.CSS.wrapper,...t])}get CSS(){return{baseBlock:this.api.styles.block,wrapper:"cdx-nested-list",wrapperOrdered:"cdx-nested-list--ordered",wrapperUnordered:"cdx-nested-list--unordered",item:"cdx-nested-list__item",itemBody:"cdx-nested-list__item-body",itemContent:"cdx-nested-list__item-content",itemChildren:"cdx-nested-list__item-children",settingsWrapper:"cdx-nested-list__settings",settingsButton:this.api.styles.settingsButton,settingsButtonActive:this.api.styles.settingsButtonActive}}get listStyle(){return this.data.style||this.defaultListStyle}set listStyle(e){if(!this.nodes||!this.nodes.wrapper)return;const t=Array.from(this.nodes.wrapper.querySelectorAll(`.${this.CSS.wrapper}`));t.push(this.nodes.wrapper),t.forEach(o=>{o.classList.toggle(this.CSS.wrapperUnordered,e==="unordered"),o.classList.toggle(this.CSS.wrapperOrdered,e==="ordered")}),this.data.style=e}get currentItem(){const e=window.getSelection();if(!e)return null;let t=e.anchorNode;return!t||(Sa(t)||(t=t.parentNode),!t)||!Sa(t)?null:t.closest(`.${this.CSS.item}`)}enterPressed(e){const t=this.currentItem;if(e.stopPropagation(),e.preventDefault(),e.isComposing)return;const o=t?this.getItemContent(t).trim().length===0:!0,a=t?.parentNode===this.nodes.wrapper,i=t?.nextElementSibling===null;if(a&&i&&o){this.getOutOfList();return}else if(i&&o){this.unshiftItem();return}const r=vs.extractFragmentFromCaretPositionTillTheEnd();if(!r)return;const s=_8(r),l=t?.querySelector(`.${this.CSS.itemChildren}`),d=this.createItem(s,void 0);l&&Array.from(l.querySelectorAll(`.${this.CSS.item}`)).length>0?l.prepend(d):t?.after(d),this.focusItem(d)}unshiftItem(){const e=this.currentItem;if(!e||!e.parentNode||!Sa(e.parentNode))return;const t=e.parentNode.closest(`.${this.CSS.item}`);if(!t)return;this.caret.save(),t.after(e),this.caret.restore();const o=t.querySelector(`.${this.CSS.itemChildren}`);o&&o.children.length===0&&o.remove()}getItemContent(e){const t=e.querySelector(`.${this.CSS.itemContent}`);return!t||x8(t)?"":t.innerHTML}focusItem(e,t=!0){const o=e.querySelector(`.${this.CSS.itemContent}`);o&&vs.focus(o,t)}getOutOfList(){var e;(e=this.currentItem)==null||e.remove(),this.api.blocks.insert(),this.api.caret.setToBlock(this.api.blocks.getCurrentBlockIndex())}backspace(e){if(!vs.isAtStart())return;e.preventDefault();const t=this.currentItem;if(!t)return;const o=t.previousSibling;if(!t.parentNode||!Sa(t.parentNode))return;const a=t.parentNode.closest(`.${this.CSS.item}`);if(!o&&!a||o&&!Sa(o))return;e.stopPropagation();let i;if(o){const u=o.querySelectorAll(`.${this.CSS.item}`);i=Array.from(u).pop()||o}else i=a;const r=vs.extractFragmentFromCaretPositionTillTheEnd();if(!r)return;const s=_8(r);if(!i)return;const l=i.querySelector(`.${this.CSS.itemContent}`);if(!l)return;vs.focus(l,!1),this.caret.save(),l.insertAdjacentHTML("beforeend",s);let d=t.querySelectorAll(`.${this.CSS.itemChildren} > .${this.CSS.item}`);d=Array.from(d),d=d.filter(u=>!u.parentNode||!Sa(u.parentNode)?!1:u.parentNode.closest(`.${this.CSS.item}`)===t),d.reverse().forEach(u=>{o?i.after(u):t.after(u)}),t.remove(),this.caret.restore()}addTab(e){e.stopPropagation(),e.preventDefault();const t=this.currentItem;if(!t)return;const o=t.previousSibling;if(!o||!Sa(o)||!o)return;const a=o.querySelector(`.${this.CSS.itemChildren}`);if(this.caret.save(),a)a.appendChild(t);else{const i=this.makeListWrapper(void 0,[this.CSS.itemChildren]),r=o.querySelector(`.${this.CSS.itemBody}`);i.appendChild(t),r?.appendChild(i)}this.caret.restore()}shiftTab(e){e.stopPropagation(),e.preventDefault(),this.unshiftItem()}static joinRecursive(e){return e.items.map(t=>`${t.content} ${d6.joinRecursive(t)}`).join("")}static get conversionConfig(){return{export:e=>d6.joinRecursive(e),import:e=>({items:[{content:e,items:[]}],style:"unordered"})}}};(function(){try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode(".cdx-marker{background:rgba(245,235,111,.29);padding:3px 0}")),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const mq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-width="2" d="M11.3536 9.31802L12.7678 7.90381C13.5488 7.12276 14.8151 7.12276 15.5962 7.90381C16.3772 8.68486 16.3772 9.95119 15.5962 10.7322L14.182 12.1464M11.3536 9.31802L7.96729 12.7043C7.40889 13.2627 7.02827 13.9739 6.8734 14.7482L6.69798 15.6253C6.55804 16.325 7.17496 16.942 7.87468 16.802L8.75176 16.6266C9.52612 16.4717 10.2373 16.0911 10.7957 15.5327L14.182 12.1464M11.3536 9.31802L14.182 12.1464"/><line x1="15" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/></svg>';let hq=class _2{static get CSS(){return"cdx-marker"}constructor({api:e}){this.api=e,this.button=null,this.tag="MARK",this.iconClasses={base:this.api.styles.inlineToolButton,active:this.api.styles.inlineToolButtonActive}}static get isInline(){return!0}render(){return this.button=document.createElement("button"),this.button.type="button",this.button.classList.add(this.iconClasses.base),this.button.innerHTML=this.toolboxIcon,this.button}surround(e){if(!e)return;let t=this.api.selection.findParentTag(this.tag,_2.CSS);t?this.unwrap(t):this.wrap(e)}wrap(e){let t=document.createElement(this.tag);t.classList.add(_2.CSS),t.appendChild(e.extractContents()),e.insertNode(t),this.api.selection.expandToTag(t)}unwrap(e){this.api.selection.expandToTag(e);let t=window.getSelection(),o=t.getRangeAt(0),a=o.extractContents();e.parentNode.removeChild(e),o.insertNode(a),t.removeAllRanges(),t.addRange(o)}checkState(){const e=this.api.selection.findParentTag(this.tag,_2.CSS);this.button.classList.toggle(this.iconClasses.active,!!e)}get toolboxIcon(){return mq}static get sanitize(){return{mark:{class:_2.CSS}}}};(function(){try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode(".cdx-underline{text-decoration:underline}")),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const fq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 7.5V11.5C9 12.2956 9.31607 13.0587 9.87868 13.6213C10.4413 14.1839 11.2044 14.5 12 14.5C12.7956 14.5 13.5587 14.1839 14.1213 13.6213C14.6839 13.0587 15 12.2956 15 11.5V7.5"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7.71429 18H16.2857"/></svg>',F8=class x2{constructor(e){this.tag="U",this.api=e.api,this.iconClasses={base:this.api.styles.inlineToolButton,active:this.api.styles.inlineToolButtonActive}}static get CSS(){return"cdx-underline"}render(){return this.button=document.createElement("button"),this.button.type="button",this.button.classList.add(this.iconClasses.base),this.button.innerHTML=this.toolboxIcon,this.button}surround(e){if(!e)return;const t=this.api.selection.findParentTag(this.tag,x2.CSS);t?this.unwrap(t):this.wrap(e)}wrap(e){const t=document.createElement(this.tag);t.classList.add(x2.CSS),t.appendChild(e.extractContents()),e.insertNode(t),this.api.selection.expandToTag(t)}unwrap(e){var t;this.api.selection.expandToTag(e);const o=window.getSelection();if(!o)return;const a=o.getRangeAt(0);if(!a)return;const i=a.extractContents();i&&((t=e.parentNode)==null||t.removeChild(e),a.insertNode(i),o.removeAllRanges(),o.addRange(a))}checkState(){var e;const t=this.api.selection.findParentTag(this.tag,x2.CSS);return(e=this.button)==null||e.classList.toggle(this.iconClasses.active,!!t),!!t}get toolboxIcon(){return fq}static get sanitize(){return{u:{class:x2.CSS}}}};F8.isInline=!0;let gq=F8;(function(){try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode(".inline-code{background:rgba(250,239,240,.78);color:#b44437;padding:3px 4px;border-radius:5px;margin:0 1px;font-family:inherit;font-size:.86em;font-weight:500;letter-spacing:.3px}")),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const vq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 8L5 12L9 16"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 8L19 12L15 16"/></svg>';let bq=class D2{constructor({api:e}){this.tag="CODE",this.api=e,this.button=null,this.iconClasses={base:this.api.styles.inlineToolButton,active:this.api.styles.inlineToolButtonActive}}static get CSS(){return"inline-code"}static get isInline(){return!0}render(){return this.button=document.createElement("button"),this.button.type="button",this.button.classList.add(this.iconClasses.base),this.button.innerHTML=this.toolboxIcon,this.button}surround(e){var t;if(!e)return;let o=this.api.selection.findParentTag(this.tag,D2.CSS);o?this.unwrap(o):(t=e.commonAncestorContainer.parentElement)!=null&&t.querySelector(this.tag)||this.wrap(e)}wrap(e){let t=document.createElement(this.tag);t.classList.add(D2.CSS),t.appendChild(e.extractContents()),e.insertNode(t),this.api.selection.expandToTag(t)}unwrap(e){var t;this.api.selection.expandToTag(e);const o=window.getSelection();if(!o)return;const a=o.getRangeAt(0),i=a.extractContents();(t=e.parentNode)==null||t.removeChild(e),a.insertNode(i),o.removeAllRanges(),o.addRange(a)}checkState(){const e=this.api.selection.findParentTag(this.tag,D2.CSS);return this.button&&this.button.classList.toggle(this.iconClasses.active,!!e),!!e}get toolboxIcon(){return vq}static get sanitize(){return{code:{class:D2.CSS}}}};(function(){var n;try{if(typeof document<"u"){var e=document.createElement("style");e.nonce=(n=document.head.querySelector("meta[property=csp-nonce]"))==null?void 0:n.content,e.appendChild(document.createTextNode('.tc-wrap{--color-background:#f9f9fb;--color-text-secondary:#7b7e89;--color-border:#e8e8eb;--cell-size:34px;--toolbox-icon-size:18px;--toolbox-padding:6px;--toolbox-aiming-field-size:calc(var(--toolbox-icon-size) + var(--toolbox-padding)*2);border-left:0;position:relative;height:100%;width:100%;margin-top:var(--toolbox-icon-size);box-sizing:border-box;display:grid;grid-template-columns:calc(100% - var(--cell-size)) var(--cell-size);z-index:0}.tc-wrap--readonly{grid-template-columns:100% var(--cell-size)}.tc-wrap svg{vertical-align:top}@media print{.tc-wrap{border-left-color:var(--color-border);border-left-style:solid;border-left-width:1px;grid-template-columns:100% var(--cell-size)}}@media print{.tc-wrap .tc-row:after{display:none}}.tc-table{position:relative;width:100%;height:100%;display:grid;font-size:14px;border-top:1px solid var(--color-border);line-height:1.4}.tc-table:after{width:calc(var(--cell-size));height:100%;left:calc(var(--cell-size)*-1);top:0}.tc-table:after,.tc-table:before{position:absolute;content:""}.tc-table:before{width:100%;height:var(--toolbox-aiming-field-size);top:calc(var(--toolbox-aiming-field-size)*-1);left:0}.tc-table--heading .tc-row:first-child{font-weight:600;border-bottom:2px solid var(--color-border);position:sticky;top:0;z-index:2;background:var(--color-background)}.tc-table--heading .tc-row:first-child [contenteditable]:empty:before{content:attr(heading);color:var(--color-text-secondary)}.tc-table--heading .tc-row:first-child:after{bottom:-2px;border-bottom:2px solid var(--color-border)}.tc-add-column,.tc-add-row{display:flex;color:var(--color-text-secondary)}@media print{.tc-add{display:none}}.tc-add-column{display:grid;border-top:1px solid var(--color-border);grid-template-columns:var(--cell-size);grid-auto-rows:var(--cell-size);place-items:center}.tc-add-column svg{padding:5px;position:sticky;top:0;background-color:var(--color-background)}.tc-add-column--disabled{visibility:hidden}@media print{.tc-add-column{display:none}}.tc-add-row{height:var(--cell-size);align-items:center;padding-left:4px;position:relative}.tc-add-row--disabled{display:none}.tc-add-row:before{content:"";position:absolute;right:calc(var(--cell-size)*-1);width:var(--cell-size);height:100%}@media print{.tc-add-row{display:none}}.tc-add-column,.tc-add-row{transition:0s;cursor:pointer;will-change:background-color}.tc-add-column:hover,.tc-add-row:hover{transition:background-color .1s ease;background-color:var(--color-background)}.tc-add-row{margin-top:1px}.tc-add-row:hover:before{transition:.1s;background-color:var(--color-background)}.tc-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(10px,1fr));position:relative;border-bottom:1px solid var(--color-border)}.tc-row:after{content:"";pointer-events:none;position:absolute;width:var(--cell-size);height:100%;bottom:-1px;right:calc(var(--cell-size)*-1);border-bottom:1px solid var(--color-border)}.tc-row--selected{background:var(--color-background)}.tc-row--selected:after{background:var(--color-background)}.tc-cell{border-right:1px solid var(--color-border);padding:6px 12px;overflow:hidden;outline:none;line-break:normal}.tc-cell--selected{background:var(--color-background)}.tc-wrap--readonly .tc-row:after{display:none}.tc-toolbox{--toolbox-padding:6px;--popover-margin:30px;--toggler-click-zone-size:30px;--toggler-dots-color:#7b7e89;--toggler-dots-color-hovered:#1d202b;position:absolute;cursor:pointer;z-index:1;opacity:0;transition:opacity .1s;will-change:left,opacity}.tc-toolbox--column{top:calc(var(--toggler-click-zone-size)*-1);transform:translate(calc(var(--toggler-click-zone-size)*-1/2));will-change:left,opacity}.tc-toolbox--row{left:calc(var(--popover-margin)*-1);transform:translateY(calc(var(--toggler-click-zone-size)*-1/2));margin-top:-1px;will-change:top,opacity}.tc-toolbox--showed{opacity:1}.tc-toolbox .tc-popover{position:absolute;top:0;left:var(--popover-margin)}.tc-toolbox__toggler{display:flex;align-items:center;justify-content:center;width:var(--toggler-click-zone-size);height:var(--toggler-click-zone-size);color:var(--toggler-dots-color);opacity:0;transition:opacity .15s ease;will-change:opacity}.tc-toolbox__toggler:hover{color:var(--toggler-dots-color-hovered)}.tc-toolbox__toggler svg{fill:currentColor}.tc-wrap:hover .tc-toolbox__toggler{opacity:1}.tc-settings .cdx-settings-button{width:50%;margin:0}.tc-popover{--color-border:#eaeaea;--color-background:#fff;--color-background-hover:rgba(232,232,235,.49);--color-background-confirm:#e24a4a;--color-background-confirm-hover:#d54040;--color-text-confirm:#fff;background:var(--color-background);border:1px solid var(--color-border);box-shadow:0 3px 15px -3px #0d142121;border-radius:6px;padding:6px;display:none;will-change:opacity,transform}.tc-popover--opened{display:block;animation:menuShowing .1s cubic-bezier(.215,.61,.355,1) forwards}.tc-popover__item{display:flex;align-items:center;padding:2px 14px 2px 2px;border-radius:5px;cursor:pointer;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;user-select:none}.tc-popover__item:hover{background:var(--color-background-hover)}.tc-popover__item:not(:last-of-type){margin-bottom:2px}.tc-popover__item-icon{display:inline-flex;width:26px;height:26px;align-items:center;justify-content:center;background:var(--color-background);border-radius:5px;border:1px solid var(--color-border);margin-right:8px}.tc-popover__item-label{line-height:22px;font-size:14px;font-weight:500}.tc-popover__item--confirm{background:var(--color-background-confirm);color:var(--color-text-confirm)}.tc-popover__item--confirm:hover{background-color:var(--color-background-confirm-hover)}.tc-popover__item--confirm .tc-popover__item-icon{background:var(--color-background-confirm);border-color:#0000001a}.tc-popover__item--confirm .tc-popover__item-icon svg{transition:transform .2s ease-in;transform:rotate(90deg) scale(1.2)}.tc-popover__item--hidden{display:none}@keyframes menuShowing{0%{opacity:0;transform:translateY(-8px) scale(.9)}70%{opacity:1;transform:translateY(2px)}to{transform:translateY(0)}}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();function Kn(n,e,t={}){const o=document.createElement(n);Array.isArray(e)?o.classList.add(...e):e&&o.classList.add(e);for(const a in t)Object.prototype.hasOwnProperty.call(t,a)&&(o[a]=t[a]);return o}function E8(n){const e=n.getBoundingClientRect();return{y1:Math.floor(e.top+window.pageYOffset),x1:Math.floor(e.left+window.pageXOffset),x2:Math.floor(e.right+window.pageXOffset),y2:Math.floor(e.bottom+window.pageYOffset)}}function S8(n,e){const t=E8(n),o=E8(e);return{fromTopBorder:o.y1-t.y1,fromLeftBorder:o.x1-t.x1,fromRightBorder:t.x2-o.x2,fromBottomBorder:t.y2-o.y2}}function yq(n,e){const t=n.getBoundingClientRect(),{width:o,height:a,x:i,y:r}=t,{clientX:s,clientY:l}=e;return{width:o,height:a,x:s-i,y:l-r}}function I8(n,e){return e.parentNode.insertBefore(n,e)}function M8(n,e=!0){const t=document.createRange(),o=window.getSelection();t.selectNodeContents(n),t.collapse(e),o.removeAllRanges(),o.addRange(t)}let Cq=class oo{constructor({items:e}){this.items=e,this.wrapper=void 0,this.itemEls=[]}static get CSS(){return{popover:"tc-popover",popoverOpened:"tc-popover--opened",item:"tc-popover__item",itemHidden:"tc-popover__item--hidden",itemConfirmState:"tc-popover__item--confirm",itemIcon:"tc-popover__item-icon",itemLabel:"tc-popover__item-label"}}render(){return this.wrapper=Kn("div",oo.CSS.popover),this.items.forEach((e,t)=>{const o=Kn("div",oo.CSS.item),a=Kn("div",oo.CSS.itemIcon,{innerHTML:e.icon}),i=Kn("div",oo.CSS.itemLabel,{textContent:e.label});o.dataset.index=t,o.appendChild(a),o.appendChild(i),this.wrapper.appendChild(o),this.itemEls.push(o)}),this.wrapper.addEventListener("click",e=>{this.popoverClicked(e)}),this.wrapper}popoverClicked(e){const t=e.target.closest(`.${oo.CSS.item}`);if(!t)return;const o=t.dataset.index,a=this.items[o];if(a.confirmationRequired&&!this.hasConfirmationState(t)){this.setConfirmationState(t);return}a.onClick()}setConfirmationState(e){e.classList.add(oo.CSS.itemConfirmState)}clearConfirmationState(e){e.classList.remove(oo.CSS.itemConfirmState)}hasConfirmationState(e){return e.classList.contains(oo.CSS.itemConfirmState)}get opened(){return this.wrapper.classList.contains(oo.CSS.popoverOpened)}open(){this.items.forEach((e,t)=>{typeof e.hideIf=="function"&&this.itemEls[t].classList.toggle(oo.CSS.itemHidden,e.hideIf())}),this.wrapper.classList.add(oo.CSS.popoverOpened)}close(){this.wrapper.classList.remove(oo.CSS.popoverOpened),this.itemEls.forEach(e=>{this.clearConfirmationState(e)})}};const kq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 9L10 12M10 12L7 15M10 12H4"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 9L14 12M14 12L17 15M14 12H20"/></svg>',B8='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 8L12 12M12 12L16 16M12 12L16 8M12 12L8 16"/></svg>',wq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.8833 9.16666L18.2167 12.5M18.2167 12.5L14.8833 15.8333M18.2167 12.5H10.05C9.16594 12.5 8.31809 12.1488 7.69297 11.5237C7.06785 10.8986 6.71666 10.0507 6.71666 9.16666"/></svg>',jq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.9167 14.9167L11.5833 18.25M11.5833 18.25L8.25 14.9167M11.5833 18.25L11.5833 10.0833C11.5833 9.19928 11.9345 8.35143 12.5596 7.72631C13.1848 7.10119 14.0326 6.75 14.9167 6.75"/></svg>',_q='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.13333 14.9167L12.4667 18.25M12.4667 18.25L15.8 14.9167M12.4667 18.25L12.4667 10.0833C12.4667 9.19928 12.1155 8.35143 11.4904 7.72631C10.8652 7.10119 10.0174 6.75 9.13333 6.75"/></svg>',xq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.8833 15.8333L18.2167 12.5M18.2167 12.5L14.8833 9.16667M18.2167 12.5L10.05 12.5C9.16595 12.5 8.31811 12.8512 7.69299 13.4763C7.06787 14.1014 6.71667 14.9493 6.71667 15.8333"/></svg>',Dq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.41 9.66H9.4"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 9.66H14.59"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.31 14.36H9.3"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 14.36H14.59"/></svg>',T8='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12 7V12M12 17V12M17 12H12M12 12H7"/></svg>',Fq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 9L20 12L17 15"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 12H20"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 9L4 12L7 15"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 12H10"/></svg>',Eq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-width="2" d="M5 10H19"/><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/></svg>',Sq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-width="2" d="M10 5V18.5"/><path stroke="currentColor" stroke-width="2" d="M14 5V18.5"/><path stroke="currentColor" stroke-width="2" d="M5 10H19"/><path stroke="currentColor" stroke-width="2" d="M5 14H19"/><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/></svg>',Iq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-width="2" d="M10 5V18.5"/><path stroke="currentColor" stroke-width="2" d="M5 10H19"/><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/></svg>';let A8=class gl{constructor({api:e,items:t,onOpen:o,onClose:a,cssModifier:i=""}){this.api=e,this.items=t,this.onOpen=o,this.onClose=a,this.cssModifier=i,this.popover=null,this.wrapper=this.createToolbox()}static get CSS(){return{toolbox:"tc-toolbox",toolboxShowed:"tc-toolbox--showed",toggler:"tc-toolbox__toggler"}}get element(){return this.wrapper}createToolbox(){const e=Kn("div",[gl.CSS.toolbox,this.cssModifier?`${gl.CSS.toolbox}--${this.cssModifier}`:""]);e.dataset.mutationFree="true";const t=this.createPopover(),o=this.createToggler();return e.appendChild(o),e.appendChild(t),e}createToggler(){const e=Kn("div",gl.CSS.toggler,{innerHTML:Dq});return e.addEventListener("click",()=>{this.togglerClicked()}),e}createPopover(){return this.popover=new Cq({items:this.items}),this.popover.render()}togglerClicked(){this.popover.opened?(this.popover.close(),this.onClose()):(this.popover.open(),this.onOpen())}show(e){const t=e();Object.entries(t).forEach(([o,a])=>{this.wrapper.style[o]=a}),this.wrapper.classList.add(gl.CSS.toolboxShowed)}hide(){this.popover.close(),this.wrapper.classList.remove(gl.CSS.toolboxShowed)}};function Mq(n,e){let t=0;return function(...o){const a=new Date().getTime();if(!(a-t<n))return t=a,e(...o)}}const Me={wrapper:"tc-wrap",wrapperReadOnly:"tc-wrap--readonly",table:"tc-table",row:"tc-row",withHeadings:"tc-table--heading",rowSelected:"tc-row--selected",cell:"tc-cell",cellSelected:"tc-cell--selected",addRow:"tc-add-row",addRowDisabled:"tc-add-row--disabled",addColumn:"tc-add-column",addColumnDisabled:"tc-add-column--disabled"};let Bq=class{constructor(e,t,o,a){this.readOnly=e,this.api=t,this.data=o,this.config=a,this.wrapper=null,this.table=null,this.toolboxColumn=this.createColumnToolbox(),this.toolboxRow=this.createRowToolbox(),this.createTableWrapper(),this.hoveredRow=0,this.hoveredColumn=0,this.selectedRow=0,this.selectedColumn=0,this.tunes={withHeadings:!1},this.resize(),this.fill(),this.focusedCell={row:0,column:0},this.documentClicked=i=>{const r=i.target.closest(`.${Me.table}`)!==null,s=i.target.closest(`.${Me.wrapper}`)===null;(r||s)&&this.hideToolboxes();const l=i.target.closest(`.${Me.addRow}`),d=i.target.closest(`.${Me.addColumn}`);l&&l.parentNode===this.wrapper?(this.addRow(void 0,!0),this.hideToolboxes()):d&&d.parentNode===this.wrapper&&(this.addColumn(void 0,!0),this.hideToolboxes())},this.readOnly||this.bindEvents()}getWrapper(){return this.wrapper}bindEvents(){document.addEventListener("click",this.documentClicked),this.table.addEventListener("mousemove",Mq(150,e=>this.onMouseMoveInTable(e)),{passive:!0}),this.table.onkeypress=e=>this.onKeyPressListener(e),this.table.addEventListener("keydown",e=>this.onKeyDownListener(e)),this.table.addEventListener("focusin",e=>this.focusInTableListener(e))}createColumnToolbox(){return new A8({api:this.api,cssModifier:"column",items:[{label:this.api.i18n.t("Add column to left"),icon:jq,hideIf:()=>this.numberOfColumns===this.config.maxcols,onClick:()=>{this.addColumn(this.selectedColumn,!0),this.hideToolboxes()}},{label:this.api.i18n.t("Add column to right"),icon:_q,hideIf:()=>this.numberOfColumns===this.config.maxcols,onClick:()=>{this.addColumn(this.selectedColumn+1,!0),this.hideToolboxes()}},{label:this.api.i18n.t("Delete column"),icon:B8,hideIf:()=>this.numberOfColumns===1,confirmationRequired:!0,onClick:()=>{this.deleteColumn(this.selectedColumn),this.hideToolboxes()}}],onOpen:()=>{this.selectColumn(this.hoveredColumn),this.hideRowToolbox()},onClose:()=>{this.unselectColumn()}})}createRowToolbox(){return new A8({api:this.api,cssModifier:"row",items:[{label:this.api.i18n.t("Add row above"),icon:xq,hideIf:()=>this.numberOfRows===this.config.maxrows,onClick:()=>{this.addRow(this.selectedRow,!0),this.hideToolboxes()}},{label:this.api.i18n.t("Add row below"),icon:wq,hideIf:()=>this.numberOfRows===this.config.maxrows,onClick:()=>{this.addRow(this.selectedRow+1,!0),this.hideToolboxes()}},{label:this.api.i18n.t("Delete row"),icon:B8,hideIf:()=>this.numberOfRows===1,confirmationRequired:!0,onClick:()=>{this.deleteRow(this.selectedRow),this.hideToolboxes()}}],onOpen:()=>{this.selectRow(this.hoveredRow),this.hideColumnToolbox()},onClose:()=>{this.unselectRow()}})}moveCursorToNextRow(){this.focusedCell.row!==this.numberOfRows?(this.focusedCell.row+=1,this.focusCell(this.focusedCell)):(this.addRow(),this.focusedCell.row+=1,this.focusCell(this.focusedCell),this.updateToolboxesPosition(0,0))}getCell(e,t){return this.table.querySelectorAll(`.${Me.row}:nth-child(${e}) .${Me.cell}`)[t-1]}getRow(e){return this.table.querySelector(`.${Me.row}:nth-child(${e})`)}getRowByCell(e){return e.parentElement}getRowFirstCell(e){return e.querySelector(`.${Me.cell}:first-child`)}setCellContent(e,t,o){const a=this.getCell(e,t);a.innerHTML=o}addColumn(e=-1,t=!1){var o;let a=this.numberOfColumns;if(this.config&&this.config.maxcols&&this.numberOfColumns>=this.config.maxcols)return;for(let r=1;r<=this.numberOfRows;r++){let s;const l=this.createCell();if(e>0&&e<=a?(s=this.getCell(r,e),I8(l,s)):s=this.getRow(r).appendChild(l),r===1){const d=this.getCell(r,e>0?e:a+1);d&&t&&M8(d)}}const i=this.wrapper.querySelector(`.${Me.addColumn}`);(o=this.config)!=null&&o.maxcols&&this.numberOfColumns>this.config.maxcols-1&&i&&i.classList.add(Me.addColumnDisabled),this.addHeadingAttrToFirstRow()}addRow(e=-1,t=!1){let o,a=Kn("div",Me.row);this.tunes.withHeadings&&this.removeHeadingAttrFromFirstRow();let i=this.numberOfColumns;if(this.config&&this.config.maxrows&&this.numberOfRows>=this.config.maxrows&&s)return;if(e>0&&e<=this.numberOfRows){let l=this.getRow(e);o=I8(a,l)}else o=this.table.appendChild(a);this.fillRow(o,i),this.tunes.withHeadings&&this.addHeadingAttrToFirstRow();const r=this.getRowFirstCell(o);r&&t&&M8(r);const s=this.wrapper.querySelector(`.${Me.addRow}`);return this.config&&this.config.maxrows&&this.numberOfRows>=this.config.maxrows&&s&&s.classList.add(Me.addRowDisabled),o}deleteColumn(e){for(let o=1;o<=this.numberOfRows;o++){const a=this.getCell(o,e);if(!a)return;a.remove()}const t=this.wrapper.querySelector(`.${Me.addColumn}`);t&&t.classList.remove(Me.addColumnDisabled)}deleteRow(e){this.getRow(e).remove();const t=this.wrapper.querySelector(`.${Me.addRow}`);t&&t.classList.remove(Me.addRowDisabled),this.addHeadingAttrToFirstRow()}createTableWrapper(){if(this.wrapper=Kn("div",Me.wrapper),this.table=Kn("div",Me.table),this.readOnly&&this.wrapper.classList.add(Me.wrapperReadOnly),this.wrapper.appendChild(this.toolboxRow.element),this.wrapper.appendChild(this.toolboxColumn.element),this.wrapper.appendChild(this.table),!this.readOnly){const e=Kn("div",Me.addColumn,{innerHTML:T8}),t=Kn("div",Me.addRow,{innerHTML:T8});this.wrapper.appendChild(e),this.wrapper.appendChild(t)}}computeInitialSize(){const e=this.data&&this.data.content,t=Array.isArray(e),o=t?e.length:!1,a=t?e.length:void 0,i=o?e[0].length:void 0,r=Number.parseInt(this.config&&this.config.rows),s=Number.parseInt(this.config&&this.config.cols),l=!isNaN(r)&&r>0?r:void 0,d=!isNaN(s)&&s>0?s:void 0;return{rows:a||l||2,cols:i||d||2}}resize(){const{rows:e,cols:t}=this.computeInitialSize();for(let o=0;o<e;o++)this.addRow();for(let o=0;o<t;o++)this.addColumn()}fill(){const e=this.data;if(e&&e.content)for(let t=0;t<e.content.length;t++)for(let o=0;o<e.content[t].length;o++)this.setCellContent(t+1,o+1,e.content[t][o])}fillRow(e,t){for(let o=1;o<=t;o++){const a=this.createCell();e.appendChild(a)}}createCell(){return Kn("div",Me.cell,{contentEditable:!this.readOnly})}get numberOfRows(){return this.table.childElementCount}get numberOfColumns(){return this.numberOfRows?this.table.querySelectorAll(`.${Me.row}:first-child .${Me.cell}`).length:0}get isColumnMenuShowing(){return this.selectedColumn!==0}get isRowMenuShowing(){return this.selectedRow!==0}onMouseMoveInTable(e){const{row:t,column:o}=this.getHoveredCell(e);this.hoveredColumn=o,this.hoveredRow=t,this.updateToolboxesPosition()}onKeyPressListener(e){if(e.key==="Enter"){if(e.shiftKey)return!0;this.moveCursorToNextRow()}return e.key!=="Enter"}onKeyDownListener(e){e.key==="Tab"&&e.stopPropagation()}focusInTableListener(e){const t=e.target,o=this.getRowByCell(t);this.focusedCell={row:Array.from(this.table.querySelectorAll(`.${Me.row}`)).indexOf(o)+1,column:Array.from(o.querySelectorAll(`.${Me.cell}`)).indexOf(t)+1}}hideToolboxes(){this.hideRowToolbox(),this.hideColumnToolbox(),this.updateToolboxesPosition()}hideRowToolbox(){this.unselectRow(),this.toolboxRow.hide()}hideColumnToolbox(){this.unselectColumn(),this.toolboxColumn.hide()}focusCell(){this.focusedCellElem.focus()}get focusedCellElem(){const{row:e,column:t}=this.focusedCell;return this.getCell(e,t)}updateToolboxesPosition(e=this.hoveredRow,t=this.hoveredColumn){this.isColumnMenuShowing||t>0&&t<=this.numberOfColumns&&this.toolboxColumn.show(()=>({left:`calc((100% - var(--cell-size)) / (${this.numberOfColumns} * 2) * (1 + (${t} - 1) * 2))`})),this.isRowMenuShowing||e>0&&e<=this.numberOfRows&&this.toolboxRow.show(()=>{const o=this.getRow(e),{fromTopBorder:a}=S8(this.table,o),{height:i}=o.getBoundingClientRect();return{top:`${Math.ceil(a+i/2)}px`}})}setHeadingsSetting(e){this.tunes.withHeadings=e,e?(this.table.classList.add(Me.withHeadings),this.addHeadingAttrToFirstRow()):(this.table.classList.remove(Me.withHeadings),this.removeHeadingAttrFromFirstRow())}addHeadingAttrToFirstRow(){for(let e=1;e<=this.numberOfColumns;e++){let t=this.getCell(1,e);t&&t.setAttribute("heading",this.api.i18n.t("Heading"))}}removeHeadingAttrFromFirstRow(){for(let e=1;e<=this.numberOfColumns;e++){let t=this.getCell(1,e);t&&t.removeAttribute("heading")}}selectRow(e){const t=this.getRow(e);t&&(this.selectedRow=e,t.classList.add(Me.rowSelected))}unselectRow(){if(this.selectedRow<=0)return;const e=this.table.querySelector(`.${Me.rowSelected}`);e&&e.classList.remove(Me.rowSelected),this.selectedRow=0}selectColumn(e){for(let t=1;t<=this.numberOfRows;t++){const o=this.getCell(t,e);o&&o.classList.add(Me.cellSelected)}this.selectedColumn=e}unselectColumn(){if(this.selectedColumn<=0)return;let e=this.table.querySelectorAll(`.${Me.cellSelected}`);Array.from(e).forEach(t=>{t.classList.remove(Me.cellSelected)}),this.selectedColumn=0}getHoveredCell(e){let t=this.hoveredRow,o=this.hoveredColumn;const{width:a,height:i,x:r,y:s}=yq(this.table,e);return r>=0&&(o=this.binSearch(this.numberOfColumns,l=>this.getCell(1,l),({fromLeftBorder:l})=>r<l,({fromRightBorder:l})=>r>a-l)),s>=0&&(t=this.binSearch(this.numberOfRows,l=>this.getCell(l,1),({fromTopBorder:l})=>s<l,({fromBottomBorder:l})=>s>i-l)),{row:t||this.hoveredRow,column:o||this.hoveredColumn}}binSearch(e,t,o,a){let i=0,r=e+1,s=0,l;for(;i<r-1&&s<10;){l=Math.ceil((i+r)/2);const d=t(l),u=S8(this.table,d);if(o(u))r=l;else if(a(u))i=l;else break;s++}return l}getData(){const e=[];for(let t=1;t<=this.numberOfRows;t++){const o=this.table.querySelector(`.${Me.row}:nth-child(${t})`),a=Array.from(o.querySelectorAll(`.${Me.cell}`));a.every(i=>!i.textContent.trim())||e.push(a.map(i=>i.innerHTML))}return e}destroy(){document.removeEventListener("click",this.documentClicked)}},Tq=class{static get isReadOnlySupported(){return!0}static get enableLineBreaks(){return!0}constructor({data:e,config:t,api:o,readOnly:a,block:i}){this.api=o,this.readOnly=a,this.config=t,this.data={withHeadings:this.getConfig("withHeadings",!1,e),stretched:this.getConfig("stretched",!1,e),content:e&&e.content?e.content:[]},this.table=null,this.block=i}static get toolbox(){return{icon:Iq,title:"Table"}}render(){return this.table=new Bq(this.readOnly,this.api,this.data,this.config),this.container=Kn("div",this.api.styles.block),this.container.appendChild(this.table.getWrapper()),this.table.setHeadingsSetting(this.data.withHeadings),this.container}renderSettings(){return[{label:this.api.i18n.t("With headings"),icon:Eq,isActive:this.data.withHeadings,closeOnActivate:!0,toggle:!0,onActivate:()=>{this.data.withHeadings=!0,this.table.setHeadingsSetting(this.data.withHeadings)}},{label:this.api.i18n.t("Without headings"),icon:Sq,isActive:!this.data.withHeadings,closeOnActivate:!0,toggle:!0,onActivate:()=>{this.data.withHeadings=!1,this.table.setHeadingsSetting(this.data.withHeadings)}},{label:this.data.stretched?this.api.i18n.t("Collapse"):this.api.i18n.t("Stretch"),icon:this.data.stretched?kq:Fq,closeOnActivate:!0,toggle:!0,onActivate:()=>{this.data.stretched=!this.data.stretched,this.block.stretched=this.data.stretched}}]}save(){const e=this.table.getData();return{withHeadings:this.data.withHeadings,stretched:this.data.stretched,content:e}}destroy(){this.table.destroy()}getConfig(e,t=void 0,o=void 0){const a=this.data||o;return a?a[e]?a[e]:t:this.config&&this.config[e]?this.config[e]:t}static get pasteConfig(){return{tags:["TABLE","TR","TH","TD"]}}onPaste(e){const t=e.detail.data,o=t.querySelector(":scope > thead, tr:first-of-type th"),a=Array.from(t.querySelectorAll("tr")).map(i=>Array.from(i.querySelectorAll("th, td")).map(r=>r.innerHTML));this.data={withHeadings:o!==null,content:a},this.table.wrapper&&this.table.wrapper.replaceWith(this.render())}};(function(){try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode(".ce-code__textarea{min-height:200px;font-family:Menlo,Monaco,Consolas,Courier New,monospace;color:#41314e;line-height:1.6em;font-size:12px;background:#f8f7fa;border:1px solid #f1f1f4;box-shadow:none;white-space:pre;word-wrap:normal;overflow-x:auto;resize:vertical}")),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();function Aq(n,e){let t="";for(;t!==`
41
+ `),a=t.innerHTML;return e.clipboardData.setData("text/plain",o),e.clipboardData.setData("text/html",a),Promise.all(this.selectedBlocks.map(i=>i.save())).then(i=>{try{e.clipboardData.setData(this.Editor.Paste.MIME_TYPE,JSON.stringify(i))}catch{}})}selectBlockByIndex(e){const{BlockManager:t}=this.Editor,o=t.getBlockByIndex(e);o!==void 0&&this.selectBlock(o)}selectBlock(e){this.selection.save(),_e.get().removeAllRanges(),e.selected=!0,this.clearCache(),this.Editor.InlineToolbar.close()}unselectBlock(e){e.selected=!1,this.clearCache()}clearCache(){this.anyBlockSelectedCache=null}destroy(){hs.remove(this.Editor.UI.nodes.redactor,"CMD+A")}handleCommandA(e){if(this.Editor.RectangleSelection.clearSelection(),Y.isNativeInput(e.target)&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}const t=this.Editor.BlockManager.getBlock(e.target),o=t.inputs;if(o.length>1&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}if(o.length===1&&!this.needToSelectAll){this.needToSelectAll=!0;return}this.needToSelectAll?(e.preventDefault(),this.selectAllBlocks(),this.needToSelectAll=!1,this.readyToBlockSelection=!1):this.readyToBlockSelection&&(e.preventDefault(),this.selectBlock(t),this.needToSelectAll=!0)}selectAllBlocks(){this.selection.save(),_e.get().removeAllRanges(),this.allBlocksSelected=!0,this.Editor.InlineToolbar.close()}}let FU=class l6 extends Pe{get positions(){return{START:"start",END:"end",DEFAULT:"default"}}static get CSS(){return{shadowCaret:"cdx-shadow-caret"}}setToBlock(e,t=this.positions.DEFAULT,o=0){var a;const{BlockManager:i,BlockSelection:r}=this.Editor;if(r.clearSelection(),!e.focusable){(a=window.getSelection())==null||a.removeAllRanges(),r.selectBlock(e),i.currentBlock=e;return}let s;switch(t){case this.positions.START:s=e.firstInput;break;case this.positions.END:s=e.lastInput;break;default:s=e.currentInput}if(!s)return;let l,d=o;if(t===this.positions.START)l=Y.getDeepestNode(s,!1),d=0;else if(t===this.positions.END)l=Y.getDeepestNode(s,!0),d=Y.getContentLength(l);else{const{node:u,offset:p}=Y.getNodeByOffset(s,o);u?(l=u,d=p):(l=Y.getDeepestNode(s,!1),d=0)}this.set(l,d),i.setCurrentBlockByChildNode(e.holder),i.currentBlock.currentInput=s}setToInput(e,t=this.positions.DEFAULT,o=0){const{currentBlock:a}=this.Editor.BlockManager,i=Y.getDeepestNode(e);switch(t){case this.positions.START:this.set(i,0);break;case this.positions.END:this.set(i,Y.getContentLength(i));break;default:o&&this.set(i,o)}a.currentInput=e}set(e,t=0){const{top:o,bottom:a}=_e.setCursor(e,t),{innerHeight:i}=window;o<0?window.scrollBy(0,o-30):a>i&&window.scrollBy(0,a-i+30)}setToTheLastBlock(){const e=this.Editor.BlockManager.lastBlock;if(e)if(e.tool.isDefault&&e.isEmpty)this.setToBlock(e);else{const t=this.Editor.BlockManager.insertAtEnd();this.setToBlock(t)}}extractFragmentFromCaretPosition(){const e=_e.get();if(e.rangeCount){const t=e.getRangeAt(0),o=this.Editor.BlockManager.currentBlock.currentInput;if(t.deleteContents(),o)if(Y.isNativeInput(o)){const a=o,i=document.createDocumentFragment(),r=a.value.substring(0,a.selectionStart),s=a.value.substring(a.selectionStart);return i.textContent=s,a.value=r,i}else{const a=t.cloneRange();return a.selectNodeContents(o),a.setStart(t.endContainer,t.endOffset),a.extractContents()}}}navigateNext(e=!1){const{BlockManager:t}=this.Editor,{currentBlock:o,nextBlock:a}=t;if(o===void 0)return!1;const{nextInput:i,currentInput:r}=o,s=r!==void 0?N0(r):void 0;let l=a;const d=e||s||!o.focusable;if(i&&d)return this.setToInput(i,this.positions.START),!0;if(l===null){if(o.tool.isDefault||!d)return!1;l=t.insertAtEnd()}return d?(this.setToBlock(l,this.positions.START),!0):!1}navigatePrevious(e=!1){const{currentBlock:t,previousBlock:o}=this.Editor.BlockManager;if(!t)return!1;const{previousInput:a,currentInput:i}=t,r=i!==void 0?L0(i):void 0,s=e||r||!t.focusable;return a&&s?(this.setToInput(a,this.positions.END),!0):o!==null&&s?(this.setToBlock(o,this.positions.END),!0):!1}createShadow(e){const t=document.createElement("span");t.classList.add(l6.CSS.shadowCaret),e.insertAdjacentElement("beforeend",t)}restoreCaret(e){const t=e.querySelector(`.${l6.CSS.shadowCaret}`);if(!t)return;new _e().expandToTag(t);const o=document.createRange();o.selectNode(t),o.extractContents()}insertContentAtCaretPosition(e){const t=document.createDocumentFragment(),o=document.createElement("div"),a=_e.get(),i=_e.range;o.innerHTML=e,Array.from(o.childNodes).forEach(d=>t.appendChild(d)),t.childNodes.length===0&&t.appendChild(new Text);const r=t.lastChild;i.deleteContents(),i.insertNode(t);const s=document.createRange(),l=r.nodeType===Node.TEXT_NODE?r:r.firstChild;l!==null&&l.textContent!==null&&s.setStart(l,l.textContent.length),a.removeAllRanges(),a.addRange(s)}};class EU extends Pe{constructor(){super(...arguments),this.onMouseUp=()=>{this.listeners.off(document,"mouseover",this.onMouseOver),this.listeners.off(document,"mouseup",this.onMouseUp)},this.onMouseOver=e=>{const{BlockManager:t,BlockSelection:o}=this.Editor;if(e.relatedTarget===null&&e.target===null)return;const a=t.getBlockByChildNode(e.relatedTarget)||this.lastSelectedBlock,i=t.getBlockByChildNode(e.target);if(!(!a||!i)&&i!==a){if(a===this.firstSelectedBlock){_e.get().removeAllRanges(),a.selected=!0,i.selected=!0,o.clearCache();return}if(i===this.firstSelectedBlock){a.selected=!1,i.selected=!1,o.clearCache();return}this.Editor.InlineToolbar.close(),this.toggleBlocksSelectedState(a,i),this.lastSelectedBlock=i}}}async prepare(){this.listeners.on(document,"mousedown",e=>{this.enableCrossBlockSelection(e)})}watchSelection(e){if(e.button!==mz.LEFT)return;const{BlockManager:t}=this.Editor;this.firstSelectedBlock=t.getBlock(e.target),this.lastSelectedBlock=this.firstSelectedBlock,this.listeners.on(document,"mouseover",this.onMouseOver),this.listeners.on(document,"mouseup",this.onMouseUp)}get isCrossBlockSelectionStarted(){return!!this.firstSelectedBlock&&!!this.lastSelectedBlock&&this.firstSelectedBlock!==this.lastSelectedBlock}toggleBlockSelectedState(e=!0){const{BlockManager:t,BlockSelection:o}=this.Editor;this.lastSelectedBlock||(this.lastSelectedBlock=this.firstSelectedBlock=t.currentBlock),this.firstSelectedBlock===this.lastSelectedBlock&&(this.firstSelectedBlock.selected=!0,o.clearCache(),_e.get().removeAllRanges());const a=t.blocks.indexOf(this.lastSelectedBlock)+(e?1:-1),i=t.blocks[a];i&&(this.lastSelectedBlock.selected!==i.selected?(i.selected=!0,o.clearCache()):(this.lastSelectedBlock.selected=!1,o.clearCache()),this.lastSelectedBlock=i,this.Editor.InlineToolbar.close(),i.holder.scrollIntoView({block:"nearest"}))}clear(e){const{BlockManager:t,BlockSelection:o,Caret:a}=this.Editor,i=t.blocks.indexOf(this.firstSelectedBlock),r=t.blocks.indexOf(this.lastSelectedBlock);if(o.anyBlockSelected&&i>-1&&r>-1&&e&&e instanceof KeyboardEvent)switch(e.keyCode){case Fe.DOWN:case Fe.RIGHT:a.setToBlock(t.blocks[Math.max(i,r)],a.positions.END);break;case Fe.UP:case Fe.LEFT:a.setToBlock(t.blocks[Math.min(i,r)],a.positions.START);break;default:a.setToBlock(t.blocks[Math.max(i,r)],a.positions.END)}this.firstSelectedBlock=this.lastSelectedBlock=null}enableCrossBlockSelection(e){const{UI:t}=this.Editor;_e.isCollapsed||this.Editor.BlockSelection.clearSelection(e),t.nodes.redactor.contains(e.target)?this.watchSelection(e):this.Editor.BlockSelection.clearSelection(e)}toggleBlocksSelectedState(e,t){const{BlockManager:o,BlockSelection:a}=this.Editor,i=o.blocks.indexOf(e),r=o.blocks.indexOf(t),s=e.selected!==t.selected;for(let l=Math.min(i,r);l<=Math.max(i,r);l++){const d=o.blocks[l];d!==this.firstSelectedBlock&&d!==(s?e:t)&&(o.blocks[l].selected=!o.blocks[l].selected,a.clearCache())}}}class SU extends Pe{constructor(){super(...arguments),this.isStartedAtEditor=!1}toggleReadOnly(e){e?this.disableModuleBindings():this.enableModuleBindings()}enableModuleBindings(){const{UI:e}=this.Editor;this.readOnlyMutableListeners.on(e.nodes.holder,"drop",async t=>{await this.processDrop(t)},!0),this.readOnlyMutableListeners.on(e.nodes.holder,"dragstart",()=>{this.processDragStart()}),this.readOnlyMutableListeners.on(e.nodes.holder,"dragover",t=>{this.processDragOver(t)},!0)}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}async processDrop(e){const{BlockManager:t,Paste:o,Caret:a}=this.Editor;e.preventDefault(),t.blocks.forEach(r=>{r.dropTarget=!1}),_e.isAtEditor&&!_e.isCollapsed&&this.isStartedAtEditor&&document.execCommand("delete"),this.isStartedAtEditor=!1;const i=t.setCurrentBlockByChildNode(e.target);if(i)this.Editor.Caret.setToBlock(i,a.positions.END);else{const r=t.setCurrentBlockByChildNode(t.lastBlock.holder);this.Editor.Caret.setToBlock(r,a.positions.END)}await o.processDataTransfer(e.dataTransfer,!0)}processDragStart(){_e.isAtEditor&&!_e.isCollapsed&&(this.isStartedAtEditor=!0),this.Editor.InlineToolbar.close()}processDragOver(e){e.preventDefault()}}const IU=180,MU=400;class BU extends Pe{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t}),this.disabled=!1,this.batchingTimeout=null,this.batchingOnChangeQueue=new Map,this.batchTime=MU,this.mutationObserver=new MutationObserver(o=>{this.redactorChanged(o)}),this.eventsDispatcher.on(hv,o=>{this.particularBlockChanged(o.event)}),this.eventsDispatcher.on(fv,()=>{this.disable()}),this.eventsDispatcher.on(gv,()=>{this.enable()})}enable(){this.mutationObserver.observe(this.Editor.UI.nodes.redactor,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),this.disabled=!1}disable(){this.mutationObserver.disconnect(),this.disabled=!0}particularBlockChanged(e){this.disabled||!bt(this.config.onChange)||(this.batchingOnChangeQueue.set(`block:${e.detail.target.id}:event:${e.type}`,e),this.batchingTimeout&&clearTimeout(this.batchingTimeout),this.batchingTimeout=setTimeout(()=>{let t;this.batchingOnChangeQueue.size===1?t=this.batchingOnChangeQueue.values().next().value:t=Array.from(this.batchingOnChangeQueue.values()),this.config.onChange&&this.config.onChange(this.Editor.API.methods,t),this.batchingOnChangeQueue.clear()},this.batchTime))}redactorChanged(e){this.eventsDispatcher.emit(om,{mutations:e})}}const g8=class Mx extends Pe{constructor(){super(...arguments),this.MIME_TYPE="application/x-editor-js",this.toolsTags={},this.tagsByTool={},this.toolsPatterns=[],this.toolsFiles={},this.exceptionList=[],this.processTool=e=>{try{const t=e.create({},{},!1);if(e.pasteConfig===!1){this.exceptionList.push(e.name);return}if(!bt(t.onPaste))return;this.getTagsConfig(e),this.getFilesConfig(e),this.getPatternsConfig(e)}catch(t){Ue(`Paste handling for «${e.name}» Tool hasn't been set up because of the error`,"warn",t)}},this.handlePasteEvent=async e=>{const{BlockManager:t,Toolbar:o}=this.Editor,a=t.setCurrentBlockByChildNode(e.target);!a||this.isNativeBehaviour(e.target)&&!e.clipboardData.types.includes("Files")||a&&this.exceptionList.includes(a.name)||(e.preventDefault(),this.processDataTransfer(e.clipboardData),o.close())}}async prepare(){this.processTools()}toggleReadOnly(e){e?this.unsetCallback():this.setCallback()}async processDataTransfer(e,t=!1){const{Tools:o}=this.Editor,a=e.types;if((a.includes?a.includes("Files"):a.contains("Files"))&&!po(this.toolsFiles)){await this.processFiles(e.files);return}const i=e.getData(this.MIME_TYPE),r=e.getData("text/plain");let s=e.getData("text/html");if(i)try{this.insertEditorJSData(JSON.parse(i));return}catch{}t&&r.trim()&&s.trim()&&(s="<p>"+(s.trim()?s:r)+"</p>");const l=Object.keys(this.toolsTags).reduce((p,m)=>(p[m.toLowerCase()]=this.toolsTags[m].sanitizationConfig??{},p),{}),d=Object.assign({},l,o.getAllInlineToolsSanitizeConfig(),{br:{}}),u=ea(s,d);!u.trim()||u.trim()===r||!Y.isHTMLString(u)?await this.processText(r):await this.processText(u,!0)}async processText(e,t=!1){const{Caret:o,BlockManager:a}=this.Editor,i=t?this.processHTML(e):this.processPlain(e);if(!i.length)return;if(i.length===1){i[0].isBlock?this.processSingleBlock(i.pop()):this.processInlinePaste(i.pop());return}const r=a.currentBlock&&a.currentBlock.tool.isDefault&&a.currentBlock.isEmpty;i.map(async(s,l)=>this.insertBlock(s,l===0&&r)),a.currentBlock&&o.setToBlock(a.currentBlock,o.positions.END)}setCallback(){this.listeners.on(this.Editor.UI.nodes.holder,"paste",this.handlePasteEvent)}unsetCallback(){this.listeners.off(this.Editor.UI.nodes.holder,"paste",this.handlePasteEvent)}processTools(){const e=this.Editor.Tools.blockTools;Array.from(e.values()).forEach(this.processTool)}collectTagNames(e){return xa(e)?[e]:tn(e)?Object.keys(e):[]}getTagsConfig(e){if(e.pasteConfig===!1)return;const t=e.pasteConfig.tags||[],o=[];t.forEach(a=>{const i=this.collectTagNames(a);o.push(...i),i.forEach(r=>{if(Object.prototype.hasOwnProperty.call(this.toolsTags,r)){Ue(`Paste handler for «${e.name}» Tool on «${r}» tag is skipped because it is already used by «${this.toolsTags[r].tool.name}» Tool.`,"warn");return}const s=tn(a)?a[r]:null;this.toolsTags[r.toUpperCase()]={tool:e,sanitizationConfig:s}})}),this.tagsByTool[e.name]=o.map(a=>a.toUpperCase())}getFilesConfig(e){if(e.pasteConfig===!1)return;const{files:t={}}=e.pasteConfig;let{extensions:o,mimeTypes:a}=t;!o&&!a||(o&&!Array.isArray(o)&&(Ue(`«extensions» property of the onDrop config for «${e.name}» Tool should be an array`),o=[]),a&&!Array.isArray(a)&&(Ue(`«mimeTypes» property of the onDrop config for «${e.name}» Tool should be an array`),a=[]),a&&(a=a.filter(i=>bz(i)?!0:(Ue(`MIME type value «${i}» for the «${e.name}» Tool is not a valid MIME type`,"warn"),!1))),this.toolsFiles[e.name]={extensions:o||[],mimeTypes:a||[]})}getPatternsConfig(e){e.pasteConfig===!1||!e.pasteConfig.patterns||po(e.pasteConfig.patterns)||Object.entries(e.pasteConfig.patterns).forEach(([t,o])=>{o instanceof RegExp||Ue(`Pattern ${o} for «${e.name}» Tool is skipped because it should be a Regexp instance.`,"warn"),this.toolsPatterns.push({key:t,pattern:o,tool:e})})}isNativeBehaviour(e){return Y.isNativeInput(e)}async processFiles(e){const{BlockManager:t}=this.Editor;let o;o=await Promise.all(Array.from(e).map(i=>this.processFile(i))),o=o.filter(i=>!!i);const a=t.currentBlock.tool.isDefault&&t.currentBlock.isEmpty;o.forEach((i,r)=>{t.paste(i.type,i.event,r===0&&a)})}async processFile(e){const t=vz(e),o=Object.entries(this.toolsFiles).find(([i,{mimeTypes:r,extensions:s}])=>{const[l,d]=e.type.split("/"),u=s.find(m=>m.toLowerCase()===t.toLowerCase()),p=r.find(m=>{const[h,f]=m.split("/");return h===l&&(f===d||f==="*")});return!!u||!!p});if(!o)return;const[a]=o;return{event:this.composePasteEvent("file",{file:e}),type:a}}processHTML(e){const{Tools:t}=this.Editor,o=Y.make("DIV");return o.innerHTML=e,this.getNodes(o).map(a=>{let i,r=t.defaultTool,s=!1;switch(a.nodeType){case Node.DOCUMENT_FRAGMENT_NODE:i=Y.make("div"),i.appendChild(a);break;case Node.ELEMENT_NODE:i=a,s=!0,this.toolsTags[i.tagName]&&(r=this.toolsTags[i.tagName].tool);break}const{tags:l}=r.pasteConfig||{tags:[]},d=l.reduce((m,h)=>(this.collectTagNames(h).forEach(f=>{const g=tn(h)?h[f]:null;m[f.toLowerCase()]=g||{}}),m),{}),u=Object.assign({},d,r.baseSanitizeConfig);if(i.tagName.toLowerCase()==="table"){const m=ea(i.outerHTML,u);i=Y.make("div",void 0,{innerHTML:m}).firstChild}else i.innerHTML=ea(i.innerHTML,u);const p=this.composePasteEvent("tag",{data:i});return{content:i,isBlock:s,tool:r.name,event:p}}).filter(a=>{const i=Y.isEmpty(a.content),r=Y.isSingleTag(a.content);return!i||r})}processPlain(e){const{defaultBlock:t}=this.config;if(!e)return[];const o=t;return e.split(/\r?\n/).filter(a=>a.trim()).map(a=>{const i=Y.make("div");i.textContent=a;const r=this.composePasteEvent("tag",{data:i});return{content:i,tool:o,isBlock:!1,event:r}})}async processSingleBlock(e){const{Caret:t,BlockManager:o}=this.Editor,{currentBlock:a}=o;if(!a||e.tool!==a.name||!Y.containsOnlyInlineElements(e.content.innerHTML)){this.insertBlock(e,a?.tool.isDefault&&a.isEmpty);return}t.insertContentAtCaretPosition(e.content.innerHTML)}async processInlinePaste(e){const{BlockManager:t,Caret:o}=this.Editor,{content:a}=e;if(t.currentBlock&&t.currentBlock.tool.isDefault&&a.textContent.length<Mx.PATTERN_PROCESSING_MAX_LENGTH){const i=await this.processPattern(a.textContent);if(i){const r=t.currentBlock&&t.currentBlock.tool.isDefault&&t.currentBlock.isEmpty,s=t.paste(i.tool,i.event,r);o.setToBlock(s,o.positions.END);return}}if(t.currentBlock&&t.currentBlock.currentInput){const i=t.currentBlock.tool.baseSanitizeConfig;document.execCommand("insertHTML",!1,ea(a.innerHTML,i))}else this.insertBlock(e)}async processPattern(e){const t=this.toolsPatterns.find(o=>{const a=o.pattern.exec(e);return a?e===a.shift():!1});return t?{event:this.composePasteEvent("pattern",{key:t.key,data:e}),tool:t.tool.name}:void 0}insertBlock(e,t=!1){const{BlockManager:o,Caret:a}=this.Editor,{currentBlock:i}=o;let r;if(t&&i&&i.isEmpty){r=o.paste(e.tool,e.event,!0),a.setToBlock(r,a.positions.END);return}r=o.paste(e.tool,e.event),a.setToBlock(r,a.positions.END)}insertEditorJSData(e){const{BlockManager:t,Caret:o,Tools:a}=this.Editor;im(e,i=>a.blockTools.get(i).sanitizeConfig).forEach(({tool:i,data:r},s)=>{let l=!1;s===0&&(l=t.currentBlock&&t.currentBlock.tool.isDefault&&t.currentBlock.isEmpty);const d=t.insert({tool:i,data:r,replace:l});o.setToBlock(d,o.positions.END)})}processElementNode(e,t,o){const a=Object.keys(this.toolsTags),i=e,{tool:r}=this.toolsTags[i.tagName]||{},s=this.tagsByTool[r?.name]||[],l=a.includes(i.tagName),d=Y.blockElements.includes(i.tagName.toLowerCase()),u=Array.from(i.children).some(({tagName:m})=>a.includes(m)&&!s.includes(m)),p=Array.from(i.children).some(({tagName:m})=>Y.blockElements.includes(m.toLowerCase()));if(!d&&!l&&!u)return o.appendChild(i),[...t,o];if(l&&!u||d&&!p&&!u)return[...t,o,i]}getNodes(e){const t=Array.from(e.childNodes);let o;const a=(i,r)=>{if(Y.isEmpty(r)&&!Y.isSingleTag(r))return i;const s=i[i.length-1];let l=new DocumentFragment;switch(s&&Y.isFragment(s)&&(l=i.pop()),r.nodeType){case Node.ELEMENT_NODE:if(o=this.processElementNode(r,i,l),o)return o;break;case Node.TEXT_NODE:return l.appendChild(r),[...i,l];default:return[...i,l]}return[...i,...Array.from(r.childNodes).reduce(a,[])]};return t.reduce(a,[])}composePasteEvent(e,t){return new CustomEvent(e,{detail:t})}};g8.PATTERN_PROCESSING_MAX_LENGTH=450;let TU=g8;class AU extends Pe{constructor(){super(...arguments),this.toolsDontSupportReadOnly=[],this.readOnlyEnabled=!1}get isEnabled(){return this.readOnlyEnabled}async prepare(){const{Tools:e}=this.Editor,{blockTools:t}=e,o=[];Array.from(t.entries()).forEach(([a,i])=>{i.isReadOnlySupported||o.push(a)}),this.toolsDontSupportReadOnly=o,this.config.readOnly&&o.length>0&&this.throwCriticalError(),this.toggle(this.config.readOnly,!0)}async toggle(e=!this.readOnlyEnabled,t=!1){e&&this.toolsDontSupportReadOnly.length>0&&this.throwCriticalError();const o=this.readOnlyEnabled;this.readOnlyEnabled=e;for(const i in this.Editor)this.Editor[i].toggleReadOnly&&this.Editor[i].toggleReadOnly(e);if(o===e)return this.readOnlyEnabled;if(t)return this.readOnlyEnabled;this.Editor.ModificationsObserver.disable();const a=await this.Editor.Saver.save();return await this.Editor.BlockManager.clear(),await this.Editor.Renderer.render(a.blocks),this.Editor.ModificationsObserver.enable(),this.readOnlyEnabled}throwCriticalError(){throw new mv(`To enable read-only mode all connected tools should support it. Tools ${this.toolsDontSupportReadOnly.join(", ")} don't support read-only mode.`)}}let OU=class vp extends Pe{constructor(){super(...arguments),this.isRectSelectionActivated=!1,this.SCROLL_SPEED=3,this.HEIGHT_OF_SCROLL_ZONE=40,this.BOTTOM_SCROLL_ZONE=1,this.TOP_SCROLL_ZONE=2,this.MAIN_MOUSE_BUTTON=0,this.mousedown=!1,this.isScrolling=!1,this.inScrollZone=null,this.startX=0,this.startY=0,this.mouseX=0,this.mouseY=0,this.stackOfSelected=[],this.listenerIds=[]}static get CSS(){return{overlay:"codex-editor-overlay",overlayContainer:"codex-editor-overlay__container",rect:"codex-editor-overlay__rectangle",topScrollZone:"codex-editor-overlay__scroll-zone--top",bottomScrollZone:"codex-editor-overlay__scroll-zone--bottom"}}prepare(){this.enableModuleBindings()}startSelection(e,t){const o=document.elementFromPoint(e-window.pageXOffset,t-window.pageYOffset);o.closest(`.${this.Editor.Toolbar.CSS.toolbar}`)||(this.Editor.BlockSelection.allBlocksSelected=!1,this.clearSelection(),this.stackOfSelected=[]);const a=[`.${Ea.CSS.content}`,`.${this.Editor.Toolbar.CSS.toolbar}`,`.${this.Editor.InlineToolbar.CSS.inlineToolbar}`],i=o.closest("."+this.Editor.UI.CSS.editorWrapper),r=a.some(s=>!!o.closest(s));!i||r||(this.mousedown=!0,this.startX=e,this.startY=t)}endSelection(){this.mousedown=!1,this.startX=0,this.startY=0,this.overlayRectangle.style.display="none"}isRectActivated(){return this.isRectSelectionActivated}clearSelection(){this.isRectSelectionActivated=!1}enableModuleBindings(){const{container:e}=this.genHTML();this.listeners.on(e,"mousedown",t=>{this.processMouseDown(t)},!1),this.listeners.on(document.body,"mousemove",J1(t=>{this.processMouseMove(t)},10),{passive:!0}),this.listeners.on(document.body,"mouseleave",()=>{this.processMouseLeave()}),this.listeners.on(window,"scroll",J1(t=>{this.processScroll(t)},10),{passive:!0}),this.listeners.on(document.body,"mouseup",()=>{this.processMouseUp()},!1)}processMouseDown(e){e.button===this.MAIN_MOUSE_BUTTON&&(e.target.closest(Y.allInputsSelector)!==null||this.startSelection(e.pageX,e.pageY))}processMouseMove(e){this.changingRectangle(e),this.scrollByZones(e.clientY)}processMouseLeave(){this.clearSelection(),this.endSelection()}processScroll(e){this.changingRectangle(e)}processMouseUp(){this.clearSelection(),this.endSelection()}scrollByZones(e){if(this.inScrollZone=null,e<=this.HEIGHT_OF_SCROLL_ZONE&&(this.inScrollZone=this.TOP_SCROLL_ZONE),document.documentElement.clientHeight-e<=this.HEIGHT_OF_SCROLL_ZONE&&(this.inScrollZone=this.BOTTOM_SCROLL_ZONE),!this.inScrollZone){this.isScrolling=!1;return}this.isScrolling||(this.scrollVertical(this.inScrollZone===this.TOP_SCROLL_ZONE?-this.SCROLL_SPEED:this.SCROLL_SPEED),this.isScrolling=!0)}genHTML(){const{UI:e}=this.Editor,t=e.nodes.holder.querySelector("."+e.CSS.editorWrapper),o=Y.make("div",vp.CSS.overlay,{}),a=Y.make("div",vp.CSS.overlayContainer,{}),i=Y.make("div",vp.CSS.rect,{});return a.appendChild(i),o.appendChild(a),t.appendChild(o),this.overlayRectangle=i,{container:t,overlay:o}}scrollVertical(e){if(!(this.inScrollZone&&this.mousedown))return;const t=window.pageYOffset;window.scrollBy(0,e),this.mouseY+=window.pageYOffset-t,setTimeout(()=>{this.scrollVertical(e)},0)}changingRectangle(e){if(!this.mousedown)return;e.pageY!==void 0&&(this.mouseX=e.pageX,this.mouseY=e.pageY);const{rightPos:t,leftPos:o,index:a}=this.genInfoForMouseSelection(),i=this.startX>t&&this.mouseX>t,r=this.startX<o&&this.mouseX<o;this.rectCrossesBlocks=!(i||r),this.isRectSelectionActivated||(this.rectCrossesBlocks=!1,this.isRectSelectionActivated=!0,this.shrinkRectangleToPoint(),this.overlayRectangle.style.display="block"),this.updateRectangleSize(),this.Editor.Toolbar.close(),a!==void 0&&(this.trySelectNextBlock(a),this.inverseSelection(),_e.get().removeAllRanges())}shrinkRectangleToPoint(){this.overlayRectangle.style.left=`${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.top=`${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.bottom=`calc(100% - ${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.right=`calc(100% - ${this.startX-window.pageXOffset}px`}inverseSelection(){const e=this.Editor.BlockManager.getBlockByIndex(this.stackOfSelected[0]).selected;if(this.rectCrossesBlocks&&!e)for(const t of this.stackOfSelected)this.Editor.BlockSelection.selectBlockByIndex(t);if(!this.rectCrossesBlocks&&e)for(const t of this.stackOfSelected)this.Editor.BlockSelection.unSelectBlockByIndex(t)}updateRectangleSize(){this.mouseY>=this.startY?(this.overlayRectangle.style.top=`${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.bottom=`calc(100% - ${this.mouseY-window.pageYOffset}px`):(this.overlayRectangle.style.bottom=`calc(100% - ${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.top=`${this.mouseY-window.pageYOffset}px`),this.mouseX>=this.startX?(this.overlayRectangle.style.left=`${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.right=`calc(100% - ${this.mouseX-window.pageXOffset}px`):(this.overlayRectangle.style.right=`calc(100% - ${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.left=`${this.mouseX-window.pageXOffset}px`)}genInfoForMouseSelection(){const e=document.body.offsetWidth/2,t=this.mouseY-window.pageYOffset,o=document.elementFromPoint(e,t),a=this.Editor.BlockManager.getBlockByChildNode(o);let i;a!==void 0&&(i=this.Editor.BlockManager.blocks.findIndex(u=>u.holder===a.holder));const r=this.Editor.BlockManager.lastBlock.holder.querySelector("."+Ea.CSS.content),s=Number.parseInt(window.getComputedStyle(r).width,10)/2,l=e-s,d=e+s;return{index:i,leftPos:l,rightPos:d}}addBlockInSelection(e){this.rectCrossesBlocks&&this.Editor.BlockSelection.selectBlockByIndex(e),this.stackOfSelected.push(e)}trySelectNextBlock(e){const t=this.stackOfSelected[this.stackOfSelected.length-1]===e,o=this.stackOfSelected.length,a=1,i=-1,r=0;if(t)return;const s=this.stackOfSelected[o-1]-this.stackOfSelected[o-2]>0;let l=r;o>1&&(l=s?a:i);const d=e>this.stackOfSelected[o-1]&&l===a,u=e<this.stackOfSelected[o-1]&&l===i,p=!(d||u||l===r);if(!p&&(e>this.stackOfSelected[o-1]||this.stackOfSelected[o-1]===void 0)){let f=this.stackOfSelected[o-1]+1||e;for(f;f<=e;f++)this.addBlockInSelection(f);return}if(!p&&e<this.stackOfSelected[o-1]){for(let f=this.stackOfSelected[o-1]-1;f>=e;f--)this.addBlockInSelection(f);return}if(!p)return;let m=o-1,h;for(e>this.stackOfSelected[o-1]?h=()=>e>this.stackOfSelected[m]:h=()=>e<this.stackOfSelected[m];h();)this.rectCrossesBlocks&&this.Editor.BlockSelection.unSelectBlockByIndex(this.stackOfSelected[m]),this.stackOfSelected.pop(),m--}};class LU extends Pe{async render(e){return new Promise(t=>{const{Tools:o,BlockManager:a}=this.Editor;if(e.length===0)a.insert();else{const i=e.map(({type:r,data:s,tunes:l,id:d})=>{o.available.has(r)===!1&&(uo(`Tool «${r}» is not found. Check 'tools' property at the Editor.js config.`,"warn"),s=this.composeStubDataForTool(r,s,d),r=o.stubTool);let u;try{u=a.composeBlock({id:d,tool:r,data:s,tunes:l})}catch(p){Ue(`Block «${r}» skipped because of plugins error`,"error",{data:s,error:p}),s=this.composeStubDataForTool(r,s,d),r=o.stubTool,u=a.composeBlock({id:d,tool:r,data:s,tunes:l})}return u});a.insertMany(i)}window.requestIdleCallback(()=>{t()},{timeout:2e3})})}composeStubDataForTool(e,t,o){const{Tools:a}=this.Editor;let i=e;if(a.unavailable.has(e)){const r=a.unavailable.get(e).toolbox;r!==void 0&&r[0].title!==void 0&&(i=r[0].title)}return{savedData:{id:o,type:e,data:t},title:i}}}class NU extends Pe{async save(){const{BlockManager:e,Tools:t}=this.Editor,o=e.blocks,a=[];try{o.forEach(s=>{a.push(this.getSavedData(s))});const i=await Promise.all(a),r=await im(i,s=>t.blockTools.get(s).sanitizeConfig);return this.makeOutput(r)}catch(i){uo("Saving failed due to the Error %o","error",i)}}async getSavedData(e){const t=await e.save(),o=t&&await e.validate(t.data);return{...t,isValid:o}}makeOutput(e){const t=[];return e.forEach(({id:o,tool:a,data:i,tunes:r,isValid:s})=>{if(!s){Ue(`Block «${a}» skipped because saved data is invalid`);return}if(a===this.Editor.Tools.stubTool){t.push(i);return}const l={id:o,type:a,data:i,...!po(r)&&{tunes:r}};t.push(l)}),{time:+new Date,blocks:t,version:"2.31.3"}}}(function(){try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode(".ce-paragraph{line-height:1.6em;outline:none}.ce-block:only-of-type .ce-paragraph[data-placeholder-active]:empty:before,.ce-block:only-of-type .ce-paragraph[data-placeholder-active][data-empty=true]:before{content:attr(data-placeholder-active)}.ce-paragraph p:first-of-type{margin-top:0}.ce-paragraph p:last-of-type{margin-bottom:0}")),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const PU='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 9V7.2C8 7.08954 8.08954 7 8.2 7L12 7M16 9V7.2C16 7.08954 15.9105 7 15.8 7L12 7M12 7L12 17M12 17H10M12 17H14"/></svg>';function RU(n){const e=document.createElement("div");e.innerHTML=n.trim();const t=document.createDocumentFragment();return t.append(...Array.from(e.childNodes)),t}let VU=class Bx{static get DEFAULT_PLACEHOLDER(){return""}constructor({data:e,config:t,api:o,readOnly:a}){this.api=o,this.readOnly=a,this._CSS={block:this.api.styles.block,wrapper:"ce-paragraph"},this.readOnly||(this.onKeyUp=this.onKeyUp.bind(this)),this._placeholder=t.placeholder?t.placeholder:Bx.DEFAULT_PLACEHOLDER,this._data=e??{},this._element=null,this._preserveBlank=t.preserveBlank??!1}onKeyUp(e){if(e.code!=="Backspace"&&e.code!=="Delete"||!this._element)return;const{textContent:t}=this._element;t===""&&(this._element.innerHTML="")}drawView(){const e=document.createElement("DIV");return e.classList.add(this._CSS.wrapper,this._CSS.block),e.contentEditable="false",e.dataset.placeholderActive=this.api.i18n.t(this._placeholder),this._data.text&&(e.innerHTML=this._data.text),this.readOnly||(e.contentEditable="true",e.addEventListener("keyup",this.onKeyUp)),e}render(){return this._element=this.drawView(),this._element}merge(e){if(!this._element)return;this._data.text+=e.text;const t=RU(e.text);this._element.appendChild(t),this._element.normalize()}validate(e){return!(e.text.trim()===""&&!this._preserveBlank)}save(e){return{text:e.innerHTML}}onPaste(e){const t={text:e.detail.data.innerHTML};this._data=t,window.requestAnimationFrame(()=>{this._element&&(this._element.innerHTML=this._data.text||"")})}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{text:{br:!0}}}static get isReadOnlySupported(){return!0}static get pasteConfig(){return{tags:["P"]}}static get toolbox(){return{icon:PU,title:"Text"}}},sh=class{constructor(){this.commandName="bold"}static get sanitize(){return{b:{}}}render(){return{icon:u$,name:"bold",onActivate:()=>{document.execCommand(this.commandName)},isActive:()=>document.queryCommandState(this.commandName)}}get shortcut(){return"CMD+B"}};sh.isInline=!0,sh.title="Bold";let lh=class{constructor(){this.commandName="italic",this.CSS={button:"ce-inline-tool",buttonActive:"ce-inline-tool--active",buttonModifier:"ce-inline-tool--italic"},this.nodes={button:null}}static get sanitize(){return{i:{}}}render(){return this.nodes.button=document.createElement("button"),this.nodes.button.type="button",this.nodes.button.classList.add(this.CSS.button,this.CSS.buttonModifier),this.nodes.button.innerHTML=b$,this.nodes.button}surround(){document.execCommand(this.commandName)}checkState(){const e=document.queryCommandState(this.commandName);return this.nodes.button.classList.toggle(this.CSS.buttonActive,e),e}get shortcut(){return"CMD+I"}};lh.isInline=!0,lh.title="Italic";let ch=class{constructor({api:e}){this.commandLink="createLink",this.commandUnlink="unlink",this.ENTER_KEY=13,this.CSS={button:"ce-inline-tool",buttonActive:"ce-inline-tool--active",buttonModifier:"ce-inline-tool--link",buttonUnlink:"ce-inline-tool--unlink",input:"ce-inline-tool-input",inputShowed:"ce-inline-tool-input--showed"},this.nodes={button:null,input:null},this.inputOpened=!1,this.toolbar=e.toolbar,this.inlineToolbar=e.inlineToolbar,this.notifier=e.notifier,this.i18n=e.i18n,this.selection=new _e}static get sanitize(){return{a:{href:!0,target:"_blank",rel:"nofollow"}}}render(){return this.nodes.button=document.createElement("button"),this.nodes.button.type="button",this.nodes.button.classList.add(this.CSS.button,this.CSS.buttonModifier),this.nodes.button.innerHTML=Dv,this.nodes.button}renderActions(){return this.nodes.input=document.createElement("input"),this.nodes.input.placeholder=this.i18n.t("Add a link"),this.nodes.input.enterKeyHint="done",this.nodes.input.classList.add(this.CSS.input),this.nodes.input.addEventListener("keydown",e=>{e.keyCode===this.ENTER_KEY&&this.enterPressed(e)}),this.nodes.input}surround(e){if(e){this.inputOpened?(this.selection.restore(),this.selection.removeFakeBackground()):(this.selection.setFakeBackground(),this.selection.save());const t=this.selection.findParentTag("A");if(t){this.inputOpened?(this.closeActions(!1),this.checkState()):(this.selection.expandToTag(t),this.unlink(),this.closeActions(),this.checkState(),this.toolbar.close());return}}this.toggleActions()}checkState(){const e=this.selection.findParentTag("A");if(e){this.nodes.button.innerHTML=w$,this.nodes.button.classList.add(this.CSS.buttonUnlink),this.nodes.button.classList.add(this.CSS.buttonActive),this.openActions();const t=e.getAttribute("href");this.nodes.input.value=t!=="null"?t:"",this.selection.save()}else this.nodes.button.innerHTML=Dv,this.nodes.button.classList.remove(this.CSS.buttonUnlink),this.nodes.button.classList.remove(this.CSS.buttonActive);return!!e}clear(){this.closeActions()}get shortcut(){return"CMD+K"}toggleActions(){this.inputOpened?this.closeActions(!1):this.openActions(!0)}openActions(e=!1){this.nodes.input.classList.add(this.CSS.inputShowed),e&&this.nodes.input.focus(),this.inputOpened=!0}closeActions(e=!0){if(this.selection.isFakeBackgroundEnabled){const t=new _e;t.save(),this.selection.restore(),this.selection.removeFakeBackground(),t.restore()}this.nodes.input.classList.remove(this.CSS.inputShowed),this.nodes.input.value="",e&&this.selection.clearSaved(),this.inputOpened=!1}enterPressed(e){let t=this.nodes.input.value||"";if(!t.trim()){this.selection.restore(),this.unlink(),e.preventDefault(),this.closeActions();return}if(!this.validateURL(t)){this.notifier.show({message:"Pasted link is not valid.",style:"error"}),Ue("Incorrect Link pasted","warn",t);return}t=this.prepareLink(t),this.selection.restore(),this.selection.removeFakeBackground(),this.insertLink(t),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.selection.collapseToEnd(),this.inlineToolbar.close()}validateURL(e){return!/\s/.test(e)}prepareLink(e){return e=e.trim(),e=this.addProtocol(e),e}addProtocol(e){if(/^(\w+):(\/\/)?/.test(e))return e;const t=/^\/[^/\s]/.test(e),o=e.substring(0,1)==="#",a=/^\/\/[^/\s]/.test(e);return!t&&!o&&!a&&(e="http://"+e),e}insertLink(e){const t=this.selection.findParentTag("A");t&&this.selection.expandToTag(t),document.execCommand(this.commandLink,!1,e)}unlink(){document.execCommand(this.commandUnlink)}};ch.isInline=!0,ch.title="Link";class v8{constructor({api:e}){this.i18nAPI=e.i18n,this.blocksAPI=e.blocks,this.selectionAPI=e.selection,this.toolsAPI=e.tools,this.caretAPI=e.caret}async render(){const e=_e.get(),t=this.blocksAPI.getBlockByElement(e.anchorNode);if(t===void 0)return[];const o=this.toolsAPI.getBlockTools(),a=await bv(t,o);if(a.length===0)return[];const i=a.reduce((d,u)=>{var p;return(p=u.toolbox)==null||p.forEach(m=>{d.push({icon:m.icon,title:jn.t(Un.toolNames,m.title),name:u.name,closeOnActivate:!0,onActivate:async()=>{const h=await this.blocksAPI.convert(t.id,u.name,m.data);this.caretAPI.setToBlock(h,"end")}})}),d},[]),r=await t.getActiveToolboxEntry(),s=r!==void 0?r.icon:Fv,l=!ps();return{icon:s,name:"convert-to",hint:{title:this.i18nAPI.t("Convert to")},children:{searchable:l,items:i,onOpen:()=>{l&&(this.selectionAPI.setFakeBackground(),this.selectionAPI.save())},onClose:()=>{l&&(this.selectionAPI.restore(),this.selectionAPI.removeFakeBackground())}}}}}v8.isInline=!0;let b8=class{constructor({data:e,api:t}){this.CSS={wrapper:"ce-stub",info:"ce-stub__info",title:"ce-stub__title",subtitle:"ce-stub__subtitle"},this.api=t,this.title=e.title||this.api.i18n.t("Error"),this.subtitle=this.api.i18n.t("The block can not be displayed correctly."),this.savedData=e.savedData,this.wrapper=this.make()}render(){return this.wrapper}save(){return this.savedData}make(){const e=Y.make("div",this.CSS.wrapper),t=j$,o=Y.make("div",this.CSS.info),a=Y.make("div",this.CSS.title,{textContent:this.title}),i=Y.make("div",this.CSS.subtitle,{textContent:this.subtitle});return e.innerHTML=t,o.appendChild(a),o.appendChild(i),e.appendChild(o),e}};b8.isReadOnlySupported=!0;class HU extends bm{constructor(){super(...arguments),this.type=lr.Inline}get title(){return this.constructable[O0.Title]}create(){return new this.constructable({api:this.api,config:this.settings})}get isReadOnlySupported(){return this.constructable[O0.IsReadOnlySupported]??!1}}class zU extends bm{constructor(){super(...arguments),this.type=lr.Tune}create(e,t){return new this.constructable({api:this.api,config:this.settings,block:t,data:e})}}let na=class fl extends Map{get blockTools(){const e=Array.from(this.entries()).filter(([,t])=>t.isBlock());return new fl(e)}get inlineTools(){const e=Array.from(this.entries()).filter(([,t])=>t.isInline());return new fl(e)}get blockTunes(){const e=Array.from(this.entries()).filter(([,t])=>t.isTune());return new fl(e)}get internalTools(){const e=Array.from(this.entries()).filter(([,t])=>t.isInternal);return new fl(e)}get externalTools(){const e=Array.from(this.entries()).filter(([,t])=>!t.isInternal);return new fl(e)}};var $U=Object.defineProperty,WU=Object.getOwnPropertyDescriptor,y8=(n,e,t,o)=>{for(var a=WU(e,t),i=n.length-1,r;i>=0;i--)(r=n[i])&&(a=r(e,t,a)||a);return a&&$U(e,t,a),a};let dh=class extends bm{constructor(){super(...arguments),this.type=lr.Block,this.inlineTools=new na,this.tunes=new na}create(e,t,o){return new this.constructable({data:e,block:t,readOnly:o,api:this.api,config:this.settings})}get isReadOnlySupported(){return this.constructable[fs.IsReadOnlySupported]===!0}get isLineBreaksEnabled(){return this.constructable[fs.IsEnabledLineBreaks]}get toolbox(){const e=this.constructable[fs.Toolbox],t=this.config[A0.Toolbox];if(!po(e)&&t!==!1)return t?Array.isArray(e)?Array.isArray(t)?t.map((o,a)=>{const i=e[a];return i?{...i,...o}:o}):[t]:Array.isArray(t)?t:[{...e,...t}]:Array.isArray(e)?e:[e]}get conversionConfig(){return this.constructable[fs.ConversionConfig]}get enabledInlineTools(){return this.config[A0.EnabledInlineTools]||!1}get enabledBlockTunes(){return this.config[A0.EnabledBlockTunes]}get pasteConfig(){return this.constructable[fs.PasteConfig]??{}}get sanitizeConfig(){const e=super.sanitizeConfig,t=this.baseSanitizeConfig;if(po(e))return t;const o={};for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)){const i=e[a];tn(i)?o[a]=Object.assign({},t,i):o[a]=i}return o}get baseSanitizeConfig(){const e={};return Array.from(this.inlineTools.values()).forEach(t=>Object.assign(e,t.sanitizeConfig)),Array.from(this.tunes.values()).forEach(t=>Object.assign(e,t.sanitizeConfig)),e}};y8([us],dh.prototype,"sanitizeConfig"),y8([us],dh.prototype,"baseSanitizeConfig");class UU{constructor(e,t,o){this.api=o,this.config=e,this.editorConfig=t}get(e){const{class:t,isInternal:o=!1,...a}=this.config[e],i=this.getConstructor(t),r=t[vm.IsTune];return new i({name:e,constructable:t,config:a,api:this.api.getMethodsForTool(e,r),isDefault:e===this.editorConfig.defaultBlock,defaultPlaceholder:this.editorConfig.placeholder,isInternal:o})}getConstructor(e){switch(!0){case e[O0.IsInline]:return HU;case e[vm.IsTune]:return zU;default:return dh}}}class C8{constructor({api:e}){this.CSS={animation:"wobble"},this.api=e}render(){return{icon:p$,title:this.api.i18n.t("Move down"),onActivate:()=>this.handleClick(),name:"move-down"}}handleClick(){const e=this.api.blocks.getCurrentBlockIndex(),t=this.api.blocks.getBlockByIndex(e+1);if(!t)throw new Error("Unable to move Block down since it is already the last");const o=t.holder,a=o.getBoundingClientRect();let i=Math.abs(window.innerHeight-o.offsetHeight);a.top<window.innerHeight&&(i=window.scrollY+o.offsetHeight),window.scrollTo(0,i),this.api.blocks.move(e+1),this.api.toolbar.toggleBlockSettings(!0)}}C8.isTune=!0;class k8{constructor({api:e}){this.api=e}render(){return{icon:g$,title:this.api.i18n.t("Delete"),name:"delete",confirmation:{title:this.api.i18n.t("Click to delete"),onActivate:()=>this.handleClick()}}}handleClick(){this.api.blocks.delete()}}k8.isTune=!0;class w8{constructor({api:e}){this.CSS={animation:"wobble"},this.api=e}render(){return{icon:f$,title:this.api.i18n.t("Move up"),onActivate:()=>this.handleClick(),name:"move-up"}}handleClick(){const e=this.api.blocks.getCurrentBlockIndex(),t=this.api.blocks.getBlockByIndex(e),o=this.api.blocks.getBlockByIndex(e-1);if(e===0||!t||!o)throw new Error("Unable to move Block up since it is already the first");const a=t.holder,i=o.holder,r=a.getBoundingClientRect(),s=i.getBoundingClientRect();let l;s.top>0?l=Math.abs(r.top)-Math.abs(s.top):l=Math.abs(r.top)+s.height,window.scrollBy(0,-1*l),this.api.blocks.move(e-1),this.api.toolbar.toggleBlockSettings(!0)}}w8.isTune=!0;var qU=Object.defineProperty,KU=Object.getOwnPropertyDescriptor,ZU=(n,e,t,o)=>{for(var a=KU(e,t),i=n.length-1,r;i>=0;i--)(r=n[i])&&(a=r(e,t,a)||a);return a&&qU(e,t,a),a};class j8 extends Pe{constructor(){super(...arguments),this.stubTool="stub",this.toolsAvailable=new na,this.toolsUnavailable=new na}get available(){return this.toolsAvailable}get unavailable(){return this.toolsUnavailable}get inlineTools(){return this.available.inlineTools}get blockTools(){return this.available.blockTools}get blockTunes(){return this.available.blockTunes}get defaultTool(){return this.blockTools.get(this.config.defaultBlock)}get internal(){return this.available.internalTools}async prepare(){if(this.validateTools(),this.config.tools=Q1({},this.internalTools,this.config.tools),!Object.prototype.hasOwnProperty.call(this.config,"tools")||Object.keys(this.config.tools).length===0)throw Error("Can't start without tools");const e=this.prepareConfig();this.factory=new UU(e,this.config,this.Editor.API);const t=this.getListOfPrepareFunctions(e);if(t.length===0)return Promise.resolve();await gz(t,o=>{this.toolPrepareMethodSuccess(o)},o=>{this.toolPrepareMethodFallback(o)}),this.prepareBlockTools()}getAllInlineToolsSanitizeConfig(){const e={};return Array.from(this.inlineTools.values()).forEach(t=>{Object.assign(e,t.sanitizeConfig)}),e}destroy(){Object.values(this.available).forEach(async e=>{bt(e.reset)&&await e.reset()})}get internalTools(){return{convertTo:{class:v8,isInternal:!0},link:{class:ch,isInternal:!0},bold:{class:sh,isInternal:!0},italic:{class:lh,isInternal:!0},paragraph:{class:VU,inlineToolbar:!0,isInternal:!0},stub:{class:b8,isInternal:!0},moveUp:{class:w8,isInternal:!0},delete:{class:k8,isInternal:!0},moveDown:{class:C8,isInternal:!0}}}toolPrepareMethodSuccess(e){const t=this.factory.get(e.toolName);if(t.isInline()){const o=["render"].filter(a=>!t.create()[a]);if(o.length){Ue(`Incorrect Inline Tool: ${t.name}. Some of required methods is not implemented %o`,"warn",o),this.toolsUnavailable.set(t.name,t);return}}this.toolsAvailable.set(t.name,t)}toolPrepareMethodFallback(e){this.toolsUnavailable.set(e.toolName,this.factory.get(e.toolName))}getListOfPrepareFunctions(e){const t=[];return Object.entries(e).forEach(([o,a])=>{t.push({function:bt(a.class.prepare)?a.class.prepare:()=>{},data:{toolName:o,config:a.config}})}),t}prepareBlockTools(){Array.from(this.blockTools.values()).forEach(e=>{this.assignInlineToolsToBlockTool(e),this.assignBlockTunesToBlockTool(e)})}assignInlineToolsToBlockTool(e){if(this.config.inlineToolbar!==!1){if(e.enabledInlineTools===!0){e.inlineTools=new na(Array.isArray(this.config.inlineToolbar)?this.config.inlineToolbar.map(t=>[t,this.inlineTools.get(t)]):Array.from(this.inlineTools.entries()));return}Array.isArray(e.enabledInlineTools)&&(e.inlineTools=new na(["convertTo",...e.enabledInlineTools].map(t=>[t,this.inlineTools.get(t)])))}}assignBlockTunesToBlockTool(e){if(e.enabledBlockTunes!==!1){if(Array.isArray(e.enabledBlockTunes)){const t=new na(e.enabledBlockTunes.map(o=>[o,this.blockTunes.get(o)]));e.tunes=new na([...t,...this.blockTunes.internalTools]);return}if(Array.isArray(this.config.tunes)){const t=new na(this.config.tunes.map(o=>[o,this.blockTunes.get(o)]));e.tunes=new na([...t,...this.blockTunes.internalTools]);return}e.tunes=this.blockTunes.internalTools}}validateTools(){for(const e in this.config.tools)if(Object.prototype.hasOwnProperty.call(this.config.tools,e)){if(e in this.internalTools)return;const t=this.config.tools[e];if(!bt(t)&&!bt(t.class))throw Error(`Tool «${e}» must be a constructor function or an object with function in the «class» property`)}}prepareConfig(){const e={};for(const t in this.config.tools)tn(this.config.tools[t])?e[t]=this.config.tools[t]:e[t]={class:this.config.tools[t]};return e}}ZU([us],j8.prototype,"getAllInlineToolsSanitizeConfig");const YU=`:root{--selectionColor: #e1f2ff;--inlineSelectionColor: #d4ecff;--bg-light: #eff2f5;--grayText: #707684;--color-dark: #1D202B;--color-active-icon: #388AE5;--color-gray-border: rgba(201, 201, 204, .48);--content-width: 650px;--narrow-mode-right-padding: 50px;--toolbox-buttons-size: 26px;--toolbox-buttons-size--mobile: 36px;--icon-size: 20px;--icon-size--mobile: 28px;--block-padding-vertical: .4em;--color-line-gray: #EFF0F1 }.codex-editor{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;z-index:1}.codex-editor .hide{display:none}.codex-editor__redactor [contenteditable]:empty:after{content:"\\feff"}@media (min-width: 651px){.codex-editor--narrow .codex-editor__redactor{margin-right:50px}}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .codex-editor__redactor{margin-left:50px;margin-right:0}}@media (min-width: 651px){.codex-editor--narrow .ce-toolbar__actions{right:-5px}}.codex-editor-copyable{position:absolute;height:1px;width:1px;top:-400%;opacity:.001}.codex-editor-overlay{position:fixed;top:0;left:0;right:0;bottom:0;z-index:999;pointer-events:none;overflow:hidden}.codex-editor-overlay__container{position:relative;pointer-events:auto;z-index:0}.codex-editor-overlay__rectangle{position:absolute;pointer-events:none;background-color:#2eaadc33;border:1px solid transparent}.codex-editor svg{max-height:100%}.codex-editor path{stroke:currentColor}.codex-editor ::-moz-selection{background-color:#d4ecff}.codex-editor ::selection{background-color:#d4ecff}.codex-editor--toolbox-opened [contentEditable=true][data-placeholder]:focus:before{opacity:0!important}.ce-scroll-locked{overflow:hidden}.ce-scroll-locked--hard{overflow:hidden;top:calc(-1 * var(--window-scroll-offset));position:fixed;width:100%}.ce-toolbar{position:absolute;left:0;right:0;top:0;-webkit-transition:opacity .1s ease;transition:opacity .1s ease;will-change:opacity,top;display:none}.ce-toolbar--opened{display:block}.ce-toolbar__content{max-width:650px;margin:0 auto;position:relative}.ce-toolbar__plus{color:#1d202b;cursor:pointer;width:26px;height:26px;border-radius:7px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-flex-negative:0;flex-shrink:0}@media (max-width: 650px){.ce-toolbar__plus{width:36px;height:36px}}@media (hover: hover){.ce-toolbar__plus:hover{background-color:#eff2f5}}.ce-toolbar__plus--active{background-color:#eff2f5;-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}.ce-toolbar__plus-shortcut{opacity:.6;word-spacing:-2px;margin-top:5px}@media (max-width: 650px){.ce-toolbar__plus{position:absolute;background-color:#fff;border:1px solid #E8E8EB;-webkit-box-shadow:0 3px 15px -3px rgba(13,20,33,.13);box-shadow:0 3px 15px -3px #0d142121;border-radius:6px;z-index:2;position:static}.ce-toolbar__plus--left-oriented:before{left:15px;margin-left:0}.ce-toolbar__plus--right-oriented:before{left:auto;right:15px;margin-left:0}}.ce-toolbar__actions{position:absolute;right:100%;opacity:0;display:-webkit-box;display:-ms-flexbox;display:flex;padding-right:5px}.ce-toolbar__actions--opened{opacity:1}@media (max-width: 650px){.ce-toolbar__actions{right:auto}}.ce-toolbar__settings-btn{color:#1d202b;width:26px;height:26px;border-radius:7px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;margin-left:3px;cursor:pointer;user-select:none}@media (max-width: 650px){.ce-toolbar__settings-btn{width:36px;height:36px}}@media (hover: hover){.ce-toolbar__settings-btn:hover{background-color:#eff2f5}}.ce-toolbar__settings-btn--active{background-color:#eff2f5;-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}@media (min-width: 651px){.ce-toolbar__settings-btn{width:24px}}.ce-toolbar__settings-btn--hidden{display:none}@media (max-width: 650px){.ce-toolbar__settings-btn{position:absolute;background-color:#fff;border:1px solid #E8E8EB;-webkit-box-shadow:0 3px 15px -3px rgba(13,20,33,.13);box-shadow:0 3px 15px -3px #0d142121;border-radius:6px;z-index:2;position:static}.ce-toolbar__settings-btn--left-oriented:before{left:15px;margin-left:0}.ce-toolbar__settings-btn--right-oriented:before{left:auto;right:15px;margin-left:0}}.ce-toolbar__plus svg,.ce-toolbar__settings-btn svg{width:24px;height:24px}@media (min-width: 651px){.codex-editor--narrow .ce-toolbar__plus{left:5px}}@media (min-width: 651px){.codex-editor--narrow .ce-toolbox .ce-popover{right:0;left:auto;left:initial}}.ce-inline-toolbar{--y-offset: 8px;--color-background-icon-active: rgba(56, 138, 229, .1);--color-text-icon-active: #388AE5;--color-text-primary: black;position:absolute;visibility:hidden;-webkit-transition:opacity .25s ease;transition:opacity .25s ease;will-change:opacity,left,top;top:0;left:0;z-index:3;opacity:1;visibility:visible}.ce-inline-toolbar [hidden]{display:none!important}.ce-inline-toolbar__toggler-and-button-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;padding:0 6px}.ce-inline-toolbar__buttons{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-inline-toolbar__dropdown{display:-webkit-box;display:-ms-flexbox;display:flex;padding:6px;margin:0 6px 0 -6px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;cursor:pointer;border-right:1px solid rgba(201,201,204,.48);-webkit-box-sizing:border-box;box-sizing:border-box}@media (hover: hover){.ce-inline-toolbar__dropdown:hover{background:#eff2f5}}.ce-inline-toolbar__dropdown--hidden{display:none}.ce-inline-toolbar__dropdown-content,.ce-inline-toolbar__dropdown-arrow{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-inline-toolbar__dropdown-content svg,.ce-inline-toolbar__dropdown-arrow svg{width:20px;height:20px}.ce-inline-toolbar__shortcut{opacity:.6;word-spacing:-3px;margin-top:3px}.ce-inline-tool{color:var(--color-text-primary);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border:0;border-radius:4px;line-height:normal;height:100%;padding:0;width:28px;background-color:transparent;cursor:pointer}@media (max-width: 650px){.ce-inline-tool{width:36px;height:36px}}@media (hover: hover){.ce-inline-tool:hover{background-color:#f8f8f8}}.ce-inline-tool svg{display:block;width:20px;height:20px}@media (max-width: 650px){.ce-inline-tool svg{width:28px;height:28px}}.ce-inline-tool--link .icon--unlink,.ce-inline-tool--unlink .icon--link{display:none}.ce-inline-tool--unlink .icon--unlink{display:inline-block;margin-bottom:-1px}.ce-inline-tool-input{background:#F8F8F8;border:1px solid rgba(226,226,229,.2);border-radius:6px;padding:4px 8px;font-size:14px;line-height:22px;outline:none;margin:0;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;display:none;font-weight:500;-webkit-appearance:none;font-family:inherit}@media (max-width: 650px){.ce-inline-tool-input{font-size:15px;font-weight:500}}.ce-inline-tool-input::-webkit-input-placeholder{color:#707684}.ce-inline-tool-input::-moz-placeholder{color:#707684}.ce-inline-tool-input:-ms-input-placeholder{color:#707684}.ce-inline-tool-input::-ms-input-placeholder{color:#707684}.ce-inline-tool-input::placeholder{color:#707684}.ce-inline-tool-input--showed{display:block}.ce-inline-tool--active{background:var(--color-background-icon-active);color:var(--color-text-icon-active)}@-webkit-keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.ce-block{-webkit-animation:fade-in .3s ease;animation:fade-in .3s ease;-webkit-animation-fill-mode:none;animation-fill-mode:none;-webkit-animation-fill-mode:initial;animation-fill-mode:initial}.ce-block:first-of-type{margin-top:0}.ce-block--selected .ce-block__content{background:#e1f2ff}.ce-block--selected .ce-block__content [contenteditable]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ce-block--selected .ce-block__content img,.ce-block--selected .ce-block__content .ce-stub{opacity:.55}.ce-block--stretched .ce-block__content{max-width:none}.ce-block__content{position:relative;max-width:650px;margin:0 auto;-webkit-transition:background-color .15s ease;transition:background-color .15s ease}.ce-block--drop-target .ce-block__content:before{content:"";position:absolute;top:100%;left:-20px;margin-top:-1px;height:8px;width:8px;border:solid #388AE5;border-width:1px 1px 0 0;-webkit-transform-origin:right;transform-origin:right;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.ce-block--drop-target .ce-block__content:after{content:"";position:absolute;top:100%;height:1px;width:100%;color:#388ae5;background:repeating-linear-gradient(90deg,#388AE5,#388AE5 1px,#fff 1px,#fff 6px)}.ce-block a{cursor:pointer;-webkit-text-decoration:underline;text-decoration:underline}.ce-block b{font-weight:700}.ce-block i{font-style:italic}@-webkit-keyframes bounceIn{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}20%{-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}60%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes bounceIn{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}20%{-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}60%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@-webkit-keyframes selectionBounce{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}50%{-webkit-transform:scale3d(1.01,1.01,1.01);transform:scale3d(1.01,1.01,1.01)}70%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes selectionBounce{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}50%{-webkit-transform:scale3d(1.01,1.01,1.01);transform:scale3d(1.01,1.01,1.01)}70%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@-webkit-keyframes buttonClicked{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.95,.95,.95);transform:scale3d(.95,.95,.95)}60%{-webkit-transform:scale3d(1.02,1.02,1.02);transform:scale3d(1.02,1.02,1.02)}80%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes buttonClicked{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.95,.95,.95);transform:scale3d(.95,.95,.95)}60%{-webkit-transform:scale3d(1.02,1.02,1.02);transform:scale3d(1.02,1.02,1.02)}80%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}.cdx-block{padding:.4em 0}.cdx-block::-webkit-input-placeholder{line-height:normal!important}.cdx-input{border:1px solid rgba(201,201,204,.48);-webkit-box-shadow:inset 0 1px 2px 0 rgba(35,44,72,.06);box-shadow:inset 0 1px 2px #232c480f;border-radius:3px;padding:10px 12px;outline:none;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.cdx-input[data-placeholder]:before{position:static!important}.cdx-input[data-placeholder]:before{display:inline-block;width:0;white-space:nowrap;pointer-events:none}.cdx-settings-button{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;border-radius:3px;cursor:pointer;border:0;outline:none;background-color:transparent;vertical-align:bottom;color:inherit;margin:0;min-width:26px;min-height:26px}.cdx-settings-button--focused{background:rgba(34,186,255,.08)!important}.cdx-settings-button--focused{-webkit-box-shadow:inset 0 0 0px 1px rgba(7,161,227,.08);box-shadow:inset 0 0 0 1px #07a1e314}.cdx-settings-button--focused-animated{-webkit-animation-name:buttonClicked;animation-name:buttonClicked;-webkit-animation-duration:.25s;animation-duration:.25s}.cdx-settings-button--active{color:#388ae5}.cdx-settings-button svg{width:auto;height:auto}@media (max-width: 650px){.cdx-settings-button svg{width:28px;height:28px}}@media (max-width: 650px){.cdx-settings-button{width:36px;height:36px;border-radius:8px}}@media (hover: hover){.cdx-settings-button:hover{background-color:#eff2f5}}.cdx-loader{position:relative;border:1px solid rgba(201,201,204,.48)}.cdx-loader:before{content:"";position:absolute;left:50%;top:50%;width:18px;height:18px;margin:-11px 0 0 -11px;border:2px solid rgba(201,201,204,.48);border-left-color:#388ae5;border-radius:50%;-webkit-animation:cdxRotation 1.2s infinite linear;animation:cdxRotation 1.2s infinite linear}@-webkit-keyframes cdxRotation{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes cdxRotation{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.cdx-button{padding:13px;border-radius:3px;border:1px solid rgba(201,201,204,.48);font-size:14.9px;background:#fff;-webkit-box-shadow:0 2px 2px 0 rgba(18,30,57,.04);box-shadow:0 2px 2px #121e390a;color:#707684;text-align:center;cursor:pointer}@media (hover: hover){.cdx-button:hover{background:#FBFCFE;-webkit-box-shadow:0 1px 3px 0 rgba(18,30,57,.08);box-shadow:0 1px 3px #121e3914}}.cdx-button svg{height:20px;margin-right:.2em;margin-top:-2px}.ce-stub{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:12px 18px;margin:10px 0;border-radius:10px;background:#eff2f5;border:1px solid #EFF0F1;color:#707684;font-size:14px}.ce-stub svg{width:20px;height:20px}.ce-stub__info{margin-left:14px}.ce-stub__title{font-weight:500;text-transform:capitalize}.codex-editor.codex-editor--rtl{direction:rtl}.codex-editor.codex-editor--rtl .cdx-list{padding-left:0;padding-right:40px}.codex-editor.codex-editor--rtl .ce-toolbar__plus{right:-26px;left:auto}.codex-editor.codex-editor--rtl .ce-toolbar__actions{right:auto;left:-26px}@media (max-width: 650px){.codex-editor.codex-editor--rtl .ce-toolbar__actions{margin-left:0;margin-right:auto;padding-right:0;padding-left:10px}}.codex-editor.codex-editor--rtl .ce-settings{left:5px;right:auto}.codex-editor.codex-editor--rtl .ce-settings:before{right:auto;left:25px}.codex-editor.codex-editor--rtl .ce-settings__button:not(:nth-child(3n+3)){margin-left:3px;margin-right:0}.codex-editor.codex-editor--rtl .ce-conversion-tool__icon{margin-right:0;margin-left:10px}.codex-editor.codex-editor--rtl .ce-inline-toolbar__dropdown{border-right:0px solid transparent;border-left:1px solid rgba(201,201,204,.48);margin:0 -6px 0 6px}.codex-editor.codex-editor--rtl .ce-inline-toolbar__dropdown .icon--toggler-down{margin-left:0;margin-right:4px}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .ce-toolbar__plus{left:0;right:5px}}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .ce-toolbar__actions{left:-5px}}.cdx-search-field{--icon-margin-right: 10px;background:#F8F8F8;border:1px solid rgba(226,226,229,.2);border-radius:6px;padding:2px;display:grid;grid-template-columns:auto auto 1fr;grid-template-rows:auto}.cdx-search-field__icon{width:26px;height:26px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-right:var(--icon-margin-right)}.cdx-search-field__icon svg{width:20px;height:20px;color:#707684}.cdx-search-field__input{font-size:14px;outline:none;font-weight:500;font-family:inherit;border:0;background:transparent;margin:0;padding:0;line-height:22px;min-width:calc(100% - 26px - var(--icon-margin-right))}.cdx-search-field__input::-webkit-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::-moz-placeholder{color:#707684;font-weight:500}.cdx-search-field__input:-ms-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::-ms-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::placeholder{color:#707684;font-weight:500}.ce-popover{--border-radius: 6px;--width: 200px;--max-height: 270px;--padding: 6px;--offset-from-target: 8px;--color-border: #EFF0F1;--color-shadow: rgba(13, 20, 33, .1);--color-background: white;--color-text-primary: black;--color-text-secondary: #707684;--color-border-icon: rgba(201, 201, 204, .48);--color-border-icon-disabled: #EFF0F1;--color-text-icon-active: #388AE5;--color-background-icon-active: rgba(56, 138, 229, .1);--color-background-item-focus: rgba(34, 186, 255, .08);--color-shadow-item-focus: rgba(7, 161, 227, .08);--color-background-item-hover: #F8F8F8;--color-background-item-confirm: #E24A4A;--color-background-item-confirm-hover: #CE4343;--popover-top: calc(100% + var(--offset-from-target));--popover-left: 0;--nested-popover-overlap: 4px;--icon-size: 20px;--item-padding: 3px;--item-height: calc(var(--icon-size) + 2 * var(--item-padding))}.ce-popover__container{min-width:var(--width);width:var(--width);max-height:var(--max-height);border-radius:var(--border-radius);overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-box-shadow:0px 3px 15px -3px var(--color-shadow);box-shadow:0 3px 15px -3px var(--color-shadow);position:absolute;left:var(--popover-left);top:var(--popover-top);background:var(--color-background);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;z-index:4;opacity:0;max-height:0;pointer-events:none;padding:0;border:none}.ce-popover--opened>.ce-popover__container{opacity:1;padding:var(--padding);max-height:var(--max-height);pointer-events:auto;-webkit-animation:panelShowing .1s ease;animation:panelShowing .1s ease;border:1px solid var(--color-border)}@media (max-width: 650px){.ce-popover--opened>.ce-popover__container{-webkit-animation:panelShowingMobile .25s ease;animation:panelShowingMobile .25s ease}}.ce-popover--open-top .ce-popover__container{--popover-top: calc(-1 * (var(--offset-from-target) + var(--popover-height)))}.ce-popover--open-left .ce-popover__container{--popover-left: calc(-1 * var(--width) + 100%)}.ce-popover__items{overflow-y:auto;-ms-scroll-chaining:none;overscroll-behavior:contain}@media (max-width: 650px){.ce-popover__overlay{position:fixed;top:0;bottom:0;left:0;right:0;background:#1D202B;z-index:3;opacity:.5;-webkit-transition:opacity .12s ease-in;transition:opacity .12s ease-in;will-change:opacity;visibility:visible}}.ce-popover__overlay--hidden{display:none}@media (max-width: 650px){.ce-popover .ce-popover__container{--offset: 5px;position:fixed;max-width:none;min-width:calc(100% - var(--offset) * 2);left:var(--offset);right:var(--offset);bottom:calc(var(--offset) + env(safe-area-inset-bottom));top:auto;border-radius:10px}}.ce-popover__search{margin-bottom:5px}.ce-popover__nothing-found-message{color:#707684;display:none;cursor:default;padding:3px;font-size:14px;line-height:20px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ce-popover__nothing-found-message--displayed{display:block}.ce-popover--nested .ce-popover__container{--popover-left: calc(var(--nesting-level) * (var(--width) - var(--nested-popover-overlap)));top:calc(var(--trigger-item-top) - var(--nested-popover-overlap));position:absolute}.ce-popover--open-top.ce-popover--nested .ce-popover__container{top:calc(var(--trigger-item-top) - var(--popover-height) + var(--item-height) + var(--offset-from-target) + var(--nested-popover-overlap))}.ce-popover--open-left .ce-popover--nested .ce-popover__container{--popover-left: calc(-1 * (var(--nesting-level) + 1) * var(--width) + 100%)}.ce-popover-item-separator{padding:4px 3px}.ce-popover-item-separator--hidden{display:none}.ce-popover-item-separator__line{height:1px;background:var(--color-border);width:100%}.ce-popover-item-html--hidden{display:none}.ce-popover-item{--border-radius: 6px;border-radius:var(--border-radius);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:var(--item-padding);color:var(--color-text-primary);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:none;background:transparent}@media (max-width: 650px){.ce-popover-item{padding:4px}}.ce-popover-item:not(:last-of-type){margin-bottom:1px}.ce-popover-item__icon{width:26px;height:26px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.ce-popover-item__icon svg{width:20px;height:20px}@media (max-width: 650px){.ce-popover-item__icon{width:36px;height:36px;border-radius:8px}.ce-popover-item__icon svg{width:28px;height:28px}}.ce-popover-item__icon--tool{margin-right:4px}.ce-popover-item__title{font-size:14px;line-height:20px;font-weight:500;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-right:auto}@media (max-width: 650px){.ce-popover-item__title{font-size:16px}}.ce-popover-item__secondary-title{color:var(--color-text-secondary);font-size:12px;white-space:nowrap;letter-spacing:-.1em;padding-right:5px;opacity:.6}@media (max-width: 650px){.ce-popover-item__secondary-title{display:none}}.ce-popover-item--active{background:var(--color-background-icon-active);color:var(--color-text-icon-active)}.ce-popover-item--disabled{color:var(--color-text-secondary);cursor:default;pointer-events:none}.ce-popover-item--focused:not(.ce-popover-item--no-focus){background:var(--color-background-item-focus)!important}.ce-popover-item--hidden{display:none}@media (hover: hover){.ce-popover-item:hover{cursor:pointer}.ce-popover-item:hover:not(.ce-popover-item--no-hover){background-color:var(--color-background-item-hover)}}.ce-popover-item--confirmation{background:var(--color-background-item-confirm)}.ce-popover-item--confirmation .ce-popover-item__title,.ce-popover-item--confirmation .ce-popover-item__icon{color:#fff}@media (hover: hover){.ce-popover-item--confirmation:not(.ce-popover-item--no-hover):hover{background:var(--color-background-item-confirm-hover)}}.ce-popover-item--confirmation:not(.ce-popover-item--no-focus).ce-popover-item--focused{background:var(--color-background-item-confirm-hover)!important}@-webkit-keyframes panelShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes panelShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes panelShowingMobile{0%{opacity:0;-webkit-transform:translateY(14px) scale(.98);transform:translateY(14px) scale(.98)}70%{opacity:1;-webkit-transform:translateY(-4px);transform:translateY(-4px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes panelShowingMobile{0%{opacity:0;-webkit-transform:translateY(14px) scale(.98);transform:translateY(14px) scale(.98)}70%{opacity:1;-webkit-transform:translateY(-4px);transform:translateY(-4px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}.wobble{-webkit-animation-name:wobble;animation-name:wobble;-webkit-animation-duration:.4s;animation-duration:.4s}@-webkit-keyframes wobble{0%{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}15%{-webkit-transform:translate3d(-9%,0,0);transform:translate3d(-9%,0,0)}30%{-webkit-transform:translate3d(9%,0,0);transform:translate3d(9%,0,0)}45%{-webkit-transform:translate3d(-4%,0,0);transform:translate3d(-4%,0,0)}60%{-webkit-transform:translate3d(4%,0,0);transform:translate3d(4%,0,0)}75%{-webkit-transform:translate3d(-1%,0,0);transform:translate3d(-1%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}}@keyframes wobble{0%{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}15%{-webkit-transform:translate3d(-9%,0,0);transform:translate3d(-9%,0,0)}30%{-webkit-transform:translate3d(9%,0,0);transform:translate3d(9%,0,0)}45%{-webkit-transform:translate3d(-4%,0,0);transform:translate3d(-4%,0,0)}60%{-webkit-transform:translate3d(4%,0,0);transform:translate3d(4%,0,0)}75%{-webkit-transform:translate3d(-1%,0,0);transform:translate3d(-1%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}}.ce-popover-header{margin-bottom:8px;margin-top:4px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.ce-popover-header__text{font-size:18px;font-weight:600}.ce-popover-header__back-button{border:0;background:transparent;width:36px;height:36px;color:var(--color-text-primary)}.ce-popover-header__back-button svg{display:block;width:28px;height:28px}.ce-popover--inline{--height: 38px;--height-mobile: 46px;--container-padding: 4px;position:relative}.ce-popover--inline .ce-popover__custom-content{margin-bottom:0}.ce-popover--inline .ce-popover__items{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-popover--inline .ce-popover__container{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;padding:var(--container-padding);height:var(--height);top:0;min-width:-webkit-max-content;min-width:-moz-max-content;min-width:max-content;width:-webkit-max-content;width:-moz-max-content;width:max-content;-webkit-animation:none;animation:none}@media (max-width: 650px){.ce-popover--inline .ce-popover__container{height:var(--height-mobile);position:absolute}}.ce-popover--inline .ce-popover-item-separator{padding:0 4px}.ce-popover--inline .ce-popover-item-separator__line{height:100%;width:1px}.ce-popover--inline .ce-popover-item{border-radius:4px;padding:4px}.ce-popover--inline .ce-popover-item__icon--tool{-webkit-box-shadow:none;box-shadow:none;background:transparent;margin-right:0}.ce-popover--inline .ce-popover-item__icon{width:auto;width:initial;height:auto;height:initial}.ce-popover--inline .ce-popover-item__icon svg{width:20px;height:20px}@media (max-width: 650px){.ce-popover--inline .ce-popover-item__icon svg{width:28px;height:28px}}.ce-popover--inline .ce-popover-item:not(:last-of-type){margin-bottom:0;margin-bottom:initial}.ce-popover--inline .ce-popover-item-html{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.ce-popover--inline .ce-popover-item__icon--chevron-right{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.ce-popover--inline .ce-popover--nested-level-1 .ce-popover__container{--offset: 3px;left:0;top:calc(var(--height) + var(--offset))}@media (max-width: 650px){.ce-popover--inline .ce-popover--nested-level-1 .ce-popover__container{top:calc(var(--height-mobile) + var(--offset))}}.ce-popover--inline .ce-popover--nested .ce-popover__container{min-width:var(--width);width:var(--width);height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;padding:6px;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.ce-popover--inline .ce-popover--nested .ce-popover__items{display:block;width:100%}.ce-popover--inline .ce-popover--nested .ce-popover-item{border-radius:6px;padding:3px}@media (max-width: 650px){.ce-popover--inline .ce-popover--nested .ce-popover-item{padding:4px}}.ce-popover--inline .ce-popover--nested .ce-popover-item__icon--tool{margin-right:4px}.ce-popover--inline .ce-popover--nested .ce-popover-item__icon{width:26px;height:26px}.ce-popover--inline .ce-popover--nested .ce-popover-item-separator{padding:4px 3px}.ce-popover--inline .ce-popover--nested .ce-popover-item-separator__line{width:100%;height:1px}.codex-editor [data-placeholder]:empty:before,.codex-editor [data-placeholder][data-empty=true]:before{pointer-events:none;color:#707684;cursor:text;content:attr(data-placeholder)}.codex-editor [data-placeholder-active]:empty:before,.codex-editor [data-placeholder-active][data-empty=true]:before{pointer-events:none;color:#707684;cursor:text}.codex-editor [data-placeholder-active]:empty:focus:before,.codex-editor [data-placeholder-active][data-empty=true]:focus:before{content:attr(data-placeholder-active)}
42
+ `;class GU extends Pe{constructor(){super(...arguments),this.isMobile=!1,this.contentRectCache=null,this.resizeDebouncer=lv(()=>{this.windowResize()},200),this.selectionChangeDebounced=lv(()=>{this.selectionChanged()},IU),this.documentTouchedListener=e=>{this.documentTouched(e)}}get CSS(){return{editorWrapper:"codex-editor",editorWrapperNarrow:"codex-editor--narrow",editorZone:"codex-editor__redactor",editorZoneHidden:"codex-editor__redactor--hidden",editorEmpty:"codex-editor--empty",editorRtlFix:"codex-editor--rtl"}}get contentRect(){if(this.contentRectCache!==null)return this.contentRectCache;const e=this.nodes.wrapper.querySelector(`.${Ea.CSS.content}`);return e?(this.contentRectCache=e.getBoundingClientRect(),this.contentRectCache):{width:650,left:0,right:0}}async prepare(){this.setIsMobile(),this.make(),this.loadStyles()}toggleReadOnly(e){e?this.unbindReadOnlySensitiveListeners():window.requestIdleCallback(()=>{this.bindReadOnlySensitiveListeners()},{timeout:2e3})}checkEmptiness(){const{BlockManager:e}=this.Editor;this.nodes.wrapper.classList.toggle(this.CSS.editorEmpty,e.isEditorEmpty)}get someToolbarOpened(){const{Toolbar:e,BlockSettings:t,InlineToolbar:o}=this.Editor;return!!(t.opened||o.opened||e.toolbox.opened)}get someFlipperButtonFocused(){return this.Editor.Toolbar.toolbox.hasFocus()?!0:Object.entries(this.Editor).filter(([e,t])=>t.flipper instanceof M0).some(([e,t])=>t.flipper.hasFocus())}destroy(){this.nodes.holder.innerHTML="",this.unbindReadOnlyInsensitiveListeners()}closeAllToolbars(){const{Toolbar:e,BlockSettings:t,InlineToolbar:o}=this.Editor;t.close(),o.close(),e.toolbox.close()}setIsMobile(){const e=window.innerWidth<cv;e!==this.isMobile&&this.eventsDispatcher.emit(ec,{isEnabled:this.isMobile}),this.isMobile=e}make(){this.nodes.holder=Y.getHolder(this.config.holder),this.nodes.wrapper=Y.make("div",[this.CSS.editorWrapper,...this.isRtl?[this.CSS.editorRtlFix]:[]]),this.nodes.redactor=Y.make("div",this.CSS.editorZone),this.nodes.holder.offsetWidth<this.contentRect.width&&this.nodes.wrapper.classList.add(this.CSS.editorWrapperNarrow),this.nodes.redactor.style.paddingBottom=this.config.minHeight+"px",this.nodes.wrapper.appendChild(this.nodes.redactor),this.nodes.holder.appendChild(this.nodes.wrapper),this.bindReadOnlyInsensitiveListeners()}loadStyles(){const e="editor-js-styles";if(Y.get(e))return;const t=Y.make("style",null,{id:e,textContent:YU.toString()});this.config.style&&!po(this.config.style)&&this.config.style.nonce&&t.setAttribute("nonce",this.config.style.nonce),Y.prepend(document.head,t)}bindReadOnlyInsensitiveListeners(){this.listeners.on(document,"selectionchange",this.selectionChangeDebounced),this.listeners.on(window,"resize",this.resizeDebouncer,{passive:!0}),this.listeners.on(this.nodes.redactor,"mousedown",this.documentTouchedListener,{capture:!0,passive:!0}),this.listeners.on(this.nodes.redactor,"touchstart",this.documentTouchedListener,{capture:!0,passive:!0})}unbindReadOnlyInsensitiveListeners(){this.listeners.off(document,"selectionchange",this.selectionChangeDebounced),this.listeners.off(window,"resize",this.resizeDebouncer),this.listeners.off(this.nodes.redactor,"mousedown",this.documentTouchedListener),this.listeners.off(this.nodes.redactor,"touchstart",this.documentTouchedListener)}bindReadOnlySensitiveListeners(){this.readOnlyMutableListeners.on(this.nodes.redactor,"click",e=>{this.redactorClicked(e)},!1),this.readOnlyMutableListeners.on(document,"keydown",e=>{this.documentKeydown(e)},!0),this.readOnlyMutableListeners.on(document,"mousedown",e=>{this.documentClicked(e)},!0),this.watchBlockHoveredEvents(),this.enableInputsEmptyMark()}watchBlockHoveredEvents(){let e;this.readOnlyMutableListeners.on(this.nodes.redactor,"mousemove",J1(t=>{const o=t.target.closest(".ce-block");this.Editor.BlockSelection.anyBlockSelected||o&&e!==o&&(e=o,this.eventsDispatcher.emit(Nv,{block:this.Editor.BlockManager.getBlockByChildNode(o)}))},20),{passive:!0})}unbindReadOnlySensitiveListeners(){this.readOnlyMutableListeners.clearAll()}windowResize(){this.contentRectCache=null,this.setIsMobile()}documentKeydown(e){switch(e.keyCode){case Fe.ENTER:this.enterPressed(e);break;case Fe.BACKSPACE:case Fe.DELETE:this.backspacePressed(e);break;case Fe.ESC:this.escapePressed(e);break;default:this.defaultBehaviour(e);break}}defaultBehaviour(e){const{currentBlock:t}=this.Editor.BlockManager,o=e.target.closest(`.${this.CSS.editorWrapper}`),a=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;if(t!==void 0&&o===null){this.Editor.BlockEvents.keydown(e);return}o||t&&a||(this.Editor.BlockManager.unsetCurrentBlock(),this.Editor.Toolbar.close())}backspacePressed(e){const{BlockManager:t,BlockSelection:o,Caret:a}=this.Editor;if(o.anyBlockSelected&&!_e.isSelectionExists){const i=t.removeSelectedBlocks(),r=t.insertDefaultBlockAtIndex(i,!0);a.setToBlock(r,a.positions.START),o.clearSelection(e),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()}}escapePressed(e){this.Editor.BlockSelection.clearSelection(e),this.Editor.Toolbar.toolbox.opened?(this.Editor.Toolbar.toolbox.close(),this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock,this.Editor.Caret.positions.END)):this.Editor.BlockSettings.opened?this.Editor.BlockSettings.close():this.Editor.InlineToolbar.opened?this.Editor.InlineToolbar.close():this.Editor.Toolbar.close()}enterPressed(e){const{BlockManager:t,BlockSelection:o}=this.Editor;if(this.someToolbarOpened)return;const a=t.currentBlockIndex>=0;if(o.anyBlockSelected&&!_e.isSelectionExists){o.clearSelection(e),e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation();return}if(!this.someToolbarOpened&&a&&e.target.tagName==="BODY"){const i=this.Editor.BlockManager.insert();e.preventDefault(),this.Editor.Caret.setToBlock(i),this.Editor.Toolbar.moveAndOpen(i)}this.Editor.BlockSelection.clearSelection(e)}documentClicked(e){var t,o;if(!e.isTrusted)return;const a=e.target;this.nodes.holder.contains(a)||_e.isAtEditor||(this.Editor.BlockManager.unsetCurrentBlock(),this.Editor.Toolbar.close());const i=(t=this.Editor.BlockSettings.nodes.wrapper)==null?void 0:t.contains(a),r=(o=this.Editor.Toolbar.nodes.settingsToggler)==null?void 0:o.contains(a),s=i||r;if(this.Editor.BlockSettings.opened&&!s){this.Editor.BlockSettings.close();const l=this.Editor.BlockManager.getBlockByChildNode(a);this.Editor.Toolbar.moveAndOpen(l)}this.Editor.BlockSelection.clearSelection(e)}documentTouched(e){let t=e.target;if(t===this.nodes.redactor){const o=e instanceof MouseEvent?e.clientX:e.touches[0].clientX,a=e instanceof MouseEvent?e.clientY:e.touches[0].clientY;t=document.elementFromPoint(o,a)}try{this.Editor.BlockManager.setCurrentBlockByChildNode(t)}catch{this.Editor.RectangleSelection.isRectActivated()||this.Editor.Caret.setToTheLastBlock()}this.Editor.ReadOnly.isEnabled||this.Editor.Toolbar.moveAndOpen()}redactorClicked(e){if(!_e.isCollapsed)return;const t=e.target,o=e.metaKey||e.ctrlKey;if(Y.isAnchor(t)&&o){e.stopImmediatePropagation(),e.stopPropagation();const a=t.getAttribute("href"),i=Cz(a);wz(i);return}this.processBottomZoneClick(e)}processBottomZoneClick(e){const t=this.Editor.BlockManager.getBlockByIndex(-1),o=Y.offset(t.holder).bottom,a=e.pageY,{BlockSelection:i}=this.Editor;if(e.target instanceof Element&&e.target.isEqualNode(this.nodes.redactor)&&!i.anyBlockSelected&&o<a){e.stopImmediatePropagation(),e.stopPropagation();const{BlockManager:r,Caret:s,Toolbar:l}=this.Editor;(!r.lastBlock.tool.isDefault||!r.lastBlock.isEmpty)&&r.insertAtEnd(),s.setToTheLastBlock(),l.moveAndOpen(r.lastBlock)}}selectionChanged(){const{CrossBlockSelection:e,BlockSelection:t}=this.Editor,o=_e.anchorElement;if(e.isCrossBlockSelectionStarted&&t.anyBlockSelected&&_e.get().removeAllRanges(),!o){_e.range||this.Editor.InlineToolbar.close();return}const a=o.closest(`.${Ea.CSS.content}`);(a===null||a.closest(`.${_e.CSS.editorWrapper}`)!==this.nodes.wrapper)&&(this.Editor.InlineToolbar.containsNode(o)||this.Editor.InlineToolbar.close(),o.dataset.inlineToolbar!=="true")||(this.Editor.BlockManager.currentBlock||this.Editor.BlockManager.setCurrentBlockByChildNode(o),this.Editor.InlineToolbar.tryToShow(!0))}enableInputsEmptyMark(){function e(t){const o=t.target;dv(o)}this.readOnlyMutableListeners.on(this.nodes.wrapper,"input",e),this.readOnlyMutableListeners.on(this.nodes.wrapper,"focusin",e),this.readOnlyMutableListeners.on(this.nodes.wrapper,"focusout",e)}}const XU={BlocksAPI:Tz,CaretAPI:Oz,EventsAPI:Lz,I18nAPI:Nz,API:Pz,InlineToolbarAPI:Rz,ListenersAPI:Vz,NotifierAPI:Wz,ReadOnlyAPI:Uz,SanitizerAPI:Jz,SaverAPI:Qz,SelectionAPI:e$,ToolsAPI:t$,StylesAPI:n$,ToolbarAPI:o$,TooltipAPI:l$,UiAPI:c$,BlockSettings:O$,Toolbar:$$,InlineToolbar:W$,BlockEvents:wU,BlockManager:xU,BlockSelection:DU,Caret:FU,CrossBlockSelection:EU,DragNDrop:SU,ModificationsObserver:BU,Paste:TU,ReadOnly:AU,RectangleSelection:OU,Renderer:LU,Saver:NU,Tools:j8,UI:GU};class JU{constructor(e){this.moduleInstances={},this.eventsDispatcher=new Jl;let t,o;this.isReady=new Promise((a,i)=>{t=a,o=i}),Promise.resolve().then(async()=>{this.configuration=e,this.validate(),this.init(),await this.start(),await this.render();const{BlockManager:a,Caret:i,UI:r,ModificationsObserver:s}=this.moduleInstances;r.checkEmptiness(),s.enable(),this.configuration.autofocus===!0&&this.configuration.readOnly!==!0&&i.setToBlock(a.blocks[0],i.positions.START),t()}).catch(a=>{Ue(`Editor.js is not ready because of ${a}`,"error"),o(a)})}set configuration(e){var t,o;tn(e)?this.config={...e}:this.config={holder:e},tm(!!this.config.holderId,"config.holderId","config.holder"),this.config.holderId&&!this.config.holder&&(this.config.holder=this.config.holderId,this.config.holderId=null),this.config.holder==null&&(this.config.holder="editorjs"),this.config.logLevel||(this.config.logLevel=ov.VERBOSE),hz(this.config.logLevel),tm(!!this.config.initialBlock,"config.initialBlock","config.defaultBlock"),this.config.defaultBlock=this.config.defaultBlock||this.config.initialBlock||"paragraph",this.config.minHeight=this.config.minHeight!==void 0?this.config.minHeight:300;const a={type:this.config.defaultBlock,data:{}};this.config.placeholder=this.config.placeholder||!1,this.config.sanitizer=this.config.sanitizer||{p:!0,b:!0,a:!0},this.config.hideToolbar=this.config.hideToolbar?this.config.hideToolbar:!1,this.config.tools=this.config.tools||{},this.config.i18n=this.config.i18n||{},this.config.data=this.config.data||{blocks:[]},this.config.onReady=this.config.onReady||(()=>{}),this.config.onChange=this.config.onChange||(()=>{}),this.config.inlineToolbar=this.config.inlineToolbar!==void 0?this.config.inlineToolbar:!0,(po(this.config.data)||!this.config.data.blocks||this.config.data.blocks.length===0)&&(this.config.data={blocks:[a]}),this.config.readOnly=this.config.readOnly||!1,(t=this.config.i18n)!=null&&t.messages&&jn.setDictionary(this.config.i18n.messages),this.config.i18n.direction=((o=this.config.i18n)==null?void 0:o.direction)||"ltr"}get configuration(){return this.config}validate(){const{holderId:e,holder:t}=this.config;if(e&&t)throw Error("«holderId» and «holder» param can't assign at the same time.");if(xa(t)&&!Y.get(t))throw Error(`element with ID «${t}» is missing. Pass correct holder's ID.`);if(t&&tn(t)&&!Y.isElement(t))throw Error("«holder» value must be an Element node")}init(){this.constructModules(),this.configureModules()}async start(){await["Tools","UI","BlockManager","Paste","BlockSelection","RectangleSelection","CrossBlockSelection","ReadOnly"].reduce((e,t)=>e.then(async()=>{try{await this.moduleInstances[t].prepare()}catch(o){if(o instanceof mv)throw new Error(o.message);Ue(`Module ${t} was skipped because of %o`,"warn",o)}}),Promise.resolve())}render(){return this.moduleInstances.Renderer.render(this.config.data.blocks)}constructModules(){Object.entries(XU).forEach(([e,t])=>{try{this.moduleInstances[e]=new t({config:this.configuration,eventsDispatcher:this.eventsDispatcher})}catch(o){Ue("[constructModules]",`Module ${e} skipped because`,"error",o)}})}configureModules(){for(const e in this.moduleInstances)Object.prototype.hasOwnProperty.call(this.moduleInstances,e)&&(this.moduleInstances[e].state=this.getModulesDiff(e))}getModulesDiff(e){const t={};for(const o in this.moduleInstances)o!==e&&(t[o]=this.moduleInstances[o]);return t}}class QU{static get version(){return"2.31.3"}constructor(e){let t=()=>{};tn(e)&&bt(e.onReady)&&(t=e.onReady);const o=new JU(e);this.isReady=o.isReady.then(()=>{this.exportAPI(o),t()})}exportAPI(e){const t=["configuration"],o=()=>{Object.values(e.moduleInstances).forEach(a=>{bt(a.destroy)&&a.destroy(),a.listeners.removeAll()}),s$(),e=null;for(const a in this)Object.prototype.hasOwnProperty.call(this,a)&&delete this[a];Object.setPrototypeOf(this,null)};t.forEach(a=>{this[a]=e[a]}),this.destroy=o,Object.setPrototypeOf(this,e.moduleInstances.API.methods),delete this.exportAPI,Object.entries({blocks:{clear:"clear",render:"render"},caret:{focus:"focus"},events:{on:"on",off:"off",emit:"emit"},saver:{save:"save"}}).forEach(([a,i])=>{Object.entries(i).forEach(([r,s])=>{this[s]=e.moduleInstances.API.methods[a][r]})})}}(function(){try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode(".ce-paragraph{line-height:1.6em;outline:none}.ce-block:only-of-type .ce-paragraph[data-placeholder-active]:empty:before,.ce-block:only-of-type .ce-paragraph[data-placeholder-active][data-empty=true]:before{content:attr(data-placeholder-active)}.ce-paragraph p:first-of-type{margin-top:0}.ce-paragraph p:last-of-type{margin-bottom:0}")),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const eq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 9V7.2C8 7.08954 8.08954 7 8.2 7L12 7M16 9V7.2C16 7.08954 15.9105 7 15.8 7L12 7M12 7L12 17M12 17H10M12 17H14"/></svg>';function tq(n){const e=document.createElement("div");e.innerHTML=n.trim();const t=document.createDocumentFragment();return t.append(...Array.from(e.childNodes)),t}let nq=class Tx{static get DEFAULT_PLACEHOLDER(){return""}constructor({data:e,config:t,api:o,readOnly:a}){this.api=o,this.readOnly=a,this._CSS={block:this.api.styles.block,wrapper:"ce-paragraph"},this.readOnly||(this.onKeyUp=this.onKeyUp.bind(this)),this._placeholder=t.placeholder?t.placeholder:Tx.DEFAULT_PLACEHOLDER,this._data=e??{},this._element=null,this._preserveBlank=t.preserveBlank??!1}onKeyUp(e){if(e.code!=="Backspace"&&e.code!=="Delete"||!this._element)return;const{textContent:t}=this._element;t===""&&(this._element.innerHTML="")}drawView(){const e=document.createElement("DIV");return e.classList.add(this._CSS.wrapper,this._CSS.block),e.contentEditable="false",e.dataset.placeholderActive=this.api.i18n.t(this._placeholder),this._data.text&&(e.innerHTML=this._data.text),this.readOnly||(e.contentEditable="true",e.addEventListener("keyup",this.onKeyUp)),e}render(){return this._element=this.drawView(),this._element}merge(e){if(!this._element)return;this._data.text+=e.text;const t=tq(e.text);this._element.appendChild(t),this._element.normalize()}validate(e){return!(e.text.trim()===""&&!this._preserveBlank)}save(e){return{text:e.innerHTML}}onPaste(e){const t={text:e.detail.data.innerHTML};this._data=t,window.requestAnimationFrame(()=>{this._element&&(this._element.innerHTML=this._data.text||"")})}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{text:{br:!0}}}static get isReadOnlySupported(){return!0}static get pasteConfig(){return{tags:["P"]}}static get toolbox(){return{icon:eq,title:"Text"}}};(function(){try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode(".ce-header{padding:.6em 0 3px;margin:0;line-height:1.25em;outline:none}.ce-header p,.ce-header div{padding:0!important;margin:0!important}")),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const oq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19 17V10.2135C19 10.1287 18.9011 10.0824 18.836 10.1367L16 12.5"/></svg>',aq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 11C16 10 19 9.5 19 12C19 13.9771 16.0684 13.9997 16.0012 16.8981C15.9999 16.9533 16.0448 17 16.1 17L19.3 17"/></svg>',iq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 11C16 10.5 16.8323 10 17.6 10C18.3677 10 19.5 10.311 19.5 11.5C19.5 12.5315 18.7474 12.9022 18.548 12.9823C18.5378 12.9864 18.5395 13.0047 18.5503 13.0063C18.8115 13.0456 20 13.3065 20 14.8C20 16 19.5 17 17.8 17C17.8 17 16 17 16 16.3"/></svg>',rq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M18 10L15.2834 14.8511C15.246 14.9178 15.294 15 15.3704 15C16.8489 15 18.7561 15 20.2 15M19 17C19 15.7187 19 14.8813 19 13.6"/></svg>',sq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 15.9C16 15.9 16.3768 17 17.8 17C19.5 17 20 15.6199 20 14.7C20 12.7323 17.6745 12.0486 16.1635 12.9894C16.094 13.0327 16 12.9846 16 12.9027V10.1C16 10.0448 16.0448 10 16.1 10H19.8"/></svg>',lq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19.5 10C16.5 10.5 16 13.3285 16 15M16 15V15C16 16.1046 16.8954 17 18 17H18.3246C19.3251 17 20.3191 16.3492 20.2522 15.3509C20.0612 12.4958 16 12.6611 16 15Z"/></svg>',cq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9 7L9 12M9 17V12M9 12L15 12M15 7V12M15 17L15 12"/></svg>';let dq=class{constructor({data:e,config:t,api:o,readOnly:a}){this.api=o,this.readOnly=a,this._settings=t,this._data=this.normalizeData(e),this._element=this.getTag()}get _CSS(){return{block:this.api.styles.block,wrapper:"ce-header"}}isHeaderData(e){return e.text!==void 0}normalizeData(e){const t={text:"",level:this.defaultLevel.number};return this.isHeaderData(e)&&(t.text=e.text||"",e.level!==void 0&&!isNaN(parseInt(e.level.toString()))&&(t.level=parseInt(e.level.toString()))),t}render(){return this._element}renderSettings(){return this.levels.map(e=>({icon:e.svg,label:this.api.i18n.t(`Heading ${e.number}`),onActivate:()=>this.setLevel(e.number),closeOnActivate:!0,isActive:this.currentLevel.number===e.number,render:()=>document.createElement("div")}))}setLevel(e){this.data={level:e,text:this.data.text}}merge(e){this._element.insertAdjacentHTML("beforeend",e.text)}validate(e){return e.text.trim()!==""}save(e){return{text:e.innerHTML,level:this.currentLevel.number}}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{level:!1,text:{}}}static get isReadOnlySupported(){return!0}get data(){return this._data.text=this._element.innerHTML,this._data.level=this.currentLevel.number,this._data}set data(e){if(this._data=this.normalizeData(e),e.level!==void 0&&this._element.parentNode){const t=this.getTag();t.innerHTML=this._element.innerHTML,this._element.parentNode.replaceChild(t,this._element),this._element=t}e.text!==void 0&&(this._element.innerHTML=this._data.text||"")}getTag(){const e=document.createElement(this.currentLevel.tag);return e.innerHTML=this._data.text||"",e.classList.add(this._CSS.wrapper),e.contentEditable=this.readOnly?"false":"true",e.dataset.placeholder=this.api.i18n.t(this._settings.placeholder||""),e}get currentLevel(){let e=this.levels.find(t=>t.number===this._data.level);return e||(e=this.defaultLevel),e}get defaultLevel(){if(this._settings.defaultLevel){const e=this.levels.find(t=>t.number===this._settings.defaultLevel);if(e)return e;console.warn("(ง'̀-'́)ง Heading Tool: the default level specified was not found in available levels")}return this.levels[1]}get levels(){const e=[{number:1,tag:"H1",svg:oq},{number:2,tag:"H2",svg:aq},{number:3,tag:"H3",svg:iq},{number:4,tag:"H4",svg:rq},{number:5,tag:"H5",svg:sq},{number:6,tag:"H6",svg:lq}];return this._settings.levels?e.filter(t=>this._settings.levels.includes(t.number)):e}onPaste(e){const t=e.detail;if("data"in t){const o=t.data;let a=this.defaultLevel.number;switch(o.tagName){case"H1":a=1;break;case"H2":a=2;break;case"H3":a=3;break;case"H4":a=4;break;case"H5":a=5;break;case"H6":a=6;break}this._settings.levels&&(a=this._settings.levels.reduce((i,r)=>Math.abs(r-a)<Math.abs(i-a)?r:i)),this.data={level:a,text:o.innerHTML}}}static get pasteConfig(){return{tags:["H1","H2","H3","H4","H5","H6"]}}static get toolbox(){return{icon:cq,title:"Heading"}}};(function(){try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode('.cdx-nested-list{margin:0;padding:0;outline:none;counter-reset:item;list-style:none}.cdx-nested-list__item{line-height:1.6em;display:flex;margin:2px 0}.cdx-nested-list__item [contenteditable]{outline:none}.cdx-nested-list__item-body{flex-grow:2}.cdx-nested-list__item-content,.cdx-nested-list__item-children{flex-basis:100%}.cdx-nested-list__item-content{word-break:break-word;white-space:pre-wrap}.cdx-nested-list__item:before{counter-increment:item;margin-right:5px;white-space:nowrap}.cdx-nested-list--ordered>.cdx-nested-list__item:before{content:counters(item,".") ". "}.cdx-nested-list--unordered>.cdx-nested-list__item:before{content:"•"}.cdx-nested-list__settings{display:flex}.cdx-nested-list__settings .cdx-settings-button{width:50%}')),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();function Sa(n){return n.nodeType===Node.ELEMENT_NODE}function gs(n,e=null,t){const o=document.createElement(n);Array.isArray(e)?o.classList.add(...e):e&&o.classList.add(e);for(const a in t)o[a]=t[a];return o}function _8(n){const e=gs("div");return e.appendChild(n),e.innerHTML}function x8(n){let e;return n.nodeType!==Node.ELEMENT_NODE?e=n.textContent:(e=n.innerHTML,e=e.replaceAll("<br>","")),e?.trim().length===0}let vs=class c6{constructor(){this.savedFakeCaret=void 0}save(){const e=c6.range,t=gs("span");t.hidden=!0,e&&(e.insertNode(t),this.savedFakeCaret=t)}restore(){if(!this.savedFakeCaret)return;const e=window.getSelection();if(!e)return;const t=new Range;t.setStartAfter(this.savedFakeCaret),t.setEndAfter(this.savedFakeCaret),e.removeAllRanges(),e.addRange(t),setTimeout(()=>{var o;(o=this.savedFakeCaret)==null||o.remove()},150)}static get range(){const e=window.getSelection();return e&&e.rangeCount?e.getRangeAt(0):null}static extractFragmentFromCaretPositionTillTheEnd(){const e=window.getSelection();if(!e||!e.rangeCount)return;const t=e.getRangeAt(0);let o=t.startContainer;if(o.nodeType!==Node.ELEMENT_NODE){if(!o.parentNode)return;o=o.parentNode}if(!Sa(o))return;const a=o.closest("[contenteditable]");if(!a)return;t.deleteContents();const i=t.cloneRange();return i.selectNodeContents(a),i.setStart(t.endContainer,t.endOffset),i.extractContents()}static focus(e,t=!0){const o=document.createRange(),a=window.getSelection();a&&(o.selectNodeContents(e),o.collapse(t),a.removeAllRanges(),a.addRange(o))}static isAtStart(){const e=window.getSelection();if(!e||e.focusOffset>0)return!1;const t=e.focusNode;return!t||!Sa(t)?!1:c6.getHigherLevelSiblings(t,"left").every(o=>x8(o))}static getHigherLevelSiblings(e,t="left"){let o=e;const a=[];for(;o.parentNode&&o.parentNode.contentEditable!=="true";)o=o.parentNode;const i=t==="left"?"previousSibling":"nextSibling";for(;o[i];)o=o[i],a.push(o);return a}};const uq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="9" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 17H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 12H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 7H4.99002"/></svg>',D8='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="12" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7.79999 14L7.79999 7.2135C7.79999 7.12872 7.7011 7.0824 7.63597 7.13668L4.79999 9.5"/></svg>';let pq=class d6{static get isReadOnlySupported(){return!0}static get enableLineBreaks(){return!0}static get toolbox(){return{icon:D8,title:"List"}}constructor({data:e,config:t,api:o,readOnly:a}){var i;this.nodes={wrapper:null},this.api=o,this.readOnly=a,this.config=t,this.defaultListStyle=((i=this.config)==null?void 0:i.defaultStyle)==="ordered"?"ordered":"unordered";const r={style:this.defaultListStyle,items:[]};this.data=e&&Object.keys(e).length?e:r,this.caret=new vs}render(){return this.nodes.wrapper=this.makeListWrapper(this.data.style,[this.CSS.baseBlock]),this.data.items.length?this.appendItems(this.data.items,this.nodes.wrapper):this.appendItems([{content:"",items:[]}],this.nodes.wrapper),this.readOnly||this.nodes.wrapper.addEventListener("keydown",e=>{switch(e.key){case"Enter":this.enterPressed(e);break;case"Backspace":this.backspace(e);break;case"Tab":e.shiftKey?this.shiftTab(e):this.addTab(e);break}},!1),this.nodes.wrapper}renderSettings(){return[{name:"unordered",label:this.api.i18n.t("Unordered"),icon:uq},{name:"ordered",label:this.api.i18n.t("Ordered"),icon:D8}].map(e=>({name:e.name,icon:e.icon,label:e.label,isActive:this.data.style===e.name,closeOnActivate:!0,onActivate:()=>{this.listStyle=e.name}}))}static get pasteConfig(){return{tags:["OL","UL","LI"]}}onPaste(e){const t=e.detail.data;this.data=this.pasteHandler(t);const o=this.nodes.wrapper;o&&o.parentNode&&o.parentNode.replaceChild(this.render(),o)}pasteHandler(e){const{tagName:t}=e;let o="unordered",a;switch(t){case"OL":o="ordered",a="ol";break;case"UL":case"LI":o="unordered",a="ul"}const i={style:o,items:[]},r=s=>Array.from(s.querySelectorAll(":scope > li")).map(l=>{var d;const u=l.querySelector(`:scope > ${a}`),p=u?r(u):[];return{content:((d=l?.firstChild)==null?void 0:d.textContent)||"",items:p}});return i.items=r(e),i}appendItems(e,t){e.forEach(o=>{const a=this.createItem(o.content,o.items);t.appendChild(a)})}createItem(e,t=[]){const o=gs("li",this.CSS.item),a=gs("div",this.CSS.itemBody),i=gs("div",this.CSS.itemContent,{innerHTML:e,contentEditable:(!this.readOnly).toString()});return a.appendChild(i),o.appendChild(a),t&&t.length>0&&this.addChildrenList(o,t),o}save(){const e=t=>Array.from(t.querySelectorAll(`:scope > .${this.CSS.item}`)).map(o=>{const a=o.querySelector(`.${this.CSS.itemChildren}`),i=this.getItemContent(o),r=a?e(a):[];return{content:i,items:r}});return{style:this.data.style,items:this.nodes.wrapper?e(this.nodes.wrapper):[]}}addChildrenList(e,t){const o=e.querySelector(`.${this.CSS.itemBody}`),a=this.makeListWrapper(void 0,[this.CSS.itemChildren]);this.appendItems(t,a),o&&o.appendChild(a)}makeListWrapper(e=this.listStyle,t=[]){const o=e==="ordered"?"ol":"ul",a=e==="ordered"?this.CSS.wrapperOrdered:this.CSS.wrapperUnordered;return t.push(a),gs(o,[this.CSS.wrapper,...t])}get CSS(){return{baseBlock:this.api.styles.block,wrapper:"cdx-nested-list",wrapperOrdered:"cdx-nested-list--ordered",wrapperUnordered:"cdx-nested-list--unordered",item:"cdx-nested-list__item",itemBody:"cdx-nested-list__item-body",itemContent:"cdx-nested-list__item-content",itemChildren:"cdx-nested-list__item-children",settingsWrapper:"cdx-nested-list__settings",settingsButton:this.api.styles.settingsButton,settingsButtonActive:this.api.styles.settingsButtonActive}}get listStyle(){return this.data.style||this.defaultListStyle}set listStyle(e){if(!this.nodes||!this.nodes.wrapper)return;const t=Array.from(this.nodes.wrapper.querySelectorAll(`.${this.CSS.wrapper}`));t.push(this.nodes.wrapper),t.forEach(o=>{o.classList.toggle(this.CSS.wrapperUnordered,e==="unordered"),o.classList.toggle(this.CSS.wrapperOrdered,e==="ordered")}),this.data.style=e}get currentItem(){const e=window.getSelection();if(!e)return null;let t=e.anchorNode;return!t||(Sa(t)||(t=t.parentNode),!t)||!Sa(t)?null:t.closest(`.${this.CSS.item}`)}enterPressed(e){const t=this.currentItem;if(e.stopPropagation(),e.preventDefault(),e.isComposing)return;const o=t?this.getItemContent(t).trim().length===0:!0,a=t?.parentNode===this.nodes.wrapper,i=t?.nextElementSibling===null;if(a&&i&&o){this.getOutOfList();return}else if(i&&o){this.unshiftItem();return}const r=vs.extractFragmentFromCaretPositionTillTheEnd();if(!r)return;const s=_8(r),l=t?.querySelector(`.${this.CSS.itemChildren}`),d=this.createItem(s,void 0);l&&Array.from(l.querySelectorAll(`.${this.CSS.item}`)).length>0?l.prepend(d):t?.after(d),this.focusItem(d)}unshiftItem(){const e=this.currentItem;if(!e||!e.parentNode||!Sa(e.parentNode))return;const t=e.parentNode.closest(`.${this.CSS.item}`);if(!t)return;this.caret.save(),t.after(e),this.caret.restore();const o=t.querySelector(`.${this.CSS.itemChildren}`);o&&o.children.length===0&&o.remove()}getItemContent(e){const t=e.querySelector(`.${this.CSS.itemContent}`);return!t||x8(t)?"":t.innerHTML}focusItem(e,t=!0){const o=e.querySelector(`.${this.CSS.itemContent}`);o&&vs.focus(o,t)}getOutOfList(){var e;(e=this.currentItem)==null||e.remove(),this.api.blocks.insert(),this.api.caret.setToBlock(this.api.blocks.getCurrentBlockIndex())}backspace(e){if(!vs.isAtStart())return;e.preventDefault();const t=this.currentItem;if(!t)return;const o=t.previousSibling;if(!t.parentNode||!Sa(t.parentNode))return;const a=t.parentNode.closest(`.${this.CSS.item}`);if(!o&&!a||o&&!Sa(o))return;e.stopPropagation();let i;if(o){const u=o.querySelectorAll(`.${this.CSS.item}`);i=Array.from(u).pop()||o}else i=a;const r=vs.extractFragmentFromCaretPositionTillTheEnd();if(!r)return;const s=_8(r);if(!i)return;const l=i.querySelector(`.${this.CSS.itemContent}`);if(!l)return;vs.focus(l,!1),this.caret.save(),l.insertAdjacentHTML("beforeend",s);let d=t.querySelectorAll(`.${this.CSS.itemChildren} > .${this.CSS.item}`);d=Array.from(d),d=d.filter(u=>!u.parentNode||!Sa(u.parentNode)?!1:u.parentNode.closest(`.${this.CSS.item}`)===t),d.reverse().forEach(u=>{o?i.after(u):t.after(u)}),t.remove(),this.caret.restore()}addTab(e){e.stopPropagation(),e.preventDefault();const t=this.currentItem;if(!t)return;const o=t.previousSibling;if(!o||!Sa(o)||!o)return;const a=o.querySelector(`.${this.CSS.itemChildren}`);if(this.caret.save(),a)a.appendChild(t);else{const i=this.makeListWrapper(void 0,[this.CSS.itemChildren]),r=o.querySelector(`.${this.CSS.itemBody}`);i.appendChild(t),r?.appendChild(i)}this.caret.restore()}shiftTab(e){e.stopPropagation(),e.preventDefault(),this.unshiftItem()}static joinRecursive(e){return e.items.map(t=>`${t.content} ${d6.joinRecursive(t)}`).join("")}static get conversionConfig(){return{export:e=>d6.joinRecursive(e),import:e=>({items:[{content:e,items:[]}],style:"unordered"})}}};(function(){try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode(".cdx-marker{background:rgba(245,235,111,.29);padding:3px 0}")),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const mq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-width="2" d="M11.3536 9.31802L12.7678 7.90381C13.5488 7.12276 14.8151 7.12276 15.5962 7.90381C16.3772 8.68486 16.3772 9.95119 15.5962 10.7322L14.182 12.1464M11.3536 9.31802L7.96729 12.7043C7.40889 13.2627 7.02827 13.9739 6.8734 14.7482L6.69798 15.6253C6.55804 16.325 7.17496 16.942 7.87468 16.802L8.75176 16.6266C9.52612 16.4717 10.2373 16.0911 10.7957 15.5327L14.182 12.1464M11.3536 9.31802L14.182 12.1464"/><line x1="15" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/></svg>';let hq=class _2{static get CSS(){return"cdx-marker"}constructor({api:e}){this.api=e,this.button=null,this.tag="MARK",this.iconClasses={base:this.api.styles.inlineToolButton,active:this.api.styles.inlineToolButtonActive}}static get isInline(){return!0}render(){return this.button=document.createElement("button"),this.button.type="button",this.button.classList.add(this.iconClasses.base),this.button.innerHTML=this.toolboxIcon,this.button}surround(e){if(!e)return;let t=this.api.selection.findParentTag(this.tag,_2.CSS);t?this.unwrap(t):this.wrap(e)}wrap(e){let t=document.createElement(this.tag);t.classList.add(_2.CSS),t.appendChild(e.extractContents()),e.insertNode(t),this.api.selection.expandToTag(t)}unwrap(e){this.api.selection.expandToTag(e);let t=window.getSelection(),o=t.getRangeAt(0),a=o.extractContents();e.parentNode.removeChild(e),o.insertNode(a),t.removeAllRanges(),t.addRange(o)}checkState(){const e=this.api.selection.findParentTag(this.tag,_2.CSS);this.button.classList.toggle(this.iconClasses.active,!!e)}get toolboxIcon(){return mq}static get sanitize(){return{mark:{class:_2.CSS}}}};(function(){try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode(".cdx-underline{text-decoration:underline}")),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const fq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 7.5V11.5C9 12.2956 9.31607 13.0587 9.87868 13.6213C10.4413 14.1839 11.2044 14.5 12 14.5C12.7956 14.5 13.5587 14.1839 14.1213 13.6213C14.6839 13.0587 15 12.2956 15 11.5V7.5"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7.71429 18H16.2857"/></svg>',F8=class x2{constructor(e){this.tag="U",this.api=e.api,this.iconClasses={base:this.api.styles.inlineToolButton,active:this.api.styles.inlineToolButtonActive}}static get CSS(){return"cdx-underline"}render(){return this.button=document.createElement("button"),this.button.type="button",this.button.classList.add(this.iconClasses.base),this.button.innerHTML=this.toolboxIcon,this.button}surround(e){if(!e)return;const t=this.api.selection.findParentTag(this.tag,x2.CSS);t?this.unwrap(t):this.wrap(e)}wrap(e){const t=document.createElement(this.tag);t.classList.add(x2.CSS),t.appendChild(e.extractContents()),e.insertNode(t),this.api.selection.expandToTag(t)}unwrap(e){var t;this.api.selection.expandToTag(e);const o=window.getSelection();if(!o)return;const a=o.getRangeAt(0);if(!a)return;const i=a.extractContents();i&&((t=e.parentNode)==null||t.removeChild(e),a.insertNode(i),o.removeAllRanges(),o.addRange(a))}checkState(){var e;const t=this.api.selection.findParentTag(this.tag,x2.CSS);return(e=this.button)==null||e.classList.toggle(this.iconClasses.active,!!t),!!t}get toolboxIcon(){return fq}static get sanitize(){return{u:{class:x2.CSS}}}};F8.isInline=!0;let gq=F8;(function(){try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode(".inline-code{background:rgba(250,239,240,.78);color:#b44437;padding:3px 4px;border-radius:5px;margin:0 1px;font-family:inherit;font-size:.86em;font-weight:500;letter-spacing:.3px}")),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const vq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 8L5 12L9 16"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 8L19 12L15 16"/></svg>';let bq=class D2{constructor({api:e}){this.tag="CODE",this.api=e,this.button=null,this.iconClasses={base:this.api.styles.inlineToolButton,active:this.api.styles.inlineToolButtonActive}}static get CSS(){return"inline-code"}static get isInline(){return!0}render(){return this.button=document.createElement("button"),this.button.type="button",this.button.classList.add(this.iconClasses.base),this.button.innerHTML=this.toolboxIcon,this.button}surround(e){var t;if(!e)return;let o=this.api.selection.findParentTag(this.tag,D2.CSS);o?this.unwrap(o):(t=e.commonAncestorContainer.parentElement)!=null&&t.querySelector(this.tag)||this.wrap(e)}wrap(e){let t=document.createElement(this.tag);t.classList.add(D2.CSS),t.appendChild(e.extractContents()),e.insertNode(t),this.api.selection.expandToTag(t)}unwrap(e){var t;this.api.selection.expandToTag(e);const o=window.getSelection();if(!o)return;const a=o.getRangeAt(0),i=a.extractContents();(t=e.parentNode)==null||t.removeChild(e),a.insertNode(i),o.removeAllRanges(),o.addRange(a)}checkState(){const e=this.api.selection.findParentTag(this.tag,D2.CSS);return this.button&&this.button.classList.toggle(this.iconClasses.active,!!e),!!e}get toolboxIcon(){return vq}static get sanitize(){return{code:{class:D2.CSS}}}};(function(){var n;try{if(typeof document<"u"){var e=document.createElement("style");e.nonce=(n=document.head.querySelector("meta[property=csp-nonce]"))==null?void 0:n.content,e.appendChild(document.createTextNode('.tc-wrap{--color-background:#f9f9fb;--color-text-secondary:#7b7e89;--color-border:#e8e8eb;--cell-size:34px;--toolbox-icon-size:18px;--toolbox-padding:6px;--toolbox-aiming-field-size:calc(var(--toolbox-icon-size) + var(--toolbox-padding)*2);border-left:0;position:relative;height:100%;width:100%;margin-top:var(--toolbox-icon-size);box-sizing:border-box;display:grid;grid-template-columns:calc(100% - var(--cell-size)) var(--cell-size);z-index:0}.tc-wrap--readonly{grid-template-columns:100% var(--cell-size)}.tc-wrap svg{vertical-align:top}@media print{.tc-wrap{border-left-color:var(--color-border);border-left-style:solid;border-left-width:1px;grid-template-columns:100% var(--cell-size)}}@media print{.tc-wrap .tc-row:after{display:none}}.tc-table{position:relative;width:100%;height:100%;display:grid;font-size:14px;border-top:1px solid var(--color-border);line-height:1.4}.tc-table:after{width:calc(var(--cell-size));height:100%;left:calc(var(--cell-size)*-1);top:0}.tc-table:after,.tc-table:before{position:absolute;content:""}.tc-table:before{width:100%;height:var(--toolbox-aiming-field-size);top:calc(var(--toolbox-aiming-field-size)*-1);left:0}.tc-table--heading .tc-row:first-child{font-weight:600;border-bottom:2px solid var(--color-border);position:sticky;top:0;z-index:2;background:var(--color-background)}.tc-table--heading .tc-row:first-child [contenteditable]:empty:before{content:attr(heading);color:var(--color-text-secondary)}.tc-table--heading .tc-row:first-child:after{bottom:-2px;border-bottom:2px solid var(--color-border)}.tc-add-column,.tc-add-row{display:flex;color:var(--color-text-secondary)}@media print{.tc-add{display:none}}.tc-add-column{display:grid;border-top:1px solid var(--color-border);grid-template-columns:var(--cell-size);grid-auto-rows:var(--cell-size);place-items:center}.tc-add-column svg{padding:5px;position:sticky;top:0;background-color:var(--color-background)}.tc-add-column--disabled{visibility:hidden}@media print{.tc-add-column{display:none}}.tc-add-row{height:var(--cell-size);align-items:center;padding-left:4px;position:relative}.tc-add-row--disabled{display:none}.tc-add-row:before{content:"";position:absolute;right:calc(var(--cell-size)*-1);width:var(--cell-size);height:100%}@media print{.tc-add-row{display:none}}.tc-add-column,.tc-add-row{transition:0s;cursor:pointer;will-change:background-color}.tc-add-column:hover,.tc-add-row:hover{transition:background-color .1s ease;background-color:var(--color-background)}.tc-add-row{margin-top:1px}.tc-add-row:hover:before{transition:.1s;background-color:var(--color-background)}.tc-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(10px,1fr));position:relative;border-bottom:1px solid var(--color-border)}.tc-row:after{content:"";pointer-events:none;position:absolute;width:var(--cell-size);height:100%;bottom:-1px;right:calc(var(--cell-size)*-1);border-bottom:1px solid var(--color-border)}.tc-row--selected{background:var(--color-background)}.tc-row--selected:after{background:var(--color-background)}.tc-cell{border-right:1px solid var(--color-border);padding:6px 12px;overflow:hidden;outline:none;line-break:normal}.tc-cell--selected{background:var(--color-background)}.tc-wrap--readonly .tc-row:after{display:none}.tc-toolbox{--toolbox-padding:6px;--popover-margin:30px;--toggler-click-zone-size:30px;--toggler-dots-color:#7b7e89;--toggler-dots-color-hovered:#1d202b;position:absolute;cursor:pointer;z-index:1;opacity:0;transition:opacity .1s;will-change:left,opacity}.tc-toolbox--column{top:calc(var(--toggler-click-zone-size)*-1);transform:translate(calc(var(--toggler-click-zone-size)*-1/2));will-change:left,opacity}.tc-toolbox--row{left:calc(var(--popover-margin)*-1);transform:translateY(calc(var(--toggler-click-zone-size)*-1/2));margin-top:-1px;will-change:top,opacity}.tc-toolbox--showed{opacity:1}.tc-toolbox .tc-popover{position:absolute;top:0;left:var(--popover-margin)}.tc-toolbox__toggler{display:flex;align-items:center;justify-content:center;width:var(--toggler-click-zone-size);height:var(--toggler-click-zone-size);color:var(--toggler-dots-color);opacity:0;transition:opacity .15s ease;will-change:opacity}.tc-toolbox__toggler:hover{color:var(--toggler-dots-color-hovered)}.tc-toolbox__toggler svg{fill:currentColor}.tc-wrap:hover .tc-toolbox__toggler{opacity:1}.tc-settings .cdx-settings-button{width:50%;margin:0}.tc-popover{--color-border:#eaeaea;--color-background:#fff;--color-background-hover:rgba(232,232,235,.49);--color-background-confirm:#e24a4a;--color-background-confirm-hover:#d54040;--color-text-confirm:#fff;background:var(--color-background);border:1px solid var(--color-border);box-shadow:0 3px 15px -3px #0d142121;border-radius:6px;padding:6px;display:none;will-change:opacity,transform}.tc-popover--opened{display:block;animation:menuShowing .1s cubic-bezier(.215,.61,.355,1) forwards}.tc-popover__item{display:flex;align-items:center;padding:2px 14px 2px 2px;border-radius:5px;cursor:pointer;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;user-select:none}.tc-popover__item:hover{background:var(--color-background-hover)}.tc-popover__item:not(:last-of-type){margin-bottom:2px}.tc-popover__item-icon{display:inline-flex;width:26px;height:26px;align-items:center;justify-content:center;background:var(--color-background);border-radius:5px;border:1px solid var(--color-border);margin-right:8px}.tc-popover__item-label{line-height:22px;font-size:14px;font-weight:500}.tc-popover__item--confirm{background:var(--color-background-confirm);color:var(--color-text-confirm)}.tc-popover__item--confirm:hover{background-color:var(--color-background-confirm-hover)}.tc-popover__item--confirm .tc-popover__item-icon{background:var(--color-background-confirm);border-color:#0000001a}.tc-popover__item--confirm .tc-popover__item-icon svg{transition:transform .2s ease-in;transform:rotate(90deg) scale(1.2)}.tc-popover__item--hidden{display:none}@keyframes menuShowing{0%{opacity:0;transform:translateY(-8px) scale(.9)}70%{opacity:1;transform:translateY(2px)}to{transform:translateY(0)}}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();function Kn(n,e,t={}){const o=document.createElement(n);Array.isArray(e)?o.classList.add(...e):e&&o.classList.add(e);for(const a in t)Object.prototype.hasOwnProperty.call(t,a)&&(o[a]=t[a]);return o}function E8(n){const e=n.getBoundingClientRect();return{y1:Math.floor(e.top+window.pageYOffset),x1:Math.floor(e.left+window.pageXOffset),x2:Math.floor(e.right+window.pageXOffset),y2:Math.floor(e.bottom+window.pageYOffset)}}function S8(n,e){const t=E8(n),o=E8(e);return{fromTopBorder:o.y1-t.y1,fromLeftBorder:o.x1-t.x1,fromRightBorder:t.x2-o.x2,fromBottomBorder:t.y2-o.y2}}function yq(n,e){const t=n.getBoundingClientRect(),{width:o,height:a,x:i,y:r}=t,{clientX:s,clientY:l}=e;return{width:o,height:a,x:s-i,y:l-r}}function I8(n,e){return e.parentNode.insertBefore(n,e)}function M8(n,e=!0){const t=document.createRange(),o=window.getSelection();t.selectNodeContents(n),t.collapse(e),o.removeAllRanges(),o.addRange(t)}let Cq=class oo{constructor({items:e}){this.items=e,this.wrapper=void 0,this.itemEls=[]}static get CSS(){return{popover:"tc-popover",popoverOpened:"tc-popover--opened",item:"tc-popover__item",itemHidden:"tc-popover__item--hidden",itemConfirmState:"tc-popover__item--confirm",itemIcon:"tc-popover__item-icon",itemLabel:"tc-popover__item-label"}}render(){return this.wrapper=Kn("div",oo.CSS.popover),this.items.forEach((e,t)=>{const o=Kn("div",oo.CSS.item),a=Kn("div",oo.CSS.itemIcon,{innerHTML:e.icon}),i=Kn("div",oo.CSS.itemLabel,{textContent:e.label});o.dataset.index=t,o.appendChild(a),o.appendChild(i),this.wrapper.appendChild(o),this.itemEls.push(o)}),this.wrapper.addEventListener("click",e=>{this.popoverClicked(e)}),this.wrapper}popoverClicked(e){const t=e.target.closest(`.${oo.CSS.item}`);if(!t)return;const o=t.dataset.index,a=this.items[o];if(a.confirmationRequired&&!this.hasConfirmationState(t)){this.setConfirmationState(t);return}a.onClick()}setConfirmationState(e){e.classList.add(oo.CSS.itemConfirmState)}clearConfirmationState(e){e.classList.remove(oo.CSS.itemConfirmState)}hasConfirmationState(e){return e.classList.contains(oo.CSS.itemConfirmState)}get opened(){return this.wrapper.classList.contains(oo.CSS.popoverOpened)}open(){this.items.forEach((e,t)=>{typeof e.hideIf=="function"&&this.itemEls[t].classList.toggle(oo.CSS.itemHidden,e.hideIf())}),this.wrapper.classList.add(oo.CSS.popoverOpened)}close(){this.wrapper.classList.remove(oo.CSS.popoverOpened),this.itemEls.forEach(e=>{this.clearConfirmationState(e)})}};const kq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 9L10 12M10 12L7 15M10 12H4"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 9L14 12M14 12L17 15M14 12H20"/></svg>',B8='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 8L12 12M12 12L16 16M12 12L16 8M12 12L8 16"/></svg>',wq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.8833 9.16666L18.2167 12.5M18.2167 12.5L14.8833 15.8333M18.2167 12.5H10.05C9.16594 12.5 8.31809 12.1488 7.69297 11.5237C7.06785 10.8986 6.71666 10.0507 6.71666 9.16666"/></svg>',jq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.9167 14.9167L11.5833 18.25M11.5833 18.25L8.25 14.9167M11.5833 18.25L11.5833 10.0833C11.5833 9.19928 11.9345 8.35143 12.5596 7.72631C13.1848 7.10119 14.0326 6.75 14.9167 6.75"/></svg>',_q='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.13333 14.9167L12.4667 18.25M12.4667 18.25L15.8 14.9167M12.4667 18.25L12.4667 10.0833C12.4667 9.19928 12.1155 8.35143 11.4904 7.72631C10.8652 7.10119 10.0174 6.75 9.13333 6.75"/></svg>',xq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.8833 15.8333L18.2167 12.5M18.2167 12.5L14.8833 9.16667M18.2167 12.5L10.05 12.5C9.16595 12.5 8.31811 12.8512 7.69299 13.4763C7.06787 14.1014 6.71667 14.9493 6.71667 15.8333"/></svg>',Dq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.41 9.66H9.4"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 9.66H14.59"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.31 14.36H9.3"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 14.36H14.59"/></svg>',T8='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12 7V12M12 17V12M17 12H12M12 12H7"/></svg>',Fq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 9L20 12L17 15"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 12H20"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 9L4 12L7 15"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 12H10"/></svg>',Eq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-width="2" d="M5 10H19"/><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/></svg>',Sq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-width="2" d="M10 5V18.5"/><path stroke="currentColor" stroke-width="2" d="M14 5V18.5"/><path stroke="currentColor" stroke-width="2" d="M5 10H19"/><path stroke="currentColor" stroke-width="2" d="M5 14H19"/><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/></svg>',Iq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-width="2" d="M10 5V18.5"/><path stroke="currentColor" stroke-width="2" d="M5 10H19"/><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/></svg>';let A8=class gl{constructor({api:e,items:t,onOpen:o,onClose:a,cssModifier:i=""}){this.api=e,this.items=t,this.onOpen=o,this.onClose=a,this.cssModifier=i,this.popover=null,this.wrapper=this.createToolbox()}static get CSS(){return{toolbox:"tc-toolbox",toolboxShowed:"tc-toolbox--showed",toggler:"tc-toolbox__toggler"}}get element(){return this.wrapper}createToolbox(){const e=Kn("div",[gl.CSS.toolbox,this.cssModifier?`${gl.CSS.toolbox}--${this.cssModifier}`:""]);e.dataset.mutationFree="true";const t=this.createPopover(),o=this.createToggler();return e.appendChild(o),e.appendChild(t),e}createToggler(){const e=Kn("div",gl.CSS.toggler,{innerHTML:Dq});return e.addEventListener("click",()=>{this.togglerClicked()}),e}createPopover(){return this.popover=new Cq({items:this.items}),this.popover.render()}togglerClicked(){this.popover.opened?(this.popover.close(),this.onClose()):(this.popover.open(),this.onOpen())}show(e){const t=e();Object.entries(t).forEach(([o,a])=>{this.wrapper.style[o]=a}),this.wrapper.classList.add(gl.CSS.toolboxShowed)}hide(){this.popover.close(),this.wrapper.classList.remove(gl.CSS.toolboxShowed)}};function Mq(n,e){let t=0;return function(...o){const a=new Date().getTime();if(!(a-t<n))return t=a,e(...o)}}const Me={wrapper:"tc-wrap",wrapperReadOnly:"tc-wrap--readonly",table:"tc-table",row:"tc-row",withHeadings:"tc-table--heading",rowSelected:"tc-row--selected",cell:"tc-cell",cellSelected:"tc-cell--selected",addRow:"tc-add-row",addRowDisabled:"tc-add-row--disabled",addColumn:"tc-add-column",addColumnDisabled:"tc-add-column--disabled"};let Bq=class{constructor(e,t,o,a){this.readOnly=e,this.api=t,this.data=o,this.config=a,this.wrapper=null,this.table=null,this.toolboxColumn=this.createColumnToolbox(),this.toolboxRow=this.createRowToolbox(),this.createTableWrapper(),this.hoveredRow=0,this.hoveredColumn=0,this.selectedRow=0,this.selectedColumn=0,this.tunes={withHeadings:!1},this.resize(),this.fill(),this.focusedCell={row:0,column:0},this.documentClicked=i=>{const r=i.target.closest(`.${Me.table}`)!==null,s=i.target.closest(`.${Me.wrapper}`)===null;(r||s)&&this.hideToolboxes();const l=i.target.closest(`.${Me.addRow}`),d=i.target.closest(`.${Me.addColumn}`);l&&l.parentNode===this.wrapper?(this.addRow(void 0,!0),this.hideToolboxes()):d&&d.parentNode===this.wrapper&&(this.addColumn(void 0,!0),this.hideToolboxes())},this.readOnly||this.bindEvents()}getWrapper(){return this.wrapper}bindEvents(){document.addEventListener("click",this.documentClicked),this.table.addEventListener("mousemove",Mq(150,e=>this.onMouseMoveInTable(e)),{passive:!0}),this.table.onkeypress=e=>this.onKeyPressListener(e),this.table.addEventListener("keydown",e=>this.onKeyDownListener(e)),this.table.addEventListener("focusin",e=>this.focusInTableListener(e))}createColumnToolbox(){return new A8({api:this.api,cssModifier:"column",items:[{label:this.api.i18n.t("Add column to left"),icon:jq,hideIf:()=>this.numberOfColumns===this.config.maxcols,onClick:()=>{this.addColumn(this.selectedColumn,!0),this.hideToolboxes()}},{label:this.api.i18n.t("Add column to right"),icon:_q,hideIf:()=>this.numberOfColumns===this.config.maxcols,onClick:()=>{this.addColumn(this.selectedColumn+1,!0),this.hideToolboxes()}},{label:this.api.i18n.t("Delete column"),icon:B8,hideIf:()=>this.numberOfColumns===1,confirmationRequired:!0,onClick:()=>{this.deleteColumn(this.selectedColumn),this.hideToolboxes()}}],onOpen:()=>{this.selectColumn(this.hoveredColumn),this.hideRowToolbox()},onClose:()=>{this.unselectColumn()}})}createRowToolbox(){return new A8({api:this.api,cssModifier:"row",items:[{label:this.api.i18n.t("Add row above"),icon:xq,hideIf:()=>this.numberOfRows===this.config.maxrows,onClick:()=>{this.addRow(this.selectedRow,!0),this.hideToolboxes()}},{label:this.api.i18n.t("Add row below"),icon:wq,hideIf:()=>this.numberOfRows===this.config.maxrows,onClick:()=>{this.addRow(this.selectedRow+1,!0),this.hideToolboxes()}},{label:this.api.i18n.t("Delete row"),icon:B8,hideIf:()=>this.numberOfRows===1,confirmationRequired:!0,onClick:()=>{this.deleteRow(this.selectedRow),this.hideToolboxes()}}],onOpen:()=>{this.selectRow(this.hoveredRow),this.hideColumnToolbox()},onClose:()=>{this.unselectRow()}})}moveCursorToNextRow(){this.focusedCell.row!==this.numberOfRows?(this.focusedCell.row+=1,this.focusCell(this.focusedCell)):(this.addRow(),this.focusedCell.row+=1,this.focusCell(this.focusedCell),this.updateToolboxesPosition(0,0))}getCell(e,t){return this.table.querySelectorAll(`.${Me.row}:nth-child(${e}) .${Me.cell}`)[t-1]}getRow(e){return this.table.querySelector(`.${Me.row}:nth-child(${e})`)}getRowByCell(e){return e.parentElement}getRowFirstCell(e){return e.querySelector(`.${Me.cell}:first-child`)}setCellContent(e,t,o){const a=this.getCell(e,t);a.innerHTML=o}addColumn(e=-1,t=!1){var o;let a=this.numberOfColumns;if(this.config&&this.config.maxcols&&this.numberOfColumns>=this.config.maxcols)return;for(let r=1;r<=this.numberOfRows;r++){let s;const l=this.createCell();if(e>0&&e<=a?(s=this.getCell(r,e),I8(l,s)):s=this.getRow(r).appendChild(l),r===1){const d=this.getCell(r,e>0?e:a+1);d&&t&&M8(d)}}const i=this.wrapper.querySelector(`.${Me.addColumn}`);(o=this.config)!=null&&o.maxcols&&this.numberOfColumns>this.config.maxcols-1&&i&&i.classList.add(Me.addColumnDisabled),this.addHeadingAttrToFirstRow()}addRow(e=-1,t=!1){let o,a=Kn("div",Me.row);this.tunes.withHeadings&&this.removeHeadingAttrFromFirstRow();let i=this.numberOfColumns;if(this.config&&this.config.maxrows&&this.numberOfRows>=this.config.maxrows&&s)return;if(e>0&&e<=this.numberOfRows){let l=this.getRow(e);o=I8(a,l)}else o=this.table.appendChild(a);this.fillRow(o,i),this.tunes.withHeadings&&this.addHeadingAttrToFirstRow();const r=this.getRowFirstCell(o);r&&t&&M8(r);const s=this.wrapper.querySelector(`.${Me.addRow}`);return this.config&&this.config.maxrows&&this.numberOfRows>=this.config.maxrows&&s&&s.classList.add(Me.addRowDisabled),o}deleteColumn(e){for(let o=1;o<=this.numberOfRows;o++){const a=this.getCell(o,e);if(!a)return;a.remove()}const t=this.wrapper.querySelector(`.${Me.addColumn}`);t&&t.classList.remove(Me.addColumnDisabled)}deleteRow(e){this.getRow(e).remove();const t=this.wrapper.querySelector(`.${Me.addRow}`);t&&t.classList.remove(Me.addRowDisabled),this.addHeadingAttrToFirstRow()}createTableWrapper(){if(this.wrapper=Kn("div",Me.wrapper),this.table=Kn("div",Me.table),this.readOnly&&this.wrapper.classList.add(Me.wrapperReadOnly),this.wrapper.appendChild(this.toolboxRow.element),this.wrapper.appendChild(this.toolboxColumn.element),this.wrapper.appendChild(this.table),!this.readOnly){const e=Kn("div",Me.addColumn,{innerHTML:T8}),t=Kn("div",Me.addRow,{innerHTML:T8});this.wrapper.appendChild(e),this.wrapper.appendChild(t)}}computeInitialSize(){const e=this.data&&this.data.content,t=Array.isArray(e),o=t?e.length:!1,a=t?e.length:void 0,i=o?e[0].length:void 0,r=Number.parseInt(this.config&&this.config.rows),s=Number.parseInt(this.config&&this.config.cols),l=!isNaN(r)&&r>0?r:void 0,d=!isNaN(s)&&s>0?s:void 0;return{rows:a||l||2,cols:i||d||2}}resize(){const{rows:e,cols:t}=this.computeInitialSize();for(let o=0;o<e;o++)this.addRow();for(let o=0;o<t;o++)this.addColumn()}fill(){const e=this.data;if(e&&e.content)for(let t=0;t<e.content.length;t++)for(let o=0;o<e.content[t].length;o++)this.setCellContent(t+1,o+1,e.content[t][o])}fillRow(e,t){for(let o=1;o<=t;o++){const a=this.createCell();e.appendChild(a)}}createCell(){return Kn("div",Me.cell,{contentEditable:!this.readOnly})}get numberOfRows(){return this.table.childElementCount}get numberOfColumns(){return this.numberOfRows?this.table.querySelectorAll(`.${Me.row}:first-child .${Me.cell}`).length:0}get isColumnMenuShowing(){return this.selectedColumn!==0}get isRowMenuShowing(){return this.selectedRow!==0}onMouseMoveInTable(e){const{row:t,column:o}=this.getHoveredCell(e);this.hoveredColumn=o,this.hoveredRow=t,this.updateToolboxesPosition()}onKeyPressListener(e){if(e.key==="Enter"){if(e.shiftKey)return!0;this.moveCursorToNextRow()}return e.key!=="Enter"}onKeyDownListener(e){e.key==="Tab"&&e.stopPropagation()}focusInTableListener(e){const t=e.target,o=this.getRowByCell(t);this.focusedCell={row:Array.from(this.table.querySelectorAll(`.${Me.row}`)).indexOf(o)+1,column:Array.from(o.querySelectorAll(`.${Me.cell}`)).indexOf(t)+1}}hideToolboxes(){this.hideRowToolbox(),this.hideColumnToolbox(),this.updateToolboxesPosition()}hideRowToolbox(){this.unselectRow(),this.toolboxRow.hide()}hideColumnToolbox(){this.unselectColumn(),this.toolboxColumn.hide()}focusCell(){this.focusedCellElem.focus()}get focusedCellElem(){const{row:e,column:t}=this.focusedCell;return this.getCell(e,t)}updateToolboxesPosition(e=this.hoveredRow,t=this.hoveredColumn){this.isColumnMenuShowing||t>0&&t<=this.numberOfColumns&&this.toolboxColumn.show(()=>({left:`calc((100% - var(--cell-size)) / (${this.numberOfColumns} * 2) * (1 + (${t} - 1) * 2))`})),this.isRowMenuShowing||e>0&&e<=this.numberOfRows&&this.toolboxRow.show(()=>{const o=this.getRow(e),{fromTopBorder:a}=S8(this.table,o),{height:i}=o.getBoundingClientRect();return{top:`${Math.ceil(a+i/2)}px`}})}setHeadingsSetting(e){this.tunes.withHeadings=e,e?(this.table.classList.add(Me.withHeadings),this.addHeadingAttrToFirstRow()):(this.table.classList.remove(Me.withHeadings),this.removeHeadingAttrFromFirstRow())}addHeadingAttrToFirstRow(){for(let e=1;e<=this.numberOfColumns;e++){let t=this.getCell(1,e);t&&t.setAttribute("heading",this.api.i18n.t("Heading"))}}removeHeadingAttrFromFirstRow(){for(let e=1;e<=this.numberOfColumns;e++){let t=this.getCell(1,e);t&&t.removeAttribute("heading")}}selectRow(e){const t=this.getRow(e);t&&(this.selectedRow=e,t.classList.add(Me.rowSelected))}unselectRow(){if(this.selectedRow<=0)return;const e=this.table.querySelector(`.${Me.rowSelected}`);e&&e.classList.remove(Me.rowSelected),this.selectedRow=0}selectColumn(e){for(let t=1;t<=this.numberOfRows;t++){const o=this.getCell(t,e);o&&o.classList.add(Me.cellSelected)}this.selectedColumn=e}unselectColumn(){if(this.selectedColumn<=0)return;let e=this.table.querySelectorAll(`.${Me.cellSelected}`);Array.from(e).forEach(t=>{t.classList.remove(Me.cellSelected)}),this.selectedColumn=0}getHoveredCell(e){let t=this.hoveredRow,o=this.hoveredColumn;const{width:a,height:i,x:r,y:s}=yq(this.table,e);return r>=0&&(o=this.binSearch(this.numberOfColumns,l=>this.getCell(1,l),({fromLeftBorder:l})=>r<l,({fromRightBorder:l})=>r>a-l)),s>=0&&(t=this.binSearch(this.numberOfRows,l=>this.getCell(l,1),({fromTopBorder:l})=>s<l,({fromBottomBorder:l})=>s>i-l)),{row:t||this.hoveredRow,column:o||this.hoveredColumn}}binSearch(e,t,o,a){let i=0,r=e+1,s=0,l;for(;i<r-1&&s<10;){l=Math.ceil((i+r)/2);const d=t(l),u=S8(this.table,d);if(o(u))r=l;else if(a(u))i=l;else break;s++}return l}getData(){const e=[];for(let t=1;t<=this.numberOfRows;t++){const o=this.table.querySelector(`.${Me.row}:nth-child(${t})`),a=Array.from(o.querySelectorAll(`.${Me.cell}`));a.every(i=>!i.textContent.trim())||e.push(a.map(i=>i.innerHTML))}return e}destroy(){document.removeEventListener("click",this.documentClicked)}},Tq=class{static get isReadOnlySupported(){return!0}static get enableLineBreaks(){return!0}constructor({data:e,config:t,api:o,readOnly:a,block:i}){this.api=o,this.readOnly=a,this.config=t,this.data={withHeadings:this.getConfig("withHeadings",!1,e),stretched:this.getConfig("stretched",!1,e),content:e&&e.content?e.content:[]},this.table=null,this.block=i}static get toolbox(){return{icon:Iq,title:"Table"}}render(){return this.table=new Bq(this.readOnly,this.api,this.data,this.config),this.container=Kn("div",this.api.styles.block),this.container.appendChild(this.table.getWrapper()),this.table.setHeadingsSetting(this.data.withHeadings),this.container}renderSettings(){return[{label:this.api.i18n.t("With headings"),icon:Eq,isActive:this.data.withHeadings,closeOnActivate:!0,toggle:!0,onActivate:()=>{this.data.withHeadings=!0,this.table.setHeadingsSetting(this.data.withHeadings)}},{label:this.api.i18n.t("Without headings"),icon:Sq,isActive:!this.data.withHeadings,closeOnActivate:!0,toggle:!0,onActivate:()=>{this.data.withHeadings=!1,this.table.setHeadingsSetting(this.data.withHeadings)}},{label:this.data.stretched?this.api.i18n.t("Collapse"):this.api.i18n.t("Stretch"),icon:this.data.stretched?kq:Fq,closeOnActivate:!0,toggle:!0,onActivate:()=>{this.data.stretched=!this.data.stretched,this.block.stretched=this.data.stretched}}]}save(){const e=this.table.getData();return{withHeadings:this.data.withHeadings,stretched:this.data.stretched,content:e}}destroy(){this.table.destroy()}getConfig(e,t=void 0,o=void 0){const a=this.data||o;return a?a[e]?a[e]:t:this.config&&this.config[e]?this.config[e]:t}static get pasteConfig(){return{tags:["TABLE","TR","TH","TD"]}}onPaste(e){const t=e.detail.data,o=t.querySelector(":scope > thead, tr:first-of-type th"),a=Array.from(t.querySelectorAll("tr")).map(i=>Array.from(i.querySelectorAll("th, td")).map(r=>r.innerHTML));this.data={withHeadings:o!==null,content:a},this.table.wrapper&&this.table.wrapper.replaceWith(this.render())}};(function(){try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode(".ce-code__textarea{min-height:200px;font-family:Menlo,Monaco,Consolas,Courier New,monospace;color:#41314e;line-height:1.6em;font-size:12px;background:#f8f7fa;border:1px solid #f1f1f4;box-shadow:none;white-space:pre;word-wrap:normal;overflow-x:auto;resize:vertical}")),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();function Aq(n,e){let t="";for(;t!==`
43
43
  `&&e>0;)e=e-1,t=n.substr(e,1);return t===`
44
44
  `&&(e+=1),e}const Oq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 8L5 12L9 16"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 8L19 12L15 16"/></svg>';let Lq=class Ax{static get isReadOnlySupported(){return!0}static get enableLineBreaks(){return!0}constructor({data:e,config:t,api:o,readOnly:a}){this.api=o,this.readOnly=a,this.placeholder=this.api.i18n.t(t.placeholder||Ax.DEFAULT_PLACEHOLDER),this.CSS={baseClass:this.api.styles.block,input:this.api.styles.input,wrapper:"ce-code",textarea:"ce-code__textarea"},this.nodes={holder:null,textarea:null},this.data={code:e.code??""},this.nodes.holder=this.drawView()}render(){return this.nodes.holder}save(e){return{code:e.querySelector("textarea").value}}onPaste(e){if(e.type==="tag"){const t=e.detail.data;this.handleHTMLPaste(t)}}get data(){return this._data}set data(e){this._data=e,this.nodes.textarea&&(this.nodes.textarea.value=e.code)}static get toolbox(){return{icon:Oq,title:"Code"}}static get DEFAULT_PLACEHOLDER(){return"Enter a code"}static get pasteConfig(){return{tags:["pre"]}}static get sanitize(){return{code:!0}}tabHandler(e){e.stopPropagation(),e.preventDefault();const t=e.target,o=e.shiftKey,a=t.selectionStart,i=t.value,r=" ";let s;if(!o)s=a+r.length,t.value=i.substring(0,a)+r+i.substring(a);else{const l=Aq(i,a);if(i.substr(l,r.length)!==r)return;t.value=i.substring(0,l)+i.substring(l+r.length),s=a-r.length}t.setSelectionRange(s,s)}drawView(){const e=document.createElement("div"),t=document.createElement("textarea");return e.classList.add(this.CSS.baseClass,this.CSS.wrapper),t.classList.add(this.CSS.textarea,this.CSS.input),t.value=this.data.code,t.placeholder=this.placeholder,this.readOnly&&(t.disabled=!0),e.appendChild(t),t.addEventListener("keydown",o=>{o.code==="Tab"&&this.tabHandler(o)}),this.nodes.textarea=t,e}handleHTMLPaste(e){this.data={code:e.innerHTML}}};(function(){try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode('.ce-delimiter{line-height:1.6em;width:100%;text-align:center}.ce-delimiter:before{display:inline-block;content:"***";font-size:30px;line-height:65px;height:30px;letter-spacing:.2em}')),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const Nq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="6" x2="10" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="14" x2="18" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/></svg>';let Pq=class{static get isReadOnlySupported(){return!0}static get contentless(){return!0}constructor({data:e,config:t,api:o}){this.api=o,this._CSS={block:this.api.styles.block,wrapper:"ce-delimiter"},this._element=this.drawView(),this.data=e}drawView(){let e=document.createElement("div");return e.classList.add(this._CSS.wrapper,this._CSS.block),e}render(){return this._element}save(e){return{}}static get toolbox(){return{icon:Nq,title:"Delimiter"}}static get pasteConfig(){return{tags:["HR"]}}onPaste(e){this.data={}}};(function(){try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode('.cdx-checklist{gap:6px;display:flex;flex-direction:column}.cdx-checklist__item{display:flex;box-sizing:content-box;align-items:flex-start}.cdx-checklist__item-text{outline:none;flex-grow:1;line-height:1.57em}.cdx-checklist__item-checkbox{width:22px;height:22px;display:flex;align-items:center;margin-right:8px;margin-top:calc(.785em - 11px);cursor:pointer}.cdx-checklist__item-checkbox svg{opacity:0;height:20px;width:20px;position:absolute;left:-1px;top:-1px;max-height:20px}@media (hover: hover){.cdx-checklist__item-checkbox:not(.cdx-checklist__item-checkbox--no-hover):hover .cdx-checklist__item-checkbox-check svg{opacity:1}}.cdx-checklist__item-checkbox-check{cursor:pointer;display:inline-block;flex-shrink:0;position:relative;width:20px;height:20px;box-sizing:border-box;margin-left:0;border-radius:5px;border:1px solid #C9C9C9;background:#fff}.cdx-checklist__item-checkbox-check:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;border-radius:100%;background-color:#369fff;visibility:hidden;pointer-events:none;transform:scale(1);transition:transform .4s ease-out,opacity .4s}@media (hover: hover){.cdx-checklist__item--checked .cdx-checklist__item-checkbox:not(.cdx-checklist__item--checked .cdx-checklist__item-checkbox--no-hover):hover .cdx-checklist__item-checkbox-check{background:#0059AB;border-color:#0059ab}}.cdx-checklist__item--checked .cdx-checklist__item-checkbox-check{background:#369FFF;border-color:#369fff}.cdx-checklist__item--checked .cdx-checklist__item-checkbox-check svg{opacity:1}.cdx-checklist__item--checked .cdx-checklist__item-checkbox-check svg path{stroke:#fff}.cdx-checklist__item--checked .cdx-checklist__item-checkbox-check:before{opacity:0;visibility:visible;transform:scale(2.5)}')),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const Rq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7 12L10.4884 15.8372C10.5677 15.9245 10.705 15.9245 10.7844 15.8372L17 9"/></svg>',Vq='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9.2 12L11.0586 13.8586C11.1367 13.9367 11.2633 13.9367 11.3414 13.8586L14.7 10.5"/><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/></svg>';function O8(){const n=document.activeElement,e=window.getSelection().getRangeAt(0),t=e.cloneRange();return t.selectNodeContents(n),t.setStart(e.endContainer,e.endOffset),t.extractContents()}function Hq(n){const e=document.createElement("div");return e.appendChild(n),e.innerHTML}function ic(n,e=null,t={}){const o=document.createElement(n);Array.isArray(e)?o.classList.add(...e):e&&o.classList.add(e);for(const a in t)o[a]=t[a];return o}function L8(n){return n.innerHTML.replace("<br>"," ").trim()}function N8(n,e=!1,t=void 0){const o=document.createRange(),a=window.getSelection();o.selectNodeContents(n),t!==void 0&&(o.setStart(n,t),o.setEnd(n,t)),o.collapse(e),a.removeAllRanges(),a.addRange(o)}Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(n){let e=this;if(!document.documentElement.contains(e))return null;do{if(e.matches(n))return e;e=e.parentElement||e.parentNode}while(e!==null&&e.nodeType===1);return null});let zq=class{static get isReadOnlySupported(){return!0}static get enableLineBreaks(){return!0}static get toolbox(){return{icon:Vq,title:"Checklist"}}static get conversionConfig(){return{export:e=>e.items.map(({text:t})=>t).join(". "),import:e=>({items:[{text:e,checked:!1}]})}}constructor({data:e,config:t,api:o,readOnly:a}){this._elements={wrapper:null,items:[]},this.readOnly=a,this.api=o,this.data=e||{}}render(){return this._elements.wrapper=ic("div",[this.CSS.baseBlock,this.CSS.wrapper]),this.data.items||(this.data.items=[{text:"",checked:!1}]),this.data.items.forEach(e=>{const t=this.createChecklistItem(e);this._elements.wrapper.appendChild(t)}),this.readOnly?this._elements.wrapper:(this._elements.wrapper.addEventListener("keydown",e=>{const[t,o]=[13,8];switch(e.keyCode){case t:this.enterPressed(e);break;case o:this.backspace(e);break}},!1),this._elements.wrapper.addEventListener("click",e=>{this.toggleCheckbox(e)}),this._elements.wrapper)}save(){let e=this.items.map(t=>{const o=this.getItemInput(t);return{text:L8(o),checked:t.classList.contains(this.CSS.itemChecked)}});return e=e.filter(t=>t.text.trim().length!==0),{items:e}}validate(e){return!!e.items.length}toggleCheckbox(e){const t=e.target.closest(`.${this.CSS.item}`),o=t.querySelector(`.${this.CSS.checkboxContainer}`);o.contains(e.target)&&(t.classList.toggle(this.CSS.itemChecked),o.classList.add(this.CSS.noHover),o.addEventListener("mouseleave",()=>this.removeSpecialHoverBehavior(o),{once:!0}))}createChecklistItem(e={}){const t=ic("div",this.CSS.item),o=ic("span",this.CSS.checkbox),a=ic("div",this.CSS.checkboxContainer),i=ic("div",this.CSS.textField,{innerHTML:e.text?e.text:"",contentEditable:!this.readOnly});return e.checked&&t.classList.add(this.CSS.itemChecked),o.innerHTML=Rq,a.appendChild(o),t.appendChild(a),t.appendChild(i),t}enterPressed(e){e.preventDefault();const t=this.items,o=document.activeElement.closest(`.${this.CSS.item}`);if(t.indexOf(o)===t.length-1&&L8(this.getItemInput(o)).length===0){const s=this.api.blocks.getCurrentBlockIndex();o.remove(),this.api.blocks.insert(),this.api.caret.setToBlock(s+1);return}const a=O8(),i=Hq(a),r=this.createChecklistItem({text:i,checked:!1});this._elements.wrapper.insertBefore(r,o.nextSibling),N8(this.getItemInput(r),!0)}backspace(e){const t=e.target.closest(`.${this.CSS.item}`),o=this.items.indexOf(t),a=this.items[o-1];if(!a||window.getSelection().focusOffset!==0)return;e.preventDefault();const i=O8(),r=this.getItemInput(a),s=r.childNodes.length;r.appendChild(i),N8(r,void 0,s),t.remove()}get CSS(){return{baseBlock:this.api.styles.block,wrapper:"cdx-checklist",item:"cdx-checklist__item",itemChecked:"cdx-checklist__item--checked",noHover:"cdx-checklist__item-checkbox--no-hover",checkbox:"cdx-checklist__item-checkbox-check",textField:"cdx-checklist__item-text",checkboxContainer:"cdx-checklist__item-checkbox"}}get items(){return Array.from(this._elements.wrapper.querySelectorAll(`.${this.CSS.item}`))}removeSpecialHoverBehavior(e){e.classList.remove(this.CSS.noHover)}getItemInput(e){return e.querySelector(`.${this.CSS.textField}`)}};function uh(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ph={exports:{}};var P8;function $q(){return P8||(P8=1,(function(n,e){(function(t,o){n.exports=o()})(self,(()=>(()=>{var t={917:function(r,s){var l,d;l=function(u){var p=(function(){function h(f,g){for(var v=0;v<g.length;v++){var b=g[v];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(f,b.key,b)}}return function(f,g,v){return g&&h(f.prototype,g),v&&h(f,v),f}})(),m=(function(){function h(f){(function(g,v){if(!(g instanceof v))throw new TypeError("Cannot call a class as a function")})(this,h),this.target=f,this.isContentEditable=f&&f.contentEditable}return p(h,[{key:"getPos",value:function(){if(document.activeElement!==this.target)return-1;if(this.isContentEditable==="true"){this.target.focus();var f=document.getSelection().getRangeAt(0),g=f.cloneRange();return g.selectNodeContents(this.target),g.setEnd(f.endContainer,f.endOffset),g.toString().length}return this.target.selectionStart}},{key:"setPos",value:function(f){if(this.isContentEditable==="true"){if(f>=0){var g=window.getSelection(),v=this.createRange(this.target,{count:f});v&&(v.collapse(!1),g.removeAllRanges(),g.addRange(v))}}else this.target.setSelectionRange(f,f)}},{key:"createRange",value:function(f,g,v){if(v||((v=document.createRange()).selectNode(f),v.setStart(f,0)),g.count===0)v.setEnd(f,g.count);else if(f&&g.count>0)if(f.nodeType===Node.TEXT_NODE)f.textContent.length<g.count?g.count-=f.textContent.length:(v.setEnd(f,g.count),g.count=0);else for(var b=0;b<f.childNodes.length&&(v=this.createRange(f.childNodes[b],g,v),g.count!==0);b++);return v}}]),h})();u.exports=m},(d=l.apply(s,[r]))===void 0||(r.exports=d)},442:(r,s,l)=>{r.exports=l(917)},633:(r,s,l)=>{var d=l(738).default;function u(){r.exports=u=function(){return m},r.exports.__esModule=!0,r.exports.default=r.exports;var p,m={},h=Object.prototype,f=h.hasOwnProperty,g=Object.defineProperty||function(z,K,G){z[K]=G.value},v=typeof Symbol=="function"?Symbol:{},b=v.iterator||"@@iterator",y=v.asyncIterator||"@@asyncIterator",k=v.toStringTag||"@@toStringTag";function S(z,K,G){return Object.defineProperty(z,K,{value:G,enumerable:!0,configurable:!0,writable:!0}),z[K]}try{S({},"")}catch{S=function(K,G,le){return K[G]=le}}function F(z,K,G,le){var ne=K&&K.prototype instanceof x?K:x,oe=Object.create(ne.prototype),se=new L(le||[]);return g(oe,"_invoke",{value:H(z,G,se)}),oe}function D(z,K,G){try{return{type:"normal",arg:z.call(K,G)}}catch(le){return{type:"throw",arg:le}}}m.wrap=F;var w="suspendedStart",_="suspendedYield",M="executing",I="completed",j={};function x(){}function B(){}function A(){}var E={};S(E,b,(function(){return this}));var T=Object.getPrototypeOf,C=T&&T(T(P([])));C&&C!==h&&f.call(C,b)&&(E=C);var O=A.prototype=x.prototype=Object.create(E);function R(z){["next","throw","return"].forEach((function(K){S(z,K,(function(G){return this._invoke(K,G)}))}))}function V(z,K){function G(ne,oe,se,De){var he=D(z[ne],z,oe);if(he.type!=="throw"){var Ht=he.arg,tt=Ht.value;return tt&&d(tt)=="object"&&f.call(tt,"__await")?K.resolve(tt.__await).then((function(Xe){G("next",Xe,se,De)}),(function(Xe){G("throw",Xe,se,De)})):K.resolve(tt).then((function(Xe){Ht.value=Xe,se(Ht)}),(function(Xe){return G("throw",Xe,se,De)}))}De(he.arg)}var le;g(this,"_invoke",{value:function(ne,oe){function se(){return new K((function(De,he){G(ne,oe,De,he)}))}return le=le?le.then(se,se):se()}})}function H(z,K,G){var le=w;return function(ne,oe){if(le===M)throw Error("Generator is already running");if(le===I){if(ne==="throw")throw oe;return{value:p,done:!0}}for(G.method=ne,G.arg=oe;;){var se=G.delegate;if(se){var De=q(se,G);if(De){if(De===j)continue;return De}}if(G.method==="next")G.sent=G._sent=G.arg;else if(G.method==="throw"){if(le===w)throw le=I,G.arg;G.dispatchException(G.arg)}else G.method==="return"&&G.abrupt("return",G.arg);le=M;var he=D(z,K,G);if(he.type==="normal"){if(le=G.done?I:_,he.arg===j)continue;return{value:he.arg,done:G.done}}he.type==="throw"&&(le=I,G.method="throw",G.arg=he.arg)}}}function q(z,K){var G=K.method,le=z.iterator[G];if(le===p)return K.delegate=null,G==="throw"&&z.iterator.return&&(K.method="return",K.arg=p,q(z,K),K.method==="throw")||G!=="return"&&(K.method="throw",K.arg=new TypeError("The iterator does not provide a '"+G+"' method")),j;var ne=D(le,z.iterator,K.arg);if(ne.type==="throw")return K.method="throw",K.arg=ne.arg,K.delegate=null,j;var oe=ne.arg;return oe?oe.done?(K[z.resultName]=oe.value,K.next=z.nextLoc,K.method!=="return"&&(K.method="next",K.arg=p),K.delegate=null,j):oe:(K.method="throw",K.arg=new TypeError("iterator result is not an object"),K.delegate=null,j)}function $(z){var K={tryLoc:z[0]};1 in z&&(K.catchLoc=z[1]),2 in z&&(K.finallyLoc=z[2],K.afterLoc=z[3]),this.tryEntries.push(K)}function N(z){var K=z.completion||{};K.type="normal",delete K.arg,z.completion=K}function L(z){this.tryEntries=[{tryLoc:"root"}],z.forEach($,this),this.reset(!0)}function P(z){if(z||z===""){var K=z[b];if(K)return K.call(z);if(typeof z.next=="function")return z;if(!isNaN(z.length)){var G=-1,le=function ne(){for(;++G<z.length;)if(f.call(z,G))return ne.value=z[G],ne.done=!1,ne;return ne.value=p,ne.done=!0,ne};return le.next=le}}throw new TypeError(d(z)+" is not iterable")}return B.prototype=A,g(O,"constructor",{value:A,configurable:!0}),g(A,"constructor",{value:B,configurable:!0}),B.displayName=S(A,k,"GeneratorFunction"),m.isGeneratorFunction=function(z){var K=typeof z=="function"&&z.constructor;return!!K&&(K===B||(K.displayName||K.name)==="GeneratorFunction")},m.mark=function(z){return Object.setPrototypeOf?Object.setPrototypeOf(z,A):(z.__proto__=A,S(z,k,"GeneratorFunction")),z.prototype=Object.create(O),z},m.awrap=function(z){return{__await:z}},R(V.prototype),S(V.prototype,y,(function(){return this})),m.AsyncIterator=V,m.async=function(z,K,G,le,ne){ne===void 0&&(ne=Promise);var oe=new V(F(z,K,G,le),ne);return m.isGeneratorFunction(K)?oe:oe.next().then((function(se){return se.done?se.value:oe.next()}))},R(O),S(O,k,"Generator"),S(O,b,(function(){return this})),S(O,"toString",(function(){return"[object Generator]"})),m.keys=function(z){var K=Object(z),G=[];for(var le in K)G.push(le);return G.reverse(),function ne(){for(;G.length;){var oe=G.pop();if(oe in K)return ne.value=oe,ne.done=!1,ne}return ne.done=!0,ne}},m.values=P,L.prototype={constructor:L,reset:function(z){if(this.prev=0,this.next=0,this.sent=this._sent=p,this.done=!1,this.delegate=null,this.method="next",this.arg=p,this.tryEntries.forEach(N),!z)for(var K in this)K.charAt(0)==="t"&&f.call(this,K)&&!isNaN(+K.slice(1))&&(this[K]=p)},stop:function(){this.done=!0;var z=this.tryEntries[0].completion;if(z.type==="throw")throw z.arg;return this.rval},dispatchException:function(z){if(this.done)throw z;var K=this;function G(he,Ht){return oe.type="throw",oe.arg=z,K.next=he,Ht&&(K.method="next",K.arg=p),!!Ht}for(var le=this.tryEntries.length-1;le>=0;--le){var ne=this.tryEntries[le],oe=ne.completion;if(ne.tryLoc==="root")return G("end");if(ne.tryLoc<=this.prev){var se=f.call(ne,"catchLoc"),De=f.call(ne,"finallyLoc");if(se&&De){if(this.prev<ne.catchLoc)return G(ne.catchLoc,!0);if(this.prev<ne.finallyLoc)return G(ne.finallyLoc)}else if(se){if(this.prev<ne.catchLoc)return G(ne.catchLoc,!0)}else{if(!De)throw Error("try statement without catch or finally");if(this.prev<ne.finallyLoc)return G(ne.finallyLoc)}}}},abrupt:function(z,K){for(var G=this.tryEntries.length-1;G>=0;--G){var le=this.tryEntries[G];if(le.tryLoc<=this.prev&&f.call(le,"finallyLoc")&&this.prev<le.finallyLoc){var ne=le;break}}ne&&(z==="break"||z==="continue")&&ne.tryLoc<=K&&K<=ne.finallyLoc&&(ne=null);var oe=ne?ne.completion:{};return oe.type=z,oe.arg=K,ne?(this.method="next",this.next=ne.finallyLoc,j):this.complete(oe)},complete:function(z,K){if(z.type==="throw")throw z.arg;return z.type==="break"||z.type==="continue"?this.next=z.arg:z.type==="return"?(this.rval=this.arg=z.arg,this.method="return",this.next="end"):z.type==="normal"&&K&&(this.next=K),j},finish:function(z){for(var K=this.tryEntries.length-1;K>=0;--K){var G=this.tryEntries[K];if(G.finallyLoc===z)return this.complete(G.completion,G.afterLoc),N(G),j}},catch:function(z){for(var K=this.tryEntries.length-1;K>=0;--K){var G=this.tryEntries[K];if(G.tryLoc===z){var le=G.completion;if(le.type==="throw"){var ne=le.arg;N(G)}return ne}}throw Error("illegal catch attempt")},delegateYield:function(z,K,G){return this.delegate={iterator:P(z),resultName:K,nextLoc:G},this.method==="next"&&(this.arg=p),j}},m}r.exports=u,r.exports.__esModule=!0,r.exports.default=r.exports},738:r=>{function s(l){return r.exports=s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},r.exports.__esModule=!0,r.exports.default=r.exports,s(l)}r.exports=s,r.exports.__esModule=!0,r.exports.default=r.exports},756:(r,s,l)=>{var d=l(633)();r.exports=d;try{regeneratorRuntime=d}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=d:Function("r","regeneratorRuntime = r")(d)}}},o={};function a(r){var s=o[r];if(s!==void 0)return s.exports;var l=o[r]={exports:{}};return t[r].call(l.exports,l,l.exports,a),l.exports}a.n=r=>{var s=r&&r.__esModule?()=>r.default:()=>r;return a.d(s,{a:s}),s},a.d=(r,s)=>{for(var l in s)a.o(s,l)&&!a.o(r,l)&&Object.defineProperty(r,l,{enumerable:!0,get:s[l]})},a.o=(r,s)=>Object.prototype.hasOwnProperty.call(r,s);var i={};return(()=>{function r(F,D,w,_,M,I,j){try{var x=F[I](j),B=x.value}catch(A){return void w(A)}x.done?D(B):Promise.resolve(B).then(_,M)}function s(F){return function(){var D=this,w=arguments;return new Promise((function(_,M){var I=F.apply(D,w);function j(B){r(I,_,M,j,x,"next",B)}function x(B){r(I,_,M,j,x,"throw",B)}j(void 0)}))}}function l(F){return l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(D){return typeof D}:function(D){return D&&typeof Symbol=="function"&&D.constructor===Symbol&&D!==Symbol.prototype?"symbol":typeof D},l(F)}function d(F){var D=(function(w,_){if(l(w)!="object"||!w)return w;var M=w[Symbol.toPrimitive];if(M!==void 0){var I=M.call(w,"string");if(l(I)!="object")return I;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(w)})(F);return l(D)=="symbol"?D:D+""}function u(F,D){if(!(F instanceof D))throw new TypeError("Cannot call a class as a function")}function p(F,D){for(var w=0;w<D.length;w++){var _=D[w];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(F,d(_.key),_)}}function m(F,D,w){return D&&p(F.prototype,D),w&&p(F,w),Object.defineProperty(F,"prototype",{writable:!1}),F}a.d(i,{default:()=>S});var h=a(756),f=a.n(h),g=a(442),v=a.n(g),b=(function(){return m((function F(D,w,_){u(this,F),this.holder=w,this.observer=null,this.debounceTimer=_,this.mutationDebouncer=this.debounce((function(){D()}),this.debounceTimer)}),[{key:"setMutationObserver",value:function(){var F=this,D=this.holder.querySelector(".codex-editor__redactor");this.observer=new MutationObserver((function(w){F.mutationHandler(w)})),this.observer.observe(D,{childList:!0,attributes:!0,subtree:!0,characterData:!0,characterDataOldValue:!0})}},{key:"mutationHandler",value:function(F){var D=this,w=!1;F.forEach((function(_){switch(_.type){case"childList":_.target===D.holder?D.onDestroy():w=!0;break;case"characterData":w=!0;break;case"attributes":_.target.classList.contains("ce-block")||_.target.classList.contains("tc-toolbox")||(w=!0)}})),w&&this.mutationDebouncer()}},{key:"debounce",value:function(F,D){var w,_=this;return function(){for(var M=arguments.length,I=new Array(M),j=0;j<M;j++)I[j]=arguments[j];var x=_;clearTimeout(w),w=setTimeout((function(){return F.apply(x,I)}),D)}}},{key:"onDestroy",value:function(){var F=new CustomEvent("destroy");document.dispatchEvent(F),this.observer.disconnect()}}])})();function y(F,D){var w=Object.keys(F);if(Object.getOwnPropertySymbols){var _=Object.getOwnPropertySymbols(F);D&&(_=_.filter((function(M){return Object.getOwnPropertyDescriptor(F,M).enumerable}))),w.push.apply(w,_)}return w}function k(F){for(var D=1;D<arguments.length;D++){var w=arguments[D]!=null?arguments[D]:{};D%2?y(Object(w),!0).forEach((function(_){var M,I,j;M=F,I=_,j=w[_],(I=d(I))in M?Object.defineProperty(M,I,{value:j,enumerable:!0,configurable:!0,writable:!0}):M[I]=j})):Object.getOwnPropertyDescriptors?Object.defineProperties(F,Object.getOwnPropertyDescriptors(w)):y(Object(w)).forEach((function(_){Object.defineProperty(F,_,Object.getOwnPropertyDescriptor(w,_))}))}return F}var S=(function(){return m((function I(j){var x=this,B=j.editor,A=j.config,E=A===void 0?{}:A,T=j.onUpdate,C=j.maxLength;u(this,I);var O={maxLength:30,onUpdate:function(){},config:{debounceTimer:200,shortcuts:{undo:["CMD+Z"],redo:["CMD+Y","CMD+SHIFT+Z"]}}},R=B.blocks,V=B.caret,H=B.configuration,q=H.holder,$=H.defaultBlock,N=O.config.shortcuts,L=E.shortcuts,P=k(k({},N),L),z=Array.isArray(P.undo)?P.undo:[P.undo],K=Array.isArray(P.redo)?P.redo:[P.redo],G=O.config.debounceTimer,le=E.debounceTimer,ne=le===void 0?G:le;this.holder=typeof q=="string"?document.getElementById(q):q,this.editor=B,this.defaultBlock=$,this.blocks=R,this.caret=V,this.shouldSaveHistory=!0,this.readOnly=H.readOnly,this.maxLength=C||O.maxLength,this.onUpdate=T||O.onUpdate,this.config={debounceTimer:ne,shortcuts:{undo:z,redo:K}},new b((function(){return x.registerChange()}),this.holder,this.config.debounceTimer).setMutationObserver(),this.setEventListeners(),this.initialItem=null,this.clear()}),[{key:"truncate",value:function(I,j){for(;I.length>j;)I.shift()}},{key:"initialize",value:function(I){var j="blocks"in I?I.blocks:I,x={index:j.length-1,state:j};this.stack[0]=x,this.initialItem=x}},{key:"clear",value:function(){this.stack=this.initialItem?[this.initialItem]:[{index:0,state:[{type:this.defaultBlock,data:{}}]}],this.position=0,this.onUpdate()}},{key:"setReadOnly",value:function(){var I=this.holder.querySelector(".ce-toolbox");this.readOnly=!I}},{key:"registerChange",value:function(){var I=this;this.setReadOnly(),this.readOnly||(this.editor&&this.editor.save&&this.shouldSaveHistory&&this.editor.save().then((function(j){I.editorDidUpdate(j.blocks)&&I.save(j.blocks)})),this.shouldSaveHistory=!0)}},{key:"editorDidUpdate",value:function(I){var j=this.stack[this.position].state;return!!I.length&&(I.length!==j.length||JSON.stringify(j)!==JSON.stringify(I))}},{key:"save",value:function(I){this.position>=this.maxLength&&this.truncate(this.stack,this.maxLength),this.position=Math.min(this.position,this.stack.length-1),this.stack=this.stack.slice(0,this.position+1);var j=this.blocks.getCurrentBlockIndex(),x=this.blocks.getBlocksCount(),B=j;I[j]||(B-=x-I.length);var A=!I[B]||I[B].type!=="paragraph"&&I[B].type!=="header"?null:this.getCaretIndex(j);this.stack.push({index:B,state:I,caretIndex:A}),this.position+=1,this.onUpdate()}},{key:"getCaretIndex",value:function(I){var j=this.holder.getElementsByClassName("ce-block__content");return new(v())(j[I].firstChild).getPos()}},{key:"insertDeletedBlock",value:function(I,j,x){for(var B=0;B<I.length;B+=1)if(!j[B]||I[B].id!==j[B].id){this.blocks.insert(I[B].type,I[B].data,{},B,!0),this.caret.setToBlock(x,"end");break}}},{key:"blockWasDropped",value:function(I,j){return I.length===j.length&&I.some((function(x,B){return x.id!==j[B].id}))}},{key:"blockWasSkipped",value:function(I,j){return I.length!==j.length}},{key:"contentChangedInNoFocusBlock",value:function(I,j){return I!==j}},{key:"blockWasDeleted",value:function(I,j){return I.length>j.length}},{key:"contentWasCopied",value:function(I,j,x){return Object.keys(I[x].data).length===0&&JSON.stringify(j[x+1])!==JSON.stringify(I[x+1])}},{key:"undo",value:(M=s(f().mark((function I(){var j,x,B,A,E,T,C,O,R,V,H;return f().wrap((function(q){for(;;)switch(q.prev=q.next){case 0:if(!this.canUndo()){q.next=47;break}if(j=this.stack[this.position],x=j.index,B=j.state,this.position-=1,this.shouldSaveHistory=!1,A=this.stack[this.position].index,E=this.stack[this.position],T=E.state,C=E.caretIndex,this.onUpdate(),O=this.blocks.getBlocksCount(),T[A]||(A-=1,this.stack[this.position].index=A),!this.blockWasDeleted(T,B)){q.next=13;break}this.insertDeletedBlock(T,B,A),q.next=42;break;case 13:if(!this.contentWasCopied(T,B,A)){q.next=19;break}return q.next=16,this.blocks.render({blocks:T});case 16:this.caret.setToBlock(A,"end"),q.next=42;break;case 19:if(!(A<x&&this.blockWasSkipped(T,B))){q.next=25;break}return q.next=22,this.blocks.delete(x);case 22:this.caret.setToBlock(A,"end"),q.next=42;break;case 25:if(!(O>T.length)){q.next=31;break}return q.next=28,this.blocks.render({blocks:T});case 28:this.setCaretIndex(A,C),q.next=42;break;case 31:if(!this.blockWasDropped(T,B)){q.next=37;break}return q.next=34,this.blocks.render({blocks:T});case 34:this.caret.setToBlock(A,"end"),q.next=42;break;case 37:if(!this.contentChangedInNoFocusBlock(A,x)){q.next=42;break}return R=this.blocks.getBlockByIndex(x),V=R.id,q.next=41,this.blocks.update(V,T[x].data);case 41:this.setCaretIndex(A,C);case 42:if(!(H=this.blocks.getBlockByIndex(A))){q.next=47;break}return q.next=46,this.blocks.update(H.id,T[A].data);case 46:this.setCaretIndex(A,C);case 47:case"end":return q.stop()}}),I,this)}))),function(){return M.apply(this,arguments)})},{key:"setCaretIndex",value:function(I,j){if(j&&j!==-1){var x=this.holder.getElementsByClassName("ce-block__content"),B=new(v())(x[I].firstChild);setTimeout((function(){return B.setPos(j)}),50)}else this.caret.setToBlock(I,"end")}},{key:"insertBlock",value:(_=s(f().mark((function I(j,x){return f().wrap((function(B){for(;;)switch(B.prev=B.next){case 0:return B.next=2,this.blocks.insert(j[x].type,j[x].data,{},x,!0);case 2:case"end":return B.stop()}}),I,this)}))),function(I,j){return _.apply(this,arguments)})},{key:"insertSkippedBlocks",value:(w=s(f().mark((function I(j,x,B){var A;return f().wrap((function(E){for(;;)switch(E.prev=E.next){case 0:for(A=j.length;A<x.length;A+=1)this.insertBlock(x,A);if(JSON.stringify(j[B-1])===JSON.stringify(x[B-1])){E.next=4;break}return E.next=4,this.updateModifiedBlock(x,B);case 4:case"end":return E.stop()}}),I,this)}))),function(I,j,x){return w.apply(this,arguments)})},{key:"updateModifiedBlock",value:(D=s(f().mark((function I(j,x){var B;return f().wrap((function(A){for(;;)switch(A.prev=A.next){case 0:if(B=j[x-1],!this.editor.blocks.getById(B.id)){A.next=3;break}return A.abrupt("return",this.blocks.update(B.id,B.data));case 3:return A.abrupt("return",this.blocks.render({blocks:j}));case 4:case"end":return A.stop()}}),I,this)}))),function(I,j){return D.apply(this,arguments)})},{key:"redo",value:(F=s(f().mark((function I(){var j,x,B,A,E,T,C;return f().wrap((function(O){for(;;)switch(O.prev=O.next){case 0:if(!this.canRedo()){O.next=27;break}if(this.position+=1,this.shouldSaveHistory=!1,j=this.stack[this.position],x=j.index,B=j.state,A=j.caretIndex,(E=this.stack[this.position-1]).index,T=E.state,!this.blockWasDeleted(T,B)){O.next=11;break}return O.next=8,this.blocks.delete();case 8:this.caret.setToBlock(x,"end"),O.next=21;break;case 11:if(!this.blockWasSkipped(B,T)){O.next=17;break}return O.next=14,this.insertSkippedBlocks(T,B,x);case 14:this.caret.setToBlock(x,"end"),O.next=21;break;case 17:if(!this.blockWasDropped(B,T)||this.position===1){O.next=21;break}return O.next=20,this.blocks.render({blocks:B});case 20:this.caret.setToBlock(x,"end");case 21:if(this.onUpdate(),!(C=this.blocks.getBlockByIndex(x))){O.next=27;break}return O.next=26,this.blocks.update(C.id,B[x].data);case 26:this.setCaretIndex(x,A);case 27:case"end":return O.stop()}}),I,this)}))),function(){return F.apply(this,arguments)})},{key:"canUndo",value:function(){return!this.readOnly&&this.position>0}},{key:"canRedo",value:function(){return!this.readOnly&&this.position<this.count()}},{key:"count",value:function(){return this.stack.length-1}},{key:"parseKeys",value:function(I){var j={CMD:/(Mac)/i.test(navigator.platform)?"metaKey":"ctrlKey",ALT:"altKey",SHIFT:"shiftKey"},x=I.slice(0,-1).map((function(A){return j[A]})),B=x.includes("shiftKey")&&I.length===2?I[I.length-1].toUpperCase():I[I.length-1].toLowerCase();return x.push(B),x}},{key:"setEventListeners",value:function(){var I=this,j=this.holder,x=this.config.shortcuts,B=x.undo,A=x.redo,E=B.map((function($){return $.replace(/ /g,"").split("+")})),T=A.map((function($){return $.replace(/ /g,"").split("+")})),C=E.map((function($){return I.parseKeys($)})),O=T.map((function($){return I.parseKeys($)})),R=function($,N){return N.reduce((function(L,P){return L||(function(z,K){return K.length===3&&z[K[0]]&&z[K[1]]&&z.key.toLowerCase()===K[2]})($,P)}),!1)},V=function($,N,L){return!(!(function(P,z){return z.reduce((function(K,G){return K||(function(le,ne){return ne.length===2&&le[ne[0]]&&le.key.toLowerCase()===ne[1]})(P,G)}),!1)})($,N)||R($,L))||!!R($,N)},H=function($){V($,C,O)&&($.preventDefault(),I.undo())},q=function($){V($,O,C)&&($.preventDefault(),I.redo())};j.addEventListener("keydown",H),j.addEventListener("keydown",q),j.addEventListener("destroy",(function(){j.removeEventListener("keydown",H),j.removeEventListener("keydown",q)}))}}],[{key:"isReadOnlySupported",get:function(){return!0}}]);var F,D,w,_,M})()})(),i.default})()))})(ph)),ph.exports}var Wq=$q();const Uq=uh(Wq);var mh={exports:{}},R8;function qq(){return R8||(R8=1,(function(n,e){(function(t,o){n.exports=o()})(self,(()=>(()=>{var t={523:(r,s,l)=>{l.d(s,{A:()=>h});var d=l(601),u=l.n(d),p=l(314),m=l.n(p)()(u());m.push([r.id,`.ce-block--drop-target .ce-block__content:before {
45
45
  content: "";