@26lights/orcha 0.42.43 → 0.42.44
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/orcha.cjs.js +1 -1
- package/dist/orcha.es.js +1 -1
- package/dist/orcha.umd.js +1 -1
- package/package.json +1 -1
package/dist/orcha.cjs.js
CHANGED
|
@@ -220,7 +220,7 @@ body{height: min-content; overflow: hidden;}
|
|
|
220
220
|
${e.relaceTextAll}
|
|
221
221
|
</button>
|
|
222
222
|
</div>
|
|
223
|
-
</div>`,i=h.utils.createElement("DIV",{class:"se-find-replace"},t);return{panel:i,findInput:i.querySelector(".se-find-replace-input"),replaceInput:i.querySelector(".se-replace-input"),countDisplay:i.querySelector(".se-find-replace-count"),replaceRow:i.querySelector(".se-find-replace-row-replace"),btnCase:i.querySelector(".se-find-opt-case"),btnWord:i.querySelector(".se-find-opt-word"),btnRegex:i.querySelector(".se-find-opt-regex"),btnPrev:i.querySelector('[data-command="prev"]'),btnNext:i.querySelector('[data-command="next"]'),btnReplace:i.querySelector('[data-command="replace"]'),btnReplaceAll:i.querySelector('[data-command="replace-all"]')}}const LA=Cg;class AA{constructor(e){Mr(this,"$");this.$=e.$}}const $A=AA,{isMobile:OA,_w:VA}=me;function RA(s){var n;const e=h.query.getEventTarget(s);let t=e;this.$.store.mode.isBalloon&&!((n=this.$.context.get("toolbar_sub_main"))!=null&&n.contains(t))&&this._hideToolbar_sub();const i=h.check.isInputElement(t);if(i?this.$.store.set("_preventBlur",!1):this.$.frameContext.get("wysiwyg").contains(this.$.selection.getNode())||this.$.focusManager.focus(),h.query.getParentElement(t,".se-dropdown"))s.stopPropagation(),this.$.ui.preventToolbarHide(!0);else{let r=t.getAttribute("data-command"),a=t.className;for(;t&&!r&&!/(se-menu-list|sun-editor-common|se-menu-tray)/.test(a);)t=t.parentElement,r=t.getAttribute("data-command"),a=t.className;if(i&&/^INPUT$/i.test(t==null?void 0:t.getAttribute("data-type"))){if(this.$.store.set("_preventBlur",!0),this._inputFocus=!0,this.$.store.get("hasFocus")||this.applyTagEffect(),!h.check.isInputElement(e)||e.disabled)return;const c=this.$.plugins[r];if(!c||(this.__inputBlurEvent&&this.__removeInput(),typeof c.toolbarInputChange=="function"&&(this.__inputPlugin={obj:c,target:e,value:e.value}),this.__inputBlurEvent=this.$.eventManager.addEvent(e,"blur",d=>{if(!c.isInputActive)try{const u=e.value.trim();typeof c.toolbarInputChange=="function"&&u!==this.__inputPlugin.value&&c.toolbarInputChange({target:e,value:u,event:d})}finally{VA.setTimeout(()=>this._inputFocus=!1,0),this.__removeInput()}}),!c))return;typeof c.toolbarInputKeyDown=="function"&&(this.__inputKeyEvent=this.$.eventManager.addEvent(e,"keydown",d=>{c.toolbarInputKeyDown({target:e,event:d})}))}else if(this.__inputBlurEvent&&this.__inputPlugin){const c=this.__inputPlugin.target.value.trim();c!==this.__inputPlugin.value&&this.__inputPlugin.obj.toolbarInputChange({target:this.__inputPlugin.target,value:c,event:s}),this.__removeInput();return}else this.$.frameContext.get("isCodeView")||(OA?this.$.store.set("_preventBlur",!0):(s.preventDefault(),me.isGecko&&r&&this.$.eventManager._injectActiveEvent(t)));(r===this.$.menu.currentDropdownName||r===this.$.menu.currentContainerName)&&s.stopPropagation()}}function IA(s){const e=h.query.getEventTarget(s),t=h.query.getCommandTarget(e);if(!t)return;let i=t,n="";for(;i&&!/se-menu-tray/.test(i.className)&&!n;)i=i.parentElement,n=i==null?void 0:i.getAttribute("data-key");if(!n)return;const r=this.$.plugins[n];!r||typeof r.action!="function"||(s.stopPropagation(),r.action(t))}function DA(s){const e=h.query.getEventTarget(s);this.$.commandDispatcher.runFromTarget(e)}const{_w:c1}=me,uv=new WeakMap;async function PA(s,e){const t=h.query.getEventTarget(e);if(this.$.store.set("_mousedown",!0),this.__onDownEv&&hv.call(this),this.__onDownEv=this.$.eventManager.addGlobalEvent("mouseup",hv.bind(this)),!(s.get("isReadOnly")||h.check.isNonEditable(s.get("wysiwyg")))){if(this.$.format._isExcludeSelectionElement(t)){e.preventDefault();return}this._setSelectionSync(),c1.setTimeout(this.$.selection.init.bind(this.$.selection),0),await this.$.eventManager.triggerEvent("onMouseDown",{frameContext:s,event:e})!==!1&&await this._callPluginEventAsync("onMouseDown",{frameContext:s,event:e})!==!1&&(this.$.store.mode.isBalloon?this._hideToolbar():this.$.store.mode.isSubBalloon&&this._hideToolbar_sub(),/FIGURE/i.test(t==null?void 0:t.nodeName)&&e.preventDefault())}}function hv(){this.$.store.set("_mousedown",!1),this.__onDownEv=this.$.eventManager.removeGlobalEvent(this.__onDownEv)}async function HA(s,e){await this.$.eventManager.triggerEvent("onMouseUp",{frameContext:s,event:e})!==!1&&await this._callPluginEventAsync("onMouseUp",{frameContext:s,event:e})}async function FA(s,e){const t=h.query.getEventTarget(e);if(s.get("isReadOnly"))return e.preventDefault(),h.check.isAnchor(t)&&c1.open(t.href,t.target),!1;if(h.check.isNonEditable(s.get("wysiwyg"))||await this.$.eventManager.triggerEvent("onClick",{frameContext:s,event:e})===!1||await this._callPluginEventAsync("onClick",{frameContext:s,event:e})===!1)return;const i=this.$.component.get(t);if(i){e.preventDefault(),this.$.component.select(i.target,i.pluginName);return}if(this.$.selection.init(),e.detail===3){const c=this.$.selection.getRange();this.$.format.isLine(c.endContainer)&&c.endOffset===0&&this.$.selection.setRange(c.startContainer,c.startOffset,c.startContainer,c.startContainer.textContent.length)}const n=this.$.selection.getNode(),r=this.$.format.getLine(n,null),a=this.$.format.getBlock(n,null);if(!r&&!h.check.isNonEditable(t)&&!h.check.isList(a)){const c=this.$.selection.getRange();if(this.$.format.getLine(c.startContainer)===this.$.format.getLine(c.endContainer))if(h.check.isList(a)){e.preventDefault();const d=n.nextElementSibling,u=h.utils.createElement("LI",null,n);a.insertBefore(u,d),this.$.focusManager.focus()}else!h.check.isWysiwygFrame(n)&&!this.$.component.is(n)&&(!h.check.isTableElements(n)||h.check.isTableCell(n))&&this._setDefaultLine(this.$.format.isBlock(a)?"DIV":this.$.options.get("defaultLine"))!==null&&(e.preventDefault(),this.$.focusManager.focus())}this.$.commandDispatcher._copyFormat(),(this.$.store.mode.isBalloon||this.$.store.mode.isSubBalloon)&&c1.setTimeout(this._toggleToolbarBalloon.bind(this),0)}function WA(s,e){if(s.get("isReadOnly")||s.get("isDisabled"))return!1;let t=uv.get(s);t||(t={rafId:null,event:null},uv.set(s,t)),t.event=e,t.rafId===null&&(t.rafId=c1.requestAnimationFrame(()=>{var r;const i=t.event;if(t.rafId=null,t.event=null,!i)return;const n=h.query.getEventTarget(i);we.get("__overInfo")!==!1&&!this.$.ui.selectMenuOn&&this.$.component.hoverSelect(n),(r=this.$.ui.blockHandle)==null||r.positionForTarget(n,i.clientY),this._callPluginEvent("onMouseMove",{frameContext:s,event:i})}))}async function zA(s,e){var t;(t=this.$.ui.blockHandle)==null||t.hide(e),await this.$.eventManager.triggerEvent("onMouseLeave",{frameContext:s,event:e})!==!1&&await this._callPluginEventAsync("onMouseLeave",{frameContext:s,event:e})}const jA={"event.prevent":({ctx:s})=>s.e.preventDefault(),"event.stop":({ctx:s})=>s.e.stopPropagation(),"event.prevent.stop":({ctx:s})=>{s.e.preventDefault(),s.e.stopPropagation()},"cache.styleNode":({ports:s})=>s.styleNodeCache(),"cache.formatAttrsTemp":({ports:s},{attrs:e})=>s.formatAttrsTempCache(e),"focusManager.nativeFocus":({ports:s})=>s.focusManager.nativeFocus(),"history.push":({ports:s},e)=>s.history.push(e),"documentType.refreshHeader":({ctx:s})=>{he.setTimeout(()=>{s.fc.get("documentType").reHeader()},0)},"component.deselect":({ports:s})=>s.component.deselect(),"selection.setRange":({ports:s},{sc:e,so:t,ec:i,eo:n})=>s.selection.setRange(e,t,i,n),"format.removeBlock":({ports:s},{rangeEl:e,selectedFormats:t,newBlockElement:i,shouldDelete:n,skipHistory:r})=>s.format.removeBlock(e,{selectedFormats:t,newBlockElement:i,shouldDelete:n,skipHistory:r}),"dom.utils.removeItem":(s,{item:e})=>h.utils.removeItem(e),"select.component.fallback":({ports:s},{cmponentInfo:e})=>{s.component.select(e.target,e.pluginName)===!1&&s.focusManager.blur()}},UA={"del.format.removeAndMove":({ports:s},{container:e,formatEl:t})=>{const i=s.html.remove();if(i.commonCon!==i.container&&t.parentElement)if(t.contains(e)){const n=qA(t);s.selection.setRange(n,n.textContent.length,n,n.textContent.length)}else{const{focusNode:n,focusOffset:r}=ZA(t);s.selection.setRange(n,r,n,r)}},"backspace.brline.strip":({ctx:s,ports:e},{formatEl:t})=>{const i=s.options.get("defaultLine"),n=t.parentNode,r=h.utils.createElement(i);for(;t.firstChild&&!h.check.isBreak(t.firstChild);)r.appendChild(t.firstChild);t.firstChild&&h.check.isBreak(t.firstChild)&&t.removeChild(t.firstChild),r.firstChild||(r.innerHTML="<br>"),n.insertBefore(r,t),(!t.firstChild||!t.textContent.trim()&&!t.querySelector("br"))&&n.removeChild(t);const a=r.firstChild;e.selection.setRange(a,0,a,0)},"backspace.format.maintain":({ctx:s},{formatEl:e})=>{if(e.nodeName.toUpperCase()===s.options.get("defaultLine").toUpperCase()){e.innerHTML="<br>";const t=e.attributes;for(;t[0];)e.removeAttribute(t[0].name)}else e.parentNode.replaceChild(h.utils.createElement(s.options.get("defaultLine"),null,"<br>"),e)},"backspace.component.select":({ports:s},{selectionNode:e,range:t,fileComponentInfo:i})=>{var r;let n=null;h.check.isBreak(e)?h.utils.removeItem(e):h.check.isBreak(n=(r=t.startContainer.childNodes)==null?void 0:r[t.startOffset])&&h.utils.removeItem(n),s.component.select(i.target,i.pluginName)===!1&&s.focusManager.blur()},"backspace.component.remove":({ports:s},{isList:e,sel:t,formatEl:i,fileComponentInfo:n})=>{e&&h.utils.removeItem(t),i.textContent.length===0&&h.utils.removeItem(i),s.component.select(n.target,n.pluginName)===!1&&s.focusManager.blur()},"backspace.list.mergePrev":({ports:s},{prev:e,formatEl:t,rangeEl:i})=>{let n=e===i.parentNode?i.previousSibling:e.lastChild;n||(n=h.utils.createTextNode(Ie.zeroWidthSpace),i.parentNode.insertBefore(n,i.parentNode.firstChild));const r=n.nodeType===3?n.textContent.length:1,a=t.childNodes;let c=n,d=a[0];for(;d=a[0];)e.insertBefore(d,c.nextSibling),c=d;h.utils.removeItem(t),i.children.length===0&&h.utils.removeItem(i),s.selection.setRange(n,r,n,r)},"backspace.list.removeNested":({ports:s},{range:e})=>{s.html.remove(),e.startContainer.nodeType===3&&s.selection.setRange(e.startContainer,e.startContainer.textContent.length,e.startContainer,e.startContainer.textContent.length)},"backspace.emptyLine.mergePrev":({ports:s},{formatEl:e,prev:t})=>{h.utils.removeItem(e),fv(s,t,!0)},"backspace.brline.rowMerge":({ports:s},{rowEndBr:e,rowStartBr:t})=>{const i=t.nextSibling;i!==e&&(i==null?void 0:i.nodeType)===3&&h.check.isZeroWidth(i)&&h.utils.removeItem(i);const n=t.previousSibling;if(h.utils.removeItem(t),n&&n.nodeType===3)s.selection.setRange(n,n.textContent.length,n,n.textContent.length);else if(h.check.isBreak(n))s.selection.setRange(e,0,e,0);else{const r=e.parentNode;s.selection.setRange(r,0,r,0)}},"backspace.softBreak.merge":({ports:s},{zws:e})=>{const t=e.previousSibling,i=e.parentNode,n=t==null?void 0:t.previousSibling;h.utils.removeItem(e),t&&h.utils.removeItem(t),n?d0(s,n):i&&s.selection.setRange(i,0,i,0)},"delete.component.select":({ports:s},{formatEl:e,fileComponentInfo:t})=>{if(h.check.isListCell(e)){const i=t.container.previousSibling;h.check.isZeroWidth(i)&&h.utils.removeItem(i)}else h.check.isZeroWidth(e)&&h.utils.removeItem(e);s.component.select(t.target,t.pluginName)===!1&&s.focusManager.blur()},"delete.component.selectNext":({ports:s,ctx:e},{formatEl:t,nextEl:i})=>{if(h.check.isZeroWidth(t)&&(h.utils.removeItem(t),h.check.isTable(i))){let r=h.query.getEdgeChild(i,h.check.isTableCell,!1);r=r.firstElementChild||r,s.selection.setRange(r,0,r,0);return}const n=s.component.get(i);n?(e.e.stopPropagation(),s.component.select(n.target,n.pluginName)===!1&&s.focusManager.blur()):s.component.is(i)&&(e.e.stopPropagation(),h.utils.removeItem(i))},"delete.list.removeNested":({ports:s,ctx:e},{range:t,formatEl:i,rangeEl:n})=>{t.startContainer!==t.endContainer&&s.html.remove();const r=h.utils.arrayFind(i.children,h.check.isList)||i.nextElementSibling||n.parentElement.nextElementSibling;if(r&&(h.check.isList(r)||h.utils.arrayFind(r.children,h.check.isList))){e.e.preventDefault();let a,c;if(h.check.isList(r)){const d=r.firstElementChild;for(c=d.childNodes,a=c[0];c[0];)i.insertBefore(c[0],r);h.utils.removeItem(d)}else{for(a=r.firstChild,c=r.childNodes;c[0];)i.appendChild(c[0]);h.utils.removeItem(r)}s.selection.setRange(a,0,a,0),s.history.push(!0)}},"delete.emptyLine.mergeNext":({ports:s},{formatEl:e,next:t})=>{h.utils.removeItem(e),fv(s,t,!1)},"line.merge":({ports:s},{into:e,from:t})=>{const i=s.format,n=t.parentElement;pv(e);const r=e.lastChild;for(pv(t);t.firstChild;)e.appendChild(t.firstChild);h.utils.removeItem(t);let a=n;for(;a&&a!==e.parentElement&&i.isBlock(a)&&!i.isClosureBlock(a)&&h.check.isZeroWidth(a);){const c=a.parentElement;h.utils.removeItem(a),a=c}e.firstChild||e.appendChild(h.utils.createElement("BR")),r?d0(s,r):s.selection.setRange(e,0,e,0)},"delete.brline.rowMerge":({ports:s},{rowEndBr:e})=>{let t=e.nextSibling;(t==null?void 0:t.nodeType)===3&&h.check.isZeroWidth(t)&&(t=t.nextSibling);const i=e.parentNode;h.utils.removeItem(e),t&&(t.nodeType===3||h.check.isBreak(t))?s.selection.setRange(t,0,t,0):s.selection.setRange(i,i.childNodes.length,i,i.childNodes.length)},"delete.softBreak.merge":({ports:s},{br:e})=>{const t=e.previousSibling,i=e.parentNode,n=e.nextSibling;n&&n.nodeType===3&&h.check.isZeroWidth(n.textContent)&&h.utils.removeItem(n),h.utils.removeItem(e),t?d0(s,t):i&&s.selection.setRange(i,0,i,0)},"tab.format.indent":({ports:s,ctx:e},{range:t,formatEl:i,shift:n})=>{const r=s.format.getLines(null),a=[],c=[],d=h.check.isListCell(r[0]),u=h.check.isListCell(r.at(-1));let f={sc:t.startContainer,so:t.startOffset,ec:t.endContainer,eo:t.endOffset};for(let p=0,m=r.length,g;p<m;p++)if(g=r[p],h.check.isListCell(g)){if(!g.previousElementSibling&&!n)continue;a.push(g)}else c.push(g);if(a.length>0&&(f=s.listFormat.applyNested(a,n)),c.length>0)if(n){const p=c.length-1;for(let y=0,v;y<=p;y++){v=c[y].childNodes;for(let C=0,w=v.length,k;C<w&&(k=v[C],!!k);C++)if(!h.check.isZeroWidth(k)){/^\s{1,4}$/.test(k.textContent)?h.utils.removeItem(k):/^\s{1,4}/.test(k.textContent)&&(k.textContent=k.textContent.replace(/^\s{1,4}/,""));break}}const m=h.query.getEdgeChild(c[0],"text",!1),g=h.query.getEdgeChild(c[p],"text",!0);!d&&m&&(f.sc=m,f.so=0),!u&&g&&(f.ec=g,f.eo=g.textContent.length)}else if(c.length===1){let p=e.store.get("tabSize")+1;if(e.options.get("syncTabIndent")){const g=h.query.findTextIndexOnLine(i,t.startContainer,t.startOffset,v=>s.component.is(v)),y=s.format.isLine(i.previousElementSibling)?h.query.findTabEndIndex(i.previousElementSibling,g,2):0;y>g&&(p=y-g)}const m=h.utils.createTextNode(new Array(p).join(" "));if(!s.html.insertNode(m,{afterNode:null,skipCharCount:!1}))return!1;d||(f.sc=m,f.so=m.length),u||(f.ec=m,f.eo=m.length)}else{const p=h.utils.createTextNode(new Array(e.store.get("tabSize")+1).join(" ")),m=c.length-1;for(let v=0,C;v<=m;v++)C=c[v].firstChild,C&&(h.check.isBreak(C)?c[v].insertBefore(p.cloneNode(!1),C):C.textContent=p.textContent+C.textContent);const g=h.query.getEdgeChild(c[0],"text",!1),y=h.query.getEdgeChild(c[m],"text",!0);!d&&g&&(f.sc=g,f.so=0),!u&&y&&(f.ec=y,f.eo=y.textContent.length)}s.selection.setRange(f.sc,f.so,f.ec,f.eo)},"caret.scrollTo":({ports:s},{range:e})=>{s.caretScrollTo(e)},"enter.line.addDefault":({ports:s},{formatEl:e})=>{const i=s.format.addLineAfter(e).firstChild;s.selection.setRange(i,0,i,0)},"enter.list.addItem":({ports:s},{formatEl:e,selectionNode:t})=>{const i=h.utils.createElement("BR"),n=h.utils.createElement("LI",null,i);e.parentNode.insertBefore(n,e.nextElementSibling),n.appendChild(t.nextSibling),s.selection.setRange(i,1,i,1)},"enter.format.exitEmpty":({ports:s,ctx:e},{formatEl:t,rangeEl:i})=>{let n=null;if(h.check.isListCell(i.parentElement)){const r=t.parentNode.parentElement;i=r.parentElement;const a=h.utils.createElement("LI");a.innerHTML="<br>",h.utils.copyTagAttributes(a,t,e.options.get("lineAttrReset")),n=a,i.insertBefore(n,r.nextElementSibling)}else{let r;h.check.isTableCell(i.parentElement)?r="DIV":h.check.isList(i.parentElement)?r="LI":s.format.isLine(i.nextElementSibling)?r=i.nextElementSibling.nodeName:s.format.isLine(i.previousElementSibling)?r=i.previousElementSibling.nodeName:r=e.options.get("defaultLine"),n=h.utils.createElement(r);const a=s.format.removeBlock(i,{selectedFormats:[t],newBlockElement:null,shouldDelete:!0,skipHistory:!0});a.cc.insertBefore(n,a.sc?a.sc.nextSibling:a.cc.firstChild)}n.innerHTML="<br>",s.nodeTransform.removeAllParents(t,null,null),s.selection.setRange(n,1,n,1)},"enter.format.cleanBrAndZWS":({ports:s},{selectionNode:e,selectionFormat:t,brBlock:i,children:n,offset:r})=>{t?h.utils.removeItem(n[r-1]):h.utils.removeItem(e);const a=i.nextElementSibling,c=s.format.addLine(i,s.format.isLine(a)?a:null);h.utils.copyFormatAttributes(c,i),s.selection.setRange(c,1,c,1)},"enter.format.insertBrHtml":({ports:s},{brBlock:e,range:t,wSelection:i,offset:n})=>{s.html.insert(t.collapsed&&h.check.isBreak(t.startContainer.childNodes[t.startOffset-1])?"<br>":"<br><br>",{selectInserted:!1,skipCharCount:!0,skipCleaning:!0});let r=i.focusNode;const a=i.focusOffset;e===r&&(r=r.childNodes[a-n>1?a-1:a]),s.selection.setRange(r,1,r,1),s.setOnShortcutKey(!0)},"enter.brline.insert":({ports:s},{range:e})=>{s.selection.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset),e.collapsed||s.html.remove();const t=h.utils.createElement("BR");s.html.insertNode(t,{afterNode:null,skipCharCount:!0}),t.nextSibling||t.parentNode.appendChild(h.utils.createElement("BR"));const i=t.nextSibling;s.selection.setRange(i,0,i,0),s.setOnShortcutKey(!0)},"enter.shift.br":({ports:s,ctx:e},{range:t})=>{const i=e.fc.get("_wd"),n=s.selection.get(),a=(n==null?void 0:n.rangeCount)>0&&e.fc.get("wysiwyg").contains(n.focusNode)?n.getRangeAt(0):t,c=i.createRange();if(c.setStart(a.startContainer,a.startOffset),c.setEnd(a.endContainer,a.endOffset),a.collapsed||(c.deleteContents(),c.collapse(!0)),c.startContainer.nodeType===1&&h.check.isBreak(c.startContainer)){const f=c.startContainer;c.setStart(f.parentNode,h.utils.getArrayIndex(f.parentNode.childNodes,f)+c.startOffset),c.collapse(!0)}const d=h.utils.createElement("BR");c.insertNode(d);const u=d.nextSibling;if(u&&u.nodeType===3&&!h.check.isZeroWidth(u.textContent))s.selection.setRange(u,0,u,0);else{const f=h.utils.createTextNode(Ie.zeroWidthSpace);d.parentNode.insertBefore(f,d.nextSibling),s.selection.setRange(f,1,f,1)}s.history.push(!1)},"enter.brline.exit":({ports:s},{brBlock:e})=>{const t=e.lastChild;t&&(h.check.isBreak(t)||h.check.isZeroWidth(t.textContent))&&h.utils.removeItem(t);const i=e.nextElementSibling,n=s.format.addLine(e,s.format.isLine(i)?i:null);h.utils.copyFormatAttributes(n,e),s.selection.setRange(n,1,n,1)},"enter.format.insertBrNode":({ports:s},{wSelection:e})=>{const t=e.focusNode.nextSibling,i=h.utils.createElement("BR");s.html.insertNode(i,{afterNode:null,skipCharCount:!0});const n=i.previousSibling,r=i.nextSibling;!h.check.isBreak(t)&&!h.check.isBreak(n)&&(!r||h.check.isZeroWidth(r))?(i.parentNode.insertBefore(i.cloneNode(!1),i),s.selection.setRange(i,1,i,1)):s.selection.setRange(r,0,r,0),s.setOnShortcutKey(!0)},"enter.format.breakAtEdge":({ports:s,ctx:e},{formatEl:t,selectionNode:i,formatStartEdge:n,formatEndEdge:r,bidiSwapped:a})=>{const c=h.utils.createElement("BR"),d=h.utils.createElement(t.nodeName,null,c);h.utils.copyTagAttributes(d,t,e.options.get("lineAttrReset"));let u=c;if(!(r&&e.options.get("lineBreakClearStyle"))){let f=i;do{if(!h.check.isBreak(f)&&f.nodeType===1){const p=f.cloneNode(!1);p.appendChild(u),u=p}f=f.parentElement}while(t!==f&&t.contains(f))}if(d.appendChild(u),t.parentNode.insertBefore(d,n&&!r?t:t.nextElementSibling),r)s.selection.setRange(c,1,c,1);else if(a)s.selection.setRange(t,1,t,1);else{const f=t.firstChild||t;s.selection.setRange(f,0,f,0)}},"enter.format.breakWithSelection":({ports:s,ctx:e},{formatEl:t,range:i,formatStartEdge:n,formatEndEdge:r})=>{const a=s.format.getLine(i.startContainer,null)!==s.format.getLine(i.endContainer,null),c=t.cloneNode(!1);c.innerHTML="<br>";const d=i.commonAncestorContainer,u=d===i.startContainer&&d===i.endContainer&&h.check.isZeroWidth(d)?{container:d,offset:i.endOffset,prevContainer:d.previousElementSibling,commonCon:d}:s.html.remove();let f=s.format.getLine(u.container,null),p=0;if(!f){h.check.isWysiwygFrame(u.container)&&(s.enterPrevent(e.e),e.fc.get("wysiwyg").appendChild(c),f=c,h.utils.copyTagAttributes(f,t,e.options.get("lineAttrReset")),s.selection.setRange(f,p,f,p));return}const m=s.format.getBlock(u.container);f=f.contains(m)?h.query.getEdgeChild(m,g=>!!s.format.getLine(g),!1):f,a?r&&!n?(f.parentNode.insertBefore(c,!u.prevContainer||u.container===u.prevContainer?f.nextElementSibling:f),f=c,p=0):(p=u.offset,n&&(f.parentNode.insertBefore(c,f),r&&(p=0))):r&&n?(f.parentNode.insertBefore(c,f),p=0):r?(f=f.parentNode.insertBefore(c,f.nextElementSibling),f=c,p=0):f=s.nodeTransform.split(u.container,u.offset,h.query.getNodeDepth(t)),s.enterPrevent(e.e),h.utils.copyTagAttributes(f,t,e.options.get("lineAttrReset")),s.selection.setRange(f,p,f,p)},"enter.format.breakAtCursor":({ports:s,ctx:e},{formatEl:t,range:i})=>{let n=null;h.check.isZeroWidth(t)?n=s.format.addLine(t,t.cloneNode(!1)):n=s.nodeTransform.split(i.endContainer,i.endOffset,h.query.getNodeDepth(t)),s.enterPrevent(e.e),h.utils.copyTagAttributes(n,t,e.options.get("lineAttrReset")),s.selection.setRange(n,0,n,0)},"enter.figcaption.exitInList":({ports:s},{formatEl:e})=>{const t=s.format.addLine(e,null);s.selection.setRange(t,0,t,0)},"keydown.input.insertNbsp":({ports:s})=>{const e=s.html.insertNode(h.utils.createTextNode(" "),{afterNode:null,skipCharCount:!0});e&&s.selection.setRange(e,e.length,e,e.length)},"keydown.input.insertZWS":({ports:s})=>{const e=h.utils.createTextNode(Ie.zeroWidthSpace);s.html.insertNode(e,{afterNode:null,skipCharCount:!0}),s.selection.setRange(e,1,e,1)}};function fv(s,e,t){const i=t?e.childNodes.length:0;s.selection.setRange(e,i,e,i)}function d0(s,e){const t=e.nodeType===3?e.textContent.length:e.childNodes.length;s.selection.setRange(e,t,e,t)}function pv(s){let e=s.lastChild;for(;e&&(h.check.isBreak(e)||e.nodeType===3&&h.check.isZeroWidth(e));){const t=e.previousSibling;h.utils.removeItem(e),e=t}}function qA(s){const e=s.lastChild,t=s.nextElementSibling;if(!t)return e;if(h.check.isZeroWidth(t))return h.utils.removeItem(t),e;const i=t.childNodes;for(;i[0];)s.appendChild(i[0]);return h.utils.removeItem(t),e}function ZA(s){var r;const e=s.childNodes,t=s.previousElementSibling;let i=e[0],n=0;if(!t)return{focusNode:i,focusOffset:n};if(h.check.isZeroWidth(t))return h.utils.removeItem(t),{focusNode:i,focusOffset:n};if(e.length>1||((r=e[0])==null?void 0:r.textContent.length)>0)for(;e[0];)t.appendChild(e[0]);else i=t.lastChild,n=i.textContent.length;return h.utils.removeItem(s),{focusNode:i,focusOffset:n}}const GA="action.stop";async function b5(s,e){const t={...jA,...UA};for(const i of s){if(i.t===GA)return!1;const n=t[i.t];if(n&&await n(e,i.p)===!1)return!1}}function w5(s){var f;const e=s.selection.getRange(),t=e.startContainer,i=e.endContainer,n=s.format.getBlock(t),r=s.format.getBlock(i),a=h.check.isTableCell(n),c=h.check.isTableCell(r);if((a&&!n.previousElementSibling&&!n.parentElement.previousElementSibling||c&&!r.nextElementSibling&&!r.parentElement.nextElementSibling)&&n!==r){const p=((f=h.query.getParentElement(e.commonAncestorContainer,h.check.isFigure))==null?void 0:f.parentElement)||e.commonAncestorContainer;if(!a)h.utils.removeItem(h.query.getParentElement(r,m=>p===m.parentNode));else if(!c)h.utils.removeItem(h.query.getParentElement(n,m=>p===m.parentNode));else return h.utils.removeItem(h.query.getParentElement(n,m=>p===m.parentNode)),s.focusManager.nativeFocus(),!0}const d=t.nodeType===1?h.query.getParentElement(t,".se-component"):null,u=i.nodeType===1?h.query.getParentElement(i,".se-component"):null;return d&&h.utils.removeItem(d),u&&h.utils.removeItem(u),!1}function YA(s,e,t){let i=e.parentNode.previousSibling;const n=e.parentNode.nextSibling;i||(n?i=n:(i=h.utils.createElement("BR"),t.appendChild(i)));let r=e;for(;t.contains(r)&&!r.previousSibling;)r=r.parentNode;if(!t.contains(r))return e.textContent="",s.nodeTransform.removeAllParents(e,null,t),!0}function d1(s,e,t){const i=t?e.startContainer:e.endContainer,n=t?e.startOffset:e.endOffset,r=t?"previousSibling":"nextSibling",a=i.nodeType===1;let c;return a?(c=mv(s,i.childNodes[n],r,i),h.check.isComponentContainer(c)||h.check.isNonEditable(c)?c:null):(c=mv(s,i,r,i),h.check.isEdgePoint(i,n,t?"front":"end")&&(h.check.isComponentContainer(c)||h.check.isNonEditable(c))?c:null)}function mv(s,e,t,i){if(!e)return null;let n=e[t];if(!n)if(n=s.format.getLine(i),n=n?n[t]:null,n&&!s.component.is(n))n=t==="previousSibling"?n.firstChild:n.lastChild;else return null;return n}function KA(s,e){return s.setDefaultLine(e)}function xc(s,e,t,i){if(!s.collapsed||!e)return!1;const n=s.getBoundingClientRect();if(n.height<=0)return!1;const r=i.createRange();r.selectNodeContents(e);const a=r.getBoundingClientRect();return a.width<=2?!1:t==="front"?n.left<=a.left+2:n.left>=a.right-2}const G={prevent:()=>({t:"event.prevent"}),stop:()=>({t:"event.stop"}),preventStop:()=>({t:"event.prevent.stop"}),cacheStyleNode:()=>({t:"cache.styleNode"}),cacheFormatAttrsTemp:s=>({t:"cache.formatAttrsTemp",p:{attrs:s}}),componentDeselect:()=>({t:"component.deselect"}),editorNativeFocus:()=>({t:"focusManager.nativeFocus"}),historyPush:s=>({t:"history.push",p:s}),documentTypeRefreshHeader:()=>({t:"documentType.refreshHeader"}),selectionSetRange:(s,e,t,i)=>({t:"selection.setRange",p:{sc:s,so:e,ec:t,eo:i}}),formatRemoveBlock:(s,e,t,i,n)=>({t:"format.removeBlock",p:{rangeEl:s,selectedFormats:e,newBlockElement:t,shouldDelete:i,skipHistory:n}}),domUtilsRemoveItem:s=>({t:"dom.utils.removeItem",p:{item:s}}),selectComponentFallback:s=>({t:"select.component.fallback",p:{cmponentInfo:s}}),delFormatRemoveAndMove:(s,e)=>({t:"del.format.removeAndMove",p:{container:s,formatEl:e}}),backspaceFormatMaintain:s=>({t:"backspace.format.maintain",p:{formatEl:s}}),backspaceBrLineStrip:s=>({t:"backspace.brline.strip",p:{formatEl:s}}),backspaceComponentSelect:(s,e,t)=>({t:"backspace.component.select",p:{selectionNode:s,range:e,fileComponentInfo:t}}),backspaceComponentRemove:(s,e,t,i)=>({t:"backspace.component.remove",p:{isList:s,sel:e,formatEl:t,fileComponentInfo:i}}),backspaceListMergePrev:(s,e,t)=>({t:"backspace.list.mergePrev",p:{prev:s,formatEl:e,rangeEl:t}}),backspaceListRemoveNested:s=>({t:"backspace.list.removeNested",p:{range:s}}),backspaceEmptyLineMergePrev:(s,e)=>({t:"backspace.emptyLine.mergePrev",p:{formatEl:s,prev:e}}),backspaceBrLineRowMerge:(s,e)=>({t:"backspace.brline.rowMerge",p:{rowEndBr:s,rowStartBr:e}}),backspaceSoftBreakMerge:s=>({t:"backspace.softBreak.merge",p:{zws:s}}),deleteComponentSelect:(s,e)=>({t:"delete.component.select",p:{formatEl:s,fileComponentInfo:e}}),deleteComponentSelectNext:(s,e)=>({t:"delete.component.selectNext",p:{formatEl:s,nextEl:e}}),deleteListRemoveNested:(s,e,t)=>({t:"delete.list.removeNested",p:{range:s,formatEl:e,rangeEl:t}}),deleteEmptyLineMergeNext:(s,e)=>({t:"delete.emptyLine.mergeNext",p:{formatEl:s,next:e}}),deleteBrLineRowMerge:s=>({t:"delete.brline.rowMerge",p:{rowEndBr:s}}),deleteSoftBreakMerge:s=>({t:"delete.softBreak.merge",p:{br:s}}),mergeLineInto:(s,e)=>({t:"line.merge",p:{into:s,from:e}}),tabFormatIndent:(s,e,t)=>({t:"tab.format.indent",p:{range:s,formatEl:e,shift:t}}),caretScrollTo:s=>({t:"caret.scrollTo",p:{range:s}}),enterLineAddDefault:s=>({t:"enter.line.addDefault",p:{formatEl:s}}),enterListAddItem:(s,e)=>({t:"enter.list.addItem",p:{formatEl:s,selectionNode:e}}),enterFormatExitEmpty:(s,e)=>({t:"enter.format.exitEmpty",p:{formatEl:s,rangeEl:e}}),enterFormatCleanBrAndZWS:(s,e,t,i,n)=>({t:"enter.format.cleanBrAndZWS",p:{selectionNode:s,selectionFormat:e,brBlock:t,children:i,offset:n}}),enterFormatInsertBrHtml:(s,e,t,i)=>({t:"enter.format.insertBrHtml",p:{brBlock:s,range:e,wSelection:t,offset:i}}),enterFormatInsertBrNode:s=>({t:"enter.format.insertBrNode",p:{wSelection:s}}),enterBrLineInsert:s=>({t:"enter.brline.insert",p:{range:s}}),enterShiftBr:s=>({t:"enter.shift.br",p:{range:s}}),enterBrLineExit:s=>({t:"enter.brline.exit",p:{brBlock:s}}),enterFormatBreakAtEdge:(s,e,t,i,n)=>({t:"enter.format.breakAtEdge",p:{formatEl:s,selectionNode:e,formatStartEdge:t,formatEndEdge:i,bidiSwapped:n}}),enterFormatBreakWithSelection:(s,e,t,i)=>({t:"enter.format.breakWithSelection",p:{formatEl:s,range:e,formatStartEdge:t,formatEndEdge:i}}),enterFormatBreakAtCursor:(s,e)=>({t:"enter.format.breakAtCursor",p:{formatEl:s,range:e}}),enterFigcaptionExitInList:s=>({t:"enter.figcaption.exitInList",p:{formatEl:s}}),keydownInputInsertNbsp:()=>({t:"keydown.input.insertNbsp"}),keydownInputInsertZWS:()=>({t:"keydown.input.insertZWS"})};function XA(s,e,t){const{format:i,component:n}=e,{fc:r,options:a,range:c,selectionNode:d}=t;let{formatEl:u}=t;const f=!c.collapsed||c.startContainer!==c.endContainer,p=a.get("_rtl")&&!f&&c.startOffset===0&&xc(c,u,"front",r.get("_wd"));if(s.push(G.componentDeselect()),s.push(G.cacheStyleNode()),f&&w5(e))return s.push(G.preventStop()),s.push(G.caretScrollTo(c)),!0;if(!i.isNormalLine(u)&&!i.isBrLine(u)&&!r.get("wysiwyg").firstElementChild&&!n.is(d)&&KA(e,a.get("defaultLine"))!==null)return s.push(G.preventStop()),!1;if(i.isLine(u)&&f&&h.check.isEdgePoint(c.startContainer,c.startOffset,"front")&&(!c.startContainer.previousSibling||h.check.isZeroWidth(c.startContainer.previousSibling))&&i.getLine(c.startContainer)!==i.getLine(c.endContainer)&&(i.isLine(u.previousElementSibling)||h.check.isListCell(u)))return s.push(G.preventStop()),s.push(G.delFormatRemoveAndMove(c.startContainer,u)),s.push(G.historyPush(!0)),s.push(G.caretScrollTo(c)),!1;if(!f&&!p&&u&&i.isNormalLine(u)&&!h.check.isListCell(u)&&i.isEdgeLine(c.startContainer,c.startOffset,"front")){const C=QA(i,u);if(C)return s.push(G.preventStop()),s.push(G.mergeLineInto(C,u)),s.push(G.historyPush(!0)),!1}if(!f&&!p&&!u.previousElementSibling&&c.startOffset===0&&!d.previousSibling&&!h.check.isListCell(u)&&i.isLine(u)&&(!i.isBrLine(u)||i.isClosureBrLine(u)||h.check.isWysiwygFrame(u.parentNode)))return i.isClosureBlock(u.parentNode)?(s.push(G.preventStop()),!1):i.isBrLine(u)&&h.check.isWysiwygFrame(u.parentNode)?(s.push(G.preventStop()),s.push(G.backspaceBrLineStrip(u)),s.push(G.historyPush(!0)),!1):(h.check.isWysiwygFrame(u.parentNode)&&u.childNodes.length<=1&&(!u.firstChild||h.check.isZeroWidth(u.textContent))&&(s.push(G.preventStop()),s.push(G.backspaceFormatMaintain(u))),s.push(G.editorNativeFocus()),s.push(G.caretScrollTo(c)),!1);const m=c.startContainer;if(u&&!p&&!u.previousElementSibling&&c.startOffset===0&&m.nodeType===3&&h.check.isZeroWidth(m)&&YA(e,m,u)===!0)return!0;if(!f&&u&&(c.startOffset===0||d===u)){const C=d===u?d1(e,c,!0):h.check.isElement(d.previousSibling)?d.previousSibling:h.check.isEdgePoint(c.startContainer,c.startOffset)?h.query.getPreviousDeepestNode(c.startContainer):null;if(n.is(C)){const w=n.get(C);if(w)return s.push(G.preventStop()),s.push(G.backspaceComponentSelect(d,c,w)),!0}}if(d1(e,c,!0))return s.push(G.preventStop()),!0;!f&&!p&&i.isEdgeLine(c.startContainer,c.startOffset,"front")&&i.isLine(u.previousElementSibling)&&s.push(G.cacheFormatAttrsTemp(u.previousElementSibling.attributes)),u=i.getLine(c.startContainer,null);const g=i.getBlock(u,null),y=c.commonAncestorContainer;if(g&&u&&!h.check.isTableCell(g)&&!/^FIGCAPTION$/i.test(g.nodeName)){if(h.check.isListCell(u)&&h.check.isList(g)&&(h.check.isListCell(g.parentElement)||u.previousElementSibling)&&(d===u||d.nodeType===3&&(!d.previousSibling||h.check.isList(d.previousSibling)))&&(i.getLine(c.startContainer,null)!==i.getLine(c.endContainer,null)?g.contains(c.startContainer):c.startOffset===0&&c.collapsed&&!p)){if(c.startContainer!==c.endContainer)s.push(G.prevent()),s.push(G.backspaceListRemoveNested(c)),s.push(G.historyPush(!0));else{let C=u.previousElementSibling||g.parentElement;if(h.check.isListCell(C)){s.push(G.prevent());let w=C;if(!C.contains(u)&&h.check.isListCell(w)&&h.check.isList(w.lastElementChild)){for(w=w.lastElementChild.lastElementChild;h.check.isListCell(w)&&h.check.isList(w.lastElementChild);)w=w.lastElementChild&&w.lastElementChild.lastElementChild;C=w}s.push(G.backspaceListMergePrev(C,u,g)),s.push(G.historyPush(!0))}}return s.push(G.caretScrollTo(c)),!0}if(!f&&c.startOffset===0&&!p){let C=!0,w=y;for(;w&&w!==g&&!h.check.isWysiwygFrame(w);){if(w.previousSibling&&(w.previousSibling.nodeType===1||!h.check.isZeroWidth(w.previousSibling.textContent.trim()))){C=!1;break}w=w.parentNode}if(C&&g.parentNode)return s.push(G.prevent()),s.push(G.formatRemoveBlock(g,h.check.isListCell(u)?[u]:null,null,!1,!1)),s.push(G.historyPush(!0)),s.push(G.caretScrollTo(c)),!0}}if(!f&&u&&h.check.isEmptyLine(u)&&n.is(u.previousElementSibling)){const C=n.get(u.previousElementSibling);if(C)return s.push(G.preventStop()),s.push(G.backspaceComponentRemove(!1,u.firstChild,u,C)),s.push(G.caretScrollTo(c)),!0}if(!f&&u&&(c.startOffset===0||d===u&&u.childNodes[c.startOffset])){const C=h.check.isListCell(u),w=d===u?u.childNodes[c.startOffset]:d,k=(C?w:u).previousSibling,_=C||(y.nodeType===3||h.check.isBreak(y))&&!y.previousSibling&&c.startOffset===0;if(w&&(C||!w.previousSibling)&&(y&&n.is(y.previousSibling)||_&&n.is(k))){const M=n.get(k);return M?(s.push(G.preventStop()),s.push(G.backspaceComponentRemove(C,w,u,M))):n.is(k)&&(s.push(G.preventStop()),s.push(G.domUtilsRemoveItem(k))),s.push(G.caretScrollTo(c)),!0}if(w&&h.check.isNonEditable(w.previousSibling))return s.push(G.preventStop()),s.push(G.domUtilsRemoveItem(w.previousSibling)),s.push(G.caretScrollTo(c)),!0}if(!f&&i.isBrLine(u)&&h.check.isBreak(c.startContainer)&&c.startOffset===0){let C=c.startContainer.previousSibling;if((C==null?void 0:C.nodeType)===3&&h.check.isZeroWidth(C)&&(C=C.previousSibling),h.check.isBreak(C))return s.push(G.preventStop()),s.push(G.backspaceBrLineRowMerge(c.startContainer,C)),s.push(G.historyPush(!0)),s.push(G.caretScrollTo(c)),!1}if(!f&&c.startContainer.nodeType===3&&h.check.isZeroWidth(c.startContainer)&&c.startOffset<=1&&h.check.isBreak(c.startContainer.previousSibling))return s.push(G.preventStop()),s.push(G.backspaceSoftBreakMerge(c.startContainer)),s.push(G.historyPush(!0)),s.push(G.caretScrollTo(c)),!1;const v=u==null?void 0:u.previousElementSibling;return!f&&u&&i.isNormalLine(u)&&!h.check.isListCell(u)&&h.check.isEmptyLine(u)&&(i.isNormalLine(v)||i.isBrLine(v))?(s.push(G.preventStop()),s.push(G.backspaceEmptyLineMergePrev(u,v)),s.push(G.historyPush(!0)),s.push(G.caretScrollTo(c)),!1):(s.push(G.caretScrollTo(c)),!0)}function QA(s,e){let t=e.previousElementSibling;if(t){if(!s.isBlock(t))return null}else{const n=e.parentElement;if(!s.isBlock(n)||s.isClosureBlock(n)||(t=n.previousElementSibling,!t))return null}let i=t;for(;i&&s.isBlock(i)&&!s.isClosureBlock(i);)i=i.lastElementChild;return!s.isNormalLine(i)||h.check.isListCell(i)||s.isBrLine(i)||s.isClosureBrLine(i)?null:i}function JA(s,e,t){var g,y;const{format:i,component:n}=e,{fc:r,range:a,selectionNode:c}=t;let{formatEl:d}=t;const u=!a.collapsed||a.startContainer!==a.endContainer,f=t.options.get("_rtl")&&!u&&a.endOffset>=(((g=a.endContainer.textContent)==null?void 0:g.length)||0)&&xc(a,d,"end",r.get("_wd"));if(s.push(G.componentDeselect()),s.push(G.cacheStyleNode()),u&&w5(e))return s.push(G.preventStop()),!0;if(!u&&!f&&d&&i.isNormalLine(d)&&!h.check.isListCell(d)&&i.isEdgeLine(a.endContainer,a.endOffset,"end")){const v=e$(i,d);if(v)return s.push(G.preventStop()),s.push(G.mergeLineInto(d,v)),s.push(G.historyPush(!0)),!1}if(!u&&!f&&i.isEdgeLine(a.endContainer,a.endOffset,"end")&&!d.nextSibling)return s.push(G.preventStop()),!1;if(i.isLine(d)&&u&&h.check.isEdgePoint(a.endContainer,a.endOffset,"end")&&(!a.endContainer.nextSibling||h.check.isZeroWidth(a.endContainer.nextSibling))&&i.getLine(a.startContainer)!==i.getLine(a.endContainer)&&(i.isLine(d.nextElementSibling)||h.check.isListCell(d)))return s.push(G.preventStop()),s.push(G.delFormatRemoveAndMove(a.endContainer,d)),s.push(G.historyPush(!0)),!1;if(!u&&d&&(a.endOffset===a.endContainer.textContent.length||c===d)){const v=c===d?d1(e,a,!1):h.check.isElement(c.nextSibling)?c.nextSibling:h.check.isEdgePoint(a.endContainer,a.endOffset)?h.query.getNextDeepestNode(a.endContainer,null):null;if(n.is(v)){const C=n.get(v);if(C)return s.push(G.preventStop()),s.push(G.deleteComponentSelect(d,C)),!0}}if(d1(e,a,!1))return s.push(G.preventStop()),!0;if((i.isLine(c)||c.nextSibling===null||h.check.isZeroWidth(c.nextSibling)&&c.nextSibling.nextSibling===null)&&a.startOffset===c.textContent.length){const v=d.nextElementSibling;if(!v)return!0;if(n.is(v))return s.push(G.prevent()),s.push(G.deleteComponentSelectNext(d,v)),!0}if(!u&&(h.check.isEdgePoint(a.endContainer,a.endOffset)||c===d&&d.childNodes[a.startOffset])){const v=c===d&&d.childNodes[a.startOffset]||c;if(v&&h.check.isNonEditable(v.nextSibling))return s.push(G.preventStop()),s.push(G.domUtilsRemoveItem(v.nextSibling)),!0;if(n.is(v))return s.push(G.preventStop()),s.push(G.domUtilsRemoveItem(v)),!0}!u&&!f&&i.isEdgeLine(a.endContainer,a.endOffset,"end")&&i.isLine(d.nextElementSibling)&&s.push(G.cacheFormatAttrsTemp(d.attributes)),d=i.getLine(a.startContainer,null);const p=i.getBlock(d,null);if(h.check.isListCell(d)&&h.check.isList(p)&&(c===d||c.nodeType===3&&(!c.nextSibling||h.check.isList(c.nextSibling))&&(i.getLine(a.startContainer,null)!==i.getLine(a.endContainer,null)?p.contains(a.endContainer):a.endOffset===c.textContent.length&&a.collapsed&&!f)))return s.push(G.deleteListRemoveNested(a,d,p)),!0;if(!u&&i.isBrLine(d)&&h.check.isBreak(a.startContainer)&&a.startOffset===0){let v=a.startContainer.previousSibling;if((v==null?void 0:v.nodeType)===3&&h.check.isZeroWidth(v)&&(v=v.previousSibling),h.check.isBreak(v))return s.push(G.preventStop()),s.push(G.deleteBrLineRowMerge(a.startContainer)),s.push(G.historyPush(!0)),!1}if(!u){const v=a.startContainer;let C=null;if(v.nodeType===3&&a.startOffset>=v.textContent.length&&h.check.isBreak(v.nextSibling)){const w=v.nextSibling;((y=w.nextSibling)==null?void 0:y.nodeType)===3&&h.check.isZeroWidth(w.nextSibling.textContent)&&(C=w)}else v.nodeType===3&&h.check.isZeroWidth(v)&&a.startOffset===0&&h.check.isBreak(v.previousSibling)&&(C=v.previousSibling);if(C)return s.push(G.preventStop()),s.push(G.deleteSoftBreakMerge(C)),s.push(G.historyPush(!0)),!1}const m=d==null?void 0:d.nextElementSibling;return!u&&d&&i.isNormalLine(d)&&!h.check.isListCell(d)&&h.check.isEmptyLine(d)&&(i.isNormalLine(m)||i.isBrLine(m))?(s.push(G.preventStop()),s.push(G.deleteEmptyLineMergeNext(d,m)),s.push(G.historyPush(!0)),!1):!0}function e$(s,e){let t=e.nextElementSibling;if(t){if(!s.isBlock(t))return null}else{const n=e.parentElement;if(!s.isBlock(n)||s.isClosureBlock(n)||(t=n.nextElementSibling,!t))return null}let i=t;for(;i&&s.isBlock(i)&&!s.isClosureBlock(i);)i=i.firstElementChild;return!s.isNormalLine(i)||h.check.isListCell(i)||s.isBrLine(i)||s.isClosureBrLine(i)?null:i}function t$(s,e){const t=Array.from(s.childNodes),i=[[]];for(const f of t)h.check.isBreak(f)?i.push([]):i[i.length-1].push(f);t.length&&h.check.isBreak(t[t.length-1])&&i.pop();const n=f=>!f||f.every(p=>h.check.isZeroWidth(p.textContent)),r=e.anchorNode;let a=0;if(r===s)for(let f=0;f<e.anchorOffset&&f<t.length;f++)h.check.isBreak(t[f])&&a++;else for(const f of t){if(f===r||f.nodeType===1&&f.contains(r))break;h.check.isBreak(f)&&a++}const c=Math.max(i.length,1),d=Math.min(a,c-1);return{shouldExit:d===c-1&&n(i[d])&&d>=1&&n(i[d-1])}}function k5(s,e,t){const{format:i,char:n,selection:r}=e,{frameOptions:a,range:c,formatEl:d,selectionNode:u,shift:f,e:p}=t,m=!c.collapsed||c.startContainer!==c.endContainer;s.push(G.componentDeselect());const g=i.getBrLine(u,null),y=i.getBlock(d,null);if(a.get("charCounter_type")==="byte-html"){let v="";if(!f&&g||f?v="<br>":v="<"+d.nodeName+"><br></"+d.nodeName+">",!n.check(v))return s.push(G.prevent()),!1}if(f)return e.enterPrevent(p),s.push(G.enterShiftBr(c)),s.push(G.caretScrollTo(c)),!0;if(!f){let v=i.isEdgeLine(c.endContainer,c.endOffset,"end"),C=i.isEdgeLine(c.startContainer,c.startOffset,"front"),w=!1;if(t.options.get("_rtl")&&d&&c.collapsed&&C!==v){const k=t.fc.get("_wd");C&&xc(c,d,"front",k)?(C=!1,v=!0,w=!0):v&&xc(c,d,"end",k)&&(v=!1,C=!0,w=!0)}if(v&&(/^H[1-6]$/i.test(d.nodeName)||/^HR$/i.test(d.nodeName)))return e.enterPrevent(p),s.push(G.enterLineAddDefault(d)),s.push(G.caretScrollTo(c)),!0;if(y&&d&&!h.check.isTableCell(y)&&!/^FIGCAPTION$/i.test(y.nodeName)){const k=r.getRange();if(h.check.isEdgePoint(k.endContainer,k.endOffset)&&h.check.isList(u.nextSibling))return e.enterPrevent(p),s.push(G.enterListAddItem(d,u)),s.push(G.caretScrollTo(c)),!0;if((k.commonAncestorContainer.nodeType!==3||!k.commonAncestorContainer.nextElementSibling)&&h.check.isZeroWidth(d.innerText.trim())&&!h.check.isListCell(d.nextElementSibling))return e.enterPrevent(p),s.push(G.enterFormatExitEmpty(d,y)),!0}if(g||y===d&&i.isClosureBlock(y)&&i.isLine(d)){if(e.enterPrevent(p),g&&!i.isClosureBrLine(g))return t$(g,r.get()).shouldExit?s.push(G.enterBrLineExit(g)):s.push(G.enterBrLineInsert(c)),s.push(G.caretScrollTo(c)),!0;const k=r.get();return u===g?s.push(G.enterFormatInsertBrHtml(g,c,k,k.focusOffset)):s.push(G.enterFormatInsertBrNode(k)),s.push(G.caretScrollTo(c)),!0}if(c.collapsed&&(C||v))return e.enterPrevent(p),s.push(G.enterFormatBreakAtEdge(d,u,C,v,w)),s.push(G.caretScrollTo(c)),!0;if(d){if(s.push(G.prevent()),m){if(t.options.get("_rtl")&&C&&!v){const k=t.fc.get("_wd"),_=k.createRange();_.setStart(c.startContainer,c.startOffset),_.collapse(!0),xc(_,d,"front",k)&&(C=!1,v=!0,w=!0)}s.push(G.enterFormatBreakWithSelection(d,c,C,v))}else s.push(G.enterFormatBreakAtCursor(d,c));return s.push(G.caretScrollTo(c)),!0}}return m?(s.push(G.caretScrollTo(c)),!0):(y&&h.query.getParentElement(y,"FIGCAPTION")&&h.query.getParentElement(y,h.check.isList)&&(e.enterPrevent(p),s.push(G.enterFigcaptionExitInList(d)),s.push(G.caretScrollTo(c))),!0)}function s$(s,e,t){const{options:i,selectionNode:n,range:r,formatEl:a,ctrl:c,alt:d,shift:u}=t;return i.get("tabDisable")||(s.push(G.prevent()),c||d||h.check.isWysiwygFrame(n))||(s.push(G.tabFormatIndent(r,a,u)),s.push(G.historyPush(!1))),!0}function i$(s,e,t){var p;const{component:i}=e,{formatEl:n,range:r,selectionNode:a,keyCode:c}=t,d=t.options.get("_rtl"),u=c==="ArrowLeft"?d?"forward":"back":c==="ArrowRight"?d?"back":"forward":null;let f=null;switch(c){case"ArrowUp":i.is(n.previousElementSibling)&&(f=i.get(n.previousElementSibling));break;case"ArrowLeft":case"ArrowRight":if(u==="forward"){if(h.check.isEdgePoint(a,r.endOffset,"end")){const m=a.nextElementSibling||h.query.getNextDeepestNode(a);m?i.is(m)&&(f=i.get(m)):i.is(n.nextElementSibling)&&(f=i.get(n.nextElementSibling))}}else if(u==="back"&&h.check.isEdgePoint(a,r.startOffset,"front")){const m=a.previousElementSibling||h.query.getPreviousDeepestNode(a);m?i.is(m)&&(f=i.get(m)):i.is(n.previousElementSibling)&&(f=i.get(n.previousElementSibling))}break;case"ArrowDown":i.is(n.nextElementSibling)&&(f=i.get(n.nextElementSibling));break}f&&!((p=f.options)!=null&&p.isInputComponent)&&(s.push(G.prevent()),s.push(G.selectComponentFallback(f)))}const{isOSX_IOS:n$}=me,o$=!0;function Vm(s,e){return o$&&s.get("_canUseBeforeInput")&&!(e!=null&&e.repeat)}async function r$(s,e){const t=[];switch(e.keyCode){case"Backspace":{if(XA(t,s,e)===!1)return t;break}case"Delete":{if(JA(t,s,e)===!1)return t;break}case"Tab":{if(s$(t,s,e)===!1)return t;break}case"Enter":{if(!Vm(e.store,e.e)&&k5(t,s,e)===!1)return t;break}}const{fc:i,keyCode:n,shift:r,alt:a,ctrl:c,range:d}=e;if(r&&(n$?a:c)&&xe.isSpace(n))return t.push(G.preventStop()),t.push(G.keydownInputInsertNbsp()),t;const u=!d.collapsed||d.startContainer!==d.endContainer;return!c&&!a&&!u&&!xe.isNonTextKey(n)&&h.check.isBreak(d.commonAncestorContainer)?(t.push(G.keydownInputInsertZWS()),t):i.has("documentType_use_header")&&u&&!c&&!a&&!r&&!xe.isDirectionKey(n)?(t.push(G.documentTypeRefreshHeader()),t):(i$(t,s,e),t)}function _5(s,{_styleNodes:e}){const{frameContext:t,ui:i,focusManager:n,selection:r,format:a,listFormat:c,component:d,html:u,nodeTransform:f,history:p,char:m,menu:g,store:y}=s.$;return{focusManager:{nativeFocus:()=>n.nativeFocus(),blur:()=>n.blur()},selection:{getRange:()=>r.getRange(),getNode:()=>r.getNode(),setRange:(v,C,w,k)=>r.setRange(v,C,w,k),get:()=>r.get()},format:{isLine:v=>a.isLine(v),getLine:(v,C)=>a.getLine(v,C),getLines:v=>a.getLines(v),getBrLine:(v,C)=>a.getBrLine(v,C),getBlock:(v,C)=>a.getBlock(v,C),isNormalLine:v=>a.isNormalLine(v),isBrLine:v=>a.isBrLine(v),isClosureBrLine:v=>a.isClosureBrLine(v),isBlock:v=>a.isBlock(v),isClosureBlock:v=>a.isClosureBlock(v),isEdgeLine:(v,C,w)=>a.isEdgeLine(v,C,w),removeBlock:(v,C)=>a.removeBlock(v,C),addLine:(v,C)=>a.addLine(v,C),addLineAfter:v=>a.addLineAfter(v)},listFormat:{applyNested:(v,C)=>c.applyNested(v,C)},component:{deselect:()=>d.deselect(),is:v=>d.is(v),get:v=>d.get(v),select:(v,C)=>d.select(v,C)},html:{remove:()=>u.remove(),insert:(v,C)=>u.insert(v,C),insertNode:(v,C)=>u.insertNode(v,C)},history:{push:v=>p.push(!!v)},nodeTransform:{removeAllParents:(v,C,w)=>f.removeAllParents(v,C,w),split:(v,C,w)=>f.split(v,C,w)},char:{check:v=>m.check(v)},menu:{dropdownOff:()=>g.dropdownOff()},setDefaultLine:v=>s._setDefaultLine(v),hideToolbar:()=>s._hideToolbar(),hideToolbar_sub:()=>s._hideToolbar_sub(),styleNodeCache:()=>e.value=s.__cacheStyleNodes,formatAttrsTempCache:v=>s._formatAttrsTemp=v,setOnShortcutKey:v=>s._onShortcutKey=v,caretScrollTo(v){i._iframeAutoHeight(t),r.scrollTo(r.getRange()||v,{behavior:"auto",block:"nearest",inline:"nearest"})},enterPrevent(v){v.preventDefault(),!(!l3||Vm(y))&&(s.__focusTemp.focus({preventScroll:!0}),t.get("wysiwyg").focus({preventScroll:!0}))}}}const l$={value:[]};async function a$(s,e){if(s.get("isReadOnly")||s.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;if(Vm(this.$.store)&&(e.inputType==="insertParagraph"||e.inputType==="insertLineBreak")){await c$.call(this,s,e);return}const t=(e.data===null?"":e.data===void 0?" ":e.data)||"";if(xe.isComposing(e))this._handledInBefore=!1;else{if(!this.$.char.test(t,!1))return e.preventDefault(),e.stopPropagation(),!1;this._handledInBefore=!0}await this.$.eventManager.triggerEvent("onBeforeInput",{frameContext:s,event:e,data:t})!==!1&&await this._callPluginEventAsync("onBeforeInput",{frameContext:s,event:e,data:t})}async function c$(s,e){if(e.isComposing||this.isComposing||this.$.ui.selectMenuOn)return;let t=this.$.selection.getNode();if(h.check.isInputElement(t)||this.$.menu.currentDropdownName)return;h.check.isWysiwygFrame(t)&&(this._setDefaultLine(this.$.options.get("defaultLine")),t=this.$.selection.getNode());const i=this._enterKeyShift||e.inputType==="insertLineBreak";if(this._enterKeyShift=!1,!i){const u=this._normalizeEditRange();u&&(t=u)}const n=this.$.selection.getRange(),r=this.$.format.getLine(t,null)||t,a={e,fc:s,store:this.$.store,options:this.$.options,frameOptions:this.$.frameOptions,range:n,selectionNode:t,formatEl:r,keyCode:"Enter",ctrl:!1,alt:!1,shift:i},c=_5(this,{_styleNodes:l$}),d=[];k5(d,c,a),d.some(u=>u.t==="event.prevent"||u.t==="event.prevent.stop")&&e.preventDefault(),await b5(d,{ports:c,ctx:a})}async function d$(s,e){if(s.get("isReadOnly")||s.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;const t=this.$.selection.getRange(),i=this.$.selection.getNode(),n=this.$.format.getLine(i,null);if(!this.$.format.isNormalLine(n)&&!this.$.format.isBrLine(n)&&t.collapsed&&!this.$.component.is(i)&&!h.check.isList(i)){const a=this.$.format.getBlock(i,null);this._setDefaultLine(this.$.format.isBlock(a)?"DIV":this.$.options.get("defaultLine"))}this.$.selection.init();const r=(e.data===null?"":e.data===void 0?" ":e.data)||"";if(!this._handledInBefore&&!this.$.char.test(r,!0))return e.preventDefault(),e.stopPropagation(),!1;this._handledInBefore=!1,await this.$.eventManager.triggerEvent("onInput",{frameContext:s,event:e,data:r})!==!1&&(await this._callPluginEventAsync("onInput",{frameContext:s,event:e,data:r}),this.$.history.push(!0))}const{_w:gv}=me,u$=new RegExp(Ie.zeroWidthSpace+"+",""),Pr={ctrl:!1,alt:!1},Gh=Object.preventExtensions({value:[]});async function h$(s,e){var g,y;if(this.isComposing=xe.isComposing(e))return!0;if(this.$.ui.selectMenuOn||!e.isTrusted)return;let t=this.$.selection.getNode();if(h.check.isInputElement(t)||this.$.menu.currentDropdownName)return;const i=e.code,n=xe.isShift(e),r=Pr.ctrl=xe.isCtrl(e),a=Pr.alt=xe.isAlt(e);if(xe.isEnter(i)&&(this._enterKeyShift=n),!r&&s.get("isReadOnly")&&!xe.isDirectionKey(i))return e.preventDefault(),!1;if(this.$.menu.dropdownOff(),this.$.store.mode.isBalloon?this.$.store.mode.isBalloonAlways||this._hideToolbar():this.$.store.mode.isSubBalloon&&(this.$.store.mode.isSubBalloonAlways||this._hideToolbar_sub()),xe.isEnter(i)&&!Vm(this.$.store,e)||xe.isRemoveKey(i)){const v=this._normalizeEditRange();v&&(t=v)}const d=this.$.selection.getRange(),u=this.$.format.getLine(t,null)||t;if(r&&!xe.isNonTextKey(i)&&this.$.shortcuts.command(e,r,n,i,"",!1,null,null))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1;if(!r&&!xe.isNonTextKey(i)&&this.$.format.isLine(u)&&d.collapsed&&h.check.isEdgePoint(d.startContainer,0,"front")){const v=(y=(g=d.startContainer).substringData)==null?void 0:y.call(g,0,d.startOffset);if(v&&this.$.shortcuts.command(e,!1,n,i,v,!0,u,d))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1}else this._onShortcutKey&&(this._onShortcutKey=!1);const f={e,fc:s,store:this.$.store,options:this.$.options,frameOptions:this.$.frameOptions,range:d,selectionNode:t,formatEl:u,keyCode:i,ctrl:r,alt:a,shift:n},p=_5(this,{_styleNodes:Gh}),m=await r$(p,f);await this.$.eventManager.triggerEvent("onKeyDown",{frameContext:s,event:e})!==!1&&await this._callPluginEventAsync("onKeyDown",{frameContext:s,event:e,range:d,line:u})!==!1&&await b5(m,{ports:p,ctx:f})}async function f$(s,e){var p;if(this._onShortcutKey||this.$.menu.currentDropdownName)return;const t=e.code,i=xe.isCtrl(e),n=xe.isAlt(e);if(i&&(Pr.ctrl=!1),n&&(Pr.alt=!1),s.get("isReadOnly"))return;const r=this.$.selection.getRange();let a=this.$.selection.getNode();if((this.$.store.mode.isBalloon||this.$.store.mode.isSubBalloon)&&((this.$.store.mode.isBalloonAlways||this.$.store.mode.isSubBalloonAlways)&&!xe.isEsc(t)||!r.collapsed))if(this.$.store.mode.isBalloonAlways||this.$.store.mode.isSubBalloonAlways)xe.isEsc(t)||this._showToolbarBalloonDelay();else{this.$.store.mode.isSubBalloon?this.$.subToolbar._showBalloon():this.$.toolbar._showBalloon();return}if(xe.isBackspace(t)&&h.check.isWysiwygFrame(a)&&a.textContent===""&&a.children.length===0){e.preventDefault(),e.stopPropagation(),a.innerHTML="";const m=this.$.store.get("currentNodes")[0],g=h.utils.createElement(this.$.format.isLine(m)&&!h.check.isListCell(m)?m:this.$.options.get("defaultLine"),null,"<br>");a.appendChild(g),this.$.selection.setRange(g,0,g,0),this.applyTagEffect(),this.$.history.push(!1),s.has("documentType_use_header")&&xe.isDocumentTypeObserverKey(t)&&s.get("documentType").reHeader();return}const c=this.$.format.getLine(a,null),d=this.$.format.getBlock(a,null),u=this._formatAttrsTemp;if(c&&u){for(let m=0,g=u.length;m<g;m++){if(xe.isEnter(t)&&/^id$/i.test(u[m].name)){c.removeAttribute("id");continue}c.setAttribute(u[m].name,u[m].value)}this._formatAttrsTemp=null}if(!this.$.format.isNormalLine(c)&&!this.$.format.isBrLine(c)&&r.collapsed&&!this.$.component.is(a)&&!h.check.isList(a)&&this._setDefaultLine(this.$.format.isBlock(d)?"DIV":this.$.options.get("defaultLine"))!==null&&(a=this.$.selection.getNode()),!Pr.ctrl&&!Pr.alt&&!xe.isNonTextKey(t)&&a.nodeType===3&&Ie.zeroWidthRegExp.test(a.textContent)&&!(e.isComposing!==void 0?e.isComposing:this.isComposing)){let m=r.startOffset,g=r.endOffset;const y=(a.textContent.substring(0,g).match(u$)||"").length;m=r.startOffset-y,g=r.endOffset-y,a.textContent=a.textContent.replace(Ie.zeroWidthRegExp,""),this.$.selection.setRange(a,m<0?0:m,a,g<0?0:g)}if(xe.isRemoveKey(t)&&h.check.isZeroWidth(c==null?void 0:c.textContent)&&!c.previousElementSibling&&!h.check.isListCell(c)){const m=this.$.options.get("retainStyleMode");m!=="none"&&((p=Gh.value)==null?void 0:p.length)>0?m==="repeat"?this.__retainTimer?(this.__retainTimer=gv.clearTimeout(this.__retainTimer),this._clearRetainStyleNodes(c)):(this.__retainTimer=gv.setTimeout(()=>{this.__retainTimer=null},0),this._retainStyleNodes(c,Gh.value)):(this.__retainTimer=null,this._retainStyleNodes(c,Gh.value)):this._clearRetainStyleNodes(c)}if(s.has("documentType_use_header"))if(xe.isDocumentTypeObserverKey(t)){s.get("documentType").reHeader();const m=h.query.getParentElement(this.$.selection.selectionNode,this.$.format.isLine.bind(this.$.format));s.get("documentType").on(m)}else{const m=h.query.getParentElement(a,g=>g.nodeType===1);s.get("documentType").onChangeText(m)}await this.$.eventManager.triggerEvent("onKeyUp",{frameContext:s,event:e})!==!1&&await this._callPluginEventAsync("onKeyUp",{frameContext:s,event:e,range:r,line:c})!==!1&&xe.isHistoryRelevantKey(t)&&this.$.history.push(!0)}const{_w:p$}=me;function m$(s,e){const t=e.clipboardData;return t?this._dataTransferAction("paste",e,t,s):!0}async function g$(s,e){const t=e.clipboardData;if(await this.$.eventManager.triggerEvent("onCopy",{frameContext:s,event:e,clipboardData:t})===!1)return e.preventDefault(),e.stopPropagation(),!1;const i=s.get("_ww").getSelection();this.__secopy=i.toString()}async function v$(s,e){const t=e.clipboardData;if(await this.$.eventManager.triggerEvent("onCut",{frameContext:s,event:e,clipboardData:t})===!1)return e.preventDefault(),e.stopPropagation(),!1;const i=s.get("_ww").getSelection();this.__secopy=i.toString(),p$.setTimeout(()=>{this.$.history.push(!1)},0)}const{_w:Nh}=me;function y$(s,e,t,i,n){var m,g;if(n.dataTransfer&&Array.from(n.dataTransfer.types||[]).includes("application/x-suneditor-block-drag"))return;const{sc:r,so:a,ec:c,eo:d}=this.$.selection.getDragEventLocationRange(n);if(!r)return;n.preventDefault();const u=s.get("_wd").createRange();u.setStart(r,a),u.setEnd(c,d);const f={y:0,x:0};if(t){const y=this.$.offset.getGlobal(t),v=i?this.$.context.get("toolbar_main").offsetHeight:0;f.y=y.top+v-Nh.scrollY,f.x=y.left-Nh.scrollX}const p=u.getBoundingClientRect();if(p.height>0){const y=s.get("wysiwygFrame");let v=0,C=0;/^iframe$/i.test(y.nodeName)&&(v=y.offsetLeft,C=y.offsetTop),e.style.left=`${p.right+Nh.scrollX+f.x+v}px`,e.style.top=`${p.top+Nh.scrollY+f.y-5+C}px`,e.style.height=`${p.height+10}px`,e.style.display="block";try{(m=e.showPopover)==null||m.call(e)}catch{}}else{try{(g=e.hidePopover)==null||g.call(e)}catch{}e.style.display="none"}}function C$(s){var e;try{(e=s.hidePopover)==null||e.call(s)}catch{}s.style.display="none"}function b$(s,e,t){var i;try{if(s.get("isReadOnly"))return t.preventDefault(),t.stopPropagation(),!1;const n=t.dataTransfer;if(!n)return!0;if(Array.from(n.types||[]).includes("application/x-suneditor-block-drag"))return;const{sc:r,so:a,ec:c,eo:d}=this.$.selection.getDragEventLocationRange(t);if(!r)return;if(h.query.getParentElement(r,".se-disable-pointer")){t.preventDefault();return}if(we.get("__dragContainer")){if(t.preventDefault(),we.get("__dragContainer").contains(t.target)){this.$.component.deselect();return}const u=we.get("__dragContainer");this.$.component.deselect(),this.$.selection.setRange(r,a,c,d),this.$.html.insertNode(u,{afterNode:null,skipCharCount:!0}),s.has("documentType_use_page")&&(s.get("documentTypePageMirror").innerHTML=s.get("wysiwyg").innerHTML,s.get("documentType").rePage(!0));return}return this.$.html.remove(),this.$.selection.setRange(r,a,c,d),this._dataTransferAction("drop",t,n,s)}finally{try{(i=e.hidePopover)==null||i.call(e)}catch{}e.style.display="none"}}var Re;class w${constructor({$:e}){b(this,Re,void 0);E(this,Re,e)}execute(e){if(!o(this,Re).options.get("__lineFormatFilter"))return null;if(o(this,Re).pluginManager.fileInfo.pluginRegExp.test(o(this,Re).ui.currentControllerName))return;const t=o(this,Re).selection.getRange(),i=t.commonAncestorContainer,n=t.startContainer,r=t.endOffset,a=o(this,Re).format.getBlock(i,null);let c,d,u;if(a){u=h.utils.createElement(e||o(this,Re).options.get("defaultLine")),u.innerHTML=a.innerHTML,u.childNodes.length===0&&(u.innerHTML=Ie.zeroWidthSpace),a.innerHTML=u.outerHTML,u=a.firstChild,c=u.childNodes[r]||h.query.getEdgeChildNodes(u,null).sc,c||(c=h.utils.createTextNode(Ie.zeroWidthSpace),u.insertBefore(c,u.firstChild)),d=c.textContent.length,o(this,Re).selection.setRange(c,d,c,d);return}if(i.nodeType===3&&o(this,Re).component.is(i.parentElement)){const f=o(this,Re).component.get(i.parentElement);if(!f)return;const p=f.container;if(i.parentElement===p){const m=i.nextElementSibling?p:p.nextElementSibling,g=h.utils.createElement(o(this,Re).options.get("defaultLine"),null,i);p.parentElement.insertBefore(g,m),o(this,Re).focusManager.focusEdge(g);return}return o(this,Re).component.select(f.target,f.pluginName),null}else if(i.nodeType===1&&i.getAttribute("data-se-embed")==="true"){let f=i.nextElementSibling;o(this,Re).format.isLine(f)||(f=o(this,Re).format.addLine(i,o(this,Re).options.get("defaultLine"))),o(this,Re).selection.setRange(f.firstChild,0,f.firstChild,0);return}if(!((o(this,Re).format.isBlock(n)||h.check.isWysiwygFrame(n))&&(o(this,Re).component.is(n.children[t.startOffset])||o(this,Re).component.is(n.children[t.startOffset-1])))){if(h.query.getParentElement(i,h.check.isExcludeFormat))return null;if(o(this,Re).format.isBlock(i)&&i.childNodes.length<=1){let f=null;i.childNodes.length===1&&h.check.isBreak(i.firstChild)?f=i.firstChild:(f=h.utils.createTextNode(Ie.zeroWidthSpace),i.appendChild(f)),o(this,Re).selection.setRange(f,1,f,1);return}try{if(i.nodeType===3&&(u=h.utils.createElement(e||o(this,Re).options.get("defaultLine")),i.parentNode.insertBefore(u,i),u.appendChild(i)),h.check.isBreak(u.nextSibling)&&h.utils.removeItem(u.nextSibling),h.check.isBreak(u.previousSibling)&&h.utils.removeItem(u.previousSibling),h.check.isBreak(c)){const f=h.utils.createTextNode(Ie.zeroWidthSpace);c.parentNode.insertBefore(f,c),c=f}}catch{o(this,Re).frameContext.get("_wd").execCommand("formatBlock",!1,`<${e||o(this,Re).options.get("defaultLine")}>`),o(this,Re).store.set("_lastSelectionNode",null),o(this,Re).selection.init();return}if(u&&(h.check.isBreak(u.nextSibling)&&h.utils.removeItem(u.nextSibling),h.check.isBreak(u.previousSibling)&&h.utils.removeItem(u.previousSibling),h.check.isBreak(c))){const f=h.utils.createTextNode(Ie.zeroWidthSpace);c.parentNode.insertBefore(f,c),c=f}o(this,Re).store.set("_lastSelectionNode",null),n?o(this,Re).selection.setRange(n,1,n,1):o(this,Re).focusManager.nativeFocus()}}}Re=new WeakMap;var sh,De,ih,nh,xg,jp,E5;class k${constructor(e){b(this,nh);b(this,jp);b(this,sh,void 0);b(this,De,void 0);b(this,ih,void 0);E(this,sh,e),E(this,De,e.$),E(this,ih,new RegExp(`^(${Object.keys(o(this,De).options.get("_defaultStyleTagMap")).join("|")})$`,"i"))}update(e){if(e||(e=o(this,De).selection.getNode()),e===o(this,De).store.get("_lastSelectionNode"))return;o(this,De).store.set("_lastSelectionNode",e);const t=o(this,De).options.get("_rtl")?"marginRight":"marginLeft",i=o(this,De).plugins,n=o(this,De).commandDispatcher.targets,r=o(this,ih),a=o(this,De).options.get("_styleCommandMap"),c=[],d=[],u=o(this,De).options.get("_textStyleTags"),f=[],p=[],m=o(this,De).commandDispatcher.activeCommands,g=m.length;let y="";if(o(this,De).component.is(e)&&!o(this,De).component.__selectionSelected){const w=o(this,De).component.get(e);if(!w)return;o(this,De).store.set("_lastSelectionNode",null),o(this,De).component.select(w.target,w.pluginName);return}for(;e.firstChild;)e=e.firstChild;const v=o(this,De).frameContext,C=!v.get("isReadOnly");for(let w=e;!h.check.isWysiwygFrame(w)&&w;w=w.parentElement)if(!(w.nodeType!==1||h.check.isBreak(w))){if(T(this,jp,E5).call(this,w)){o(this,De).focusManager.blur();return}if(y=w.nodeName.toLowerCase(),d.push(y),u.includes(y)&&!o(this,De).format.isLine(y)&&f.push(w),C)for(let k=0,_;k<g;k++)_=m[k],!c.includes(_)&&!p.includes(_)&&n.get(_)&&n.get(_).filter(M=>{var x;const S=(x=i[_])==null?void 0:x.active(w,M);return S===void 0&&p.push(_),S}).length>0&&c.push(_);if(o(this,De).format.isLine(w)){if(!c.includes("outdent")&&n.has("outdent")&&(h.check.isListCell(w)||w.style[t]&&Q.get(w.style[t],0)>0)&&n.get("outdent").filter(k=>h.check.isImportantDisabled(k)?!1:(k.disabled=!1,!0)).length>0&&c.push("outdent"),!c.includes("indent")&&n.has("indent")){const k=h.check.isListCell(w)&&!w.previousElementSibling;n.get("indent").filter(_=>h.check.isImportantDisabled(_)?!1:(_.disabled=k,!0)).length>0&&c.push("indent")}continue}r.test(y)&&(y=a[y]||y,c.push(y),h.utils.addClass(n.get(y),"active"))}return T(this,nh,xg).call(this,c),o(this,sh).__cacheStyleNodes=f.reverse(),o(this,De).store.set("currentNodes",d.reverse()),o(this,De).store.set("currentNodesMap",c),o(this,De).frameOptions.get("statusbar_showPathLabel")&&v.get("navigation")&&(v.get("navigation").textContent=o(this,De).options.get("_rtl")?o(this,De).store.get("currentNodes").reverse().join(" < "):o(this,De).store.get("currentNodes").join(" > ")),e}reset(){T(this,nh,xg).call(this,[])}}sh=new WeakMap,De=new WeakMap,ih=new WeakMap,nh=new WeakSet,xg=function(e){const t=o(this,De).commandDispatcher.activeCommands,i=o(this,De).commandDispatcher.targets,n=o(this,De).plugins;for(let r=0,a=t.length,c,d,u;r<a;r++)if(c=t[r],!(e.includes(c)||!(d=i.get(c)))){u=n[c];for(let f=0,p=d.length,m;f<p;f++)m=d[f],m&&(u?u.active(null,m):/^outdent$/i.test(c)?h.check.isImportantDisabled(m)||(m.disabled=!0):/^indent$/i.test(c)?h.check.isImportantDisabled(m)||(m.disabled=!1):h.utils.removeClass(m,"active"))}},jp=new WeakSet,E5=function(e){return h.check.isElement(e)&&e.getAttribute("data-se-non-focus")==="true"};const{_w:yt,isMobile:u0,isTouchDevice:h0}=me;var be,fi,ts,Rt,oe,nt,ot,It,Wt,Pn,Hn,Fn,Up,T5,qp,S5,gr,Tc,Zp,x5,Gp,M5,Yp,B5,Kp,N5,Xp,L5,Qp,A5,Jp,$5,oh,Mg,em,O5,tm,V5,sm,R5,im,I5,nm,D5,om,P5,rm,H5,lm,F5;class _$ extends $A{constructor(t){super(t);b(this,Up);b(this,qp);b(this,gr);b(this,Zp);b(this,Gp);b(this,Yp);b(this,Kp);b(this,Xp);b(this,Qp);b(this,Jp);b(this,oh);b(this,em);b(this,tm);b(this,sm);b(this,im);b(this,nm);b(this,om);b(this,rm);b(this,lm);b(this,be,void 0);b(this,fi,void 0);b(this,ts,void 0);b(this,Rt,void 0);b(this,oe,void 0);b(this,nt,void 0);b(this,ot,void 0);b(this,It,void 0);b(this,Wt,null);b(this,Pn,null);b(this,Hn,null);b(this,Fn,null);E(this,be,this.$.store),E(this,fi,this.$.contextProvider),E(this,ts,this.$.context),E(this,Rt,this.$.options),E(this,oe,this.$.eventManager),E(this,nt,this.$.toolbar),E(this,ot,this.$.ui),E(this,It,this.$.menu),this.isComposing=!1,this._enterKeyShift=!1,this.scrollparents=[],this.defaultLineManager=new w$(this),this.selectionState=new k$(this),this._onShortcutKey=!1,this._handledInBefore=!1,this._wwFrameObserver=null,this._toolbarObserver=null,this._lineBreakComp=null,this._formatAttrsTemp=null,this._resizeClientY=0,this.__cacheStyleNodes=[],this.__onDownEv=null,this._inputFocus=!1,this.__inputPlugin=null,this.__inputBlurEvent=null,this.__inputKeyEvent=null,this.__retainTimer=null,this.__eventDoc=null,this.__secopy=null,this.__focusTemp=o(this,fi).carrierWrapper.querySelector(".__se__focus__temp__")}applyTagEffect(t){return this.selectionState.update(t)}_showToolbarBalloonDelay(){o(this,Wt)&&yt.clearTimeout(o(this,Wt)),E(this,Wt,yt.setTimeout(()=>{yt.clearTimeout(o(this,Wt)),E(this,Wt,null),o(this,be).mode.isSubBalloon?this.$.subToolbar._showBalloon():o(this,nt)._showBalloon()},250))}_toggleToolbarBalloon(){this.$.selection.init();const t=this.$.selection.getRange(),i=o(this,Rt).has("_subMode");!(i?o(this,be).mode.isSubBalloonAlways:o(this,be).mode.isBalloonAlways)&&t.collapsed?i?this._hideToolbar_sub():this._hideToolbar():i?this.$.subToolbar._showBalloon(t):o(this,nt)._showBalloon(t)}_hideToolbar(){!o(this,ot).isPreventToolbarHide&&!this.$.frameContext.get("isFullScreen")&&o(this,nt).hide()}_hideToolbar_sub(){this.$.subToolbar&&!o(this,ot).isPreventToolbarHide&&this.$.subToolbar.hide()}_setDefaultLine(t){return this.defaultLineManager.execute(t)}_normalizeEditRange(){var i;if(!this.$.format.isLine((i=this.$.selection.getRange())==null?void 0:i.startContainer))return null;this.$.selection.resetRangeToTextNode();const t=this.$.selection.getRange();if(t.startContainer===t.endContainer&&t.startOffset!==t.endOffset&&t.startContainer.nodeType===3&&h.check.isZeroWidth(t.startContainer)){const n=t.startContainer.nextSibling;n&&h.check.isBreak(n)?this.$.selection.setRange(n,0,n,0):this.$.selection.setRange(t.endContainer,t.endOffset,t.endContainer,t.endOffset)}return this.$.selection.getNode()}async _dataTransferAction(t,i,n,r){try{return o(this,ot).showLoading(),await T(this,qp,S5).call(this,t,i,n,r),i.preventDefault(),i.stopPropagation(),!1}catch(a){console.warn("[SUNEDITOR.paste.error]",a)}finally{o(this,ot).hideLoading()}}_addCommonEvents(){const t=RA.bind(this),i=DA.bind(this);o(this,oe).addEvent(o(this,ts).get("menuTray"),"mousedown",t,!1),o(this,oe).addEvent(o(this,ts).get("menuTray"),"click",IA.bind(this),!0),o(this,oe).addEvent(o(this,ts).get("toolbar_main"),"mousedown",t,!1),o(this,oe).addEvent(o(this,ts).get("toolbar_main"),"click",i,!1),o(this,Rt).has("_subMode")&&(o(this,oe).addEvent(o(this,ts).get("toolbar_sub_main"),"mousedown",t,!1),o(this,oe).addEvent(o(this,ts).get("toolbar_sub_main"),"click",i,!1)),o(this,nt)._setResponsive(),me.isResizeObserverSupported&&(this._toolbarObserver=new ResizeObserver(()=>{yt.setTimeout(()=>{o(this,nt).resetResponsiveToolbar()},0)}),this._wwFrameObserver=new ResizeObserver(n=>{yt.setTimeout(()=>{n.forEach(r=>{o(this,ot)._emitResizeEvent(this.$.frameRoots.get(r.target.getAttribute("data-root-key")),-1,r)}),o(this,be).mode.isInline&&o(this,be).mode.isBottom&&o(this,nt)._resetSticky()},0)})),o(this,Rt).get("closeModalOutsideClick")&&o(this,oe).addEvent(o(this,fi).carrierWrapper.querySelector(".se-modal .se-modal-inner"),"click",n=>{n.target===o(this,fi).carrierWrapper.querySelector(".se-modal .se-modal-inner")&&o(this,ot).offCurrentModal()},!1),o(this,oe).addEvent(yt,"resize",T(this,em,O5).bind(this),!1),o(this,oe).addEvent(yt.visualViewport,"resize",T(this,tm,V5).bind(this),!1),o(this,oe).addEvent(yt,"scroll",T(this,sm,R5).bind(this),!1),h0&&o(this,oe).addEvent(yt.visualViewport,"scroll",T(this,im,I5).bind(this),!1)}_addFrameEvents(t){const i=t.get("options").get("iframe"),n=i?t.get("_ww"):t.get("wysiwyg");t.set("eventWysiwyg",n);const r=t.get("code"),a=o(this,fi).carrierWrapper.querySelector(".se-drag-cursor"),c=WA.bind(this,t);o(this,oe).addEvent(n,"mousemove",c,!1),o(this,oe).addEvent(n,"mouseleave",zA.bind(this,t),!1),o(this,oe).addEvent(n,"mousedown",PA.bind(this,t),!1),o(this,oe).addEvent(n,"mouseup",HA.bind(this,t),!1),o(this,oe).addEvent(n,"click",FA.bind(this,t),!1),o(this,oe).addEvent(n,"beforeinput",a$.bind(this,t),!1),o(this,oe).addEvent(n,"input",d$.bind(this,t),!1),o(this,oe).addEvent(n,"keydown",h$.bind(this,t),!1),o(this,oe).addEvent(n,"keyup",f$.bind(this,t),!1),o(this,oe).addEvent(n,"paste",m$.bind(this,t),!1),o(this,oe).addEvent(n,"copy",g$.bind(this,t),!1),o(this,oe).addEvent(n,"cut",v$.bind(this,t),!1),o(this,oe).addEvent(n,"dragover",y$.bind(this,t,a,i?this.$.frameContext.get("topArea"):null,!o(this,Rt).get("toolbar_container")&&!o(this,be).mode.isBalloon&&!o(this,be).mode.isInline),!1),o(this,oe).addEvent(n,"dragend",C$.bind(this,a),!1),o(this,oe).addEvent(n,"drop",b$.bind(this,t,a),!1),o(this,oe).addEvent(n,"scroll",T(this,Gp,M5).bind(this,t,n),{passive:!0,capture:!1}),o(this,oe).addEvent(n,"focus",T(this,Yp,B5).bind(this,t),!1),o(this,oe).addEvent(n,"blur",T(this,Kp,N5).bind(this,t),!1),o(this,oe).addEvent(r,"mousedown",T(this,rm,H5).bind(this,t),!1);const d=t.get("wrapper").querySelector(".se-drag-handle");if(o(this,oe).addEvent(d,"wheel",m=>{m.preventDefault(),this.$.component.deselect()},!1),o(this,oe).addEvent(t.get("lineBreaker_t"),"pointerdown",T(this,oh,Mg).bind(this,"t"),!1),o(this,oe).addEvent(t.get("lineBreaker_b"),"pointerdown",T(this,oh,Mg).bind(this,"b"),!1),h0&&o(this,oe).addEvent(n,"touchstart",c,{passive:!0,capture:!1}),!o(this,Rt).get("hasCodeMirror")){const m=t.get("codeNumbers"),g=this.$.viewer._codeViewAutoHeight.bind(this.$.viewer,t.get("code"),m,this.$.frameOptions.get("height")==="auto");o(this,oe).addEvent(r,"keydown",g,!1),o(this,oe).addEvent(r,"keyup",g,!1),o(this,oe).addEvent(r,"paste",g,!1),o(this,Rt).get("tabDisable")||o(this,oe).addEvent(r,"keydown",vv,!1),m&&o(this,oe).addEvent(r,"scroll",this.$.viewer._scrollLineNumbers.bind(r,m),!1)}const u=t.get("markdown");if(u){o(this,oe).addEvent(u,"mousedown",T(this,lm,F5).bind(this,t),!1);const m=t.get("markdownNumbers"),g=this.$.viewer._markdownViewAutoHeight.bind(this.$.viewer,u,m,this.$.frameOptions.get("height")==="auto");o(this,oe).addEvent(u,"keydown",g,!1),o(this,oe).addEvent(u,"keyup",g,!1),o(this,oe).addEvent(u,"paste",g,!1),o(this,Rt).get("tabDisable")||o(this,oe).addEvent(u,"keydown",vv,!1),m&&o(this,oe).addEvent(u,"scroll",this.$.viewer._scrollMarkdownLineNumbers.bind(u,m),!1)}t.has("statusbar")&&this.__addStatusbarEvent(t,t.get("options"));const f=T(this,om,P5).bind(this),p=h.query.getScrollParents(t.get("originElement"));for(const m of p)this.scrollparents.push(m),o(this,oe).addEvent(m,"scroll",f,!1);o(this,oe).addEvent(this.__focusTemp,"focus",m=>m.preventDefault(),!1),this.__eventDoc!==t.get("_wd")&&(this.__eventDoc=t.get("_wd"),o(this,oe).addEvent(this.__eventDoc,"selectionchange",T(this,nm,D5).bind(this,this.__eventDoc),!1))}__addStatusbarEvent(t,i){/\d+/.test(i.get("height"))&&i.get("statusbar_resizeEnable")?i.set("__statusbarEvent",o(this,oe).addEvent(t.get("statusbar"),"mousedown",T(this,Xp,L5).bind(this),!1)):h.utils.addClass(t.get("statusbar"),"se-resizing-none")}_removeAllEvents(){o(this,oe)._init(),this._wwFrameObserver&&(this._wwFrameObserver.disconnect(),this._wwFrameObserver=null),this._toolbarObserver&&(this._toolbarObserver.disconnect(),this._toolbarObserver=null),o(this,Wt)&&(yt.clearTimeout(o(this,Wt)),E(this,Wt,null)),this.__retainTimer&&(yt.clearTimeout(this.__retainTimer),this.__retainTimer=null),o(this,Hn)&&E(this,Hn,o(this,oe).removeGlobalEvent(o(this,Hn))),o(this,Fn)&&E(this,Fn,o(this,oe).removeGlobalEvent(o(this,Fn))),o(this,Pn)&&E(this,Pn,o(this,oe).removeGlobalEvent(o(this,Pn))),this._formatAttrsTemp=null,this.__cacheStyleNodes=null,this.__inputPlugin=null,this.__inputBlurEvent=null,this.__inputKeyEvent=null,this.__focusTemp=null,this.__eventDoc=null,this.__secopy=null,this._lineBreakComp=null,this.scrollparents=null}_setSelectionSync(){o(this,oe).removeGlobalEvent(o(this,Hn)),E(this,Hn,o(this,oe).addGlobalEvent("mouseup",()=>{this.$.selection.init(),o(this,oe).removeGlobalEvent(o(this,Hn))}))}_retainStyleNodes(t,i){let r=i[0].cloneNode(!1);for(let u=1,f=i.length,p;u<f;u++)p=i[u].cloneNode(!1),r.appendChild(p),r=p;const{parent:a,inner:c}=this.$.nodeTransform.createNestedNode(i,null),d=h.utils.createTextNode(Ie.zeroWidthSpace);c.appendChild(d),t.innerHTML="",t.appendChild(a),this.$.selection.setRange(d,1,d,1)}_clearRetainStyleNodes(t){t.innerHTML="<br>",this.$.selection.setRange(t,0,t,0)}_callPluginEvent(t,i){return this.$.pluginManager.emitEvent(t,i)}async _callPluginEventAsync(t,i){return await this.$.pluginManager.emitEventAsync(t,i)}__removeInput(){o(this,be).set("_preventBlur",!1),this._inputFocus=!1,this.__inputBlurEvent=o(this,oe).removeEvent(this.__inputBlurEvent),this.__inputKeyEvent=o(this,oe).removeEvent(this.__inputKeyEvent),this.__inputPlugin=null}__postFocusEvent(t,i){(o(this,be).mode.isInline||o(this,be).mode.isBalloonAlways)&&o(this,nt).show(),o(this,be).mode.isSubBalloonAlways&&this.$.subToolbar.show(),o(this,nt)._resetSticky(),o(this,ot)._updatePlaceholder(t),o(this,oe).triggerEvent("onFocus",{frameContext:t,event:i}),this._callPluginEvent("onFocus",{frameContext:t,event:i})}__postBlurEvent(t,i){o(this,be).mode.isInline?yt.setTimeout(()=>{o(this,be).get("hasFocus")||this._hideToolbar()},0):o(this,be).mode.isBalloon&&this._hideToolbar(),o(this,be).mode.isSubBalloon&&this._hideToolbar_sub(),o(this,oe).triggerEvent("onBlur",{frameContext:t,event:i}),this._callPluginEvent("onBlur",{frameContext:t,event:i})}__setViewportSize(){o(this,be).set("currentViewportHeight",Q.get(yt.visualViewport.height,0))}}be=new WeakMap,fi=new WeakMap,ts=new WeakMap,Rt=new WeakMap,oe=new WeakMap,nt=new WeakMap,ot=new WeakMap,It=new WeakMap,Wt=new WeakMap,Pn=new WeakMap,Hn=new WeakMap,Fn=new WeakMap,Up=new WeakSet,T5=function(){o(this,Wt)&&yt.clearTimeout(o(this,Wt)),E(this,Wt,yt.setTimeout(()=>{yt.clearTimeout(o(this,Wt)),E(this,Wt,null),this._toggleToolbarBalloon()},250))},qp=new WeakSet,S5=async function(t,i,n,r){i.preventDefault(),i.stopPropagation();let a=n.getData("text/plain"),c=n.getData("text/html");const d=!c,u=this.__secopy===a,f=/class=["']*Mso(Normal|List)/i.test(c)||/content=["']*Word.Document/i.test(c)||/content=["']*OneNote.File/i.test(c)||/content=["']*Excel.Sheet/i.test(c),p=u?"SE":f?"MS":"";if(d?c=Se.htmlToEntity(a).replace(/\n/g,"<br>"):(c=c.replace(/^<html>\r?\n?<body>\r?\n?\x3C!--StartFragment-->|\x3C!--EndFragment-->\r?\n?<\/body>\r?\n?<\/html>$/g,""),f&&(c=c.replace(/\n/g," "),a=a.replace(/\n/g," "),c=cN.cleanHTML(c))),!u&&o(this,Rt).get("autoLinkify")){const v=new DOMParser().parseFromString(c,"text/html");h.query.getListChildNodes(v.body,Se.textToAnchor,null),c=v.body.innerHTML}d||(c=this.$.html.clean(c,{forceFormat:!1,whitelist:null,blacklist:null}));const m=this.$.char.test(this.$.frameOptions.get("charCounter_type")==="byte-html"?c:a,!1);if(t==="paste"){const y=await o(this,oe).triggerEvent("onPaste",{frameContext:r,event:i,data:c,maxCharCount:m,from:p});if(y===!1)return!1;if(typeof y=="string"){if(!y)return!1;c=y}}if(t==="drop"){const y=await o(this,oe).triggerEvent("onDrop",{frameContext:r,event:i,data:c,maxCharCount:m,from:p});if(y===!1)return!1;if(typeof y=="string"){if(!y)return!1;c=y}}const g=n.files;if(g.length>0&&!f){for(let y=0,v=g.length;y<v;y++)await this._callPluginEventAsync("onFilePasteAndDrop",{frameContext:r,event:i,file:g[y]});return!1}if(!m)return!1;if(c){const y=new DOMParser().parseFromString(c,"text/html");return await this._callPluginEventAsync("onPaste",{frameContext:r,event:i,data:c,doc:y})!==!1&&this.$.html.insert(c,{selectInserted:!1,skipCharCount:!0,skipCleaning:!0}),r.has("documentType_use_header")&&r.get("documentType").reHeader(),!1}},gr=new WeakSet,Tc=function(){o(this,It).currentDropdownActiveButton&&o(this,It).currentDropdown&&o(this,It).__resetMenuPosition(o(this,It).currentDropdownActiveButton,o(this,It).currentDropdown),o(this,ot)._repositionControllers()},Zp=new WeakSet,x5=function(){me.isResizeObserverSupported||(o(this,nt).resetResponsiveToolbar(),o(this,Rt).get("_subMode")&&this.$.subToolbar.resetResponsiveToolbar());const t=o(this,ts).get("toolbar_main"),i=t.style.display==="none"||o(this,be).mode.isInline&&!o(this,nt).inlineToolbarAttr.isShow;if(t.offsetWidth===0&&!i)return;const n=o(this,ot).opendBrowser;if(n&&n.area.style.display==="block"&&(n.body.style.maxHeight=h.utils.getClientSize().h-n.header.offsetHeight-50+"px"),o(this,It).currentDropdownActiveButton&&o(this,It).currentDropdown&&o(this,It).__resetMenuPosition(o(this,It).currentDropdownActiveButton,o(this,It).currentDropdown),this.$.viewer._resetFullScreenHeight())return;const r=this.$.frameContext;if(r.get("isCodeView")&&o(this,be).mode.isInline){o(this,nt)._showInline();return}o(this,ot)._iframeAutoHeight(r),o(this,nt).isSticky&&(o(this,nt).isCSSSticky||(o(this,ts).get("toolbar_main").style.width=r.get("topArea").offsetWidth-2+"px"),o(this,nt)._resetSticky())},Gp=new WeakSet,M5=function(t,i,n){o(this,ot)._syncScrollPosition(i),T(this,gr,Tc).call(this),this._callPluginEvent("onScroll",{frameContext:t,event:n}),t.has("documentType_use_page")&&t.get("documentType").scrollPage(),o(this,oe).triggerEvent("onScroll",{frameContext:t,event:n})},Yp=new WeakSet,B5=function(t,i){if(this.$.selection.__iframeFocus||t.get("isReadOnly")||t.get("isDisabled"))return i.preventDefault(),!1;o(this,be).set("hasFocus",!0),this.$.component.__prevent=!1,o(this,oe).triggerEvent("onNativeFocus",{frameContext:t,event:i});const n=t.get("key");if(this._inputFocus){o(this,be).mode.isInline&&yt.setTimeout(()=>{o(this,nt)._showInline()},0);return}o(this,be).get("rootKey")===n&&o(this,be).get("_preventBlur")||o(this,be).get("_preventFocus")||(o(this,be).set("_preventFocus",!0),h.utils.removeClass(this.$.commandDispatcher.targets.get("codeView"),"active"),o(this,ot)._toggleCodeViewButtons(!1),this.$.facade.changeFrameContext(n),this.$.history.resetButtons(n,null),yt.setTimeout(()=>{this.__postFocusEvent(t,i)},0))},Kp=new WeakSet,N5=function(t,i){t.get("isCodeView")||t.get("isReadOnly")||t.get("isDisabled")||(o(this,be).set("hasFocus",!1),o(this,be).set("_lastSelectionNode",null),o(this,oe).triggerEvent("onNativeBlur",{frameContext:t,event:i}),o(this,ot)._updatePlaceholder(t),!(this._inputFocus||o(this,be).get("_preventBlur"))&&(o(this,be).set("_preventFocus",!1),this.selectionState.reset(),o(this,be).set("currentNodes",[]),o(this,be).set("currentNodesMap",[]),o(this,ot).offCurrentController(),o(this,fi).applyToRoots(n=>{n.get("navigation")&&(n.get("navigation").textContent="")}),this.$.history.check(t.get("key"),o(this,be).get("_range")),this.__postBlurEvent(t,i)))},Xp=new WeakSet,L5=function(t){t.stopPropagation(),this._resizeClientY=t.clientY,o(this,ot).enableBackWrapper("ns-resize"),E(this,Fn,o(this,oe).addGlobalEvent("mousemove",T(this,Qp,A5).bind(this))),E(this,Pn,o(this,oe).addGlobalEvent("mouseup",T(this,Jp,$5).bind(this)))},Qp=new WeakSet,A5=function(t){const i=this.$.frameContext,n=i.get("wrapper").offsetHeight+(t.clientY-this._resizeClientY),r=n<i.get("_minHeight")?i.get("_minHeight"):n;i.get("wysiwygFrame").style.height=i.get("code").style.height=r+"px",this._resizeClientY=t.clientY,me.isResizeObserverSupported||o(this,ot)._emitResizeEvent(i,r,null)},Jp=new WeakSet,$5=function(){o(this,ot).disableBackWrapper(),o(this,Fn)&&E(this,Fn,o(this,oe).removeGlobalEvent(o(this,Fn))),o(this,Pn)&&E(this,Pn,o(this,oe).removeGlobalEvent(o(this,Pn)))},oh=new WeakSet,Mg=function(t,i){i.preventDefault();const n=this._lineBreakComp;if(!n)return;const r=h.check.isListCell(n.parentElement),a=h.utils.createElement(r?"BR":h.check.isTableCell(n.parentElement)?"DIV":o(this,Rt).get("defaultLine"));if(r||(a.innerHTML="<br>"),!(this.$.frameOptions.get("charCounter_type")==="byte-html"&&!this.$.char.check(a.outerHTML))){n.parentNode.insertBefore(a,t==="t"?n:n.nextSibling),this.$.component.deselect();try{const c=r?a:a.firstChild;this.$.selection.setRange(c,1,c,1),this.$.history.push(!1)}catch(c){console.warn("[SUNEDITOR.lineBreaker.error]",c)}}},em=new WeakSet,O5=function(){o(this,be).set("initViewportHeight",yt.visualViewport.height),u0||o(this,ot).offCurrentController(),o(this,be).mode.isBalloon?o(this,nt).hide():o(this,be).mode.isSubBalloon&&this.$.subToolbar.hide(),T(this,Zp,x5).call(this)},tm=new WeakSet,V5=function(){u0&&o(this,Rt).get("_toolbar_sticky")>-1&&(o(this,nt)._resetSticky(),o(this,It).__restoreMenuPosition()),T(this,gr,Tc).call(this);const t=o(this,be).get("currentViewportHeight");this.__setViewportSize(),u0&&t>0&&t-yt.visualViewport.height>100&&o(this,be).get("hasFocus")&&this.$.selection.scrollTo(this.$.selection.getRange(),{behavior:"auto",block:"nearest",inline:"nearest"})},sm=new WeakSet,R5=function(){o(this,Rt).get("_toolbar_sticky")>-1&&o(this,nt)._resetSticky(),o(this,be).mode.isBalloon&&o(this,ts).get("toolbar_main").style.display==="block"?o(this,nt)._setBalloonOffset(o(this,nt).balloonOffset.position==="top"):o(this,be).mode.isSubBalloon&&o(this,ts).get("toolbar_sub_main").style.display==="block"&&this.$.subToolbar._setBalloonOffset(this.$.subToolbar.balloonOffset.position==="top"),T(this,gr,Tc).call(this),this.$.frameContext.has("documentType_use_page")&&this.$.frameContext.get("documentType").scrollWindow()},im=new WeakSet,I5=function(){o(this,Rt).get("_toolbar_sticky")>-1&&(o(this,nt)._resetSticky(),o(this,It).__restoreMenuPosition())},nm=new WeakSet,D5=function(t){let n=t.getSelection().anchorNode;o(this,fi).applyToRoots(r=>{if(n&&r.get("wysiwyg").contains(n)){if(r.get("isReadOnly")||r.get("isDisabled"))return;if(n=null,this.$.selection.init(),this.applyTagEffect(),o(this,ot)._updatePlaceholder(r),h0&&(o(this,be).mode.isBalloon||o(this,be).mode.isSubBalloon)&&T(this,Up,T5).call(this),r.has("documentType_use_header")){const a=h.query.getParentElement(this.$.selection.selectionNode,this.$.format.isLine.bind(this.$.format));r.get("documentType").on(a)}}})},om=new WeakSet,P5=function(){o(this,It).dropdownOff(),T(this,gr,Tc).call(this)},rm=new WeakSet,H5=function(t){this.$.facade.changeFrameContext(t.get("key")),h.utils.addClass(this.$.commandDispatcher.targets.get("codeView"),"active"),o(this,ot)._toggleCodeViewButtons(!0)},lm=new WeakSet,F5=function(t){this.$.facade.changeFrameContext(t.get("key")),h.utils.addClass(this.$.commandDispatcher.targets.get("markdownView"),"active"),o(this,ot)._toggleCodeViewButtons(!0)};function vv(s){if(s.key!=="Tab")return;s.preventDefault();const e=s.target,t=e.selectionStart,i=e.selectionEnd;e.value=e.value.substring(0,t)+" "+e.value.substring(i),e.selectionStart=e.selectionEnd=t+1}const E$=_$;var ss,ve,am,W5,cm,z5,dm,j5,um,U5,hm,q5;class T${constructor(e,t){b(this,am);b(this,cm);b(this,dm);b(this,um);b(this,hm);b(this,ss,new Map);b(this,ve,new Map);Mr(this,"$",null);const{product:i,options:n}=t;this.store=new $N(i),this.$={facade:e,store:this.store},T(this,am,W5).call(this,i,n),T(this,cm,z5).call(this),T(this,dm,j5).call(this,i),T(this,hm,q5).call(this),T(this,um,U5).call(this),this._eventOrchestrator=new E$(this),o(this,ss).get("eventManager")._bindOrchestrator(this._eventOrchestrator)}_destroy(){var t,i,n;if(this.$===null)return;const e=[];for(const[r,a]of o(this,ve))try{(t=a==null?void 0:a._destroy)==null||t.call(a)}catch(c){e.push(`[Logic:${r}] ${c.message}`)}o(this,ve).clear();try{(i=this._eventOrchestrator)==null||i._removeAllEvents()}catch(r){e.push(`[EventOrchestrator] ${r.message}`)}this._eventOrchestrator=null;for(const[r,a]of o(this,ss))try{(n=a==null?void 0:a._destroy)==null||n.call(a)}catch(c){e.push(`[Config:${r}] ${c.message}`)}o(this,ss).clear(),e.length>0&&console.warn("[CoreKernel._destroy] Cleanup completed with errors:",e),this.$=null,this.store._destroy(),this.store=null,this.facade=null}}ss=new WeakMap,ve=new WeakMap,am=new WeakSet,W5=function(e,t){const i=new VN(e),n=new RN(this,e,t);o(this,ss).set("contextProvider",i),o(this,ss).set("optionProvider",n),o(this,ss).set("instanceCheck",new DN(i.frameContext)),o(this,ss).set("eventManager",new qN(i,n,this.$))},cm=new WeakSet,z5=function(){const e=o(this,ss).get("contextProvider"),t=o(this,ss).get("optionProvider");Object.assign(this.$,{contextProvider:e,optionProvider:t,instanceCheck:o(this,ss).get("instanceCheck"),eventManager:o(this,ss).get("eventManager"),frameRoots:e.frameRoots,context:e.context,options:t.options,icons:e.icons,lang:e.lang,frameContext:e.frameContext,frameOptions:t.frameOptions})},dm=new WeakSet,j5=function(e){o(this,ve).set("offset",new GN(this)),o(this,ve).set("selection",new KN(this)),o(this,ve).set("html",new NL(this)),o(this,ve).set("nodeTransform",new AL(this)),o(this,ve).set("format",new QN(this)),o(this,ve).set("inline",new eL(this)),o(this,ve).set("listFormat",new sL(this)),o(this,ve).set("char",new OL(this)),o(this,ve).set("shortcuts",new RL(this)),o(this,ve).set("component",new JL(this)),o(this,ve).set("pluginManager",new tA(this,e)),o(this,ve).set("focusManager",new sA(this)),o(this,ve).set("ui",new wA(this)),o(this,ve).set("commandDispatcher",new vA(this)),o(this,ve).set("toolbar",new lv(this,{keyName:"toolbar",balloon:this.store.mode.isBalloon,balloonAlways:this.store.mode.isBalloonAlways,inline:this.store.mode.isInline,res:e.responsiveButtons})),this.$.options.has("_subMode")&&o(this,ve).set("subToolbar",new lv(this,{keyName:"toolbar_sub",balloon:this.store.mode.isSubBalloon,balloonAlways:this.store.mode.isSubBalloonAlways,inline:!1,res:e.responsiveButtons_sub})),o(this,ve).set("menu",new SA(this)),o(this,ve).set("viewer",new MA(this)),o(this,ve).set("finder",new LA(this)),o(this,ve).set("history",kA(this))},um=new WeakSet,U5=function(){for(const[,e]of o(this,ve))typeof(e==null?void 0:e._init)=="function"&&e._init()},hm=new WeakSet,q5=function(){const e=o(this,ve).get("pluginManager");Object.assign(this.$,{offset:o(this,ve).get("offset"),selection:o(this,ve).get("selection"),format:o(this,ve).get("format"),inline:o(this,ve).get("inline"),listFormat:o(this,ve).get("listFormat"),html:o(this,ve).get("html"),nodeTransform:o(this,ve).get("nodeTransform"),char:o(this,ve).get("char"),component:o(this,ve).get("component"),focusManager:o(this,ve).get("focusManager"),pluginManager:e,plugins:e.plugins,ui:o(this,ve).get("ui"),commandDispatcher:o(this,ve).get("commandDispatcher"),history:o(this,ve).get("history"),shortcuts:o(this,ve).get("shortcuts"),toolbar:o(this,ve).get("toolbar"),subToolbar:o(this,ve).get("subToolbar"),menu:o(this,ve).get("menu"),viewer:o(this,ve).get("viewer"),finder:o(this,ve).get("finder")})};const S$=T$;var is,Va,Yh,fm,Z5,pm,G5,mm,Y5,gm,K5,vm,X5;class x${constructor(e,t){b(this,Va);b(this,fm);b(this,pm);b(this,mm);b(this,gm);b(this,vm);b(this,is,void 0);Mr(this,"$");const i=gN(e,t),n=new S$(this,{product:i,options:t});E(this,is,n),this.$=n.$,T(this,vm,X5).call(this,t).catch(r=>{console.error("[SUNEDITOR:E_CREATE_FAIL] Failed to create editor instance.",r)})}isEmpty(e){const t=(e||this.$.frameContext).get("wysiwyg");return h.check.isZeroWidth(t.textContent)&&!t.querySelector(this.$.options.get("allowedEmptyTags"))&&(t.innerText.match(/\n/g)||"").length<=1}resetOptions(e){var t;this.$.optionProvider.reset(e),this.$.store.set("_lastSelectionNode",null),T(this,Va,Yh).call(this,this.$.frameRoots.get(this.$.store.get("rootKey")));for(const i of Object.values(this.$.plugins))(t=i.init)==null||t.call(i)}changeFrameContext(e){e!==this.$.store.get("rootKey")&&(this.$.store.set("rootKey",e),T(this,Va,Yh).call(this,this.$.frameRoots.get(e)),this.$.toolbar._resetSticky())}destroy(){this.$.options.get("hasCodeMirror")&&this.$.contextProvider.applyToRoots(e=>{const i=e.get("options").get("codeMirrorEditor");i&&i.toTextArea()}),h.utils.removeItem(this.$.context.get("toolbar_wrapper")),h.utils.removeItem(this.$.context.get("toolbar_sub_wrapper")),h.utils.removeItem(this.$.context.get("statusbar_wrapper"));for(const e in this.events)this.events[e]=null;return this.events=null,o(this,is)._destroy(),null}}is=new WeakMap,Va=new WeakSet,Yh=function(e){this.$.contextProvider.reset(e),this.$.optionProvider.resetFrame(e.get("options")),this.$.ui.reset(e)},fm=new WeakSet,Z5=function(e){this.$.store.set("initViewportHeight",me._w.visualViewport.height),o(this,is)._eventOrchestrator.__setViewportSize(),this.$.store.set("_canUseBeforeInput",me.canUseBeforeInput()),this.$.contextProvider.init(),T(this,Va,Yh).call(this,this.$.frameRoots.get(this.$.store.get("rootKey"))),T(this,mm,Y5).call(this,e),this.$.contextProvider.applyToRoots(t=>{o(this,is)._eventOrchestrator._addFrameEvents(t),T(this,pm,G5).call(this,t,t.get("options").get("value")),t.get("options").get("iframe")&&t.get("options").get("height")==="auto"&&this.$.ui._emitResizeEvent(t,t.get("wysiwygFrame").offsetHeight,null)}),o(this,is)._eventOrchestrator.__eventDoc=null,this.$.store._editorInitFinished=!0,this.$.pluginManager.checkFileInfo(!0),this.$.history.reset(),me._w.setTimeout(()=>{var t,i;if(!((t=this.$.context)!=null&&t.size)){console.warn("[SUNEDITOR:E_INIT_FAIL] Editor instance was destroyed before initialization completed. Check if destroy() was called.");return}this.$.context.get("toolbar_main").style.visibility="",this.$.contextProvider.applyToRoots(n=>{o(this,is)._eventOrchestrator._wwFrameObserver&&o(this,is)._eventOrchestrator._wwFrameObserver.observe(n.get("wysiwygFrame")),o(this,is)._eventOrchestrator._toolbarObserver&&o(this,is)._eventOrchestrator._toolbarObserver.observe(n.get("_toolbarShadow")),this.$.ui._syncFrameState(n)});for(const n of Object.values(this.$.plugins))(i=n.init)==null||i.call(n);this.$.selection.__init(),this.$.eventManager.triggerEvent("onload",{})},0)},pm=new WeakSet,G5=function(e,t){e.get("wysiwyg").innerHTML=this.$.html.clean(typeof t=="string"?t:(/^TEXTAREA$/i.test(e.get("originElement").nodeName)?e.get("originElement").value:e.get("originElement").innerHTML)||"",{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.$.options.get("freeCodeViewMode")})||"<"+this.$.options.get("defaultLine")+"><br></"+this.$.options.get("defaultLine")+">",e.has("charCounter")&&(e.get("charCounter").textContent=String(this.$.char.getLength())),e.has("wordCounter")&&(e.get("wordCounter").textContent=String(this.$.char.getWordCount())),this.$.options.get("type")==="document"&&(e.set("documentType",new LN(o(this,is),e)),e.get("documentType").useHeader&&e.set("documentType_use_header",!0),e.get("documentType").usePage&&(e.set("documentType_use_page",!0),e.get("documentTypePageMirror").innerHTML=e.get("wysiwyg").innerHTML))},mm=new WeakSet,Y5=function(e){this.$.pluginManager.init(e),this.$.shortcuts._registerShortcuts(),this.$.commandDispatcher._initCommandButtons(),this.$.ui.init()},gm=new WeakSet,K5=function(e,t,i){e.contentDocument.documentElement.className="sun-editor",e.contentDocument.head.innerHTML='<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">'+Se._setIframeStyleLinks(i.get("iframe_cssFileName"))+Se._setAutoHeightStyle(i.get("height")),e.contentDocument.body.className=t.get("_editableClass"),e.contentDocument.body.setAttribute("contenteditable","true"),t.get("_rtl")&&(e.contentDocument.body.dir="rtl")},vm=new WeakSet,X5=async function(e){o(this,is)._eventOrchestrator._addCommonEvents();const t=[];this.$.contextProvider.applyToRoots(i=>{const n=i.get("originElement"),r=i.get("topArea");if(n.style.display="none",r.style.display="block",n.parentNode.insertBefore(r,n.nextElementSibling),i.get("options").get("iframe")){const a=new Promise(c=>{const d=u=>{T(this,gm,K5).call(this,u,this.$.optionProvider.options,i.get("options")),c()};if(me.isGecko){let u=null;this.$.eventManager.addEvent(i.get("wysiwygFrame"),"load",({target:f})=>{clearTimeout(u),u=setTimeout(()=>{this.$&&d(f)},60)})}else this.$.eventManager.addEvent(i.get("wysiwygFrame"),"load",({target:u})=>{d(u)})});t.push(a)}}),this.$.contextProvider.applyToRoots(i=>{i.get("wrapper").appendChild(i.get("wysiwygFrame")),i.get("documentTypeInner")&&i.get("wrapper").insertBefore(i.get("documentTypeInner"),i.get("wysiwygFrame")),i.get("documentTypePage")&&(i.get("wrapper").appendChild(i.get("documentTypePage")),i.get("wrapper").appendChild(i.get("documentTypePageMirror"))),i.get("blockHandleArea")&&i.get("wrapper").insertBefore(i.get("blockHandleArea"),i.get("wysiwygFrame"))}),t.length>0&&await Promise.all(t),T(this,fm,Z5).call(this,e)};const M$=x$,B$={init(s){return{create:(e,t)=>this.create(e,t,s)}},create(s,e,t){if(typeof e!="object"&&(e={}),t&&(e=(()=>[t,e].reduce((n,r)=>(Object.entries(r).forEach(([a,c])=>{if(a==="plugins"&&c&&n[a]){const d=Array.isArray(n[a])?n[a]:Object.values(n[a]),u=Array.isArray(c)?c:Object.values(c);n[a]=[...u.filter(f=>!d.includes(f)),...d]}else n[a]=c}),n),{}))()),!s)throw Error('[SUNEDITOR.create.fail] The first parameter "target" is missing.');const i=[];if(typeof s=="string"){const n=document.querySelector(s);if(!n)throw Error(`[SUNEDITOR.create.fail]-[document.querySelector(${s})] Cannot find target element. Make sure "${s}" is a valid selector and exists in the document.`);i.push({key:null,target:n})}else if(s.nodeType===1)i.push({key:null,target:s});else{let n;for(const r in s){if(n=s[r],!n.target||n.target.nodeType!==1)throw Error(`[SUNEDITOR.create.fail] suneditor multi root requires textarea's element at the "target" property.`);n.key=r,i.push(n)}}return new M$(i,e)}};const Kg=l.defineComponent({__name:"AoRichTextEditor",props:{modelValue:{default:""},readonly:{type:Boolean,default:!1},placeholder:{default:""}},emits:["update:modelValue","blur","focus"],setup(s,{emit:e}){const t=s,i=e,n=l.ref(null),r=l.shallowRef(null),a=l.ref(t.modelValue??""),c=l.ref(!1),d=f=>({value:f,placeholder:t.placeholder,width:"100%",minHeight:"100px",statusBar:!1,charCounter:!1,buttonList:[["bold","italic","underline","strike"],["list"]],editable:!t.readonly,attributesWhitelist:{all:{"data-mention":"data-mention"}},defaultStyle:`
|
|
223
|
+
</div>`,i=h.utils.createElement("DIV",{class:"se-find-replace"},t);return{panel:i,findInput:i.querySelector(".se-find-replace-input"),replaceInput:i.querySelector(".se-replace-input"),countDisplay:i.querySelector(".se-find-replace-count"),replaceRow:i.querySelector(".se-find-replace-row-replace"),btnCase:i.querySelector(".se-find-opt-case"),btnWord:i.querySelector(".se-find-opt-word"),btnRegex:i.querySelector(".se-find-opt-regex"),btnPrev:i.querySelector('[data-command="prev"]'),btnNext:i.querySelector('[data-command="next"]'),btnReplace:i.querySelector('[data-command="replace"]'),btnReplaceAll:i.querySelector('[data-command="replace-all"]')}}const LA=Cg;class AA{constructor(e){Mr(this,"$");this.$=e.$}}const $A=AA,{isMobile:OA,_w:VA}=me;function RA(s){var n;const e=h.query.getEventTarget(s);let t=e;this.$.store.mode.isBalloon&&!((n=this.$.context.get("toolbar_sub_main"))!=null&&n.contains(t))&&this._hideToolbar_sub();const i=h.check.isInputElement(t);if(i?this.$.store.set("_preventBlur",!1):this.$.frameContext.get("wysiwyg").contains(this.$.selection.getNode())||this.$.focusManager.focus(),h.query.getParentElement(t,".se-dropdown"))s.stopPropagation(),this.$.ui.preventToolbarHide(!0);else{let r=t.getAttribute("data-command"),a=t.className;for(;t&&!r&&!/(se-menu-list|sun-editor-common|se-menu-tray)/.test(a);)t=t.parentElement,r=t.getAttribute("data-command"),a=t.className;if(i&&/^INPUT$/i.test(t==null?void 0:t.getAttribute("data-type"))){if(this.$.store.set("_preventBlur",!0),this._inputFocus=!0,this.$.store.get("hasFocus")||this.applyTagEffect(),!h.check.isInputElement(e)||e.disabled)return;const c=this.$.plugins[r];if(!c||(this.__inputBlurEvent&&this.__removeInput(),typeof c.toolbarInputChange=="function"&&(this.__inputPlugin={obj:c,target:e,value:e.value}),this.__inputBlurEvent=this.$.eventManager.addEvent(e,"blur",d=>{if(!c.isInputActive)try{const u=e.value.trim();typeof c.toolbarInputChange=="function"&&u!==this.__inputPlugin.value&&c.toolbarInputChange({target:e,value:u,event:d})}finally{VA.setTimeout(()=>this._inputFocus=!1,0),this.__removeInput()}}),!c))return;typeof c.toolbarInputKeyDown=="function"&&(this.__inputKeyEvent=this.$.eventManager.addEvent(e,"keydown",d=>{c.toolbarInputKeyDown({target:e,event:d})}))}else if(this.__inputBlurEvent&&this.__inputPlugin){const c=this.__inputPlugin.target.value.trim();c!==this.__inputPlugin.value&&this.__inputPlugin.obj.toolbarInputChange({target:this.__inputPlugin.target,value:c,event:s}),this.__removeInput();return}else this.$.frameContext.get("isCodeView")||(OA?this.$.store.set("_preventBlur",!0):(s.preventDefault(),me.isGecko&&r&&this.$.eventManager._injectActiveEvent(t)));(r===this.$.menu.currentDropdownName||r===this.$.menu.currentContainerName)&&s.stopPropagation()}}function IA(s){const e=h.query.getEventTarget(s),t=h.query.getCommandTarget(e);if(!t)return;let i=t,n="";for(;i&&!/se-menu-tray/.test(i.className)&&!n;)i=i.parentElement,n=i==null?void 0:i.getAttribute("data-key");if(!n)return;const r=this.$.plugins[n];!r||typeof r.action!="function"||(s.stopPropagation(),r.action(t))}function DA(s){const e=h.query.getEventTarget(s);this.$.commandDispatcher.runFromTarget(e)}const{_w:c1}=me,uv=new WeakMap;async function PA(s,e){const t=h.query.getEventTarget(e);if(this.$.store.set("_mousedown",!0),this.__onDownEv&&hv.call(this),this.__onDownEv=this.$.eventManager.addGlobalEvent("mouseup",hv.bind(this)),!(s.get("isReadOnly")||h.check.isNonEditable(s.get("wysiwyg")))){if(this.$.format._isExcludeSelectionElement(t)){e.preventDefault();return}this._setSelectionSync(),c1.setTimeout(this.$.selection.init.bind(this.$.selection),0),await this.$.eventManager.triggerEvent("onMouseDown",{frameContext:s,event:e})!==!1&&await this._callPluginEventAsync("onMouseDown",{frameContext:s,event:e})!==!1&&(this.$.store.mode.isBalloon?this._hideToolbar():this.$.store.mode.isSubBalloon&&this._hideToolbar_sub(),/FIGURE/i.test(t==null?void 0:t.nodeName)&&e.preventDefault())}}function hv(){this.$.store.set("_mousedown",!1),this.__onDownEv=this.$.eventManager.removeGlobalEvent(this.__onDownEv)}async function HA(s,e){await this.$.eventManager.triggerEvent("onMouseUp",{frameContext:s,event:e})!==!1&&await this._callPluginEventAsync("onMouseUp",{frameContext:s,event:e})}async function FA(s,e){const t=h.query.getEventTarget(e);if(s.get("isReadOnly"))return e.preventDefault(),h.check.isAnchor(t)&&c1.open(t.href,t.target),!1;if(h.check.isNonEditable(s.get("wysiwyg"))||await this.$.eventManager.triggerEvent("onClick",{frameContext:s,event:e})===!1||await this._callPluginEventAsync("onClick",{frameContext:s,event:e})===!1)return;const i=this.$.component.get(t);if(i){e.preventDefault(),this.$.component.select(i.target,i.pluginName);return}if(this.$.selection.init(),e.detail===3){const c=this.$.selection.getRange();this.$.format.isLine(c.endContainer)&&c.endOffset===0&&this.$.selection.setRange(c.startContainer,c.startOffset,c.startContainer,c.startContainer.textContent.length)}const n=this.$.selection.getNode(),r=this.$.format.getLine(n,null),a=this.$.format.getBlock(n,null);if(!r&&!h.check.isNonEditable(t)&&!h.check.isList(a)){const c=this.$.selection.getRange();if(this.$.format.getLine(c.startContainer)===this.$.format.getLine(c.endContainer))if(h.check.isList(a)){e.preventDefault();const d=n.nextElementSibling,u=h.utils.createElement("LI",null,n);a.insertBefore(u,d),this.$.focusManager.focus()}else!h.check.isWysiwygFrame(n)&&!this.$.component.is(n)&&(!h.check.isTableElements(n)||h.check.isTableCell(n))&&this._setDefaultLine(this.$.format.isBlock(a)?"DIV":this.$.options.get("defaultLine"))!==null&&(e.preventDefault(),this.$.focusManager.focus())}this.$.commandDispatcher._copyFormat(),(this.$.store.mode.isBalloon||this.$.store.mode.isSubBalloon)&&c1.setTimeout(this._toggleToolbarBalloon.bind(this),0)}function WA(s,e){if(s.get("isReadOnly")||s.get("isDisabled"))return!1;let t=uv.get(s);t||(t={rafId:null,event:null},uv.set(s,t)),t.event=e,t.rafId===null&&(t.rafId=c1.requestAnimationFrame(()=>{var r;const i=t.event;if(t.rafId=null,t.event=null,!i)return;const n=h.query.getEventTarget(i);we.get("__overInfo")!==!1&&!this.$.ui.selectMenuOn&&this.$.component.hoverSelect(n),(r=this.$.ui.blockHandle)==null||r.positionForTarget(n,i.clientY),this._callPluginEvent("onMouseMove",{frameContext:s,event:i})}))}async function zA(s,e){var t;(t=this.$.ui.blockHandle)==null||t.hide(e),await this.$.eventManager.triggerEvent("onMouseLeave",{frameContext:s,event:e})!==!1&&await this._callPluginEventAsync("onMouseLeave",{frameContext:s,event:e})}const jA={"event.prevent":({ctx:s})=>s.e.preventDefault(),"event.stop":({ctx:s})=>s.e.stopPropagation(),"event.prevent.stop":({ctx:s})=>{s.e.preventDefault(),s.e.stopPropagation()},"cache.styleNode":({ports:s})=>s.styleNodeCache(),"cache.formatAttrsTemp":({ports:s},{attrs:e})=>s.formatAttrsTempCache(e),"focusManager.nativeFocus":({ports:s})=>s.focusManager.nativeFocus(),"history.push":({ports:s},e)=>s.history.push(e),"documentType.refreshHeader":({ctx:s})=>{he.setTimeout(()=>{s.fc.get("documentType").reHeader()},0)},"component.deselect":({ports:s})=>s.component.deselect(),"selection.setRange":({ports:s},{sc:e,so:t,ec:i,eo:n})=>s.selection.setRange(e,t,i,n),"format.removeBlock":({ports:s},{rangeEl:e,selectedFormats:t,newBlockElement:i,shouldDelete:n,skipHistory:r})=>s.format.removeBlock(e,{selectedFormats:t,newBlockElement:i,shouldDelete:n,skipHistory:r}),"dom.utils.removeItem":(s,{item:e})=>h.utils.removeItem(e),"select.component.fallback":({ports:s},{cmponentInfo:e})=>{s.component.select(e.target,e.pluginName)===!1&&s.focusManager.blur()}},UA={"del.format.removeAndMove":({ports:s},{container:e,formatEl:t})=>{const i=s.html.remove();if(i.commonCon!==i.container&&t.parentElement)if(t.contains(e)){const n=qA(t);s.selection.setRange(n,n.textContent.length,n,n.textContent.length)}else{const{focusNode:n,focusOffset:r}=ZA(t);s.selection.setRange(n,r,n,r)}},"backspace.brline.strip":({ctx:s,ports:e},{formatEl:t})=>{const i=s.options.get("defaultLine"),n=t.parentNode,r=h.utils.createElement(i);for(;t.firstChild&&!h.check.isBreak(t.firstChild);)r.appendChild(t.firstChild);t.firstChild&&h.check.isBreak(t.firstChild)&&t.removeChild(t.firstChild),r.firstChild||(r.innerHTML="<br>"),n.insertBefore(r,t),(!t.firstChild||!t.textContent.trim()&&!t.querySelector("br"))&&n.removeChild(t);const a=r.firstChild;e.selection.setRange(a,0,a,0)},"backspace.format.maintain":({ctx:s},{formatEl:e})=>{if(e.nodeName.toUpperCase()===s.options.get("defaultLine").toUpperCase()){e.innerHTML="<br>";const t=e.attributes;for(;t[0];)e.removeAttribute(t[0].name)}else e.parentNode.replaceChild(h.utils.createElement(s.options.get("defaultLine"),null,"<br>"),e)},"backspace.component.select":({ports:s},{selectionNode:e,range:t,fileComponentInfo:i})=>{var r;let n=null;h.check.isBreak(e)?h.utils.removeItem(e):h.check.isBreak(n=(r=t.startContainer.childNodes)==null?void 0:r[t.startOffset])&&h.utils.removeItem(n),s.component.select(i.target,i.pluginName)===!1&&s.focusManager.blur()},"backspace.component.remove":({ports:s},{isList:e,sel:t,formatEl:i,fileComponentInfo:n})=>{e&&h.utils.removeItem(t),i.textContent.length===0&&h.utils.removeItem(i),s.component.select(n.target,n.pluginName)===!1&&s.focusManager.blur()},"backspace.list.mergePrev":({ports:s},{prev:e,formatEl:t,rangeEl:i})=>{let n=e===i.parentNode?i.previousSibling:e.lastChild;n||(n=h.utils.createTextNode(Ie.zeroWidthSpace),i.parentNode.insertBefore(n,i.parentNode.firstChild));const r=n.nodeType===3?n.textContent.length:1,a=t.childNodes;let c=n,d=a[0];for(;d=a[0];)e.insertBefore(d,c.nextSibling),c=d;h.utils.removeItem(t),i.children.length===0&&h.utils.removeItem(i),s.selection.setRange(n,r,n,r)},"backspace.list.removeNested":({ports:s},{range:e})=>{s.html.remove(),e.startContainer.nodeType===3&&s.selection.setRange(e.startContainer,e.startContainer.textContent.length,e.startContainer,e.startContainer.textContent.length)},"backspace.emptyLine.mergePrev":({ports:s},{formatEl:e,prev:t})=>{h.utils.removeItem(e),fv(s,t,!0)},"backspace.brline.rowMerge":({ports:s},{rowEndBr:e,rowStartBr:t})=>{const i=t.nextSibling;i!==e&&(i==null?void 0:i.nodeType)===3&&h.check.isZeroWidth(i)&&h.utils.removeItem(i);const n=t.previousSibling;if(h.utils.removeItem(t),n&&n.nodeType===3)s.selection.setRange(n,n.textContent.length,n,n.textContent.length);else if(h.check.isBreak(n))s.selection.setRange(e,0,e,0);else{const r=e.parentNode;s.selection.setRange(r,0,r,0)}},"backspace.softBreak.merge":({ports:s},{zws:e})=>{const t=e.previousSibling,i=e.parentNode,n=t==null?void 0:t.previousSibling;h.utils.removeItem(e),t&&h.utils.removeItem(t),n?d0(s,n):i&&s.selection.setRange(i,0,i,0)},"delete.component.select":({ports:s},{formatEl:e,fileComponentInfo:t})=>{if(h.check.isListCell(e)){const i=t.container.previousSibling;h.check.isZeroWidth(i)&&h.utils.removeItem(i)}else h.check.isZeroWidth(e)&&h.utils.removeItem(e);s.component.select(t.target,t.pluginName)===!1&&s.focusManager.blur()},"delete.component.selectNext":({ports:s,ctx:e},{formatEl:t,nextEl:i})=>{if(h.check.isZeroWidth(t)&&(h.utils.removeItem(t),h.check.isTable(i))){let r=h.query.getEdgeChild(i,h.check.isTableCell,!1);r=r.firstElementChild||r,s.selection.setRange(r,0,r,0);return}const n=s.component.get(i);n?(e.e.stopPropagation(),s.component.select(n.target,n.pluginName)===!1&&s.focusManager.blur()):s.component.is(i)&&(e.e.stopPropagation(),h.utils.removeItem(i))},"delete.list.removeNested":({ports:s,ctx:e},{range:t,formatEl:i,rangeEl:n})=>{t.startContainer!==t.endContainer&&s.html.remove();const r=h.utils.arrayFind(i.children,h.check.isList)||i.nextElementSibling||n.parentElement.nextElementSibling;if(r&&(h.check.isList(r)||h.utils.arrayFind(r.children,h.check.isList))){e.e.preventDefault();let a,c;if(h.check.isList(r)){const d=r.firstElementChild;for(c=d.childNodes,a=c[0];c[0];)i.insertBefore(c[0],r);h.utils.removeItem(d)}else{for(a=r.firstChild,c=r.childNodes;c[0];)i.appendChild(c[0]);h.utils.removeItem(r)}s.selection.setRange(a,0,a,0),s.history.push(!0)}},"delete.emptyLine.mergeNext":({ports:s},{formatEl:e,next:t})=>{h.utils.removeItem(e),fv(s,t,!1)},"line.merge":({ports:s},{into:e,from:t})=>{const i=s.format,n=t.parentElement;pv(e);const r=e.lastChild;for(pv(t);t.firstChild;)e.appendChild(t.firstChild);h.utils.removeItem(t);let a=n;for(;a&&a!==e.parentElement&&i.isBlock(a)&&!i.isClosureBlock(a)&&h.check.isZeroWidth(a);){const c=a.parentElement;h.utils.removeItem(a),a=c}e.firstChild||e.appendChild(h.utils.createElement("BR")),r?d0(s,r):s.selection.setRange(e,0,e,0)},"delete.brline.rowMerge":({ports:s},{rowEndBr:e})=>{let t=e.nextSibling;(t==null?void 0:t.nodeType)===3&&h.check.isZeroWidth(t)&&(t=t.nextSibling);const i=e.parentNode;h.utils.removeItem(e),t&&(t.nodeType===3||h.check.isBreak(t))?s.selection.setRange(t,0,t,0):s.selection.setRange(i,i.childNodes.length,i,i.childNodes.length)},"delete.softBreak.merge":({ports:s},{br:e})=>{const t=e.previousSibling,i=e.parentNode,n=e.nextSibling;n&&n.nodeType===3&&h.check.isZeroWidth(n.textContent)&&h.utils.removeItem(n),h.utils.removeItem(e),t?d0(s,t):i&&s.selection.setRange(i,0,i,0)},"tab.format.indent":({ports:s,ctx:e},{range:t,formatEl:i,shift:n})=>{const r=s.format.getLines(null),a=[],c=[],d=h.check.isListCell(r[0]),u=h.check.isListCell(r.at(-1));let f={sc:t.startContainer,so:t.startOffset,ec:t.endContainer,eo:t.endOffset};for(let p=0,m=r.length,g;p<m;p++)if(g=r[p],h.check.isListCell(g)){if(!g.previousElementSibling&&!n)continue;a.push(g)}else c.push(g);if(a.length>0&&(f=s.listFormat.applyNested(a,n)),c.length>0)if(n){const p=c.length-1;for(let y=0,v;y<=p;y++){v=c[y].childNodes;for(let C=0,w=v.length,k;C<w&&(k=v[C],!!k);C++)if(!h.check.isZeroWidth(k)){/^\s{1,4}$/.test(k.textContent)?h.utils.removeItem(k):/^\s{1,4}/.test(k.textContent)&&(k.textContent=k.textContent.replace(/^\s{1,4}/,""));break}}const m=h.query.getEdgeChild(c[0],"text",!1),g=h.query.getEdgeChild(c[p],"text",!0);!d&&m&&(f.sc=m,f.so=0),!u&&g&&(f.ec=g,f.eo=g.textContent.length)}else if(c.length===1){let p=e.store.get("tabSize")+1;if(e.options.get("syncTabIndent")){const g=h.query.findTextIndexOnLine(i,t.startContainer,t.startOffset,v=>s.component.is(v)),y=s.format.isLine(i.previousElementSibling)?h.query.findTabEndIndex(i.previousElementSibling,g,2):0;y>g&&(p=y-g)}const m=h.utils.createTextNode(new Array(p).join(" "));if(!s.html.insertNode(m,{afterNode:null,skipCharCount:!1}))return!1;d||(f.sc=m,f.so=m.length),u||(f.ec=m,f.eo=m.length)}else{const p=h.utils.createTextNode(new Array(e.store.get("tabSize")+1).join(" ")),m=c.length-1;for(let v=0,C;v<=m;v++)C=c[v].firstChild,C&&(h.check.isBreak(C)?c[v].insertBefore(p.cloneNode(!1),C):C.textContent=p.textContent+C.textContent);const g=h.query.getEdgeChild(c[0],"text",!1),y=h.query.getEdgeChild(c[m],"text",!0);!d&&g&&(f.sc=g,f.so=0),!u&&y&&(f.ec=y,f.eo=y.textContent.length)}s.selection.setRange(f.sc,f.so,f.ec,f.eo)},"caret.scrollTo":({ports:s},{range:e})=>{s.caretScrollTo(e)},"enter.line.addDefault":({ports:s},{formatEl:e})=>{const i=s.format.addLineAfter(e).firstChild;s.selection.setRange(i,0,i,0)},"enter.list.addItem":({ports:s},{formatEl:e,selectionNode:t})=>{const i=h.utils.createElement("BR"),n=h.utils.createElement("LI",null,i);e.parentNode.insertBefore(n,e.nextElementSibling),n.appendChild(t.nextSibling),s.selection.setRange(i,1,i,1)},"enter.format.exitEmpty":({ports:s,ctx:e},{formatEl:t,rangeEl:i})=>{let n=null;if(h.check.isListCell(i.parentElement)){const r=t.parentNode.parentElement;i=r.parentElement;const a=h.utils.createElement("LI");a.innerHTML="<br>",h.utils.copyTagAttributes(a,t,e.options.get("lineAttrReset")),n=a,i.insertBefore(n,r.nextElementSibling)}else{let r;h.check.isTableCell(i.parentElement)?r="DIV":h.check.isList(i.parentElement)?r="LI":s.format.isLine(i.nextElementSibling)?r=i.nextElementSibling.nodeName:s.format.isLine(i.previousElementSibling)?r=i.previousElementSibling.nodeName:r=e.options.get("defaultLine"),n=h.utils.createElement(r);const a=s.format.removeBlock(i,{selectedFormats:[t],newBlockElement:null,shouldDelete:!0,skipHistory:!0});a.cc.insertBefore(n,a.sc?a.sc.nextSibling:a.cc.firstChild)}n.innerHTML="<br>",s.nodeTransform.removeAllParents(t,null,null),s.selection.setRange(n,1,n,1)},"enter.format.cleanBrAndZWS":({ports:s},{selectionNode:e,selectionFormat:t,brBlock:i,children:n,offset:r})=>{t?h.utils.removeItem(n[r-1]):h.utils.removeItem(e);const a=i.nextElementSibling,c=s.format.addLine(i,s.format.isLine(a)?a:null);h.utils.copyFormatAttributes(c,i),s.selection.setRange(c,1,c,1)},"enter.format.insertBrHtml":({ports:s},{brBlock:e,range:t,wSelection:i,offset:n})=>{s.html.insert(t.collapsed&&h.check.isBreak(t.startContainer.childNodes[t.startOffset-1])?"<br>":"<br><br>",{selectInserted:!1,skipCharCount:!0,skipCleaning:!0});let r=i.focusNode;const a=i.focusOffset;e===r&&(r=r.childNodes[a-n>1?a-1:a]),s.selection.setRange(r,1,r,1),s.setOnShortcutKey(!0)},"enter.brline.insert":({ports:s},{range:e})=>{s.selection.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset),e.collapsed||s.html.remove();const t=h.utils.createElement("BR");s.html.insertNode(t,{afterNode:null,skipCharCount:!0}),t.nextSibling||t.parentNode.appendChild(h.utils.createElement("BR"));const i=t.nextSibling;s.selection.setRange(i,0,i,0),s.setOnShortcutKey(!0)},"enter.shift.br":({ports:s,ctx:e},{range:t})=>{const i=e.fc.get("_wd"),n=s.selection.get(),a=(n==null?void 0:n.rangeCount)>0&&e.fc.get("wysiwyg").contains(n.focusNode)?n.getRangeAt(0):t,c=i.createRange();if(c.setStart(a.startContainer,a.startOffset),c.setEnd(a.endContainer,a.endOffset),a.collapsed||(c.deleteContents(),c.collapse(!0)),c.startContainer.nodeType===1&&h.check.isBreak(c.startContainer)){const f=c.startContainer;c.setStart(f.parentNode,h.utils.getArrayIndex(f.parentNode.childNodes,f)+c.startOffset),c.collapse(!0)}const d=h.utils.createElement("BR");c.insertNode(d);const u=d.nextSibling;if(u&&u.nodeType===3&&!h.check.isZeroWidth(u.textContent))s.selection.setRange(u,0,u,0);else{const f=h.utils.createTextNode(Ie.zeroWidthSpace);d.parentNode.insertBefore(f,d.nextSibling),s.selection.setRange(f,1,f,1)}s.history.push(!1)},"enter.brline.exit":({ports:s},{brBlock:e})=>{const t=e.lastChild;t&&(h.check.isBreak(t)||h.check.isZeroWidth(t.textContent))&&h.utils.removeItem(t);const i=e.nextElementSibling,n=s.format.addLine(e,s.format.isLine(i)?i:null);h.utils.copyFormatAttributes(n,e),s.selection.setRange(n,1,n,1)},"enter.format.insertBrNode":({ports:s},{wSelection:e})=>{const t=e.focusNode.nextSibling,i=h.utils.createElement("BR");s.html.insertNode(i,{afterNode:null,skipCharCount:!0});const n=i.previousSibling,r=i.nextSibling;!h.check.isBreak(t)&&!h.check.isBreak(n)&&(!r||h.check.isZeroWidth(r))?(i.parentNode.insertBefore(i.cloneNode(!1),i),s.selection.setRange(i,1,i,1)):s.selection.setRange(r,0,r,0),s.setOnShortcutKey(!0)},"enter.format.breakAtEdge":({ports:s,ctx:e},{formatEl:t,selectionNode:i,formatStartEdge:n,formatEndEdge:r,bidiSwapped:a})=>{const c=h.utils.createElement("BR"),d=h.utils.createElement(t.nodeName,null,c);h.utils.copyTagAttributes(d,t,e.options.get("lineAttrReset"));let u=c;if(!(r&&e.options.get("lineBreakClearStyle"))){let f=i;do{if(!h.check.isBreak(f)&&f.nodeType===1){const p=f.cloneNode(!1);p.appendChild(u),u=p}f=f.parentElement}while(t!==f&&t.contains(f))}if(d.appendChild(u),t.parentNode.insertBefore(d,n&&!r?t:t.nextElementSibling),r)s.selection.setRange(c,1,c,1);else if(a)s.selection.setRange(t,1,t,1);else{const f=t.firstChild||t;s.selection.setRange(f,0,f,0)}},"enter.format.breakWithSelection":({ports:s,ctx:e},{formatEl:t,range:i,formatStartEdge:n,formatEndEdge:r})=>{const a=s.format.getLine(i.startContainer,null)!==s.format.getLine(i.endContainer,null),c=t.cloneNode(!1);c.innerHTML="<br>";const d=i.commonAncestorContainer,u=d===i.startContainer&&d===i.endContainer&&h.check.isZeroWidth(d)?{container:d,offset:i.endOffset,prevContainer:d.previousElementSibling,commonCon:d}:s.html.remove();let f=s.format.getLine(u.container,null),p=0;if(!f){h.check.isWysiwygFrame(u.container)&&(s.enterPrevent(e.e),e.fc.get("wysiwyg").appendChild(c),f=c,h.utils.copyTagAttributes(f,t,e.options.get("lineAttrReset")),s.selection.setRange(f,p,f,p));return}const m=s.format.getBlock(u.container);f=f.contains(m)?h.query.getEdgeChild(m,g=>!!s.format.getLine(g),!1):f,a?r&&!n?(f.parentNode.insertBefore(c,!u.prevContainer||u.container===u.prevContainer?f.nextElementSibling:f),f=c,p=0):(p=u.offset,n&&(f.parentNode.insertBefore(c,f),r&&(p=0))):r&&n?(f.parentNode.insertBefore(c,f),p=0):r?(f=f.parentNode.insertBefore(c,f.nextElementSibling),f=c,p=0):f=s.nodeTransform.split(u.container,u.offset,h.query.getNodeDepth(t)),s.enterPrevent(e.e),h.utils.copyTagAttributes(f,t,e.options.get("lineAttrReset")),s.selection.setRange(f,p,f,p)},"enter.format.breakAtCursor":({ports:s,ctx:e},{formatEl:t,range:i})=>{let n=null;h.check.isZeroWidth(t)?n=s.format.addLine(t,t.cloneNode(!1)):n=s.nodeTransform.split(i.endContainer,i.endOffset,h.query.getNodeDepth(t)),s.enterPrevent(e.e),h.utils.copyTagAttributes(n,t,e.options.get("lineAttrReset")),s.selection.setRange(n,0,n,0)},"enter.figcaption.exitInList":({ports:s},{formatEl:e})=>{const t=s.format.addLine(e,null);s.selection.setRange(t,0,t,0)},"keydown.input.insertNbsp":({ports:s})=>{const e=s.html.insertNode(h.utils.createTextNode(" "),{afterNode:null,skipCharCount:!0});e&&s.selection.setRange(e,e.length,e,e.length)},"keydown.input.insertZWS":({ports:s})=>{const e=h.utils.createTextNode(Ie.zeroWidthSpace);s.html.insertNode(e,{afterNode:null,skipCharCount:!0}),s.selection.setRange(e,1,e,1)}};function fv(s,e,t){const i=t?e.childNodes.length:0;s.selection.setRange(e,i,e,i)}function d0(s,e){const t=e.nodeType===3?e.textContent.length:e.childNodes.length;s.selection.setRange(e,t,e,t)}function pv(s){let e=s.lastChild;for(;e&&(h.check.isBreak(e)||e.nodeType===3&&h.check.isZeroWidth(e));){const t=e.previousSibling;h.utils.removeItem(e),e=t}}function qA(s){const e=s.lastChild,t=s.nextElementSibling;if(!t)return e;if(h.check.isZeroWidth(t))return h.utils.removeItem(t),e;const i=t.childNodes;for(;i[0];)s.appendChild(i[0]);return h.utils.removeItem(t),e}function ZA(s){var r;const e=s.childNodes,t=s.previousElementSibling;let i=e[0],n=0;if(!t)return{focusNode:i,focusOffset:n};if(h.check.isZeroWidth(t))return h.utils.removeItem(t),{focusNode:i,focusOffset:n};if(e.length>1||((r=e[0])==null?void 0:r.textContent.length)>0)for(;e[0];)t.appendChild(e[0]);else i=t.lastChild,n=i.textContent.length;return h.utils.removeItem(s),{focusNode:i,focusOffset:n}}const GA="action.stop";async function b5(s,e){const t={...jA,...UA};for(const i of s){if(i.t===GA)return!1;const n=t[i.t];if(n&&await n(e,i.p)===!1)return!1}}function w5(s){var f;const e=s.selection.getRange(),t=e.startContainer,i=e.endContainer,n=s.format.getBlock(t),r=s.format.getBlock(i),a=h.check.isTableCell(n),c=h.check.isTableCell(r);if((a&&!n.previousElementSibling&&!n.parentElement.previousElementSibling||c&&!r.nextElementSibling&&!r.parentElement.nextElementSibling)&&n!==r){const p=((f=h.query.getParentElement(e.commonAncestorContainer,h.check.isFigure))==null?void 0:f.parentElement)||e.commonAncestorContainer;if(!a)h.utils.removeItem(h.query.getParentElement(r,m=>p===m.parentNode));else if(!c)h.utils.removeItem(h.query.getParentElement(n,m=>p===m.parentNode));else return h.utils.removeItem(h.query.getParentElement(n,m=>p===m.parentNode)),s.focusManager.nativeFocus(),!0}const d=t.nodeType===1?h.query.getParentElement(t,".se-component"):null,u=i.nodeType===1?h.query.getParentElement(i,".se-component"):null;return d&&h.utils.removeItem(d),u&&h.utils.removeItem(u),!1}function YA(s,e,t){let i=e.parentNode.previousSibling;const n=e.parentNode.nextSibling;i||(n?i=n:(i=h.utils.createElement("BR"),t.appendChild(i)));let r=e;for(;t.contains(r)&&!r.previousSibling;)r=r.parentNode;if(!t.contains(r))return e.textContent="",s.nodeTransform.removeAllParents(e,null,t),!0}function d1(s,e,t){const i=t?e.startContainer:e.endContainer,n=t?e.startOffset:e.endOffset,r=t?"previousSibling":"nextSibling",a=i.nodeType===1;let c;return a?(c=mv(s,i.childNodes[n],r,i),h.check.isComponentContainer(c)||h.check.isNonEditable(c)?c:null):(c=mv(s,i,r,i),h.check.isEdgePoint(i,n,t?"front":"end")&&(h.check.isComponentContainer(c)||h.check.isNonEditable(c))?c:null)}function mv(s,e,t,i){if(!e)return null;let n=e[t];if(!n)if(n=s.format.getLine(i),n=n?n[t]:null,n&&!s.component.is(n))n=t==="previousSibling"?n.firstChild:n.lastChild;else return null;return n}function KA(s,e){return s.setDefaultLine(e)}function xc(s,e,t,i){if(!s.collapsed||!e)return!1;const n=s.getBoundingClientRect();if(n.height<=0)return!1;const r=i.createRange();r.selectNodeContents(e);const a=r.getBoundingClientRect();return a.width<=2?!1:t==="front"?n.left<=a.left+2:n.left>=a.right-2}const G={prevent:()=>({t:"event.prevent"}),stop:()=>({t:"event.stop"}),preventStop:()=>({t:"event.prevent.stop"}),cacheStyleNode:()=>({t:"cache.styleNode"}),cacheFormatAttrsTemp:s=>({t:"cache.formatAttrsTemp",p:{attrs:s}}),componentDeselect:()=>({t:"component.deselect"}),editorNativeFocus:()=>({t:"focusManager.nativeFocus"}),historyPush:s=>({t:"history.push",p:s}),documentTypeRefreshHeader:()=>({t:"documentType.refreshHeader"}),selectionSetRange:(s,e,t,i)=>({t:"selection.setRange",p:{sc:s,so:e,ec:t,eo:i}}),formatRemoveBlock:(s,e,t,i,n)=>({t:"format.removeBlock",p:{rangeEl:s,selectedFormats:e,newBlockElement:t,shouldDelete:i,skipHistory:n}}),domUtilsRemoveItem:s=>({t:"dom.utils.removeItem",p:{item:s}}),selectComponentFallback:s=>({t:"select.component.fallback",p:{cmponentInfo:s}}),delFormatRemoveAndMove:(s,e)=>({t:"del.format.removeAndMove",p:{container:s,formatEl:e}}),backspaceFormatMaintain:s=>({t:"backspace.format.maintain",p:{formatEl:s}}),backspaceBrLineStrip:s=>({t:"backspace.brline.strip",p:{formatEl:s}}),backspaceComponentSelect:(s,e,t)=>({t:"backspace.component.select",p:{selectionNode:s,range:e,fileComponentInfo:t}}),backspaceComponentRemove:(s,e,t,i)=>({t:"backspace.component.remove",p:{isList:s,sel:e,formatEl:t,fileComponentInfo:i}}),backspaceListMergePrev:(s,e,t)=>({t:"backspace.list.mergePrev",p:{prev:s,formatEl:e,rangeEl:t}}),backspaceListRemoveNested:s=>({t:"backspace.list.removeNested",p:{range:s}}),backspaceEmptyLineMergePrev:(s,e)=>({t:"backspace.emptyLine.mergePrev",p:{formatEl:s,prev:e}}),backspaceBrLineRowMerge:(s,e)=>({t:"backspace.brline.rowMerge",p:{rowEndBr:s,rowStartBr:e}}),backspaceSoftBreakMerge:s=>({t:"backspace.softBreak.merge",p:{zws:s}}),deleteComponentSelect:(s,e)=>({t:"delete.component.select",p:{formatEl:s,fileComponentInfo:e}}),deleteComponentSelectNext:(s,e)=>({t:"delete.component.selectNext",p:{formatEl:s,nextEl:e}}),deleteListRemoveNested:(s,e,t)=>({t:"delete.list.removeNested",p:{range:s,formatEl:e,rangeEl:t}}),deleteEmptyLineMergeNext:(s,e)=>({t:"delete.emptyLine.mergeNext",p:{formatEl:s,next:e}}),deleteBrLineRowMerge:s=>({t:"delete.brline.rowMerge",p:{rowEndBr:s}}),deleteSoftBreakMerge:s=>({t:"delete.softBreak.merge",p:{br:s}}),mergeLineInto:(s,e)=>({t:"line.merge",p:{into:s,from:e}}),tabFormatIndent:(s,e,t)=>({t:"tab.format.indent",p:{range:s,formatEl:e,shift:t}}),caretScrollTo:s=>({t:"caret.scrollTo",p:{range:s}}),enterLineAddDefault:s=>({t:"enter.line.addDefault",p:{formatEl:s}}),enterListAddItem:(s,e)=>({t:"enter.list.addItem",p:{formatEl:s,selectionNode:e}}),enterFormatExitEmpty:(s,e)=>({t:"enter.format.exitEmpty",p:{formatEl:s,rangeEl:e}}),enterFormatCleanBrAndZWS:(s,e,t,i,n)=>({t:"enter.format.cleanBrAndZWS",p:{selectionNode:s,selectionFormat:e,brBlock:t,children:i,offset:n}}),enterFormatInsertBrHtml:(s,e,t,i)=>({t:"enter.format.insertBrHtml",p:{brBlock:s,range:e,wSelection:t,offset:i}}),enterFormatInsertBrNode:s=>({t:"enter.format.insertBrNode",p:{wSelection:s}}),enterBrLineInsert:s=>({t:"enter.brline.insert",p:{range:s}}),enterShiftBr:s=>({t:"enter.shift.br",p:{range:s}}),enterBrLineExit:s=>({t:"enter.brline.exit",p:{brBlock:s}}),enterFormatBreakAtEdge:(s,e,t,i,n)=>({t:"enter.format.breakAtEdge",p:{formatEl:s,selectionNode:e,formatStartEdge:t,formatEndEdge:i,bidiSwapped:n}}),enterFormatBreakWithSelection:(s,e,t,i)=>({t:"enter.format.breakWithSelection",p:{formatEl:s,range:e,formatStartEdge:t,formatEndEdge:i}}),enterFormatBreakAtCursor:(s,e)=>({t:"enter.format.breakAtCursor",p:{formatEl:s,range:e}}),enterFigcaptionExitInList:s=>({t:"enter.figcaption.exitInList",p:{formatEl:s}}),keydownInputInsertNbsp:()=>({t:"keydown.input.insertNbsp"}),keydownInputInsertZWS:()=>({t:"keydown.input.insertZWS"})};function XA(s,e,t){const{format:i,component:n}=e,{fc:r,options:a,range:c,selectionNode:d}=t;let{formatEl:u}=t;const f=!c.collapsed||c.startContainer!==c.endContainer,p=a.get("_rtl")&&!f&&c.startOffset===0&&xc(c,u,"front",r.get("_wd"));if(s.push(G.componentDeselect()),s.push(G.cacheStyleNode()),f&&w5(e))return s.push(G.preventStop()),s.push(G.caretScrollTo(c)),!0;if(!i.isNormalLine(u)&&!i.isBrLine(u)&&!r.get("wysiwyg").firstElementChild&&!n.is(d)&&KA(e,a.get("defaultLine"))!==null)return s.push(G.preventStop()),!1;if(i.isLine(u)&&f&&h.check.isEdgePoint(c.startContainer,c.startOffset,"front")&&(!c.startContainer.previousSibling||h.check.isZeroWidth(c.startContainer.previousSibling))&&i.getLine(c.startContainer)!==i.getLine(c.endContainer)&&(i.isLine(u.previousElementSibling)||h.check.isListCell(u)))return s.push(G.preventStop()),s.push(G.delFormatRemoveAndMove(c.startContainer,u)),s.push(G.historyPush(!0)),s.push(G.caretScrollTo(c)),!1;if(!f&&!p&&u&&i.isNormalLine(u)&&!h.check.isListCell(u)&&i.isEdgeLine(c.startContainer,c.startOffset,"front")){const C=QA(i,u);if(C)return s.push(G.preventStop()),s.push(G.mergeLineInto(C,u)),s.push(G.historyPush(!0)),!1}if(!f&&!p&&!u.previousElementSibling&&c.startOffset===0&&!d.previousSibling&&!h.check.isListCell(u)&&i.isLine(u)&&(!i.isBrLine(u)||i.isClosureBrLine(u)||h.check.isWysiwygFrame(u.parentNode)))return i.isClosureBlock(u.parentNode)?(s.push(G.preventStop()),!1):i.isBrLine(u)&&h.check.isWysiwygFrame(u.parentNode)?(s.push(G.preventStop()),s.push(G.backspaceBrLineStrip(u)),s.push(G.historyPush(!0)),!1):(h.check.isWysiwygFrame(u.parentNode)&&u.childNodes.length<=1&&(!u.firstChild||h.check.isZeroWidth(u.textContent))&&(s.push(G.preventStop()),s.push(G.backspaceFormatMaintain(u))),s.push(G.editorNativeFocus()),s.push(G.caretScrollTo(c)),!1);const m=c.startContainer;if(u&&!p&&!u.previousElementSibling&&c.startOffset===0&&m.nodeType===3&&h.check.isZeroWidth(m)&&YA(e,m,u)===!0)return!0;if(!f&&u&&(c.startOffset===0||d===u)){const C=d===u?d1(e,c,!0):h.check.isElement(d.previousSibling)?d.previousSibling:h.check.isEdgePoint(c.startContainer,c.startOffset)?h.query.getPreviousDeepestNode(c.startContainer):null;if(n.is(C)){const w=n.get(C);if(w)return s.push(G.preventStop()),s.push(G.backspaceComponentSelect(d,c,w)),!0}}if(d1(e,c,!0))return s.push(G.preventStop()),!0;!f&&!p&&i.isEdgeLine(c.startContainer,c.startOffset,"front")&&i.isLine(u.previousElementSibling)&&s.push(G.cacheFormatAttrsTemp(u.previousElementSibling.attributes)),u=i.getLine(c.startContainer,null);const g=i.getBlock(u,null),y=c.commonAncestorContainer;if(g&&u&&!h.check.isTableCell(g)&&!/^FIGCAPTION$/i.test(g.nodeName)){if(h.check.isListCell(u)&&h.check.isList(g)&&(h.check.isListCell(g.parentElement)||u.previousElementSibling)&&(d===u||d.nodeType===3&&(!d.previousSibling||h.check.isList(d.previousSibling)))&&(i.getLine(c.startContainer,null)!==i.getLine(c.endContainer,null)?g.contains(c.startContainer):c.startOffset===0&&c.collapsed&&!p)){if(c.startContainer!==c.endContainer)s.push(G.prevent()),s.push(G.backspaceListRemoveNested(c)),s.push(G.historyPush(!0));else{let C=u.previousElementSibling||g.parentElement;if(h.check.isListCell(C)){s.push(G.prevent());let w=C;if(!C.contains(u)&&h.check.isListCell(w)&&h.check.isList(w.lastElementChild)){for(w=w.lastElementChild.lastElementChild;h.check.isListCell(w)&&h.check.isList(w.lastElementChild);)w=w.lastElementChild&&w.lastElementChild.lastElementChild;C=w}s.push(G.backspaceListMergePrev(C,u,g)),s.push(G.historyPush(!0))}}return s.push(G.caretScrollTo(c)),!0}if(!f&&c.startOffset===0&&!p){let C=!0,w=y;for(;w&&w!==g&&!h.check.isWysiwygFrame(w);){if(w.previousSibling&&(w.previousSibling.nodeType===1||!h.check.isZeroWidth(w.previousSibling.textContent.trim()))){C=!1;break}w=w.parentNode}if(C&&g.parentNode)return s.push(G.prevent()),s.push(G.formatRemoveBlock(g,h.check.isListCell(u)?[u]:null,null,!1,!1)),s.push(G.historyPush(!0)),s.push(G.caretScrollTo(c)),!0}}if(!f&&u&&h.check.isEmptyLine(u)&&n.is(u.previousElementSibling)){const C=n.get(u.previousElementSibling);if(C)return s.push(G.preventStop()),s.push(G.backspaceComponentRemove(!1,u.firstChild,u,C)),s.push(G.caretScrollTo(c)),!0}if(!f&&u&&(c.startOffset===0||d===u&&u.childNodes[c.startOffset])){const C=h.check.isListCell(u),w=d===u?u.childNodes[c.startOffset]:d,k=(C?w:u).previousSibling,_=C||(y.nodeType===3||h.check.isBreak(y))&&!y.previousSibling&&c.startOffset===0;if(w&&(C||!w.previousSibling)&&(y&&n.is(y.previousSibling)||_&&n.is(k))){const M=n.get(k);return M?(s.push(G.preventStop()),s.push(G.backspaceComponentRemove(C,w,u,M))):n.is(k)&&(s.push(G.preventStop()),s.push(G.domUtilsRemoveItem(k))),s.push(G.caretScrollTo(c)),!0}if(w&&h.check.isNonEditable(w.previousSibling))return s.push(G.preventStop()),s.push(G.domUtilsRemoveItem(w.previousSibling)),s.push(G.caretScrollTo(c)),!0}if(!f&&i.isBrLine(u)&&h.check.isBreak(c.startContainer)&&c.startOffset===0){let C=c.startContainer.previousSibling;if((C==null?void 0:C.nodeType)===3&&h.check.isZeroWidth(C)&&(C=C.previousSibling),h.check.isBreak(C))return s.push(G.preventStop()),s.push(G.backspaceBrLineRowMerge(c.startContainer,C)),s.push(G.historyPush(!0)),s.push(G.caretScrollTo(c)),!1}if(!f&&c.startContainer.nodeType===3&&h.check.isZeroWidth(c.startContainer)&&c.startOffset<=1&&h.check.isBreak(c.startContainer.previousSibling))return s.push(G.preventStop()),s.push(G.backspaceSoftBreakMerge(c.startContainer)),s.push(G.historyPush(!0)),s.push(G.caretScrollTo(c)),!1;const v=u==null?void 0:u.previousElementSibling;return!f&&u&&i.isNormalLine(u)&&!h.check.isListCell(u)&&h.check.isEmptyLine(u)&&(i.isNormalLine(v)||i.isBrLine(v))?(s.push(G.preventStop()),s.push(G.backspaceEmptyLineMergePrev(u,v)),s.push(G.historyPush(!0)),s.push(G.caretScrollTo(c)),!1):(s.push(G.caretScrollTo(c)),!0)}function QA(s,e){let t=e.previousElementSibling;if(t){if(!s.isBlock(t))return null}else{const n=e.parentElement;if(!s.isBlock(n)||s.isClosureBlock(n)||(t=n.previousElementSibling,!t))return null}let i=t;for(;i&&s.isBlock(i)&&!s.isClosureBlock(i);)i=i.lastElementChild;return!s.isNormalLine(i)||h.check.isListCell(i)||s.isBrLine(i)||s.isClosureBrLine(i)?null:i}function JA(s,e,t){var g,y;const{format:i,component:n}=e,{fc:r,range:a,selectionNode:c}=t;let{formatEl:d}=t;const u=!a.collapsed||a.startContainer!==a.endContainer,f=t.options.get("_rtl")&&!u&&a.endOffset>=(((g=a.endContainer.textContent)==null?void 0:g.length)||0)&&xc(a,d,"end",r.get("_wd"));if(s.push(G.componentDeselect()),s.push(G.cacheStyleNode()),u&&w5(e))return s.push(G.preventStop()),!0;if(!u&&!f&&d&&i.isNormalLine(d)&&!h.check.isListCell(d)&&i.isEdgeLine(a.endContainer,a.endOffset,"end")){const v=e$(i,d);if(v)return s.push(G.preventStop()),s.push(G.mergeLineInto(d,v)),s.push(G.historyPush(!0)),!1}if(!u&&!f&&i.isEdgeLine(a.endContainer,a.endOffset,"end")&&!d.nextSibling)return s.push(G.preventStop()),!1;if(i.isLine(d)&&u&&h.check.isEdgePoint(a.endContainer,a.endOffset,"end")&&(!a.endContainer.nextSibling||h.check.isZeroWidth(a.endContainer.nextSibling))&&i.getLine(a.startContainer)!==i.getLine(a.endContainer)&&(i.isLine(d.nextElementSibling)||h.check.isListCell(d)))return s.push(G.preventStop()),s.push(G.delFormatRemoveAndMove(a.endContainer,d)),s.push(G.historyPush(!0)),!1;if(!u&&d&&(a.endOffset===a.endContainer.textContent.length||c===d)){const v=c===d?d1(e,a,!1):h.check.isElement(c.nextSibling)?c.nextSibling:h.check.isEdgePoint(a.endContainer,a.endOffset)?h.query.getNextDeepestNode(a.endContainer,null):null;if(n.is(v)){const C=n.get(v);if(C)return s.push(G.preventStop()),s.push(G.deleteComponentSelect(d,C)),!0}}if(d1(e,a,!1))return s.push(G.preventStop()),!0;if((i.isLine(c)||c.nextSibling===null||h.check.isZeroWidth(c.nextSibling)&&c.nextSibling.nextSibling===null)&&a.startOffset===c.textContent.length){const v=d.nextElementSibling;if(!v)return!0;if(n.is(v))return s.push(G.prevent()),s.push(G.deleteComponentSelectNext(d,v)),!0}if(!u&&(h.check.isEdgePoint(a.endContainer,a.endOffset)||c===d&&d.childNodes[a.startOffset])){const v=c===d&&d.childNodes[a.startOffset]||c;if(v&&h.check.isNonEditable(v.nextSibling))return s.push(G.preventStop()),s.push(G.domUtilsRemoveItem(v.nextSibling)),!0;if(n.is(v))return s.push(G.preventStop()),s.push(G.domUtilsRemoveItem(v)),!0}!u&&!f&&i.isEdgeLine(a.endContainer,a.endOffset,"end")&&i.isLine(d.nextElementSibling)&&s.push(G.cacheFormatAttrsTemp(d.attributes)),d=i.getLine(a.startContainer,null);const p=i.getBlock(d,null);if(h.check.isListCell(d)&&h.check.isList(p)&&(c===d||c.nodeType===3&&(!c.nextSibling||h.check.isList(c.nextSibling))&&(i.getLine(a.startContainer,null)!==i.getLine(a.endContainer,null)?p.contains(a.endContainer):a.endOffset===c.textContent.length&&a.collapsed&&!f)))return s.push(G.deleteListRemoveNested(a,d,p)),!0;if(!u&&i.isBrLine(d)&&h.check.isBreak(a.startContainer)&&a.startOffset===0){let v=a.startContainer.previousSibling;if((v==null?void 0:v.nodeType)===3&&h.check.isZeroWidth(v)&&(v=v.previousSibling),h.check.isBreak(v))return s.push(G.preventStop()),s.push(G.deleteBrLineRowMerge(a.startContainer)),s.push(G.historyPush(!0)),!1}if(!u){const v=a.startContainer;let C=null;if(v.nodeType===3&&a.startOffset>=v.textContent.length&&h.check.isBreak(v.nextSibling)){const w=v.nextSibling;((y=w.nextSibling)==null?void 0:y.nodeType)===3&&h.check.isZeroWidth(w.nextSibling.textContent)&&(C=w)}else v.nodeType===3&&h.check.isZeroWidth(v)&&a.startOffset===0&&h.check.isBreak(v.previousSibling)&&(C=v.previousSibling);if(C)return s.push(G.preventStop()),s.push(G.deleteSoftBreakMerge(C)),s.push(G.historyPush(!0)),!1}const m=d==null?void 0:d.nextElementSibling;return!u&&d&&i.isNormalLine(d)&&!h.check.isListCell(d)&&h.check.isEmptyLine(d)&&(i.isNormalLine(m)||i.isBrLine(m))?(s.push(G.preventStop()),s.push(G.deleteEmptyLineMergeNext(d,m)),s.push(G.historyPush(!0)),!1):!0}function e$(s,e){let t=e.nextElementSibling;if(t){if(!s.isBlock(t))return null}else{const n=e.parentElement;if(!s.isBlock(n)||s.isClosureBlock(n)||(t=n.nextElementSibling,!t))return null}let i=t;for(;i&&s.isBlock(i)&&!s.isClosureBlock(i);)i=i.firstElementChild;return!s.isNormalLine(i)||h.check.isListCell(i)||s.isBrLine(i)||s.isClosureBrLine(i)?null:i}function t$(s,e){const t=Array.from(s.childNodes),i=[[]];for(const f of t)h.check.isBreak(f)?i.push([]):i[i.length-1].push(f);t.length&&h.check.isBreak(t[t.length-1])&&i.pop();const n=f=>!f||f.every(p=>h.check.isZeroWidth(p.textContent)),r=e.anchorNode;let a=0;if(r===s)for(let f=0;f<e.anchorOffset&&f<t.length;f++)h.check.isBreak(t[f])&&a++;else for(const f of t){if(f===r||f.nodeType===1&&f.contains(r))break;h.check.isBreak(f)&&a++}const c=Math.max(i.length,1),d=Math.min(a,c-1);return{shouldExit:d===c-1&&n(i[d])&&d>=1&&n(i[d-1])}}function k5(s,e,t){const{format:i,char:n,selection:r}=e,{frameOptions:a,range:c,formatEl:d,selectionNode:u,shift:f,e:p}=t,m=!c.collapsed||c.startContainer!==c.endContainer;s.push(G.componentDeselect());const g=i.getBrLine(u,null),y=i.getBlock(d,null);if(a.get("charCounter_type")==="byte-html"){let v="";if(!f&&g||f?v="<br>":v="<"+d.nodeName+"><br></"+d.nodeName+">",!n.check(v))return s.push(G.prevent()),!1}if(f)return e.enterPrevent(p),s.push(G.enterShiftBr(c)),s.push(G.caretScrollTo(c)),!0;if(!f){let v=i.isEdgeLine(c.endContainer,c.endOffset,"end"),C=i.isEdgeLine(c.startContainer,c.startOffset,"front"),w=!1;if(t.options.get("_rtl")&&d&&c.collapsed&&C!==v){const k=t.fc.get("_wd");C&&xc(c,d,"front",k)?(C=!1,v=!0,w=!0):v&&xc(c,d,"end",k)&&(v=!1,C=!0,w=!0)}if(v&&(/^H[1-6]$/i.test(d.nodeName)||/^HR$/i.test(d.nodeName)))return e.enterPrevent(p),s.push(G.enterLineAddDefault(d)),s.push(G.caretScrollTo(c)),!0;if(y&&d&&!h.check.isTableCell(y)&&!/^FIGCAPTION$/i.test(y.nodeName)){const k=r.getRange();if(h.check.isEdgePoint(k.endContainer,k.endOffset)&&h.check.isList(u.nextSibling))return e.enterPrevent(p),s.push(G.enterListAddItem(d,u)),s.push(G.caretScrollTo(c)),!0;if((k.commonAncestorContainer.nodeType!==3||!k.commonAncestorContainer.nextElementSibling)&&h.check.isZeroWidth(d.innerText.trim())&&!h.check.isListCell(d.nextElementSibling))return e.enterPrevent(p),s.push(G.enterFormatExitEmpty(d,y)),!0}if(g||y===d&&i.isClosureBlock(y)&&i.isLine(d)){if(e.enterPrevent(p),g&&!i.isClosureBrLine(g))return t$(g,r.get()).shouldExit?s.push(G.enterBrLineExit(g)):s.push(G.enterBrLineInsert(c)),s.push(G.caretScrollTo(c)),!0;const k=r.get();return u===g?s.push(G.enterFormatInsertBrHtml(g,c,k,k.focusOffset)):s.push(G.enterFormatInsertBrNode(k)),s.push(G.caretScrollTo(c)),!0}if(c.collapsed&&(C||v))return e.enterPrevent(p),s.push(G.enterFormatBreakAtEdge(d,u,C,v,w)),s.push(G.caretScrollTo(c)),!0;if(d){if(s.push(G.prevent()),m){if(t.options.get("_rtl")&&C&&!v){const k=t.fc.get("_wd"),_=k.createRange();_.setStart(c.startContainer,c.startOffset),_.collapse(!0),xc(_,d,"front",k)&&(C=!1,v=!0,w=!0)}s.push(G.enterFormatBreakWithSelection(d,c,C,v))}else s.push(G.enterFormatBreakAtCursor(d,c));return s.push(G.caretScrollTo(c)),!0}}return m?(s.push(G.caretScrollTo(c)),!0):(y&&h.query.getParentElement(y,"FIGCAPTION")&&h.query.getParentElement(y,h.check.isList)&&(e.enterPrevent(p),s.push(G.enterFigcaptionExitInList(d)),s.push(G.caretScrollTo(c))),!0)}function s$(s,e,t){const{options:i,selectionNode:n,range:r,formatEl:a,ctrl:c,alt:d,shift:u}=t;return i.get("tabDisable")||(s.push(G.prevent()),c||d||h.check.isWysiwygFrame(n))||(s.push(G.tabFormatIndent(r,a,u)),s.push(G.historyPush(!1))),!0}function i$(s,e,t){var p;const{component:i}=e,{formatEl:n,range:r,selectionNode:a,keyCode:c}=t,d=t.options.get("_rtl"),u=c==="ArrowLeft"?d?"forward":"back":c==="ArrowRight"?d?"back":"forward":null;let f=null;switch(c){case"ArrowUp":i.is(n.previousElementSibling)&&(f=i.get(n.previousElementSibling));break;case"ArrowLeft":case"ArrowRight":if(u==="forward"){if(h.check.isEdgePoint(a,r.endOffset,"end")){const m=a.nextElementSibling||h.query.getNextDeepestNode(a);m?i.is(m)&&(f=i.get(m)):i.is(n.nextElementSibling)&&(f=i.get(n.nextElementSibling))}}else if(u==="back"&&h.check.isEdgePoint(a,r.startOffset,"front")){const m=a.previousElementSibling||h.query.getPreviousDeepestNode(a);m?i.is(m)&&(f=i.get(m)):i.is(n.previousElementSibling)&&(f=i.get(n.previousElementSibling))}break;case"ArrowDown":i.is(n.nextElementSibling)&&(f=i.get(n.nextElementSibling));break}f&&!((p=f.options)!=null&&p.isInputComponent)&&(s.push(G.prevent()),s.push(G.selectComponentFallback(f)))}const{isOSX_IOS:n$}=me,o$=!0;function Vm(s,e){return o$&&s.get("_canUseBeforeInput")&&!(e!=null&&e.repeat)}async function r$(s,e){const t=[];switch(e.keyCode){case"Backspace":{if(XA(t,s,e)===!1)return t;break}case"Delete":{if(JA(t,s,e)===!1)return t;break}case"Tab":{if(s$(t,s,e)===!1)return t;break}case"Enter":{if(!Vm(e.store,e.e)&&k5(t,s,e)===!1)return t;break}}const{fc:i,keyCode:n,shift:r,alt:a,ctrl:c,range:d}=e;if(r&&(n$?a:c)&&xe.isSpace(n))return t.push(G.preventStop()),t.push(G.keydownInputInsertNbsp()),t;const u=!d.collapsed||d.startContainer!==d.endContainer;return!c&&!a&&!u&&!xe.isNonTextKey(n)&&h.check.isBreak(d.commonAncestorContainer)?(t.push(G.keydownInputInsertZWS()),t):i.has("documentType_use_header")&&u&&!c&&!a&&!r&&!xe.isDirectionKey(n)?(t.push(G.documentTypeRefreshHeader()),t):(i$(t,s,e),t)}function _5(s,{_styleNodes:e}){const{frameContext:t,ui:i,focusManager:n,selection:r,format:a,listFormat:c,component:d,html:u,nodeTransform:f,history:p,char:m,menu:g,store:y}=s.$;return{focusManager:{nativeFocus:()=>n.nativeFocus(),blur:()=>n.blur()},selection:{getRange:()=>r.getRange(),getNode:()=>r.getNode(),setRange:(v,C,w,k)=>r.setRange(v,C,w,k),get:()=>r.get()},format:{isLine:v=>a.isLine(v),getLine:(v,C)=>a.getLine(v,C),getLines:v=>a.getLines(v),getBrLine:(v,C)=>a.getBrLine(v,C),getBlock:(v,C)=>a.getBlock(v,C),isNormalLine:v=>a.isNormalLine(v),isBrLine:v=>a.isBrLine(v),isClosureBrLine:v=>a.isClosureBrLine(v),isBlock:v=>a.isBlock(v),isClosureBlock:v=>a.isClosureBlock(v),isEdgeLine:(v,C,w)=>a.isEdgeLine(v,C,w),removeBlock:(v,C)=>a.removeBlock(v,C),addLine:(v,C)=>a.addLine(v,C),addLineAfter:v=>a.addLineAfter(v)},listFormat:{applyNested:(v,C)=>c.applyNested(v,C)},component:{deselect:()=>d.deselect(),is:v=>d.is(v),get:v=>d.get(v),select:(v,C)=>d.select(v,C)},html:{remove:()=>u.remove(),insert:(v,C)=>u.insert(v,C),insertNode:(v,C)=>u.insertNode(v,C)},history:{push:v=>p.push(!!v)},nodeTransform:{removeAllParents:(v,C,w)=>f.removeAllParents(v,C,w),split:(v,C,w)=>f.split(v,C,w)},char:{check:v=>m.check(v)},menu:{dropdownOff:()=>g.dropdownOff()},setDefaultLine:v=>s._setDefaultLine(v),hideToolbar:()=>s._hideToolbar(),hideToolbar_sub:()=>s._hideToolbar_sub(),styleNodeCache:()=>e.value=s.__cacheStyleNodes,formatAttrsTempCache:v=>s._formatAttrsTemp=v,setOnShortcutKey:v=>s._onShortcutKey=v,caretScrollTo(v){i._iframeAutoHeight(t),r.scrollTo(r.getRange()||v,{behavior:"auto",block:"nearest",inline:"nearest"})},enterPrevent(v){v.preventDefault(),!(!l3||Vm(y))&&(s.__focusTemp.focus({preventScroll:!0}),t.get("wysiwyg").focus({preventScroll:!0}))}}}const l$={value:[]};async function a$(s,e){if(s.get("isReadOnly")||s.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;if(Vm(this.$.store)&&(e.inputType==="insertParagraph"||e.inputType==="insertLineBreak")){await c$.call(this,s,e);return}const t=(e.data===null?"":e.data===void 0?" ":e.data)||"";if(xe.isComposing(e))this._handledInBefore=!1;else{if(!this.$.char.test(t,!1))return e.preventDefault(),e.stopPropagation(),!1;this._handledInBefore=!0}await this.$.eventManager.triggerEvent("onBeforeInput",{frameContext:s,event:e,data:t})!==!1&&await this._callPluginEventAsync("onBeforeInput",{frameContext:s,event:e,data:t})}async function c$(s,e){if(e.isComposing||this.isComposing||this.$.ui.selectMenuOn)return;let t=this.$.selection.getNode();if(h.check.isInputElement(t)||this.$.menu.currentDropdownName)return;h.check.isWysiwygFrame(t)&&(this._setDefaultLine(this.$.options.get("defaultLine")),t=this.$.selection.getNode());const i=this._enterKeyShift||e.inputType==="insertLineBreak";if(this._enterKeyShift=!1,!i){const u=this._normalizeEditRange();u&&(t=u)}const n=this.$.selection.getRange(),r=this.$.format.getLine(t,null)||t,a={e,fc:s,store:this.$.store,options:this.$.options,frameOptions:this.$.frameOptions,range:n,selectionNode:t,formatEl:r,keyCode:"Enter",ctrl:!1,alt:!1,shift:i},c=_5(this,{_styleNodes:l$}),d=[];k5(d,c,a),d.some(u=>u.t==="event.prevent"||u.t==="event.prevent.stop")&&e.preventDefault(),await b5(d,{ports:c,ctx:a})}async function d$(s,e){if(s.get("isReadOnly")||s.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;const t=this.$.selection.getRange(),i=this.$.selection.getNode(),n=this.$.format.getLine(i,null);if(!this.$.format.isNormalLine(n)&&!this.$.format.isBrLine(n)&&t.collapsed&&!this.$.component.is(i)&&!h.check.isList(i)){const a=this.$.format.getBlock(i,null);this._setDefaultLine(this.$.format.isBlock(a)?"DIV":this.$.options.get("defaultLine"))}this.$.selection.init();const r=(e.data===null?"":e.data===void 0?" ":e.data)||"";if(!this._handledInBefore&&!this.$.char.test(r,!0))return e.preventDefault(),e.stopPropagation(),!1;this._handledInBefore=!1,await this.$.eventManager.triggerEvent("onInput",{frameContext:s,event:e,data:r})!==!1&&(await this._callPluginEventAsync("onInput",{frameContext:s,event:e,data:r}),this.$.history.push(!0))}const{_w:gv}=me,u$=new RegExp(Ie.zeroWidthSpace+"+",""),Pr={ctrl:!1,alt:!1},Gh=Object.preventExtensions({value:[]});async function h$(s,e){var g,y;if(this.isComposing=xe.isComposing(e))return!0;if(this.$.ui.selectMenuOn||!e.isTrusted)return;let t=this.$.selection.getNode();if(h.check.isInputElement(t)||this.$.menu.currentDropdownName)return;const i=e.code,n=xe.isShift(e),r=Pr.ctrl=xe.isCtrl(e),a=Pr.alt=xe.isAlt(e);if(xe.isEnter(i)&&(this._enterKeyShift=n),!r&&s.get("isReadOnly")&&!xe.isDirectionKey(i))return e.preventDefault(),!1;if(this.$.menu.dropdownOff(),this.$.store.mode.isBalloon?this.$.store.mode.isBalloonAlways||this._hideToolbar():this.$.store.mode.isSubBalloon&&(this.$.store.mode.isSubBalloonAlways||this._hideToolbar_sub()),xe.isEnter(i)&&!Vm(this.$.store,e)||xe.isRemoveKey(i)){const v=this._normalizeEditRange();v&&(t=v)}const d=this.$.selection.getRange(),u=this.$.format.getLine(t,null)||t;if(r&&!xe.isNonTextKey(i)&&this.$.shortcuts.command(e,r,n,i,"",!1,null,null))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1;if(!r&&!xe.isNonTextKey(i)&&this.$.format.isLine(u)&&d.collapsed&&h.check.isEdgePoint(d.startContainer,0,"front")){const v=(y=(g=d.startContainer).substringData)==null?void 0:y.call(g,0,d.startOffset);if(v&&this.$.shortcuts.command(e,!1,n,i,v,!0,u,d))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1}else this._onShortcutKey&&(this._onShortcutKey=!1);const f={e,fc:s,store:this.$.store,options:this.$.options,frameOptions:this.$.frameOptions,range:d,selectionNode:t,formatEl:u,keyCode:i,ctrl:r,alt:a,shift:n},p=_5(this,{_styleNodes:Gh}),m=await r$(p,f);await this.$.eventManager.triggerEvent("onKeyDown",{frameContext:s,event:e})!==!1&&await this._callPluginEventAsync("onKeyDown",{frameContext:s,event:e,range:d,line:u})!==!1&&await b5(m,{ports:p,ctx:f})}async function f$(s,e){var p;if(this._onShortcutKey||this.$.menu.currentDropdownName)return;const t=e.code,i=xe.isCtrl(e),n=xe.isAlt(e);if(i&&(Pr.ctrl=!1),n&&(Pr.alt=!1),s.get("isReadOnly"))return;const r=this.$.selection.getRange();let a=this.$.selection.getNode();if((this.$.store.mode.isBalloon||this.$.store.mode.isSubBalloon)&&((this.$.store.mode.isBalloonAlways||this.$.store.mode.isSubBalloonAlways)&&!xe.isEsc(t)||!r.collapsed))if(this.$.store.mode.isBalloonAlways||this.$.store.mode.isSubBalloonAlways)xe.isEsc(t)||this._showToolbarBalloonDelay();else{this.$.store.mode.isSubBalloon?this.$.subToolbar._showBalloon():this.$.toolbar._showBalloon();return}if(xe.isBackspace(t)&&h.check.isWysiwygFrame(a)&&a.textContent===""&&a.children.length===0){e.preventDefault(),e.stopPropagation(),a.innerHTML="";const m=this.$.store.get("currentNodes")[0],g=h.utils.createElement(this.$.format.isLine(m)&&!h.check.isListCell(m)?m:this.$.options.get("defaultLine"),null,"<br>");a.appendChild(g),this.$.selection.setRange(g,0,g,0),this.applyTagEffect(),this.$.history.push(!1),s.has("documentType_use_header")&&xe.isDocumentTypeObserverKey(t)&&s.get("documentType").reHeader();return}const c=this.$.format.getLine(a,null),d=this.$.format.getBlock(a,null),u=this._formatAttrsTemp;if(c&&u){for(let m=0,g=u.length;m<g;m++){if(xe.isEnter(t)&&/^id$/i.test(u[m].name)){c.removeAttribute("id");continue}c.setAttribute(u[m].name,u[m].value)}this._formatAttrsTemp=null}if(!this.$.format.isNormalLine(c)&&!this.$.format.isBrLine(c)&&r.collapsed&&!this.$.component.is(a)&&!h.check.isList(a)&&this._setDefaultLine(this.$.format.isBlock(d)?"DIV":this.$.options.get("defaultLine"))!==null&&(a=this.$.selection.getNode()),!Pr.ctrl&&!Pr.alt&&!xe.isNonTextKey(t)&&a.nodeType===3&&Ie.zeroWidthRegExp.test(a.textContent)&&!(e.isComposing!==void 0?e.isComposing:this.isComposing)){let m=r.startOffset,g=r.endOffset;const y=(a.textContent.substring(0,g).match(u$)||"").length;m=r.startOffset-y,g=r.endOffset-y,a.textContent=a.textContent.replace(Ie.zeroWidthRegExp,""),this.$.selection.setRange(a,m<0?0:m,a,g<0?0:g)}if(xe.isRemoveKey(t)&&h.check.isZeroWidth(c==null?void 0:c.textContent)&&!c.previousElementSibling&&!h.check.isListCell(c)){const m=this.$.options.get("retainStyleMode");m!=="none"&&((p=Gh.value)==null?void 0:p.length)>0?m==="repeat"?this.__retainTimer?(this.__retainTimer=gv.clearTimeout(this.__retainTimer),this._clearRetainStyleNodes(c)):(this.__retainTimer=gv.setTimeout(()=>{this.__retainTimer=null},0),this._retainStyleNodes(c,Gh.value)):(this.__retainTimer=null,this._retainStyleNodes(c,Gh.value)):this._clearRetainStyleNodes(c)}if(s.has("documentType_use_header"))if(xe.isDocumentTypeObserverKey(t)){s.get("documentType").reHeader();const m=h.query.getParentElement(this.$.selection.selectionNode,this.$.format.isLine.bind(this.$.format));s.get("documentType").on(m)}else{const m=h.query.getParentElement(a,g=>g.nodeType===1);s.get("documentType").onChangeText(m)}await this.$.eventManager.triggerEvent("onKeyUp",{frameContext:s,event:e})!==!1&&await this._callPluginEventAsync("onKeyUp",{frameContext:s,event:e,range:r,line:c})!==!1&&xe.isHistoryRelevantKey(t)&&this.$.history.push(!0)}const{_w:p$}=me;function m$(s,e){const t=e.clipboardData;return t?this._dataTransferAction("paste",e,t,s):!0}async function g$(s,e){const t=e.clipboardData;if(await this.$.eventManager.triggerEvent("onCopy",{frameContext:s,event:e,clipboardData:t})===!1)return e.preventDefault(),e.stopPropagation(),!1;const i=s.get("_ww").getSelection();this.__secopy=i.toString()}async function v$(s,e){const t=e.clipboardData;if(await this.$.eventManager.triggerEvent("onCut",{frameContext:s,event:e,clipboardData:t})===!1)return e.preventDefault(),e.stopPropagation(),!1;const i=s.get("_ww").getSelection();this.__secopy=i.toString(),p$.setTimeout(()=>{this.$.history.push(!1)},0)}const{_w:Nh}=me;function y$(s,e,t,i,n){var m,g;if(n.dataTransfer&&Array.from(n.dataTransfer.types||[]).includes("application/x-suneditor-block-drag"))return;const{sc:r,so:a,ec:c,eo:d}=this.$.selection.getDragEventLocationRange(n);if(!r)return;n.preventDefault();const u=s.get("_wd").createRange();u.setStart(r,a),u.setEnd(c,d);const f={y:0,x:0};if(t){const y=this.$.offset.getGlobal(t),v=i?this.$.context.get("toolbar_main").offsetHeight:0;f.y=y.top+v-Nh.scrollY,f.x=y.left-Nh.scrollX}const p=u.getBoundingClientRect();if(p.height>0){const y=s.get("wysiwygFrame");let v=0,C=0;/^iframe$/i.test(y.nodeName)&&(v=y.offsetLeft,C=y.offsetTop),e.style.left=`${p.right+Nh.scrollX+f.x+v}px`,e.style.top=`${p.top+Nh.scrollY+f.y-5+C}px`,e.style.height=`${p.height+10}px`,e.style.display="block";try{(m=e.showPopover)==null||m.call(e)}catch{}}else{try{(g=e.hidePopover)==null||g.call(e)}catch{}e.style.display="none"}}function C$(s){var e;try{(e=s.hidePopover)==null||e.call(s)}catch{}s.style.display="none"}function b$(s,e,t){var i;try{if(s.get("isReadOnly"))return t.preventDefault(),t.stopPropagation(),!1;const n=t.dataTransfer;if(!n)return!0;if(Array.from(n.types||[]).includes("application/x-suneditor-block-drag"))return;const{sc:r,so:a,ec:c,eo:d}=this.$.selection.getDragEventLocationRange(t);if(!r)return;if(h.query.getParentElement(r,".se-disable-pointer")){t.preventDefault();return}if(we.get("__dragContainer")){if(t.preventDefault(),we.get("__dragContainer").contains(t.target)){this.$.component.deselect();return}const u=we.get("__dragContainer");this.$.component.deselect(),this.$.selection.setRange(r,a,c,d),this.$.html.insertNode(u,{afterNode:null,skipCharCount:!0}),s.has("documentType_use_page")&&(s.get("documentTypePageMirror").innerHTML=s.get("wysiwyg").innerHTML,s.get("documentType").rePage(!0));return}return this.$.html.remove(),this.$.selection.setRange(r,a,c,d),this._dataTransferAction("drop",t,n,s)}finally{try{(i=e.hidePopover)==null||i.call(e)}catch{}e.style.display="none"}}var Re;class w${constructor({$:e}){b(this,Re,void 0);E(this,Re,e)}execute(e){if(!o(this,Re).options.get("__lineFormatFilter"))return null;if(o(this,Re).pluginManager.fileInfo.pluginRegExp.test(o(this,Re).ui.currentControllerName))return;const t=o(this,Re).selection.getRange(),i=t.commonAncestorContainer,n=t.startContainer,r=t.endOffset,a=o(this,Re).format.getBlock(i,null);let c,d,u;if(a){u=h.utils.createElement(e||o(this,Re).options.get("defaultLine")),u.innerHTML=a.innerHTML,u.childNodes.length===0&&(u.innerHTML=Ie.zeroWidthSpace),a.innerHTML=u.outerHTML,u=a.firstChild,c=u.childNodes[r]||h.query.getEdgeChildNodes(u,null).sc,c||(c=h.utils.createTextNode(Ie.zeroWidthSpace),u.insertBefore(c,u.firstChild)),d=c.textContent.length,o(this,Re).selection.setRange(c,d,c,d);return}if(i.nodeType===3&&o(this,Re).component.is(i.parentElement)){const f=o(this,Re).component.get(i.parentElement);if(!f)return;const p=f.container;if(i.parentElement===p){const m=i.nextElementSibling?p:p.nextElementSibling,g=h.utils.createElement(o(this,Re).options.get("defaultLine"),null,i);p.parentElement.insertBefore(g,m),o(this,Re).focusManager.focusEdge(g);return}return o(this,Re).component.select(f.target,f.pluginName),null}else if(i.nodeType===1&&i.getAttribute("data-se-embed")==="true"){let f=i.nextElementSibling;o(this,Re).format.isLine(f)||(f=o(this,Re).format.addLine(i,o(this,Re).options.get("defaultLine"))),o(this,Re).selection.setRange(f.firstChild,0,f.firstChild,0);return}if(!((o(this,Re).format.isBlock(n)||h.check.isWysiwygFrame(n))&&(o(this,Re).component.is(n.children[t.startOffset])||o(this,Re).component.is(n.children[t.startOffset-1])))){if(h.query.getParentElement(i,h.check.isExcludeFormat))return null;if(o(this,Re).format.isBlock(i)&&i.childNodes.length<=1){let f=null;i.childNodes.length===1&&h.check.isBreak(i.firstChild)?f=i.firstChild:(f=h.utils.createTextNode(Ie.zeroWidthSpace),i.appendChild(f)),o(this,Re).selection.setRange(f,1,f,1);return}try{if(i.nodeType===3&&(u=h.utils.createElement(e||o(this,Re).options.get("defaultLine")),i.parentNode.insertBefore(u,i),u.appendChild(i)),h.check.isBreak(u.nextSibling)&&h.utils.removeItem(u.nextSibling),h.check.isBreak(u.previousSibling)&&h.utils.removeItem(u.previousSibling),h.check.isBreak(c)){const f=h.utils.createTextNode(Ie.zeroWidthSpace);c.parentNode.insertBefore(f,c),c=f}}catch{o(this,Re).frameContext.get("_wd").execCommand("formatBlock",!1,`<${e||o(this,Re).options.get("defaultLine")}>`),o(this,Re).store.set("_lastSelectionNode",null),o(this,Re).selection.init();return}if(u&&(h.check.isBreak(u.nextSibling)&&h.utils.removeItem(u.nextSibling),h.check.isBreak(u.previousSibling)&&h.utils.removeItem(u.previousSibling),h.check.isBreak(c))){const f=h.utils.createTextNode(Ie.zeroWidthSpace);c.parentNode.insertBefore(f,c),c=f}o(this,Re).store.set("_lastSelectionNode",null),n?o(this,Re).selection.setRange(n,1,n,1):o(this,Re).focusManager.nativeFocus()}}}Re=new WeakMap;var sh,De,ih,nh,xg,jp,E5;class k${constructor(e){b(this,nh);b(this,jp);b(this,sh,void 0);b(this,De,void 0);b(this,ih,void 0);E(this,sh,e),E(this,De,e.$),E(this,ih,new RegExp(`^(${Object.keys(o(this,De).options.get("_defaultStyleTagMap")).join("|")})$`,"i"))}update(e){if(e||(e=o(this,De).selection.getNode()),e===o(this,De).store.get("_lastSelectionNode"))return;o(this,De).store.set("_lastSelectionNode",e);const t=o(this,De).options.get("_rtl")?"marginRight":"marginLeft",i=o(this,De).plugins,n=o(this,De).commandDispatcher.targets,r=o(this,ih),a=o(this,De).options.get("_styleCommandMap"),c=[],d=[],u=o(this,De).options.get("_textStyleTags"),f=[],p=[],m=o(this,De).commandDispatcher.activeCommands,g=m.length;let y="";if(o(this,De).component.is(e)&&!o(this,De).component.__selectionSelected){const w=o(this,De).component.get(e);if(!w)return;o(this,De).store.set("_lastSelectionNode",null),o(this,De).component.select(w.target,w.pluginName);return}for(;e.firstChild;)e=e.firstChild;const v=o(this,De).frameContext,C=!v.get("isReadOnly");for(let w=e;!h.check.isWysiwygFrame(w)&&w;w=w.parentElement)if(!(w.nodeType!==1||h.check.isBreak(w))){if(T(this,jp,E5).call(this,w)){o(this,De).focusManager.blur();return}if(y=w.nodeName.toLowerCase(),d.push(y),u.includes(y)&&!o(this,De).format.isLine(y)&&f.push(w),C)for(let k=0,_;k<g;k++)_=m[k],!c.includes(_)&&!p.includes(_)&&n.get(_)&&n.get(_).filter(M=>{var x;const S=(x=i[_])==null?void 0:x.active(w,M);return S===void 0&&p.push(_),S}).length>0&&c.push(_);if(o(this,De).format.isLine(w)){if(!c.includes("outdent")&&n.has("outdent")&&(h.check.isListCell(w)||w.style[t]&&Q.get(w.style[t],0)>0)&&n.get("outdent").filter(k=>h.check.isImportantDisabled(k)?!1:(k.disabled=!1,!0)).length>0&&c.push("outdent"),!c.includes("indent")&&n.has("indent")){const k=h.check.isListCell(w)&&!w.previousElementSibling;n.get("indent").filter(_=>h.check.isImportantDisabled(_)?!1:(_.disabled=k,!0)).length>0&&c.push("indent")}continue}r.test(y)&&(y=a[y]||y,c.push(y),h.utils.addClass(n.get(y),"active"))}return T(this,nh,xg).call(this,c),o(this,sh).__cacheStyleNodes=f.reverse(),o(this,De).store.set("currentNodes",d.reverse()),o(this,De).store.set("currentNodesMap",c),o(this,De).frameOptions.get("statusbar_showPathLabel")&&v.get("navigation")&&(v.get("navigation").textContent=o(this,De).options.get("_rtl")?o(this,De).store.get("currentNodes").reverse().join(" < "):o(this,De).store.get("currentNodes").join(" > ")),e}reset(){T(this,nh,xg).call(this,[])}}sh=new WeakMap,De=new WeakMap,ih=new WeakMap,nh=new WeakSet,xg=function(e){const t=o(this,De).commandDispatcher.activeCommands,i=o(this,De).commandDispatcher.targets,n=o(this,De).plugins;for(let r=0,a=t.length,c,d,u;r<a;r++)if(c=t[r],!(e.includes(c)||!(d=i.get(c)))){u=n[c];for(let f=0,p=d.length,m;f<p;f++)m=d[f],m&&(u?u.active(null,m):/^outdent$/i.test(c)?h.check.isImportantDisabled(m)||(m.disabled=!0):/^indent$/i.test(c)?h.check.isImportantDisabled(m)||(m.disabled=!1):h.utils.removeClass(m,"active"))}},jp=new WeakSet,E5=function(e){return h.check.isElement(e)&&e.getAttribute("data-se-non-focus")==="true"};const{_w:yt,isMobile:u0,isTouchDevice:h0}=me;var be,fi,ts,Rt,oe,nt,ot,It,Wt,Pn,Hn,Fn,Up,T5,qp,S5,gr,Tc,Zp,x5,Gp,M5,Yp,B5,Kp,N5,Xp,L5,Qp,A5,Jp,$5,oh,Mg,em,O5,tm,V5,sm,R5,im,I5,nm,D5,om,P5,rm,H5,lm,F5;class _$ extends $A{constructor(t){super(t);b(this,Up);b(this,qp);b(this,gr);b(this,Zp);b(this,Gp);b(this,Yp);b(this,Kp);b(this,Xp);b(this,Qp);b(this,Jp);b(this,oh);b(this,em);b(this,tm);b(this,sm);b(this,im);b(this,nm);b(this,om);b(this,rm);b(this,lm);b(this,be,void 0);b(this,fi,void 0);b(this,ts,void 0);b(this,Rt,void 0);b(this,oe,void 0);b(this,nt,void 0);b(this,ot,void 0);b(this,It,void 0);b(this,Wt,null);b(this,Pn,null);b(this,Hn,null);b(this,Fn,null);E(this,be,this.$.store),E(this,fi,this.$.contextProvider),E(this,ts,this.$.context),E(this,Rt,this.$.options),E(this,oe,this.$.eventManager),E(this,nt,this.$.toolbar),E(this,ot,this.$.ui),E(this,It,this.$.menu),this.isComposing=!1,this._enterKeyShift=!1,this.scrollparents=[],this.defaultLineManager=new w$(this),this.selectionState=new k$(this),this._onShortcutKey=!1,this._handledInBefore=!1,this._wwFrameObserver=null,this._toolbarObserver=null,this._lineBreakComp=null,this._formatAttrsTemp=null,this._resizeClientY=0,this.__cacheStyleNodes=[],this.__onDownEv=null,this._inputFocus=!1,this.__inputPlugin=null,this.__inputBlurEvent=null,this.__inputKeyEvent=null,this.__retainTimer=null,this.__eventDoc=null,this.__secopy=null,this.__focusTemp=o(this,fi).carrierWrapper.querySelector(".__se__focus__temp__")}applyTagEffect(t){return this.selectionState.update(t)}_showToolbarBalloonDelay(){o(this,Wt)&&yt.clearTimeout(o(this,Wt)),E(this,Wt,yt.setTimeout(()=>{yt.clearTimeout(o(this,Wt)),E(this,Wt,null),o(this,be).mode.isSubBalloon?this.$.subToolbar._showBalloon():o(this,nt)._showBalloon()},250))}_toggleToolbarBalloon(){this.$.selection.init();const t=this.$.selection.getRange(),i=o(this,Rt).has("_subMode");!(i?o(this,be).mode.isSubBalloonAlways:o(this,be).mode.isBalloonAlways)&&t.collapsed?i?this._hideToolbar_sub():this._hideToolbar():i?this.$.subToolbar._showBalloon(t):o(this,nt)._showBalloon(t)}_hideToolbar(){!o(this,ot).isPreventToolbarHide&&!this.$.frameContext.get("isFullScreen")&&o(this,nt).hide()}_hideToolbar_sub(){this.$.subToolbar&&!o(this,ot).isPreventToolbarHide&&this.$.subToolbar.hide()}_setDefaultLine(t){return this.defaultLineManager.execute(t)}_normalizeEditRange(){var i;if(!this.$.format.isLine((i=this.$.selection.getRange())==null?void 0:i.startContainer))return null;this.$.selection.resetRangeToTextNode();const t=this.$.selection.getRange();if(t.startContainer===t.endContainer&&t.startOffset!==t.endOffset&&t.startContainer.nodeType===3&&h.check.isZeroWidth(t.startContainer)){const n=t.startContainer.nextSibling;n&&h.check.isBreak(n)?this.$.selection.setRange(n,0,n,0):this.$.selection.setRange(t.endContainer,t.endOffset,t.endContainer,t.endOffset)}return this.$.selection.getNode()}async _dataTransferAction(t,i,n,r){try{return o(this,ot).showLoading(),await T(this,qp,S5).call(this,t,i,n,r),i.preventDefault(),i.stopPropagation(),!1}catch(a){console.warn("[SUNEDITOR.paste.error]",a)}finally{o(this,ot).hideLoading()}}_addCommonEvents(){const t=RA.bind(this),i=DA.bind(this);o(this,oe).addEvent(o(this,ts).get("menuTray"),"mousedown",t,!1),o(this,oe).addEvent(o(this,ts).get("menuTray"),"click",IA.bind(this),!0),o(this,oe).addEvent(o(this,ts).get("toolbar_main"),"mousedown",t,!1),o(this,oe).addEvent(o(this,ts).get("toolbar_main"),"click",i,!1),o(this,Rt).has("_subMode")&&(o(this,oe).addEvent(o(this,ts).get("toolbar_sub_main"),"mousedown",t,!1),o(this,oe).addEvent(o(this,ts).get("toolbar_sub_main"),"click",i,!1)),o(this,nt)._setResponsive(),me.isResizeObserverSupported&&(this._toolbarObserver=new ResizeObserver(()=>{yt.setTimeout(()=>{o(this,nt).resetResponsiveToolbar()},0)}),this._wwFrameObserver=new ResizeObserver(n=>{yt.setTimeout(()=>{n.forEach(r=>{o(this,ot)._emitResizeEvent(this.$.frameRoots.get(r.target.getAttribute("data-root-key")),-1,r)}),o(this,be).mode.isInline&&o(this,be).mode.isBottom&&o(this,nt)._resetSticky()},0)})),o(this,Rt).get("closeModalOutsideClick")&&o(this,oe).addEvent(o(this,fi).carrierWrapper.querySelector(".se-modal .se-modal-inner"),"click",n=>{n.target===o(this,fi).carrierWrapper.querySelector(".se-modal .se-modal-inner")&&o(this,ot).offCurrentModal()},!1),o(this,oe).addEvent(yt,"resize",T(this,em,O5).bind(this),!1),o(this,oe).addEvent(yt.visualViewport,"resize",T(this,tm,V5).bind(this),!1),o(this,oe).addEvent(yt,"scroll",T(this,sm,R5).bind(this),!1),h0&&o(this,oe).addEvent(yt.visualViewport,"scroll",T(this,im,I5).bind(this),!1)}_addFrameEvents(t){const i=t.get("options").get("iframe"),n=i?t.get("_ww"):t.get("wysiwyg");t.set("eventWysiwyg",n);const r=t.get("code"),a=o(this,fi).carrierWrapper.querySelector(".se-drag-cursor"),c=WA.bind(this,t);o(this,oe).addEvent(n,"mousemove",c,!1),o(this,oe).addEvent(n,"mouseleave",zA.bind(this,t),!1),o(this,oe).addEvent(n,"mousedown",PA.bind(this,t),!1),o(this,oe).addEvent(n,"mouseup",HA.bind(this,t),!1),o(this,oe).addEvent(n,"click",FA.bind(this,t),!1),o(this,oe).addEvent(n,"beforeinput",a$.bind(this,t),!1),o(this,oe).addEvent(n,"input",d$.bind(this,t),!1),o(this,oe).addEvent(n,"keydown",h$.bind(this,t),!1),o(this,oe).addEvent(n,"keyup",f$.bind(this,t),!1),o(this,oe).addEvent(n,"paste",m$.bind(this,t),!1),o(this,oe).addEvent(n,"copy",g$.bind(this,t),!1),o(this,oe).addEvent(n,"cut",v$.bind(this,t),!1),o(this,oe).addEvent(n,"dragover",y$.bind(this,t,a,i?this.$.frameContext.get("topArea"):null,!o(this,Rt).get("toolbar_container")&&!o(this,be).mode.isBalloon&&!o(this,be).mode.isInline),!1),o(this,oe).addEvent(n,"dragend",C$.bind(this,a),!1),o(this,oe).addEvent(n,"drop",b$.bind(this,t,a),!1),o(this,oe).addEvent(n,"scroll",T(this,Gp,M5).bind(this,t,n),{passive:!0,capture:!1}),o(this,oe).addEvent(n,"focus",T(this,Yp,B5).bind(this,t),!1),o(this,oe).addEvent(n,"blur",T(this,Kp,N5).bind(this,t),!1),o(this,oe).addEvent(r,"mousedown",T(this,rm,H5).bind(this,t),!1);const d=t.get("wrapper").querySelector(".se-drag-handle");if(o(this,oe).addEvent(d,"wheel",m=>{m.preventDefault(),this.$.component.deselect()},!1),o(this,oe).addEvent(t.get("lineBreaker_t"),"pointerdown",T(this,oh,Mg).bind(this,"t"),!1),o(this,oe).addEvent(t.get("lineBreaker_b"),"pointerdown",T(this,oh,Mg).bind(this,"b"),!1),h0&&o(this,oe).addEvent(n,"touchstart",c,{passive:!0,capture:!1}),!o(this,Rt).get("hasCodeMirror")){const m=t.get("codeNumbers"),g=this.$.viewer._codeViewAutoHeight.bind(this.$.viewer,t.get("code"),m,this.$.frameOptions.get("height")==="auto");o(this,oe).addEvent(r,"keydown",g,!1),o(this,oe).addEvent(r,"keyup",g,!1),o(this,oe).addEvent(r,"paste",g,!1),o(this,Rt).get("tabDisable")||o(this,oe).addEvent(r,"keydown",vv,!1),m&&o(this,oe).addEvent(r,"scroll",this.$.viewer._scrollLineNumbers.bind(r,m),!1)}const u=t.get("markdown");if(u){o(this,oe).addEvent(u,"mousedown",T(this,lm,F5).bind(this,t),!1);const m=t.get("markdownNumbers"),g=this.$.viewer._markdownViewAutoHeight.bind(this.$.viewer,u,m,this.$.frameOptions.get("height")==="auto");o(this,oe).addEvent(u,"keydown",g,!1),o(this,oe).addEvent(u,"keyup",g,!1),o(this,oe).addEvent(u,"paste",g,!1),o(this,Rt).get("tabDisable")||o(this,oe).addEvent(u,"keydown",vv,!1),m&&o(this,oe).addEvent(u,"scroll",this.$.viewer._scrollMarkdownLineNumbers.bind(u,m),!1)}t.has("statusbar")&&this.__addStatusbarEvent(t,t.get("options"));const f=T(this,om,P5).bind(this),p=h.query.getScrollParents(t.get("originElement"));for(const m of p)this.scrollparents.push(m),o(this,oe).addEvent(m,"scroll",f,!1);o(this,oe).addEvent(this.__focusTemp,"focus",m=>m.preventDefault(),!1),this.__eventDoc!==t.get("_wd")&&(this.__eventDoc=t.get("_wd"),o(this,oe).addEvent(this.__eventDoc,"selectionchange",T(this,nm,D5).bind(this,this.__eventDoc),!1))}__addStatusbarEvent(t,i){/\d+/.test(i.get("height"))&&i.get("statusbar_resizeEnable")?i.set("__statusbarEvent",o(this,oe).addEvent(t.get("statusbar"),"mousedown",T(this,Xp,L5).bind(this),!1)):h.utils.addClass(t.get("statusbar"),"se-resizing-none")}_removeAllEvents(){o(this,oe)._init(),this._wwFrameObserver&&(this._wwFrameObserver.disconnect(),this._wwFrameObserver=null),this._toolbarObserver&&(this._toolbarObserver.disconnect(),this._toolbarObserver=null),o(this,Wt)&&(yt.clearTimeout(o(this,Wt)),E(this,Wt,null)),this.__retainTimer&&(yt.clearTimeout(this.__retainTimer),this.__retainTimer=null),o(this,Hn)&&E(this,Hn,o(this,oe).removeGlobalEvent(o(this,Hn))),o(this,Fn)&&E(this,Fn,o(this,oe).removeGlobalEvent(o(this,Fn))),o(this,Pn)&&E(this,Pn,o(this,oe).removeGlobalEvent(o(this,Pn))),this._formatAttrsTemp=null,this.__cacheStyleNodes=null,this.__inputPlugin=null,this.__inputBlurEvent=null,this.__inputKeyEvent=null,this.__focusTemp=null,this.__eventDoc=null,this.__secopy=null,this._lineBreakComp=null,this.scrollparents=null}_setSelectionSync(){o(this,oe).removeGlobalEvent(o(this,Hn)),E(this,Hn,o(this,oe).addGlobalEvent("mouseup",()=>{this.$.selection.init(),o(this,oe).removeGlobalEvent(o(this,Hn))}))}_retainStyleNodes(t,i){let r=i[0].cloneNode(!1);for(let u=1,f=i.length,p;u<f;u++)p=i[u].cloneNode(!1),r.appendChild(p),r=p;const{parent:a,inner:c}=this.$.nodeTransform.createNestedNode(i,null),d=h.utils.createTextNode(Ie.zeroWidthSpace);c.appendChild(d),t.innerHTML="",t.appendChild(a),this.$.selection.setRange(d,1,d,1)}_clearRetainStyleNodes(t){t.innerHTML="<br>",this.$.selection.setRange(t,0,t,0)}_callPluginEvent(t,i){return this.$.pluginManager.emitEvent(t,i)}async _callPluginEventAsync(t,i){return await this.$.pluginManager.emitEventAsync(t,i)}__removeInput(){o(this,be).set("_preventBlur",!1),this._inputFocus=!1,this.__inputBlurEvent=o(this,oe).removeEvent(this.__inputBlurEvent),this.__inputKeyEvent=o(this,oe).removeEvent(this.__inputKeyEvent),this.__inputPlugin=null}__postFocusEvent(t,i){(o(this,be).mode.isInline||o(this,be).mode.isBalloonAlways)&&o(this,nt).show(),o(this,be).mode.isSubBalloonAlways&&this.$.subToolbar.show(),o(this,nt)._resetSticky(),o(this,ot)._updatePlaceholder(t),o(this,oe).triggerEvent("onFocus",{frameContext:t,event:i}),this._callPluginEvent("onFocus",{frameContext:t,event:i})}__postBlurEvent(t,i){o(this,be).mode.isInline?yt.setTimeout(()=>{o(this,be).get("hasFocus")||this._hideToolbar()},0):o(this,be).mode.isBalloon&&this._hideToolbar(),o(this,be).mode.isSubBalloon&&this._hideToolbar_sub(),o(this,oe).triggerEvent("onBlur",{frameContext:t,event:i}),this._callPluginEvent("onBlur",{frameContext:t,event:i})}__setViewportSize(){o(this,be).set("currentViewportHeight",Q.get(yt.visualViewport.height,0))}}be=new WeakMap,fi=new WeakMap,ts=new WeakMap,Rt=new WeakMap,oe=new WeakMap,nt=new WeakMap,ot=new WeakMap,It=new WeakMap,Wt=new WeakMap,Pn=new WeakMap,Hn=new WeakMap,Fn=new WeakMap,Up=new WeakSet,T5=function(){o(this,Wt)&&yt.clearTimeout(o(this,Wt)),E(this,Wt,yt.setTimeout(()=>{yt.clearTimeout(o(this,Wt)),E(this,Wt,null),this._toggleToolbarBalloon()},250))},qp=new WeakSet,S5=async function(t,i,n,r){i.preventDefault(),i.stopPropagation();let a=n.getData("text/plain"),c=n.getData("text/html");const d=!c,u=this.__secopy===a,f=/class=["']*Mso(Normal|List)/i.test(c)||/content=["']*Word.Document/i.test(c)||/content=["']*OneNote.File/i.test(c)||/content=["']*Excel.Sheet/i.test(c),p=u?"SE":f?"MS":"";if(d?c=Se.htmlToEntity(a).replace(/\n/g,"<br>"):(c=c.replace(/^<html>\r?\n?<body>\r?\n?\x3C!--StartFragment-->|\x3C!--EndFragment-->\r?\n?<\/body>\r?\n?<\/html>$/g,""),f&&(c=c.replace(/\n/g," "),a=a.replace(/\n/g," "),c=cN.cleanHTML(c))),!u&&o(this,Rt).get("autoLinkify")){const v=new DOMParser().parseFromString(c,"text/html");h.query.getListChildNodes(v.body,Se.textToAnchor,null),c=v.body.innerHTML}d||(c=this.$.html.clean(c,{forceFormat:!1,whitelist:null,blacklist:null}));const m=this.$.char.test(this.$.frameOptions.get("charCounter_type")==="byte-html"?c:a,!1);if(t==="paste"){const y=await o(this,oe).triggerEvent("onPaste",{frameContext:r,event:i,data:c,maxCharCount:m,from:p});if(y===!1)return!1;if(typeof y=="string"){if(!y)return!1;c=y}}if(t==="drop"){const y=await o(this,oe).triggerEvent("onDrop",{frameContext:r,event:i,data:c,maxCharCount:m,from:p});if(y===!1)return!1;if(typeof y=="string"){if(!y)return!1;c=y}}const g=n.files;if(g.length>0&&!f){for(let y=0,v=g.length;y<v;y++)await this._callPluginEventAsync("onFilePasteAndDrop",{frameContext:r,event:i,file:g[y]});return!1}if(!m)return!1;if(c){const y=new DOMParser().parseFromString(c,"text/html");return await this._callPluginEventAsync("onPaste",{frameContext:r,event:i,data:c,doc:y})!==!1&&this.$.html.insert(c,{selectInserted:!1,skipCharCount:!0,skipCleaning:!0}),r.has("documentType_use_header")&&r.get("documentType").reHeader(),!1}},gr=new WeakSet,Tc=function(){o(this,It).currentDropdownActiveButton&&o(this,It).currentDropdown&&o(this,It).__resetMenuPosition(o(this,It).currentDropdownActiveButton,o(this,It).currentDropdown),o(this,ot)._repositionControllers()},Zp=new WeakSet,x5=function(){me.isResizeObserverSupported||(o(this,nt).resetResponsiveToolbar(),o(this,Rt).get("_subMode")&&this.$.subToolbar.resetResponsiveToolbar());const t=o(this,ts).get("toolbar_main"),i=t.style.display==="none"||o(this,be).mode.isInline&&!o(this,nt).inlineToolbarAttr.isShow;if(t.offsetWidth===0&&!i)return;const n=o(this,ot).opendBrowser;if(n&&n.area.style.display==="block"&&(n.body.style.maxHeight=h.utils.getClientSize().h-n.header.offsetHeight-50+"px"),o(this,It).currentDropdownActiveButton&&o(this,It).currentDropdown&&o(this,It).__resetMenuPosition(o(this,It).currentDropdownActiveButton,o(this,It).currentDropdown),this.$.viewer._resetFullScreenHeight())return;const r=this.$.frameContext;if(r.get("isCodeView")&&o(this,be).mode.isInline){o(this,nt)._showInline();return}o(this,ot)._iframeAutoHeight(r),o(this,nt).isSticky&&(o(this,nt).isCSSSticky||(o(this,ts).get("toolbar_main").style.width=r.get("topArea").offsetWidth-2+"px"),o(this,nt)._resetSticky())},Gp=new WeakSet,M5=function(t,i,n){o(this,ot)._syncScrollPosition(i),T(this,gr,Tc).call(this),this._callPluginEvent("onScroll",{frameContext:t,event:n}),t.has("documentType_use_page")&&t.get("documentType").scrollPage(),o(this,oe).triggerEvent("onScroll",{frameContext:t,event:n})},Yp=new WeakSet,B5=function(t,i){if(this.$.selection.__iframeFocus||t.get("isReadOnly")||t.get("isDisabled"))return i.preventDefault(),!1;o(this,be).set("hasFocus",!0),this.$.component.__prevent=!1,o(this,oe).triggerEvent("onNativeFocus",{frameContext:t,event:i});const n=t.get("key");if(this._inputFocus){o(this,be).mode.isInline&&yt.setTimeout(()=>{o(this,nt)._showInline()},0);return}o(this,be).get("rootKey")===n&&o(this,be).get("_preventBlur")||o(this,be).get("_preventFocus")||(o(this,be).set("_preventFocus",!0),h.utils.removeClass(this.$.commandDispatcher.targets.get("codeView"),"active"),o(this,ot)._toggleCodeViewButtons(!1),this.$.facade.changeFrameContext(n),this.$.history.resetButtons(n,null),yt.setTimeout(()=>{this.__postFocusEvent(t,i)},0))},Kp=new WeakSet,N5=function(t,i){t.get("isCodeView")||t.get("isReadOnly")||t.get("isDisabled")||(o(this,be).set("hasFocus",!1),o(this,be).set("_lastSelectionNode",null),o(this,oe).triggerEvent("onNativeBlur",{frameContext:t,event:i}),o(this,ot)._updatePlaceholder(t),!(this._inputFocus||o(this,be).get("_preventBlur"))&&(o(this,be).set("_preventFocus",!1),this.selectionState.reset(),o(this,be).set("currentNodes",[]),o(this,be).set("currentNodesMap",[]),o(this,ot).offCurrentController(),o(this,fi).applyToRoots(n=>{n.get("navigation")&&(n.get("navigation").textContent="")}),this.$.history.check(t.get("key"),o(this,be).get("_range")),this.__postBlurEvent(t,i)))},Xp=new WeakSet,L5=function(t){t.stopPropagation(),this._resizeClientY=t.clientY,o(this,ot).enableBackWrapper("ns-resize"),E(this,Fn,o(this,oe).addGlobalEvent("mousemove",T(this,Qp,A5).bind(this))),E(this,Pn,o(this,oe).addGlobalEvent("mouseup",T(this,Jp,$5).bind(this)))},Qp=new WeakSet,A5=function(t){const i=this.$.frameContext,n=i.get("wrapper").offsetHeight+(t.clientY-this._resizeClientY),r=n<i.get("_minHeight")?i.get("_minHeight"):n;i.get("wysiwygFrame").style.height=i.get("code").style.height=r+"px",this._resizeClientY=t.clientY,me.isResizeObserverSupported||o(this,ot)._emitResizeEvent(i,r,null)},Jp=new WeakSet,$5=function(){o(this,ot).disableBackWrapper(),o(this,Fn)&&E(this,Fn,o(this,oe).removeGlobalEvent(o(this,Fn))),o(this,Pn)&&E(this,Pn,o(this,oe).removeGlobalEvent(o(this,Pn)))},oh=new WeakSet,Mg=function(t,i){i.preventDefault();const n=this._lineBreakComp;if(!n)return;const r=h.check.isListCell(n.parentElement),a=h.utils.createElement(r?"BR":h.check.isTableCell(n.parentElement)?"DIV":o(this,Rt).get("defaultLine"));if(r||(a.innerHTML="<br>"),!(this.$.frameOptions.get("charCounter_type")==="byte-html"&&!this.$.char.check(a.outerHTML))){n.parentNode.insertBefore(a,t==="t"?n:n.nextSibling),this.$.component.deselect();try{const c=r?a:a.firstChild;this.$.selection.setRange(c,1,c,1),this.$.history.push(!1)}catch(c){console.warn("[SUNEDITOR.lineBreaker.error]",c)}}},em=new WeakSet,O5=function(){o(this,be).set("initViewportHeight",yt.visualViewport.height),u0||o(this,ot).offCurrentController(),o(this,be).mode.isBalloon?o(this,nt).hide():o(this,be).mode.isSubBalloon&&this.$.subToolbar.hide(),T(this,Zp,x5).call(this)},tm=new WeakSet,V5=function(){u0&&o(this,Rt).get("_toolbar_sticky")>-1&&(o(this,nt)._resetSticky(),o(this,It).__restoreMenuPosition()),T(this,gr,Tc).call(this);const t=o(this,be).get("currentViewportHeight");this.__setViewportSize(),u0&&t>0&&t-yt.visualViewport.height>100&&o(this,be).get("hasFocus")&&this.$.selection.scrollTo(this.$.selection.getRange(),{behavior:"auto",block:"nearest",inline:"nearest"})},sm=new WeakSet,R5=function(){o(this,Rt).get("_toolbar_sticky")>-1&&o(this,nt)._resetSticky(),o(this,be).mode.isBalloon&&o(this,ts).get("toolbar_main").style.display==="block"?o(this,nt)._setBalloonOffset(o(this,nt).balloonOffset.position==="top"):o(this,be).mode.isSubBalloon&&o(this,ts).get("toolbar_sub_main").style.display==="block"&&this.$.subToolbar._setBalloonOffset(this.$.subToolbar.balloonOffset.position==="top"),T(this,gr,Tc).call(this),this.$.frameContext.has("documentType_use_page")&&this.$.frameContext.get("documentType").scrollWindow()},im=new WeakSet,I5=function(){o(this,Rt).get("_toolbar_sticky")>-1&&(o(this,nt)._resetSticky(),o(this,It).__restoreMenuPosition())},nm=new WeakSet,D5=function(t){let n=t.getSelection().anchorNode;o(this,fi).applyToRoots(r=>{if(n&&r.get("wysiwyg").contains(n)){if(r.get("isReadOnly")||r.get("isDisabled"))return;if(n=null,this.$.selection.init(),this.applyTagEffect(),o(this,ot)._updatePlaceholder(r),h0&&(o(this,be).mode.isBalloon||o(this,be).mode.isSubBalloon)&&T(this,Up,T5).call(this),r.has("documentType_use_header")){const a=h.query.getParentElement(this.$.selection.selectionNode,this.$.format.isLine.bind(this.$.format));r.get("documentType").on(a)}}})},om=new WeakSet,P5=function(){o(this,It).dropdownOff(),T(this,gr,Tc).call(this)},rm=new WeakSet,H5=function(t){this.$.facade.changeFrameContext(t.get("key")),h.utils.addClass(this.$.commandDispatcher.targets.get("codeView"),"active"),o(this,ot)._toggleCodeViewButtons(!0)},lm=new WeakSet,F5=function(t){this.$.facade.changeFrameContext(t.get("key")),h.utils.addClass(this.$.commandDispatcher.targets.get("markdownView"),"active"),o(this,ot)._toggleCodeViewButtons(!0)};function vv(s){if(s.key!=="Tab")return;s.preventDefault();const e=s.target,t=e.selectionStart,i=e.selectionEnd;e.value=e.value.substring(0,t)+" "+e.value.substring(i),e.selectionStart=e.selectionEnd=t+1}const E$=_$;var ss,ve,am,W5,cm,z5,dm,j5,um,U5,hm,q5;class T${constructor(e,t){b(this,am);b(this,cm);b(this,dm);b(this,um);b(this,hm);b(this,ss,new Map);b(this,ve,new Map);Mr(this,"$",null);const{product:i,options:n}=t;this.store=new $N(i),this.$={facade:e,store:this.store},T(this,am,W5).call(this,i,n),T(this,cm,z5).call(this),T(this,dm,j5).call(this,i),T(this,hm,q5).call(this),T(this,um,U5).call(this),this._eventOrchestrator=new E$(this),o(this,ss).get("eventManager")._bindOrchestrator(this._eventOrchestrator)}_destroy(){var t,i,n;if(this.$===null)return;const e=[];for(const[r,a]of o(this,ve))try{(t=a==null?void 0:a._destroy)==null||t.call(a)}catch(c){e.push(`[Logic:${r}] ${c.message}`)}o(this,ve).clear();try{(i=this._eventOrchestrator)==null||i._removeAllEvents()}catch(r){e.push(`[EventOrchestrator] ${r.message}`)}this._eventOrchestrator=null;for(const[r,a]of o(this,ss))try{(n=a==null?void 0:a._destroy)==null||n.call(a)}catch(c){e.push(`[Config:${r}] ${c.message}`)}o(this,ss).clear(),e.length>0&&console.warn("[CoreKernel._destroy] Cleanup completed with errors:",e),this.$=null,this.store._destroy(),this.store=null,this.facade=null}}ss=new WeakMap,ve=new WeakMap,am=new WeakSet,W5=function(e,t){const i=new VN(e),n=new RN(this,e,t);o(this,ss).set("contextProvider",i),o(this,ss).set("optionProvider",n),o(this,ss).set("instanceCheck",new DN(i.frameContext)),o(this,ss).set("eventManager",new qN(i,n,this.$))},cm=new WeakSet,z5=function(){const e=o(this,ss).get("contextProvider"),t=o(this,ss).get("optionProvider");Object.assign(this.$,{contextProvider:e,optionProvider:t,instanceCheck:o(this,ss).get("instanceCheck"),eventManager:o(this,ss).get("eventManager"),frameRoots:e.frameRoots,context:e.context,options:t.options,icons:e.icons,lang:e.lang,frameContext:e.frameContext,frameOptions:t.frameOptions})},dm=new WeakSet,j5=function(e){o(this,ve).set("offset",new GN(this)),o(this,ve).set("selection",new KN(this)),o(this,ve).set("html",new NL(this)),o(this,ve).set("nodeTransform",new AL(this)),o(this,ve).set("format",new QN(this)),o(this,ve).set("inline",new eL(this)),o(this,ve).set("listFormat",new sL(this)),o(this,ve).set("char",new OL(this)),o(this,ve).set("shortcuts",new RL(this)),o(this,ve).set("component",new JL(this)),o(this,ve).set("pluginManager",new tA(this,e)),o(this,ve).set("focusManager",new sA(this)),o(this,ve).set("ui",new wA(this)),o(this,ve).set("commandDispatcher",new vA(this)),o(this,ve).set("toolbar",new lv(this,{keyName:"toolbar",balloon:this.store.mode.isBalloon,balloonAlways:this.store.mode.isBalloonAlways,inline:this.store.mode.isInline,res:e.responsiveButtons})),this.$.options.has("_subMode")&&o(this,ve).set("subToolbar",new lv(this,{keyName:"toolbar_sub",balloon:this.store.mode.isSubBalloon,balloonAlways:this.store.mode.isSubBalloonAlways,inline:!1,res:e.responsiveButtons_sub})),o(this,ve).set("menu",new SA(this)),o(this,ve).set("viewer",new MA(this)),o(this,ve).set("finder",new LA(this)),o(this,ve).set("history",kA(this))},um=new WeakSet,U5=function(){for(const[,e]of o(this,ve))typeof(e==null?void 0:e._init)=="function"&&e._init()},hm=new WeakSet,q5=function(){const e=o(this,ve).get("pluginManager");Object.assign(this.$,{offset:o(this,ve).get("offset"),selection:o(this,ve).get("selection"),format:o(this,ve).get("format"),inline:o(this,ve).get("inline"),listFormat:o(this,ve).get("listFormat"),html:o(this,ve).get("html"),nodeTransform:o(this,ve).get("nodeTransform"),char:o(this,ve).get("char"),component:o(this,ve).get("component"),focusManager:o(this,ve).get("focusManager"),pluginManager:e,plugins:e.plugins,ui:o(this,ve).get("ui"),commandDispatcher:o(this,ve).get("commandDispatcher"),history:o(this,ve).get("history"),shortcuts:o(this,ve).get("shortcuts"),toolbar:o(this,ve).get("toolbar"),subToolbar:o(this,ve).get("subToolbar"),menu:o(this,ve).get("menu"),viewer:o(this,ve).get("viewer"),finder:o(this,ve).get("finder")})};const S$=T$;var is,Va,Yh,fm,Z5,pm,G5,mm,Y5,gm,K5,vm,X5;class x${constructor(e,t){b(this,Va);b(this,fm);b(this,pm);b(this,mm);b(this,gm);b(this,vm);b(this,is,void 0);Mr(this,"$");const i=gN(e,t),n=new S$(this,{product:i,options:t});E(this,is,n),this.$=n.$,T(this,vm,X5).call(this,t).catch(r=>{console.error("[SUNEDITOR:E_CREATE_FAIL] Failed to create editor instance.",r)})}isEmpty(e){const t=(e||this.$.frameContext).get("wysiwyg");return h.check.isZeroWidth(t.textContent)&&!t.querySelector(this.$.options.get("allowedEmptyTags"))&&(t.innerText.match(/\n/g)||"").length<=1}resetOptions(e){var t;this.$.optionProvider.reset(e),this.$.store.set("_lastSelectionNode",null),T(this,Va,Yh).call(this,this.$.frameRoots.get(this.$.store.get("rootKey")));for(const i of Object.values(this.$.plugins))(t=i.init)==null||t.call(i)}changeFrameContext(e){e!==this.$.store.get("rootKey")&&(this.$.store.set("rootKey",e),T(this,Va,Yh).call(this,this.$.frameRoots.get(e)),this.$.toolbar._resetSticky())}destroy(){this.$.options.get("hasCodeMirror")&&this.$.contextProvider.applyToRoots(e=>{const i=e.get("options").get("codeMirrorEditor");i&&i.toTextArea()}),h.utils.removeItem(this.$.context.get("toolbar_wrapper")),h.utils.removeItem(this.$.context.get("toolbar_sub_wrapper")),h.utils.removeItem(this.$.context.get("statusbar_wrapper"));for(const e in this.events)this.events[e]=null;return this.events=null,o(this,is)._destroy(),null}}is=new WeakMap,Va=new WeakSet,Yh=function(e){this.$.contextProvider.reset(e),this.$.optionProvider.resetFrame(e.get("options")),this.$.ui.reset(e)},fm=new WeakSet,Z5=function(e){this.$.store.set("initViewportHeight",me._w.visualViewport.height),o(this,is)._eventOrchestrator.__setViewportSize(),this.$.store.set("_canUseBeforeInput",me.canUseBeforeInput()),this.$.contextProvider.init(),T(this,Va,Yh).call(this,this.$.frameRoots.get(this.$.store.get("rootKey"))),T(this,mm,Y5).call(this,e),this.$.contextProvider.applyToRoots(t=>{o(this,is)._eventOrchestrator._addFrameEvents(t),T(this,pm,G5).call(this,t,t.get("options").get("value")),t.get("options").get("iframe")&&t.get("options").get("height")==="auto"&&this.$.ui._emitResizeEvent(t,t.get("wysiwygFrame").offsetHeight,null)}),o(this,is)._eventOrchestrator.__eventDoc=null,this.$.store._editorInitFinished=!0,this.$.pluginManager.checkFileInfo(!0),this.$.history.reset(),me._w.setTimeout(()=>{var t,i;if(!((t=this.$.context)!=null&&t.size)){console.warn("[SUNEDITOR:E_INIT_FAIL] Editor instance was destroyed before initialization completed. Check if destroy() was called.");return}this.$.context.get("toolbar_main").style.visibility="",this.$.contextProvider.applyToRoots(n=>{o(this,is)._eventOrchestrator._wwFrameObserver&&o(this,is)._eventOrchestrator._wwFrameObserver.observe(n.get("wysiwygFrame")),o(this,is)._eventOrchestrator._toolbarObserver&&o(this,is)._eventOrchestrator._toolbarObserver.observe(n.get("_toolbarShadow")),this.$.ui._syncFrameState(n)});for(const n of Object.values(this.$.plugins))(i=n.init)==null||i.call(n);this.$.selection.__init(),this.$.eventManager.triggerEvent("onload",{})},0)},pm=new WeakSet,G5=function(e,t){e.get("wysiwyg").innerHTML=this.$.html.clean(typeof t=="string"?t:(/^TEXTAREA$/i.test(e.get("originElement").nodeName)?e.get("originElement").value:e.get("originElement").innerHTML)||"",{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.$.options.get("freeCodeViewMode")})||"<"+this.$.options.get("defaultLine")+"><br></"+this.$.options.get("defaultLine")+">",e.has("charCounter")&&(e.get("charCounter").textContent=String(this.$.char.getLength())),e.has("wordCounter")&&(e.get("wordCounter").textContent=String(this.$.char.getWordCount())),this.$.options.get("type")==="document"&&(e.set("documentType",new LN(o(this,is),e)),e.get("documentType").useHeader&&e.set("documentType_use_header",!0),e.get("documentType").usePage&&(e.set("documentType_use_page",!0),e.get("documentTypePageMirror").innerHTML=e.get("wysiwyg").innerHTML))},mm=new WeakSet,Y5=function(e){this.$.pluginManager.init(e),this.$.shortcuts._registerShortcuts(),this.$.commandDispatcher._initCommandButtons(),this.$.ui.init()},gm=new WeakSet,K5=function(e,t,i){e.contentDocument.documentElement.className="sun-editor",e.contentDocument.head.innerHTML='<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">'+Se._setIframeStyleLinks(i.get("iframe_cssFileName"))+Se._setAutoHeightStyle(i.get("height")),e.contentDocument.body.className=t.get("_editableClass"),e.contentDocument.body.setAttribute("contenteditable","true"),t.get("_rtl")&&(e.contentDocument.body.dir="rtl")},vm=new WeakSet,X5=async function(e){o(this,is)._eventOrchestrator._addCommonEvents();const t=[];this.$.contextProvider.applyToRoots(i=>{const n=i.get("originElement"),r=i.get("topArea");if(n.style.display="none",r.style.display="block",n.parentNode.insertBefore(r,n.nextElementSibling),i.get("options").get("iframe")){const a=new Promise(c=>{const d=u=>{T(this,gm,K5).call(this,u,this.$.optionProvider.options,i.get("options")),c()};if(me.isGecko){let u=null;this.$.eventManager.addEvent(i.get("wysiwygFrame"),"load",({target:f})=>{clearTimeout(u),u=setTimeout(()=>{this.$&&d(f)},60)})}else this.$.eventManager.addEvent(i.get("wysiwygFrame"),"load",({target:u})=>{d(u)})});t.push(a)}}),this.$.contextProvider.applyToRoots(i=>{i.get("wrapper").appendChild(i.get("wysiwygFrame")),i.get("documentTypeInner")&&i.get("wrapper").insertBefore(i.get("documentTypeInner"),i.get("wysiwygFrame")),i.get("documentTypePage")&&(i.get("wrapper").appendChild(i.get("documentTypePage")),i.get("wrapper").appendChild(i.get("documentTypePageMirror"))),i.get("blockHandleArea")&&i.get("wrapper").insertBefore(i.get("blockHandleArea"),i.get("wysiwygFrame"))}),t.length>0&&await Promise.all(t),T(this,fm,Z5).call(this,e)};const M$=x$,B$={init(s){return{create:(e,t)=>this.create(e,t,s)}},create(s,e,t){if(typeof e!="object"&&(e={}),t&&(e=(()=>[t,e].reduce((n,r)=>(Object.entries(r).forEach(([a,c])=>{if(a==="plugins"&&c&&n[a]){const d=Array.isArray(n[a])?n[a]:Object.values(n[a]),u=Array.isArray(c)?c:Object.values(c);n[a]=[...u.filter(f=>!d.includes(f)),...d]}else n[a]=c}),n),{}))()),!s)throw Error('[SUNEDITOR.create.fail] The first parameter "target" is missing.');const i=[];if(typeof s=="string"){const n=document.querySelector(s);if(!n)throw Error(`[SUNEDITOR.create.fail]-[document.querySelector(${s})] Cannot find target element. Make sure "${s}" is a valid selector and exists in the document.`);i.push({key:null,target:n})}else if(s.nodeType===1)i.push({key:null,target:s});else{let n;for(const r in s){if(n=s[r],!n.target||n.target.nodeType!==1)throw Error(`[SUNEDITOR.create.fail] suneditor multi root requires textarea's element at the "target" property.`);n.key=r,i.push(n)}}return new M$(i,e)}};const Kg=l.defineComponent({__name:"AoRichTextEditor",props:{modelValue:{default:""},readonly:{type:Boolean,default:!1},placeholder:{default:""}},emits:["update:modelValue","blur","focus"],setup(s,{emit:e}){const t=s,i=e,n=l.ref(null),r=l.shallowRef(null),a=l.ref(t.modelValue??""),c=l.ref(!1),d=f=>({value:f,placeholder:t.placeholder,width:"100%",minHeight:"100px",statusBar:!1,charCounter:!1,buttonList:[["bold","italic","underline","strike"],["ul","ol"]],editable:!t.readonly,attributesWhitelist:{all:{"data-mention":"data-mention"}},defaultStyle:`
|
|
224
224
|
font-family: inherit;
|
|
225
225
|
font-size: inherit;
|
|
226
226
|
line-height: 1.5;
|
package/dist/orcha.es.js
CHANGED
|
@@ -27947,7 +27947,7 @@ const N2 = /* @__PURE__ */ ve({
|
|
|
27947
27947
|
charCounter: !1,
|
|
27948
27948
|
buttonList: [
|
|
27949
27949
|
["bold", "italic", "underline", "strike"],
|
|
27950
|
-
["
|
|
27950
|
+
["ul", "ol"]
|
|
27951
27951
|
],
|
|
27952
27952
|
editable: !t.readonly,
|
|
27953
27953
|
attributesWhitelist: {
|
package/dist/orcha.umd.js
CHANGED
|
@@ -221,7 +221,7 @@ body{height: min-content; overflow: hidden;}
|
|
|
221
221
|
${e.relaceTextAll}
|
|
222
222
|
</button>
|
|
223
223
|
</div>
|
|
224
|
-
</div>`,o=u.utils.createElement("DIV",{class:"se-find-replace"},t);return{panel:o,findInput:o.querySelector(".se-find-replace-input"),replaceInput:o.querySelector(".se-replace-input"),countDisplay:o.querySelector(".se-find-replace-count"),replaceRow:o.querySelector(".se-find-replace-row-replace"),btnCase:o.querySelector(".se-find-opt-case"),btnWord:o.querySelector(".se-find-opt-word"),btnRegex:o.querySelector(".se-find-opt-regex"),btnPrev:o.querySelector('[data-command="prev"]'),btnNext:o.querySelector('[data-command="next"]'),btnReplace:o.querySelector('[data-command="replace"]'),btnReplaceAll:o.querySelector('[data-command="replace-all"]')}}const YN=jg;class KN{constructor(e){jl(this,"$");this.$=e.$}}const XN=KN,{isMobile:QN,_w:JN}=ge;function eL(i){var s;const e=u.query.getEventTarget(i);let t=e;this.$.store.mode.isBalloon&&!((s=this.$.context.get("toolbar_sub_main"))!=null&&s.contains(t))&&this._hideToolbar_sub();const o=u.check.isInputElement(t);if(o?this.$.store.set("_preventBlur",!1):this.$.frameContext.get("wysiwyg").contains(this.$.selection.getNode())||this.$.focusManager.focus(),u.query.getParentElement(t,".se-dropdown"))i.stopPropagation(),this.$.ui.preventToolbarHide(!0);else{let r=t.getAttribute("data-command"),l=t.className;for(;t&&!r&&!/(se-menu-list|sun-editor-common|se-menu-tray)/.test(l);)t=t.parentElement,r=t.getAttribute("data-command"),l=t.className;if(o&&/^INPUT$/i.test(t==null?void 0:t.getAttribute("data-type"))){if(this.$.store.set("_preventBlur",!0),this._inputFocus=!0,this.$.store.get("hasFocus")||this.applyTagEffect(),!u.check.isInputElement(e)||e.disabled)return;const c=this.$.plugins[r];if(!c||(this.__inputBlurEvent&&this.__removeInput(),typeof c.toolbarInputChange=="function"&&(this.__inputPlugin={obj:c,target:e,value:e.value}),this.__inputBlurEvent=this.$.eventManager.addEvent(e,"blur",d=>{if(!c.isInputActive)try{const h=e.value.trim();typeof c.toolbarInputChange=="function"&&h!==this.__inputPlugin.value&&c.toolbarInputChange({target:e,value:h,event:d})}finally{JN.setTimeout(()=>this._inputFocus=!1,0),this.__removeInput()}}),!c))return;typeof c.toolbarInputKeyDown=="function"&&(this.__inputKeyEvent=this.$.eventManager.addEvent(e,"keydown",d=>{c.toolbarInputKeyDown({target:e,event:d})}))}else if(this.__inputBlurEvent&&this.__inputPlugin){const c=this.__inputPlugin.target.value.trim();c!==this.__inputPlugin.value&&this.__inputPlugin.obj.toolbarInputChange({target:this.__inputPlugin.target,value:c,event:i}),this.__removeInput();return}else this.$.frameContext.get("isCodeView")||(QN?this.$.store.set("_preventBlur",!0):(i.preventDefault(),ge.isGecko&&r&&this.$.eventManager._injectActiveEvent(t)));(r===this.$.menu.currentDropdownName||r===this.$.menu.currentContainerName)&&i.stopPropagation()}}function tL(i){const e=u.query.getEventTarget(i),t=u.query.getCommandTarget(e);if(!t)return;let o=t,s="";for(;o&&!/se-menu-tray/.test(o.className)&&!s;)o=o.parentElement,s=o==null?void 0:o.getAttribute("data-key");if(!s)return;const r=this.$.plugins[s];!r||typeof r.action!="function"||(i.stopPropagation(),r.action(t))}function iL(i){const e=u.query.getEventTarget(i);this.$.commandDispatcher.runFromTarget(e)}const{_w:ap}=ge,Av=new WeakMap;async function oL(i,e){const t=u.query.getEventTarget(e);if(this.$.store.set("_mousedown",!0),this.__onDownEv&&Bv.call(this),this.__onDownEv=this.$.eventManager.addGlobalEvent("mouseup",Bv.bind(this)),!(i.get("isReadOnly")||u.check.isNonEditable(i.get("wysiwyg")))){if(this.$.format._isExcludeSelectionElement(t)){e.preventDefault();return}this._setSelectionSync(),ap.setTimeout(this.$.selection.init.bind(this.$.selection),0),await this.$.eventManager.triggerEvent("onMouseDown",{frameContext:i,event:e})!==!1&&await this._callPluginEventAsync("onMouseDown",{frameContext:i,event:e})!==!1&&(this.$.store.mode.isBalloon?this._hideToolbar():this.$.store.mode.isSubBalloon&&this._hideToolbar_sub(),/FIGURE/i.test(t==null?void 0:t.nodeName)&&e.preventDefault())}}function Bv(){this.$.store.set("_mousedown",!1),this.__onDownEv=this.$.eventManager.removeGlobalEvent(this.__onDownEv)}async function sL(i,e){await this.$.eventManager.triggerEvent("onMouseUp",{frameContext:i,event:e})!==!1&&await this._callPluginEventAsync("onMouseUp",{frameContext:i,event:e})}async function nL(i,e){const t=u.query.getEventTarget(e);if(i.get("isReadOnly"))return e.preventDefault(),u.check.isAnchor(t)&&ap.open(t.href,t.target),!1;if(u.check.isNonEditable(i.get("wysiwyg"))||await this.$.eventManager.triggerEvent("onClick",{frameContext:i,event:e})===!1||await this._callPluginEventAsync("onClick",{frameContext:i,event:e})===!1)return;const o=this.$.component.get(t);if(o){e.preventDefault(),this.$.component.select(o.target,o.pluginName);return}if(this.$.selection.init(),e.detail===3){const c=this.$.selection.getRange();this.$.format.isLine(c.endContainer)&&c.endOffset===0&&this.$.selection.setRange(c.startContainer,c.startOffset,c.startContainer,c.startContainer.textContent.length)}const s=this.$.selection.getNode(),r=this.$.format.getLine(s,null),l=this.$.format.getBlock(s,null);if(!r&&!u.check.isNonEditable(t)&&!u.check.isList(l)){const c=this.$.selection.getRange();if(this.$.format.getLine(c.startContainer)===this.$.format.getLine(c.endContainer))if(u.check.isList(l)){e.preventDefault();const d=s.nextElementSibling,h=u.utils.createElement("LI",null,s);l.insertBefore(h,d),this.$.focusManager.focus()}else!u.check.isWysiwygFrame(s)&&!this.$.component.is(s)&&(!u.check.isTableElements(s)||u.check.isTableCell(s))&&this._setDefaultLine(this.$.format.isBlock(l)?"DIV":this.$.options.get("defaultLine"))!==null&&(e.preventDefault(),this.$.focusManager.focus())}this.$.commandDispatcher._copyFormat(),(this.$.store.mode.isBalloon||this.$.store.mode.isSubBalloon)&&ap.setTimeout(this._toggleToolbarBalloon.bind(this),0)}function rL(i,e){if(i.get("isReadOnly")||i.get("isDisabled"))return!1;let t=Av.get(i);t||(t={rafId:null,event:null},Av.set(i,t)),t.event=e,t.rafId===null&&(t.rafId=ap.requestAnimationFrame(()=>{var r;const o=t.event;if(t.rafId=null,t.event=null,!o)return;const s=u.query.getEventTarget(o);ye.get("__overInfo")!==!1&&!this.$.ui.selectMenuOn&&this.$.component.hoverSelect(s),(r=this.$.ui.blockHandle)==null||r.positionForTarget(s,o.clientY),this._callPluginEvent("onMouseMove",{frameContext:i,event:o})}))}async function aL(i,e){var t;(t=this.$.ui.blockHandle)==null||t.hide(e),await this.$.eventManager.triggerEvent("onMouseLeave",{frameContext:i,event:e})!==!1&&await this._callPluginEventAsync("onMouseLeave",{frameContext:i,event:e})}const lL={"event.prevent":({ctx:i})=>i.e.preventDefault(),"event.stop":({ctx:i})=>i.e.stopPropagation(),"event.prevent.stop":({ctx:i})=>{i.e.preventDefault(),i.e.stopPropagation()},"cache.styleNode":({ports:i})=>i.styleNodeCache(),"cache.formatAttrsTemp":({ports:i},{attrs:e})=>i.formatAttrsTempCache(e),"focusManager.nativeFocus":({ports:i})=>i.focusManager.nativeFocus(),"history.push":({ports:i},e)=>i.history.push(e),"documentType.refreshHeader":({ctx:i})=>{pe.setTimeout(()=>{i.fc.get("documentType").reHeader()},0)},"component.deselect":({ports:i})=>i.component.deselect(),"selection.setRange":({ports:i},{sc:e,so:t,ec:o,eo:s})=>i.selection.setRange(e,t,o,s),"format.removeBlock":({ports:i},{rangeEl:e,selectedFormats:t,newBlockElement:o,shouldDelete:s,skipHistory:r})=>i.format.removeBlock(e,{selectedFormats:t,newBlockElement:o,shouldDelete:s,skipHistory:r}),"dom.utils.removeItem":(i,{item:e})=>u.utils.removeItem(e),"select.component.fallback":({ports:i},{cmponentInfo:e})=>{i.component.select(e.target,e.pluginName)===!1&&i.focusManager.blur()}},cL={"del.format.removeAndMove":({ports:i},{container:e,formatEl:t})=>{const o=i.html.remove();if(o.commonCon!==o.container&&t.parentElement)if(t.contains(e)){const s=dL(t);i.selection.setRange(s,s.textContent.length,s,s.textContent.length)}else{const{focusNode:s,focusOffset:r}=hL(t);i.selection.setRange(s,r,s,r)}},"backspace.brline.strip":({ctx:i,ports:e},{formatEl:t})=>{const o=i.options.get("defaultLine"),s=t.parentNode,r=u.utils.createElement(o);for(;t.firstChild&&!u.check.isBreak(t.firstChild);)r.appendChild(t.firstChild);t.firstChild&&u.check.isBreak(t.firstChild)&&t.removeChild(t.firstChild),r.firstChild||(r.innerHTML="<br>"),s.insertBefore(r,t),(!t.firstChild||!t.textContent.trim()&&!t.querySelector("br"))&&s.removeChild(t);const l=r.firstChild;e.selection.setRange(l,0,l,0)},"backspace.format.maintain":({ctx:i},{formatEl:e})=>{if(e.nodeName.toUpperCase()===i.options.get("defaultLine").toUpperCase()){e.innerHTML="<br>";const t=e.attributes;for(;t[0];)e.removeAttribute(t[0].name)}else e.parentNode.replaceChild(u.utils.createElement(i.options.get("defaultLine"),null,"<br>"),e)},"backspace.component.select":({ports:i},{selectionNode:e,range:t,fileComponentInfo:o})=>{var r;let s=null;u.check.isBreak(e)?u.utils.removeItem(e):u.check.isBreak(s=(r=t.startContainer.childNodes)==null?void 0:r[t.startOffset])&&u.utils.removeItem(s),i.component.select(o.target,o.pluginName)===!1&&i.focusManager.blur()},"backspace.component.remove":({ports:i},{isList:e,sel:t,formatEl:o,fileComponentInfo:s})=>{e&&u.utils.removeItem(t),o.textContent.length===0&&u.utils.removeItem(o),i.component.select(s.target,s.pluginName)===!1&&i.focusManager.blur()},"backspace.list.mergePrev":({ports:i},{prev:e,formatEl:t,rangeEl:o})=>{let s=e===o.parentNode?o.previousSibling:e.lastChild;s||(s=u.utils.createTextNode(De.zeroWidthSpace),o.parentNode.insertBefore(s,o.parentNode.firstChild));const r=s.nodeType===3?s.textContent.length:1,l=t.childNodes;let c=s,d=l[0];for(;d=l[0];)e.insertBefore(d,c.nextSibling),c=d;u.utils.removeItem(t),o.children.length===0&&u.utils.removeItem(o),i.selection.setRange(s,r,s,r)},"backspace.list.removeNested":({ports:i},{range:e})=>{i.html.remove(),e.startContainer.nodeType===3&&i.selection.setRange(e.startContainer,e.startContainer.textContent.length,e.startContainer,e.startContainer.textContent.length)},"backspace.emptyLine.mergePrev":({ports:i},{formatEl:e,prev:t})=>{u.utils.removeItem(e),Nv(i,t,!0)},"backspace.brline.rowMerge":({ports:i},{rowEndBr:e,rowStartBr:t})=>{const o=t.nextSibling;o!==e&&(o==null?void 0:o.nodeType)===3&&u.check.isZeroWidth(o)&&u.utils.removeItem(o);const s=t.previousSibling;if(u.utils.removeItem(t),s&&s.nodeType===3)i.selection.setRange(s,s.textContent.length,s,s.textContent.length);else if(u.check.isBreak(s))i.selection.setRange(e,0,e,0);else{const r=e.parentNode;i.selection.setRange(r,0,r,0)}},"backspace.softBreak.merge":({ports:i},{zws:e})=>{const t=e.previousSibling,o=e.parentNode,s=t==null?void 0:t.previousSibling;u.utils.removeItem(e),t&&u.utils.removeItem(t),s?Fg(i,s):o&&i.selection.setRange(o,0,o,0)},"delete.component.select":({ports:i},{formatEl:e,fileComponentInfo:t})=>{if(u.check.isListCell(e)){const o=t.container.previousSibling;u.check.isZeroWidth(o)&&u.utils.removeItem(o)}else u.check.isZeroWidth(e)&&u.utils.removeItem(e);i.component.select(t.target,t.pluginName)===!1&&i.focusManager.blur()},"delete.component.selectNext":({ports:i,ctx:e},{formatEl:t,nextEl:o})=>{if(u.check.isZeroWidth(t)&&(u.utils.removeItem(t),u.check.isTable(o))){let r=u.query.getEdgeChild(o,u.check.isTableCell,!1);r=r.firstElementChild||r,i.selection.setRange(r,0,r,0);return}const s=i.component.get(o);s?(e.e.stopPropagation(),i.component.select(s.target,s.pluginName)===!1&&i.focusManager.blur()):i.component.is(o)&&(e.e.stopPropagation(),u.utils.removeItem(o))},"delete.list.removeNested":({ports:i,ctx:e},{range:t,formatEl:o,rangeEl:s})=>{t.startContainer!==t.endContainer&&i.html.remove();const r=u.utils.arrayFind(o.children,u.check.isList)||o.nextElementSibling||s.parentElement.nextElementSibling;if(r&&(u.check.isList(r)||u.utils.arrayFind(r.children,u.check.isList))){e.e.preventDefault();let l,c;if(u.check.isList(r)){const d=r.firstElementChild;for(c=d.childNodes,l=c[0];c[0];)o.insertBefore(c[0],r);u.utils.removeItem(d)}else{for(l=r.firstChild,c=r.childNodes;c[0];)o.appendChild(c[0]);u.utils.removeItem(r)}i.selection.setRange(l,0,l,0),i.history.push(!0)}},"delete.emptyLine.mergeNext":({ports:i},{formatEl:e,next:t})=>{u.utils.removeItem(e),Nv(i,t,!1)},"line.merge":({ports:i},{into:e,from:t})=>{const o=i.format,s=t.parentElement;Lv(e);const r=e.lastChild;for(Lv(t);t.firstChild;)e.appendChild(t.firstChild);u.utils.removeItem(t);let l=s;for(;l&&l!==e.parentElement&&o.isBlock(l)&&!o.isClosureBlock(l)&&u.check.isZeroWidth(l);){const c=l.parentElement;u.utils.removeItem(l),l=c}e.firstChild||e.appendChild(u.utils.createElement("BR")),r?Fg(i,r):i.selection.setRange(e,0,e,0)},"delete.brline.rowMerge":({ports:i},{rowEndBr:e})=>{let t=e.nextSibling;(t==null?void 0:t.nodeType)===3&&u.check.isZeroWidth(t)&&(t=t.nextSibling);const o=e.parentNode;u.utils.removeItem(e),t&&(t.nodeType===3||u.check.isBreak(t))?i.selection.setRange(t,0,t,0):i.selection.setRange(o,o.childNodes.length,o,o.childNodes.length)},"delete.softBreak.merge":({ports:i},{br:e})=>{const t=e.previousSibling,o=e.parentNode,s=e.nextSibling;s&&s.nodeType===3&&u.check.isZeroWidth(s.textContent)&&u.utils.removeItem(s),u.utils.removeItem(e),t?Fg(i,t):o&&i.selection.setRange(o,0,o,0)},"tab.format.indent":({ports:i,ctx:e},{range:t,formatEl:o,shift:s})=>{const r=i.format.getLines(null),l=[],c=[],d=u.check.isListCell(r[0]),h=u.check.isListCell(r.at(-1));let p={sc:t.startContainer,so:t.startOffset,ec:t.endContainer,eo:t.endOffset};for(let f=0,m=r.length,g;f<m;f++)if(g=r[f],u.check.isListCell(g)){if(!g.previousElementSibling&&!s)continue;l.push(g)}else c.push(g);if(l.length>0&&(p=i.listFormat.applyNested(l,s)),c.length>0)if(s){const f=c.length-1;for(let v=0,b;v<=f;v++){b=c[v].childNodes;for(let y=0,C=b.length,k;y<C&&(k=b[y],!!k);y++)if(!u.check.isZeroWidth(k)){/^\s{1,4}$/.test(k.textContent)?u.utils.removeItem(k):/^\s{1,4}/.test(k.textContent)&&(k.textContent=k.textContent.replace(/^\s{1,4}/,""));break}}const m=u.query.getEdgeChild(c[0],"text",!1),g=u.query.getEdgeChild(c[f],"text",!0);!d&&m&&(p.sc=m,p.so=0),!h&&g&&(p.ec=g,p.eo=g.textContent.length)}else if(c.length===1){let f=e.store.get("tabSize")+1;if(e.options.get("syncTabIndent")){const g=u.query.findTextIndexOnLine(o,t.startContainer,t.startOffset,b=>i.component.is(b)),v=i.format.isLine(o.previousElementSibling)?u.query.findTabEndIndex(o.previousElementSibling,g,2):0;v>g&&(f=v-g)}const m=u.utils.createTextNode(new Array(f).join(" "));if(!i.html.insertNode(m,{afterNode:null,skipCharCount:!1}))return!1;d||(p.sc=m,p.so=m.length),h||(p.ec=m,p.eo=m.length)}else{const f=u.utils.createTextNode(new Array(e.store.get("tabSize")+1).join(" ")),m=c.length-1;for(let b=0,y;b<=m;b++)y=c[b].firstChild,y&&(u.check.isBreak(y)?c[b].insertBefore(f.cloneNode(!1),y):y.textContent=f.textContent+y.textContent);const g=u.query.getEdgeChild(c[0],"text",!1),v=u.query.getEdgeChild(c[m],"text",!0);!d&&g&&(p.sc=g,p.so=0),!h&&v&&(p.ec=v,p.eo=v.textContent.length)}i.selection.setRange(p.sc,p.so,p.ec,p.eo)},"caret.scrollTo":({ports:i},{range:e})=>{i.caretScrollTo(e)},"enter.line.addDefault":({ports:i},{formatEl:e})=>{const o=i.format.addLineAfter(e).firstChild;i.selection.setRange(o,0,o,0)},"enter.list.addItem":({ports:i},{formatEl:e,selectionNode:t})=>{const o=u.utils.createElement("BR"),s=u.utils.createElement("LI",null,o);e.parentNode.insertBefore(s,e.nextElementSibling),s.appendChild(t.nextSibling),i.selection.setRange(o,1,o,1)},"enter.format.exitEmpty":({ports:i,ctx:e},{formatEl:t,rangeEl:o})=>{let s=null;if(u.check.isListCell(o.parentElement)){const r=t.parentNode.parentElement;o=r.parentElement;const l=u.utils.createElement("LI");l.innerHTML="<br>",u.utils.copyTagAttributes(l,t,e.options.get("lineAttrReset")),s=l,o.insertBefore(s,r.nextElementSibling)}else{let r;u.check.isTableCell(o.parentElement)?r="DIV":u.check.isList(o.parentElement)?r="LI":i.format.isLine(o.nextElementSibling)?r=o.nextElementSibling.nodeName:i.format.isLine(o.previousElementSibling)?r=o.previousElementSibling.nodeName:r=e.options.get("defaultLine"),s=u.utils.createElement(r);const l=i.format.removeBlock(o,{selectedFormats:[t],newBlockElement:null,shouldDelete:!0,skipHistory:!0});l.cc.insertBefore(s,l.sc?l.sc.nextSibling:l.cc.firstChild)}s.innerHTML="<br>",i.nodeTransform.removeAllParents(t,null,null),i.selection.setRange(s,1,s,1)},"enter.format.cleanBrAndZWS":({ports:i},{selectionNode:e,selectionFormat:t,brBlock:o,children:s,offset:r})=>{t?u.utils.removeItem(s[r-1]):u.utils.removeItem(e);const l=o.nextElementSibling,c=i.format.addLine(o,i.format.isLine(l)?l:null);u.utils.copyFormatAttributes(c,o),i.selection.setRange(c,1,c,1)},"enter.format.insertBrHtml":({ports:i},{brBlock:e,range:t,wSelection:o,offset:s})=>{i.html.insert(t.collapsed&&u.check.isBreak(t.startContainer.childNodes[t.startOffset-1])?"<br>":"<br><br>",{selectInserted:!1,skipCharCount:!0,skipCleaning:!0});let r=o.focusNode;const l=o.focusOffset;e===r&&(r=r.childNodes[l-s>1?l-1:l]),i.selection.setRange(r,1,r,1),i.setOnShortcutKey(!0)},"enter.brline.insert":({ports:i},{range:e})=>{i.selection.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset),e.collapsed||i.html.remove();const t=u.utils.createElement("BR");i.html.insertNode(t,{afterNode:null,skipCharCount:!0}),t.nextSibling||t.parentNode.appendChild(u.utils.createElement("BR"));const o=t.nextSibling;i.selection.setRange(o,0,o,0),i.setOnShortcutKey(!0)},"enter.shift.br":({ports:i,ctx:e},{range:t})=>{const o=e.fc.get("_wd"),s=i.selection.get(),l=(s==null?void 0:s.rangeCount)>0&&e.fc.get("wysiwyg").contains(s.focusNode)?s.getRangeAt(0):t,c=o.createRange();if(c.setStart(l.startContainer,l.startOffset),c.setEnd(l.endContainer,l.endOffset),l.collapsed||(c.deleteContents(),c.collapse(!0)),c.startContainer.nodeType===1&&u.check.isBreak(c.startContainer)){const p=c.startContainer;c.setStart(p.parentNode,u.utils.getArrayIndex(p.parentNode.childNodes,p)+c.startOffset),c.collapse(!0)}const d=u.utils.createElement("BR");c.insertNode(d);const h=d.nextSibling;if(h&&h.nodeType===3&&!u.check.isZeroWidth(h.textContent))i.selection.setRange(h,0,h,0);else{const p=u.utils.createTextNode(De.zeroWidthSpace);d.parentNode.insertBefore(p,d.nextSibling),i.selection.setRange(p,1,p,1)}i.history.push(!1)},"enter.brline.exit":({ports:i},{brBlock:e})=>{const t=e.lastChild;t&&(u.check.isBreak(t)||u.check.isZeroWidth(t.textContent))&&u.utils.removeItem(t);const o=e.nextElementSibling,s=i.format.addLine(e,i.format.isLine(o)?o:null);u.utils.copyFormatAttributes(s,e),i.selection.setRange(s,1,s,1)},"enter.format.insertBrNode":({ports:i},{wSelection:e})=>{const t=e.focusNode.nextSibling,o=u.utils.createElement("BR");i.html.insertNode(o,{afterNode:null,skipCharCount:!0});const s=o.previousSibling,r=o.nextSibling;!u.check.isBreak(t)&&!u.check.isBreak(s)&&(!r||u.check.isZeroWidth(r))?(o.parentNode.insertBefore(o.cloneNode(!1),o),i.selection.setRange(o,1,o,1)):i.selection.setRange(r,0,r,0),i.setOnShortcutKey(!0)},"enter.format.breakAtEdge":({ports:i,ctx:e},{formatEl:t,selectionNode:o,formatStartEdge:s,formatEndEdge:r,bidiSwapped:l})=>{const c=u.utils.createElement("BR"),d=u.utils.createElement(t.nodeName,null,c);u.utils.copyTagAttributes(d,t,e.options.get("lineAttrReset"));let h=c;if(!(r&&e.options.get("lineBreakClearStyle"))){let p=o;do{if(!u.check.isBreak(p)&&p.nodeType===1){const f=p.cloneNode(!1);f.appendChild(h),h=f}p=p.parentElement}while(t!==p&&t.contains(p))}if(d.appendChild(h),t.parentNode.insertBefore(d,s&&!r?t:t.nextElementSibling),r)i.selection.setRange(c,1,c,1);else if(l)i.selection.setRange(t,1,t,1);else{const p=t.firstChild||t;i.selection.setRange(p,0,p,0)}},"enter.format.breakWithSelection":({ports:i,ctx:e},{formatEl:t,range:o,formatStartEdge:s,formatEndEdge:r})=>{const l=i.format.getLine(o.startContainer,null)!==i.format.getLine(o.endContainer,null),c=t.cloneNode(!1);c.innerHTML="<br>";const d=o.commonAncestorContainer,h=d===o.startContainer&&d===o.endContainer&&u.check.isZeroWidth(d)?{container:d,offset:o.endOffset,prevContainer:d.previousElementSibling,commonCon:d}:i.html.remove();let p=i.format.getLine(h.container,null),f=0;if(!p){u.check.isWysiwygFrame(h.container)&&(i.enterPrevent(e.e),e.fc.get("wysiwyg").appendChild(c),p=c,u.utils.copyTagAttributes(p,t,e.options.get("lineAttrReset")),i.selection.setRange(p,f,p,f));return}const m=i.format.getBlock(h.container);p=p.contains(m)?u.query.getEdgeChild(m,g=>!!i.format.getLine(g),!1):p,l?r&&!s?(p.parentNode.insertBefore(c,!h.prevContainer||h.container===h.prevContainer?p.nextElementSibling:p),p=c,f=0):(f=h.offset,s&&(p.parentNode.insertBefore(c,p),r&&(f=0))):r&&s?(p.parentNode.insertBefore(c,p),f=0):r?(p=p.parentNode.insertBefore(c,p.nextElementSibling),p=c,f=0):p=i.nodeTransform.split(h.container,h.offset,u.query.getNodeDepth(t)),i.enterPrevent(e.e),u.utils.copyTagAttributes(p,t,e.options.get("lineAttrReset")),i.selection.setRange(p,f,p,f)},"enter.format.breakAtCursor":({ports:i,ctx:e},{formatEl:t,range:o})=>{let s=null;u.check.isZeroWidth(t)?s=i.format.addLine(t,t.cloneNode(!1)):s=i.nodeTransform.split(o.endContainer,o.endOffset,u.query.getNodeDepth(t)),i.enterPrevent(e.e),u.utils.copyTagAttributes(s,t,e.options.get("lineAttrReset")),i.selection.setRange(s,0,s,0)},"enter.figcaption.exitInList":({ports:i},{formatEl:e})=>{const t=i.format.addLine(e,null);i.selection.setRange(t,0,t,0)},"keydown.input.insertNbsp":({ports:i})=>{const e=i.html.insertNode(u.utils.createTextNode(" "),{afterNode:null,skipCharCount:!0});e&&i.selection.setRange(e,e.length,e,e.length)},"keydown.input.insertZWS":({ports:i})=>{const e=u.utils.createTextNode(De.zeroWidthSpace);i.html.insertNode(e,{afterNode:null,skipCharCount:!0}),i.selection.setRange(e,1,e,1)}};function Nv(i,e,t){const o=t?e.childNodes.length:0;i.selection.setRange(e,o,e,o)}function Fg(i,e){const t=e.nodeType===3?e.textContent.length:e.childNodes.length;i.selection.setRange(e,t,e,t)}function Lv(i){let e=i.lastChild;for(;e&&(u.check.isBreak(e)||e.nodeType===3&&u.check.isZeroWidth(e));){const t=e.previousSibling;u.utils.removeItem(e),e=t}}function dL(i){const e=i.lastChild,t=i.nextElementSibling;if(!t)return e;if(u.check.isZeroWidth(t))return u.utils.removeItem(t),e;const o=t.childNodes;for(;o[0];)i.appendChild(o[0]);return u.utils.removeItem(t),e}function hL(i){var r;const e=i.childNodes,t=i.previousElementSibling;let o=e[0],s=0;if(!t)return{focusNode:o,focusOffset:s};if(u.check.isZeroWidth(t))return u.utils.removeItem(t),{focusNode:o,focusOffset:s};if(e.length>1||((r=e[0])==null?void 0:r.textContent.length)>0)for(;e[0];)t.appendChild(e[0]);else o=t.lastChild,s=o.textContent.length;return u.utils.removeItem(i),{focusNode:o,focusOffset:s}}const uL="action.stop";async function Iv(i,e){const t={...lL,...cL};for(const o of i){if(o.t===uL)return!1;const s=t[o.t];if(s&&await s(e,o.p)===!1)return!1}}function $v(i){var p;const e=i.selection.getRange(),t=e.startContainer,o=e.endContainer,s=i.format.getBlock(t),r=i.format.getBlock(o),l=u.check.isTableCell(s),c=u.check.isTableCell(r);if((l&&!s.previousElementSibling&&!s.parentElement.previousElementSibling||c&&!r.nextElementSibling&&!r.parentElement.nextElementSibling)&&s!==r){const f=((p=u.query.getParentElement(e.commonAncestorContainer,u.check.isFigure))==null?void 0:p.parentElement)||e.commonAncestorContainer;if(!l)u.utils.removeItem(u.query.getParentElement(r,m=>f===m.parentNode));else if(!c)u.utils.removeItem(u.query.getParentElement(s,m=>f===m.parentNode));else return u.utils.removeItem(u.query.getParentElement(s,m=>f===m.parentNode)),i.focusManager.nativeFocus(),!0}const d=t.nodeType===1?u.query.getParentElement(t,".se-component"):null,h=o.nodeType===1?u.query.getParentElement(o,".se-component"):null;return d&&u.utils.removeItem(d),h&&u.utils.removeItem(h),!1}function pL(i,e,t){let o=e.parentNode.previousSibling;const s=e.parentNode.nextSibling;o||(s?o=s:(o=u.utils.createElement("BR"),t.appendChild(o)));let r=e;for(;t.contains(r)&&!r.previousSibling;)r=r.parentNode;if(!t.contains(r))return e.textContent="",i.nodeTransform.removeAllParents(e,null,t),!0}function lp(i,e,t){const o=t?e.startContainer:e.endContainer,s=t?e.startOffset:e.endOffset,r=t?"previousSibling":"nextSibling",l=o.nodeType===1;let c;return l?(c=Ov(i,o.childNodes[s],r,o),u.check.isComponentContainer(c)||u.check.isNonEditable(c)?c:null):(c=Ov(i,o,r,o),u.check.isEdgePoint(o,s,t?"front":"end")&&(u.check.isComponentContainer(c)||u.check.isNonEditable(c))?c:null)}function Ov(i,e,t,o){if(!e)return null;let s=e[t];if(!s)if(s=i.format.getLine(o),s=s?s[t]:null,s&&!i.component.is(s))s=t==="previousSibling"?s.firstChild:s.lastChild;else return null;return s}function fL(i,e){return i.setDefaultLine(e)}function yc(i,e,t,o){if(!i.collapsed||!e)return!1;const s=i.getBoundingClientRect();if(s.height<=0)return!1;const r=o.createRange();r.selectNodeContents(e);const l=r.getBoundingClientRect();return l.width<=2?!1:t==="front"?s.left<=l.left+2:s.left>=l.right-2}const G={prevent:()=>({t:"event.prevent"}),stop:()=>({t:"event.stop"}),preventStop:()=>({t:"event.prevent.stop"}),cacheStyleNode:()=>({t:"cache.styleNode"}),cacheFormatAttrsTemp:i=>({t:"cache.formatAttrsTemp",p:{attrs:i}}),componentDeselect:()=>({t:"component.deselect"}),editorNativeFocus:()=>({t:"focusManager.nativeFocus"}),historyPush:i=>({t:"history.push",p:i}),documentTypeRefreshHeader:()=>({t:"documentType.refreshHeader"}),selectionSetRange:(i,e,t,o)=>({t:"selection.setRange",p:{sc:i,so:e,ec:t,eo:o}}),formatRemoveBlock:(i,e,t,o,s)=>({t:"format.removeBlock",p:{rangeEl:i,selectedFormats:e,newBlockElement:t,shouldDelete:o,skipHistory:s}}),domUtilsRemoveItem:i=>({t:"dom.utils.removeItem",p:{item:i}}),selectComponentFallback:i=>({t:"select.component.fallback",p:{cmponentInfo:i}}),delFormatRemoveAndMove:(i,e)=>({t:"del.format.removeAndMove",p:{container:i,formatEl:e}}),backspaceFormatMaintain:i=>({t:"backspace.format.maintain",p:{formatEl:i}}),backspaceBrLineStrip:i=>({t:"backspace.brline.strip",p:{formatEl:i}}),backspaceComponentSelect:(i,e,t)=>({t:"backspace.component.select",p:{selectionNode:i,range:e,fileComponentInfo:t}}),backspaceComponentRemove:(i,e,t,o)=>({t:"backspace.component.remove",p:{isList:i,sel:e,formatEl:t,fileComponentInfo:o}}),backspaceListMergePrev:(i,e,t)=>({t:"backspace.list.mergePrev",p:{prev:i,formatEl:e,rangeEl:t}}),backspaceListRemoveNested:i=>({t:"backspace.list.removeNested",p:{range:i}}),backspaceEmptyLineMergePrev:(i,e)=>({t:"backspace.emptyLine.mergePrev",p:{formatEl:i,prev:e}}),backspaceBrLineRowMerge:(i,e)=>({t:"backspace.brline.rowMerge",p:{rowEndBr:i,rowStartBr:e}}),backspaceSoftBreakMerge:i=>({t:"backspace.softBreak.merge",p:{zws:i}}),deleteComponentSelect:(i,e)=>({t:"delete.component.select",p:{formatEl:i,fileComponentInfo:e}}),deleteComponentSelectNext:(i,e)=>({t:"delete.component.selectNext",p:{formatEl:i,nextEl:e}}),deleteListRemoveNested:(i,e,t)=>({t:"delete.list.removeNested",p:{range:i,formatEl:e,rangeEl:t}}),deleteEmptyLineMergeNext:(i,e)=>({t:"delete.emptyLine.mergeNext",p:{formatEl:i,next:e}}),deleteBrLineRowMerge:i=>({t:"delete.brline.rowMerge",p:{rowEndBr:i}}),deleteSoftBreakMerge:i=>({t:"delete.softBreak.merge",p:{br:i}}),mergeLineInto:(i,e)=>({t:"line.merge",p:{into:i,from:e}}),tabFormatIndent:(i,e,t)=>({t:"tab.format.indent",p:{range:i,formatEl:e,shift:t}}),caretScrollTo:i=>({t:"caret.scrollTo",p:{range:i}}),enterLineAddDefault:i=>({t:"enter.line.addDefault",p:{formatEl:i}}),enterListAddItem:(i,e)=>({t:"enter.list.addItem",p:{formatEl:i,selectionNode:e}}),enterFormatExitEmpty:(i,e)=>({t:"enter.format.exitEmpty",p:{formatEl:i,rangeEl:e}}),enterFormatCleanBrAndZWS:(i,e,t,o,s)=>({t:"enter.format.cleanBrAndZWS",p:{selectionNode:i,selectionFormat:e,brBlock:t,children:o,offset:s}}),enterFormatInsertBrHtml:(i,e,t,o)=>({t:"enter.format.insertBrHtml",p:{brBlock:i,range:e,wSelection:t,offset:o}}),enterFormatInsertBrNode:i=>({t:"enter.format.insertBrNode",p:{wSelection:i}}),enterBrLineInsert:i=>({t:"enter.brline.insert",p:{range:i}}),enterShiftBr:i=>({t:"enter.shift.br",p:{range:i}}),enterBrLineExit:i=>({t:"enter.brline.exit",p:{brBlock:i}}),enterFormatBreakAtEdge:(i,e,t,o,s)=>({t:"enter.format.breakAtEdge",p:{formatEl:i,selectionNode:e,formatStartEdge:t,formatEndEdge:o,bidiSwapped:s}}),enterFormatBreakWithSelection:(i,e,t,o)=>({t:"enter.format.breakWithSelection",p:{formatEl:i,range:e,formatStartEdge:t,formatEndEdge:o}}),enterFormatBreakAtCursor:(i,e)=>({t:"enter.format.breakAtCursor",p:{formatEl:i,range:e}}),enterFigcaptionExitInList:i=>({t:"enter.figcaption.exitInList",p:{formatEl:i}}),keydownInputInsertNbsp:()=>({t:"keydown.input.insertNbsp"}),keydownInputInsertZWS:()=>({t:"keydown.input.insertZWS"})};function mL(i,e,t){const{format:o,component:s}=e,{fc:r,options:l,range:c,selectionNode:d}=t;let{formatEl:h}=t;const p=!c.collapsed||c.startContainer!==c.endContainer,f=l.get("_rtl")&&!p&&c.startOffset===0&&yc(c,h,"front",r.get("_wd"));if(i.push(G.componentDeselect()),i.push(G.cacheStyleNode()),p&&$v(e))return i.push(G.preventStop()),i.push(G.caretScrollTo(c)),!0;if(!o.isNormalLine(h)&&!o.isBrLine(h)&&!r.get("wysiwyg").firstElementChild&&!s.is(d)&&fL(e,l.get("defaultLine"))!==null)return i.push(G.preventStop()),!1;if(o.isLine(h)&&p&&u.check.isEdgePoint(c.startContainer,c.startOffset,"front")&&(!c.startContainer.previousSibling||u.check.isZeroWidth(c.startContainer.previousSibling))&&o.getLine(c.startContainer)!==o.getLine(c.endContainer)&&(o.isLine(h.previousElementSibling)||u.check.isListCell(h)))return i.push(G.preventStop()),i.push(G.delFormatRemoveAndMove(c.startContainer,h)),i.push(G.historyPush(!0)),i.push(G.caretScrollTo(c)),!1;if(!p&&!f&&h&&o.isNormalLine(h)&&!u.check.isListCell(h)&&o.isEdgeLine(c.startContainer,c.startOffset,"front")){const y=gL(o,h);if(y)return i.push(G.preventStop()),i.push(G.mergeLineInto(y,h)),i.push(G.historyPush(!0)),!1}if(!p&&!f&&!h.previousElementSibling&&c.startOffset===0&&!d.previousSibling&&!u.check.isListCell(h)&&o.isLine(h)&&(!o.isBrLine(h)||o.isClosureBrLine(h)||u.check.isWysiwygFrame(h.parentNode)))return o.isClosureBlock(h.parentNode)?(i.push(G.preventStop()),!1):o.isBrLine(h)&&u.check.isWysiwygFrame(h.parentNode)?(i.push(G.preventStop()),i.push(G.backspaceBrLineStrip(h)),i.push(G.historyPush(!0)),!1):(u.check.isWysiwygFrame(h.parentNode)&&h.childNodes.length<=1&&(!h.firstChild||u.check.isZeroWidth(h.textContent))&&(i.push(G.preventStop()),i.push(G.backspaceFormatMaintain(h))),i.push(G.editorNativeFocus()),i.push(G.caretScrollTo(c)),!1);const m=c.startContainer;if(h&&!f&&!h.previousElementSibling&&c.startOffset===0&&m.nodeType===3&&u.check.isZeroWidth(m)&&pL(e,m,h)===!0)return!0;if(!p&&h&&(c.startOffset===0||d===h)){const y=d===h?lp(e,c,!0):u.check.isElement(d.previousSibling)?d.previousSibling:u.check.isEdgePoint(c.startContainer,c.startOffset)?u.query.getPreviousDeepestNode(c.startContainer):null;if(s.is(y)){const C=s.get(y);if(C)return i.push(G.preventStop()),i.push(G.backspaceComponentSelect(d,c,C)),!0}}if(lp(e,c,!0))return i.push(G.preventStop()),!0;!p&&!f&&o.isEdgeLine(c.startContainer,c.startOffset,"front")&&o.isLine(h.previousElementSibling)&&i.push(G.cacheFormatAttrsTemp(h.previousElementSibling.attributes)),h=o.getLine(c.startContainer,null);const g=o.getBlock(h,null),v=c.commonAncestorContainer;if(g&&h&&!u.check.isTableCell(g)&&!/^FIGCAPTION$/i.test(g.nodeName)){if(u.check.isListCell(h)&&u.check.isList(g)&&(u.check.isListCell(g.parentElement)||h.previousElementSibling)&&(d===h||d.nodeType===3&&(!d.previousSibling||u.check.isList(d.previousSibling)))&&(o.getLine(c.startContainer,null)!==o.getLine(c.endContainer,null)?g.contains(c.startContainer):c.startOffset===0&&c.collapsed&&!f)){if(c.startContainer!==c.endContainer)i.push(G.prevent()),i.push(G.backspaceListRemoveNested(c)),i.push(G.historyPush(!0));else{let y=h.previousElementSibling||g.parentElement;if(u.check.isListCell(y)){i.push(G.prevent());let C=y;if(!y.contains(h)&&u.check.isListCell(C)&&u.check.isList(C.lastElementChild)){for(C=C.lastElementChild.lastElementChild;u.check.isListCell(C)&&u.check.isList(C.lastElementChild);)C=C.lastElementChild&&C.lastElementChild.lastElementChild;y=C}i.push(G.backspaceListMergePrev(y,h,g)),i.push(G.historyPush(!0))}}return i.push(G.caretScrollTo(c)),!0}if(!p&&c.startOffset===0&&!f){let y=!0,C=v;for(;C&&C!==g&&!u.check.isWysiwygFrame(C);){if(C.previousSibling&&(C.previousSibling.nodeType===1||!u.check.isZeroWidth(C.previousSibling.textContent.trim()))){y=!1;break}C=C.parentNode}if(y&&g.parentNode)return i.push(G.prevent()),i.push(G.formatRemoveBlock(g,u.check.isListCell(h)?[h]:null,null,!1,!1)),i.push(G.historyPush(!0)),i.push(G.caretScrollTo(c)),!0}}if(!p&&h&&u.check.isEmptyLine(h)&&s.is(h.previousElementSibling)){const y=s.get(h.previousElementSibling);if(y)return i.push(G.preventStop()),i.push(G.backspaceComponentRemove(!1,h.firstChild,h,y)),i.push(G.caretScrollTo(c)),!0}if(!p&&h&&(c.startOffset===0||d===h&&h.childNodes[c.startOffset])){const y=u.check.isListCell(h),C=d===h?h.childNodes[c.startOffset]:d,k=(y?C:h).previousSibling,_=y||(v.nodeType===3||u.check.isBreak(v))&&!v.previousSibling&&c.startOffset===0;if(C&&(y||!C.previousSibling)&&(v&&s.is(v.previousSibling)||_&&s.is(k))){const S=s.get(k);return S?(i.push(G.preventStop()),i.push(G.backspaceComponentRemove(y,C,h,S))):s.is(k)&&(i.push(G.preventStop()),i.push(G.domUtilsRemoveItem(k))),i.push(G.caretScrollTo(c)),!0}if(C&&u.check.isNonEditable(C.previousSibling))return i.push(G.preventStop()),i.push(G.domUtilsRemoveItem(C.previousSibling)),i.push(G.caretScrollTo(c)),!0}if(!p&&o.isBrLine(h)&&u.check.isBreak(c.startContainer)&&c.startOffset===0){let y=c.startContainer.previousSibling;if((y==null?void 0:y.nodeType)===3&&u.check.isZeroWidth(y)&&(y=y.previousSibling),u.check.isBreak(y))return i.push(G.preventStop()),i.push(G.backspaceBrLineRowMerge(c.startContainer,y)),i.push(G.historyPush(!0)),i.push(G.caretScrollTo(c)),!1}if(!p&&c.startContainer.nodeType===3&&u.check.isZeroWidth(c.startContainer)&&c.startOffset<=1&&u.check.isBreak(c.startContainer.previousSibling))return i.push(G.preventStop()),i.push(G.backspaceSoftBreakMerge(c.startContainer)),i.push(G.historyPush(!0)),i.push(G.caretScrollTo(c)),!1;const b=h==null?void 0:h.previousElementSibling;return!p&&h&&o.isNormalLine(h)&&!u.check.isListCell(h)&&u.check.isEmptyLine(h)&&(o.isNormalLine(b)||o.isBrLine(b))?(i.push(G.preventStop()),i.push(G.backspaceEmptyLineMergePrev(h,b)),i.push(G.historyPush(!0)),i.push(G.caretScrollTo(c)),!1):(i.push(G.caretScrollTo(c)),!0)}function gL(i,e){let t=e.previousElementSibling;if(t){if(!i.isBlock(t))return null}else{const s=e.parentElement;if(!i.isBlock(s)||i.isClosureBlock(s)||(t=s.previousElementSibling,!t))return null}let o=t;for(;o&&i.isBlock(o)&&!i.isClosureBlock(o);)o=o.lastElementChild;return!i.isNormalLine(o)||u.check.isListCell(o)||i.isBrLine(o)||i.isClosureBrLine(o)?null:o}function bL(i,e,t){var g,v;const{format:o,component:s}=e,{fc:r,range:l,selectionNode:c}=t;let{formatEl:d}=t;const h=!l.collapsed||l.startContainer!==l.endContainer,p=t.options.get("_rtl")&&!h&&l.endOffset>=(((g=l.endContainer.textContent)==null?void 0:g.length)||0)&&yc(l,d,"end",r.get("_wd"));if(i.push(G.componentDeselect()),i.push(G.cacheStyleNode()),h&&$v(e))return i.push(G.preventStop()),!0;if(!h&&!p&&d&&o.isNormalLine(d)&&!u.check.isListCell(d)&&o.isEdgeLine(l.endContainer,l.endOffset,"end")){const b=vL(o,d);if(b)return i.push(G.preventStop()),i.push(G.mergeLineInto(d,b)),i.push(G.historyPush(!0)),!1}if(!h&&!p&&o.isEdgeLine(l.endContainer,l.endOffset,"end")&&!d.nextSibling)return i.push(G.preventStop()),!1;if(o.isLine(d)&&h&&u.check.isEdgePoint(l.endContainer,l.endOffset,"end")&&(!l.endContainer.nextSibling||u.check.isZeroWidth(l.endContainer.nextSibling))&&o.getLine(l.startContainer)!==o.getLine(l.endContainer)&&(o.isLine(d.nextElementSibling)||u.check.isListCell(d)))return i.push(G.preventStop()),i.push(G.delFormatRemoveAndMove(l.endContainer,d)),i.push(G.historyPush(!0)),!1;if(!h&&d&&(l.endOffset===l.endContainer.textContent.length||c===d)){const b=c===d?lp(e,l,!1):u.check.isElement(c.nextSibling)?c.nextSibling:u.check.isEdgePoint(l.endContainer,l.endOffset)?u.query.getNextDeepestNode(l.endContainer,null):null;if(s.is(b)){const y=s.get(b);if(y)return i.push(G.preventStop()),i.push(G.deleteComponentSelect(d,y)),!0}}if(lp(e,l,!1))return i.push(G.preventStop()),!0;if((o.isLine(c)||c.nextSibling===null||u.check.isZeroWidth(c.nextSibling)&&c.nextSibling.nextSibling===null)&&l.startOffset===c.textContent.length){const b=d.nextElementSibling;if(!b)return!0;if(s.is(b))return i.push(G.prevent()),i.push(G.deleteComponentSelectNext(d,b)),!0}if(!h&&(u.check.isEdgePoint(l.endContainer,l.endOffset)||c===d&&d.childNodes[l.startOffset])){const b=c===d&&d.childNodes[l.startOffset]||c;if(b&&u.check.isNonEditable(b.nextSibling))return i.push(G.preventStop()),i.push(G.domUtilsRemoveItem(b.nextSibling)),!0;if(s.is(b))return i.push(G.preventStop()),i.push(G.domUtilsRemoveItem(b)),!0}!h&&!p&&o.isEdgeLine(l.endContainer,l.endOffset,"end")&&o.isLine(d.nextElementSibling)&&i.push(G.cacheFormatAttrsTemp(d.attributes)),d=o.getLine(l.startContainer,null);const f=o.getBlock(d,null);if(u.check.isListCell(d)&&u.check.isList(f)&&(c===d||c.nodeType===3&&(!c.nextSibling||u.check.isList(c.nextSibling))&&(o.getLine(l.startContainer,null)!==o.getLine(l.endContainer,null)?f.contains(l.endContainer):l.endOffset===c.textContent.length&&l.collapsed&&!p)))return i.push(G.deleteListRemoveNested(l,d,f)),!0;if(!h&&o.isBrLine(d)&&u.check.isBreak(l.startContainer)&&l.startOffset===0){let b=l.startContainer.previousSibling;if((b==null?void 0:b.nodeType)===3&&u.check.isZeroWidth(b)&&(b=b.previousSibling),u.check.isBreak(b))return i.push(G.preventStop()),i.push(G.deleteBrLineRowMerge(l.startContainer)),i.push(G.historyPush(!0)),!1}if(!h){const b=l.startContainer;let y=null;if(b.nodeType===3&&l.startOffset>=b.textContent.length&&u.check.isBreak(b.nextSibling)){const C=b.nextSibling;((v=C.nextSibling)==null?void 0:v.nodeType)===3&&u.check.isZeroWidth(C.nextSibling.textContent)&&(y=C)}else b.nodeType===3&&u.check.isZeroWidth(b)&&l.startOffset===0&&u.check.isBreak(b.previousSibling)&&(y=b.previousSibling);if(y)return i.push(G.preventStop()),i.push(G.deleteSoftBreakMerge(y)),i.push(G.historyPush(!0)),!1}const m=d==null?void 0:d.nextElementSibling;return!h&&d&&o.isNormalLine(d)&&!u.check.isListCell(d)&&u.check.isEmptyLine(d)&&(o.isNormalLine(m)||o.isBrLine(m))?(i.push(G.preventStop()),i.push(G.deleteEmptyLineMergeNext(d,m)),i.push(G.historyPush(!0)),!1):!0}function vL(i,e){let t=e.nextElementSibling;if(t){if(!i.isBlock(t))return null}else{const s=e.parentElement;if(!i.isBlock(s)||i.isClosureBlock(s)||(t=s.nextElementSibling,!t))return null}let o=t;for(;o&&i.isBlock(o)&&!i.isClosureBlock(o);)o=o.firstElementChild;return!i.isNormalLine(o)||u.check.isListCell(o)||i.isBrLine(o)||i.isClosureBrLine(o)?null:o}function yL(i,e){const t=Array.from(i.childNodes),o=[[]];for(const p of t)u.check.isBreak(p)?o.push([]):o[o.length-1].push(p);t.length&&u.check.isBreak(t[t.length-1])&&o.pop();const s=p=>!p||p.every(f=>u.check.isZeroWidth(f.textContent)),r=e.anchorNode;let l=0;if(r===i)for(let p=0;p<e.anchorOffset&&p<t.length;p++)u.check.isBreak(t[p])&&l++;else for(const p of t){if(p===r||p.nodeType===1&&p.contains(r))break;u.check.isBreak(p)&&l++}const c=Math.max(o.length,1),d=Math.min(l,c-1);return{shouldExit:d===c-1&&s(o[d])&&d>=1&&s(o[d-1])}}function Dv(i,e,t){const{format:o,char:s,selection:r}=e,{frameOptions:l,range:c,formatEl:d,selectionNode:h,shift:p,e:f}=t,m=!c.collapsed||c.startContainer!==c.endContainer;i.push(G.componentDeselect());const g=o.getBrLine(h,null),v=o.getBlock(d,null);if(l.get("charCounter_type")==="byte-html"){let b="";if(!p&&g||p?b="<br>":b="<"+d.nodeName+"><br></"+d.nodeName+">",!s.check(b))return i.push(G.prevent()),!1}if(p)return e.enterPrevent(f),i.push(G.enterShiftBr(c)),i.push(G.caretScrollTo(c)),!0;if(!p){let b=o.isEdgeLine(c.endContainer,c.endOffset,"end"),y=o.isEdgeLine(c.startContainer,c.startOffset,"front"),C=!1;if(t.options.get("_rtl")&&d&&c.collapsed&&y!==b){const k=t.fc.get("_wd");y&&yc(c,d,"front",k)?(y=!1,b=!0,C=!0):b&&yc(c,d,"end",k)&&(b=!1,y=!0,C=!0)}if(b&&(/^H[1-6]$/i.test(d.nodeName)||/^HR$/i.test(d.nodeName)))return e.enterPrevent(f),i.push(G.enterLineAddDefault(d)),i.push(G.caretScrollTo(c)),!0;if(v&&d&&!u.check.isTableCell(v)&&!/^FIGCAPTION$/i.test(v.nodeName)){const k=r.getRange();if(u.check.isEdgePoint(k.endContainer,k.endOffset)&&u.check.isList(h.nextSibling))return e.enterPrevent(f),i.push(G.enterListAddItem(d,h)),i.push(G.caretScrollTo(c)),!0;if((k.commonAncestorContainer.nodeType!==3||!k.commonAncestorContainer.nextElementSibling)&&u.check.isZeroWidth(d.innerText.trim())&&!u.check.isListCell(d.nextElementSibling))return e.enterPrevent(f),i.push(G.enterFormatExitEmpty(d,v)),!0}if(g||v===d&&o.isClosureBlock(v)&&o.isLine(d)){if(e.enterPrevent(f),g&&!o.isClosureBrLine(g))return yL(g,r.get()).shouldExit?i.push(G.enterBrLineExit(g)):i.push(G.enterBrLineInsert(c)),i.push(G.caretScrollTo(c)),!0;const k=r.get();return h===g?i.push(G.enterFormatInsertBrHtml(g,c,k,k.focusOffset)):i.push(G.enterFormatInsertBrNode(k)),i.push(G.caretScrollTo(c)),!0}if(c.collapsed&&(y||b))return e.enterPrevent(f),i.push(G.enterFormatBreakAtEdge(d,h,y,b,C)),i.push(G.caretScrollTo(c)),!0;if(d){if(i.push(G.prevent()),m){if(t.options.get("_rtl")&&y&&!b){const k=t.fc.get("_wd"),_=k.createRange();_.setStart(c.startContainer,c.startOffset),_.collapse(!0),yc(_,d,"front",k)&&(y=!1,b=!0,C=!0)}i.push(G.enterFormatBreakWithSelection(d,c,y,b))}else i.push(G.enterFormatBreakAtCursor(d,c));return i.push(G.caretScrollTo(c)),!0}}return m?(i.push(G.caretScrollTo(c)),!0):(v&&u.query.getParentElement(v,"FIGCAPTION")&&u.query.getParentElement(v,u.check.isList)&&(e.enterPrevent(f),i.push(G.enterFigcaptionExitInList(d)),i.push(G.caretScrollTo(c))),!0)}function wL(i,e,t){const{options:o,selectionNode:s,range:r,formatEl:l,ctrl:c,alt:d,shift:h}=t;return o.get("tabDisable")||(i.push(G.prevent()),c||d||u.check.isWysiwygFrame(s))||(i.push(G.tabFormatIndent(r,l,h)),i.push(G.historyPush(!1))),!0}function CL(i,e,t){var f;const{component:o}=e,{formatEl:s,range:r,selectionNode:l,keyCode:c}=t,d=t.options.get("_rtl"),h=c==="ArrowLeft"?d?"forward":"back":c==="ArrowRight"?d?"back":"forward":null;let p=null;switch(c){case"ArrowUp":o.is(s.previousElementSibling)&&(p=o.get(s.previousElementSibling));break;case"ArrowLeft":case"ArrowRight":if(h==="forward"){if(u.check.isEdgePoint(l,r.endOffset,"end")){const m=l.nextElementSibling||u.query.getNextDeepestNode(l);m?o.is(m)&&(p=o.get(m)):o.is(s.nextElementSibling)&&(p=o.get(s.nextElementSibling))}}else if(h==="back"&&u.check.isEdgePoint(l,r.startOffset,"front")){const m=l.previousElementSibling||u.query.getPreviousDeepestNode(l);m?o.is(m)&&(p=o.get(m)):o.is(s.previousElementSibling)&&(p=o.get(s.previousElementSibling))}break;case"ArrowDown":o.is(s.nextElementSibling)&&(p=o.get(s.nextElementSibling));break}p&&!((f=p.options)!=null&&f.isInputComponent)&&(i.push(G.prevent()),i.push(G.selectComponentFallback(p)))}const{isOSX_IOS:kL}=ge,_L=!0;function cp(i,e){return _L&&i.get("_canUseBeforeInput")&&!(e!=null&&e.repeat)}async function xL(i,e){const t=[];switch(e.keyCode){case"Backspace":{if(mL(t,i,e)===!1)return t;break}case"Delete":{if(bL(t,i,e)===!1)return t;break}case"Tab":{if(wL(t,i,e)===!1)return t;break}case"Enter":{if(!cp(e.store,e.e)&&Dv(t,i,e)===!1)return t;break}}const{fc:o,keyCode:s,shift:r,alt:l,ctrl:c,range:d}=e;if(r&&(kL?l:c)&&Me.isSpace(s))return t.push(G.preventStop()),t.push(G.keydownInputInsertNbsp()),t;const h=!d.collapsed||d.startContainer!==d.endContainer;return!c&&!l&&!h&&!Me.isNonTextKey(s)&&u.check.isBreak(d.commonAncestorContainer)?(t.push(G.keydownInputInsertZWS()),t):o.has("documentType_use_header")&&h&&!c&&!l&&!r&&!Me.isDirectionKey(s)?(t.push(G.documentTypeRefreshHeader()),t):(CL(t,i,e),t)}function Vv(i,{_styleNodes:e}){const{frameContext:t,ui:o,focusManager:s,selection:r,format:l,listFormat:c,component:d,html:h,nodeTransform:p,history:f,char:m,menu:g,store:v}=i.$;return{focusManager:{nativeFocus:()=>s.nativeFocus(),blur:()=>s.blur()},selection:{getRange:()=>r.getRange(),getNode:()=>r.getNode(),setRange:(b,y,C,k)=>r.setRange(b,y,C,k),get:()=>r.get()},format:{isLine:b=>l.isLine(b),getLine:(b,y)=>l.getLine(b,y),getLines:b=>l.getLines(b),getBrLine:(b,y)=>l.getBrLine(b,y),getBlock:(b,y)=>l.getBlock(b,y),isNormalLine:b=>l.isNormalLine(b),isBrLine:b=>l.isBrLine(b),isClosureBrLine:b=>l.isClosureBrLine(b),isBlock:b=>l.isBlock(b),isClosureBlock:b=>l.isClosureBlock(b),isEdgeLine:(b,y,C)=>l.isEdgeLine(b,y,C),removeBlock:(b,y)=>l.removeBlock(b,y),addLine:(b,y)=>l.addLine(b,y),addLineAfter:b=>l.addLineAfter(b)},listFormat:{applyNested:(b,y)=>c.applyNested(b,y)},component:{deselect:()=>d.deselect(),is:b=>d.is(b),get:b=>d.get(b),select:(b,y)=>d.select(b,y)},html:{remove:()=>h.remove(),insert:(b,y)=>h.insert(b,y),insertNode:(b,y)=>h.insertNode(b,y)},history:{push:b=>f.push(!!b)},nodeTransform:{removeAllParents:(b,y,C)=>p.removeAllParents(b,y,C),split:(b,y,C)=>p.split(b,y,C)},char:{check:b=>m.check(b)},menu:{dropdownOff:()=>g.dropdownOff()},setDefaultLine:b=>i._setDefaultLine(b),hideToolbar:()=>i._hideToolbar(),hideToolbar_sub:()=>i._hideToolbar_sub(),styleNodeCache:()=>e.value=i.__cacheStyleNodes,formatAttrsTempCache:b=>i._formatAttrsTemp=b,setOnShortcutKey:b=>i._onShortcutKey=b,caretScrollTo(b){o._iframeAutoHeight(t),r.scrollTo(r.getRange()||b,{behavior:"auto",block:"nearest",inline:"nearest"})},enterPrevent(b){b.preventDefault(),!(!yb||cp(v))&&(i.__focusTemp.focus({preventScroll:!0}),t.get("wysiwyg").focus({preventScroll:!0}))}}}const EL={value:[]};async function TL(i,e){if(i.get("isReadOnly")||i.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;if(cp(this.$.store)&&(e.inputType==="insertParagraph"||e.inputType==="insertLineBreak")){await ML.call(this,i,e);return}const t=(e.data===null?"":e.data===void 0?" ":e.data)||"";if(Me.isComposing(e))this._handledInBefore=!1;else{if(!this.$.char.test(t,!1))return e.preventDefault(),e.stopPropagation(),!1;this._handledInBefore=!0}await this.$.eventManager.triggerEvent("onBeforeInput",{frameContext:i,event:e,data:t})!==!1&&await this._callPluginEventAsync("onBeforeInput",{frameContext:i,event:e,data:t})}async function ML(i,e){if(e.isComposing||this.isComposing||this.$.ui.selectMenuOn)return;let t=this.$.selection.getNode();if(u.check.isInputElement(t)||this.$.menu.currentDropdownName)return;u.check.isWysiwygFrame(t)&&(this._setDefaultLine(this.$.options.get("defaultLine")),t=this.$.selection.getNode());const o=this._enterKeyShift||e.inputType==="insertLineBreak";if(this._enterKeyShift=!1,!o){const h=this._normalizeEditRange();h&&(t=h)}const s=this.$.selection.getRange(),r=this.$.format.getLine(t,null)||t,l={e,fc:i,store:this.$.store,options:this.$.options,frameOptions:this.$.frameOptions,range:s,selectionNode:t,formatEl:r,keyCode:"Enter",ctrl:!1,alt:!1,shift:o},c=Vv(this,{_styleNodes:EL}),d=[];Dv(d,c,l),d.some(h=>h.t==="event.prevent"||h.t==="event.prevent.stop")&&e.preventDefault(),await Iv(d,{ports:c,ctx:l})}async function SL(i,e){if(i.get("isReadOnly")||i.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;const t=this.$.selection.getRange(),o=this.$.selection.getNode(),s=this.$.format.getLine(o,null);if(!this.$.format.isNormalLine(s)&&!this.$.format.isBrLine(s)&&t.collapsed&&!this.$.component.is(o)&&!u.check.isList(o)){const l=this.$.format.getBlock(o,null);this._setDefaultLine(this.$.format.isBlock(l)?"DIV":this.$.options.get("defaultLine"))}this.$.selection.init();const r=(e.data===null?"":e.data===void 0?" ":e.data)||"";if(!this._handledInBefore&&!this.$.char.test(r,!0))return e.preventDefault(),e.stopPropagation(),!1;this._handledInBefore=!1,await this.$.eventManager.triggerEvent("onInput",{frameContext:i,event:e,data:r})!==!1&&(await this._callPluginEventAsync("onInput",{frameContext:i,event:e,data:r}),this.$.history.push(!0))}const{_w:Rv}=ge,AL=new RegExp(De.zeroWidthSpace+"+",""),Wr={ctrl:!1,alt:!1},dp=Object.preventExtensions({value:[]});async function BL(i,e){var g,v;if(this.isComposing=Me.isComposing(e))return!0;if(this.$.ui.selectMenuOn||!e.isTrusted)return;let t=this.$.selection.getNode();if(u.check.isInputElement(t)||this.$.menu.currentDropdownName)return;const o=e.code,s=Me.isShift(e),r=Wr.ctrl=Me.isCtrl(e),l=Wr.alt=Me.isAlt(e);if(Me.isEnter(o)&&(this._enterKeyShift=s),!r&&i.get("isReadOnly")&&!Me.isDirectionKey(o))return e.preventDefault(),!1;if(this.$.menu.dropdownOff(),this.$.store.mode.isBalloon?this.$.store.mode.isBalloonAlways||this._hideToolbar():this.$.store.mode.isSubBalloon&&(this.$.store.mode.isSubBalloonAlways||this._hideToolbar_sub()),Me.isEnter(o)&&!cp(this.$.store,e)||Me.isRemoveKey(o)){const b=this._normalizeEditRange();b&&(t=b)}const d=this.$.selection.getRange(),h=this.$.format.getLine(t,null)||t;if(r&&!Me.isNonTextKey(o)&&this.$.shortcuts.command(e,r,s,o,"",!1,null,null))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1;if(!r&&!Me.isNonTextKey(o)&&this.$.format.isLine(h)&&d.collapsed&&u.check.isEdgePoint(d.startContainer,0,"front")){const b=(v=(g=d.startContainer).substringData)==null?void 0:v.call(g,0,d.startOffset);if(b&&this.$.shortcuts.command(e,!1,s,o,b,!0,h,d))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1}else this._onShortcutKey&&(this._onShortcutKey=!1);const p={e,fc:i,store:this.$.store,options:this.$.options,frameOptions:this.$.frameOptions,range:d,selectionNode:t,formatEl:h,keyCode:o,ctrl:r,alt:l,shift:s},f=Vv(this,{_styleNodes:dp}),m=await xL(f,p);await this.$.eventManager.triggerEvent("onKeyDown",{frameContext:i,event:e})!==!1&&await this._callPluginEventAsync("onKeyDown",{frameContext:i,event:e,range:d,line:h})!==!1&&await Iv(m,{ports:f,ctx:p})}async function NL(i,e){var f;if(this._onShortcutKey||this.$.menu.currentDropdownName)return;const t=e.code,o=Me.isCtrl(e),s=Me.isAlt(e);if(o&&(Wr.ctrl=!1),s&&(Wr.alt=!1),i.get("isReadOnly"))return;const r=this.$.selection.getRange();let l=this.$.selection.getNode();if((this.$.store.mode.isBalloon||this.$.store.mode.isSubBalloon)&&((this.$.store.mode.isBalloonAlways||this.$.store.mode.isSubBalloonAlways)&&!Me.isEsc(t)||!r.collapsed))if(this.$.store.mode.isBalloonAlways||this.$.store.mode.isSubBalloonAlways)Me.isEsc(t)||this._showToolbarBalloonDelay();else{this.$.store.mode.isSubBalloon?this.$.subToolbar._showBalloon():this.$.toolbar._showBalloon();return}if(Me.isBackspace(t)&&u.check.isWysiwygFrame(l)&&l.textContent===""&&l.children.length===0){e.preventDefault(),e.stopPropagation(),l.innerHTML="";const m=this.$.store.get("currentNodes")[0],g=u.utils.createElement(this.$.format.isLine(m)&&!u.check.isListCell(m)?m:this.$.options.get("defaultLine"),null,"<br>");l.appendChild(g),this.$.selection.setRange(g,0,g,0),this.applyTagEffect(),this.$.history.push(!1),i.has("documentType_use_header")&&Me.isDocumentTypeObserverKey(t)&&i.get("documentType").reHeader();return}const c=this.$.format.getLine(l,null),d=this.$.format.getBlock(l,null),h=this._formatAttrsTemp;if(c&&h){for(let m=0,g=h.length;m<g;m++){if(Me.isEnter(t)&&/^id$/i.test(h[m].name)){c.removeAttribute("id");continue}c.setAttribute(h[m].name,h[m].value)}this._formatAttrsTemp=null}if(!this.$.format.isNormalLine(c)&&!this.$.format.isBrLine(c)&&r.collapsed&&!this.$.component.is(l)&&!u.check.isList(l)&&this._setDefaultLine(this.$.format.isBlock(d)?"DIV":this.$.options.get("defaultLine"))!==null&&(l=this.$.selection.getNode()),!Wr.ctrl&&!Wr.alt&&!Me.isNonTextKey(t)&&l.nodeType===3&&De.zeroWidthRegExp.test(l.textContent)&&!(e.isComposing!==void 0?e.isComposing:this.isComposing)){let m=r.startOffset,g=r.endOffset;const v=(l.textContent.substring(0,g).match(AL)||"").length;m=r.startOffset-v,g=r.endOffset-v,l.textContent=l.textContent.replace(De.zeroWidthRegExp,""),this.$.selection.setRange(l,m<0?0:m,l,g<0?0:g)}if(Me.isRemoveKey(t)&&u.check.isZeroWidth(c==null?void 0:c.textContent)&&!c.previousElementSibling&&!u.check.isListCell(c)){const m=this.$.options.get("retainStyleMode");m!=="none"&&((f=dp.value)==null?void 0:f.length)>0?m==="repeat"?this.__retainTimer?(this.__retainTimer=Rv.clearTimeout(this.__retainTimer),this._clearRetainStyleNodes(c)):(this.__retainTimer=Rv.setTimeout(()=>{this.__retainTimer=null},0),this._retainStyleNodes(c,dp.value)):(this.__retainTimer=null,this._retainStyleNodes(c,dp.value)):this._clearRetainStyleNodes(c)}if(i.has("documentType_use_header"))if(Me.isDocumentTypeObserverKey(t)){i.get("documentType").reHeader();const m=u.query.getParentElement(this.$.selection.selectionNode,this.$.format.isLine.bind(this.$.format));i.get("documentType").on(m)}else{const m=u.query.getParentElement(l,g=>g.nodeType===1);i.get("documentType").onChangeText(m)}await this.$.eventManager.triggerEvent("onKeyUp",{frameContext:i,event:e})!==!1&&await this._callPluginEventAsync("onKeyUp",{frameContext:i,event:e,range:r,line:c})!==!1&&Me.isHistoryRelevantKey(t)&&this.$.history.push(!0)}const{_w:LL}=ge;function IL(i,e){const t=e.clipboardData;return t?this._dataTransferAction("paste",e,t,i):!0}async function $L(i,e){const t=e.clipboardData;if(await this.$.eventManager.triggerEvent("onCopy",{frameContext:i,event:e,clipboardData:t})===!1)return e.preventDefault(),e.stopPropagation(),!1;const o=i.get("_ww").getSelection();this.__secopy=o.toString()}async function OL(i,e){const t=e.clipboardData;if(await this.$.eventManager.triggerEvent("onCut",{frameContext:i,event:e,clipboardData:t})===!1)return e.preventDefault(),e.stopPropagation(),!1;const o=i.get("_ww").getSelection();this.__secopy=o.toString(),LL.setTimeout(()=>{this.$.history.push(!1)},0)}const{_w:hp}=ge;function DL(i,e,t,o,s){var m,g;if(s.dataTransfer&&Array.from(s.dataTransfer.types||[]).includes("application/x-suneditor-block-drag"))return;const{sc:r,so:l,ec:c,eo:d}=this.$.selection.getDragEventLocationRange(s);if(!r)return;s.preventDefault();const h=i.get("_wd").createRange();h.setStart(r,l),h.setEnd(c,d);const p={y:0,x:0};if(t){const v=this.$.offset.getGlobal(t),b=o?this.$.context.get("toolbar_main").offsetHeight:0;p.y=v.top+b-hp.scrollY,p.x=v.left-hp.scrollX}const f=h.getBoundingClientRect();if(f.height>0){const v=i.get("wysiwygFrame");let b=0,y=0;/^iframe$/i.test(v.nodeName)&&(b=v.offsetLeft,y=v.offsetTop),e.style.left=`${f.right+hp.scrollX+p.x+b}px`,e.style.top=`${f.top+hp.scrollY+p.y-5+y}px`,e.style.height=`${f.height+10}px`,e.style.display="block";try{(m=e.showPopover)==null||m.call(e)}catch{}}else{try{(g=e.hidePopover)==null||g.call(e)}catch{}e.style.display="none"}}function VL(i){var e;try{(e=i.hidePopover)==null||e.call(i)}catch{}i.style.display="none"}function RL(i,e,t){var o;try{if(i.get("isReadOnly"))return t.preventDefault(),t.stopPropagation(),!1;const s=t.dataTransfer;if(!s)return!0;if(Array.from(s.types||[]).includes("application/x-suneditor-block-drag"))return;const{sc:r,so:l,ec:c,eo:d}=this.$.selection.getDragEventLocationRange(t);if(!r)return;if(u.query.getParentElement(r,".se-disable-pointer")){t.preventDefault();return}if(ye.get("__dragContainer")){if(t.preventDefault(),ye.get("__dragContainer").contains(t.target)){this.$.component.deselect();return}const h=ye.get("__dragContainer");this.$.component.deselect(),this.$.selection.setRange(r,l,c,d),this.$.html.insertNode(h,{afterNode:null,skipCharCount:!0}),i.has("documentType_use_page")&&(i.get("documentTypePageMirror").innerHTML=i.get("wysiwyg").innerHTML,i.get("documentType").rePage(!0));return}return this.$.html.remove(),this.$.selection.setRange(r,l,c,d),this._dataTransferAction("drop",t,s,i)}finally{try{(o=e.hidePopover)==null||o.call(e)}catch{}e.style.display="none"}}class zL{constructor({$:e}){w(this,Re,void 0);x(this,Re,e)}execute(e){if(!n(this,Re).options.get("__lineFormatFilter"))return null;if(n(this,Re).pluginManager.fileInfo.pluginRegExp.test(n(this,Re).ui.currentControllerName))return;const t=n(this,Re).selection.getRange(),o=t.commonAncestorContainer,s=t.startContainer,r=t.endOffset,l=n(this,Re).format.getBlock(o,null);let c,d,h;if(l){h=u.utils.createElement(e||n(this,Re).options.get("defaultLine")),h.innerHTML=l.innerHTML,h.childNodes.length===0&&(h.innerHTML=De.zeroWidthSpace),l.innerHTML=h.outerHTML,h=l.firstChild,c=h.childNodes[r]||u.query.getEdgeChildNodes(h,null).sc,c||(c=u.utils.createTextNode(De.zeroWidthSpace),h.insertBefore(c,h.firstChild)),d=c.textContent.length,n(this,Re).selection.setRange(c,d,c,d);return}if(o.nodeType===3&&n(this,Re).component.is(o.parentElement)){const p=n(this,Re).component.get(o.parentElement);if(!p)return;const f=p.container;if(o.parentElement===f){const m=o.nextElementSibling?f:f.nextElementSibling,g=u.utils.createElement(n(this,Re).options.get("defaultLine"),null,o);f.parentElement.insertBefore(g,m),n(this,Re).focusManager.focusEdge(g);return}return n(this,Re).component.select(p.target,p.pluginName),null}else if(o.nodeType===1&&o.getAttribute("data-se-embed")==="true"){let p=o.nextElementSibling;n(this,Re).format.isLine(p)||(p=n(this,Re).format.addLine(o,n(this,Re).options.get("defaultLine"))),n(this,Re).selection.setRange(p.firstChild,0,p.firstChild,0);return}if(!((n(this,Re).format.isBlock(s)||u.check.isWysiwygFrame(s))&&(n(this,Re).component.is(s.children[t.startOffset])||n(this,Re).component.is(s.children[t.startOffset-1])))){if(u.query.getParentElement(o,u.check.isExcludeFormat))return null;if(n(this,Re).format.isBlock(o)&&o.childNodes.length<=1){let p=null;o.childNodes.length===1&&u.check.isBreak(o.firstChild)?p=o.firstChild:(p=u.utils.createTextNode(De.zeroWidthSpace),o.appendChild(p)),n(this,Re).selection.setRange(p,1,p,1);return}try{if(o.nodeType===3&&(h=u.utils.createElement(e||n(this,Re).options.get("defaultLine")),o.parentNode.insertBefore(h,o),h.appendChild(o)),u.check.isBreak(h.nextSibling)&&u.utils.removeItem(h.nextSibling),u.check.isBreak(h.previousSibling)&&u.utils.removeItem(h.previousSibling),u.check.isBreak(c)){const p=u.utils.createTextNode(De.zeroWidthSpace);c.parentNode.insertBefore(p,c),c=p}}catch{n(this,Re).frameContext.get("_wd").execCommand("formatBlock",!1,`<${e||n(this,Re).options.get("defaultLine")}>`),n(this,Re).store.set("_lastSelectionNode",null),n(this,Re).selection.init();return}if(h&&(u.check.isBreak(h.nextSibling)&&u.utils.removeItem(h.nextSibling),u.check.isBreak(h.previousSibling)&&u.utils.removeItem(h.previousSibling),u.check.isBreak(c))){const p=u.utils.createTextNode(De.zeroWidthSpace);c.parentNode.insertBefore(p,c),c=p}n(this,Re).store.set("_lastSelectionNode",null),s?n(this,Re).selection.setRange(s,1,s,1):n(this,Re).focusManager.nativeFocus()}}}Re=new WeakMap;class PL{constructor(e){w(this,jh);w(this,G1);w(this,Ph,void 0);w(this,ze,void 0);w(this,Hh,void 0);x(this,Ph,e),x(this,ze,e.$),x(this,Hh,new RegExp(`^(${Object.keys(n(this,ze).options.get("_defaultStyleTagMap")).join("|")})$`,"i"))}update(e){if(e||(e=n(this,ze).selection.getNode()),e===n(this,ze).store.get("_lastSelectionNode"))return;n(this,ze).store.set("_lastSelectionNode",e);const t=n(this,ze).options.get("_rtl")?"marginRight":"marginLeft",o=n(this,ze).plugins,s=n(this,ze).commandDispatcher.targets,r=n(this,Hh),l=n(this,ze).options.get("_styleCommandMap"),c=[],d=[],h=n(this,ze).options.get("_textStyleTags"),p=[],f=[],m=n(this,ze).commandDispatcher.activeCommands,g=m.length;let v="";if(n(this,ze).component.is(e)&&!n(this,ze).component.__selectionSelected){const C=n(this,ze).component.get(e);if(!C)return;n(this,ze).store.set("_lastSelectionNode",null),n(this,ze).component.select(C.target,C.pluginName);return}for(;e.firstChild;)e=e.firstChild;const b=n(this,ze).frameContext,y=!b.get("isReadOnly");for(let C=e;!u.check.isWysiwygFrame(C)&&C;C=C.parentElement)if(!(C.nodeType!==1||u.check.isBreak(C))){if(E(this,G1,I3).call(this,C)){n(this,ze).focusManager.blur();return}if(v=C.nodeName.toLowerCase(),d.push(v),h.includes(v)&&!n(this,ze).format.isLine(v)&&p.push(C),y)for(let k=0,_;k<g;k++)_=m[k],!c.includes(_)&&!f.includes(_)&&s.get(_)&&s.get(_).filter(S=>{var M;const T=(M=o[_])==null?void 0:M.active(C,S);return T===void 0&&f.push(_),T}).length>0&&c.push(_);if(n(this,ze).format.isLine(C)){if(!c.includes("outdent")&&s.has("outdent")&&(u.check.isListCell(C)||C.style[t]&&Q.get(C.style[t],0)>0)&&s.get("outdent").filter(k=>u.check.isImportantDisabled(k)?!1:(k.disabled=!1,!0)).length>0&&c.push("outdent"),!c.includes("indent")&&s.has("indent")){const k=u.check.isListCell(C)&&!C.previousElementSibling;s.get("indent").filter(_=>u.check.isImportantDisabled(_)?!1:(_.disabled=k,!0)).length>0&&c.push("indent")}continue}r.test(v)&&(v=l[v]||v,c.push(v),u.utils.addClass(s.get(v),"active"))}return E(this,jh,a2).call(this,c),n(this,Ph).__cacheStyleNodes=p.reverse(),n(this,ze).store.set("currentNodes",d.reverse()),n(this,ze).store.set("currentNodesMap",c),n(this,ze).frameOptions.get("statusbar_showPathLabel")&&b.get("navigation")&&(b.get("navigation").textContent=n(this,ze).options.get("_rtl")?n(this,ze).store.get("currentNodes").reverse().join(" < "):n(this,ze).store.get("currentNodes").join(" > ")),e}reset(){E(this,jh,a2).call(this,[])}}Ph=new WeakMap,ze=new WeakMap,Hh=new WeakMap,jh=new WeakSet,a2=function(e){const t=n(this,ze).commandDispatcher.activeCommands,o=n(this,ze).commandDispatcher.targets,s=n(this,ze).plugins;for(let r=0,l=t.length,c,d,h;r<l;r++)if(c=t[r],!(e.includes(c)||!(d=o.get(c)))){h=s[c];for(let p=0,f=d.length,m;p<f;p++)m=d[p],m&&(h?h.active(null,m):/^outdent$/i.test(c)?u.check.isImportantDisabled(m)||(m.disabled=!0):/^indent$/i.test(c)?u.check.isImportantDisabled(m)||(m.disabled=!1):u.utils.removeClass(m,"active"))}},G1=new WeakSet,I3=function(e){return u.check.isElement(e)&&e.getAttribute("data-se-non-focus")==="true"};const{_w:Ct,isMobile:Wg,isTouchDevice:Ug}=ge;class HL extends XN{constructor(t){super(t);w(this,Y1);w(this,K1);w(this,kr);w(this,X1);w(this,Q1);w(this,J1);w(this,em);w(this,tm);w(this,im);w(this,om);w(this,Fh);w(this,sm);w(this,nm);w(this,rm);w(this,am);w(this,lm);w(this,cm);w(this,dm);w(this,hm);w(this,Ce,void 0);w(this,ko,void 0);w(this,oi,void 0);w(this,Rt,void 0);w(this,se,void 0);w(this,nt,void 0);w(this,rt,void 0);w(this,zt,void 0);w(this,qt,null);w(this,Zs,null);w(this,Gs,null);w(this,Ys,null);x(this,Ce,this.$.store),x(this,ko,this.$.contextProvider),x(this,oi,this.$.context),x(this,Rt,this.$.options),x(this,se,this.$.eventManager),x(this,nt,this.$.toolbar),x(this,rt,this.$.ui),x(this,zt,this.$.menu),this.isComposing=!1,this._enterKeyShift=!1,this.scrollparents=[],this.defaultLineManager=new zL(this),this.selectionState=new PL(this),this._onShortcutKey=!1,this._handledInBefore=!1,this._wwFrameObserver=null,this._toolbarObserver=null,this._lineBreakComp=null,this._formatAttrsTemp=null,this._resizeClientY=0,this.__cacheStyleNodes=[],this.__onDownEv=null,this._inputFocus=!1,this.__inputPlugin=null,this.__inputBlurEvent=null,this.__inputKeyEvent=null,this.__retainTimer=null,this.__eventDoc=null,this.__secopy=null,this.__focusTemp=n(this,ko).carrierWrapper.querySelector(".__se__focus__temp__")}applyTagEffect(t){return this.selectionState.update(t)}_showToolbarBalloonDelay(){n(this,qt)&&Ct.clearTimeout(n(this,qt)),x(this,qt,Ct.setTimeout(()=>{Ct.clearTimeout(n(this,qt)),x(this,qt,null),n(this,Ce).mode.isSubBalloon?this.$.subToolbar._showBalloon():n(this,nt)._showBalloon()},250))}_toggleToolbarBalloon(){this.$.selection.init();const t=this.$.selection.getRange(),o=n(this,Rt).has("_subMode");!(o?n(this,Ce).mode.isSubBalloonAlways:n(this,Ce).mode.isBalloonAlways)&&t.collapsed?o?this._hideToolbar_sub():this._hideToolbar():o?this.$.subToolbar._showBalloon(t):n(this,nt)._showBalloon(t)}_hideToolbar(){!n(this,rt).isPreventToolbarHide&&!this.$.frameContext.get("isFullScreen")&&n(this,nt).hide()}_hideToolbar_sub(){this.$.subToolbar&&!n(this,rt).isPreventToolbarHide&&this.$.subToolbar.hide()}_setDefaultLine(t){return this.defaultLineManager.execute(t)}_normalizeEditRange(){var o;if(!this.$.format.isLine((o=this.$.selection.getRange())==null?void 0:o.startContainer))return null;this.$.selection.resetRangeToTextNode();const t=this.$.selection.getRange();if(t.startContainer===t.endContainer&&t.startOffset!==t.endOffset&&t.startContainer.nodeType===3&&u.check.isZeroWidth(t.startContainer)){const s=t.startContainer.nextSibling;s&&u.check.isBreak(s)?this.$.selection.setRange(s,0,s,0):this.$.selection.setRange(t.endContainer,t.endOffset,t.endContainer,t.endOffset)}return this.$.selection.getNode()}async _dataTransferAction(t,o,s,r){try{return n(this,rt).showLoading(),await E(this,K1,O3).call(this,t,o,s,r),o.preventDefault(),o.stopPropagation(),!1}catch(l){console.warn("[SUNEDITOR.paste.error]",l)}finally{n(this,rt).hideLoading()}}_addCommonEvents(){const t=eL.bind(this),o=iL.bind(this);n(this,se).addEvent(n(this,oi).get("menuTray"),"mousedown",t,!1),n(this,se).addEvent(n(this,oi).get("menuTray"),"click",tL.bind(this),!0),n(this,se).addEvent(n(this,oi).get("toolbar_main"),"mousedown",t,!1),n(this,se).addEvent(n(this,oi).get("toolbar_main"),"click",o,!1),n(this,Rt).has("_subMode")&&(n(this,se).addEvent(n(this,oi).get("toolbar_sub_main"),"mousedown",t,!1),n(this,se).addEvent(n(this,oi).get("toolbar_sub_main"),"click",o,!1)),n(this,nt)._setResponsive(),ge.isResizeObserverSupported&&(this._toolbarObserver=new ResizeObserver(()=>{Ct.setTimeout(()=>{n(this,nt).resetResponsiveToolbar()},0)}),this._wwFrameObserver=new ResizeObserver(s=>{Ct.setTimeout(()=>{s.forEach(r=>{n(this,rt)._emitResizeEvent(this.$.frameRoots.get(r.target.getAttribute("data-root-key")),-1,r)}),n(this,Ce).mode.isInline&&n(this,Ce).mode.isBottom&&n(this,nt)._resetSticky()},0)})),n(this,Rt).get("closeModalOutsideClick")&&n(this,se).addEvent(n(this,ko).carrierWrapper.querySelector(".se-modal .se-modal-inner"),"click",s=>{s.target===n(this,ko).carrierWrapper.querySelector(".se-modal .se-modal-inner")&&n(this,rt).offCurrentModal()},!1),n(this,se).addEvent(Ct,"resize",E(this,sm,F3).bind(this),!1),n(this,se).addEvent(Ct.visualViewport,"resize",E(this,nm,W3).bind(this),!1),n(this,se).addEvent(Ct,"scroll",E(this,rm,U3).bind(this),!1),Ug&&n(this,se).addEvent(Ct.visualViewport,"scroll",E(this,am,q3).bind(this),!1)}_addFrameEvents(t){const o=t.get("options").get("iframe"),s=o?t.get("_ww"):t.get("wysiwyg");t.set("eventWysiwyg",s);const r=t.get("code"),l=n(this,ko).carrierWrapper.querySelector(".se-drag-cursor"),c=rL.bind(this,t);n(this,se).addEvent(s,"mousemove",c,!1),n(this,se).addEvent(s,"mouseleave",aL.bind(this,t),!1),n(this,se).addEvent(s,"mousedown",oL.bind(this,t),!1),n(this,se).addEvent(s,"mouseup",sL.bind(this,t),!1),n(this,se).addEvent(s,"click",nL.bind(this,t),!1),n(this,se).addEvent(s,"beforeinput",TL.bind(this,t),!1),n(this,se).addEvent(s,"input",SL.bind(this,t),!1),n(this,se).addEvent(s,"keydown",BL.bind(this,t),!1),n(this,se).addEvent(s,"keyup",NL.bind(this,t),!1),n(this,se).addEvent(s,"paste",IL.bind(this,t),!1),n(this,se).addEvent(s,"copy",$L.bind(this,t),!1),n(this,se).addEvent(s,"cut",OL.bind(this,t),!1),n(this,se).addEvent(s,"dragover",DL.bind(this,t,l,o?this.$.frameContext.get("topArea"):null,!n(this,Rt).get("toolbar_container")&&!n(this,Ce).mode.isBalloon&&!n(this,Ce).mode.isInline),!1),n(this,se).addEvent(s,"dragend",VL.bind(this,l),!1),n(this,se).addEvent(s,"drop",RL.bind(this,t,l),!1),n(this,se).addEvent(s,"scroll",E(this,Q1,V3).bind(this,t,s),{passive:!0,capture:!1}),n(this,se).addEvent(s,"focus",E(this,J1,R3).bind(this,t),!1),n(this,se).addEvent(s,"blur",E(this,em,z3).bind(this,t),!1),n(this,se).addEvent(r,"mousedown",E(this,dm,Y3).bind(this,t),!1);const d=t.get("wrapper").querySelector(".se-drag-handle");if(n(this,se).addEvent(d,"wheel",m=>{m.preventDefault(),this.$.component.deselect()},!1),n(this,se).addEvent(t.get("lineBreaker_t"),"pointerdown",E(this,Fh,l2).bind(this,"t"),!1),n(this,se).addEvent(t.get("lineBreaker_b"),"pointerdown",E(this,Fh,l2).bind(this,"b"),!1),Ug&&n(this,se).addEvent(s,"touchstart",c,{passive:!0,capture:!1}),!n(this,Rt).get("hasCodeMirror")){const m=t.get("codeNumbers"),g=this.$.viewer._codeViewAutoHeight.bind(this.$.viewer,t.get("code"),m,this.$.frameOptions.get("height")==="auto");n(this,se).addEvent(r,"keydown",g,!1),n(this,se).addEvent(r,"keyup",g,!1),n(this,se).addEvent(r,"paste",g,!1),n(this,Rt).get("tabDisable")||n(this,se).addEvent(r,"keydown",zv,!1),m&&n(this,se).addEvent(r,"scroll",this.$.viewer._scrollLineNumbers.bind(r,m),!1)}const h=t.get("markdown");if(h){n(this,se).addEvent(h,"mousedown",E(this,hm,K3).bind(this,t),!1);const m=t.get("markdownNumbers"),g=this.$.viewer._markdownViewAutoHeight.bind(this.$.viewer,h,m,this.$.frameOptions.get("height")==="auto");n(this,se).addEvent(h,"keydown",g,!1),n(this,se).addEvent(h,"keyup",g,!1),n(this,se).addEvent(h,"paste",g,!1),n(this,Rt).get("tabDisable")||n(this,se).addEvent(h,"keydown",zv,!1),m&&n(this,se).addEvent(h,"scroll",this.$.viewer._scrollMarkdownLineNumbers.bind(h,m),!1)}t.has("statusbar")&&this.__addStatusbarEvent(t,t.get("options"));const p=E(this,cm,G3).bind(this),f=u.query.getScrollParents(t.get("originElement"));for(const m of f)this.scrollparents.push(m),n(this,se).addEvent(m,"scroll",p,!1);n(this,se).addEvent(this.__focusTemp,"focus",m=>m.preventDefault(),!1),this.__eventDoc!==t.get("_wd")&&(this.__eventDoc=t.get("_wd"),n(this,se).addEvent(this.__eventDoc,"selectionchange",E(this,lm,Z3).bind(this,this.__eventDoc),!1))}__addStatusbarEvent(t,o){/\d+/.test(o.get("height"))&&o.get("statusbar_resizeEnable")?o.set("__statusbarEvent",n(this,se).addEvent(t.get("statusbar"),"mousedown",E(this,tm,P3).bind(this),!1)):u.utils.addClass(t.get("statusbar"),"se-resizing-none")}_removeAllEvents(){n(this,se)._init(),this._wwFrameObserver&&(this._wwFrameObserver.disconnect(),this._wwFrameObserver=null),this._toolbarObserver&&(this._toolbarObserver.disconnect(),this._toolbarObserver=null),n(this,qt)&&(Ct.clearTimeout(n(this,qt)),x(this,qt,null)),this.__retainTimer&&(Ct.clearTimeout(this.__retainTimer),this.__retainTimer=null),n(this,Gs)&&x(this,Gs,n(this,se).removeGlobalEvent(n(this,Gs))),n(this,Ys)&&x(this,Ys,n(this,se).removeGlobalEvent(n(this,Ys))),n(this,Zs)&&x(this,Zs,n(this,se).removeGlobalEvent(n(this,Zs))),this._formatAttrsTemp=null,this.__cacheStyleNodes=null,this.__inputPlugin=null,this.__inputBlurEvent=null,this.__inputKeyEvent=null,this.__focusTemp=null,this.__eventDoc=null,this.__secopy=null,this._lineBreakComp=null,this.scrollparents=null}_setSelectionSync(){n(this,se).removeGlobalEvent(n(this,Gs)),x(this,Gs,n(this,se).addGlobalEvent("mouseup",()=>{this.$.selection.init(),n(this,se).removeGlobalEvent(n(this,Gs))}))}_retainStyleNodes(t,o){let r=o[0].cloneNode(!1);for(let h=1,p=o.length,f;h<p;h++)f=o[h].cloneNode(!1),r.appendChild(f),r=f;const{parent:l,inner:c}=this.$.nodeTransform.createNestedNode(o,null),d=u.utils.createTextNode(De.zeroWidthSpace);c.appendChild(d),t.innerHTML="",t.appendChild(l),this.$.selection.setRange(d,1,d,1)}_clearRetainStyleNodes(t){t.innerHTML="<br>",this.$.selection.setRange(t,0,t,0)}_callPluginEvent(t,o){return this.$.pluginManager.emitEvent(t,o)}async _callPluginEventAsync(t,o){return await this.$.pluginManager.emitEventAsync(t,o)}__removeInput(){n(this,Ce).set("_preventBlur",!1),this._inputFocus=!1,this.__inputBlurEvent=n(this,se).removeEvent(this.__inputBlurEvent),this.__inputKeyEvent=n(this,se).removeEvent(this.__inputKeyEvent),this.__inputPlugin=null}__postFocusEvent(t,o){(n(this,Ce).mode.isInline||n(this,Ce).mode.isBalloonAlways)&&n(this,nt).show(),n(this,Ce).mode.isSubBalloonAlways&&this.$.subToolbar.show(),n(this,nt)._resetSticky(),n(this,rt)._updatePlaceholder(t),n(this,se).triggerEvent("onFocus",{frameContext:t,event:o}),this._callPluginEvent("onFocus",{frameContext:t,event:o})}__postBlurEvent(t,o){n(this,Ce).mode.isInline?Ct.setTimeout(()=>{n(this,Ce).get("hasFocus")||this._hideToolbar()},0):n(this,Ce).mode.isBalloon&&this._hideToolbar(),n(this,Ce).mode.isSubBalloon&&this._hideToolbar_sub(),n(this,se).triggerEvent("onBlur",{frameContext:t,event:o}),this._callPluginEvent("onBlur",{frameContext:t,event:o})}__setViewportSize(){n(this,Ce).set("currentViewportHeight",Q.get(Ct.visualViewport.height,0))}}Ce=new WeakMap,ko=new WeakMap,oi=new WeakMap,Rt=new WeakMap,se=new WeakMap,nt=new WeakMap,rt=new WeakMap,zt=new WeakMap,qt=new WeakMap,Zs=new WeakMap,Gs=new WeakMap,Ys=new WeakMap,Y1=new WeakSet,$3=function(){n(this,qt)&&Ct.clearTimeout(n(this,qt)),x(this,qt,Ct.setTimeout(()=>{Ct.clearTimeout(n(this,qt)),x(this,qt,null),this._toggleToolbarBalloon()},250))},K1=new WeakSet,O3=async function(t,o,s,r){o.preventDefault(),o.stopPropagation();let l=s.getData("text/plain"),c=s.getData("text/html");const d=!c,h=this.__secopy===l,p=/class=["']*Mso(Normal|List)/i.test(c)||/content=["']*Word.Document/i.test(c)||/content=["']*OneNote.File/i.test(c)||/content=["']*Excel.Sheet/i.test(c),f=h?"SE":p?"MS":"";if(d?c=Te.htmlToEntity(l).replace(/\n/g,"<br>"):(c=c.replace(/^<html>\r?\n?<body>\r?\n?\x3C!--StartFragment-->|\x3C!--EndFragment-->\r?\n?<\/body>\r?\n?<\/html>$/g,""),p&&(c=c.replace(/\n/g," "),l=l.replace(/\n/g," "),c=SA.cleanHTML(c))),!h&&n(this,Rt).get("autoLinkify")){const b=new DOMParser().parseFromString(c,"text/html");u.query.getListChildNodes(b.body,Te.textToAnchor,null),c=b.body.innerHTML}d||(c=this.$.html.clean(c,{forceFormat:!1,whitelist:null,blacklist:null}));const m=this.$.char.test(this.$.frameOptions.get("charCounter_type")==="byte-html"?c:l,!1);if(t==="paste"){const v=await n(this,se).triggerEvent("onPaste",{frameContext:r,event:o,data:c,maxCharCount:m,from:f});if(v===!1)return!1;if(typeof v=="string"){if(!v)return!1;c=v}}if(t==="drop"){const v=await n(this,se).triggerEvent("onDrop",{frameContext:r,event:o,data:c,maxCharCount:m,from:f});if(v===!1)return!1;if(typeof v=="string"){if(!v)return!1;c=v}}const g=s.files;if(g.length>0&&!p){for(let v=0,b=g.length;v<b;v++)await this._callPluginEventAsync("onFilePasteAndDrop",{frameContext:r,event:o,file:g[v]});return!1}if(!m)return!1;if(c){const v=new DOMParser().parseFromString(c,"text/html");return await this._callPluginEventAsync("onPaste",{frameContext:r,event:o,data:c,doc:v})!==!1&&this.$.html.insert(c,{selectInserted:!1,skipCharCount:!0,skipCleaning:!0}),r.has("documentType_use_header")&&r.get("documentType").reHeader(),!1}},kr=new WeakSet,pu=function(){n(this,zt).currentDropdownActiveButton&&n(this,zt).currentDropdown&&n(this,zt).__resetMenuPosition(n(this,zt).currentDropdownActiveButton,n(this,zt).currentDropdown),n(this,rt)._repositionControllers()},X1=new WeakSet,D3=function(){ge.isResizeObserverSupported||(n(this,nt).resetResponsiveToolbar(),n(this,Rt).get("_subMode")&&this.$.subToolbar.resetResponsiveToolbar());const t=n(this,oi).get("toolbar_main"),o=t.style.display==="none"||n(this,Ce).mode.isInline&&!n(this,nt).inlineToolbarAttr.isShow;if(t.offsetWidth===0&&!o)return;const s=n(this,rt).opendBrowser;if(s&&s.area.style.display==="block"&&(s.body.style.maxHeight=u.utils.getClientSize().h-s.header.offsetHeight-50+"px"),n(this,zt).currentDropdownActiveButton&&n(this,zt).currentDropdown&&n(this,zt).__resetMenuPosition(n(this,zt).currentDropdownActiveButton,n(this,zt).currentDropdown),this.$.viewer._resetFullScreenHeight())return;const r=this.$.frameContext;if(r.get("isCodeView")&&n(this,Ce).mode.isInline){n(this,nt)._showInline();return}n(this,rt)._iframeAutoHeight(r),n(this,nt).isSticky&&(n(this,nt).isCSSSticky||(n(this,oi).get("toolbar_main").style.width=r.get("topArea").offsetWidth-2+"px"),n(this,nt)._resetSticky())},Q1=new WeakSet,V3=function(t,o,s){n(this,rt)._syncScrollPosition(o),E(this,kr,pu).call(this),this._callPluginEvent("onScroll",{frameContext:t,event:s}),t.has("documentType_use_page")&&t.get("documentType").scrollPage(),n(this,se).triggerEvent("onScroll",{frameContext:t,event:s})},J1=new WeakSet,R3=function(t,o){if(this.$.selection.__iframeFocus||t.get("isReadOnly")||t.get("isDisabled"))return o.preventDefault(),!1;n(this,Ce).set("hasFocus",!0),this.$.component.__prevent=!1,n(this,se).triggerEvent("onNativeFocus",{frameContext:t,event:o});const s=t.get("key");if(this._inputFocus){n(this,Ce).mode.isInline&&Ct.setTimeout(()=>{n(this,nt)._showInline()},0);return}n(this,Ce).get("rootKey")===s&&n(this,Ce).get("_preventBlur")||n(this,Ce).get("_preventFocus")||(n(this,Ce).set("_preventFocus",!0),u.utils.removeClass(this.$.commandDispatcher.targets.get("codeView"),"active"),n(this,rt)._toggleCodeViewButtons(!1),this.$.facade.changeFrameContext(s),this.$.history.resetButtons(s,null),Ct.setTimeout(()=>{this.__postFocusEvent(t,o)},0))},em=new WeakSet,z3=function(t,o){t.get("isCodeView")||t.get("isReadOnly")||t.get("isDisabled")||(n(this,Ce).set("hasFocus",!1),n(this,Ce).set("_lastSelectionNode",null),n(this,se).triggerEvent("onNativeBlur",{frameContext:t,event:o}),n(this,rt)._updatePlaceholder(t),!(this._inputFocus||n(this,Ce).get("_preventBlur"))&&(n(this,Ce).set("_preventFocus",!1),this.selectionState.reset(),n(this,Ce).set("currentNodes",[]),n(this,Ce).set("currentNodesMap",[]),n(this,rt).offCurrentController(),n(this,ko).applyToRoots(s=>{s.get("navigation")&&(s.get("navigation").textContent="")}),this.$.history.check(t.get("key"),n(this,Ce).get("_range")),this.__postBlurEvent(t,o)))},tm=new WeakSet,P3=function(t){t.stopPropagation(),this._resizeClientY=t.clientY,n(this,rt).enableBackWrapper("ns-resize"),x(this,Ys,n(this,se).addGlobalEvent("mousemove",E(this,im,H3).bind(this))),x(this,Zs,n(this,se).addGlobalEvent("mouseup",E(this,om,j3).bind(this)))},im=new WeakSet,H3=function(t){const o=this.$.frameContext,s=o.get("wrapper").offsetHeight+(t.clientY-this._resizeClientY),r=s<o.get("_minHeight")?o.get("_minHeight"):s;o.get("wysiwygFrame").style.height=o.get("code").style.height=r+"px",this._resizeClientY=t.clientY,ge.isResizeObserverSupported||n(this,rt)._emitResizeEvent(o,r,null)},om=new WeakSet,j3=function(){n(this,rt).disableBackWrapper(),n(this,Ys)&&x(this,Ys,n(this,se).removeGlobalEvent(n(this,Ys))),n(this,Zs)&&x(this,Zs,n(this,se).removeGlobalEvent(n(this,Zs)))},Fh=new WeakSet,l2=function(t,o){o.preventDefault();const s=this._lineBreakComp;if(!s)return;const r=u.check.isListCell(s.parentElement),l=u.utils.createElement(r?"BR":u.check.isTableCell(s.parentElement)?"DIV":n(this,Rt).get("defaultLine"));if(r||(l.innerHTML="<br>"),!(this.$.frameOptions.get("charCounter_type")==="byte-html"&&!this.$.char.check(l.outerHTML))){s.parentNode.insertBefore(l,t==="t"?s:s.nextSibling),this.$.component.deselect();try{const c=r?l:l.firstChild;this.$.selection.setRange(c,1,c,1),this.$.history.push(!1)}catch(c){console.warn("[SUNEDITOR.lineBreaker.error]",c)}}},sm=new WeakSet,F3=function(){n(this,Ce).set("initViewportHeight",Ct.visualViewport.height),Wg||n(this,rt).offCurrentController(),n(this,Ce).mode.isBalloon?n(this,nt).hide():n(this,Ce).mode.isSubBalloon&&this.$.subToolbar.hide(),E(this,X1,D3).call(this)},nm=new WeakSet,W3=function(){Wg&&n(this,Rt).get("_toolbar_sticky")>-1&&(n(this,nt)._resetSticky(),n(this,zt).__restoreMenuPosition()),E(this,kr,pu).call(this);const t=n(this,Ce).get("currentViewportHeight");this.__setViewportSize(),Wg&&t>0&&t-Ct.visualViewport.height>100&&n(this,Ce).get("hasFocus")&&this.$.selection.scrollTo(this.$.selection.getRange(),{behavior:"auto",block:"nearest",inline:"nearest"})},rm=new WeakSet,U3=function(){n(this,Rt).get("_toolbar_sticky")>-1&&n(this,nt)._resetSticky(),n(this,Ce).mode.isBalloon&&n(this,oi).get("toolbar_main").style.display==="block"?n(this,nt)._setBalloonOffset(n(this,nt).balloonOffset.position==="top"):n(this,Ce).mode.isSubBalloon&&n(this,oi).get("toolbar_sub_main").style.display==="block"&&this.$.subToolbar._setBalloonOffset(this.$.subToolbar.balloonOffset.position==="top"),E(this,kr,pu).call(this),this.$.frameContext.has("documentType_use_page")&&this.$.frameContext.get("documentType").scrollWindow()},am=new WeakSet,q3=function(){n(this,Rt).get("_toolbar_sticky")>-1&&(n(this,nt)._resetSticky(),n(this,zt).__restoreMenuPosition())},lm=new WeakSet,Z3=function(t){let s=t.getSelection().anchorNode;n(this,ko).applyToRoots(r=>{if(s&&r.get("wysiwyg").contains(s)){if(r.get("isReadOnly")||r.get("isDisabled"))return;if(s=null,this.$.selection.init(),this.applyTagEffect(),n(this,rt)._updatePlaceholder(r),Ug&&(n(this,Ce).mode.isBalloon||n(this,Ce).mode.isSubBalloon)&&E(this,Y1,$3).call(this),r.has("documentType_use_header")){const l=u.query.getParentElement(this.$.selection.selectionNode,this.$.format.isLine.bind(this.$.format));r.get("documentType").on(l)}}})},cm=new WeakSet,G3=function(){n(this,zt).dropdownOff(),E(this,kr,pu).call(this)},dm=new WeakSet,Y3=function(t){this.$.facade.changeFrameContext(t.get("key")),u.utils.addClass(this.$.commandDispatcher.targets.get("codeView"),"active"),n(this,rt)._toggleCodeViewButtons(!0)},hm=new WeakSet,K3=function(t){this.$.facade.changeFrameContext(t.get("key")),u.utils.addClass(this.$.commandDispatcher.targets.get("markdownView"),"active"),n(this,rt)._toggleCodeViewButtons(!0)};function zv(i){if(i.key!=="Tab")return;i.preventDefault();const e=i.target,t=e.selectionStart,o=e.selectionEnd;e.value=e.value.substring(0,t)+" "+e.value.substring(o),e.selectionStart=e.selectionEnd=t+1}const jL=HL;class FL{constructor(e,t){w(this,um);w(this,pm);w(this,fm);w(this,mm);w(this,gm);w(this,si,new Map);w(this,ve,new Map);jl(this,"$",null);const{product:o,options:s}=t;this.store=new XA(o),this.$={facade:e,store:this.store},E(this,um,X3).call(this,o,s),E(this,pm,Q3).call(this),E(this,fm,J3).call(this,o),E(this,gm,t5).call(this),E(this,mm,e5).call(this),this._eventOrchestrator=new jL(this),n(this,si).get("eventManager")._bindOrchestrator(this._eventOrchestrator)}_destroy(){var t,o,s;if(this.$===null)return;const e=[];for(const[r,l]of n(this,ve))try{(t=l==null?void 0:l._destroy)==null||t.call(l)}catch(c){e.push(`[Logic:${r}] ${c.message}`)}n(this,ve).clear();try{(o=this._eventOrchestrator)==null||o._removeAllEvents()}catch(r){e.push(`[EventOrchestrator] ${r.message}`)}this._eventOrchestrator=null;for(const[r,l]of n(this,si))try{(s=l==null?void 0:l._destroy)==null||s.call(l)}catch(c){e.push(`[Config:${r}] ${c.message}`)}n(this,si).clear(),e.length>0&&console.warn("[CoreKernel._destroy] Cleanup completed with errors:",e),this.$=null,this.store._destroy(),this.store=null,this.facade=null}}si=new WeakMap,ve=new WeakMap,um=new WeakSet,X3=function(e,t){const o=new JA(e),s=new eB(this,e,t);n(this,si).set("contextProvider",o),n(this,si).set("optionProvider",s),n(this,si).set("instanceCheck",new iB(o.frameContext)),n(this,si).set("eventManager",new dB(o,s,this.$))},pm=new WeakSet,Q3=function(){const e=n(this,si).get("contextProvider"),t=n(this,si).get("optionProvider");Object.assign(this.$,{contextProvider:e,optionProvider:t,instanceCheck:n(this,si).get("instanceCheck"),eventManager:n(this,si).get("eventManager"),frameRoots:e.frameRoots,context:e.context,options:t.options,icons:e.icons,lang:e.lang,frameContext:e.frameContext,frameOptions:t.frameOptions})},fm=new WeakSet,J3=function(e){n(this,ve).set("offset",new uB(this)),n(this,ve).set("selection",new fB(this)),n(this,ve).set("html",new GB(this)),n(this,ve).set("nodeTransform",new KB(this)),n(this,ve).set("format",new gB(this)),n(this,ve).set("inline",new vB(this)),n(this,ve).set("listFormat",new wB(this)),n(this,ve).set("char",new QB(this)),n(this,ve).set("shortcuts",new eN(this)),n(this,ve).set("component",new bN(this)),n(this,ve).set("pluginManager",new yN(this,e)),n(this,ve).set("focusManager",new wN(this)),n(this,ve).set("ui",new zN(this)),n(this,ve).set("commandDispatcher",new ON(this)),n(this,ve).set("toolbar",new Ev(this,{keyName:"toolbar",balloon:this.store.mode.isBalloon,balloonAlways:this.store.mode.isBalloonAlways,inline:this.store.mode.isInline,res:e.responsiveButtons})),this.$.options.has("_subMode")&&n(this,ve).set("subToolbar",new Ev(this,{keyName:"toolbar_sub",balloon:this.store.mode.isSubBalloon,balloonAlways:this.store.mode.isSubBalloonAlways,inline:!1,res:e.responsiveButtons_sub})),n(this,ve).set("menu",new WN(this)),n(this,ve).set("viewer",new qN(this)),n(this,ve).set("finder",new YN(this)),n(this,ve).set("history",PN(this))},mm=new WeakSet,e5=function(){for(const[,e]of n(this,ve))typeof(e==null?void 0:e._init)=="function"&&e._init()},gm=new WeakSet,t5=function(){const e=n(this,ve).get("pluginManager");Object.assign(this.$,{offset:n(this,ve).get("offset"),selection:n(this,ve).get("selection"),format:n(this,ve).get("format"),inline:n(this,ve).get("inline"),listFormat:n(this,ve).get("listFormat"),html:n(this,ve).get("html"),nodeTransform:n(this,ve).get("nodeTransform"),char:n(this,ve).get("char"),component:n(this,ve).get("component"),focusManager:n(this,ve).get("focusManager"),pluginManager:e,plugins:e.plugins,ui:n(this,ve).get("ui"),commandDispatcher:n(this,ve).get("commandDispatcher"),history:n(this,ve).get("history"),shortcuts:n(this,ve).get("shortcuts"),toolbar:n(this,ve).get("toolbar"),subToolbar:n(this,ve).get("subToolbar"),menu:n(this,ve).get("menu"),viewer:n(this,ve).get("viewer"),finder:n(this,ve).get("finder")})};const WL=FL;class UL{constructor(e,t){w(this,Rl);w(this,bm);w(this,vm);w(this,ym);w(this,wm);w(this,Cm);w(this,ni,void 0);jl(this,"$");const o=OA(e,t),s=new WL(this,{product:o,options:t});x(this,ni,s),this.$=s.$,E(this,Cm,r5).call(this,t).catch(r=>{console.error("[SUNEDITOR:E_CREATE_FAIL] Failed to create editor instance.",r)})}isEmpty(e){const t=(e||this.$.frameContext).get("wysiwyg");return u.check.isZeroWidth(t.textContent)&&!t.querySelector(this.$.options.get("allowedEmptyTags"))&&(t.innerText.match(/\n/g)||"").length<=1}resetOptions(e){var t;this.$.optionProvider.reset(e),this.$.store.set("_lastSelectionNode",null),E(this,Rl,zm).call(this,this.$.frameRoots.get(this.$.store.get("rootKey")));for(const o of Object.values(this.$.plugins))(t=o.init)==null||t.call(o)}changeFrameContext(e){e!==this.$.store.get("rootKey")&&(this.$.store.set("rootKey",e),E(this,Rl,zm).call(this,this.$.frameRoots.get(e)),this.$.toolbar._resetSticky())}destroy(){this.$.options.get("hasCodeMirror")&&this.$.contextProvider.applyToRoots(e=>{const o=e.get("options").get("codeMirrorEditor");o&&o.toTextArea()}),u.utils.removeItem(this.$.context.get("toolbar_wrapper")),u.utils.removeItem(this.$.context.get("toolbar_sub_wrapper")),u.utils.removeItem(this.$.context.get("statusbar_wrapper"));for(const e in this.events)this.events[e]=null;return this.events=null,n(this,ni)._destroy(),null}}ni=new WeakMap,Rl=new WeakSet,zm=function(e){this.$.contextProvider.reset(e),this.$.optionProvider.resetFrame(e.get("options")),this.$.ui.reset(e)},bm=new WeakSet,i5=function(e){this.$.store.set("initViewportHeight",ge._w.visualViewport.height),n(this,ni)._eventOrchestrator.__setViewportSize(),this.$.store.set("_canUseBeforeInput",ge.canUseBeforeInput()),this.$.contextProvider.init(),E(this,Rl,zm).call(this,this.$.frameRoots.get(this.$.store.get("rootKey"))),E(this,ym,s5).call(this,e),this.$.contextProvider.applyToRoots(t=>{n(this,ni)._eventOrchestrator._addFrameEvents(t),E(this,vm,o5).call(this,t,t.get("options").get("value")),t.get("options").get("iframe")&&t.get("options").get("height")==="auto"&&this.$.ui._emitResizeEvent(t,t.get("wysiwygFrame").offsetHeight,null)}),n(this,ni)._eventOrchestrator.__eventDoc=null,this.$.store._editorInitFinished=!0,this.$.pluginManager.checkFileInfo(!0),this.$.history.reset(),ge._w.setTimeout(()=>{var t,o;if(!((t=this.$.context)!=null&&t.size)){console.warn("[SUNEDITOR:E_INIT_FAIL] Editor instance was destroyed before initialization completed. Check if destroy() was called.");return}this.$.context.get("toolbar_main").style.visibility="",this.$.contextProvider.applyToRoots(s=>{n(this,ni)._eventOrchestrator._wwFrameObserver&&n(this,ni)._eventOrchestrator._wwFrameObserver.observe(s.get("wysiwygFrame")),n(this,ni)._eventOrchestrator._toolbarObserver&&n(this,ni)._eventOrchestrator._toolbarObserver.observe(s.get("_toolbarShadow")),this.$.ui._syncFrameState(s)});for(const s of Object.values(this.$.plugins))(o=s.init)==null||o.call(s);this.$.selection.__init(),this.$.eventManager.triggerEvent("onload",{})},0)},vm=new WeakSet,o5=function(e,t){e.get("wysiwyg").innerHTML=this.$.html.clean(typeof t=="string"?t:(/^TEXTAREA$/i.test(e.get("originElement").nodeName)?e.get("originElement").value:e.get("originElement").innerHTML)||"",{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.$.options.get("freeCodeViewMode")})||"<"+this.$.options.get("defaultLine")+"><br></"+this.$.options.get("defaultLine")+">",e.has("charCounter")&&(e.get("charCounter").textContent=String(this.$.char.getLength())),e.has("wordCounter")&&(e.get("wordCounter").textContent=String(this.$.char.getWordCount())),this.$.options.get("type")==="document"&&(e.set("documentType",new YA(n(this,ni),e)),e.get("documentType").useHeader&&e.set("documentType_use_header",!0),e.get("documentType").usePage&&(e.set("documentType_use_page",!0),e.get("documentTypePageMirror").innerHTML=e.get("wysiwyg").innerHTML))},ym=new WeakSet,s5=function(e){this.$.pluginManager.init(e),this.$.shortcuts._registerShortcuts(),this.$.commandDispatcher._initCommandButtons(),this.$.ui.init()},wm=new WeakSet,n5=function(e,t,o){e.contentDocument.documentElement.className="sun-editor",e.contentDocument.head.innerHTML='<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">'+Te._setIframeStyleLinks(o.get("iframe_cssFileName"))+Te._setAutoHeightStyle(o.get("height")),e.contentDocument.body.className=t.get("_editableClass"),e.contentDocument.body.setAttribute("contenteditable","true"),t.get("_rtl")&&(e.contentDocument.body.dir="rtl")},Cm=new WeakSet,r5=async function(e){n(this,ni)._eventOrchestrator._addCommonEvents();const t=[];this.$.contextProvider.applyToRoots(o=>{const s=o.get("originElement"),r=o.get("topArea");if(s.style.display="none",r.style.display="block",s.parentNode.insertBefore(r,s.nextElementSibling),o.get("options").get("iframe")){const l=new Promise(c=>{const d=h=>{E(this,wm,n5).call(this,h,this.$.optionProvider.options,o.get("options")),c()};if(ge.isGecko){let h=null;this.$.eventManager.addEvent(o.get("wysiwygFrame"),"load",({target:p})=>{clearTimeout(h),h=setTimeout(()=>{this.$&&d(p)},60)})}else this.$.eventManager.addEvent(o.get("wysiwygFrame"),"load",({target:h})=>{d(h)})});t.push(l)}}),this.$.contextProvider.applyToRoots(o=>{o.get("wrapper").appendChild(o.get("wysiwygFrame")),o.get("documentTypeInner")&&o.get("wrapper").insertBefore(o.get("documentTypeInner"),o.get("wysiwygFrame")),o.get("documentTypePage")&&(o.get("wrapper").appendChild(o.get("documentTypePage")),o.get("wrapper").appendChild(o.get("documentTypePageMirror"))),o.get("blockHandleArea")&&o.get("wrapper").insertBefore(o.get("blockHandleArea"),o.get("wysiwygFrame"))}),t.length>0&&await Promise.all(t),E(this,bm,i5).call(this,e)};const qL=UL,ZL={init(i){return{create:(e,t)=>this.create(e,t,i)}},create(i,e,t){if(typeof e!="object"&&(e={}),t&&(e=(()=>[t,e].reduce((s,r)=>(Object.entries(r).forEach(([l,c])=>{if(l==="plugins"&&c&&s[l]){const d=Array.isArray(s[l])?s[l]:Object.values(s[l]),h=Array.isArray(c)?c:Object.values(c);s[l]=[...h.filter(p=>!d.includes(p)),...d]}else s[l]=c}),s),{}))()),!i)throw Error('[SUNEDITOR.create.fail] The first parameter "target" is missing.');const o=[];if(typeof i=="string"){const s=document.querySelector(i);if(!s)throw Error(`[SUNEDITOR.create.fail]-[document.querySelector(${i})] Cannot find target element. Make sure "${i}" is a valid selector and exists in the document.`);o.push({key:null,target:s})}else if(i.nodeType===1)o.push({key:null,target:i});else{let s;for(const r in i){if(s=i[r],!s.target||s.target.nodeType!==1)throw Error(`[SUNEDITOR.create.fail] suneditor multi root requires textarea's element at the "target" property.`);s.key=r,o.push(s)}}return new qL(o,e)}},LR="",IR="",qg=a.defineComponent({__name:"AoRichTextEditor",props:{modelValue:{default:""},readonly:{type:Boolean,default:!1},placeholder:{default:""}},emits:["update:modelValue","blur","focus"],setup(i,{emit:e}){const t=i,o=e,s=a.ref(null),r=a.shallowRef(null),l=a.ref(t.modelValue??""),c=a.ref(!1),d=p=>({value:p,placeholder:t.placeholder,width:"100%",minHeight:"100px",statusBar:!1,charCounter:!1,buttonList:[["bold","italic","underline","strike"],["list"]],editable:!t.readonly,attributesWhitelist:{all:{"data-mention":"data-mention"}},defaultStyle:`
|
|
224
|
+
</div>`,o=u.utils.createElement("DIV",{class:"se-find-replace"},t);return{panel:o,findInput:o.querySelector(".se-find-replace-input"),replaceInput:o.querySelector(".se-replace-input"),countDisplay:o.querySelector(".se-find-replace-count"),replaceRow:o.querySelector(".se-find-replace-row-replace"),btnCase:o.querySelector(".se-find-opt-case"),btnWord:o.querySelector(".se-find-opt-word"),btnRegex:o.querySelector(".se-find-opt-regex"),btnPrev:o.querySelector('[data-command="prev"]'),btnNext:o.querySelector('[data-command="next"]'),btnReplace:o.querySelector('[data-command="replace"]'),btnReplaceAll:o.querySelector('[data-command="replace-all"]')}}const YN=jg;class KN{constructor(e){jl(this,"$");this.$=e.$}}const XN=KN,{isMobile:QN,_w:JN}=ge;function eL(i){var s;const e=u.query.getEventTarget(i);let t=e;this.$.store.mode.isBalloon&&!((s=this.$.context.get("toolbar_sub_main"))!=null&&s.contains(t))&&this._hideToolbar_sub();const o=u.check.isInputElement(t);if(o?this.$.store.set("_preventBlur",!1):this.$.frameContext.get("wysiwyg").contains(this.$.selection.getNode())||this.$.focusManager.focus(),u.query.getParentElement(t,".se-dropdown"))i.stopPropagation(),this.$.ui.preventToolbarHide(!0);else{let r=t.getAttribute("data-command"),l=t.className;for(;t&&!r&&!/(se-menu-list|sun-editor-common|se-menu-tray)/.test(l);)t=t.parentElement,r=t.getAttribute("data-command"),l=t.className;if(o&&/^INPUT$/i.test(t==null?void 0:t.getAttribute("data-type"))){if(this.$.store.set("_preventBlur",!0),this._inputFocus=!0,this.$.store.get("hasFocus")||this.applyTagEffect(),!u.check.isInputElement(e)||e.disabled)return;const c=this.$.plugins[r];if(!c||(this.__inputBlurEvent&&this.__removeInput(),typeof c.toolbarInputChange=="function"&&(this.__inputPlugin={obj:c,target:e,value:e.value}),this.__inputBlurEvent=this.$.eventManager.addEvent(e,"blur",d=>{if(!c.isInputActive)try{const h=e.value.trim();typeof c.toolbarInputChange=="function"&&h!==this.__inputPlugin.value&&c.toolbarInputChange({target:e,value:h,event:d})}finally{JN.setTimeout(()=>this._inputFocus=!1,0),this.__removeInput()}}),!c))return;typeof c.toolbarInputKeyDown=="function"&&(this.__inputKeyEvent=this.$.eventManager.addEvent(e,"keydown",d=>{c.toolbarInputKeyDown({target:e,event:d})}))}else if(this.__inputBlurEvent&&this.__inputPlugin){const c=this.__inputPlugin.target.value.trim();c!==this.__inputPlugin.value&&this.__inputPlugin.obj.toolbarInputChange({target:this.__inputPlugin.target,value:c,event:i}),this.__removeInput();return}else this.$.frameContext.get("isCodeView")||(QN?this.$.store.set("_preventBlur",!0):(i.preventDefault(),ge.isGecko&&r&&this.$.eventManager._injectActiveEvent(t)));(r===this.$.menu.currentDropdownName||r===this.$.menu.currentContainerName)&&i.stopPropagation()}}function tL(i){const e=u.query.getEventTarget(i),t=u.query.getCommandTarget(e);if(!t)return;let o=t,s="";for(;o&&!/se-menu-tray/.test(o.className)&&!s;)o=o.parentElement,s=o==null?void 0:o.getAttribute("data-key");if(!s)return;const r=this.$.plugins[s];!r||typeof r.action!="function"||(i.stopPropagation(),r.action(t))}function iL(i){const e=u.query.getEventTarget(i);this.$.commandDispatcher.runFromTarget(e)}const{_w:ap}=ge,Av=new WeakMap;async function oL(i,e){const t=u.query.getEventTarget(e);if(this.$.store.set("_mousedown",!0),this.__onDownEv&&Bv.call(this),this.__onDownEv=this.$.eventManager.addGlobalEvent("mouseup",Bv.bind(this)),!(i.get("isReadOnly")||u.check.isNonEditable(i.get("wysiwyg")))){if(this.$.format._isExcludeSelectionElement(t)){e.preventDefault();return}this._setSelectionSync(),ap.setTimeout(this.$.selection.init.bind(this.$.selection),0),await this.$.eventManager.triggerEvent("onMouseDown",{frameContext:i,event:e})!==!1&&await this._callPluginEventAsync("onMouseDown",{frameContext:i,event:e})!==!1&&(this.$.store.mode.isBalloon?this._hideToolbar():this.$.store.mode.isSubBalloon&&this._hideToolbar_sub(),/FIGURE/i.test(t==null?void 0:t.nodeName)&&e.preventDefault())}}function Bv(){this.$.store.set("_mousedown",!1),this.__onDownEv=this.$.eventManager.removeGlobalEvent(this.__onDownEv)}async function sL(i,e){await this.$.eventManager.triggerEvent("onMouseUp",{frameContext:i,event:e})!==!1&&await this._callPluginEventAsync("onMouseUp",{frameContext:i,event:e})}async function nL(i,e){const t=u.query.getEventTarget(e);if(i.get("isReadOnly"))return e.preventDefault(),u.check.isAnchor(t)&&ap.open(t.href,t.target),!1;if(u.check.isNonEditable(i.get("wysiwyg"))||await this.$.eventManager.triggerEvent("onClick",{frameContext:i,event:e})===!1||await this._callPluginEventAsync("onClick",{frameContext:i,event:e})===!1)return;const o=this.$.component.get(t);if(o){e.preventDefault(),this.$.component.select(o.target,o.pluginName);return}if(this.$.selection.init(),e.detail===3){const c=this.$.selection.getRange();this.$.format.isLine(c.endContainer)&&c.endOffset===0&&this.$.selection.setRange(c.startContainer,c.startOffset,c.startContainer,c.startContainer.textContent.length)}const s=this.$.selection.getNode(),r=this.$.format.getLine(s,null),l=this.$.format.getBlock(s,null);if(!r&&!u.check.isNonEditable(t)&&!u.check.isList(l)){const c=this.$.selection.getRange();if(this.$.format.getLine(c.startContainer)===this.$.format.getLine(c.endContainer))if(u.check.isList(l)){e.preventDefault();const d=s.nextElementSibling,h=u.utils.createElement("LI",null,s);l.insertBefore(h,d),this.$.focusManager.focus()}else!u.check.isWysiwygFrame(s)&&!this.$.component.is(s)&&(!u.check.isTableElements(s)||u.check.isTableCell(s))&&this._setDefaultLine(this.$.format.isBlock(l)?"DIV":this.$.options.get("defaultLine"))!==null&&(e.preventDefault(),this.$.focusManager.focus())}this.$.commandDispatcher._copyFormat(),(this.$.store.mode.isBalloon||this.$.store.mode.isSubBalloon)&&ap.setTimeout(this._toggleToolbarBalloon.bind(this),0)}function rL(i,e){if(i.get("isReadOnly")||i.get("isDisabled"))return!1;let t=Av.get(i);t||(t={rafId:null,event:null},Av.set(i,t)),t.event=e,t.rafId===null&&(t.rafId=ap.requestAnimationFrame(()=>{var r;const o=t.event;if(t.rafId=null,t.event=null,!o)return;const s=u.query.getEventTarget(o);ye.get("__overInfo")!==!1&&!this.$.ui.selectMenuOn&&this.$.component.hoverSelect(s),(r=this.$.ui.blockHandle)==null||r.positionForTarget(s,o.clientY),this._callPluginEvent("onMouseMove",{frameContext:i,event:o})}))}async function aL(i,e){var t;(t=this.$.ui.blockHandle)==null||t.hide(e),await this.$.eventManager.triggerEvent("onMouseLeave",{frameContext:i,event:e})!==!1&&await this._callPluginEventAsync("onMouseLeave",{frameContext:i,event:e})}const lL={"event.prevent":({ctx:i})=>i.e.preventDefault(),"event.stop":({ctx:i})=>i.e.stopPropagation(),"event.prevent.stop":({ctx:i})=>{i.e.preventDefault(),i.e.stopPropagation()},"cache.styleNode":({ports:i})=>i.styleNodeCache(),"cache.formatAttrsTemp":({ports:i},{attrs:e})=>i.formatAttrsTempCache(e),"focusManager.nativeFocus":({ports:i})=>i.focusManager.nativeFocus(),"history.push":({ports:i},e)=>i.history.push(e),"documentType.refreshHeader":({ctx:i})=>{pe.setTimeout(()=>{i.fc.get("documentType").reHeader()},0)},"component.deselect":({ports:i})=>i.component.deselect(),"selection.setRange":({ports:i},{sc:e,so:t,ec:o,eo:s})=>i.selection.setRange(e,t,o,s),"format.removeBlock":({ports:i},{rangeEl:e,selectedFormats:t,newBlockElement:o,shouldDelete:s,skipHistory:r})=>i.format.removeBlock(e,{selectedFormats:t,newBlockElement:o,shouldDelete:s,skipHistory:r}),"dom.utils.removeItem":(i,{item:e})=>u.utils.removeItem(e),"select.component.fallback":({ports:i},{cmponentInfo:e})=>{i.component.select(e.target,e.pluginName)===!1&&i.focusManager.blur()}},cL={"del.format.removeAndMove":({ports:i},{container:e,formatEl:t})=>{const o=i.html.remove();if(o.commonCon!==o.container&&t.parentElement)if(t.contains(e)){const s=dL(t);i.selection.setRange(s,s.textContent.length,s,s.textContent.length)}else{const{focusNode:s,focusOffset:r}=hL(t);i.selection.setRange(s,r,s,r)}},"backspace.brline.strip":({ctx:i,ports:e},{formatEl:t})=>{const o=i.options.get("defaultLine"),s=t.parentNode,r=u.utils.createElement(o);for(;t.firstChild&&!u.check.isBreak(t.firstChild);)r.appendChild(t.firstChild);t.firstChild&&u.check.isBreak(t.firstChild)&&t.removeChild(t.firstChild),r.firstChild||(r.innerHTML="<br>"),s.insertBefore(r,t),(!t.firstChild||!t.textContent.trim()&&!t.querySelector("br"))&&s.removeChild(t);const l=r.firstChild;e.selection.setRange(l,0,l,0)},"backspace.format.maintain":({ctx:i},{formatEl:e})=>{if(e.nodeName.toUpperCase()===i.options.get("defaultLine").toUpperCase()){e.innerHTML="<br>";const t=e.attributes;for(;t[0];)e.removeAttribute(t[0].name)}else e.parentNode.replaceChild(u.utils.createElement(i.options.get("defaultLine"),null,"<br>"),e)},"backspace.component.select":({ports:i},{selectionNode:e,range:t,fileComponentInfo:o})=>{var r;let s=null;u.check.isBreak(e)?u.utils.removeItem(e):u.check.isBreak(s=(r=t.startContainer.childNodes)==null?void 0:r[t.startOffset])&&u.utils.removeItem(s),i.component.select(o.target,o.pluginName)===!1&&i.focusManager.blur()},"backspace.component.remove":({ports:i},{isList:e,sel:t,formatEl:o,fileComponentInfo:s})=>{e&&u.utils.removeItem(t),o.textContent.length===0&&u.utils.removeItem(o),i.component.select(s.target,s.pluginName)===!1&&i.focusManager.blur()},"backspace.list.mergePrev":({ports:i},{prev:e,formatEl:t,rangeEl:o})=>{let s=e===o.parentNode?o.previousSibling:e.lastChild;s||(s=u.utils.createTextNode(De.zeroWidthSpace),o.parentNode.insertBefore(s,o.parentNode.firstChild));const r=s.nodeType===3?s.textContent.length:1,l=t.childNodes;let c=s,d=l[0];for(;d=l[0];)e.insertBefore(d,c.nextSibling),c=d;u.utils.removeItem(t),o.children.length===0&&u.utils.removeItem(o),i.selection.setRange(s,r,s,r)},"backspace.list.removeNested":({ports:i},{range:e})=>{i.html.remove(),e.startContainer.nodeType===3&&i.selection.setRange(e.startContainer,e.startContainer.textContent.length,e.startContainer,e.startContainer.textContent.length)},"backspace.emptyLine.mergePrev":({ports:i},{formatEl:e,prev:t})=>{u.utils.removeItem(e),Nv(i,t,!0)},"backspace.brline.rowMerge":({ports:i},{rowEndBr:e,rowStartBr:t})=>{const o=t.nextSibling;o!==e&&(o==null?void 0:o.nodeType)===3&&u.check.isZeroWidth(o)&&u.utils.removeItem(o);const s=t.previousSibling;if(u.utils.removeItem(t),s&&s.nodeType===3)i.selection.setRange(s,s.textContent.length,s,s.textContent.length);else if(u.check.isBreak(s))i.selection.setRange(e,0,e,0);else{const r=e.parentNode;i.selection.setRange(r,0,r,0)}},"backspace.softBreak.merge":({ports:i},{zws:e})=>{const t=e.previousSibling,o=e.parentNode,s=t==null?void 0:t.previousSibling;u.utils.removeItem(e),t&&u.utils.removeItem(t),s?Fg(i,s):o&&i.selection.setRange(o,0,o,0)},"delete.component.select":({ports:i},{formatEl:e,fileComponentInfo:t})=>{if(u.check.isListCell(e)){const o=t.container.previousSibling;u.check.isZeroWidth(o)&&u.utils.removeItem(o)}else u.check.isZeroWidth(e)&&u.utils.removeItem(e);i.component.select(t.target,t.pluginName)===!1&&i.focusManager.blur()},"delete.component.selectNext":({ports:i,ctx:e},{formatEl:t,nextEl:o})=>{if(u.check.isZeroWidth(t)&&(u.utils.removeItem(t),u.check.isTable(o))){let r=u.query.getEdgeChild(o,u.check.isTableCell,!1);r=r.firstElementChild||r,i.selection.setRange(r,0,r,0);return}const s=i.component.get(o);s?(e.e.stopPropagation(),i.component.select(s.target,s.pluginName)===!1&&i.focusManager.blur()):i.component.is(o)&&(e.e.stopPropagation(),u.utils.removeItem(o))},"delete.list.removeNested":({ports:i,ctx:e},{range:t,formatEl:o,rangeEl:s})=>{t.startContainer!==t.endContainer&&i.html.remove();const r=u.utils.arrayFind(o.children,u.check.isList)||o.nextElementSibling||s.parentElement.nextElementSibling;if(r&&(u.check.isList(r)||u.utils.arrayFind(r.children,u.check.isList))){e.e.preventDefault();let l,c;if(u.check.isList(r)){const d=r.firstElementChild;for(c=d.childNodes,l=c[0];c[0];)o.insertBefore(c[0],r);u.utils.removeItem(d)}else{for(l=r.firstChild,c=r.childNodes;c[0];)o.appendChild(c[0]);u.utils.removeItem(r)}i.selection.setRange(l,0,l,0),i.history.push(!0)}},"delete.emptyLine.mergeNext":({ports:i},{formatEl:e,next:t})=>{u.utils.removeItem(e),Nv(i,t,!1)},"line.merge":({ports:i},{into:e,from:t})=>{const o=i.format,s=t.parentElement;Lv(e);const r=e.lastChild;for(Lv(t);t.firstChild;)e.appendChild(t.firstChild);u.utils.removeItem(t);let l=s;for(;l&&l!==e.parentElement&&o.isBlock(l)&&!o.isClosureBlock(l)&&u.check.isZeroWidth(l);){const c=l.parentElement;u.utils.removeItem(l),l=c}e.firstChild||e.appendChild(u.utils.createElement("BR")),r?Fg(i,r):i.selection.setRange(e,0,e,0)},"delete.brline.rowMerge":({ports:i},{rowEndBr:e})=>{let t=e.nextSibling;(t==null?void 0:t.nodeType)===3&&u.check.isZeroWidth(t)&&(t=t.nextSibling);const o=e.parentNode;u.utils.removeItem(e),t&&(t.nodeType===3||u.check.isBreak(t))?i.selection.setRange(t,0,t,0):i.selection.setRange(o,o.childNodes.length,o,o.childNodes.length)},"delete.softBreak.merge":({ports:i},{br:e})=>{const t=e.previousSibling,o=e.parentNode,s=e.nextSibling;s&&s.nodeType===3&&u.check.isZeroWidth(s.textContent)&&u.utils.removeItem(s),u.utils.removeItem(e),t?Fg(i,t):o&&i.selection.setRange(o,0,o,0)},"tab.format.indent":({ports:i,ctx:e},{range:t,formatEl:o,shift:s})=>{const r=i.format.getLines(null),l=[],c=[],d=u.check.isListCell(r[0]),h=u.check.isListCell(r.at(-1));let p={sc:t.startContainer,so:t.startOffset,ec:t.endContainer,eo:t.endOffset};for(let f=0,m=r.length,g;f<m;f++)if(g=r[f],u.check.isListCell(g)){if(!g.previousElementSibling&&!s)continue;l.push(g)}else c.push(g);if(l.length>0&&(p=i.listFormat.applyNested(l,s)),c.length>0)if(s){const f=c.length-1;for(let v=0,b;v<=f;v++){b=c[v].childNodes;for(let y=0,C=b.length,k;y<C&&(k=b[y],!!k);y++)if(!u.check.isZeroWidth(k)){/^\s{1,4}$/.test(k.textContent)?u.utils.removeItem(k):/^\s{1,4}/.test(k.textContent)&&(k.textContent=k.textContent.replace(/^\s{1,4}/,""));break}}const m=u.query.getEdgeChild(c[0],"text",!1),g=u.query.getEdgeChild(c[f],"text",!0);!d&&m&&(p.sc=m,p.so=0),!h&&g&&(p.ec=g,p.eo=g.textContent.length)}else if(c.length===1){let f=e.store.get("tabSize")+1;if(e.options.get("syncTabIndent")){const g=u.query.findTextIndexOnLine(o,t.startContainer,t.startOffset,b=>i.component.is(b)),v=i.format.isLine(o.previousElementSibling)?u.query.findTabEndIndex(o.previousElementSibling,g,2):0;v>g&&(f=v-g)}const m=u.utils.createTextNode(new Array(f).join(" "));if(!i.html.insertNode(m,{afterNode:null,skipCharCount:!1}))return!1;d||(p.sc=m,p.so=m.length),h||(p.ec=m,p.eo=m.length)}else{const f=u.utils.createTextNode(new Array(e.store.get("tabSize")+1).join(" ")),m=c.length-1;for(let b=0,y;b<=m;b++)y=c[b].firstChild,y&&(u.check.isBreak(y)?c[b].insertBefore(f.cloneNode(!1),y):y.textContent=f.textContent+y.textContent);const g=u.query.getEdgeChild(c[0],"text",!1),v=u.query.getEdgeChild(c[m],"text",!0);!d&&g&&(p.sc=g,p.so=0),!h&&v&&(p.ec=v,p.eo=v.textContent.length)}i.selection.setRange(p.sc,p.so,p.ec,p.eo)},"caret.scrollTo":({ports:i},{range:e})=>{i.caretScrollTo(e)},"enter.line.addDefault":({ports:i},{formatEl:e})=>{const o=i.format.addLineAfter(e).firstChild;i.selection.setRange(o,0,o,0)},"enter.list.addItem":({ports:i},{formatEl:e,selectionNode:t})=>{const o=u.utils.createElement("BR"),s=u.utils.createElement("LI",null,o);e.parentNode.insertBefore(s,e.nextElementSibling),s.appendChild(t.nextSibling),i.selection.setRange(o,1,o,1)},"enter.format.exitEmpty":({ports:i,ctx:e},{formatEl:t,rangeEl:o})=>{let s=null;if(u.check.isListCell(o.parentElement)){const r=t.parentNode.parentElement;o=r.parentElement;const l=u.utils.createElement("LI");l.innerHTML="<br>",u.utils.copyTagAttributes(l,t,e.options.get("lineAttrReset")),s=l,o.insertBefore(s,r.nextElementSibling)}else{let r;u.check.isTableCell(o.parentElement)?r="DIV":u.check.isList(o.parentElement)?r="LI":i.format.isLine(o.nextElementSibling)?r=o.nextElementSibling.nodeName:i.format.isLine(o.previousElementSibling)?r=o.previousElementSibling.nodeName:r=e.options.get("defaultLine"),s=u.utils.createElement(r);const l=i.format.removeBlock(o,{selectedFormats:[t],newBlockElement:null,shouldDelete:!0,skipHistory:!0});l.cc.insertBefore(s,l.sc?l.sc.nextSibling:l.cc.firstChild)}s.innerHTML="<br>",i.nodeTransform.removeAllParents(t,null,null),i.selection.setRange(s,1,s,1)},"enter.format.cleanBrAndZWS":({ports:i},{selectionNode:e,selectionFormat:t,brBlock:o,children:s,offset:r})=>{t?u.utils.removeItem(s[r-1]):u.utils.removeItem(e);const l=o.nextElementSibling,c=i.format.addLine(o,i.format.isLine(l)?l:null);u.utils.copyFormatAttributes(c,o),i.selection.setRange(c,1,c,1)},"enter.format.insertBrHtml":({ports:i},{brBlock:e,range:t,wSelection:o,offset:s})=>{i.html.insert(t.collapsed&&u.check.isBreak(t.startContainer.childNodes[t.startOffset-1])?"<br>":"<br><br>",{selectInserted:!1,skipCharCount:!0,skipCleaning:!0});let r=o.focusNode;const l=o.focusOffset;e===r&&(r=r.childNodes[l-s>1?l-1:l]),i.selection.setRange(r,1,r,1),i.setOnShortcutKey(!0)},"enter.brline.insert":({ports:i},{range:e})=>{i.selection.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset),e.collapsed||i.html.remove();const t=u.utils.createElement("BR");i.html.insertNode(t,{afterNode:null,skipCharCount:!0}),t.nextSibling||t.parentNode.appendChild(u.utils.createElement("BR"));const o=t.nextSibling;i.selection.setRange(o,0,o,0),i.setOnShortcutKey(!0)},"enter.shift.br":({ports:i,ctx:e},{range:t})=>{const o=e.fc.get("_wd"),s=i.selection.get(),l=(s==null?void 0:s.rangeCount)>0&&e.fc.get("wysiwyg").contains(s.focusNode)?s.getRangeAt(0):t,c=o.createRange();if(c.setStart(l.startContainer,l.startOffset),c.setEnd(l.endContainer,l.endOffset),l.collapsed||(c.deleteContents(),c.collapse(!0)),c.startContainer.nodeType===1&&u.check.isBreak(c.startContainer)){const p=c.startContainer;c.setStart(p.parentNode,u.utils.getArrayIndex(p.parentNode.childNodes,p)+c.startOffset),c.collapse(!0)}const d=u.utils.createElement("BR");c.insertNode(d);const h=d.nextSibling;if(h&&h.nodeType===3&&!u.check.isZeroWidth(h.textContent))i.selection.setRange(h,0,h,0);else{const p=u.utils.createTextNode(De.zeroWidthSpace);d.parentNode.insertBefore(p,d.nextSibling),i.selection.setRange(p,1,p,1)}i.history.push(!1)},"enter.brline.exit":({ports:i},{brBlock:e})=>{const t=e.lastChild;t&&(u.check.isBreak(t)||u.check.isZeroWidth(t.textContent))&&u.utils.removeItem(t);const o=e.nextElementSibling,s=i.format.addLine(e,i.format.isLine(o)?o:null);u.utils.copyFormatAttributes(s,e),i.selection.setRange(s,1,s,1)},"enter.format.insertBrNode":({ports:i},{wSelection:e})=>{const t=e.focusNode.nextSibling,o=u.utils.createElement("BR");i.html.insertNode(o,{afterNode:null,skipCharCount:!0});const s=o.previousSibling,r=o.nextSibling;!u.check.isBreak(t)&&!u.check.isBreak(s)&&(!r||u.check.isZeroWidth(r))?(o.parentNode.insertBefore(o.cloneNode(!1),o),i.selection.setRange(o,1,o,1)):i.selection.setRange(r,0,r,0),i.setOnShortcutKey(!0)},"enter.format.breakAtEdge":({ports:i,ctx:e},{formatEl:t,selectionNode:o,formatStartEdge:s,formatEndEdge:r,bidiSwapped:l})=>{const c=u.utils.createElement("BR"),d=u.utils.createElement(t.nodeName,null,c);u.utils.copyTagAttributes(d,t,e.options.get("lineAttrReset"));let h=c;if(!(r&&e.options.get("lineBreakClearStyle"))){let p=o;do{if(!u.check.isBreak(p)&&p.nodeType===1){const f=p.cloneNode(!1);f.appendChild(h),h=f}p=p.parentElement}while(t!==p&&t.contains(p))}if(d.appendChild(h),t.parentNode.insertBefore(d,s&&!r?t:t.nextElementSibling),r)i.selection.setRange(c,1,c,1);else if(l)i.selection.setRange(t,1,t,1);else{const p=t.firstChild||t;i.selection.setRange(p,0,p,0)}},"enter.format.breakWithSelection":({ports:i,ctx:e},{formatEl:t,range:o,formatStartEdge:s,formatEndEdge:r})=>{const l=i.format.getLine(o.startContainer,null)!==i.format.getLine(o.endContainer,null),c=t.cloneNode(!1);c.innerHTML="<br>";const d=o.commonAncestorContainer,h=d===o.startContainer&&d===o.endContainer&&u.check.isZeroWidth(d)?{container:d,offset:o.endOffset,prevContainer:d.previousElementSibling,commonCon:d}:i.html.remove();let p=i.format.getLine(h.container,null),f=0;if(!p){u.check.isWysiwygFrame(h.container)&&(i.enterPrevent(e.e),e.fc.get("wysiwyg").appendChild(c),p=c,u.utils.copyTagAttributes(p,t,e.options.get("lineAttrReset")),i.selection.setRange(p,f,p,f));return}const m=i.format.getBlock(h.container);p=p.contains(m)?u.query.getEdgeChild(m,g=>!!i.format.getLine(g),!1):p,l?r&&!s?(p.parentNode.insertBefore(c,!h.prevContainer||h.container===h.prevContainer?p.nextElementSibling:p),p=c,f=0):(f=h.offset,s&&(p.parentNode.insertBefore(c,p),r&&(f=0))):r&&s?(p.parentNode.insertBefore(c,p),f=0):r?(p=p.parentNode.insertBefore(c,p.nextElementSibling),p=c,f=0):p=i.nodeTransform.split(h.container,h.offset,u.query.getNodeDepth(t)),i.enterPrevent(e.e),u.utils.copyTagAttributes(p,t,e.options.get("lineAttrReset")),i.selection.setRange(p,f,p,f)},"enter.format.breakAtCursor":({ports:i,ctx:e},{formatEl:t,range:o})=>{let s=null;u.check.isZeroWidth(t)?s=i.format.addLine(t,t.cloneNode(!1)):s=i.nodeTransform.split(o.endContainer,o.endOffset,u.query.getNodeDepth(t)),i.enterPrevent(e.e),u.utils.copyTagAttributes(s,t,e.options.get("lineAttrReset")),i.selection.setRange(s,0,s,0)},"enter.figcaption.exitInList":({ports:i},{formatEl:e})=>{const t=i.format.addLine(e,null);i.selection.setRange(t,0,t,0)},"keydown.input.insertNbsp":({ports:i})=>{const e=i.html.insertNode(u.utils.createTextNode(" "),{afterNode:null,skipCharCount:!0});e&&i.selection.setRange(e,e.length,e,e.length)},"keydown.input.insertZWS":({ports:i})=>{const e=u.utils.createTextNode(De.zeroWidthSpace);i.html.insertNode(e,{afterNode:null,skipCharCount:!0}),i.selection.setRange(e,1,e,1)}};function Nv(i,e,t){const o=t?e.childNodes.length:0;i.selection.setRange(e,o,e,o)}function Fg(i,e){const t=e.nodeType===3?e.textContent.length:e.childNodes.length;i.selection.setRange(e,t,e,t)}function Lv(i){let e=i.lastChild;for(;e&&(u.check.isBreak(e)||e.nodeType===3&&u.check.isZeroWidth(e));){const t=e.previousSibling;u.utils.removeItem(e),e=t}}function dL(i){const e=i.lastChild,t=i.nextElementSibling;if(!t)return e;if(u.check.isZeroWidth(t))return u.utils.removeItem(t),e;const o=t.childNodes;for(;o[0];)i.appendChild(o[0]);return u.utils.removeItem(t),e}function hL(i){var r;const e=i.childNodes,t=i.previousElementSibling;let o=e[0],s=0;if(!t)return{focusNode:o,focusOffset:s};if(u.check.isZeroWidth(t))return u.utils.removeItem(t),{focusNode:o,focusOffset:s};if(e.length>1||((r=e[0])==null?void 0:r.textContent.length)>0)for(;e[0];)t.appendChild(e[0]);else o=t.lastChild,s=o.textContent.length;return u.utils.removeItem(i),{focusNode:o,focusOffset:s}}const uL="action.stop";async function Iv(i,e){const t={...lL,...cL};for(const o of i){if(o.t===uL)return!1;const s=t[o.t];if(s&&await s(e,o.p)===!1)return!1}}function $v(i){var p;const e=i.selection.getRange(),t=e.startContainer,o=e.endContainer,s=i.format.getBlock(t),r=i.format.getBlock(o),l=u.check.isTableCell(s),c=u.check.isTableCell(r);if((l&&!s.previousElementSibling&&!s.parentElement.previousElementSibling||c&&!r.nextElementSibling&&!r.parentElement.nextElementSibling)&&s!==r){const f=((p=u.query.getParentElement(e.commonAncestorContainer,u.check.isFigure))==null?void 0:p.parentElement)||e.commonAncestorContainer;if(!l)u.utils.removeItem(u.query.getParentElement(r,m=>f===m.parentNode));else if(!c)u.utils.removeItem(u.query.getParentElement(s,m=>f===m.parentNode));else return u.utils.removeItem(u.query.getParentElement(s,m=>f===m.parentNode)),i.focusManager.nativeFocus(),!0}const d=t.nodeType===1?u.query.getParentElement(t,".se-component"):null,h=o.nodeType===1?u.query.getParentElement(o,".se-component"):null;return d&&u.utils.removeItem(d),h&&u.utils.removeItem(h),!1}function pL(i,e,t){let o=e.parentNode.previousSibling;const s=e.parentNode.nextSibling;o||(s?o=s:(o=u.utils.createElement("BR"),t.appendChild(o)));let r=e;for(;t.contains(r)&&!r.previousSibling;)r=r.parentNode;if(!t.contains(r))return e.textContent="",i.nodeTransform.removeAllParents(e,null,t),!0}function lp(i,e,t){const o=t?e.startContainer:e.endContainer,s=t?e.startOffset:e.endOffset,r=t?"previousSibling":"nextSibling",l=o.nodeType===1;let c;return l?(c=Ov(i,o.childNodes[s],r,o),u.check.isComponentContainer(c)||u.check.isNonEditable(c)?c:null):(c=Ov(i,o,r,o),u.check.isEdgePoint(o,s,t?"front":"end")&&(u.check.isComponentContainer(c)||u.check.isNonEditable(c))?c:null)}function Ov(i,e,t,o){if(!e)return null;let s=e[t];if(!s)if(s=i.format.getLine(o),s=s?s[t]:null,s&&!i.component.is(s))s=t==="previousSibling"?s.firstChild:s.lastChild;else return null;return s}function fL(i,e){return i.setDefaultLine(e)}function yc(i,e,t,o){if(!i.collapsed||!e)return!1;const s=i.getBoundingClientRect();if(s.height<=0)return!1;const r=o.createRange();r.selectNodeContents(e);const l=r.getBoundingClientRect();return l.width<=2?!1:t==="front"?s.left<=l.left+2:s.left>=l.right-2}const G={prevent:()=>({t:"event.prevent"}),stop:()=>({t:"event.stop"}),preventStop:()=>({t:"event.prevent.stop"}),cacheStyleNode:()=>({t:"cache.styleNode"}),cacheFormatAttrsTemp:i=>({t:"cache.formatAttrsTemp",p:{attrs:i}}),componentDeselect:()=>({t:"component.deselect"}),editorNativeFocus:()=>({t:"focusManager.nativeFocus"}),historyPush:i=>({t:"history.push",p:i}),documentTypeRefreshHeader:()=>({t:"documentType.refreshHeader"}),selectionSetRange:(i,e,t,o)=>({t:"selection.setRange",p:{sc:i,so:e,ec:t,eo:o}}),formatRemoveBlock:(i,e,t,o,s)=>({t:"format.removeBlock",p:{rangeEl:i,selectedFormats:e,newBlockElement:t,shouldDelete:o,skipHistory:s}}),domUtilsRemoveItem:i=>({t:"dom.utils.removeItem",p:{item:i}}),selectComponentFallback:i=>({t:"select.component.fallback",p:{cmponentInfo:i}}),delFormatRemoveAndMove:(i,e)=>({t:"del.format.removeAndMove",p:{container:i,formatEl:e}}),backspaceFormatMaintain:i=>({t:"backspace.format.maintain",p:{formatEl:i}}),backspaceBrLineStrip:i=>({t:"backspace.brline.strip",p:{formatEl:i}}),backspaceComponentSelect:(i,e,t)=>({t:"backspace.component.select",p:{selectionNode:i,range:e,fileComponentInfo:t}}),backspaceComponentRemove:(i,e,t,o)=>({t:"backspace.component.remove",p:{isList:i,sel:e,formatEl:t,fileComponentInfo:o}}),backspaceListMergePrev:(i,e,t)=>({t:"backspace.list.mergePrev",p:{prev:i,formatEl:e,rangeEl:t}}),backspaceListRemoveNested:i=>({t:"backspace.list.removeNested",p:{range:i}}),backspaceEmptyLineMergePrev:(i,e)=>({t:"backspace.emptyLine.mergePrev",p:{formatEl:i,prev:e}}),backspaceBrLineRowMerge:(i,e)=>({t:"backspace.brline.rowMerge",p:{rowEndBr:i,rowStartBr:e}}),backspaceSoftBreakMerge:i=>({t:"backspace.softBreak.merge",p:{zws:i}}),deleteComponentSelect:(i,e)=>({t:"delete.component.select",p:{formatEl:i,fileComponentInfo:e}}),deleteComponentSelectNext:(i,e)=>({t:"delete.component.selectNext",p:{formatEl:i,nextEl:e}}),deleteListRemoveNested:(i,e,t)=>({t:"delete.list.removeNested",p:{range:i,formatEl:e,rangeEl:t}}),deleteEmptyLineMergeNext:(i,e)=>({t:"delete.emptyLine.mergeNext",p:{formatEl:i,next:e}}),deleteBrLineRowMerge:i=>({t:"delete.brline.rowMerge",p:{rowEndBr:i}}),deleteSoftBreakMerge:i=>({t:"delete.softBreak.merge",p:{br:i}}),mergeLineInto:(i,e)=>({t:"line.merge",p:{into:i,from:e}}),tabFormatIndent:(i,e,t)=>({t:"tab.format.indent",p:{range:i,formatEl:e,shift:t}}),caretScrollTo:i=>({t:"caret.scrollTo",p:{range:i}}),enterLineAddDefault:i=>({t:"enter.line.addDefault",p:{formatEl:i}}),enterListAddItem:(i,e)=>({t:"enter.list.addItem",p:{formatEl:i,selectionNode:e}}),enterFormatExitEmpty:(i,e)=>({t:"enter.format.exitEmpty",p:{formatEl:i,rangeEl:e}}),enterFormatCleanBrAndZWS:(i,e,t,o,s)=>({t:"enter.format.cleanBrAndZWS",p:{selectionNode:i,selectionFormat:e,brBlock:t,children:o,offset:s}}),enterFormatInsertBrHtml:(i,e,t,o)=>({t:"enter.format.insertBrHtml",p:{brBlock:i,range:e,wSelection:t,offset:o}}),enterFormatInsertBrNode:i=>({t:"enter.format.insertBrNode",p:{wSelection:i}}),enterBrLineInsert:i=>({t:"enter.brline.insert",p:{range:i}}),enterShiftBr:i=>({t:"enter.shift.br",p:{range:i}}),enterBrLineExit:i=>({t:"enter.brline.exit",p:{brBlock:i}}),enterFormatBreakAtEdge:(i,e,t,o,s)=>({t:"enter.format.breakAtEdge",p:{formatEl:i,selectionNode:e,formatStartEdge:t,formatEndEdge:o,bidiSwapped:s}}),enterFormatBreakWithSelection:(i,e,t,o)=>({t:"enter.format.breakWithSelection",p:{formatEl:i,range:e,formatStartEdge:t,formatEndEdge:o}}),enterFormatBreakAtCursor:(i,e)=>({t:"enter.format.breakAtCursor",p:{formatEl:i,range:e}}),enterFigcaptionExitInList:i=>({t:"enter.figcaption.exitInList",p:{formatEl:i}}),keydownInputInsertNbsp:()=>({t:"keydown.input.insertNbsp"}),keydownInputInsertZWS:()=>({t:"keydown.input.insertZWS"})};function mL(i,e,t){const{format:o,component:s}=e,{fc:r,options:l,range:c,selectionNode:d}=t;let{formatEl:h}=t;const p=!c.collapsed||c.startContainer!==c.endContainer,f=l.get("_rtl")&&!p&&c.startOffset===0&&yc(c,h,"front",r.get("_wd"));if(i.push(G.componentDeselect()),i.push(G.cacheStyleNode()),p&&$v(e))return i.push(G.preventStop()),i.push(G.caretScrollTo(c)),!0;if(!o.isNormalLine(h)&&!o.isBrLine(h)&&!r.get("wysiwyg").firstElementChild&&!s.is(d)&&fL(e,l.get("defaultLine"))!==null)return i.push(G.preventStop()),!1;if(o.isLine(h)&&p&&u.check.isEdgePoint(c.startContainer,c.startOffset,"front")&&(!c.startContainer.previousSibling||u.check.isZeroWidth(c.startContainer.previousSibling))&&o.getLine(c.startContainer)!==o.getLine(c.endContainer)&&(o.isLine(h.previousElementSibling)||u.check.isListCell(h)))return i.push(G.preventStop()),i.push(G.delFormatRemoveAndMove(c.startContainer,h)),i.push(G.historyPush(!0)),i.push(G.caretScrollTo(c)),!1;if(!p&&!f&&h&&o.isNormalLine(h)&&!u.check.isListCell(h)&&o.isEdgeLine(c.startContainer,c.startOffset,"front")){const y=gL(o,h);if(y)return i.push(G.preventStop()),i.push(G.mergeLineInto(y,h)),i.push(G.historyPush(!0)),!1}if(!p&&!f&&!h.previousElementSibling&&c.startOffset===0&&!d.previousSibling&&!u.check.isListCell(h)&&o.isLine(h)&&(!o.isBrLine(h)||o.isClosureBrLine(h)||u.check.isWysiwygFrame(h.parentNode)))return o.isClosureBlock(h.parentNode)?(i.push(G.preventStop()),!1):o.isBrLine(h)&&u.check.isWysiwygFrame(h.parentNode)?(i.push(G.preventStop()),i.push(G.backspaceBrLineStrip(h)),i.push(G.historyPush(!0)),!1):(u.check.isWysiwygFrame(h.parentNode)&&h.childNodes.length<=1&&(!h.firstChild||u.check.isZeroWidth(h.textContent))&&(i.push(G.preventStop()),i.push(G.backspaceFormatMaintain(h))),i.push(G.editorNativeFocus()),i.push(G.caretScrollTo(c)),!1);const m=c.startContainer;if(h&&!f&&!h.previousElementSibling&&c.startOffset===0&&m.nodeType===3&&u.check.isZeroWidth(m)&&pL(e,m,h)===!0)return!0;if(!p&&h&&(c.startOffset===0||d===h)){const y=d===h?lp(e,c,!0):u.check.isElement(d.previousSibling)?d.previousSibling:u.check.isEdgePoint(c.startContainer,c.startOffset)?u.query.getPreviousDeepestNode(c.startContainer):null;if(s.is(y)){const C=s.get(y);if(C)return i.push(G.preventStop()),i.push(G.backspaceComponentSelect(d,c,C)),!0}}if(lp(e,c,!0))return i.push(G.preventStop()),!0;!p&&!f&&o.isEdgeLine(c.startContainer,c.startOffset,"front")&&o.isLine(h.previousElementSibling)&&i.push(G.cacheFormatAttrsTemp(h.previousElementSibling.attributes)),h=o.getLine(c.startContainer,null);const g=o.getBlock(h,null),v=c.commonAncestorContainer;if(g&&h&&!u.check.isTableCell(g)&&!/^FIGCAPTION$/i.test(g.nodeName)){if(u.check.isListCell(h)&&u.check.isList(g)&&(u.check.isListCell(g.parentElement)||h.previousElementSibling)&&(d===h||d.nodeType===3&&(!d.previousSibling||u.check.isList(d.previousSibling)))&&(o.getLine(c.startContainer,null)!==o.getLine(c.endContainer,null)?g.contains(c.startContainer):c.startOffset===0&&c.collapsed&&!f)){if(c.startContainer!==c.endContainer)i.push(G.prevent()),i.push(G.backspaceListRemoveNested(c)),i.push(G.historyPush(!0));else{let y=h.previousElementSibling||g.parentElement;if(u.check.isListCell(y)){i.push(G.prevent());let C=y;if(!y.contains(h)&&u.check.isListCell(C)&&u.check.isList(C.lastElementChild)){for(C=C.lastElementChild.lastElementChild;u.check.isListCell(C)&&u.check.isList(C.lastElementChild);)C=C.lastElementChild&&C.lastElementChild.lastElementChild;y=C}i.push(G.backspaceListMergePrev(y,h,g)),i.push(G.historyPush(!0))}}return i.push(G.caretScrollTo(c)),!0}if(!p&&c.startOffset===0&&!f){let y=!0,C=v;for(;C&&C!==g&&!u.check.isWysiwygFrame(C);){if(C.previousSibling&&(C.previousSibling.nodeType===1||!u.check.isZeroWidth(C.previousSibling.textContent.trim()))){y=!1;break}C=C.parentNode}if(y&&g.parentNode)return i.push(G.prevent()),i.push(G.formatRemoveBlock(g,u.check.isListCell(h)?[h]:null,null,!1,!1)),i.push(G.historyPush(!0)),i.push(G.caretScrollTo(c)),!0}}if(!p&&h&&u.check.isEmptyLine(h)&&s.is(h.previousElementSibling)){const y=s.get(h.previousElementSibling);if(y)return i.push(G.preventStop()),i.push(G.backspaceComponentRemove(!1,h.firstChild,h,y)),i.push(G.caretScrollTo(c)),!0}if(!p&&h&&(c.startOffset===0||d===h&&h.childNodes[c.startOffset])){const y=u.check.isListCell(h),C=d===h?h.childNodes[c.startOffset]:d,k=(y?C:h).previousSibling,_=y||(v.nodeType===3||u.check.isBreak(v))&&!v.previousSibling&&c.startOffset===0;if(C&&(y||!C.previousSibling)&&(v&&s.is(v.previousSibling)||_&&s.is(k))){const S=s.get(k);return S?(i.push(G.preventStop()),i.push(G.backspaceComponentRemove(y,C,h,S))):s.is(k)&&(i.push(G.preventStop()),i.push(G.domUtilsRemoveItem(k))),i.push(G.caretScrollTo(c)),!0}if(C&&u.check.isNonEditable(C.previousSibling))return i.push(G.preventStop()),i.push(G.domUtilsRemoveItem(C.previousSibling)),i.push(G.caretScrollTo(c)),!0}if(!p&&o.isBrLine(h)&&u.check.isBreak(c.startContainer)&&c.startOffset===0){let y=c.startContainer.previousSibling;if((y==null?void 0:y.nodeType)===3&&u.check.isZeroWidth(y)&&(y=y.previousSibling),u.check.isBreak(y))return i.push(G.preventStop()),i.push(G.backspaceBrLineRowMerge(c.startContainer,y)),i.push(G.historyPush(!0)),i.push(G.caretScrollTo(c)),!1}if(!p&&c.startContainer.nodeType===3&&u.check.isZeroWidth(c.startContainer)&&c.startOffset<=1&&u.check.isBreak(c.startContainer.previousSibling))return i.push(G.preventStop()),i.push(G.backspaceSoftBreakMerge(c.startContainer)),i.push(G.historyPush(!0)),i.push(G.caretScrollTo(c)),!1;const b=h==null?void 0:h.previousElementSibling;return!p&&h&&o.isNormalLine(h)&&!u.check.isListCell(h)&&u.check.isEmptyLine(h)&&(o.isNormalLine(b)||o.isBrLine(b))?(i.push(G.preventStop()),i.push(G.backspaceEmptyLineMergePrev(h,b)),i.push(G.historyPush(!0)),i.push(G.caretScrollTo(c)),!1):(i.push(G.caretScrollTo(c)),!0)}function gL(i,e){let t=e.previousElementSibling;if(t){if(!i.isBlock(t))return null}else{const s=e.parentElement;if(!i.isBlock(s)||i.isClosureBlock(s)||(t=s.previousElementSibling,!t))return null}let o=t;for(;o&&i.isBlock(o)&&!i.isClosureBlock(o);)o=o.lastElementChild;return!i.isNormalLine(o)||u.check.isListCell(o)||i.isBrLine(o)||i.isClosureBrLine(o)?null:o}function bL(i,e,t){var g,v;const{format:o,component:s}=e,{fc:r,range:l,selectionNode:c}=t;let{formatEl:d}=t;const h=!l.collapsed||l.startContainer!==l.endContainer,p=t.options.get("_rtl")&&!h&&l.endOffset>=(((g=l.endContainer.textContent)==null?void 0:g.length)||0)&&yc(l,d,"end",r.get("_wd"));if(i.push(G.componentDeselect()),i.push(G.cacheStyleNode()),h&&$v(e))return i.push(G.preventStop()),!0;if(!h&&!p&&d&&o.isNormalLine(d)&&!u.check.isListCell(d)&&o.isEdgeLine(l.endContainer,l.endOffset,"end")){const b=vL(o,d);if(b)return i.push(G.preventStop()),i.push(G.mergeLineInto(d,b)),i.push(G.historyPush(!0)),!1}if(!h&&!p&&o.isEdgeLine(l.endContainer,l.endOffset,"end")&&!d.nextSibling)return i.push(G.preventStop()),!1;if(o.isLine(d)&&h&&u.check.isEdgePoint(l.endContainer,l.endOffset,"end")&&(!l.endContainer.nextSibling||u.check.isZeroWidth(l.endContainer.nextSibling))&&o.getLine(l.startContainer)!==o.getLine(l.endContainer)&&(o.isLine(d.nextElementSibling)||u.check.isListCell(d)))return i.push(G.preventStop()),i.push(G.delFormatRemoveAndMove(l.endContainer,d)),i.push(G.historyPush(!0)),!1;if(!h&&d&&(l.endOffset===l.endContainer.textContent.length||c===d)){const b=c===d?lp(e,l,!1):u.check.isElement(c.nextSibling)?c.nextSibling:u.check.isEdgePoint(l.endContainer,l.endOffset)?u.query.getNextDeepestNode(l.endContainer,null):null;if(s.is(b)){const y=s.get(b);if(y)return i.push(G.preventStop()),i.push(G.deleteComponentSelect(d,y)),!0}}if(lp(e,l,!1))return i.push(G.preventStop()),!0;if((o.isLine(c)||c.nextSibling===null||u.check.isZeroWidth(c.nextSibling)&&c.nextSibling.nextSibling===null)&&l.startOffset===c.textContent.length){const b=d.nextElementSibling;if(!b)return!0;if(s.is(b))return i.push(G.prevent()),i.push(G.deleteComponentSelectNext(d,b)),!0}if(!h&&(u.check.isEdgePoint(l.endContainer,l.endOffset)||c===d&&d.childNodes[l.startOffset])){const b=c===d&&d.childNodes[l.startOffset]||c;if(b&&u.check.isNonEditable(b.nextSibling))return i.push(G.preventStop()),i.push(G.domUtilsRemoveItem(b.nextSibling)),!0;if(s.is(b))return i.push(G.preventStop()),i.push(G.domUtilsRemoveItem(b)),!0}!h&&!p&&o.isEdgeLine(l.endContainer,l.endOffset,"end")&&o.isLine(d.nextElementSibling)&&i.push(G.cacheFormatAttrsTemp(d.attributes)),d=o.getLine(l.startContainer,null);const f=o.getBlock(d,null);if(u.check.isListCell(d)&&u.check.isList(f)&&(c===d||c.nodeType===3&&(!c.nextSibling||u.check.isList(c.nextSibling))&&(o.getLine(l.startContainer,null)!==o.getLine(l.endContainer,null)?f.contains(l.endContainer):l.endOffset===c.textContent.length&&l.collapsed&&!p)))return i.push(G.deleteListRemoveNested(l,d,f)),!0;if(!h&&o.isBrLine(d)&&u.check.isBreak(l.startContainer)&&l.startOffset===0){let b=l.startContainer.previousSibling;if((b==null?void 0:b.nodeType)===3&&u.check.isZeroWidth(b)&&(b=b.previousSibling),u.check.isBreak(b))return i.push(G.preventStop()),i.push(G.deleteBrLineRowMerge(l.startContainer)),i.push(G.historyPush(!0)),!1}if(!h){const b=l.startContainer;let y=null;if(b.nodeType===3&&l.startOffset>=b.textContent.length&&u.check.isBreak(b.nextSibling)){const C=b.nextSibling;((v=C.nextSibling)==null?void 0:v.nodeType)===3&&u.check.isZeroWidth(C.nextSibling.textContent)&&(y=C)}else b.nodeType===3&&u.check.isZeroWidth(b)&&l.startOffset===0&&u.check.isBreak(b.previousSibling)&&(y=b.previousSibling);if(y)return i.push(G.preventStop()),i.push(G.deleteSoftBreakMerge(y)),i.push(G.historyPush(!0)),!1}const m=d==null?void 0:d.nextElementSibling;return!h&&d&&o.isNormalLine(d)&&!u.check.isListCell(d)&&u.check.isEmptyLine(d)&&(o.isNormalLine(m)||o.isBrLine(m))?(i.push(G.preventStop()),i.push(G.deleteEmptyLineMergeNext(d,m)),i.push(G.historyPush(!0)),!1):!0}function vL(i,e){let t=e.nextElementSibling;if(t){if(!i.isBlock(t))return null}else{const s=e.parentElement;if(!i.isBlock(s)||i.isClosureBlock(s)||(t=s.nextElementSibling,!t))return null}let o=t;for(;o&&i.isBlock(o)&&!i.isClosureBlock(o);)o=o.firstElementChild;return!i.isNormalLine(o)||u.check.isListCell(o)||i.isBrLine(o)||i.isClosureBrLine(o)?null:o}function yL(i,e){const t=Array.from(i.childNodes),o=[[]];for(const p of t)u.check.isBreak(p)?o.push([]):o[o.length-1].push(p);t.length&&u.check.isBreak(t[t.length-1])&&o.pop();const s=p=>!p||p.every(f=>u.check.isZeroWidth(f.textContent)),r=e.anchorNode;let l=0;if(r===i)for(let p=0;p<e.anchorOffset&&p<t.length;p++)u.check.isBreak(t[p])&&l++;else for(const p of t){if(p===r||p.nodeType===1&&p.contains(r))break;u.check.isBreak(p)&&l++}const c=Math.max(o.length,1),d=Math.min(l,c-1);return{shouldExit:d===c-1&&s(o[d])&&d>=1&&s(o[d-1])}}function Dv(i,e,t){const{format:o,char:s,selection:r}=e,{frameOptions:l,range:c,formatEl:d,selectionNode:h,shift:p,e:f}=t,m=!c.collapsed||c.startContainer!==c.endContainer;i.push(G.componentDeselect());const g=o.getBrLine(h,null),v=o.getBlock(d,null);if(l.get("charCounter_type")==="byte-html"){let b="";if(!p&&g||p?b="<br>":b="<"+d.nodeName+"><br></"+d.nodeName+">",!s.check(b))return i.push(G.prevent()),!1}if(p)return e.enterPrevent(f),i.push(G.enterShiftBr(c)),i.push(G.caretScrollTo(c)),!0;if(!p){let b=o.isEdgeLine(c.endContainer,c.endOffset,"end"),y=o.isEdgeLine(c.startContainer,c.startOffset,"front"),C=!1;if(t.options.get("_rtl")&&d&&c.collapsed&&y!==b){const k=t.fc.get("_wd");y&&yc(c,d,"front",k)?(y=!1,b=!0,C=!0):b&&yc(c,d,"end",k)&&(b=!1,y=!0,C=!0)}if(b&&(/^H[1-6]$/i.test(d.nodeName)||/^HR$/i.test(d.nodeName)))return e.enterPrevent(f),i.push(G.enterLineAddDefault(d)),i.push(G.caretScrollTo(c)),!0;if(v&&d&&!u.check.isTableCell(v)&&!/^FIGCAPTION$/i.test(v.nodeName)){const k=r.getRange();if(u.check.isEdgePoint(k.endContainer,k.endOffset)&&u.check.isList(h.nextSibling))return e.enterPrevent(f),i.push(G.enterListAddItem(d,h)),i.push(G.caretScrollTo(c)),!0;if((k.commonAncestorContainer.nodeType!==3||!k.commonAncestorContainer.nextElementSibling)&&u.check.isZeroWidth(d.innerText.trim())&&!u.check.isListCell(d.nextElementSibling))return e.enterPrevent(f),i.push(G.enterFormatExitEmpty(d,v)),!0}if(g||v===d&&o.isClosureBlock(v)&&o.isLine(d)){if(e.enterPrevent(f),g&&!o.isClosureBrLine(g))return yL(g,r.get()).shouldExit?i.push(G.enterBrLineExit(g)):i.push(G.enterBrLineInsert(c)),i.push(G.caretScrollTo(c)),!0;const k=r.get();return h===g?i.push(G.enterFormatInsertBrHtml(g,c,k,k.focusOffset)):i.push(G.enterFormatInsertBrNode(k)),i.push(G.caretScrollTo(c)),!0}if(c.collapsed&&(y||b))return e.enterPrevent(f),i.push(G.enterFormatBreakAtEdge(d,h,y,b,C)),i.push(G.caretScrollTo(c)),!0;if(d){if(i.push(G.prevent()),m){if(t.options.get("_rtl")&&y&&!b){const k=t.fc.get("_wd"),_=k.createRange();_.setStart(c.startContainer,c.startOffset),_.collapse(!0),yc(_,d,"front",k)&&(y=!1,b=!0,C=!0)}i.push(G.enterFormatBreakWithSelection(d,c,y,b))}else i.push(G.enterFormatBreakAtCursor(d,c));return i.push(G.caretScrollTo(c)),!0}}return m?(i.push(G.caretScrollTo(c)),!0):(v&&u.query.getParentElement(v,"FIGCAPTION")&&u.query.getParentElement(v,u.check.isList)&&(e.enterPrevent(f),i.push(G.enterFigcaptionExitInList(d)),i.push(G.caretScrollTo(c))),!0)}function wL(i,e,t){const{options:o,selectionNode:s,range:r,formatEl:l,ctrl:c,alt:d,shift:h}=t;return o.get("tabDisable")||(i.push(G.prevent()),c||d||u.check.isWysiwygFrame(s))||(i.push(G.tabFormatIndent(r,l,h)),i.push(G.historyPush(!1))),!0}function CL(i,e,t){var f;const{component:o}=e,{formatEl:s,range:r,selectionNode:l,keyCode:c}=t,d=t.options.get("_rtl"),h=c==="ArrowLeft"?d?"forward":"back":c==="ArrowRight"?d?"back":"forward":null;let p=null;switch(c){case"ArrowUp":o.is(s.previousElementSibling)&&(p=o.get(s.previousElementSibling));break;case"ArrowLeft":case"ArrowRight":if(h==="forward"){if(u.check.isEdgePoint(l,r.endOffset,"end")){const m=l.nextElementSibling||u.query.getNextDeepestNode(l);m?o.is(m)&&(p=o.get(m)):o.is(s.nextElementSibling)&&(p=o.get(s.nextElementSibling))}}else if(h==="back"&&u.check.isEdgePoint(l,r.startOffset,"front")){const m=l.previousElementSibling||u.query.getPreviousDeepestNode(l);m?o.is(m)&&(p=o.get(m)):o.is(s.previousElementSibling)&&(p=o.get(s.previousElementSibling))}break;case"ArrowDown":o.is(s.nextElementSibling)&&(p=o.get(s.nextElementSibling));break}p&&!((f=p.options)!=null&&f.isInputComponent)&&(i.push(G.prevent()),i.push(G.selectComponentFallback(p)))}const{isOSX_IOS:kL}=ge,_L=!0;function cp(i,e){return _L&&i.get("_canUseBeforeInput")&&!(e!=null&&e.repeat)}async function xL(i,e){const t=[];switch(e.keyCode){case"Backspace":{if(mL(t,i,e)===!1)return t;break}case"Delete":{if(bL(t,i,e)===!1)return t;break}case"Tab":{if(wL(t,i,e)===!1)return t;break}case"Enter":{if(!cp(e.store,e.e)&&Dv(t,i,e)===!1)return t;break}}const{fc:o,keyCode:s,shift:r,alt:l,ctrl:c,range:d}=e;if(r&&(kL?l:c)&&Me.isSpace(s))return t.push(G.preventStop()),t.push(G.keydownInputInsertNbsp()),t;const h=!d.collapsed||d.startContainer!==d.endContainer;return!c&&!l&&!h&&!Me.isNonTextKey(s)&&u.check.isBreak(d.commonAncestorContainer)?(t.push(G.keydownInputInsertZWS()),t):o.has("documentType_use_header")&&h&&!c&&!l&&!r&&!Me.isDirectionKey(s)?(t.push(G.documentTypeRefreshHeader()),t):(CL(t,i,e),t)}function Vv(i,{_styleNodes:e}){const{frameContext:t,ui:o,focusManager:s,selection:r,format:l,listFormat:c,component:d,html:h,nodeTransform:p,history:f,char:m,menu:g,store:v}=i.$;return{focusManager:{nativeFocus:()=>s.nativeFocus(),blur:()=>s.blur()},selection:{getRange:()=>r.getRange(),getNode:()=>r.getNode(),setRange:(b,y,C,k)=>r.setRange(b,y,C,k),get:()=>r.get()},format:{isLine:b=>l.isLine(b),getLine:(b,y)=>l.getLine(b,y),getLines:b=>l.getLines(b),getBrLine:(b,y)=>l.getBrLine(b,y),getBlock:(b,y)=>l.getBlock(b,y),isNormalLine:b=>l.isNormalLine(b),isBrLine:b=>l.isBrLine(b),isClosureBrLine:b=>l.isClosureBrLine(b),isBlock:b=>l.isBlock(b),isClosureBlock:b=>l.isClosureBlock(b),isEdgeLine:(b,y,C)=>l.isEdgeLine(b,y,C),removeBlock:(b,y)=>l.removeBlock(b,y),addLine:(b,y)=>l.addLine(b,y),addLineAfter:b=>l.addLineAfter(b)},listFormat:{applyNested:(b,y)=>c.applyNested(b,y)},component:{deselect:()=>d.deselect(),is:b=>d.is(b),get:b=>d.get(b),select:(b,y)=>d.select(b,y)},html:{remove:()=>h.remove(),insert:(b,y)=>h.insert(b,y),insertNode:(b,y)=>h.insertNode(b,y)},history:{push:b=>f.push(!!b)},nodeTransform:{removeAllParents:(b,y,C)=>p.removeAllParents(b,y,C),split:(b,y,C)=>p.split(b,y,C)},char:{check:b=>m.check(b)},menu:{dropdownOff:()=>g.dropdownOff()},setDefaultLine:b=>i._setDefaultLine(b),hideToolbar:()=>i._hideToolbar(),hideToolbar_sub:()=>i._hideToolbar_sub(),styleNodeCache:()=>e.value=i.__cacheStyleNodes,formatAttrsTempCache:b=>i._formatAttrsTemp=b,setOnShortcutKey:b=>i._onShortcutKey=b,caretScrollTo(b){o._iframeAutoHeight(t),r.scrollTo(r.getRange()||b,{behavior:"auto",block:"nearest",inline:"nearest"})},enterPrevent(b){b.preventDefault(),!(!yb||cp(v))&&(i.__focusTemp.focus({preventScroll:!0}),t.get("wysiwyg").focus({preventScroll:!0}))}}}const EL={value:[]};async function TL(i,e){if(i.get("isReadOnly")||i.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;if(cp(this.$.store)&&(e.inputType==="insertParagraph"||e.inputType==="insertLineBreak")){await ML.call(this,i,e);return}const t=(e.data===null?"":e.data===void 0?" ":e.data)||"";if(Me.isComposing(e))this._handledInBefore=!1;else{if(!this.$.char.test(t,!1))return e.preventDefault(),e.stopPropagation(),!1;this._handledInBefore=!0}await this.$.eventManager.triggerEvent("onBeforeInput",{frameContext:i,event:e,data:t})!==!1&&await this._callPluginEventAsync("onBeforeInput",{frameContext:i,event:e,data:t})}async function ML(i,e){if(e.isComposing||this.isComposing||this.$.ui.selectMenuOn)return;let t=this.$.selection.getNode();if(u.check.isInputElement(t)||this.$.menu.currentDropdownName)return;u.check.isWysiwygFrame(t)&&(this._setDefaultLine(this.$.options.get("defaultLine")),t=this.$.selection.getNode());const o=this._enterKeyShift||e.inputType==="insertLineBreak";if(this._enterKeyShift=!1,!o){const h=this._normalizeEditRange();h&&(t=h)}const s=this.$.selection.getRange(),r=this.$.format.getLine(t,null)||t,l={e,fc:i,store:this.$.store,options:this.$.options,frameOptions:this.$.frameOptions,range:s,selectionNode:t,formatEl:r,keyCode:"Enter",ctrl:!1,alt:!1,shift:o},c=Vv(this,{_styleNodes:EL}),d=[];Dv(d,c,l),d.some(h=>h.t==="event.prevent"||h.t==="event.prevent.stop")&&e.preventDefault(),await Iv(d,{ports:c,ctx:l})}async function SL(i,e){if(i.get("isReadOnly")||i.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;const t=this.$.selection.getRange(),o=this.$.selection.getNode(),s=this.$.format.getLine(o,null);if(!this.$.format.isNormalLine(s)&&!this.$.format.isBrLine(s)&&t.collapsed&&!this.$.component.is(o)&&!u.check.isList(o)){const l=this.$.format.getBlock(o,null);this._setDefaultLine(this.$.format.isBlock(l)?"DIV":this.$.options.get("defaultLine"))}this.$.selection.init();const r=(e.data===null?"":e.data===void 0?" ":e.data)||"";if(!this._handledInBefore&&!this.$.char.test(r,!0))return e.preventDefault(),e.stopPropagation(),!1;this._handledInBefore=!1,await this.$.eventManager.triggerEvent("onInput",{frameContext:i,event:e,data:r})!==!1&&(await this._callPluginEventAsync("onInput",{frameContext:i,event:e,data:r}),this.$.history.push(!0))}const{_w:Rv}=ge,AL=new RegExp(De.zeroWidthSpace+"+",""),Wr={ctrl:!1,alt:!1},dp=Object.preventExtensions({value:[]});async function BL(i,e){var g,v;if(this.isComposing=Me.isComposing(e))return!0;if(this.$.ui.selectMenuOn||!e.isTrusted)return;let t=this.$.selection.getNode();if(u.check.isInputElement(t)||this.$.menu.currentDropdownName)return;const o=e.code,s=Me.isShift(e),r=Wr.ctrl=Me.isCtrl(e),l=Wr.alt=Me.isAlt(e);if(Me.isEnter(o)&&(this._enterKeyShift=s),!r&&i.get("isReadOnly")&&!Me.isDirectionKey(o))return e.preventDefault(),!1;if(this.$.menu.dropdownOff(),this.$.store.mode.isBalloon?this.$.store.mode.isBalloonAlways||this._hideToolbar():this.$.store.mode.isSubBalloon&&(this.$.store.mode.isSubBalloonAlways||this._hideToolbar_sub()),Me.isEnter(o)&&!cp(this.$.store,e)||Me.isRemoveKey(o)){const b=this._normalizeEditRange();b&&(t=b)}const d=this.$.selection.getRange(),h=this.$.format.getLine(t,null)||t;if(r&&!Me.isNonTextKey(o)&&this.$.shortcuts.command(e,r,s,o,"",!1,null,null))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1;if(!r&&!Me.isNonTextKey(o)&&this.$.format.isLine(h)&&d.collapsed&&u.check.isEdgePoint(d.startContainer,0,"front")){const b=(v=(g=d.startContainer).substringData)==null?void 0:v.call(g,0,d.startOffset);if(b&&this.$.shortcuts.command(e,!1,s,o,b,!0,h,d))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1}else this._onShortcutKey&&(this._onShortcutKey=!1);const p={e,fc:i,store:this.$.store,options:this.$.options,frameOptions:this.$.frameOptions,range:d,selectionNode:t,formatEl:h,keyCode:o,ctrl:r,alt:l,shift:s},f=Vv(this,{_styleNodes:dp}),m=await xL(f,p);await this.$.eventManager.triggerEvent("onKeyDown",{frameContext:i,event:e})!==!1&&await this._callPluginEventAsync("onKeyDown",{frameContext:i,event:e,range:d,line:h})!==!1&&await Iv(m,{ports:f,ctx:p})}async function NL(i,e){var f;if(this._onShortcutKey||this.$.menu.currentDropdownName)return;const t=e.code,o=Me.isCtrl(e),s=Me.isAlt(e);if(o&&(Wr.ctrl=!1),s&&(Wr.alt=!1),i.get("isReadOnly"))return;const r=this.$.selection.getRange();let l=this.$.selection.getNode();if((this.$.store.mode.isBalloon||this.$.store.mode.isSubBalloon)&&((this.$.store.mode.isBalloonAlways||this.$.store.mode.isSubBalloonAlways)&&!Me.isEsc(t)||!r.collapsed))if(this.$.store.mode.isBalloonAlways||this.$.store.mode.isSubBalloonAlways)Me.isEsc(t)||this._showToolbarBalloonDelay();else{this.$.store.mode.isSubBalloon?this.$.subToolbar._showBalloon():this.$.toolbar._showBalloon();return}if(Me.isBackspace(t)&&u.check.isWysiwygFrame(l)&&l.textContent===""&&l.children.length===0){e.preventDefault(),e.stopPropagation(),l.innerHTML="";const m=this.$.store.get("currentNodes")[0],g=u.utils.createElement(this.$.format.isLine(m)&&!u.check.isListCell(m)?m:this.$.options.get("defaultLine"),null,"<br>");l.appendChild(g),this.$.selection.setRange(g,0,g,0),this.applyTagEffect(),this.$.history.push(!1),i.has("documentType_use_header")&&Me.isDocumentTypeObserverKey(t)&&i.get("documentType").reHeader();return}const c=this.$.format.getLine(l,null),d=this.$.format.getBlock(l,null),h=this._formatAttrsTemp;if(c&&h){for(let m=0,g=h.length;m<g;m++){if(Me.isEnter(t)&&/^id$/i.test(h[m].name)){c.removeAttribute("id");continue}c.setAttribute(h[m].name,h[m].value)}this._formatAttrsTemp=null}if(!this.$.format.isNormalLine(c)&&!this.$.format.isBrLine(c)&&r.collapsed&&!this.$.component.is(l)&&!u.check.isList(l)&&this._setDefaultLine(this.$.format.isBlock(d)?"DIV":this.$.options.get("defaultLine"))!==null&&(l=this.$.selection.getNode()),!Wr.ctrl&&!Wr.alt&&!Me.isNonTextKey(t)&&l.nodeType===3&&De.zeroWidthRegExp.test(l.textContent)&&!(e.isComposing!==void 0?e.isComposing:this.isComposing)){let m=r.startOffset,g=r.endOffset;const v=(l.textContent.substring(0,g).match(AL)||"").length;m=r.startOffset-v,g=r.endOffset-v,l.textContent=l.textContent.replace(De.zeroWidthRegExp,""),this.$.selection.setRange(l,m<0?0:m,l,g<0?0:g)}if(Me.isRemoveKey(t)&&u.check.isZeroWidth(c==null?void 0:c.textContent)&&!c.previousElementSibling&&!u.check.isListCell(c)){const m=this.$.options.get("retainStyleMode");m!=="none"&&((f=dp.value)==null?void 0:f.length)>0?m==="repeat"?this.__retainTimer?(this.__retainTimer=Rv.clearTimeout(this.__retainTimer),this._clearRetainStyleNodes(c)):(this.__retainTimer=Rv.setTimeout(()=>{this.__retainTimer=null},0),this._retainStyleNodes(c,dp.value)):(this.__retainTimer=null,this._retainStyleNodes(c,dp.value)):this._clearRetainStyleNodes(c)}if(i.has("documentType_use_header"))if(Me.isDocumentTypeObserverKey(t)){i.get("documentType").reHeader();const m=u.query.getParentElement(this.$.selection.selectionNode,this.$.format.isLine.bind(this.$.format));i.get("documentType").on(m)}else{const m=u.query.getParentElement(l,g=>g.nodeType===1);i.get("documentType").onChangeText(m)}await this.$.eventManager.triggerEvent("onKeyUp",{frameContext:i,event:e})!==!1&&await this._callPluginEventAsync("onKeyUp",{frameContext:i,event:e,range:r,line:c})!==!1&&Me.isHistoryRelevantKey(t)&&this.$.history.push(!0)}const{_w:LL}=ge;function IL(i,e){const t=e.clipboardData;return t?this._dataTransferAction("paste",e,t,i):!0}async function $L(i,e){const t=e.clipboardData;if(await this.$.eventManager.triggerEvent("onCopy",{frameContext:i,event:e,clipboardData:t})===!1)return e.preventDefault(),e.stopPropagation(),!1;const o=i.get("_ww").getSelection();this.__secopy=o.toString()}async function OL(i,e){const t=e.clipboardData;if(await this.$.eventManager.triggerEvent("onCut",{frameContext:i,event:e,clipboardData:t})===!1)return e.preventDefault(),e.stopPropagation(),!1;const o=i.get("_ww").getSelection();this.__secopy=o.toString(),LL.setTimeout(()=>{this.$.history.push(!1)},0)}const{_w:hp}=ge;function DL(i,e,t,o,s){var m,g;if(s.dataTransfer&&Array.from(s.dataTransfer.types||[]).includes("application/x-suneditor-block-drag"))return;const{sc:r,so:l,ec:c,eo:d}=this.$.selection.getDragEventLocationRange(s);if(!r)return;s.preventDefault();const h=i.get("_wd").createRange();h.setStart(r,l),h.setEnd(c,d);const p={y:0,x:0};if(t){const v=this.$.offset.getGlobal(t),b=o?this.$.context.get("toolbar_main").offsetHeight:0;p.y=v.top+b-hp.scrollY,p.x=v.left-hp.scrollX}const f=h.getBoundingClientRect();if(f.height>0){const v=i.get("wysiwygFrame");let b=0,y=0;/^iframe$/i.test(v.nodeName)&&(b=v.offsetLeft,y=v.offsetTop),e.style.left=`${f.right+hp.scrollX+p.x+b}px`,e.style.top=`${f.top+hp.scrollY+p.y-5+y}px`,e.style.height=`${f.height+10}px`,e.style.display="block";try{(m=e.showPopover)==null||m.call(e)}catch{}}else{try{(g=e.hidePopover)==null||g.call(e)}catch{}e.style.display="none"}}function VL(i){var e;try{(e=i.hidePopover)==null||e.call(i)}catch{}i.style.display="none"}function RL(i,e,t){var o;try{if(i.get("isReadOnly"))return t.preventDefault(),t.stopPropagation(),!1;const s=t.dataTransfer;if(!s)return!0;if(Array.from(s.types||[]).includes("application/x-suneditor-block-drag"))return;const{sc:r,so:l,ec:c,eo:d}=this.$.selection.getDragEventLocationRange(t);if(!r)return;if(u.query.getParentElement(r,".se-disable-pointer")){t.preventDefault();return}if(ye.get("__dragContainer")){if(t.preventDefault(),ye.get("__dragContainer").contains(t.target)){this.$.component.deselect();return}const h=ye.get("__dragContainer");this.$.component.deselect(),this.$.selection.setRange(r,l,c,d),this.$.html.insertNode(h,{afterNode:null,skipCharCount:!0}),i.has("documentType_use_page")&&(i.get("documentTypePageMirror").innerHTML=i.get("wysiwyg").innerHTML,i.get("documentType").rePage(!0));return}return this.$.html.remove(),this.$.selection.setRange(r,l,c,d),this._dataTransferAction("drop",t,s,i)}finally{try{(o=e.hidePopover)==null||o.call(e)}catch{}e.style.display="none"}}class zL{constructor({$:e}){w(this,Re,void 0);x(this,Re,e)}execute(e){if(!n(this,Re).options.get("__lineFormatFilter"))return null;if(n(this,Re).pluginManager.fileInfo.pluginRegExp.test(n(this,Re).ui.currentControllerName))return;const t=n(this,Re).selection.getRange(),o=t.commonAncestorContainer,s=t.startContainer,r=t.endOffset,l=n(this,Re).format.getBlock(o,null);let c,d,h;if(l){h=u.utils.createElement(e||n(this,Re).options.get("defaultLine")),h.innerHTML=l.innerHTML,h.childNodes.length===0&&(h.innerHTML=De.zeroWidthSpace),l.innerHTML=h.outerHTML,h=l.firstChild,c=h.childNodes[r]||u.query.getEdgeChildNodes(h,null).sc,c||(c=u.utils.createTextNode(De.zeroWidthSpace),h.insertBefore(c,h.firstChild)),d=c.textContent.length,n(this,Re).selection.setRange(c,d,c,d);return}if(o.nodeType===3&&n(this,Re).component.is(o.parentElement)){const p=n(this,Re).component.get(o.parentElement);if(!p)return;const f=p.container;if(o.parentElement===f){const m=o.nextElementSibling?f:f.nextElementSibling,g=u.utils.createElement(n(this,Re).options.get("defaultLine"),null,o);f.parentElement.insertBefore(g,m),n(this,Re).focusManager.focusEdge(g);return}return n(this,Re).component.select(p.target,p.pluginName),null}else if(o.nodeType===1&&o.getAttribute("data-se-embed")==="true"){let p=o.nextElementSibling;n(this,Re).format.isLine(p)||(p=n(this,Re).format.addLine(o,n(this,Re).options.get("defaultLine"))),n(this,Re).selection.setRange(p.firstChild,0,p.firstChild,0);return}if(!((n(this,Re).format.isBlock(s)||u.check.isWysiwygFrame(s))&&(n(this,Re).component.is(s.children[t.startOffset])||n(this,Re).component.is(s.children[t.startOffset-1])))){if(u.query.getParentElement(o,u.check.isExcludeFormat))return null;if(n(this,Re).format.isBlock(o)&&o.childNodes.length<=1){let p=null;o.childNodes.length===1&&u.check.isBreak(o.firstChild)?p=o.firstChild:(p=u.utils.createTextNode(De.zeroWidthSpace),o.appendChild(p)),n(this,Re).selection.setRange(p,1,p,1);return}try{if(o.nodeType===3&&(h=u.utils.createElement(e||n(this,Re).options.get("defaultLine")),o.parentNode.insertBefore(h,o),h.appendChild(o)),u.check.isBreak(h.nextSibling)&&u.utils.removeItem(h.nextSibling),u.check.isBreak(h.previousSibling)&&u.utils.removeItem(h.previousSibling),u.check.isBreak(c)){const p=u.utils.createTextNode(De.zeroWidthSpace);c.parentNode.insertBefore(p,c),c=p}}catch{n(this,Re).frameContext.get("_wd").execCommand("formatBlock",!1,`<${e||n(this,Re).options.get("defaultLine")}>`),n(this,Re).store.set("_lastSelectionNode",null),n(this,Re).selection.init();return}if(h&&(u.check.isBreak(h.nextSibling)&&u.utils.removeItem(h.nextSibling),u.check.isBreak(h.previousSibling)&&u.utils.removeItem(h.previousSibling),u.check.isBreak(c))){const p=u.utils.createTextNode(De.zeroWidthSpace);c.parentNode.insertBefore(p,c),c=p}n(this,Re).store.set("_lastSelectionNode",null),s?n(this,Re).selection.setRange(s,1,s,1):n(this,Re).focusManager.nativeFocus()}}}Re=new WeakMap;class PL{constructor(e){w(this,jh);w(this,G1);w(this,Ph,void 0);w(this,ze,void 0);w(this,Hh,void 0);x(this,Ph,e),x(this,ze,e.$),x(this,Hh,new RegExp(`^(${Object.keys(n(this,ze).options.get("_defaultStyleTagMap")).join("|")})$`,"i"))}update(e){if(e||(e=n(this,ze).selection.getNode()),e===n(this,ze).store.get("_lastSelectionNode"))return;n(this,ze).store.set("_lastSelectionNode",e);const t=n(this,ze).options.get("_rtl")?"marginRight":"marginLeft",o=n(this,ze).plugins,s=n(this,ze).commandDispatcher.targets,r=n(this,Hh),l=n(this,ze).options.get("_styleCommandMap"),c=[],d=[],h=n(this,ze).options.get("_textStyleTags"),p=[],f=[],m=n(this,ze).commandDispatcher.activeCommands,g=m.length;let v="";if(n(this,ze).component.is(e)&&!n(this,ze).component.__selectionSelected){const C=n(this,ze).component.get(e);if(!C)return;n(this,ze).store.set("_lastSelectionNode",null),n(this,ze).component.select(C.target,C.pluginName);return}for(;e.firstChild;)e=e.firstChild;const b=n(this,ze).frameContext,y=!b.get("isReadOnly");for(let C=e;!u.check.isWysiwygFrame(C)&&C;C=C.parentElement)if(!(C.nodeType!==1||u.check.isBreak(C))){if(E(this,G1,I3).call(this,C)){n(this,ze).focusManager.blur();return}if(v=C.nodeName.toLowerCase(),d.push(v),h.includes(v)&&!n(this,ze).format.isLine(v)&&p.push(C),y)for(let k=0,_;k<g;k++)_=m[k],!c.includes(_)&&!f.includes(_)&&s.get(_)&&s.get(_).filter(S=>{var M;const T=(M=o[_])==null?void 0:M.active(C,S);return T===void 0&&f.push(_),T}).length>0&&c.push(_);if(n(this,ze).format.isLine(C)){if(!c.includes("outdent")&&s.has("outdent")&&(u.check.isListCell(C)||C.style[t]&&Q.get(C.style[t],0)>0)&&s.get("outdent").filter(k=>u.check.isImportantDisabled(k)?!1:(k.disabled=!1,!0)).length>0&&c.push("outdent"),!c.includes("indent")&&s.has("indent")){const k=u.check.isListCell(C)&&!C.previousElementSibling;s.get("indent").filter(_=>u.check.isImportantDisabled(_)?!1:(_.disabled=k,!0)).length>0&&c.push("indent")}continue}r.test(v)&&(v=l[v]||v,c.push(v),u.utils.addClass(s.get(v),"active"))}return E(this,jh,a2).call(this,c),n(this,Ph).__cacheStyleNodes=p.reverse(),n(this,ze).store.set("currentNodes",d.reverse()),n(this,ze).store.set("currentNodesMap",c),n(this,ze).frameOptions.get("statusbar_showPathLabel")&&b.get("navigation")&&(b.get("navigation").textContent=n(this,ze).options.get("_rtl")?n(this,ze).store.get("currentNodes").reverse().join(" < "):n(this,ze).store.get("currentNodes").join(" > ")),e}reset(){E(this,jh,a2).call(this,[])}}Ph=new WeakMap,ze=new WeakMap,Hh=new WeakMap,jh=new WeakSet,a2=function(e){const t=n(this,ze).commandDispatcher.activeCommands,o=n(this,ze).commandDispatcher.targets,s=n(this,ze).plugins;for(let r=0,l=t.length,c,d,h;r<l;r++)if(c=t[r],!(e.includes(c)||!(d=o.get(c)))){h=s[c];for(let p=0,f=d.length,m;p<f;p++)m=d[p],m&&(h?h.active(null,m):/^outdent$/i.test(c)?u.check.isImportantDisabled(m)||(m.disabled=!0):/^indent$/i.test(c)?u.check.isImportantDisabled(m)||(m.disabled=!1):u.utils.removeClass(m,"active"))}},G1=new WeakSet,I3=function(e){return u.check.isElement(e)&&e.getAttribute("data-se-non-focus")==="true"};const{_w:Ct,isMobile:Wg,isTouchDevice:Ug}=ge;class HL extends XN{constructor(t){super(t);w(this,Y1);w(this,K1);w(this,kr);w(this,X1);w(this,Q1);w(this,J1);w(this,em);w(this,tm);w(this,im);w(this,om);w(this,Fh);w(this,sm);w(this,nm);w(this,rm);w(this,am);w(this,lm);w(this,cm);w(this,dm);w(this,hm);w(this,Ce,void 0);w(this,ko,void 0);w(this,oi,void 0);w(this,Rt,void 0);w(this,se,void 0);w(this,nt,void 0);w(this,rt,void 0);w(this,zt,void 0);w(this,qt,null);w(this,Zs,null);w(this,Gs,null);w(this,Ys,null);x(this,Ce,this.$.store),x(this,ko,this.$.contextProvider),x(this,oi,this.$.context),x(this,Rt,this.$.options),x(this,se,this.$.eventManager),x(this,nt,this.$.toolbar),x(this,rt,this.$.ui),x(this,zt,this.$.menu),this.isComposing=!1,this._enterKeyShift=!1,this.scrollparents=[],this.defaultLineManager=new zL(this),this.selectionState=new PL(this),this._onShortcutKey=!1,this._handledInBefore=!1,this._wwFrameObserver=null,this._toolbarObserver=null,this._lineBreakComp=null,this._formatAttrsTemp=null,this._resizeClientY=0,this.__cacheStyleNodes=[],this.__onDownEv=null,this._inputFocus=!1,this.__inputPlugin=null,this.__inputBlurEvent=null,this.__inputKeyEvent=null,this.__retainTimer=null,this.__eventDoc=null,this.__secopy=null,this.__focusTemp=n(this,ko).carrierWrapper.querySelector(".__se__focus__temp__")}applyTagEffect(t){return this.selectionState.update(t)}_showToolbarBalloonDelay(){n(this,qt)&&Ct.clearTimeout(n(this,qt)),x(this,qt,Ct.setTimeout(()=>{Ct.clearTimeout(n(this,qt)),x(this,qt,null),n(this,Ce).mode.isSubBalloon?this.$.subToolbar._showBalloon():n(this,nt)._showBalloon()},250))}_toggleToolbarBalloon(){this.$.selection.init();const t=this.$.selection.getRange(),o=n(this,Rt).has("_subMode");!(o?n(this,Ce).mode.isSubBalloonAlways:n(this,Ce).mode.isBalloonAlways)&&t.collapsed?o?this._hideToolbar_sub():this._hideToolbar():o?this.$.subToolbar._showBalloon(t):n(this,nt)._showBalloon(t)}_hideToolbar(){!n(this,rt).isPreventToolbarHide&&!this.$.frameContext.get("isFullScreen")&&n(this,nt).hide()}_hideToolbar_sub(){this.$.subToolbar&&!n(this,rt).isPreventToolbarHide&&this.$.subToolbar.hide()}_setDefaultLine(t){return this.defaultLineManager.execute(t)}_normalizeEditRange(){var o;if(!this.$.format.isLine((o=this.$.selection.getRange())==null?void 0:o.startContainer))return null;this.$.selection.resetRangeToTextNode();const t=this.$.selection.getRange();if(t.startContainer===t.endContainer&&t.startOffset!==t.endOffset&&t.startContainer.nodeType===3&&u.check.isZeroWidth(t.startContainer)){const s=t.startContainer.nextSibling;s&&u.check.isBreak(s)?this.$.selection.setRange(s,0,s,0):this.$.selection.setRange(t.endContainer,t.endOffset,t.endContainer,t.endOffset)}return this.$.selection.getNode()}async _dataTransferAction(t,o,s,r){try{return n(this,rt).showLoading(),await E(this,K1,O3).call(this,t,o,s,r),o.preventDefault(),o.stopPropagation(),!1}catch(l){console.warn("[SUNEDITOR.paste.error]",l)}finally{n(this,rt).hideLoading()}}_addCommonEvents(){const t=eL.bind(this),o=iL.bind(this);n(this,se).addEvent(n(this,oi).get("menuTray"),"mousedown",t,!1),n(this,se).addEvent(n(this,oi).get("menuTray"),"click",tL.bind(this),!0),n(this,se).addEvent(n(this,oi).get("toolbar_main"),"mousedown",t,!1),n(this,se).addEvent(n(this,oi).get("toolbar_main"),"click",o,!1),n(this,Rt).has("_subMode")&&(n(this,se).addEvent(n(this,oi).get("toolbar_sub_main"),"mousedown",t,!1),n(this,se).addEvent(n(this,oi).get("toolbar_sub_main"),"click",o,!1)),n(this,nt)._setResponsive(),ge.isResizeObserverSupported&&(this._toolbarObserver=new ResizeObserver(()=>{Ct.setTimeout(()=>{n(this,nt).resetResponsiveToolbar()},0)}),this._wwFrameObserver=new ResizeObserver(s=>{Ct.setTimeout(()=>{s.forEach(r=>{n(this,rt)._emitResizeEvent(this.$.frameRoots.get(r.target.getAttribute("data-root-key")),-1,r)}),n(this,Ce).mode.isInline&&n(this,Ce).mode.isBottom&&n(this,nt)._resetSticky()},0)})),n(this,Rt).get("closeModalOutsideClick")&&n(this,se).addEvent(n(this,ko).carrierWrapper.querySelector(".se-modal .se-modal-inner"),"click",s=>{s.target===n(this,ko).carrierWrapper.querySelector(".se-modal .se-modal-inner")&&n(this,rt).offCurrentModal()},!1),n(this,se).addEvent(Ct,"resize",E(this,sm,F3).bind(this),!1),n(this,se).addEvent(Ct.visualViewport,"resize",E(this,nm,W3).bind(this),!1),n(this,se).addEvent(Ct,"scroll",E(this,rm,U3).bind(this),!1),Ug&&n(this,se).addEvent(Ct.visualViewport,"scroll",E(this,am,q3).bind(this),!1)}_addFrameEvents(t){const o=t.get("options").get("iframe"),s=o?t.get("_ww"):t.get("wysiwyg");t.set("eventWysiwyg",s);const r=t.get("code"),l=n(this,ko).carrierWrapper.querySelector(".se-drag-cursor"),c=rL.bind(this,t);n(this,se).addEvent(s,"mousemove",c,!1),n(this,se).addEvent(s,"mouseleave",aL.bind(this,t),!1),n(this,se).addEvent(s,"mousedown",oL.bind(this,t),!1),n(this,se).addEvent(s,"mouseup",sL.bind(this,t),!1),n(this,se).addEvent(s,"click",nL.bind(this,t),!1),n(this,se).addEvent(s,"beforeinput",TL.bind(this,t),!1),n(this,se).addEvent(s,"input",SL.bind(this,t),!1),n(this,se).addEvent(s,"keydown",BL.bind(this,t),!1),n(this,se).addEvent(s,"keyup",NL.bind(this,t),!1),n(this,se).addEvent(s,"paste",IL.bind(this,t),!1),n(this,se).addEvent(s,"copy",$L.bind(this,t),!1),n(this,se).addEvent(s,"cut",OL.bind(this,t),!1),n(this,se).addEvent(s,"dragover",DL.bind(this,t,l,o?this.$.frameContext.get("topArea"):null,!n(this,Rt).get("toolbar_container")&&!n(this,Ce).mode.isBalloon&&!n(this,Ce).mode.isInline),!1),n(this,se).addEvent(s,"dragend",VL.bind(this,l),!1),n(this,se).addEvent(s,"drop",RL.bind(this,t,l),!1),n(this,se).addEvent(s,"scroll",E(this,Q1,V3).bind(this,t,s),{passive:!0,capture:!1}),n(this,se).addEvent(s,"focus",E(this,J1,R3).bind(this,t),!1),n(this,se).addEvent(s,"blur",E(this,em,z3).bind(this,t),!1),n(this,se).addEvent(r,"mousedown",E(this,dm,Y3).bind(this,t),!1);const d=t.get("wrapper").querySelector(".se-drag-handle");if(n(this,se).addEvent(d,"wheel",m=>{m.preventDefault(),this.$.component.deselect()},!1),n(this,se).addEvent(t.get("lineBreaker_t"),"pointerdown",E(this,Fh,l2).bind(this,"t"),!1),n(this,se).addEvent(t.get("lineBreaker_b"),"pointerdown",E(this,Fh,l2).bind(this,"b"),!1),Ug&&n(this,se).addEvent(s,"touchstart",c,{passive:!0,capture:!1}),!n(this,Rt).get("hasCodeMirror")){const m=t.get("codeNumbers"),g=this.$.viewer._codeViewAutoHeight.bind(this.$.viewer,t.get("code"),m,this.$.frameOptions.get("height")==="auto");n(this,se).addEvent(r,"keydown",g,!1),n(this,se).addEvent(r,"keyup",g,!1),n(this,se).addEvent(r,"paste",g,!1),n(this,Rt).get("tabDisable")||n(this,se).addEvent(r,"keydown",zv,!1),m&&n(this,se).addEvent(r,"scroll",this.$.viewer._scrollLineNumbers.bind(r,m),!1)}const h=t.get("markdown");if(h){n(this,se).addEvent(h,"mousedown",E(this,hm,K3).bind(this,t),!1);const m=t.get("markdownNumbers"),g=this.$.viewer._markdownViewAutoHeight.bind(this.$.viewer,h,m,this.$.frameOptions.get("height")==="auto");n(this,se).addEvent(h,"keydown",g,!1),n(this,se).addEvent(h,"keyup",g,!1),n(this,se).addEvent(h,"paste",g,!1),n(this,Rt).get("tabDisable")||n(this,se).addEvent(h,"keydown",zv,!1),m&&n(this,se).addEvent(h,"scroll",this.$.viewer._scrollMarkdownLineNumbers.bind(h,m),!1)}t.has("statusbar")&&this.__addStatusbarEvent(t,t.get("options"));const p=E(this,cm,G3).bind(this),f=u.query.getScrollParents(t.get("originElement"));for(const m of f)this.scrollparents.push(m),n(this,se).addEvent(m,"scroll",p,!1);n(this,se).addEvent(this.__focusTemp,"focus",m=>m.preventDefault(),!1),this.__eventDoc!==t.get("_wd")&&(this.__eventDoc=t.get("_wd"),n(this,se).addEvent(this.__eventDoc,"selectionchange",E(this,lm,Z3).bind(this,this.__eventDoc),!1))}__addStatusbarEvent(t,o){/\d+/.test(o.get("height"))&&o.get("statusbar_resizeEnable")?o.set("__statusbarEvent",n(this,se).addEvent(t.get("statusbar"),"mousedown",E(this,tm,P3).bind(this),!1)):u.utils.addClass(t.get("statusbar"),"se-resizing-none")}_removeAllEvents(){n(this,se)._init(),this._wwFrameObserver&&(this._wwFrameObserver.disconnect(),this._wwFrameObserver=null),this._toolbarObserver&&(this._toolbarObserver.disconnect(),this._toolbarObserver=null),n(this,qt)&&(Ct.clearTimeout(n(this,qt)),x(this,qt,null)),this.__retainTimer&&(Ct.clearTimeout(this.__retainTimer),this.__retainTimer=null),n(this,Gs)&&x(this,Gs,n(this,se).removeGlobalEvent(n(this,Gs))),n(this,Ys)&&x(this,Ys,n(this,se).removeGlobalEvent(n(this,Ys))),n(this,Zs)&&x(this,Zs,n(this,se).removeGlobalEvent(n(this,Zs))),this._formatAttrsTemp=null,this.__cacheStyleNodes=null,this.__inputPlugin=null,this.__inputBlurEvent=null,this.__inputKeyEvent=null,this.__focusTemp=null,this.__eventDoc=null,this.__secopy=null,this._lineBreakComp=null,this.scrollparents=null}_setSelectionSync(){n(this,se).removeGlobalEvent(n(this,Gs)),x(this,Gs,n(this,se).addGlobalEvent("mouseup",()=>{this.$.selection.init(),n(this,se).removeGlobalEvent(n(this,Gs))}))}_retainStyleNodes(t,o){let r=o[0].cloneNode(!1);for(let h=1,p=o.length,f;h<p;h++)f=o[h].cloneNode(!1),r.appendChild(f),r=f;const{parent:l,inner:c}=this.$.nodeTransform.createNestedNode(o,null),d=u.utils.createTextNode(De.zeroWidthSpace);c.appendChild(d),t.innerHTML="",t.appendChild(l),this.$.selection.setRange(d,1,d,1)}_clearRetainStyleNodes(t){t.innerHTML="<br>",this.$.selection.setRange(t,0,t,0)}_callPluginEvent(t,o){return this.$.pluginManager.emitEvent(t,o)}async _callPluginEventAsync(t,o){return await this.$.pluginManager.emitEventAsync(t,o)}__removeInput(){n(this,Ce).set("_preventBlur",!1),this._inputFocus=!1,this.__inputBlurEvent=n(this,se).removeEvent(this.__inputBlurEvent),this.__inputKeyEvent=n(this,se).removeEvent(this.__inputKeyEvent),this.__inputPlugin=null}__postFocusEvent(t,o){(n(this,Ce).mode.isInline||n(this,Ce).mode.isBalloonAlways)&&n(this,nt).show(),n(this,Ce).mode.isSubBalloonAlways&&this.$.subToolbar.show(),n(this,nt)._resetSticky(),n(this,rt)._updatePlaceholder(t),n(this,se).triggerEvent("onFocus",{frameContext:t,event:o}),this._callPluginEvent("onFocus",{frameContext:t,event:o})}__postBlurEvent(t,o){n(this,Ce).mode.isInline?Ct.setTimeout(()=>{n(this,Ce).get("hasFocus")||this._hideToolbar()},0):n(this,Ce).mode.isBalloon&&this._hideToolbar(),n(this,Ce).mode.isSubBalloon&&this._hideToolbar_sub(),n(this,se).triggerEvent("onBlur",{frameContext:t,event:o}),this._callPluginEvent("onBlur",{frameContext:t,event:o})}__setViewportSize(){n(this,Ce).set("currentViewportHeight",Q.get(Ct.visualViewport.height,0))}}Ce=new WeakMap,ko=new WeakMap,oi=new WeakMap,Rt=new WeakMap,se=new WeakMap,nt=new WeakMap,rt=new WeakMap,zt=new WeakMap,qt=new WeakMap,Zs=new WeakMap,Gs=new WeakMap,Ys=new WeakMap,Y1=new WeakSet,$3=function(){n(this,qt)&&Ct.clearTimeout(n(this,qt)),x(this,qt,Ct.setTimeout(()=>{Ct.clearTimeout(n(this,qt)),x(this,qt,null),this._toggleToolbarBalloon()},250))},K1=new WeakSet,O3=async function(t,o,s,r){o.preventDefault(),o.stopPropagation();let l=s.getData("text/plain"),c=s.getData("text/html");const d=!c,h=this.__secopy===l,p=/class=["']*Mso(Normal|List)/i.test(c)||/content=["']*Word.Document/i.test(c)||/content=["']*OneNote.File/i.test(c)||/content=["']*Excel.Sheet/i.test(c),f=h?"SE":p?"MS":"";if(d?c=Te.htmlToEntity(l).replace(/\n/g,"<br>"):(c=c.replace(/^<html>\r?\n?<body>\r?\n?\x3C!--StartFragment-->|\x3C!--EndFragment-->\r?\n?<\/body>\r?\n?<\/html>$/g,""),p&&(c=c.replace(/\n/g," "),l=l.replace(/\n/g," "),c=SA.cleanHTML(c))),!h&&n(this,Rt).get("autoLinkify")){const b=new DOMParser().parseFromString(c,"text/html");u.query.getListChildNodes(b.body,Te.textToAnchor,null),c=b.body.innerHTML}d||(c=this.$.html.clean(c,{forceFormat:!1,whitelist:null,blacklist:null}));const m=this.$.char.test(this.$.frameOptions.get("charCounter_type")==="byte-html"?c:l,!1);if(t==="paste"){const v=await n(this,se).triggerEvent("onPaste",{frameContext:r,event:o,data:c,maxCharCount:m,from:f});if(v===!1)return!1;if(typeof v=="string"){if(!v)return!1;c=v}}if(t==="drop"){const v=await n(this,se).triggerEvent("onDrop",{frameContext:r,event:o,data:c,maxCharCount:m,from:f});if(v===!1)return!1;if(typeof v=="string"){if(!v)return!1;c=v}}const g=s.files;if(g.length>0&&!p){for(let v=0,b=g.length;v<b;v++)await this._callPluginEventAsync("onFilePasteAndDrop",{frameContext:r,event:o,file:g[v]});return!1}if(!m)return!1;if(c){const v=new DOMParser().parseFromString(c,"text/html");return await this._callPluginEventAsync("onPaste",{frameContext:r,event:o,data:c,doc:v})!==!1&&this.$.html.insert(c,{selectInserted:!1,skipCharCount:!0,skipCleaning:!0}),r.has("documentType_use_header")&&r.get("documentType").reHeader(),!1}},kr=new WeakSet,pu=function(){n(this,zt).currentDropdownActiveButton&&n(this,zt).currentDropdown&&n(this,zt).__resetMenuPosition(n(this,zt).currentDropdownActiveButton,n(this,zt).currentDropdown),n(this,rt)._repositionControllers()},X1=new WeakSet,D3=function(){ge.isResizeObserverSupported||(n(this,nt).resetResponsiveToolbar(),n(this,Rt).get("_subMode")&&this.$.subToolbar.resetResponsiveToolbar());const t=n(this,oi).get("toolbar_main"),o=t.style.display==="none"||n(this,Ce).mode.isInline&&!n(this,nt).inlineToolbarAttr.isShow;if(t.offsetWidth===0&&!o)return;const s=n(this,rt).opendBrowser;if(s&&s.area.style.display==="block"&&(s.body.style.maxHeight=u.utils.getClientSize().h-s.header.offsetHeight-50+"px"),n(this,zt).currentDropdownActiveButton&&n(this,zt).currentDropdown&&n(this,zt).__resetMenuPosition(n(this,zt).currentDropdownActiveButton,n(this,zt).currentDropdown),this.$.viewer._resetFullScreenHeight())return;const r=this.$.frameContext;if(r.get("isCodeView")&&n(this,Ce).mode.isInline){n(this,nt)._showInline();return}n(this,rt)._iframeAutoHeight(r),n(this,nt).isSticky&&(n(this,nt).isCSSSticky||(n(this,oi).get("toolbar_main").style.width=r.get("topArea").offsetWidth-2+"px"),n(this,nt)._resetSticky())},Q1=new WeakSet,V3=function(t,o,s){n(this,rt)._syncScrollPosition(o),E(this,kr,pu).call(this),this._callPluginEvent("onScroll",{frameContext:t,event:s}),t.has("documentType_use_page")&&t.get("documentType").scrollPage(),n(this,se).triggerEvent("onScroll",{frameContext:t,event:s})},J1=new WeakSet,R3=function(t,o){if(this.$.selection.__iframeFocus||t.get("isReadOnly")||t.get("isDisabled"))return o.preventDefault(),!1;n(this,Ce).set("hasFocus",!0),this.$.component.__prevent=!1,n(this,se).triggerEvent("onNativeFocus",{frameContext:t,event:o});const s=t.get("key");if(this._inputFocus){n(this,Ce).mode.isInline&&Ct.setTimeout(()=>{n(this,nt)._showInline()},0);return}n(this,Ce).get("rootKey")===s&&n(this,Ce).get("_preventBlur")||n(this,Ce).get("_preventFocus")||(n(this,Ce).set("_preventFocus",!0),u.utils.removeClass(this.$.commandDispatcher.targets.get("codeView"),"active"),n(this,rt)._toggleCodeViewButtons(!1),this.$.facade.changeFrameContext(s),this.$.history.resetButtons(s,null),Ct.setTimeout(()=>{this.__postFocusEvent(t,o)},0))},em=new WeakSet,z3=function(t,o){t.get("isCodeView")||t.get("isReadOnly")||t.get("isDisabled")||(n(this,Ce).set("hasFocus",!1),n(this,Ce).set("_lastSelectionNode",null),n(this,se).triggerEvent("onNativeBlur",{frameContext:t,event:o}),n(this,rt)._updatePlaceholder(t),!(this._inputFocus||n(this,Ce).get("_preventBlur"))&&(n(this,Ce).set("_preventFocus",!1),this.selectionState.reset(),n(this,Ce).set("currentNodes",[]),n(this,Ce).set("currentNodesMap",[]),n(this,rt).offCurrentController(),n(this,ko).applyToRoots(s=>{s.get("navigation")&&(s.get("navigation").textContent="")}),this.$.history.check(t.get("key"),n(this,Ce).get("_range")),this.__postBlurEvent(t,o)))},tm=new WeakSet,P3=function(t){t.stopPropagation(),this._resizeClientY=t.clientY,n(this,rt).enableBackWrapper("ns-resize"),x(this,Ys,n(this,se).addGlobalEvent("mousemove",E(this,im,H3).bind(this))),x(this,Zs,n(this,se).addGlobalEvent("mouseup",E(this,om,j3).bind(this)))},im=new WeakSet,H3=function(t){const o=this.$.frameContext,s=o.get("wrapper").offsetHeight+(t.clientY-this._resizeClientY),r=s<o.get("_minHeight")?o.get("_minHeight"):s;o.get("wysiwygFrame").style.height=o.get("code").style.height=r+"px",this._resizeClientY=t.clientY,ge.isResizeObserverSupported||n(this,rt)._emitResizeEvent(o,r,null)},om=new WeakSet,j3=function(){n(this,rt).disableBackWrapper(),n(this,Ys)&&x(this,Ys,n(this,se).removeGlobalEvent(n(this,Ys))),n(this,Zs)&&x(this,Zs,n(this,se).removeGlobalEvent(n(this,Zs)))},Fh=new WeakSet,l2=function(t,o){o.preventDefault();const s=this._lineBreakComp;if(!s)return;const r=u.check.isListCell(s.parentElement),l=u.utils.createElement(r?"BR":u.check.isTableCell(s.parentElement)?"DIV":n(this,Rt).get("defaultLine"));if(r||(l.innerHTML="<br>"),!(this.$.frameOptions.get("charCounter_type")==="byte-html"&&!this.$.char.check(l.outerHTML))){s.parentNode.insertBefore(l,t==="t"?s:s.nextSibling),this.$.component.deselect();try{const c=r?l:l.firstChild;this.$.selection.setRange(c,1,c,1),this.$.history.push(!1)}catch(c){console.warn("[SUNEDITOR.lineBreaker.error]",c)}}},sm=new WeakSet,F3=function(){n(this,Ce).set("initViewportHeight",Ct.visualViewport.height),Wg||n(this,rt).offCurrentController(),n(this,Ce).mode.isBalloon?n(this,nt).hide():n(this,Ce).mode.isSubBalloon&&this.$.subToolbar.hide(),E(this,X1,D3).call(this)},nm=new WeakSet,W3=function(){Wg&&n(this,Rt).get("_toolbar_sticky")>-1&&(n(this,nt)._resetSticky(),n(this,zt).__restoreMenuPosition()),E(this,kr,pu).call(this);const t=n(this,Ce).get("currentViewportHeight");this.__setViewportSize(),Wg&&t>0&&t-Ct.visualViewport.height>100&&n(this,Ce).get("hasFocus")&&this.$.selection.scrollTo(this.$.selection.getRange(),{behavior:"auto",block:"nearest",inline:"nearest"})},rm=new WeakSet,U3=function(){n(this,Rt).get("_toolbar_sticky")>-1&&n(this,nt)._resetSticky(),n(this,Ce).mode.isBalloon&&n(this,oi).get("toolbar_main").style.display==="block"?n(this,nt)._setBalloonOffset(n(this,nt).balloonOffset.position==="top"):n(this,Ce).mode.isSubBalloon&&n(this,oi).get("toolbar_sub_main").style.display==="block"&&this.$.subToolbar._setBalloonOffset(this.$.subToolbar.balloonOffset.position==="top"),E(this,kr,pu).call(this),this.$.frameContext.has("documentType_use_page")&&this.$.frameContext.get("documentType").scrollWindow()},am=new WeakSet,q3=function(){n(this,Rt).get("_toolbar_sticky")>-1&&(n(this,nt)._resetSticky(),n(this,zt).__restoreMenuPosition())},lm=new WeakSet,Z3=function(t){let s=t.getSelection().anchorNode;n(this,ko).applyToRoots(r=>{if(s&&r.get("wysiwyg").contains(s)){if(r.get("isReadOnly")||r.get("isDisabled"))return;if(s=null,this.$.selection.init(),this.applyTagEffect(),n(this,rt)._updatePlaceholder(r),Ug&&(n(this,Ce).mode.isBalloon||n(this,Ce).mode.isSubBalloon)&&E(this,Y1,$3).call(this),r.has("documentType_use_header")){const l=u.query.getParentElement(this.$.selection.selectionNode,this.$.format.isLine.bind(this.$.format));r.get("documentType").on(l)}}})},cm=new WeakSet,G3=function(){n(this,zt).dropdownOff(),E(this,kr,pu).call(this)},dm=new WeakSet,Y3=function(t){this.$.facade.changeFrameContext(t.get("key")),u.utils.addClass(this.$.commandDispatcher.targets.get("codeView"),"active"),n(this,rt)._toggleCodeViewButtons(!0)},hm=new WeakSet,K3=function(t){this.$.facade.changeFrameContext(t.get("key")),u.utils.addClass(this.$.commandDispatcher.targets.get("markdownView"),"active"),n(this,rt)._toggleCodeViewButtons(!0)};function zv(i){if(i.key!=="Tab")return;i.preventDefault();const e=i.target,t=e.selectionStart,o=e.selectionEnd;e.value=e.value.substring(0,t)+" "+e.value.substring(o),e.selectionStart=e.selectionEnd=t+1}const jL=HL;class FL{constructor(e,t){w(this,um);w(this,pm);w(this,fm);w(this,mm);w(this,gm);w(this,si,new Map);w(this,ve,new Map);jl(this,"$",null);const{product:o,options:s}=t;this.store=new XA(o),this.$={facade:e,store:this.store},E(this,um,X3).call(this,o,s),E(this,pm,Q3).call(this),E(this,fm,J3).call(this,o),E(this,gm,t5).call(this),E(this,mm,e5).call(this),this._eventOrchestrator=new jL(this),n(this,si).get("eventManager")._bindOrchestrator(this._eventOrchestrator)}_destroy(){var t,o,s;if(this.$===null)return;const e=[];for(const[r,l]of n(this,ve))try{(t=l==null?void 0:l._destroy)==null||t.call(l)}catch(c){e.push(`[Logic:${r}] ${c.message}`)}n(this,ve).clear();try{(o=this._eventOrchestrator)==null||o._removeAllEvents()}catch(r){e.push(`[EventOrchestrator] ${r.message}`)}this._eventOrchestrator=null;for(const[r,l]of n(this,si))try{(s=l==null?void 0:l._destroy)==null||s.call(l)}catch(c){e.push(`[Config:${r}] ${c.message}`)}n(this,si).clear(),e.length>0&&console.warn("[CoreKernel._destroy] Cleanup completed with errors:",e),this.$=null,this.store._destroy(),this.store=null,this.facade=null}}si=new WeakMap,ve=new WeakMap,um=new WeakSet,X3=function(e,t){const o=new JA(e),s=new eB(this,e,t);n(this,si).set("contextProvider",o),n(this,si).set("optionProvider",s),n(this,si).set("instanceCheck",new iB(o.frameContext)),n(this,si).set("eventManager",new dB(o,s,this.$))},pm=new WeakSet,Q3=function(){const e=n(this,si).get("contextProvider"),t=n(this,si).get("optionProvider");Object.assign(this.$,{contextProvider:e,optionProvider:t,instanceCheck:n(this,si).get("instanceCheck"),eventManager:n(this,si).get("eventManager"),frameRoots:e.frameRoots,context:e.context,options:t.options,icons:e.icons,lang:e.lang,frameContext:e.frameContext,frameOptions:t.frameOptions})},fm=new WeakSet,J3=function(e){n(this,ve).set("offset",new uB(this)),n(this,ve).set("selection",new fB(this)),n(this,ve).set("html",new GB(this)),n(this,ve).set("nodeTransform",new KB(this)),n(this,ve).set("format",new gB(this)),n(this,ve).set("inline",new vB(this)),n(this,ve).set("listFormat",new wB(this)),n(this,ve).set("char",new QB(this)),n(this,ve).set("shortcuts",new eN(this)),n(this,ve).set("component",new bN(this)),n(this,ve).set("pluginManager",new yN(this,e)),n(this,ve).set("focusManager",new wN(this)),n(this,ve).set("ui",new zN(this)),n(this,ve).set("commandDispatcher",new ON(this)),n(this,ve).set("toolbar",new Ev(this,{keyName:"toolbar",balloon:this.store.mode.isBalloon,balloonAlways:this.store.mode.isBalloonAlways,inline:this.store.mode.isInline,res:e.responsiveButtons})),this.$.options.has("_subMode")&&n(this,ve).set("subToolbar",new Ev(this,{keyName:"toolbar_sub",balloon:this.store.mode.isSubBalloon,balloonAlways:this.store.mode.isSubBalloonAlways,inline:!1,res:e.responsiveButtons_sub})),n(this,ve).set("menu",new WN(this)),n(this,ve).set("viewer",new qN(this)),n(this,ve).set("finder",new YN(this)),n(this,ve).set("history",PN(this))},mm=new WeakSet,e5=function(){for(const[,e]of n(this,ve))typeof(e==null?void 0:e._init)=="function"&&e._init()},gm=new WeakSet,t5=function(){const e=n(this,ve).get("pluginManager");Object.assign(this.$,{offset:n(this,ve).get("offset"),selection:n(this,ve).get("selection"),format:n(this,ve).get("format"),inline:n(this,ve).get("inline"),listFormat:n(this,ve).get("listFormat"),html:n(this,ve).get("html"),nodeTransform:n(this,ve).get("nodeTransform"),char:n(this,ve).get("char"),component:n(this,ve).get("component"),focusManager:n(this,ve).get("focusManager"),pluginManager:e,plugins:e.plugins,ui:n(this,ve).get("ui"),commandDispatcher:n(this,ve).get("commandDispatcher"),history:n(this,ve).get("history"),shortcuts:n(this,ve).get("shortcuts"),toolbar:n(this,ve).get("toolbar"),subToolbar:n(this,ve).get("subToolbar"),menu:n(this,ve).get("menu"),viewer:n(this,ve).get("viewer"),finder:n(this,ve).get("finder")})};const WL=FL;class UL{constructor(e,t){w(this,Rl);w(this,bm);w(this,vm);w(this,ym);w(this,wm);w(this,Cm);w(this,ni,void 0);jl(this,"$");const o=OA(e,t),s=new WL(this,{product:o,options:t});x(this,ni,s),this.$=s.$,E(this,Cm,r5).call(this,t).catch(r=>{console.error("[SUNEDITOR:E_CREATE_FAIL] Failed to create editor instance.",r)})}isEmpty(e){const t=(e||this.$.frameContext).get("wysiwyg");return u.check.isZeroWidth(t.textContent)&&!t.querySelector(this.$.options.get("allowedEmptyTags"))&&(t.innerText.match(/\n/g)||"").length<=1}resetOptions(e){var t;this.$.optionProvider.reset(e),this.$.store.set("_lastSelectionNode",null),E(this,Rl,zm).call(this,this.$.frameRoots.get(this.$.store.get("rootKey")));for(const o of Object.values(this.$.plugins))(t=o.init)==null||t.call(o)}changeFrameContext(e){e!==this.$.store.get("rootKey")&&(this.$.store.set("rootKey",e),E(this,Rl,zm).call(this,this.$.frameRoots.get(e)),this.$.toolbar._resetSticky())}destroy(){this.$.options.get("hasCodeMirror")&&this.$.contextProvider.applyToRoots(e=>{const o=e.get("options").get("codeMirrorEditor");o&&o.toTextArea()}),u.utils.removeItem(this.$.context.get("toolbar_wrapper")),u.utils.removeItem(this.$.context.get("toolbar_sub_wrapper")),u.utils.removeItem(this.$.context.get("statusbar_wrapper"));for(const e in this.events)this.events[e]=null;return this.events=null,n(this,ni)._destroy(),null}}ni=new WeakMap,Rl=new WeakSet,zm=function(e){this.$.contextProvider.reset(e),this.$.optionProvider.resetFrame(e.get("options")),this.$.ui.reset(e)},bm=new WeakSet,i5=function(e){this.$.store.set("initViewportHeight",ge._w.visualViewport.height),n(this,ni)._eventOrchestrator.__setViewportSize(),this.$.store.set("_canUseBeforeInput",ge.canUseBeforeInput()),this.$.contextProvider.init(),E(this,Rl,zm).call(this,this.$.frameRoots.get(this.$.store.get("rootKey"))),E(this,ym,s5).call(this,e),this.$.contextProvider.applyToRoots(t=>{n(this,ni)._eventOrchestrator._addFrameEvents(t),E(this,vm,o5).call(this,t,t.get("options").get("value")),t.get("options").get("iframe")&&t.get("options").get("height")==="auto"&&this.$.ui._emitResizeEvent(t,t.get("wysiwygFrame").offsetHeight,null)}),n(this,ni)._eventOrchestrator.__eventDoc=null,this.$.store._editorInitFinished=!0,this.$.pluginManager.checkFileInfo(!0),this.$.history.reset(),ge._w.setTimeout(()=>{var t,o;if(!((t=this.$.context)!=null&&t.size)){console.warn("[SUNEDITOR:E_INIT_FAIL] Editor instance was destroyed before initialization completed. Check if destroy() was called.");return}this.$.context.get("toolbar_main").style.visibility="",this.$.contextProvider.applyToRoots(s=>{n(this,ni)._eventOrchestrator._wwFrameObserver&&n(this,ni)._eventOrchestrator._wwFrameObserver.observe(s.get("wysiwygFrame")),n(this,ni)._eventOrchestrator._toolbarObserver&&n(this,ni)._eventOrchestrator._toolbarObserver.observe(s.get("_toolbarShadow")),this.$.ui._syncFrameState(s)});for(const s of Object.values(this.$.plugins))(o=s.init)==null||o.call(s);this.$.selection.__init(),this.$.eventManager.triggerEvent("onload",{})},0)},vm=new WeakSet,o5=function(e,t){e.get("wysiwyg").innerHTML=this.$.html.clean(typeof t=="string"?t:(/^TEXTAREA$/i.test(e.get("originElement").nodeName)?e.get("originElement").value:e.get("originElement").innerHTML)||"",{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.$.options.get("freeCodeViewMode")})||"<"+this.$.options.get("defaultLine")+"><br></"+this.$.options.get("defaultLine")+">",e.has("charCounter")&&(e.get("charCounter").textContent=String(this.$.char.getLength())),e.has("wordCounter")&&(e.get("wordCounter").textContent=String(this.$.char.getWordCount())),this.$.options.get("type")==="document"&&(e.set("documentType",new YA(n(this,ni),e)),e.get("documentType").useHeader&&e.set("documentType_use_header",!0),e.get("documentType").usePage&&(e.set("documentType_use_page",!0),e.get("documentTypePageMirror").innerHTML=e.get("wysiwyg").innerHTML))},ym=new WeakSet,s5=function(e){this.$.pluginManager.init(e),this.$.shortcuts._registerShortcuts(),this.$.commandDispatcher._initCommandButtons(),this.$.ui.init()},wm=new WeakSet,n5=function(e,t,o){e.contentDocument.documentElement.className="sun-editor",e.contentDocument.head.innerHTML='<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">'+Te._setIframeStyleLinks(o.get("iframe_cssFileName"))+Te._setAutoHeightStyle(o.get("height")),e.contentDocument.body.className=t.get("_editableClass"),e.contentDocument.body.setAttribute("contenteditable","true"),t.get("_rtl")&&(e.contentDocument.body.dir="rtl")},Cm=new WeakSet,r5=async function(e){n(this,ni)._eventOrchestrator._addCommonEvents();const t=[];this.$.contextProvider.applyToRoots(o=>{const s=o.get("originElement"),r=o.get("topArea");if(s.style.display="none",r.style.display="block",s.parentNode.insertBefore(r,s.nextElementSibling),o.get("options").get("iframe")){const l=new Promise(c=>{const d=h=>{E(this,wm,n5).call(this,h,this.$.optionProvider.options,o.get("options")),c()};if(ge.isGecko){let h=null;this.$.eventManager.addEvent(o.get("wysiwygFrame"),"load",({target:p})=>{clearTimeout(h),h=setTimeout(()=>{this.$&&d(p)},60)})}else this.$.eventManager.addEvent(o.get("wysiwygFrame"),"load",({target:h})=>{d(h)})});t.push(l)}}),this.$.contextProvider.applyToRoots(o=>{o.get("wrapper").appendChild(o.get("wysiwygFrame")),o.get("documentTypeInner")&&o.get("wrapper").insertBefore(o.get("documentTypeInner"),o.get("wysiwygFrame")),o.get("documentTypePage")&&(o.get("wrapper").appendChild(o.get("documentTypePage")),o.get("wrapper").appendChild(o.get("documentTypePageMirror"))),o.get("blockHandleArea")&&o.get("wrapper").insertBefore(o.get("blockHandleArea"),o.get("wysiwygFrame"))}),t.length>0&&await Promise.all(t),E(this,bm,i5).call(this,e)};const qL=UL,ZL={init(i){return{create:(e,t)=>this.create(e,t,i)}},create(i,e,t){if(typeof e!="object"&&(e={}),t&&(e=(()=>[t,e].reduce((s,r)=>(Object.entries(r).forEach(([l,c])=>{if(l==="plugins"&&c&&s[l]){const d=Array.isArray(s[l])?s[l]:Object.values(s[l]),h=Array.isArray(c)?c:Object.values(c);s[l]=[...h.filter(p=>!d.includes(p)),...d]}else s[l]=c}),s),{}))()),!i)throw Error('[SUNEDITOR.create.fail] The first parameter "target" is missing.');const o=[];if(typeof i=="string"){const s=document.querySelector(i);if(!s)throw Error(`[SUNEDITOR.create.fail]-[document.querySelector(${i})] Cannot find target element. Make sure "${i}" is a valid selector and exists in the document.`);o.push({key:null,target:s})}else if(i.nodeType===1)o.push({key:null,target:i});else{let s;for(const r in i){if(s=i[r],!s.target||s.target.nodeType!==1)throw Error(`[SUNEDITOR.create.fail] suneditor multi root requires textarea's element at the "target" property.`);s.key=r,o.push(s)}}return new qL(o,e)}},LR="",IR="",qg=a.defineComponent({__name:"AoRichTextEditor",props:{modelValue:{default:""},readonly:{type:Boolean,default:!1},placeholder:{default:""}},emits:["update:modelValue","blur","focus"],setup(i,{emit:e}){const t=i,o=e,s=a.ref(null),r=a.shallowRef(null),l=a.ref(t.modelValue??""),c=a.ref(!1),d=p=>({value:p,placeholder:t.placeholder,width:"100%",minHeight:"100px",statusBar:!1,charCounter:!1,buttonList:[["bold","italic","underline","strike"],["ul","ol"]],editable:!t.readonly,attributesWhitelist:{all:{"data-mention":"data-mention"}},defaultStyle:`
|
|
225
225
|
font-family: inherit;
|
|
226
226
|
font-size: inherit;
|
|
227
227
|
line-height: 1.5;
|