suneditor 3.2.2 → 3.2.4

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.
Files changed (39) hide show
  1. package/dist/suneditor.min.css +1 -1
  2. package/dist/suneditor.min.js +1 -1
  3. package/package.json +1 -1
  4. package/src/assets/suneditor.css +6 -1
  5. package/src/core/editor.js +2 -0
  6. package/src/core/event/actions/index.js +26 -2
  7. package/src/core/event/effects/keydown.registry.js +83 -4
  8. package/src/core/event/eventOrchestrator.js +20 -3
  9. package/src/core/event/handlers/handler_ww_input.js +12 -5
  10. package/src/core/event/handlers/handler_ww_key.js +10 -7
  11. package/src/core/event/ports.js +16 -8
  12. package/src/core/event/reducers/keydown.reducer.js +19 -9
  13. package/src/core/event/rules/keydown.rule.backspace.js +15 -0
  14. package/src/core/event/rules/keydown.rule.delete.js +29 -0
  15. package/src/core/event/rules/keydown.rule.enter.js +15 -8
  16. package/src/core/kernel/store.js +2 -0
  17. package/src/core/logic/dom/html.js +13 -1
  18. package/src/core/logic/panel/blockHandle.js +50 -14
  19. package/src/core/logic/shell/ui.js +7 -5
  20. package/src/core/schema/options.js +4 -2
  21. package/src/core/section/constructor.js +15 -0
  22. package/src/helper/converter.js +3 -2
  23. package/src/helper/env.js +51 -0
  24. package/src/helper/markdown.js +3 -1
  25. package/src/modules/contract/Browser.js +2 -2
  26. package/src/modules/ui/CommandMenu.js +1 -1
  27. package/src/plugins/dropdown/table/index.js +3 -2
  28. package/src/plugins/field/slashCommand.js +17 -1
  29. package/types/core/event/actions/index.d.ts +4 -1
  30. package/types/core/event/effects/keydown.registry.d.ts +9 -2
  31. package/types/core/event/eventOrchestrator.d.ts +14 -3
  32. package/types/core/event/handlers/handler_ww_key.d.ts +1 -0
  33. package/types/core/event/ports.d.ts +8 -6
  34. package/types/core/event/reducers/keydown.reducer.d.ts +15 -5
  35. package/types/core/kernel/store.d.ts +5 -0
  36. package/types/core/schema/options.d.ts +7 -4
  37. package/types/helper/env.d.ts +10 -0
  38. package/types/helper/index.d.ts +1 -0
  39. package/types/plugins/field/slashCommand.d.ts +34 -2
@@ -1 +1 @@
1
- (()=>{var t={cfbI(t){var e,s;e="undefined"!=typeof window?window:this,s=function(t,e){const s={code:"en",align:"Align",alignBottom:"Align bottom",alignCenter:"Align center",alignJustify:"Align justify",alignLeft:"Align left",alignMiddle:"Align middle",alignRight:"Align right",alignTop:"Align top",anchor:"Anchor",asBlock:"As a block",asInline:"As a inline",asLink:"As a link",audio:"Audio",audioGallery:"Audio gallery",audio_modal_file:"Select from files",audio_modal_title:"Insert Audio",audio_modal_url:"Audio URL",autoSize:"Auto size",backgroundColor:"Background color",basic:"Basic",blockStyle:"Block style",bold:"Bold",border:"Border",border_all:"Border all",border_inside:"Border inside",border_horizontal:"Border horizontal",border_vertical:"Border vertical",border_outside:"Border outside",border_left:"Border left",border_top:"Border top",border_right:"Border right",border_bottom:"Border bottom",border_none:"Border none",bulletedList:"Bulleted list",cancel:"Cancel",caption:"Insert description",cellProperties:"Cell properties",center:"Center",close:"Close",codeView:"Code view",color:"Color",colorPicker:"Color picker",column:"Column",comment:"Comments",commentAdd:"Add comment",commentShow:"Show comments",copy:"Copy",copyFormat:"Paint Formatting",cut:"Cut",default:"Default",deleteColumn:"Delete column",deleteRow:"Delete row",dir_ltr:"Left to right",dir_rtl:"Right to left",download:"Download",drag:"Drag",drawing:"Drawing",drawing_modal_title:"Drawing",edit:"Edit",embed:"Embed",embed_modal_title:"Embed",embed_modal_source:"Embed Source / URL",exportPDF:"Export to PDF",exportWord:"Export to Word",find:"Find",decrease:"Decrease",increase:"Increase",fileBrowser:"File browser",fileGallery:"File gallery",fileUpload:"File upload",fixedColumnWidth:"Fixed column width",font:"Font",fontColor:"Font color",fontSize:"Size",formats:"Formats",fullScreen:"Full screen",height:"Height",horizontalLine:"Horizontal line",horizontalSplit:"Horizontal split",hr_dashed:"Dashed",hr_dotted:"Dotted",hr_solid:"Solid",id:"ID",image:"Image",imageGallery:"Image gallery",image_modal_altText:"Alternative text",image_modal_file:"Select from files",image_modal_title:"Insert image",image_modal_url:"Image URL",importWord:"Import from Word",indent:"Indent",inlineStyle:"Inline style",insertColumnAfter:"Insert column after",insertColumnBefore:"Insert column before",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",insertLine:"Insert line",italic:"Italic",layout:"Layout",left:"Left",lineHeight:"Line height",link:"Link",link_modal_bookmark:"Bookmark",link_modal_downloadLinkCheck:"Download link",link_modal_newWindowCheck:"Open in new window",link_modal_text:"Text to display",link_modal_title:"Insert Link",link_modal_url:"URL to link",link_modal_relAttribute:"Rel attribute",list:"List",markdownView:"Markdown view",math:"Math",math_modal_fontSizeLabel:"Font Size",math_modal_inputLabel:"Mathematical Notation",math_modal_previewLabel:"Preview",math_modal_title:"Math",maxSize:"Max size",mediaGallery:"Media gallery",menu_bordered:"Bordered",menu_code:"Code",menu_neon:"Neon",menu_shadow:"Shadow",menu_spaced:"Spaced",menu_translucent:"Translucent",mergeCells:"Merge cells",minSize:"Min size",mirrorHorizontal:"Mirror, Horizontal",mirrorVertical:"Mirror, Vertical",newDocument:"New document",numberedList:"Numbered list",outdent:"Outdent",pageBreak:"Page break",pageDown:"Page down",pageNumber:"Page number",pageUp:"Page up",paragraphStyle:"Paragraph style",preview:"Preview",print:"print",proportion:"Constrain proportions",ratio:"Ratio",redo:"Redo",remove:"Remove",removeFormat:"Remove Format",replace:"Replace",replaceAll:"Replace all",resize100:"Zoom 100%",resize25:"Zoom 25%",resize50:"Zoom 50%",resize75:"Zoom 75%",resize:"Resize",revert:"Revert",revisionHistory:"Revision History",right:"Right",rotateLeft:"Rotate left",rotateRight:"Rotate right",row:"Row",save:"Save",search:"Search",selectAll:"Select All",showBlocks:"Show blocks",size:"Size",splitCells:"Split cells",strike:"Strike",submitButton:"Submit",subscript:"Subscript",superscript:"Superscript",table:"Table",tableHeader:"Table header",tableProperties:"Table properties",tags:"Tags",tag_blockquote:"Quote",codeBlock:"Code Block",tag_div:"Normal (DIV)",tag_h:"Header",tag_p:"Paragraph",tag_pre:"Code",template:"Template",textStyle:"Text style",title:"Title",underline:"Underline",undo:"Undo",unmergeCells:"Unmerge cells",unlink:"Unlink",verticalSplit:"Vertical split",video:"Video",videoGallery:"Video gallery",video_modal_file:"Select from files",video_modal_title:"Insert Video",video_modal_url:"Media embed URL, YouTube/Vimeo",width:"Width",codeLanguage:"Language",codeLanguage_none:"None",finder_matchCase:"Match Case",finder_wholeWord:"Whole Word",finder_regex:"Regular Expression",finder_prev:"Previous Match",finder_next:"Next Match",message_copy_success:"Copied to clipboard",message_copy_fail:"Copy failed. Please copy manually."};return void 0===e&&(t.SUNEDITOR_LANG||Object.defineProperty(t,"SUNEDITOR_LANG",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(t.SUNEDITOR_LANG,"en",{enumerable:!0,writable:!0,configurable:!0,value:s})),s},"object"==typeof t.exports?t.exports=e.document?s(e,!0):function(t){if(!t.document)throw new Error("SUNEDITOR_LANG a window with a document");return s(t)}:s(e)}},e={};function s(i){var n=e[i];if(void 0!==n)return n.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,s),o.exports}s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";var t={};s.r(t),s.d(t,{Browser:()=>El,ColorPicker:()=>gr,Controller:()=>ki,Figure:()=>Pi,HueSlider:()=>dr,Modal:()=>vr});var e={};s.r(e),s.d(e,{ApiManager:()=>kl,FileManager:()=>yr});var i={};s.r(i),s.d(i,{CommandMenu:()=>ln,ModalAnchorEditor:()=>_r,SelectMenu:()=>Ei,_DragHandle:()=>fi});var n={};s.r(n),s.d(n,{EditorComponent:()=>nc,ModuleBrowser:()=>ec,ModuleColorPicker:()=>sc,ModuleController:()=>tc,ModuleHueSlider:()=>ic,ModuleModal:()=>Qh,PluginBrowser:()=>kr,PluginCommand:()=>Sr,PluginDropdown:()=>Er,PluginDropdownFree:()=>Tr,PluginField:()=>Mr,PluginInput:()=>Hr,PluginModal:()=>Lr,PluginPopup:()=>Nr});const o=window,l=document,r=Symbol("noEventHandler"),a=Symbol("onOverComponent"),h=navigator.userAgent.toLowerCase();const c="function"==typeof ResizeObserver,d="function"==typeof navigator.clipboard?.write,u=/Edg/.test(navigator.userAgent),p=/(Mac|iPhone|iPod|iPad)/.test(navigator.userAgent),g=h.includes("chrome/")&&!h.includes("edge/"),m=!!h.match(/gecko\/\d+/),f=!!o.chrome,v=h.includes("applewebkit/")&&!h.includes("chrome"),b=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(h),y=navigator.maxTouchPoints>0&&"ontouchstart"in o,C=h.includes("android"),w=p?"⌘":"CTRL",_=p?"⇧":"+SHIFT",x=o.devicePixelRatio,$={_w:o,_d:l,NO_EVENT:r,ON_OVER_COMPONENT:a,getXMLHttpRequest:function(){return new XMLHttpRequest},getPageStyle:function(t){let e="";const s=(t||l).styleSheets;for(let t,i=0,n=s.length;i<n;i++){try{t=s[i].cssRules}catch{continue}if(t)for(let s=0,i=t.length;s<i;s++)e+=t[s].cssText}return e},getIncludePath:function(t,e){let s="";const i=[],n="js"===e?"script":"link",o="js"===e?"src":"href";let r="(?:";for(let e=0,s=t.length;e<s;e++)r+=t[e]+(e<s-1?"|":")");const a=new RegExp(`(^|.*[\\/])${r}(\\.[^\\/]+)?.${e}(?:\\?.*|;.*)?$`,"i"),h=new RegExp(`.+\\.${e}(?:\\?.*|;.*)?$`,"i");for(let t=l.getElementsByTagName(n),e=0;e<t.length;e++)h.test(t[e][o])&&i.push(t[e]);for(let t=0;t<i.length;t++){const e=i[t][o].match(a);if(e){s=e[0];break}}if(!s)throw new Error("[SUNEDITOR.helper.env.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (path: +"+s+", extension: "+e+")");return""===s&&(s=i.length>0?i[0][o]:""),s.includes(":/")||"//"===s.slice(0,2)||(s=!1===s.includes("/")?location.href.match(/^.*?:\/\/[^/]*/)[0]+s:location.href.match(/^[^?]*\/(?:)/)[0]+s),s},isResizeObserverSupported:c,isClipboardSupported:d,isEdge:u,isBlink:g,isGecko:m,isChromium:f,isSafari:v,isOSX_IOS:p,isAndroid:C,isMobile:b,isTouchDevice:y,cmdIcon:w,shiftIcon:_,DPI:x,KATEX_WEBSITE:"https://katex.org/docs/supported.html",MATHJAX_WEBSITE:"https://www.mathjax.org/"},k=8203,S=String.fromCharCode(k),E=new RegExp(String.fromCharCode(k),"g"),T=new RegExp("^"+String.fromCharCode(k)+"+$");const M={zeroWidthSpace:S,zeroWidthRegExp:E,onlyZeroWidthRegExp:T,escapeStringRegexp:function(t){if("string"!=typeof t)throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}},H=/&|\u00A0|'|"|<|>/g,L=/&amp;|&nbsp;|&apos;|&quot;|&lt;|&gt;/g,N={"&":"&amp;"," ":"&nbsp;","'":"&apos;",'"':"&quot;","<":"&lt;",">":"&gt;"},A={"&amp;":"&","&nbsp;":" ","&apos;":"'","&quot;":'"',"&lt;":"<","&gt;":">"},B=/[A-Z]/g,I=/-[a-zA-Z]/g,V={"xx-small":.5625,"x-small":.625,small:.8333,medium:1,large:1.125,"x-large":1.5,"xx-large":2,"xxx-large":2.5};function O(t){if(3===t.nodeType){const e=t.nodeValue.trim();return e?{type:"text",content:e}:null}if(1===t.nodeType){const e={type:"element",tag:t.tagName.toLowerCase(),attributes:{},children:[]};for(const s of t.attributes)e.attributes[s.name]=s.value;for(const s of t.childNodes){const t=O(s);t&&e.children.push(t)}return e}return null}function R(t){return t.replace(H,(t=>N[t]||t))}function P(t){return/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(t)}const z={htmlToJson:function(t){return O((new DOMParser).parseFromString(t,"text/html").body)},jsonToHtml:function t(e){if(!e)return"";if("text"===e.type)return R(e.content||"");if("element"===e.type){const{tag:s,attributes:i={},children:n=[]}=e,o=Object.entries(i).map((([t,e])=>`${t}="${R(e)}"`)).join(" "),l=`</${s}>`;return`${o?`<${s} ${o}>`:`<${s}>`}${n.map(t).join("")}${l}`}return""},htmlToEntity:R,entityToHTML:function(t){return t.replace(L,(t=>A[t]||t))},debounce:function(t,e){let s;function i(...i){o.clearTimeout(s),s=o.setTimeout((()=>{s=null,t(...i)}),e)}return i.cancel=()=>{o.clearTimeout(s),s=null},i},syncMaps:function(t,e){e.forEach(((e,s)=>{t.set(s,e)})),t.forEach(((s,i)=>{e.has(i)||t.delete(i)}))},mergeMaps:function(...t){const e=t.filter((t=>t instanceof Map)).flatMap((t=>[...t]));return new Map(e)},getValues:function(t){return t?Object.keys(t).map((function(e){return t[e]})):[]},camelToKebabCase:function t(e){return"string"==typeof e?e.replace(B,(t=>"-"+t.toLowerCase())):e.map((function(e){return t(e)}))},kebabToCamelCase:function t(e){return"string"==typeof e?e.replace(I,(t=>t.replace("-","").toUpperCase())):e.map((function(e){return t(e)}))},toFontUnit:function(t,e){const s=e.match(/(\d+(?:\.\d+)?)(.+)/),i=s?Number(s[1]):V[e],n=s?s[2]:"rem";let o=i;switch(/em/.test(n)?o=Math.round(i/.0625):"pt"===n?o=Math.round(1.333*i):"%"===n&&(o=i/100),t){case"em":case"rem":return(.0625*o).toFixed(2)+t;case"%":return 100*Number((.0625*o).toFixed(2))+t;case"pt":return Math.round(o/1.333)+t;default:return o+t}},nodeListToArray:function(t){return t?Array.prototype.slice.call(t):[]},swapKeyValue:function(t){const e={},s=Object.prototype.hasOwnProperty;for(const i in t)s.call(t,i)&&(e[t[i]]=i);return e},createElementWhitelist:function(t){return new RegExp(`<\\/?\\b(?!\\b${(t||"").replace(/\|/g,"\\b|\\b")}\\b)[^>]*>`,"gi")},createElementBlacklist:function(t){return new RegExp(`<\\/?\\b(?:\\b${(t||"^").replace(/\|/g,"\\b|\\b")}\\b)[^>]*>`,"gi")},isHexColor:P,rgb2hex:function(t){if(P(t)||!t)return t;const e=t.match(/^rgba?[\s+]?\(([\d]+)[\s+]?,[\s+]?([\d]+)[\s+]?,[\s+]?([\d]+)[\s+]?/i);if(e&&e.length>=4){const s=("0"+parseInt(e[1],10).toString(16)).slice(-2),i=("0"+parseInt(e[2],10).toString(16)).slice(-2),n=("0"+parseInt(e[3],10).toString(16)).slice(-2);let o="";if(t.includes("rgba")){const e=t.match(/,\s*([\d]+\.?[\d]*)\s*\)/);e&&(o=("0"+Math.round(255*parseFloat(e[1])).toString(16)).slice(-2))}return`#${s}${i}${n}${o}`}return t},getWidthInPercentage:function(t,e){const s=e||t.parentElement,i=o.getComputedStyle(s),n=parseFloat(i.paddingLeft),l=parseFloat(i.paddingRight),r=s.offsetWidth-s.clientWidth,a=s.offsetWidth-n-l-r;return t.offsetWidth/a*100},textToAnchor:function(t){const e=/https?:\/\/[^\s]+/g;if(3===t.nodeType&&e.test(t.textContent)&&!/^A$/i.test(t.parentNode?.nodeName)){const s=t.textContent,i=l.createDocumentFragment();let n=0;return s.replace(e,((t,e)=>{e>n&&i.appendChild(l.createTextNode(s.slice(n,e)));const o=l.createElement("a");return o.href=t,o.target="_blank",o.textContent=t,i.appendChild(o),n=e+t.length,t})),n<s.length&&i.appendChild(l.createTextNode(s.slice(n))),t.parentNode.replaceChild(i,t),!0}return!1},spanToStyleNode:function(t,e){if(1===e.nodeType&&/^SPAN$/i.test(e.nodeName)&&e.hasAttribute("style")){const s=e.getAttribute("style"),i=[];if(Object.keys(t).forEach((e=>{if(t[e].regex.test(s)){const s=l.createElement(t[e].tag);i.push(s)}})),i.length>0){const t=l.createElement("span");let s=e.firstChild;i.forEach(((e,s)=>{0===s?t.appendChild(e):i[s-1].appendChild(e)}));const n=i[i.length-1];for(;s;){const t=s.nextSibling;n.appendChild(s),s=t}e.appendChild(t)}}},addUrlQuery:function(t,e){if(e.length>0)if(/\?/.test(t)){const s=t.split("?");t=s[0]+"?"+e+"&"+s[1]}else t+="?"+e;return t},_setDefaultOptionStyle:function(t,e){let s="";t.get("height")&&(s+="height:"+t.get("height")+";"),t.get("minHeight")&&(s+="min-height:"+t.get("minHeight")+";"),t.get("maxHeight")&&(s+="max-height:"+t.get("maxHeight")+";"),t.get("width")&&(s+="width:"+t.get("width")+";"),t.get("minWidth")&&(s+="min-width:"+t.get("minWidth")+";"),t.get("maxWidth")&&(s+="max-width:"+t.get("maxWidth")+";");let i="",n="",o="";const l=(e=s+e).split(";");for(let e,s=0,r=l.length;s<r;s++)e=l[s].trim(),e&&(/^(min-|max-)?width\s*:/.test(e)||/^(z-index|position|display)\s*:/.test(e)?i+=e+";":/^(min-|max-)?height\s*:/.test(e)?(/^height/.test(e)&&"auto"===e.split(":")[1].trim()&&t.set("height","auto"),n+=e+";"):o+=e+";");return{top:i,frame:n,editor:o}},_setIframeStyleLinks:function(t){let e="";if(t){const s=l.getElementsByTagName("link");for(let i,n=0,o=t.length;n<o;n++){i=[];const o=t[n];if("*"===o)for(let t=0,e=s.length;t<e;t++)"stylesheet"===s[t].rel&&s[t].href&&i.push(s[t].href);else if(/(^https?:\/\/)|(^data:text\/css,)/.test(o))i.push(o);else{const t=new RegExp(`(^|.*[\\/])${o}(\\..+)?.css((\\??.+?)|\\b)$`,"i");for(let e,n=0,o=s.length;n<o;n++)e=s[n].href.match(t),e&&i.push(e[0])}if(!i||0===i.length)throw new Error('[SUNEDITOR.constructor.iframe.fail] The suneditor CSS files installation path could not be automatically detected. Please set the option property "iframe_cssFileName" before creating editor instances.');for(let t=0,s=i.length;t<s;t++)e+='<link href="'+i[t]+'" rel="stylesheet">'}}return e},_setAutoHeightStyle:function(t){return"auto"===t?"<style>\n/** Iframe height auto */\nbody{height: min-content; overflow: hidden;}\n</style>":""}},F=z,D=/(\s|^)(katex|MathJax|se-exclude-format)(\s|$)/;function q(t){if(null==t)return!1;if("string"!=typeof t){if(W(t)){const e=t.children;for(let t=0,s=e.length;t<s;t++){if(!K(e[t]))return!1}}t=t.textContent}return""===t||T.test(t)}function W(t){return 1===t?.nodeType}function U(t){return/^(OL|UL)$/i.test("string"==typeof t?t:t?.nodeName)}function Z(t){return/^TABLE$/i.test("string"==typeof t?t:t?.nodeName)}function G(t){return/^(TD|TH)$/i.test("string"==typeof t?t:t?.nodeName)}function j(t){return/^BR$/i.test("string"==typeof t?t:t?.nodeName)}function K(t){return/^(BR|COLGROUP|COL|THEAD|TBODY|TFOOT|TR|AREA|BASE|EMBED|HR|IMG|INPUT|KEYGEN|LINK|META|PARAM|SOURCE|TRACK|WBR)$/i.test("string"==typeof t?t:t?.nodeName)}function Y(t){if(1!==t?.nodeType)return!1;const e=t.classList;return!!e&&(e.contains("se-component")||e.contains("se-flex-component"))}function X(t){if(1!==t?.nodeType)return!1;const e=t.classList;return!!e&&("BODY"===t.nodeName.toUpperCase()||e.contains("se-wrapper-wysiwyg")||e.contains("sun-editor-carrier-wrapper")||e.contains("se-wrapper"))}function J(t){return t?.hasAttribute("data-important-disabled")}const Q={isZeroWidth:q,isEdgePoint:function(t,e,s){return"end"!==s&&0===e||(!s||"front"!==s)&&!t.nodeValue&&e<=1||(!s||"end"===s)&&t.nodeValue&&e>=t.nodeValue.length},isText:function(t){return 3===t?.nodeType},isElement:W,isInputElement:function(t){return W(t)&&/^(INPUT|TEXTAREA|SELECT|OPTION)$/i.test(t.nodeName)},isButtonElement:function(t){return W(t)&&/^(BUTTON)$/i.test(t.nodeName)},isList:U,isListCell:function(t){return/^LI$/i.test("string"==typeof t?t:t?.nodeName)},isTable:Z,isTableElements:function(t){return/^(TABLE|THEAD|TBODY|TR|TH|TD|COL)$/i.test("string"==typeof t?t:t?.nodeName)},isTableCell:G,isTableRow:function(t){return/^TR$/i.test("string"==typeof t?t:t?.nodeName)},isBreak:j,isAnchor:function(t){return/^A$/i.test("string"==typeof t?t:t?.nodeName)},isMedia:function(t){return/^(IMG|IFRAME|AUDIO|VIDEO|CANVAS)$/i.test("string"==typeof t?t:t?.nodeName)},isIFrame:function(t){return/^IFRAME$/i.test("string"==typeof t?t:t?.nodeName)},isFigure:function(t){return/^FIGURE$/i.test("string"==typeof t?t:t?.nodeName)},isContentLess:K,isEmptyLine:function(t){if(!t?.parentNode)return!0;const e=t;return!e.querySelector("IMG, IFRAME, AUDIO, VIDEO, CANVAS, TABLE")&&(e.children.length<=1||j(e.firstElementChild))&&q(e.textContent)},isComponentContainer:Y,isWysiwygFrame:X,isNonEditable:function(t){return 1===t?.nodeType&&"false"===t.getAttribute("contenteditable")},isSpanWithoutAttr:function(t){if(1!==t?.nodeType)return!1;const e=t;return/^SPAN$/i.test(e.nodeName)&&!e.className&&0===e.style.length},isSameAttributes:function(t,e){if(3===t.nodeType&&3===e.nodeType)return!0;if(3===t.nodeType||3===e.nodeType)return!1;const s=t,i=e,n=s.style,o=i.style;let l=0;for(let t=0,e=n.length;t<e;t++)n[n[t]]===o[n[t]]&&l++;const r=s.classList,a=i.classList;let h=0;for(let t=0,e=r.length;t<e;t++)a.contains(r[t])&&h++;return l===o.length&&l===n.length&&h===a.length&&h===r.length},isExcludeFormat:function(t){return D.test(t?.className)},isUneditable:function(t){return t?.classList.contains("__se__uneditable")},isImportantDisabled:J},tt=Q;function et(t){const e=Object.prototype.toString.call(t);return"[object HTMLCollection]"===e||"[object NodeList]"===e||"[object Array]"===e}function st(t,e,s){const i=l.createElement(t);if(e)for(const t in e)void 0!==e[t]&&null!==e[t]&&i.setAttribute(t,e[t]);return s&&("string"==typeof s?i.innerHTML=s:"object"==typeof s&&i.appendChild(s)),i}function it(t){return l.createTextNode(t||"")}function nt(t,e){let s=-1;for(let i=0,n=t.length;i<n;i++)if(t[i]===e){s=i;break}return s}const ot=/(\s|^)(se-block-hover|se-block-dragging)(?=\s|$)/g;function lt(t,e,s){const i=t,n=e;if(n.style.length>0){const t=n.style;for(let e=0,s=t.length;e<s;e++)i.style[t[e]]=t[t[e]]}const o=n.attributes;for(let t,e=0,n=o.length;e<n;e++)if(t=o[e].name.toLowerCase(),s?.includes(t)||!o[e].value)i.removeAttribute(t);else if("style"!==t)if("class"===t){const t=o[e].value.replace(ot," ").replace(/\s+/g," ").trim();t?i.setAttribute("class",t):i.removeAttribute("class")}else i.setAttribute(o[e].name,o[e].value)}function rt(t,e){if(t&&1===t.nodeType)return e.split("|").some((e=>t.classList.contains(e)))}function at(t,e){if(!t)return;const s=et(t)?t:[t],i=e.split("|");for(let t=0,e=s.length;t<e;t++){const e=s[t];if(e&&1===e.nodeType)for(const t of i)t&&e.classList.add(t)}}function ht(t,e){if(!t)return;const s=et(t)?t:[t],i=e.split("|");for(let t=0,e=s.length;t<e;t++){const e=s[t];if(e&&1===e.nodeType)for(const t of i)t&&e.classList.remove(t)}}function ct(t=l){return{w:t.documentElement.clientWidth,h:t.documentElement.clientHeight}}const dt={clone:function(t,e=!1){return t.cloneNode(e)},createElement:st,createTextNode:it,getAttributesToString:function(t,e){const s=t.attributes;if(!s)return"";let i="";for(let t=0,n=s.length;t<n;t++)e?.includes(s[t].name)||(i+=s[t].name+'="'+R(s[t].value)+'" ');return i},arrayFilter:function(t,e){if(!t||0===t.length)return null;e||=()=>!0;const s=[];for(let i,n=0,o=t.length;n<o;n++)i=t[n],e(i)&&s.push(i);return s},arrayFind:function(t,e){if(!t||0===t.length)return null;e||=()=>!0;for(let s,i=0,n=t.length;i<n;i++)if(s=t[i],e(s))return s;return null},arrayIncludes:function(t,e){for(let s=0;s<t.length;s++)if(t[s]===e)return!0;return!1},getArrayIndex:nt,nextIndex:function(t,e){const s=nt(t,e);return-1===s?-1:s+1},prevIndex:function(t,e){const s=nt(t,e);return-1===s?-1:s-1},copyTagAttributes:lt,copyFormatAttributes:function(t,e){const s=e.cloneNode(!1);s.className=s.className.replace(/(\s|^)__se__format__[^\s]+/g,""),lt(t,s)},removeItem:function(t){t&&("remove"in t&&"function"==typeof t.remove?t.remove():t.parentNode&&t.parentNode.removeChild(t))},changeElement:function(t,e){if(t)if("string"==typeof e)if("outerHTML"in t)t.outerHTML=e;else{const s=st("DIV");s.innerHTML=e,t.parentNode.replaceChild(s.firstChild,t)}else 1===e?.nodeType&&t.parentNode.replaceChild(e,t)},changeTxt:function(t,e){t&&e&&(t.textContent=e)},setStyle:function(t,e,s){for(let i,n=0,o=(t=Array.isArray(t)?t:[t]).length;n<o;n++)i=t[n],i.style[e]=s,0===i.style.length&&i.removeAttribute("style")},getStyle:function(t,e){if(1===t?.nodeType)return t.style[e]},setDisabled:function(t,e,s){for(let i=0,n=t.length;i<n;i++){const n=t[i];!s&&J(n)||(n.disabled=e),s&&(e?n.setAttribute("data-important-disabled",""):n.removeAttribute("data-important-disabled"))}},hasClass:rt,addClass:at,removeClass:ht,toggleClass:function(t,e,s){if(!t||1!==t.nodeType)return;const i=t;i.classList.toggle(e,s),i.className.trim()||i.removeAttribute("class")},flashClass:function(t,e,s=120){at(t,e),o.setTimeout((()=>{ht(t,e)}),s)},getClientSize:ct,getViewportSize:function(){return"visualViewport"in o?{top:o.visualViewport.pageTop,left:o.visualViewport.pageLeft,scale:o.visualViewport.scale}:{top:0,left:0,scale:1}},applyInlineStylesAll:function(t,e,s){if(!t)return console.warn('"parentTarget" is not exist'),null;let i=t;const n=l.createElement("DIV");if(n.style.display="none",/body/i.test(i.nodeName)){const t=l.createElement("DIV"),e=i.attributes;for(let s=0,i=e.length;s<i;s++)t.setAttribute(e[s].name,e[s].value);t.innerHTML=i.innerHTML,i=t}else i=i.cloneNode(!0);n.appendChild(i),l.body.appendChild(n);const r=Array.from(i.querySelectorAll("*")),a=e?[i].concat(r):r;for(let t,e=0;t=a[e];e++){if(1!==t.nodeType)continue;const e=o.getComputedStyle(t),i=t.style;for(const t of s)i.setProperty(t,e.getPropertyValue(t)||"")}return l.body.removeChild(n),i},waitForMediaLoad:function(t,e=5e3){const s=t||l;return new Promise((t=>{const i=["img","video","audio","iframe"].flatMap((t=>Array.from(s.querySelectorAll(t))));if(0===i.length)return void t();const n=i.map((t=>{if(function(t){return"[object HTMLImageElement]"===Object.prototype.toString.call(t)}(t)){if(t.complete)return Promise.resolve()}else if(function(t){const e=Object.prototype.toString.call(t);return"[object HTMLVideoElement]"===e||"[object HTMLAudioElement]"===e}(t)){if(t.readyState>=2)return Promise.resolve()}else if(function(t){return"[object HTMLIFrameElement]"===Object.prototype.toString.call(t)}(t))try{if("complete"===t.contentDocument?.readyState)return Promise.resolve()}catch(t){console.warn(["[SUNEDITOR] Iframe load error",t])}return new Promise((e=>{t.addEventListener("load",e,{once:!0}),t.addEventListener("error",e,{once:!0})}))}));Promise.race([Promise.all(n),new Promise((t=>o.setTimeout(t,e)))]).then((()=>{t()}))}))},getRootCssVar:function(t){return l.documentElement.style.getPropertyValue(t)},setRootCssVar:function(t,e){l.documentElement.style.setProperty(t,e)},createTooltipInner:function(t){return`<span class="se-tooltip-inner"><span class="se-tooltip-text">${t}</span></span>`}};function ut(t){let e=0;for(;t=t.previousSibling;)e+=1;return e}function pt(t,e,s){const i=[];let n=!0;return vt(t,(t=>{if(t===e&&(n=!1),n&&!tt.isWysiwygFrame(t)){if(s&&3===t.nodeType){let e=null,i=null;s.s=s.e=0;let n=t.previousSibling;for(;3===n?.nodeType;)i=n.textContent.replace(E,""),s.s+=i.length,t.textContent=i+t.textContent,e=n,n=n.previousSibling,dt.removeItem(e);let o=t.nextSibling;for(;3===o?.nodeType;)i=o.textContent.replace(E,""),s.e+=i.length,t.textContent+=i,e=o,o=o.nextSibling,dt.removeItem(e)}i.push(t)}return!1})),i.map(ut).reverse()}function gt(t,e){let s,i=e;for(let e=0,n=t.length;e<n&&(s=i.childNodes,0!==s.length);e++)i=s.length<=t[e]?s[s.length-1]:s[t[e]];return i}function mt(t,e,s){const i=[];return s??=1/0,!t||s<=0||0===t.childNodes.length||(e||=()=>!0,function t(n,o){if(o>s)return;if(o>0&&e(n)&&i.push(n),o===s)return;const l=n.childNodes;for(let e=0,s=l.length;e<s;e++)t(l[e],o+1)}(t,0)),i}function ft(t){if(!t||tt.isWysiwygFrame(t))return-1;let e=0;for(t=t.parentNode;t&&!tt.isWysiwygFrame(t);)e+=1,t=t.parentNode;return e}function vt(t,e,s){let i;if("function"==typeof e)i=e;else if("object"==typeof e)i=t=>t===e;else{let t;/^\./.test(e)?(t="className",e="(\\s|^)"+e.split(".")[1]+"(\\s|$)"):/^#/.test(e)?(t="id",e="^"+e.split("#")[1]+"$"):/^:/.test(e)?(t="name",e="^"+e.split(":")[1]+"$"):(t="nodeName",e="^"+e+"$");const s=new RegExp(e,"i");i=e=>s.test(e[t])}s||=1/0;let n=0;for(;t&&!i(t);){if(n>=s||tt.isWysiwygFrame(t))return null;t=t.parentElement,n++}return t}const bt={getPositionIndex:ut,getNodePath:pt,getNodeFromPath:gt,getChildNode:function(t,e){let s=null;if(!t)return s;const i=t;return i.children&&0!==i.children.length?(e||=()=>!0,function t(n){if(i!==n&&e(n))return s=n,!0;if(n.children)for(let e=0,s=n.children.length;e<s;e++)t(n.children[e])}(i),s):s},getListChildren:function(t,e,s){const i=[];if(s??=1/0,!t||s<=0)return i;const n=t;return n.children&&0!==n.children.length?(e||=()=>!0,function t(o,l){if(!(l>s)&&(l>0&&n!==o&&e(o)&&i.push(o),l!==s&&o.children))for(let e=0,s=o.children.length;e<s;e++)t(o.children[e],l+1)}(n,0),i):i},getListChildNodes:mt,getNodeDepth:ft,sortNodeByDepth:function(t,e){const s=e?1:-1,i=-1*s;t.sort((function(t,e){if(!tt.isListCell(t)||!tt.isListCell(e))return 0;const n=ft(t),o=ft(e);return n>o?s:n<o?i:0}))},compareElements:function(t,e){let s=t,i=e;const n=ft(t),o=ft(e);if(n>o){let t=n-o;for(;t>0&&s;)s=s.parentElement,t--}else if(o>n){let t=o-n;for(;t>0&&i;)i=i.parentElement,t--}for(;s&&i&&s.parentElement!==i.parentElement;)s=s.parentElement,i=i.parentElement;if(!s?.parentNode||!i?.parentNode)return{ancestor:null,a:t,b:e,result:0};const l=s.parentNode.childNodes,r=dt.getArrayIndex(l,s),a=dt.getArrayIndex(l,i);return{ancestor:s.parentElement,a:s,b:i,result:r>a?1:r<a?-1:0}},getParentElement:vt,getParentElements:function(t,e,s){let i;if("function"==typeof e)i=e;else if("object"==typeof e)i=t=>t===e;else{let t;/^\./.test(e)?(t="className",e="(\\s|^)"+e.split(".")[1]+"(\\s|$)"):/^#/.test(e)?(t="id",e="^"+e.split("#")[1]+"$"):/^:/.test(e)?(t="name",e="^"+e.split(":")[1]+"$"):(t="nodeName",e="^"+e+"$");const s=new RegExp(e,"i");i=e=>s.test(e[t])}const n=[];s||=1/0;let o=0;for(;o<=s&&t&&!tt.isWysiwygFrame(t);)i(t)&&n.push(t),t=t.parentElement,o++;return n},getCommandTarget:function(t){let e=t;for(;e&&!/^(UL)$/i.test(e.nodeName)&&!dt.hasClass(e,"sun-editor");){if(e.hasAttribute("data-command"))return e;e=e.parentElement}return null},getEventTarget:function(t){return t.target},getEdgeChild:function(t,e,s){let i;if("function"==typeof e)i=e;else if("object"==typeof e)i=function(t){return t===e};else{let t;/^\./.test(e)?(t="className",e="(\\s|^)"+e.split(".")[1]+"(\\s|$)"):/^#/.test(e)?(t="id",e="^"+e.split("#")[1]+"$"):/^:/.test(e)?(t="name",e="^"+e.split(":")[1]+"$"):(t="nodeName",e="^"+("text"===e?"#"+e:e)+"$");const s=new RegExp(e,"i");i=function(e){return s.test(e[t])}}const n=mt(t,(t=>i(t)),null);return n[s?n.length-1:0]},getEdgeChildNodes:function(t,e){if(t){for(e||=t;t&&1===t.nodeType&&t.childNodes.length>0&&!tt.isBreak(t);)t=t.firstChild;for(;e&&1===e.nodeType&&e.childNodes.length>0&&!tt.isBreak(e);)e=e.lastChild;return{sc:t,ec:e||t}}},getPreviousDeepestNode:function(t,e){let s=t.previousSibling;if(!s){for(let i=t.parentNode;i;i=i.parentNode){if(i===e)return null;if(i.previousSibling){s=i.previousSibling;break}}if(!s)return null}if(tt.isNonEditable(s))return s;for(;s.lastChild;)s=s.lastChild;return s},getNextDeepestNode:function(t,e){let s=t.nextSibling;if(!s){for(let i=t.parentNode;i;i=i.parentNode){if(i===e)return null;if(i.nextSibling){s=i.nextSibling;break}}if(!s)return null}if(tt.isNonEditable(s))return s;for(;s.firstChild;)s=s.firstChild;return s},findTextIndexOnLine:function(t,e,s,i){if(!t)return 0;i||=()=>!0;let n=0,o=!1;return function t(l){if(!o&&8!==l.nodeType&&!i(l))if(3===l.nodeType){if(l===e)return n+=s,void(o=!0);n+=l.textContent.length}else if(1===l.nodeType){const e=l.childNodes;for(let s=0,i=e.length;s<i;s++)if(t(e[s]),o)return}}(t),n},findTabEndIndex:function(t,e,s){if(!t)return 0;const i=t.textContent,n=new RegExp(`((\\u00A0|\\s){${s},})`,"g");let o;for(n.lastIndex=e;null!==(o=n.exec(i));)if(o.index>=e){const t=o.index+o[0].length-1;return t+(i.slice(0,t+1).match(/[^\u00A0\s]/g)||[]).length+s}return 0},findVisualLastCell:function(t){if(!t||0===t.length)return null;const e={};let s=null,i=-1,n=-1;for(const o of t){const t=o.parentElement.rowIndex,l=o.rowSpan||1,r=o.colSpan||1;e[t]||=[];let a=0;const h=e[t];for(;h[a];)a++;for(let t=0;t<r;t++)h[a+t]=!0;for(let s=1;s<l;s++){const i=t+s;e[i]||=[];for(let t=0;t<r;t++)e[i][a+t]=!0}const c=t+l-1,d=a+r-1;(c>i||c===i&&d>n)&&(i=c,n=d,s=o)}return s},getScrollParents:function(t){const e=[];let s=t?.parentElement;for(;s&&!/^(body|html)$/i.test(s.nodeName);){const t=o.getComputedStyle(s),{overflow:i,overflowX:n,overflowY:l}=t;[i,n,l].some((t=>["auto","scroll","overlay"].includes(t)))&&e.push(s),s=s.parentElement}return e},getIframeDocument:function(t){return t.contentWindow?.document||t.contentDocument}};const yt={query:bt,check:tt,utils:dt};function Ct(t,e=0){if(!t)return 0;const s=(t+"").match(/-?\d+(\.\d+)?/);if(!s||!s[0])return 0;const i=Number(s[0]);return e<0?i:0===e?Math.round(i):Number(i.toFixed(e))}const wt={is:function(t){return/^-?\d+(\.\d+)?$/.test(t+"")},get:Ct,getOverlapRangeAtIndex:function(t,e,s,i){if(t<=i?e<s:e>s)return 0;const n=(t>s?t:s)-(e<i?e:i);return(n<0?-1*n:n)+1},isEven:function(t){return!(1&t)},isOdd:function(t){return!(1&~t)}},_t="ArrowLeft|ArrowUp|ArrowRight|ArrowDown",xt="F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12",$t=_t.split("|"),kt="Backspace|Delete".split("|"),St=`Backspace|Tab|Enter|ShiftLeft|ShiftRight|ControlLeft|ControlRight|AltLeft|AltRight|Pause|CapsLock|Escape|PageUp|PageDown|End|Home|${_t}|Insert|Delete|${xt}|NumLock|ScrollLock`.split("|"),Et="Backspace|Enter|Delete".split("|"),Tt="Backspace|Enter|Delete".split("|"),Mt=`ControlLeft|ControlRight|AltLeft|AltRight|Pause|CapsLock|Escape|Insert|${xt}|NumLock|ScrollLock`.split("|");const Ht={write:async function(t){if(!d)return console.error("Clipboard is not supported in this browser."),!1;let e="",s="";"string"==typeof t?(e=t,s=t):W(t)?(t.querySelectorAll("iframe").forEach((t=>{const e=document.createElement("div"),s={};for(const e of Array.from(t.attributes))s[e.name]=e.value;e.setAttribute("data-se-iframe-holder","1"),e.setAttribute("data-se-iframe-holder-attrs",JSON.stringify(s)),e.innerText=`[iframe: ${t.src}]`,t.replaceWith(e)})),e=t.outerHTML,s=t.textContent):(e=t.textContent,s=t.textContent);try{await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([e],{type:"text/html"}),"text/plain":new Blob([s],{type:"text/plain"})})])}catch{console.warn("[SUNEDITOR.copy.warn] This browser is not supported Clipboard API");try{await navigator.clipboard.writeText(s||function(t){const e=document.createElement("div");return e.innerHTML=t,e.textContent||e.innerText||""}(e))}catch(t){console.error("[SUNEDITOR.copy.fail] "+t)}}}},Lt=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/i,Nt=/^[\u200B\uFEFF]+$/;function At(t){const e=t.trim();return""===e||Nt.test(e)}const Bt={strong:"**",b:"**",em:"*",i:"*",del:"~~",s:"~~",mark:"=="};function It(t){if(!t||0===t.length)return"";const e=[];for(let s=0;s<t.length;s++){const i=Ft(t[s],"",!1);if(i){if(e.length>0){const t=e[e.length-1];!t||t.endsWith(" ")||t.endsWith("\n")||i.startsWith(" ")||i.startsWith("\n")||e.push(" ")}e.push(i)}}return e.join("")}function Vt(t){return t?"text"===t.type?t.content||"":t.children?t.children.map(Vt).join(""):"":""}function Ot(t){if(!t)return"";if("text"===t.type)return t.content||"";const{tag:e,attributes:s={},children:i=[]}=t,n=Object.entries(s).map((([t,e])=>`${t}="${e}"`)).join(" "),o=n?`<${e} ${n}>`:`<${e}>`;if(Lt.test(e))return o;return`${o}${i.map(Ot).join("")}</${e}>`}function Rt(t,e){return t?t.split("\n").map((t=>t?e+t:"")).join("\n")+"\n":""}function Pt(t,e,s){const i=t.children||[];let n="",o=1;for(const t of i){if("element"!==t.type||"li"!==t.tag)continue;const i=s?`${o}. `:"- ",l=t.children||[];let r="",a="";const h=e+" ".repeat(i.length);let c="";const d=l[0];d&&"element"===d.type&&"input"===d.tag&&"checkbox"===d.attributes?.type&&(c=void 0!==d.attributes.checked?"[x] ":"[ ] ");for(let t=0;t<l.length;t++){const e=l[t];if(0===t&&c)continue;if("element"!==e.type){r+=Ft(e,"",!1);continue}const s=e.tag;if("ul"===s||"ol"===s)a+=Pt(e,h,"ol"===s);else if("table"===s)a+=Rt(zt(e),h);else if("figure"===s){const t=(e.children||[]).find((t=>"element"===t.type&&"table"===t.tag));a+=Rt(t?zt(t):Ft(e,"",!0),h)}else"blockquote"===s||"pre"===s?a+=Rt(Ft(e,"",!0),h):r+=Ft(e,"",!1)}n+=`${e}${i}${c}${r.trim()}\n`,a&&(n+=a),o++}return n}function zt(t){const e=[];let s=!1;if(function t(i,n){for(const o of i.children||[])if("thead"===o.tag)t(o,!0);else if("tbody"===o.tag||"tfoot"===o.tag)t(o,!1);else if("tr"===o.tag){const t=[];for(const e of o.children||[])if("td"===e.tag||"th"===e.tag){const s=It(e.children).trim(),i=parseInt(e.attributes?.colspan,10)||1,n=parseInt(e.attributes?.rowspan,10)||1;t.push({content:s,colspan:i,rowspan:n})}const i=n||!s&&o.children?.some((t=>"th"===t.tag));i&&(s=!0),e.push({cells:t,isHeader:i})}}(t,!1),0===e.length)return"";const i=e.filter((t=>t.isHeader)),n=e.filter((t=>!t.isHeader)),o=[...i,...n];let l=0;for(const t of o){let e=0;for(const s of t.cells)e+=s.colspan;e>l&&(l=e)}const r=Array.from({length:o.length},(()=>new Array(l).fill(null)));for(let t=0;t<o.length;t++){let e=0;for(const s of o[t].cells){for(;e<l&&null!==r[t][e];)e++;if(e>=l)break;for(let i=0;i<s.rowspan&&t+i<o.length;i++)for(let n=0;n<s.colspan&&e+n<l;n++)r[t+i][e+n]=0===i&&0===n?s.content:"";e+=s.colspan}for(let e=0;e<l;e++)null===r[t][e]&&(r[t][e]="")}let a="";if(i.length>0){a+="| "+r[0].join(" | ")+" |\n",a+="| "+r[0].map((()=>"---")).join(" | ")+" |\n";for(let t=1;t<r.length;t++)a+="| "+r[t].join(" | ")+" |\n"}else{a+="| "+new Array(l).fill(" ").join(" | ")+" |\n",a+="| "+new Array(l).fill("---").join(" | ")+" |\n";for(let t=0;t<r.length;t++)a+="| "+r[t].join(" | ")+" |\n"}return a}function Ft(t,e,s){if(!t)return"";if("text"===t.type)return(t.content||"").replace(/[\u200B\uFEFF]/g,"");if("element"!==t.type)return"";const{tag:i,attributes:n={},children:o=[]}=t;if("body"===i)return o.map((t=>Ft(t,"",!0))).join("");const l=/^h([1-6])$/.exec(i);if(l){const t=parseInt(l[1],10);return`${"#".repeat(t)} ${It(o).trim()}\n\n`}if("p"===i){const t=It(o);return t.trim()?`${t.trim()}\n\n`:"\n"}if("br"===i)return"\n";if("hr"===i)return"---\n\n";const r=Bt[i];if(r){return`${r}${It(o)}${r}`}if("code"===i){const t=Vt({children:o});return t.includes("`")?"`` "+t+" ``":"`"+t+"`"}if("kbd"===i){return`<kbd>${Vt({children:o})}</kbd>`}if("sub"===i){return`<sub>${It(o)}</sub>`}if("sup"===i){return`<sup>${It(o)}</sup>`}if("a"===i){const t=n.href||"",e=It(o),s=n.title;return s?`[${e}](${t} "${s}")`:`[${e}](${t})`}if("img"===i){const t=n.src||"";return`![${n.alt||""}](${t})`}if("blockquote"===i){return o.map((t=>Ft(t,"",!0))).join("").replace(/\n$/,"").split("\n").map((t=>`> ${t}`)).join("\n")+"\n\n"}if("pre"===i){let e="",s="";const i=o.find((t=>"element"===t.type&&"code"===t.tag));return i?(e=(i.attributes?.class||"").replace(/^language-/,""),s=Vt(i)):(e=(t.attributes?.class||"").match(/language-(\S+)/)?.[1]||"",s=Vt({children:o})),"```"+e+"\n"+s+"\n```\n\n"}if("details"===i)return Ot(t)+"\n\n";if("summary"===i)return Ot(t);if("ul"===i)return Pt(t,e,!1)+"\n";if("ol"===i)return Pt(t,e,!0)+"\n";if("table"===i)return zt(t)+"\n";if("dl"===i){let t="";for(const e of o)"element"===e.type&&("dt"===e.tag?t+=It(e.children).trim()+"\n":"dd"===e.tag&&(t+=": "+It(e.children).trim()+"\n"));return t+"\n"}if("dt"===i||"dd"===i)return It(o).trim();if("div"===i){if(n.class&&/se-component/.test(n.class))return o.map((t=>Ft(t,e,!0))).join("");const t=It(o);return s?t+"\n\n":t}if("span"===i)return n.style||n.class?Ot(t):It(o);if("figure"===i){const t=o.map((t=>Ft(t,e,!0))).join("");return/\n$/.test(t)?t:t+"\n\n"}if("figcaption"===i){const t=It(o).trim();return t?t+"\n\n":""}return"video"===i||"audio"===i||"iframe"===i?Ot(t)+"\n\n":Ot(t)}function Dt(t){if(!t)return"";const e=[];function s(t){return e.push(t),""+(e.length-1)+""}return t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace(/\\([\\*_~`[\]()#!|{}<>+-])/g,((t,e)=>s(e)))).replace(/``\s(.+?)\s``/g,((t,e)=>s("<code>"+e+"</code>")))).replace(/`([^`]+)`/g,((t,e)=>s("<code>"+e+"</code>")))).replace(/!\[([^\]]*)\]\(([^)\s]+)(?:\s+"([^"]*)")?\)/g,((t,e,i,n)=>s(n?`<img src="${i}" alt="${e}" title="${n}">`:`<img src="${i}" alt="${e}">`)))).replace(/\[([^\]]+)\]\(([^)\s]+)(?:\s+"([^"]*)")?\)/g,((t,e,i,n)=>s(n?`<a href="${i}" title="${n}">${e}</a>`:`<a href="${i}">${e}</a>`)))).replace(/<(https?:\/\/[^>]+)>/g,((t,e)=>s(`<a href="${e}">${e}</a>`)))).replace(/<([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})>/g,((t,e)=>s(`<a href="mailto:${e}">${e}</a>`)))).replace(/(?<![="'\w/])(https?:\/\/[^\s<>\])"]+)/g,((t,e)=>s(`<a href="${e}">${e}</a>`)))).replace(/~~(.+?)~~/g,"<del>$1</del>")).replace(/\*{3}(.+?)\*{3}/g,"<strong><em>$1</em></strong>")).replace(/_{3}(.+?)_{3}/g,"<strong><em>$1</em></strong>")).replace(/\*{2}(.+?)\*{2}/g,"<strong>$1</strong>")).replace(/_{2}(.+?)_{2}/g,"<strong>$1</strong>")).replace(/\*(.+?)\*/g,"<em>$1</em>")).replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>")).replace(/==(.+?)==/g,"<mark>$1</mark>")).replace(/\^([^\s^]+)\^/g,"<sup>$1</sup>")).replace(/(?<!~)~([^\s~]+)~(?!~)/g,"<sub>$1</sub>")).replace(/\uFFFC(\d+)\uFFFC/g,((t,s)=>e[parseInt(s,10)]))}function qt(t){if(t.length<2)return"";const e=t=>t.replace(/^\|/,"").replace(/\|$/,"").split("|").map((t=>t.trim())),s=e(t[0]),i=e(t[1]).map((t=>{const e=t.trim();return/^:-+:$/.test(e)?"center":/^-+:$/.test(e)?"right":/^:-+$/.test(e)?"left":""})),n=t.slice(2).map(e),o=s.length,l=s.every((t=>""===t));let r="<table>";const a=t=>{const e=i[t];return e?` style="text-align: ${e};"`:""};if(!l){r+="<thead><tr>";for(let t=0;t<o;t++)r+=`<th${a(t)}>${Dt(s[t])}</th>`;r+="</tr></thead>"}if(n.length>0||l){r+="<tbody>";for(const t of n){r+="<tr>";for(let e=0;e<o;e++)r+=`<td${a(e)}>${Dt(t[e]||"")}</td>`;r+="</tr>"}r+="</tbody>"}return r+="</table>",r}function Wt(t,e,s){const i=s?"ol":"ul",n=s?/^(\s*)\d+\.\s+(.*)/:/^(\s*)([-*+])\s+(.*)/;let o=`<${i}>`,l=e;const r=(t[l].match(/^(\s*)/)[1]||"").length;for(;l<t.length;){const e=t[l];if(At(e)){l++;continue}const i=(e.match(/^(\s*)/)[1]||"").length;if(i<r)break;if(i!==r)break;{if(!n.exec(e))break;const i=s?e.replace(/^\s*\d+\.\s+/,""):e.replace(/^\s*[-*+]\s+/,"");l++;let a=!1,h=!1,c=i;const d=/^\[([ xX])\]\s*(.*)/.exec(i);d&&(a=!0,h=" "!==d[1],c=d[2]);let u="";for(;l<t.length;){const e=t[l];if(At(e)){l++;continue}if((e.match(/^(\s*)/)[1]||"").length<=r)break;if(/^\s*[-*+]\s+/.test(e)||/^\s*\d+\.\s+/.test(e)){const s=Wt(t,l,/^\s*\d+\.\s+/.test(e));u+=s.html,l=s.index;continue}const s=e.trimStart();if(!(/^\|.*\|/.test(s)&&l+1<t.length&&/^\s*\|[\s:]*-{3,}/.test(t[l+1])))break;{const e=[];for(;l<t.length;){const s=t[l];if(At(s)||(s.match(/^(\s*)/)[1]||"").length<=r)break;if(!/^\s*\|/.test(s))break;e.push(s.trimStart()),l++}u+=qt(e)}}if(a){o+=`<li class="task-list-item">${h?'<input type="checkbox" checked disabled> ':'<input type="checkbox" disabled> '}${Dt(c)}${u}</li>`}else o+=`<li>${Dt(i)}${u}</li>`}}return o+=`</${i}>`,{html:o,index:l}}const Ut={jsonToMarkdown:function(t){return t?Ft(t,"",!0).replace(/\n{3,}/g,"\n\n").trim()+"\n":""},markdownToHtml:function t(e,s){if(!e)return"";s||(s="p");const i=e.split("\n"),n=[];let o=0;for(;o<i.length;){const e=i[o];if(At(e)){o++;continue}const r=/^(`{3,}|~{3,})(\w*)/.exec(e);if(r){const t=r[1].charAt(0),e=r[1].length,s=r[2],a=[];o++;const h=new RegExp("^"+("`"===t?"`":"~")+"{"+e+",}\\s*$");for(;o<i.length&&!h.test(i[o]);)a.push(i[o]),o++;o++;const c=s?` class="language-${s}"`:"";n.push(`<pre><code${c}>${l=a.join("\n"),l.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}</code></pre>`);continue}const a=/^(#{1,6})\s+(.+)/.exec(e);if(a){const t=a[1].length;n.push(`<h${t}>${Dt(a[2].trim())}</h${t}>`),o++;continue}if(/^(\*{3,}|-{3,}|_{3,})\s*$/.test(e)){n.push("<hr>"),o++;continue}if(/^>\s?/.test(e)){const e=[];for(;o<i.length&&/^>\s?/.test(i[o]);)e.push(i[o].replace(/^>\s?/,"")),o++;const l=t(e.join("\n"),s);n.push(`<blockquote>${l}</blockquote>`);continue}if(/^\|.*\|/.test(e)&&o+1<i.length&&/^\|[\s:]*-{3,}[\s:]*/.test(i[o+1])){const t=[];for(;o<i.length&&/^\|.*\|/.test(i[o]);)t.push(i[o]),o++;n.push(qt(t));continue}if(/^(\s*)([-*+])\s+/.test(e)){const t=Wt(i,o,!1);n.push(t.html),o=t.index;continue}if(/^(\s*)\d+\.\s+/.test(e)){const t=Wt(i,o,!0);n.push(t.html),o=t.index;continue}if(/^\s*<[a-zA-Z]/.test(e)){let t=e;if(o++,Lt.test(e.match(/<(\w+)/)?.[1]||"")){n.push(t);continue}for(;o<i.length&&!At(i[o]);)t+="\n"+i[o],o++;n.push(t);continue}const h=[];for(;o<i.length&&!At(i[o])&&!/^(#{1,6}\s|`{3,}|~{3,}|>|\||(\s*)([-*+]|\d+\.)\s|(\*{3,}|-{3,}|_{3,})\s*$)/.test(i[o]);)h.push(i[o]),o++;if(h.length>0){const t=Dt(h.join("\n"));n.push(`<${s}>${t}</${s}>`)}else n.push(`<${s}>${Dt(i[o])}</${s}>`),o++}var l;return n.join("")}},Zt=/<!--\[if[^>]*>[\s\S]*?<!\[endif\]-->/gi,Gt=/<\/?(?:\w+:)\w+[^>]*>/gi,jt=/<xml>[\s\S]*?<\/xml>/gi,Kt=/<style[^>]*>[\s\S]*?<\/style>/gi,Yt=/\s*mso-[^:]+:[^;"]+;?/gi,Xt=/l(\d+)\s+level(\d+)\s+lfo(\d+)/i,Jt=/mso-list:\s*Ignore/i,Qt=/\bMso\w+/g,te=/\bxl\d+/g,ee=/\s*tab-stops:[^;"]+;?/gi,se=/^[\s\u00a0]*[\u2022\u00b7\u00a7\u25cf\u25cb\u25aa\u25a0·o§]\s*/,ie=[/^\s*[0-9]+[.)]\s/,/^\s*[a-z][.)]\s/i,/^\s*[ivxlmcd]+[.)]\s/i],ne=/<span\s+style\s*=\s*["']?\s*mso-spacerun:\s*yes\s*;?\s*["']?\s*>([\s\u00a0]*)<\/span>/gi,oe=/<span\s+style\s*=\s*["'][^"']*mso-tab-count:\s*\d+[^"']*["']\s*>[^<]*<\/span>/gi,le=/mso-outline-level:\s*(\d+)/i,re=/mso-highlight:\s*([^;"]+)/i,ae=/mso-level-number-format:\s*([^;\s]+)/i,he=/mso-level-start-at:\s*(\d+)/i,ce=/mso-level-text:\s*([^;\s]+)/i,de={decimal:"decimal","alpha-upper":"upper-alpha","alpha-lower":"lower-alpha","roman-upper":"upper-roman","roman-lower":"lower-roman","arabic-leading-zero":"decimal-leading-zero"},ue=/\s*margin:\s*0[a-z]*\s+0[a-z]*\s+0[a-z]*\s*;?/gi,pe=/\s*text-indent:\s*-?[\d.]+[a-z]*\s*;?/gi,ge=/\s*line-height:\s*normal\s*;?/gi,me=/MsoHeading(\d)/i,fe=/^file:\/\/\//i,ve=/^_(Toc|Ref|Hlt|Hlk)\d+$/i,be=/^#_(Toc|Ref|Hlt|Hlk)\d+$/i,ye=/page-break-before\s*:\s*always/i,Ce=/mso-break-type\s*:\s*section-break/i,we=/mso-column-break-before\s*:\s*always/i,_e=/^(?:Word)?Section\d+$/i;function xe(t){const e=t.replace(/[\s\u00a0]+/g," ").trim();if(se.test(e))return"ul";for(const t of ie)if(t.test(e))return"ol";return"ul"}function $e(t){const e=document.createTreeWalker(t,NodeFilter.SHOW_COMMENT,null),s=[];for(;e.nextNode();)s.push(e.currentNode);for(const t of s)t?.remove();const i=t.querySelectorAll("span");for(const t of i){const e=t.getAttribute("style")||"";Jt.test(e)&&t.remove()}t.firstChild&&3===t.firstChild.nodeType&&(t.firstChild.nodeValue=t.firstChild.nodeValue.replace(/^[\s\u00a0]+/,""))}function ke(t){const e=t.getAttribute("style");if(!e)return;let s=e;const i=re.exec(s);!i||/background-color/i.test(s)||/background\s*:/i.test(s)||(s+=";background-color:"+i[1].trim()),s=s.replace(Yt,"").replace(ee,"").replace(ue,"").replace(pe,"").replace(ge,"").trim(),s=s.replace(/^;+|;+$/g,"").replace(/;{2,}/g,";").trim(),s?t.setAttribute("style",s):t.removeAttribute("style")}function Se(t){const e=t.getAttribute("class");if(!e)return;const s=e.replace(Qt,"").replace(te,"").trim();s?t.setAttribute("class",s):t.removeAttribute("class")}function Ee(t){let e=t.previousSibling;for(;e;){if(1===e.nodeType)return e;if(3===e.nodeType&&e.nodeValue.trim())return null;e=e.previousSibling}return null}function Te(t,e){for(const s of t){const t=`l${s.listId}:level${s.level}`,i=e.get(t);if(i)s.type=i.type,s.listStyleType=i.listStyleType,s.startAt=i.startAt;else{const t=He(s.el);s.type=xe(t),s.listStyleType="",s.startAt=1}}const s=t[0].el.parentNode,i=t[t.length-1].el.nextSibling,n=[];let o=null;for(const e of t){const{el:t,level:s,type:i,listStyleType:l,startAt:r}=e;$e(t),ke(t),Se(t);const a=t.ownerDocument.createElement("li");for(;t.firstChild;)a.appendChild(t.firstChild);if(t.getAttribute("style")&&a.setAttribute("style",t.getAttribute("style")),0===n.length)o=Me(t.ownerDocument,i,l,r),o.appendChild(a),n.push({listEl:o,level:s});else{const e=n[n.length-1].level;if(s>e){const e=n[n.length-1].listEl.lastElementChild,o=Me(t.ownerDocument,i,l,r);o.appendChild(a),e?e.appendChild(o):n[n.length-1].listEl.appendChild(o),n.push({listEl:o,level:s})}else if(s<e){for(;n.length>1&&n[n.length-1].level>s;)n.pop();n[n.length-1].listEl.appendChild(a)}else n[n.length-1].listEl.appendChild(a)}t.remove()}o&&s.insertBefore(o,i)}function Me(t,e,s,i){const n=t.createElement(e);return s&&(n.style.listStyleType=s),"ol"===e&&i>1&&n.setAttribute("start",String(i)),n}function He(t){const e=t.querySelectorAll("span");for(const t of e){const e=t.getAttribute("style")||"";if(Jt.test(e))return t.textContent||""}return t.textContent?.substring(0,10)||""}const Le={cleanHTML:function(t){if(!t)return"";const e=function(t){const e=new Map,s=t.match(/<style[^>]*>([\s\S]*?)<\/style>/i);if(!s)return e;const i=s[1],n=/@list\s+l(\d+):level(\d+)\s*\{([^}]*)\}/gi;let o;for(;null!==(o=n.exec(i));){const t=o[1],s=o[2],i=o[3],n=`l${t}:level${s}`,l=ae.exec(i),r=he.exec(i),a=ce.exec(i);let h="ol",c="";if(l){const t=l[1].toLowerCase();if("bullet"===t||"image"===t){if(h="ul",a){const t=a[1].replace(/["%\\]/g,"");"·"===t||"·"===t?c="disc":"o"===t?c="circle":"§"!==t&&"§"!==t||(c="square")}}else c=de[t]||""}e.set(n,{type:h,listStyleType:c,startAt:r?parseInt(r[1],10):1})}return e}(t);let s=t;s=s.replace(Kt,""),s=s.replace(jt,""),s=s.replace(Zt,""),s=s.replace(Gt,""),s=s.replace(/<!--(?:Start|End)Fragment-->/gi,""),s=s.replace(/<(?:meta|link)[^>]*>/gi,""),s=s.replace(ne," "),s=s.replace(oe," "),s=s.replace(/(&nbsp;){2,}/g," "),s=s.replace(/\u00AD/g,"");const i=(new DOMParser).parseFromString(s,"text/html");!function(t){const e=t.body.querySelectorAll("del, .msoDel");for(const t of e)t.remove();const s=t.body.querySelectorAll("ins, .msoIns");for(let t=s.length-1;t>=0;t--){const e=s[t],i=e.parentNode;if(i){for(;e.firstChild;)i.insertBefore(e.firstChild,e);e.remove()}}const i=t.body.querySelectorAll('.MsoCommentReference, [style*="mso-comment-reference"]');for(const t of i)t.remove();const n=t.body.querySelectorAll(".MsoCommentText");for(const t of n)t.remove();const o=t.body.querySelectorAll('div[style*="mso-element:comment"]');for(const t of o)t.remove();const l=t.body.querySelectorAll('a[name^="_msocom"], a[name^="_msoanchor"]');for(const t of l)t.remove()}(i),function(t,e){const s=[],i=t.body.querySelectorAll("p, h1, h2, h3, h4, h5, h6");for(const t of i){const e=t.getAttribute("style")||"",i=t.getAttribute("class")||"",n=Xt.exec(e);(n||/MsoListParagraph/i.test(i))&&s.push({el:t,listId:n?n[1]:"0",level:n?parseInt(n[2],10):1,lfo:n?n[3]:"1"})}if(0===s.length)return;const n=[];let o=null;for(const t of s){const e=Ee(t.el);o&&o.length>0&&e===o[o.length-1].el?o.push(t):(o=[t],n.push(o))}for(const t of n)Te(t,e)}(i,e),function(t){const e=t.body.querySelectorAll("p");for(const s of e){const e=s.getAttribute("style")||"",i=s.getAttribute("class")||"";let n=0;const o=le.exec(e);if(o&&(n=parseInt(o[1],10)),!n){const t=me.exec(i);t&&(n=parseInt(t[1],10))}if(n>=1&&n<=6){const i=t.createElement("h"+n);for(;s.firstChild;)i.appendChild(s.firstChild);e&&i.setAttribute("style",e),s.replaceWith(i)}}}(i),function(t){const e=t.body.querySelectorAll("table");for(const t of e){Se(t),t.removeAttribute("cellspacing"),t.removeAttribute("cellpadding");const e=t.querySelectorAll("col");for(const t of e)t.remove();const s=t.querySelectorAll("colgroup");for(const t of s)t.children.length||t.remove()}const s=t.body.querySelectorAll("tr");for(const t of s)t.removeAttribute("height");const i=t.body.querySelectorAll("td, th");for(const t of i){const e=t.getAttribute("valign");if(e){t.removeAttribute("valign");const s=t.getAttribute("style")||"";/vertical-align/i.test(s)||t.setAttribute("style",(s?s+";":"")+"vertical-align:"+e)}const s=t.children;if(1===s.length&&"P"===s[0].tagName){const e=s[0],i=e.getAttribute("class")||"";if(/MsoNormal/i.test(i)||!i){for(;e.firstChild;)t.insertBefore(e.firstChild,e);e.remove()}}}}(i),function(t){const e=t.body.querySelectorAll("a");for(let t=e.length-1;t>=0;t--){const s=e[t],i=s.getAttribute("href")||"",n=s.getAttribute("name")||"";if(fe.test(i)){const t=s.parentNode;if(t){for(;s.firstChild;)t.insertBefore(s.firstChild,s);s.remove()}}else if(ve.test(n)){const t=s.parentNode;if(t){if(s.childNodes.length)for(;s.firstChild;)t.insertBefore(s.firstChild,s);s.remove()}}else if(be.test(i)){const t=s.parentNode;if(t){for(;s.firstChild;)t.insertBefore(s.firstChild,s);s.remove()}}else s.removeAttribute("v:shapes")}}(i),function(t){const e=t.body.querySelectorAll("img");for(let t=e.length-1;t>=0;t--){const s=e[t],i=s.getAttribute("src")||"";fe.test(i)?s.remove():s.removeAttribute("v:shapes")}}(i),function(t){const e=t.body.querySelectorAll("br");for(let t=e.length-1;t>=0;t--){const s=e[t],i=s.getAttribute("style")||"";ye.test(i)||Ce.test(i)||we.test(i)?s.remove():(s.removeAttribute("style"),s.removeAttribute("clear"))}const s=t.body.querySelectorAll('div[class*="Section"]');for(let t=s.length-1;t>=0;t--){const e=s[t],i=e.getAttribute("class")||"";if(_e.test(i.trim())){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);e.remove()}}}}(i);const n=i.body.querySelectorAll("*");for(const t of n){ke(t),Se(t),t.getAttribute("lang")&&t.removeAttribute("lang"),t.removeAttribute("v:shapes");const e=t.tagName.toLowerCase();"img"!==e&&"video"!==e&&"iframe"!==e&&"table"!==e&&"td"!==e&&"th"!==e&&(t.removeAttribute("width"),t.removeAttribute("height"))}!function(t){const e=t.querySelectorAll("span");for(let t=e.length-1;t>=0;t--){const s=e[t];if(!s.attributes.length||!s.getAttribute("style")&&!s.getAttribute("class")){const t=s.parentNode;if(t){for(;s.firstChild;)t.insertBefore(s.firstChild,s);t.removeChild(s)}}}}(i.body);const o=i.body.querySelectorAll("p");for(const t of o)t.textContent.trim()||t.querySelector("img, video, iframe, br, table")||t.remove();return i.body.innerHTML}},Ne=$,Ae=M,Be=F,Ie=yt,Ve=wt,Oe={isShift:function(t){return t.shiftKey||16===t.keyCode},isCtrl:function(t){const e=t.code;return t.ctrlKey||t.metaKey||"MetaLeft"===e||"MetaRight"===e},isAlt:function(t){return t.altKey},isComposing:function(t){return t.isComposing||"Process"===t.key||229===t.keyCode},isBackspace:function(t){return"Backspace"===t},isTab:function(t){return"Tab"===t},isEnter:function(t){return"Enter"===t},isEsc:function(t){return"Escape"===t},isSpace:function(t){return"Space"===t},isDirectionKey:function(t){return $t.includes(t)},isRemoveKey:function(t){return kt.includes(t)},isNonTextKey:function(t){return St.includes(t)},isHistoryRelevantKey:function(t){return Et.includes(t)},isDocumentTypeObserverKey:function(t){return Tt.includes(t)},isNonResponseKey:function(t){return Mt.includes(t)}},Re=Ht,Pe=Ut,ze=Le,Fe={env:Ne,unicode:Ae,converter:Be,dom:Ie,numbers:Ve,keyCodeMap:Oe,clipboard:Re,markdown:Pe,msOffice:ze},De={redo:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.4,10.6C16.55,9 14.15,8 11.5,8C6.85,8 2.92,11.03 1.54,15.22L3.9,16C4.95,12.81 7.95,10.5 11.5,10.5C13.45,10.5 15.23,11.22 16.62,12.38L13,16H22V7L18.4,10.6Z" /></svg>',undo:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.5,8C9.85,8 7.45,9 5.6,10.6L2,7V16H11L7.38,12.38C8.77,11.22 10.54,10.5 12.5,10.5C16.04,10.5 19.05,12.81 20.1,16L22.47,15.22C21.08,11.03 17.15,8 12.5,8Z" /></svg>',bold:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M304.793 243.891c33.639-18.537 53.657-54.16 53.657-95.693 0-48.236-26.25-87.626-68.626-104.179C265.138 34.01 240.849 32 209.661 32H24c-8.837 0-16 7.163-16 16v33.049c0 8.837 7.163 16 16 16h33.113v318.53H24c-8.837 0-16 7.163-16 16V464c0 8.837 7.163 16 16 16h195.69c24.203 0 44.834-1.289 66.866-7.584C337.52 457.193 376 410.647 376 350.014c0-52.168-26.573-91.684-71.207-106.123zM142.217 100.809h67.444c16.294 0 27.536 2.019 37.525 6.717 15.828 8.479 24.906 26.502 24.906 49.446 0 35.029-20.32 56.79-53.029 56.79h-76.846V100.809zm112.642 305.475c-10.14 4.056-22.677 4.907-31.409 4.907h-81.233V281.943h84.367c39.645 0 63.057 25.38 63.057 63.057.001 28.425-13.66 52.483-34.782 61.284z"/></svg>',underline:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 9.78 15.74"><g><path d="M14.64,3.76h2.52v7.72a4.51,4.51,0,0,1-.59,2.31,3.76,3.76,0,0,1-1.71,1.53,6.12,6.12,0,0,1-2.64.53,5,5,0,0,1-3.57-1.18,4.17,4.17,0,0,1-1.27-3.24V3.76H9.9v7.3a3,3,0,0,0,.55,2,2.3,2.3,0,0,0,1.83.65,2.26,2.26,0,0,0,1.8-.65,3.09,3.09,0,0,0,.55-2V3.76Zm2.52,13.31V19.5H7.39V17.08h9.77Z" transform="translate(-7.38 -3.76)"/></g></svg>',italic:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,4V7H12.21L8.79,15H6V18H14V15H11.79L15.21,7H18V4H10Z" /></svg>',strike:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7.2 9.8C6 7.5 7.7 4.8 10.1 4.3C13.2 3.3 17.7 4.7 17.6 8.5H14.6C14.6 8.2 14.5 7.9 14.5 7.7C14.3 7.1 13.9 6.8 13.3 6.6C12.5 6.3 11.2 6.4 10.5 6.9C9 8.2 10.4 9.5 12 10H7.4C7.3 9.9 7.3 9.8 7.2 9.8M21 13V11H3V13H12.6C12.8 13.1 13 13.1 13.2 13.2C13.8 13.5 14.3 13.7 14.5 14.3C14.6 14.7 14.7 15.2 14.5 15.6C14.3 16.1 13.9 16.3 13.4 16.5C11.6 17 9.4 16.3 9.5 14.1H6.5C6.4 16.7 8.6 18.5 11 18.8C14.8 19.6 19.3 17.2 17.3 12.9L21 13Z" /></svg>',subscript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,7.41L11.41,12L16,16.59L14.59,18L10,13.41L5.41,18L4,16.59L8.59,12L4,7.41L5.41,6L10,10.59L14.59,6L16,7.41M21.85,21.03H16.97V20.03L17.86,19.23C18.62,18.58 19.18,18.04 19.56,17.6C19.93,17.16 20.12,16.75 20.13,16.36C20.14,16.08 20.05,15.85 19.86,15.66C19.68,15.5 19.39,15.38 19,15.38C18.69,15.38 18.42,15.44 18.16,15.56L17.5,15.94L17.05,14.77C17.32,14.56 17.64,14.38 18.03,14.24C18.42,14.1 18.85,14 19.32,14C20.1,14.04 20.7,14.25 21.1,14.66C21.5,15.07 21.72,15.59 21.72,16.23C21.71,16.79 21.53,17.31 21.18,17.78C20.84,18.25 20.42,18.7 19.91,19.14L19.27,19.66V19.68H21.85V21.03Z" /></svg>',superscript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,7.41L11.41,12L16,16.59L14.59,18L10,13.41L5.41,18L4,16.59L8.59,12L4,7.41L5.41,6L10,10.59L14.59,6L16,7.41M21.85,9H16.97V8L17.86,7.18C18.62,6.54 19.18,6 19.56,5.55C19.93,5.11 20.12,4.7 20.13,4.32C20.14,4.04 20.05,3.8 19.86,3.62C19.68,3.43 19.39,3.34 19,3.33C18.69,3.34 18.42,3.4 18.16,3.5L17.5,3.89L17.05,2.72C17.32,2.5 17.64,2.33 18.03,2.19C18.42,2.05 18.85,2 19.32,2C20.1,2 20.7,2.2 21.1,2.61C21.5,3 21.72,3.54 21.72,4.18C21.71,4.74 21.53,5.26 21.18,5.73C20.84,6.21 20.42,6.66 19.91,7.09L19.27,7.61V7.63H21.85V9Z" /></svg>',remove_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22.11 21.46L2.39 1.73L1.11 3L7.65 9.54C6.74 11.03 6 12.65 6 14.23C6 17.54 8.69 20.23 12 20.23C13.74 20.23 15.3 19.5 16.4 18.29L20.84 22.73L22.11 21.46M12 18.23C9.78 18.23 8 16.45 8 14.23C8 13.5 8.5 12.27 9.14 11.03L15 16.88C14.26 17.71 13.2 18.23 12 18.23M11.14 7.94L9.71 6.5C10.57 5.38 11.25 4.61 11.25 4.61L12 3.77L12.75 4.61C12.75 4.61 14.03 6.06 15.32 7.94S18 12.07 18 14.23C18 14.41 18 14.59 17.97 14.77L15.46 12.26C15 11.23 14.37 10.07 13.68 9.07C12.84 7.85 12.44 7.42 12 6.9C11.73 7.21 11.5 7.5 11.14 7.94Z" /></svg>',remove_format:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6,5V5.18L8.82,8H11.22L10.5,9.68L12.6,11.78L14.21,8H20V5H6M3.27,5L2,6.27L8.97,13.24L6.5,19H9.5L11.07,15.34L16.73,21L18,19.73L3.55,5.27L3.27,5Z" /></svg>',indent:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,13H21V11H11M11,9H21V7H11M3,3V5H21V3M11,17H21V15H11M3,8V16L7,12M3,21H21V19H3V21Z" /></svg>',outdent:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,13H21V11H11M11,9H21V7H11M3,3V5H21V3M3,21H21V19H3M3,12L7,16V8M11,17H21V15H11V17Z" /></svg>',expansion:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,21V19H6.41L10.91,14.5L9.5,13.09L5,17.59V14H3V21H10M14.5,10.91L19,6.41V10H21V3H14V5H17.59L13.09,9.5L14.5,10.91Z" /></svg>',reduction:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19.5,3.09L15,7.59V4H13V11H20V9H16.41L20.91,4.5L19.5,3.09M4,13V15H7.59L3.09,19.5L4.5,20.91L9,16.41V20H11V13H4Z" /></svg>',code_block:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5.59 3.41L7 4.82L3.82 8L7 11.18L5.59 12.6L1 8L5.59 3.41M11.41 3.41L16 8L11.41 12.6L10 11.18L13.18 8L10 4.82L11.41 3.41M22 6V18C22 19.11 21.11 20 20 20H4C2.9 20 2 19.11 2 18V14H4V18H20V6H17.03V4H20C21.11 4 22 4.89 22 6Z" /></svg>',code_view:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.89,3L14.85,3.4L11.11,21L9.15,20.6L12.89,3M19.59,12L16,8.41V5.58L22.42,12L16,18.41V15.58L19.59,12M1.58,12L8,5.58V8.41L4.41,12L8,15.58V18.41L1.58,12Z" /></svg>',markdown_view:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2,16V8H4.73L7,11.19L9.27,8H12V16H10V10.6L7,14.05L4,10.6V16H2M16,8L20,12H17V16H15V12H12L16,8Z" /></svg>',preview:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9M12,4.5C17,4.5 21.27,7.61 23,12C21.27,16.39 17,19.5 12,19.5C7,19.5 2.73,16.39 1,12C2.73,7.61 7,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C15.76,17.5 19.17,15.36 20.82,12C19.17,8.64 15.76,6.5 12,6.5C8.24,6.5 4.83,8.64 3.18,12Z" /></svg>',print:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18,3H6V7H18M19,12A1,1 0 0,1 18,11A1,1 0 0,1 19,10A1,1 0 0,1 20,11A1,1 0 0,1 19,12M16,19H8V14H16M19,8H5A3,3 0 0,0 2,11V17H6V21H18V17H22V11A3,3 0 0,0 19,8Z" /></svg>',template:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,7.5H18V9.5H13V7.5M13,14.5H18V16.5H13V14.5M19,3A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3H19M19,19V5H5V19H19M11,6V11H6V6H11M10,10V7H7V10H10M11,13V18H6V13H11M10,17V14H7V17H10Z" /></svg>',layout:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 13H3A1 1 0 0 0 2 14V20A1 1 0 0 0 3 21H21A1 1 0 0 0 22 20V14A1 1 0 0 0 21 13M20 19H4V15H20M21 3H3A1 1 0 0 0 2 4V10A1 1 0 0 0 3 11H21A1 1 0 0 0 22 10V4A1 1 0 0 0 21 3M20 9H4V5H20Z" /></svg>',new_document:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z" /></svg>',select_all:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,9H15V15H9M7,17H17V7H7M15,5H17V3H15M15,21H17V19H15M19,17H21V15H19M19,9H21V7H19M19,21A2,2 0 0,0 21,19H19M19,13H21V11H19M11,21H13V19H11M9,3H7V5H9M3,17H5V15H3M5,21V19H3A2,2 0 0,0 5,21M19,3V5H21A2,2 0 0,0 19,3M13,3H11V5H13M3,9H5V7H3M7,21H9V19H7M3,13H5V11H3M3,5H5V3A2,2 0 0,0 3,5Z" /></svg>',line_height:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 22H3V20H21V22M21 4H3V2H21V4M10 13.7H14L12 8.3L10 13.7M11.2 6H12.9L17.6 18H15.6L14.7 15.4H9.4L8.5 18H6.5L11.2 6Z" /></svg>',paragraph_style:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M360-160v-240q-83 0-141.5-58.5T160-600q0-83 58.5-141.5T360-800h360v80h-80v560h-80v-560H440v560h-80Z"/></svg>',text_style:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,3H16V6H11V18H8V6H3V3M12,7H14V9H12V7M15,7H17V9H15V7M18,7H20V9H18V7M12,10H14V12H12V10M12,13H14V15H12V13M12,16H14V18H12V16M12,19H14V21H12V19Z" /></svg>',save:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,9H5V5H15M12,19A3,3 0 0,1 9,16A3,3 0 0,1 12,13A3,3 0 0,1 15,16A3,3 0 0,1 12,19M17,3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V7L17,3Z" /></svg>',blockquote:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11 18V10H9.12L11.12 6H5.38L3 10.76V18M9 16H5V11.24L6.62 8H7.88L5.88 12H9M21 18V10H19.12L21.12 6H15.38L13 10.76V18M19 16H15V11.24L16.62 8H17.88L15.88 12H19Z" /></svg>',arrow_down:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 8.67"><g><path d="M18.79,7.52a.8.8,0,0,1,.56-.23.82.82,0,0,1,.79.79.8.8,0,0,1-.23.56l-7.07,7.07a.79.79,0,0,1-.57.25.77.77,0,0,1-.57-.25h0L4.64,8.65a.8.8,0,0,1-.23-.57.82.82,0,0,1,.79-.79.8.8,0,0,1,.56.23L12.28,14l3.26-3.26,3.25-3.26Z" transform="translate(-4.41 -7.29)"/></g></svg>',align_justify:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm0,5.9H20.15v-2H4.41v2Zm0,3.94H20.15v-2H4.41v2Zm0,3.93h7.87v-2H4.41v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_left:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm11.8,3.94H4.41v2H16.22v-2Zm-11.8,5.9H18.18v-2H4.41v2Zm0,3.93h9.84v-2H4.41v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_right:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm3.93,5.9H20.15v-2H8.34v2Zm-2,3.94H20.14v-2H6.37v2Zm3.94,3.93h9.84v-2H10.31v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_center:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm2,3.94v2H18.18v-2H6.37Zm-1,5.9H19.16v-2H5.39v2Zm2,3.93H17.2v-2H7.36v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_top:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,11H11V21H13V11H16L12,7L8,11M4,3V5H20V3H4Z" /></svg>',align_middle:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,19H11V23H13V19H16L12,15L8,19M16,5H13V1H11V5H8L12,9L16,5M4,11V13H20V11H4Z" /></svg>',align_bottom:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,13H13V3H11V13H8L12,17L16,13M4,19V21H20V19H4Z" /></svg>',format_float_none:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,7H9V13H3V7M3,3H21V5H3V3M21,11V13H11V11H21M3,15H17V17H3V15M3,19H21V21H3V19Z" /></svg>',format_float_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,7H9V13H3V7M3,3H21V5H3V3M21,7V9H11V7H21M21,11V13H11V11H21M3,15H17V17H3V15M3,19H21V21H3V19Z" /></svg>',format_float_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,7H21V13H15V7M3,3H21V5H3V3M13,7V9H3V7H13M9,11V13H3V11H9M3,15H17V17H3V15M3,19H21V21H3V19Z" /></svg>',format_float_center:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,7H15V13H9V7M3,3H21V5H3V3M3,15H21V17H3V15M3,19H17V21H3V19Z" /></svg>',font_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g><path d="M9.62,12L12,5.67L14.37,12M11,3L5.5,17H7.75L8.87,14H15.12L16.25,17H18.5L13,3H11Z" /><path class="se-svg-color-helper" d="M0,24H24V20H0V24Z" /></g></svg>',background_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g><path d="M4,17L6.75,14.25L6.72,14.23C6.14,13.64 6.14,12.69 6.72,12.11L11.46,7.37L15.7,11.61L10.96,16.35C10.39,16.93 9.46,16.93 8.87,16.37L8.24,17H4M15.91,2.91C16.5,2.33 17.45,2.33 18.03,2.91L20.16,5.03C20.74,5.62 20.74,6.57 20.16,7.16L16.86,10.45L12.62,6.21L15.91,2.91Z" /><path class="se-svg-color-helper" d="M0,24H24V20H0V24Z" /></g></svg>',list_bulleted:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 12.37"><g><path d="M7.77,16.12a1.59,1.59,0,0,0-.49-1.18,1.62,1.62,0,0,0-1.19-.49,1.68,1.68,0,1,0,0,3.36,1.67,1.67,0,0,0,1.68-1.69Zm0-4.48A1.67,1.67,0,0,0,6.09,10,1.68,1.68,0,0,0,4.9,12.82a1.62,1.62,0,0,0,1.19.49,1.67,1.67,0,0,0,1.68-1.67Zm12.38,3.64a.27.27,0,0,0-.08-.19.28.28,0,0,0-.2-.09H9.19a.28.28,0,0,0-.2.08.29.29,0,0,0-.08.19V17a.27.27,0,0,0,.28.28H19.87a.27.27,0,0,0,.19-.08.24.24,0,0,0,.08-.2V15.28ZM7.77,7.13a1.63,1.63,0,0,0-.49-1.2,1.61,1.61,0,0,0-1.19-.49,1.61,1.61,0,0,0-1.19.49,1.71,1.71,0,0,0,0,2.4,1.62,1.62,0,0,0,1.19.49,1.61,1.61,0,0,0,1.19-.49,1.63,1.63,0,0,0,.49-1.2Zm12.38,3.66a.28.28,0,0,0-.08-.2.29.29,0,0,0-.19-.08H9.19a.27.27,0,0,0-.28.28v1.69a.27.27,0,0,0,.08.19.24.24,0,0,0,.2.08H19.87a.27.27,0,0,0,.19-.08.25.25,0,0,0,.08-.19V10.79Zm0-4.5a.27.27,0,0,0-.08-.19A.25.25,0,0,0,19.88,6H9.19A.28.28,0,0,0,9,6.1a.26.26,0,0,0-.08.19V8A.27.27,0,0,0,9,8.17a.24.24,0,0,0,.2.08H19.87a.27.27,0,0,0,.19-.08A.25.25,0,0,0,20.14,8V6.29Z" transform="translate(-4.41 -5.44)"/></g></svg>',list_numbered:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.69 15.74"><g><path d="M7.66,18a1.24,1.24,0,0,0-.26-.78,1.17,1.17,0,0,0-.72-.42l.85-1V15H4.58v1.34h.94v-.46l.85,0h0c-.11.11-.22.23-.32.35s-.23.27-.37.47L5.39,17l.23.51c.61-.05.92.11.92.49a.42.42,0,0,1-.18.37.79.79,0,0,1-.45.12A1.41,1.41,0,0,1,5,18.15l-.51.77A2.06,2.06,0,0,0,6,19.5a1.8,1.8,0,0,0,1.2-.41A1.38,1.38,0,0,0,7.66,18Zm0-5.54H6.75V13H5.63A.72.72,0,0,1,6,12.51a5.45,5.45,0,0,1,.66-.45,2.71,2.71,0,0,0,.67-.57,1.19,1.19,0,0,0,.31-.81,1.29,1.29,0,0,0-.45-1,1.86,1.86,0,0,0-2-.11,1.51,1.51,0,0,0-.62.7l.74.52A.87.87,0,0,1,6,10.28a.51.51,0,0,1,.35.12.42.42,0,0,1,.13.33.55.55,0,0,1-.21.4,3,3,0,0,1-.5.38c-.19.13-.39.27-.58.42a2,2,0,0,0-.5.6,1.63,1.63,0,0,0-.21.81,3.89,3.89,0,0,0,.05.48h3.2V12.44Zm12.45,2.82a.27.27,0,0,0-.08-.19.28.28,0,0,0-.21-.08H9.1a.32.32,0,0,0-.21.08.24.24,0,0,0-.08.2V17a.27.27,0,0,0,.08.19.3.3,0,0,0,.21.08H19.83a.32.32,0,0,0,.21-.08.25.25,0,0,0,.08-.19V15.26ZM7.69,7.32h-1V3.76H5.8L4.6,4.88l.63.68a1.85,1.85,0,0,0,.43-.48h0l0,2.24H4.74V8.2h3V7.32Zm12.43,3.42a.27.27,0,0,0-.08-.19.28.28,0,0,0-.21-.08H9.1a.32.32,0,0,0-.21.08.24.24,0,0,0-.08.2v1.71a.27.27,0,0,0,.08.19.3.3,0,0,0,.21.08H19.83a.32.32,0,0,0,.21-.08.25.25,0,0,0,.08-.19V10.74Zm0-4.52A.27.27,0,0,0,20,6,.28.28,0,0,0,19.83,6H9.1A.32.32,0,0,0,8.89,6a.24.24,0,0,0-.08.19V7.93a.27.27,0,0,0,.08.19.32.32,0,0,0,.21.08H19.83A.32.32,0,0,0,20,8.12a.26.26,0,0,0,.08-.2V6.22Z" transform="translate(-4.43 -3.76)"/></g></svg>',list_checked:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21,19V17H8V19H21M21,13V11H8V13H21M8,7H21V5H8V7M4,5V7H6V5H4M3,5A1,1 0 0,1 4,4H6A1,1 0 0,1 7,5V7A1,1 0 0,1 6,8H4A1,1 0 0,1 3,7V5M4,11V13H6V11H4M3,11A1,1 0 0,1 4,10H6A1,1 0 0,1 7,11V13A1,1 0 0,1 6,14H4A1,1 0 0,1 3,13V11M4,17V19H6V17H4M3,17A1,1 0 0,1 4,16H6A1,1 0 0,1 7,17V19A1,1 0 0,1 6,20H4A1,1 0 0,1 3,19V17Z" /></svg>',table:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M4.41,8.05V3.76H8.7V8.05H4.41Zm5.71,0V3.76h4.3V8.05h-4.3Zm5.74-4.29h4.29V8.05H15.86V3.76Zm-11.45,10V9.48H8.7v4.3H4.41Zm5.71,0V9.48h4.3v4.3h-4.3Zm5.74,0V9.48h4.29v4.3H15.86ZM4.41,19.5V15.21H8.7V19.5H4.41Zm5.71,0V15.21h4.3V19.5h-4.3Zm5.74,0V15.21h4.29V19.5H15.86Z" transform="translate(-4.41 -3.76)"/></g></svg>',table_header:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 15.74"><g><path d="M17,19.5v-.78H15.5v.78H17Zm-3,0v-.78H12.5v.78H14Zm-3,0v-.78H9.53v.78H11Zm-3,0v-.78H6.53v.78H8Zm10.55,0a1.73,1.73,0,0,0,.85-.35,1.67,1.67,0,0,0,.56-.76l-.71-.31a1.21,1.21,0,0,1-.35.4,1.34,1.34,0,0,1-.53.23l.08.38c.06.24.09.38.1.41Zm-13.7-.63.55-.55A.77.77,0,0,1,5.25,18a1.31,1.31,0,0,1-.06-.38v-.38H4.41v.38a2,2,0,0,0,.12.68,1.6,1.6,0,0,0,.35.57Zm15.27-2.12V15.26h-.78v1.49h.78Zm-15-1V14.23H4.41v1.49h.78Zm15-2V12.26h-.78v1.49h.78Zm-15-1V11.22H4.41v1.51h.78Zm15-2V9.26h-.78v1.51h.78Zm-15-1V8.17H4.41V9.74h.78Zm15-2V6.28h-.78V7.77h.78Zm-15-1.11V5.33L4.48,5.1a.77.77,0,0,0-.07.27,2.72,2.72,0,0,0,0,.28v1h.79ZM19.21,5l.63-.4A1.62,1.62,0,0,0,19.16,4a1.94,1.94,0,0,0-.91-.22v.78a1.31,1.31,0,0,1,.56.12.88.88,0,0,1,.4.36ZM6,4.54H7.78V3.76H6a.82.82,0,0,0-.28.06l.12.35c.07.21.1.33.11.36Zm10.8,0V3.76H15.28v.78h1.49Zm-3,0V3.76H12.28v.78h1.49Zm-3,0V3.76H9.28v.78h1.51ZM6,10.84h12.6V6.91H6Z" transform="translate(-4.4 -3.76)"/></g></svg>',table_properties:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.88 12L2.2 16.06L6.26 17.74L7.94 21.8L11 20.53V18.36L9 19.19L7.79 16.21L4.81 15L6.05 12L4.81 9L7.79 7.79L9 4.81L12 6.05L15 4.81L16.21 7.79L19.19 9L17.95 12L18 12.13L19.38 10.75C19.82 10.3 20.38 10.06 20.94 10L21.8 7.94L17.74 6.26L16.06 2.2L12 3.88L7.94 2.2L6.26 6.26L2.2 7.94L3.88 12M22.85 13.47L21.53 12.15C21.33 11.95 21 11.95 20.81 12.15L19.83 13.13L21.87 15.17L22.85 14.19C23.05 14 23.05 13.67 22.85 13.47M13 19.96V22H15.04L21.17 15.88L19.13 13.83L13 19.96Z" /></svg>',cell_properties:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.58,17L12,14.84L8.42,17L9.37,12.93L6.21,10.2L10.38,9.84L12,6L13.62,9.83L17.79,10.19L14.63,12.92L15.58,17M19,3A2,2 0 0,1 21,5V19C21,20.11 20.1,21 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3H19M5,5V19H19V5H5Z" /></svg>',table_column:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,2H16A2,2 0 0,1 18,4V20A2,2 0 0,1 16,22H8A2,2 0 0,1 6,20V4A2,2 0 0,1 8,2M8,10V14H16V10H8M8,16V20H16V16H8M8,4V8H16V4H8Z" /></svg>',table_row:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,14A2,2 0 0,1 20,16H4A2,2 0 0,1 2,14V10A2,2 0 0,1 4,8H20A2,2 0 0,1 22,10V14M4,14H8V10H4V14M10,14H14V10H10V14M16,14H20V10H16V14Z" /></svg>',color_checked:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z" /></svg>',color_palette:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z" /></svg>',border_all:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,11H13V5H19M19,19H13V13H19M11,11H5V5H11M11,19H5V13H11M3,21H21V3H3V21Z" /></svg>',border_inside:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,17H21V15H19M19,21H21V19H19M13,3H11V11H3V13H11V21H13V13H21V11H13M15,21H17V19H15M19,5H21V3H19M19,9H21V7H19M17,3H15V5H17M5,3H3V5H5M9,3H7V5H9M3,17H5V15H3M5,7H3V9H5M7,21H9V19H7M3,21H5V19H3V21Z" /></svg>',border_horizontal:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,21H21V19H19M15,21H17V19H15M11,17H13V15H11M19,9H21V7H19M19,5H21V3H19M3,13H21V11H3M11,21H13V19H11M19,17H21V15H19M13,3H11V5H13M13,7H11V9H13M17,3H15V5H17M9,3H7V5H9M5,3H3V5H5M7,21H9V19H7M3,17H5V15H3M5,7H3V9H5M3,21H5V19H3V21Z" /></svg>',border_vertical:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,13H17V11H15M15,21H17V19H15M15,5H17V3H15M19,9H21V7H19M19,5H21V3H19M19,13H21V11H19M19,21H21V19H19M11,21H13V3H11M19,17H21V15H19M7,5H9V3H7M3,17H5V15H3M3,21H5V19H3M3,13H5V11H3M7,13H9V11H7M7,21H9V19H7M3,5H5V3H3M3,9H5V7H3V9Z" /></svg>',border_outside:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,11H7V13H9M13,15H11V17H13M19,19H5V5H19M3,21H21V3H3M17,11H15V13H17M13,11H11V13H13M13,7H11V9H13V7Z" /></svg>',border_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,5H17V3H15M15,13H17V11H15M19,21H21V19H19M19,13H21V11H19M19,5H21V3H19M19,17H21V15H19M15,21H17V19H15M19,9H21V7H19M3,21H5V3H3M7,13H9V11H7M7,5H9V3H7M7,21H9V19H7M11,13H13V11H11M11,9H13V7H11M11,5H13V3H11M11,17H13V15H11M11,21H13V19H11V21Z" /></svg>',border_top:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,13H17V11H15M19,21H21V19H19M11,9H13V7H11M15,21H17V19H15M19,17H21V15H19M3,5H21V3H3M19,13H21V11H19M19,9H21V7H19M11,17H13V15H11M3,9H5V7H3M3,13H5V11H3M3,21H5V19H3M3,17H5V15H3M11,21H13V19H11M11,13H13V11H11M7,13H9V11H7M7,21H9V19H7V21Z" /></svg>',border_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,5H13V3H11M15,5H17V3H15M15,21H17V19H15M19,21H21V3H19M3,9H5V7H3M3,17H5V15H3M3,13H5V11H3M11,21H13V19H11M3,21H5V19H3M7,5H9V3H7M3,5H5V3H3M7,21H9V19H7V21Z" /></svg>',border_bottom:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,15H3V17H5M3,21H21V19H3M5,11H3V13H5M19,9H21V7H19M19,5H21V3H19M5,7H3V9H5M19,17H21V15H19M19,13H21V11H19M17,3H15V5H17M13,3H11V5H13M5,3H3V5H5M9,3H7V5H9" /></svg>',border_none:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,5H17V3H15M15,13H17V11H15M15,21H17V19H15M11,5H13V3H11M19,5H21V3H19M11,9H13V7H11M19,9H21V7H19M19,21H21V19H19M19,13H21V11H19M19,17H21V15H19M11,13H13V11H11M3,5H5V3H3M3,9H5V7H3M3,13H5V11H3M3,17H5V15H3M3,21H5V19H3M11,21H13V19H11M11,17H13V15H11M7,21H9V19H7M7,13H9V11H7M7,5H9V3H7V5Z" /></svg>',horizontal_line:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 2.24"><g><path d="M20.15,12.75V10.51H4.41v2.24H20.15Z" transform="translate(-4.41 -10.51)"/></g></svg>',show_blocks:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M40-40v-240h80v-400H40v-240h240v80h400v-80h240v240h-80v400h80v240H680v-80H280v80H40Zm240-160h400v-80h80v-400h-80v-80H280v80h-80v400h80v80Zm32-120 136-360h64l136 360h-62l-32-92H408l-32 92h-64Zm114-144h108l-52-150h-4l-52 150ZM120-760h80v-80h-80v80Zm640 0h80v-80h-80v80Zm0 640h80v-80h-80v80Zm-640 0h80v-80h-80v80Zm80-640Zm560 0Zm0 560Zm-560 0Z"/></svg>',cancel:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" /></svg>',selection_remove:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 20V17H22V20C22 21.11 21.1 22 20 22H17V20H20M2 20V17H4V20H7V22H4C2.9 22 2 21.1 2 20M10 20H14V22H10V20M14.59 8L12 10.59L9.41 8L8 9.41L10.59 12L8 14.59L9.41 16L12 13.41L14.59 16L16 14.59L13.41 12L16 9.41L14.59 8M20 10H22V14H20V10M2 10H4V14H2V10M2 4C2 2.89 2.9 2 4 2H7V4H4V7H2V4M22 4V7H20V4H17V2H20C21.1 2 22 2.9 22 4M10 2H14V4H10V2Z" /></svg>',image:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,19H5V5H19M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M13.96,12.29L11.21,15.83L9.25,13.47L6.5,17H17.5L13.96,12.29Z" /></svg>',image_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2L20,8V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2H14M18,20V9H13V4H6V20H18M17,13V19H7L12,14L14,16M10,10.5A1.5,1.5 0 0,1 8.5,12A1.5,1.5 0 0,1 7,10.5A1.5,1.5 0 0,1 8.5,9A1.5,1.5 0 0,1 10,10.5Z" /></svg>',video:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,19H5V5H19M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M10,8V16L15,12L10,8Z" /></svg>',video_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2L20,8V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2H14M18,20V9H13V4H6V20H18M16,18L13.5,16.3V18H8V13H13.5V14.7L16,13V18Z" /></svg>',link:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z" /></svg>',link_rel:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 1C1.89 1 1 1.89 1 3V14C1 15.11 1.89 16 3 16H14C15.11 16 16 15.11 16 14V11H14V14H3V3H14V5H16V3C16 1.89 15.11 1 14 1M9 7C7.89 7 7 7.89 7 9V12H9V9H20V20H9V18H7V20C7 21.11 7.89 22 9 22H20C21.11 22 22 21.11 22 20V9C22 7.89 21.11 7 20 7H9" /></svg>',math:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11.81 15.73"><g><path d="M17.19,5.73a1,1,0,0,0,.71-.29,1,1,0,0,0,.28-.7,1,1,0,0,0-1-1H7.35a1,1,0,0,0-1,1,.77.77,0,0,0,.13.47h0l4.58,6.43L6.68,17.81a1.25,1.25,0,0,0-.29.71.94.94,0,0,0,.28.7.92.92,0,0,0,.69.28H17.2a1,1,0,0,0,.71-.28,1,1,0,0,0,0-1.39.92.92,0,0,0-.71-.29H9.26l3.87-5.43a.86.86,0,0,0,0-.95L9.26,5.73h7.93Z" transform="translate(-6.38 -3.77)"/></g></svg>',unlink:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.43 19.12,14.63 17.79,15L19.25,16.44C20.88,15.61 22,13.95 22,12A5,5 0 0,0 17,7M16,11H13.81L15.81,13H16V11M2,4.27L5.11,7.38C3.29,8.12 2,9.91 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12C3.9,10.41 5.11,9.1 6.66,8.93L8.73,11H8V13H10.73L13,15.27V17H14.73L18.74,21L20,19.74L3.27,3L2,4.27Z" /></svg>',merge_cell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,10H3V4H11V6H5V10M19,18H13V20H21V14H19V18M5,18V14H3V20H11V18H5M21,4H13V6H19V10H21V4M8,13V15L11,12L8,9V11H3V13H8M16,11V9L13,12L16,15V13H21V11H16Z" /></svg>',split_cell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 14H21V20H3V14H5V18H19V14M3 4V10H5V6H19V10H21V4H3M11 11V13H8V15L5 12L8 9V11H11M16 11V9L19 12L16 15V13H13V11H16Z" /></svg>',unmerge_cell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,10H3V4H11V6H5V10M19,18H13V20H21V14H19V18M5,18V14H3V20H11V18H5M21,4H13V6H19V10H21V4"/><line x1="7.5" y1="12" x2="16.5" y2="12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>',caption:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.79"><g><path d="M4.41,18.52H20.15v-2H4.41ZM20,4.73H18.07V6h.65v.65H20V4.73ZM17,6V4.73H14.55V6H17ZM13.49,6V4.73H11V6h2.47ZM10,6V4.73H7.5V6H10ZM5.79,6h.65V4.73H4.5V6.67H5.8V6ZM4.5,11.34H5.79V8.48H4.5ZM6.44,13.8H5.79v-.65H4.5v1.94H6.44ZM17,15.09V13.8H14.55v1.29H17Zm-3.52,0V13.8H11v1.29h2.47Zm-3.53,0V13.8H7.5v1.29H10ZM20,13.16H18.72v.65h-.65V15.1H20Zm-1.29-1.82H20V8.48h-1.3v2.86Z" transform="translate(-4.41 -4.73)"/></g></svg>',edit:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.73"><g><path d="M7.51,5.68h6l1.52-1.57H6.94a2.4,2.4,0,0,0-1.79.82A2.8,2.8,0,0,0,4.41,6.8V17a2.55,2.55,0,0,0,.75,1.8A2.48,2.48,0,0,0,7,19.5H17.22a2.57,2.57,0,0,0,1.83-.74,2.52,2.52,0,0,0,.77-1.8V8.83l-1.58,1.54v6a1.54,1.54,0,0,1-1.53,1.53H7.51A1.54,1.54,0,0,1,6,16.41V7.21A1.52,1.52,0,0,1,7.51,5.68Zm5.63,7.47h0L10.7,10.74l-1,3.38,1.71-.48,1.7-.49Zm.34-.34h0l5.36-5.32L16.4,5.08,11,10.4l1.23,1.21,1.21,1.2ZM19.93,6.4a.82.82,0,0,0,.22-.48A.54.54,0,0,0,20,5.47L18.45,4A.67.67,0,0,0,18,3.77a.7.7,0,0,0-.48.21l-.74.72,2.44,2.43.37-.37.35-.36Z" transform="translate(-4.41 -3.77)"/></g></svg>',delete:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 15.74"><g><path d="M19.16,6.71a.94.94,0,0,0,.69-.28.91.91,0,0,0,.29-.68A1,1,0,0,0,19.85,5a.93.93,0,0,0-.69-.3H14.24A.94.94,0,0,0,14,4.06a.92.92,0,0,0-.7-.3h-2a1,1,0,0,0-.7.3.93.93,0,0,0-.28.68H5.39A.92.92,0,0,0,4.7,5a1,1,0,0,0-.29.71.91.91,0,0,0,.29.68,1,1,0,0,0,.69.28H19.16Zm-12.79,1a1,1,0,0,0-.7.3.94.94,0,0,0-.28.69v8.85A1.88,1.88,0,0,0,6,18.93a1.9,1.9,0,0,0,1.39.57H17.2a1.87,1.87,0,0,0,1.39-.58,1.91,1.91,0,0,0,.58-1.39V8.68A1,1,0,0,0,18.88,8a.89.89,0,0,0-.7-.29,1,1,0,0,0-.69.29.92.92,0,0,0-.29.68v7.87a1,1,0,0,1-1,1H8.34a.94.94,0,0,1-.69-.28,1,1,0,0,1-.29-.71V8.68a1,1,0,0,0-1-1Z" transform="translate(-4.41 -3.76)"/></g></svg>',revert:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.76 14.69"><g><path d="M18.26,15V12.3l1.89-2V15a2.58,2.58,0,0,1-.24,1c-.2.58-.75.92-1.65,1H7.56v2L4.41,15.63,7.56,13v2h10.7ZM6.3,8.28V11L4.41,13V8.28a2.58,2.58,0,0,1,.24-1c.2-.58.75-.92,1.65-1H17v-2l3.15,3.34L17,10.3v-2H6.3Z" transform="translate(-4.4 -4.28)"/></g></svg>',auto_size:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M6.71,17.19,6.89,16l1.21-.15A6,6,0,0,1,6.81,13.9a5.78,5.78,0,0,1-.45-2.27A6,6,0,0,1,8.1,7.45a5.83,5.83,0,0,1,4.17-1.73l1-1-1-1A7.89,7.89,0,0,0,5,14.64a7.73,7.73,0,0,0,1.71,2.55Zm5.57,2.31h0A7.86,7.86,0,0,0,17.85,6.07L17.67,7.3l-1.21.15a5.9,5.9,0,0,1,1.29,1.92,5.81,5.81,0,0,1,.45,2.26,5.91,5.91,0,0,1-5.9,5.9l-1,1,.49.49.47.5Z" transform="translate(-4.41 -3.76)"/></g></svg>',resize:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M23,15H21V17H23V15M23,11H21V13H23V11M23,19H21V21C22,21 23,20 23,19M15,3H13V5H15V3M23,7H21V9H23V7M21,3V5H23C23,4 22,3 21,3M3,21H11V15H1V19A2,2 0 0,0 3,21M3,7H1V9H3V7M15,19H13V21H15V19M19,3H17V5H19V3M19,19H17V21H19V19M3,3C2,3 1,4 1,5H3V3M3,11H1V13H3V11M11,3H9V5H11V3M7,3H5V5H7V3Z" /></svg>',insert_row_below:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,10A2,2 0 0,1 20,12H4A2,2 0 0,1 2,10V3H4V5H8V3H10V5H14V3H16V5H20V3H22V10M4,10H8V7H4V10M10,10H14V7H10V10M20,10V7H16V10H20M11,14H13V17H16V19H13V22H11V19H8V17H11V14Z" /></svg>',insert_row_above:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,14A2,2 0 0,0 20,12H4A2,2 0 0,0 2,14V21H4V19H8V21H10V19H14V21H16V19H20V21H22V14M4,14H8V17H4V14M10,14H14V17H10V14M20,14V17H16V14H20M11,10H13V7H16V5H13V2H11V5H8V7H11V10Z" /></svg>',insert_column_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,2A2,2 0 0,0 11,4V20A2,2 0 0,0 13,22H22V2H13M20,10V14H13V10H20M20,16V20H13V16H20M20,4V8H13V4H20M9,11H6V8H4V11H1V13H4V16H6V13H9V11Z" /></svg>',insert_column_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,2A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H2V2H11M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M15,11H18V8H20V11H23V13H20V16H18V13H15V11Z" /></svg>',delete_row:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.41,13L12,15.59L14.59,13L16,14.41L13.41,17L16,19.59L14.59,21L12,18.41L9.41,21L8,19.59L10.59,17L8,14.41L9.41,13M22,9A2,2 0 0,1 20,11H4A2,2 0 0,1 2,9V6A2,2 0 0,1 4,4H20A2,2 0 0,1 22,6V9M4,9H8V6H4V9M10,9H14V6H10V9M16,9H20V6H16V9Z" /></svg>',delete_column:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4,2H11A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H4A2,2 0 0,1 2,20V4A2,2 0 0,1 4,2M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M17.59,12L15,9.41L16.41,8L19,10.59L21.59,8L23,9.41L20.41,12L23,14.59L21.59,16L19,13.41L16.41,16L15,14.59L17.59,12Z" /></svg>',fixed_column_width:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,8H19A2,2 0 0,1 21,10V20A2,2 0 0,1 19,22H5A2,2 0 0,1 3,20V10A2,2 0 0,1 5,8M5,12V15H11V12H5M13,12V15H19V12H13M5,17V20H11V17H5M13,17V20H19V17H13M11,2H21V6H19V4H13V6H11V2Z" /></svg>',rotate_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,4.07V1L8.45,5.55L13,10V6.09C15.84,6.57 18,9.03 18,12C18,14.97 15.84,17.43 13,17.91V19.93C16.95,19.44 20,16.08 20,12C20,7.92 16.95,4.56 13,4.07M7.1,18.32C8.26,19.22 9.61,19.76 11,19.93V17.9C10.13,17.75 9.29,17.41 8.54,16.87L7.1,18.32M6.09,13H4.07C4.24,14.39 4.79,15.73 5.69,16.89L7.1,15.47C6.58,14.72 6.23,13.88 6.09,13M7.11,8.53L5.7,7.11C4.8,8.27 4.24,9.61 4.07,11H6.09C6.23,10.13 6.58,9.28 7.11,8.53Z" /></svg>',rotate_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16.89,15.5L18.31,16.89C19.21,15.73 19.76,14.39 19.93,13H17.91C17.77,13.87 17.43,14.72 16.89,15.5M13,17.9V19.92C14.39,19.75 15.74,19.21 16.9,18.31L15.46,16.87C14.71,17.41 13.87,17.76 13,17.9M19.93,11C19.76,9.61 19.21,8.27 18.31,7.11L16.89,8.53C17.43,9.28 17.77,10.13 17.91,11M15.55,5.55L11,1V4.07C7.06,4.56 4,7.92 4,12C4,16.08 7.05,19.44 11,19.93V17.91C8.16,17.43 6,14.97 6,12C6,9.03 8.16,6.57 11,6.09V10L15.55,5.55Z" /></svg>',mirror_horizontal:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.75 15.74"><g><path d="M13.75,3.76l5.9,15.74h-5.9V3.76ZM4.9,19.5,10.8,3.76V19.5H4.9Z" transform="translate(-4.9 -3.76)"/></g></svg>',mirror_vertical:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 14.75"><g><path d="M20.15,13.1,4.41,19V13.1H20.15ZM4.41,4.25l15.74,5.9H4.41V4.25Z" transform="translate(-4.41 -4.25)"/></g></svg>',checked:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 12.1"><g><path d="M4.59,12.23l.12.18L9.43,17.5a.58.58,0,0,0,.84,0L20,7.45h0a.58.58,0,0,0,0-.84l-.85-.85a.58.58,0,0,0-.84,0H18.2l-8.12,8.41a.29.29,0,0,1-.42,0l-3.4-3.63a.58.58,0,0,0-.84,0l-.85.85a.6.6,0,0,0-.14.21.51.51,0,0,0,0,.44c.05.06.1.13.16.19Z" transform="translate(-4.38 -5.58)"/></g></svg>',line_break:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,6a1,1,0,0,0-1,1v4a1,1,0,0,1-1,1H7.41l1.3-1.29A1,1,0,0,0,7.29,9.29l-3,3a1,1,0,0,0-.21.33,1,1,0,0,0,0,.76,1,1,0,0,0,.21.33l3,3a1,1,0,0,0,1.42,0,1,1,0,0,0,0-1.42L7.41,14H17a3,3,0,0,0,3-3V7A1,1,0,0,0,19,6Z"/></svg>',audio:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,9H13V14.5A2.5,2.5 0 0,1 10.5,17A2.5,2.5 0 0,1 8,14.5A2.5,2.5 0 0,1 10.5,12C11.07,12 11.58,12.19 12,12.5V7H16V9M19,3A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3H19M5,5V19H19V5H5Z" /></svg>',audio_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20,4H4A2,2 0 0,0 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V6A2,2 0 0,0 20,4M7.76,16.24L6.35,17.65C4.78,16.1 4,14.05 4,12C4,9.95 4.78,7.9 6.34,6.34L7.75,7.75C6.59,8.93 6,10.46 6,12C6,13.54 6.59,15.07 7.76,16.24M12,16A4,4 0 0,1 8,12A4,4 0 0,1 12,8A4,4 0 0,1 16,12A4,4 0 0,1 12,16M17.66,17.66L16.25,16.25C17.41,15.07 18,13.54 18,12C18,10.46 17.41,8.93 16.24,7.76L17.65,6.35C19.22,7.9 20,9.95 20,12C20,14.05 19.22,16.1 17.66,17.66M12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12A2,2 0 0,0 12,10Z" /></svg>',image_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21,17H7V3H21M21,1H7A2,2 0 0,0 5,3V17A2,2 0 0,0 7,19H21A2,2 0 0,0 23,17V3A2,2 0 0,0 21,1M3,5H1V21A2,2 0 0,0 3,23H19V21H3M15.96,10.29L13.21,13.83L11.25,11.47L8.5,15H19.5L15.96,10.29Z" /></svg>',audio_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20,2H8A2,2 0 0,0 6,4V16A2,2 0 0,0 8,18H20A2,2 0 0,0 22,16V4A2,2 0 0,0 20,2M20,16H8V4H20M12.5,15A2.5,2.5 0 0,0 15,12.5V7H18V5H14V10.5C13.58,10.19 13.07,10 12.5,10A2.5,2.5 0 0,0 10,12.5A2.5,2.5 0 0,0 12.5,15M4,6H2V20A2,2 0 0,0 4,22H18V20H4" /></svg>',video_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 6H2V20C2 21.1 2.9 22 4 22H18V20H4V6M20 4V16H8V4H20M20 2H8C6.9 2 6 2.9 6 4V16C6 17.1 6.9 18 8 18H20C21.1 18 22 17.1 22 16V4C22 2.9 21.1 2 20 2M12 14.5V5.5L18 10L12 14.5Z" /></svg>',file_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,15H9V13H16V15M19,11H9V9H19V11M19,7H9V5H19V7M3,5V21H19V23H3A2,2 0 0,1 1,21V5H3M21,1A2,2 0 0,1 23,3V17C23,18.11 22.11,19 21,19H7A2,2 0 0,1 5,17V3C5,1.89 5.89,1 7,1H21M7,3V17H21V3H7Z" /></svg>',file_browser:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 6V20H20V22H2C.895 22 0 21.11 0 20V6H2M12.78 10.05L15.81 9.79L17 7L18.19 9.79L21.22 10.05L18.92 12.04L19.61 15L17 13.47L14.39 15L15.08 12.04L12.78 10.05M24 6V16C24 17.11 23.11 18 22 18H6C4.9 18 4 17.11 4 16V4C4 2.89 4.9 2 6 2H12L14 4H22C23.11 4 24 4.9 24 6M22 6H6V16H22V6Z" /></svg>',bookmark:'<svg viewBox="0 0 24 24"><path d="M17,3H7A2,2 0 0,0 5,5V21L12,18L19,21V5C19,3.89 18.1,3 17,3Z" /></svg>',bookmark_anchor:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17,18L12,15.82L7,18V5H17M17,3H7A2,2 0 0,0 5,5V21L12,18L19,21V5C19,3.89 18.1,3 17,3Z" /></svg>',download:'<svg viewBox="0 0 24 24"><path d="M2 12H4V17H20V12H22V17C22 18.11 21.11 19 20 19H4C2.9 19 2 18.11 2 17V12M12 15L17.55 9.54L16.13 8.13L13 11.25V2H11V11.25L7.88 8.13L6.46 9.55L12 15Z" /></svg>',dir_ltr:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M9 4v4c-1.1 0-2-.9-2-2s.9-2 2-2m8-2H9C6.79 2 5 3.79 5 6s1.79 4 4 4v5h2V4h2v11h2V4h2V2zm0 12v3H5v2h12v3l4-4-4-4z"/></svg>',dir_rtl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M10 4v4c-1.1 0-2-.9-2-2s.9-2 2-2m8-2h-8C7.79 2 6 3.79 6 6s1.79 4 4 4v5h2V4h2v11h2V4h2V2zM8 14l-4 4 4 4v-3h12v-2H8v-3z"/></svg>',dragHandle:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M360-160q-33 0-56.5-23.5T280-240q0-33 23.5-56.5T360-320q33 0 56.5 23.5T440-240q0 33-23.5 56.5T360-160Zm240 0q-33 0-56.5-23.5T520-240q0-33 23.5-56.5T600-320q33 0 56.5 23.5T680-240q0 33-23.5 56.5T600-160ZM360-400q-33 0-56.5-23.5T280-480q0-33 23.5-56.5T360-560q33 0 56.5 23.5T440-480q0 33-23.5 56.5T360-400Zm240 0q-33 0-56.5-23.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 33-23.5 56.5T600-400ZM360-640q-33 0-56.5-23.5T280-720q0-33 23.5-56.5T360-800q33 0 56.5 23.5T440-720q0 33-23.5 56.5T360-640Zm240 0q-33 0-56.5-23.5T520-720q0-33 23.5-56.5T600-800q33 0 56.5 23.5T680-720q0 33-23.5 56.5T600-640Z"/></svg>',file_upload:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2L20,8V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2H14M18,20V9H13V4H6V20H18M12,12L16,16H13.5V19H10.5V16H8L12,12Z" /></svg>',file_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z" /></svg>',file_plus:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13.81 22H6C4.89 22 4 21.11 4 20V4C4 2.9 4.89 2 6 2H14L20 8V13.09C19.67 13.04 19.34 13 19 13S18.33 13.04 18 13.09V9H13V4H6V20H13.09C13.21 20.72 13.46 21.39 13.81 22M23 18H20V15H18V18H15V20H18V23H20V20H23V18Z" /></svg>',upload_tray:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 12H4V17H20V12H22V17C22 18.11 21.11 19 20 19H4C2.9 19 2 18.11 2 17V12M12 2L6.46 7.46L7.88 8.88L11 5.75V15H13V5.75L16.13 8.88L17.55 7.45L12 2Z" /></svg>',folder:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20,18H4V8H20M20,6H12L10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6Z" /></svg>',plus:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z" /></svg>',minus:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,13H5V11H19V13Z" /></svg>',selection:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2,4C2,2.89 2.9,2 4,2H7V4H4V7H2V4M22,4V7H20V4H17V2H20A2,2 0 0,1 22,4M20,20V17H22V20C22,21.11 21.1,22 20,22H17V20H20M2,20V17H4V20H7V22H4A2,2 0 0,1 2,20M10,2H14V4H10V2M10,20H14V22H10V20M20,10H22V14H20V10M2,10H4V14H2V10Z" /></svg>',copy:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z" /></svg>',cut:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,3L13,9L15,11L22,4V3M12,12.5A0.5,0.5 0 0,1 11.5,12A0.5,0.5 0 0,1 12,11.5A0.5,0.5 0 0,1 12.5,12A0.5,0.5 0 0,1 12,12.5M6,20A2,2 0 0,1 4,18C4,16.89 4.9,16 6,16A2,2 0 0,1 8,18C8,19.11 7.1,20 6,20M6,8A2,2 0 0,1 4,6C4,4.89 4.9,4 6,4A2,2 0 0,1 8,6C8,7.11 7.1,8 6,8M9.64,7.64C9.87,7.14 10,6.59 10,6A4,4 0 0,0 6,2A4,4 0 0,0 2,6A4,4 0 0,0 6,10C6.59,10 7.14,9.87 7.64,9.64L10,12L7.64,14.36C7.14,14.13 6.59,14 6,14A4,4 0 0,0 2,18A4,4 0 0,0 6,22A4,4 0 0,0 10,18C10,17.41 9.87,16.86 9.64,16.36L12,14L19,21H22V20L9.64,7.64Z" /></svg>',PDF:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3M9.5 11.5C9.5 12.3 8.8 13 8 13H7V15H5.5V9H8C8.8 9 9.5 9.7 9.5 10.5V11.5M14.5 13.5C14.5 14.3 13.8 15 13 15H10.5V9H13C13.8 9 14.5 9.7 14.5 10.5V13.5M18.5 10.5H17V11.5H18.5V13H17V15H15.5V9H18.5V10.5M12 10.5H13V13.5H12V10.5M7 10.5H8V11.5H7V10.5Z" /></svg>',format_paint:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18,4V3A1,1 0 0,0 17,2H5A1,1 0 0,0 4,3V7A1,1 0 0,0 5,8H17A1,1 0 0,0 18,7V6H19V10H9V21A1,1 0 0,0 10,22H12A1,1 0 0,0 13,21V12H21V4H18Z" /></svg>',drawing:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.75 20.85C11.53 20.15 11.14 18.22 10.24 17C9.35 15.75 8.12 14.89 6.88 14.06C6 13.5 5.19 12.8 4.54 12C4.26 11.67 3.69 11.06 4.27 10.94C4.86 10.82 5.88 11.4 6.4 11.62C7.31 12 8.21 12.44 9.05 12.96L10.06 11.26C8.5 10.23 6.5 9.32 4.64 9.05C3.58 8.89 2.46 9.11 2.1 10.26C1.78 11.25 2.29 12.25 2.87 13.03C4.24 14.86 6.37 15.74 7.96 17.32C8.3 17.65 8.71 18.04 8.91 18.5C9.12 18.94 9.07 18.97 8.6 18.97C7.36 18.97 5.81 18 4.8 17.36L3.79 19.06C5.32 20 7.88 21.47 9.75 20.85M20.84 5.25C21.06 5.03 21.06 4.67 20.84 4.46L19.54 3.16C19.33 2.95 18.97 2.95 18.76 3.16L17.74 4.18L19.82 6.26M11 10.92V13H13.08L19.23 6.85L17.15 4.77L11 10.92Z" /></svg>',eraser:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.14,3C14.63,3 14.12,3.2 13.73,3.59L2.59,14.73C1.81,15.5 1.81,16.77 2.59,17.56L5.03,20H12.69L21.41,11.27C22.2,10.5 22.2,9.23 21.41,8.44L16.56,3.59C16.17,3.2 15.65,3 15.14,3M17,18L15,20H22V18" /></svg>',search:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z" /></svg>',selection_search:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19.27 18.9C19.7 18.21 19.95 17.38 19.95 16.5C19.95 14 17.95 12 15.46 12S10.96 14 10.96 16.5 12.96 21 15.46 21C16.33 21 17.15 20.75 17.84 20.32L20.96 23.39L22.35 22L19.27 18.9M15.46 19C14.07 19 12.96 17.88 12.96 16.5S14.07 14 15.46 14 17.95 15.12 17.95 16.5 16.84 19 15.46 19M22 14H21.45C21.12 13.19 20.62 12.47 20 11.86V10H22V14M20 4H17V2H20C21.11 2 22 2.9 22 4V7H20V4M14 4H10V2H14V4M4 2H7V4H4V7H2V4C2 2.89 2.9 2 4 2M12 22H10V20C10.5 20.82 11.2 21.5 12 22M4 20H7V22H4C2.9 22 2 21.11 2 20V17H4V20M4 14H2V10H4V14Z" /></svg>',embed:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 19H15V21H19C20.1 21 21 20.1 21 19V15H19M19 3H15V5H19V9H21V5C21 3.9 20.1 3 19 3M5 5H9V3H5C3.9 3 3 3.9 3 5V9H5M5 15H3V19C3 20.1 3.9 21 5 21H9V19H5V15M7 11H9V13H7V11M11 11H13V13H11V11M15 11H17V13H15V11Z" /></svg>',finder:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"/></svg>',regex:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M197-199q-56-57-86.5-130T80-482q0-80 30-153t87-130l57 57q-46 45-70 103.5T160-482q0 64 24.5 122.5T254-256l-57 57Zm140.5-58.5Q320-275 320-300t17.5-42.5Q355-360 380-360t42.5 17.5Q440-325 440-300t-17.5 42.5Q405-240 380-240t-42.5-17.5ZM519-440v-71l-61 36-40-70 61-35-61-35 40-70 61 36v-71h80v71l61-36 40 70-61 35 61 35-40 70-61-36v71h-80Zm244 241-57-57q46-45 70-103.5T800-482q0-64-24.5-122.5T706-708l57-57q56 57 86.5 130T880-482q0 80-30 153t-87 130Z"/></svg>',match_case:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="m131-252 165-440h79l165 440h-76l-39-112H247l-40 112h-76Zm139-176h131l-64-182h-4l-63 182Zm395 186q-51 0-81-27.5T554-342q0-44 34.5-72.5T677-443q23 0 45 4t38 11v-12q0-29-20.5-47T685-505q-23 0-42 9.5T610-468l-47-35q24-29 54.5-43t68.5-14q69 0 103 32.5t34 97.5v178h-63v-37h-4q-14 23-38 35t-53 12Zm12-54q35 0 59.5-24t24.5-56q-14-8-33.5-12.5T689-393q-32 0-50 14t-18 37q0 20 16 33t40 13Z"/></svg>',whole_word:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M40-199v-200h80v120h720v-120h80v200H40Zm342-161v-34h-3q-13 20-35 31.5T294-351q-49 0-77-25.5T189-446q0-42 32.5-68.5T305-541q23 0 42.5 3.5T381-526v-14q0-27-18.5-43T312-599q-21 0-39.5 9T241-564l-43-32q19-27 48-41t67-14q62 0 95 29.5t33 85.5v176h-59Zm-66-134q-32 0-49 12.5T250-446q0 20 15 32.5t39 12.5q32 0 54.5-22.5T381-478q-14-8-32-12t-33-4Zm185 134v-401h62v113l-3 40h3q3-5 24-25.5t66-20.5q64 0 101 46t37 106q0 60-36.5 105.5T653-351q-41 0-62.5-18T563-397h-3v37h-59Zm143-238q-40 0-62 29.5T560-503q0 37 22 66t62 29q40 0 62.5-29t22.5-66q0-37-22.5-66T644-598Z"/></svg>',swap_vert:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M320-440v-287L217-624l-57-56 200-200 200 200-57 56-103-103v287h-80ZM600-80 400-280l57-56 103 103v-287h80v287l103-103 57 56L600-80Z"/></svg>',arrow_down_small:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"/></svg>',arrow_up_small:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z"/></svg>',replaceText:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" ><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g><path fill-rule="evenodd" clip-rule="evenodd" d="M3.221 3.739l2.261 2.269L7.7 3.784l-.7-.7-1.012 1.007-.008-1.6a.523.523 0 0 1 .5-.526H8V1H6.48A1.482 1.482 0 0 0 5 2.489V4.1L3.927 3.033l-.706.706zm6.67 1.794h.01c.183.311.451.467.806.467.393 0 .706-.168.94-.503.236-.335.353-.78.353-1.333 0-.511-.1-.913-.301-1.207-.201-.295-.488-.442-.86-.442-.405 0-.718.194-.938.581h-.01V1H9v4.919h.89v-.386zm-.015-1.061v-.34c0-.248.058-.448.175-.601a.54.54 0 0 1 .445-.23.49.49 0 0 1 .436.233c.104.154.155.368.155.643 0 .33-.056.587-.169.768a.524.524 0 0 1-.47.27.495.495 0 0 1-.411-.211.853.853 0 0 1-.16-.532zM9 12.769c-.256.154-.625.231-1.108.231-.563 0-1.02-.178-1.369-.533-.349-.355-.523-.813-.523-1.374 0-.648.186-1.158.56-1.53.374-.376.875-.563 1.5-.563.433 0 .746.06.94.179v.998a1.26 1.26 0 0 0-.792-.276c-.325 0-.583.1-.774.298-.19.196-.283.468-.283.816 0 .338.09.603.272.797.182.191.431.287.749.287.282 0 .558-.092.828-.276v.946zM4 7L3 8v6l1 1h7l1-1V8l-1-1H4zm0 1h7v6H4V8z"></path></g></svg>',relaceTextAll:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g><path fill-rule="evenodd" clip-rule="evenodd" d="M11.6 2.677c.147-.31.356-.465.626-.465.248 0 .44.118.573.353.134.236.201.557.201.966 0 .443-.078.798-.235 1.067-.156.268-.365.402-.627.402-.237 0-.416-.125-.537-.374h-.008v.31H11V1h.593v1.677h.008zm-.016 1.1a.78.78 0 0 0 .107.426c.071.113.163.169.274.169.136 0 .24-.072.314-.216.075-.145.113-.35.113-.615 0-.22-.035-.39-.104-.514-.067-.124-.164-.187-.29-.187-.12 0-.219.062-.297.185a.886.886 0 0 0-.117.48v.272zM4.12 7.695L2 5.568l.662-.662 1.006 1v-1.51A1.39 1.39 0 0 1 5.055 3H7.4v.905H5.055a.49.49 0 0 0-.468.493l.007 1.5.949-.944.656.656-2.08 2.085zM9.356 4.93H10V3.22C10 2.408 9.685 2 9.056 2c-.135 0-.285.024-.45.073a1.444 1.444 0 0 0-.388.167v.665c.237-.203.487-.304.75-.304.261 0 .392.156.392.469l-.6.103c-.506.086-.76.406-.76.961 0 .263.061.473.183.631A.61.61 0 0 0 8.69 5c.29 0 .509-.16.657-.48h.009v.41zm.004-1.355v.193a.75.75 0 0 1-.12.436.368.368 0 0 1-.313.17.276.276 0 0 1-.22-.095.38.38 0 0 1-.08-.248c0-.222.11-.351.332-.389l.4-.067zM7 12.93h-.644v-.41h-.009c-.148.32-.367.48-.657.48a.61.61 0 0 1-.507-.235c-.122-.158-.183-.368-.183-.63 0-.556.254-.876.76-.962l.6-.103c0-.313-.13-.47-.392-.47-.263 0-.513.102-.75.305v-.665c.095-.063.224-.119.388-.167.165-.049.315-.073.45-.073.63 0 .944.407.944 1.22v1.71zm-.64-1.162v-.193l-.4.068c-.222.037-.333.166-.333.388 0 .1.027.183.08.248a.276.276 0 0 0 .22.095.368.368 0 0 0 .312-.17c.08-.116.12-.26.12-.436zM9.262 13c.321 0 .568-.058.738-.173v-.71a.9.9 0 0 1-.552.207.619.619 0 0 1-.5-.215c-.12-.145-.181-.345-.181-.598 0-.26.063-.464.189-.612a.644.644 0 0 1 .516-.223c.194 0 .37.069.528.207v-.749c-.129-.09-.338-.134-.626-.134-.417 0-.751.14-1.001.422-.249.28-.373.662-.373 1.148 0 .42.116.764.349 1.03.232.267.537.4.913.4zM2 9l1-1h9l1 1v5l-1 1H3l-1-1V9zm1 0v5h9V9H3zm3-2l1-1h7l1 1v5l-1 1V7H6z"></path></g></svg>',menu_arrow_down:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7,10L12,15L17,10H7Z" /></svg>',menu_arrow_up:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7,15L12,10L17,15H7Z" /></svg>',menu_arrow_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,17L15,12L10,7V17Z" /></svg>',menu_arrow_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,7L9,12L14,17V7Z" /></svg>',side_menu_hamburger:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z" /></svg>',side_menu_folder:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,4A2,2 0 0,1 24,6V16A2,2 0 0,1 22,18H6A2,2 0 0,1 4,16V4A2,2 0 0,1 6,2H12L14,4H22M2,6V20H20V22H2A2,2 0 0,1 0,20V11H0V6H2M6,6V16H22V6H6Z" /></svg>',side_menu_folder_item:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,4H14L12,2H6A2,2 0 0,0 4,4V16A2,2 0 0,0 6,18H22A2,2 0 0,0 24,16V6A2,2 0 0,0 22,4M2,6H0V11H0V20A2,2 0 0,0 2,22H20V20H2V6Z" /></svg>',side_menu_item:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6H12L10,4Z" /></svg>',side_menu_folder_plus:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 19C13 19.34 13.04 19.67 13.09 20H4C2.9 20 2 19.11 2 18V6C2 4.89 2.89 4 4 4H10L12 6H20C21.1 6 22 6.89 22 8V13.81C21.12 13.3 20.1 13 19 13C15.69 13 13 15.69 13 19M20 18V15H18V18H15V20H18V23H20V20H23V18H20Z" /></svg>',alert_outline:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,15H13V17H11V15M11,7H13V13H11V7M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20Z" /></svg>',more_media:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9 13V5C9 3.9 9.9 3 11 3H20C21.1 3 22 3.9 22 5V11H18.57L17.29 9.26C17.23 9.17 17.11 9.17 17.05 9.26L15.06 12C15 12.06 14.88 12.07 14.82 12L13.39 10.25C13.33 10.18 13.22 10.18 13.16 10.25L11.05 12.91C10.97 13 11.04 13.15 11.16 13.15H17.5V15H11C9.89 15 9 14.11 9 13M6 22V21H4V22H2V2H4V3H6V2H8.39C7.54 2.74 7 3.8 7 5V13C7 15.21 8.79 17 11 17H15.7C14.67 17.83 14 19.08 14 20.5C14 21.03 14.11 21.53 14.28 22H6M4 7H6V5H4V7M4 11H6V9H4V11M4 15H6V13H4V15M6 19V17H4V19H6M23 13V15H21V20.5C21 21.88 19.88 23 18.5 23S16 21.88 16 20.5 17.12 18 18.5 18C18.86 18 19.19 18.07 19.5 18.21V13H23Z" /></svg>',more_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 6V20H18V22H3C2.4 22 2 21.6 2 21V6H4M8 2H20C21.11 2 22 2.9 22 4V16C22 17.11 21.11 18 20 18H8C6.9 18 6 17.11 6 16V4C6 2.9 6.9 2 8 2M16.3 13.3L15.9 10.7L17.8 8.8L15.2 8.4L14 6L12.8 8.4L10.2 8.8L12.1 10.6L11.6 13.2L14 12L16.3 13.3Z" /></svg>',more_folder:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 20V6H0V20C0 21.1 .9 22 2 22H20V20H2M22 4H14L12 2H6C5.6 2 5.2 2.1 4.9 2.3L4.3 2.9C4.1 3.2 4 3.6 4 4V16C4 16.4 4.1 16.8 4.3 17.1C4.4 17.2 4.5 17.3 4.5 17.4C5 17.8 5.5 18 6 18H22C23.1 18 24 17.1 24 16V6C24 4.9 23.1 4 22 4M22 12H19V15H17V12H14V10H17V7H19V10H22V12Z" /></svg>',more_list:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17 14V17H14V19H17V22H19V19H22V17H19V14M20 11V12.3C19.4 12.1 18.7 12 18 12C16.8 12 15.6 12.4 14.7 13H7V11H20M12.1 17H7V15H12.8C12.5 15.6 12.2 16.3 12.1 17M7 7H20V9H7V7M5 19H7V21H3V3H7V5H5V19Z" /></svg>',more_file:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 2H6C4.9 2 4 2.9 4 4V20C4 21.1 4.9 22 6 22H18C19.1 22 20 21.1 20 20V8L14 2M18 20H6V4H13V9H18V20M9.5 18L10.2 15.2L8 13.3L10.9 13.1L12 10.4L13.1 13L16 13.2L13.8 15.1L14.5 17.9L12 16.5L9.5 18Z" /></svg>',more_view:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 21H11V13H3M5 15H9V19H5M3 11H11V3H3M5 5H9V9H5M13 3V11H21V3M19 9H15V5H19M18 16H21V18H18V21H16V18H13V16H16V13H18Z" /></svg>',more_page:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,3H5A2,2 0 0,0 3,5V9H5V5H22V19H5V15H3V19A2,2 0 0,0 5,21H22A2,2 0 0,0 24,19V5A2,2 0 0,0 22,3M7,15V13H0V11H7V9L11,12L7,15M20,13H13V11H20V13M20,9H13V7H20V9M17,17H13V15H17V17Z" /></svg>',more_text:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="10 10 180 180"><g><path d="M49.711,142.188h49.027c2.328,0.002,4.394,1.492,5.129,3.699l9.742,29.252c0.363,1.092,1.385,1.828,2.537,1.83l15.883,0.01c0.859,0,1.667-0.412,2.17-1.109s0.641-1.594,0.37-2.41l-16.625-50.045L86.503,28.953c-0.36-1.097-1.383-1.839-2.537-1.842H64.532c-1.153-0.001-2.178,0.736-2.542,1.831L13.847,173.457c-0.271,0.816-0.135,1.713,0.369,2.412c0.503,0.697,1.311,1.109,2.171,1.109h15.872c1.151,0,2.173-0.736,2.537-1.828l9.793-29.287C45.325,143.66,47.39,142.18,49.711,142.188L49.711,142.188z M53.493,119.098l15.607-46.9c0.744-2.196,2.806-3.674,5.125-3.674s4.381,1.478,5.125,3.674l15.607,46.904c0.537,1.621,0.263,3.402-0.736,4.789c-1.018,1.408-2.649,2.24-4.386,2.24H58.615c-1.736,0-3.368-0.832-4.386-2.24C53.23,122.504,52.956,120.721,53.493,119.098L53.493,119.098z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.633,190.465,66.178,190.465,63.32L190.465,63.32z M190.465,101.994c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.887,1.026,5.352,3.056,7.395c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.994L190.465,101.994z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_paragraph:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="10 10 180 180"><g><path d="M128.39,28.499H63.493c-25.558,0-46.354,20.796-46.354,46.354c0,25.559,20.796,46.353,46.354,46.353h9.271v55.625h18.542V47.04h9.271V176.83h18.543V47.04h9.271V28.499z M72.764,102.664h-9.271c-15.337,0-27.813-12.475-27.813-27.812c0-15.336,12.476-27.813,27.813-27.813h9.271V102.664z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.633,190.465,66.178,190.465,63.32L190.465,63.32z M190.465,101.994c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.887,1.026,5.352,3.056,7.395c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.994L190.465,101.994z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_plus:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="35 30 140 140"><g><path d="M137.215,102.045c0,3.498-2.835,6.332-6.333,6.332H24.549c-3.498,0-6.334-2.834-6.334-6.332l0,0c0-3.498,2.836-6.333,6.334-6.333h106.333C134.38,95.711,137.215,98.547,137.215,102.045L137.215,102.045z M77.715,161.545c-3.498,0-6.333-2.836-6.333-6.334V48.878c0-3.498,2.836-6.333,6.333-6.333l0,0c3.498,0,6.334,2.835,6.334,6.333v106.333C84.049,158.709,81.213,161.545,77.715,161.545L77.715,161.545z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.632,190.465,66.177,190.465,63.32L190.465,63.32z M190.465,101.993c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.888,1.026,5.353,3.056,7.396c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.993L190.465,101.993z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_horizontal:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,12A2,2 0 0,1 18,10A2,2 0 0,1 20,12A2,2 0 0,1 18,14A2,2 0 0,1 16,12M10,12A2,2 0 0,1 12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12M4,12A2,2 0 0,1 6,10A2,2 0 0,1 8,12A2,2 0 0,1 6,14A2,2 0 0,1 4,12Z" /></svg>',more_vertical:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z" /></svg>',more_flag:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M360-160q-19 0-36-8.5T296-192L80-480l216-288q11-15 28-23.5t36-8.5h440q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H360ZM180-480l180 240h440v-480H360L180-480Zm248.5 28.5Q440-463 440-480t-11.5-28.5Q417-520 400-520t-28.5 11.5Q360-497 360-480t11.5 28.5Q383-440 400-440t28.5-11.5Zm140 0Q580-463 580-480t-11.5-28.5Q557-520 540-520t-28.5 11.5Q500-497 500-480t11.5 28.5Q523-440 540-440t28.5-11.5Zm140 0Q720-463 720-480t-11.5-28.5Q697-520 680-520t-28.5 11.5Q640-497 640-480t11.5 28.5Q663-440 680-440t28.5-11.5ZM580-480Z"/></svg>',as_inline:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,7L13,17H3L8,7M3,3H21V5H3V3M21,15V17H14V15H21M3,19H21V21H3V19Z" /></svg>',as_block:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,7L17,17H7L12,7M3,3H21V5H3V3M3,19H21V21H3V19Z" /></svg>',page_break:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18,20H6V18H4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V18H18V20M14,2H6A2,2 0 0,0 4,4V12H6V4H14V8H18V12H20V8L14,2M11,16H8V14H11V16M16,16H13V14H16V16M3,14H6V16H3V14M21,16H18V14H21V16Z" /></svg>',page_down:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,6H13V14L16.5,10.5L17.92,11.92L12,17.84L6.08,11.92L7.5,10.5L11,14V6M12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20Z" /></svg>',page_up:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,18H11V10L7.5,13.5L6.08,12.08L12,6.16L17.92,12.08L16.5,13.5L13,10V18M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z" /></svg>',collapse_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.92,19.92L4,12L11.92,4.08L13.33,5.5L7.83,11H22V13H7.83L13.34,18.5L11.92,19.92M4,12V2H2V22H4V12Z" /></svg>',collapse_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.08,4.08L20,12L12.08,19.92L10.67,18.5L16.17,13H2V11H16.17L10.67,5.5L12.08,4.08M20,12V22H22V2H20V12Z" /></svg>',map:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11.7 15.62"><g><path d="M12.05,12.42a2.93,2.93,0,1,1,2.07-5A2.88,2.88,0,0,1,15,9.49a3,3,0,0,1-.86,2.07,2.89,2.89,0,0,1-2.07.86Zm0-5.36a2.43,2.43,0,0,0-1.72,4.16,2.48,2.48,0,0,0,1.72.72,2.44,2.44,0,0,0,0-4.88Zm0-3.3A5.84,5.84,0,0,1,17.9,9.62a9.94,9.94,0,0,1-1.73,5A33.59,33.59,0,0,1,12.84,19a1.52,1.52,0,0,1-.23.2,1,1,0,0,1-.55.2h0a1,1,0,0,1-.55-.2,1.52,1.52,0,0,1-.23-.2,33.59,33.59,0,0,1-3.33-4.32,9.93,9.93,0,0,1-1.72-5,5.84,5.84,0,0,1,5.85-5.86ZM12,18.34l.08.05.06-.06a35.58,35.58,0,0,0,3.06-3.93,9.35,9.35,0,0,0,1.74-4.77,4.88,4.88,0,0,0-4.88-4.88A4.79,4.79,0,0,0,8.6,6.17,4.84,4.84,0,0,0,7.17,9.62,9.29,9.29,0,0,0,8.91,14.4,36,36,0,0,0,12,18.34Z" transform="translate(-6.2 -3.76)"/></g></svg>',magic_stick:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 15.75"><g><path d="M19.86,19.21a1,1,0,0,0,.28-.68,1,1,0,0,0-.28-.7L13,10.93a1,1,0,0,0-.7-.28,1,1,0,0,0-.68,1.65l6.9,6.9a1,1,0,0,0,.69.29.93.93,0,0,0,.69-.28ZM9.19,8.55a3,3,0,0,0,1.68,0,14.12,14.12,0,0,0,1.41-.32A11.26,11.26,0,0,0,10.8,7.06c-.56-.36-.86-.56-.91-.58S10,5.91,10,5.11s0-1.26-.15-1.37a4.35,4.35,0,0,0-1.19.71c-.53.4-.81.62-.87.68a9,9,0,0,0-2-.6,6.84,6.84,0,0,0-.76-.09s0,.27.08.77a8.6,8.6,0,0,0,.61,2q-.09.09-.69.87a3.59,3.59,0,0,0-.68,1.17c.12.17.57.23,1.36.15S7,9.26,7.15,9.23s.21.36.57.91a10.49,10.49,0,0,0,1.14,1.48c0-.1.14-.57.31-1.4a3,3,0,0,0,0-1.67Z" transform="translate(-4.41 -3.74)"/></g></svg>',open_in_new:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z" /></svg>'};var qe=s("cfbI"),We=s.n(qe);function Ue(t,e,s,i,n){const o=new Map([["menuTray",s],["toolbar_main",t],["toolbar_buttonTray",t.querySelector(".se-btn-tray")],["toolbar_arrow",t.querySelector(".se-arrow")]]);return i&&(o.set("toolbar_sub_main",i),o.set("toolbar_sub_buttonTray",i.querySelector(".se-btn-tray")),o.set("toolbar_sub_arrow",i.querySelector(".se-arrow")),o.set("toolbar_sub_wrapper",i.parentElement.parentElement)),e&&(o.set("toolbar_wrapper",e.querySelector(".sun-editor")),o.set("_stickyDummy",e.querySelector(".se-toolbar-sticky-dummy"))),n&&o.set("statusbar_wrapper",n.querySelector(".sun-editor")),o}function Ze(t,e,s,i,n,o,l,r,a,h,c){const d=new Map([["key",c],["options",t.options],["originElement",t.target],["topArea",e],["container",e.querySelector(".se-container")],["wrapper",e.querySelector(".se-wrapper")],["wysiwygFrame",s],["wysiwyg",s],["codeWrapper",i],["code",n],["codeNumbers",i?.querySelector(".se-code-view-line")],["markdownWrapper",o],["markdown",l],["markdownNumbers",o?.querySelector(".se-markdown-view-line")],["lineBreaker_t",e.querySelector(".se-line-breaker-component-t")],["lineBreaker_b",e.querySelector(".se-line-breaker-component-b")],["blockHandleArea",h],["blockHandle",h?.querySelector(".se-block-handle")||null],["blockHandlePlus",h?.querySelector(".se-block-handle-plus")||null],["blockHandleDrag",h?.querySelector(".se-block-handle-drag")||null],["_stickyDummy",e.querySelector(".se-toolbar-sticky-dummy")],["_toolbarShadow",e.querySelector(".se-toolbar-shadow")],["_minHeight",Ct(s.style.minHeight||"65",0)],["isCodeView",!1],["isMarkdownView",!1],["isFullScreen",!1],["isReadOnly",!1],["isDisabled",!1],["isChanged",!1],["historyIndex",-1],["savedIndex",-1],["documentTypeInner",a.inner],["documentTypePage",a.page],["documentTypePageMirror",a.pageMirror]]);r&&Ge(r,d);const u=e.querySelector(".se-placeholder");u&&d.set("placeholder",u);const p=t.options.get("placeholder_line");return p&&d.set("placeholder_line",p),d}function Ge(t,e){t?e.set("statusbar",t):e.delete("statusbar");const s=t?t.querySelector(".se-navigation"):null,i=t?t.querySelector(".se-char-counter-wrapper"):null,n=t?t.querySelector(".se-char-counter-wrapper .se-char-counter"):null;s?e.set("navigation",s):e.delete("navigation"),i?e.set("charWrapper",i):e.delete("charWrapper"),n?e.set("charCounter",n):e.delete("charCounter");const o=t?t.querySelector(".se-word-counter-wrapper"):null,l=t?t.querySelector(".se-word-counter-wrapper .se-word-counter"):null;o?e.set("wordWrapper",o):e.delete("wordWrapper"),l?e.set("wordCounter",l):e.delete("wordCounter")}const je={BUTTON_LIST:[["undo","redo"],"|",["bold","underline","italic","strike","|","subscript","superscript"],"|",["removeFormat"],"|",["outdent","indent"],"|",["fullScreen","showBlocks","codeView"],"|",["preview","print"]],REQUIRED_FORMAT_LINE:"div",REQUIRED_ELEMENT_WHITELIST:"br|div",ELEMENT_WHITELIST:"p|pre|blockquote|h1|h2|h3|h4|h5|h6|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|colgroup|col|thead|tbody|tr|th|td|caption|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code|svg|path|details|summary",TEXT_STYLE_TAGS:"strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary",SCOPE_SELECTION_TAGS:["td","table","li","ol","ul","pre","figcaption","blockquote","dl","dt","dd"],ATTRIBUTE_WHITELIST:"contenteditable|target|href|title|download|rel|src|alt|class|type|colspan|rowspan|width|height|controls|autoplay|loop|muted|poster|preload|playsinline|volume|crossorigin|disableRemotePlayback|controlsList|allowfullscreen|sandbox|loading|allow|referrerpolicy|frameborder|scrolling",FORMAT_LINE:"P|H[1-6]|LI|TH|TD|DETAILS",FORMAT_BR_LINE:"PRE",FORMAT_CLOSURE_BR_LINE:"",FORMAT_BLOCK:"BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|CAPTION|DETAILS",FORMAT_CLOSURE_BLOCK:"TH|TD",ALLOWED_EMPTY_NODE_LIST:".se-component, pre, blockquote, hr, li, table, img, iframe, video, audio, canvas, details",SIZE_UNITS:["px","pt","em","rem"],CLASS_NAME:"^__se__|^se-|^katex|^MathJax|^language-",CLASS_MJX:"mjx-container|mjx-math|mjx-mrow|mjx-mi|mjx-mo|mjx-mn|mjx-msup|mjx-mfrac|mjx-munderover",EXTRA_TAG_MAP:{script:!1,style:!1,meta:!1,link:!1,"[a-z]+:[a-z]+":!1},CONTENT_STYLES:"background|background-clip|background-color|border|border-bottom|border-collapse|border-color|border-image|border-left-width|border-radius|border-right-width|border-spacing|border-style|border-top|border-width|box-shadow|box-sizing|caption-side|color|content|direction|display|position|float|font|font-family|font-size|font-style|font-weight|height|min-height|max-height|width|min-width|max-width|left|letter-spacing|line-height|list-style-position|list-style-type|margin|margin-block-end|margin-block-start|margin-bottom|margin-inline-end|margin-inline-start|margin-left|margin-right|margin-top|padding|padding-bottom|padding-inline-start|padding-left|padding-right|padding-top|outline|overflow|page-break-before|page-break-after|page-break-inside|rotate|rotateX|rotateY|table-layout|text-align|text-decoration|text-shadow|text-transform|top|text-indent|text-rendering|vertical-align|visibility|white-space|word-break|word-wrap",TAG_STYLES:{"@text":"font-family|font-size|color|background-color|width|height","@line":"text-align|margin|margin-left|margin-right|line-height","table|th|td":"border|border-[a-z]+|color|background-color|text-align|float|font-weight|text-decoration|font-style|vertical-align","table|td":"width",tr:"height",col:"width",caption:"text-align|caption-side","ol|ul":"list-style-type",figure:"display|width|height|padding|padding-bottom",figcaption:"margin|margin-top|margin-bottom|text-align","img|video|iframe":"transform|transform-origin|width|min-width|max-width|height|min-height|max-height|float|margin|margin-top",hr:""},RETAIN_STYLE_MODE:["repeat","always","none"]},Ke={value:"fixed",placeholder:!0,placeholder_line:!0,editableFrameAttributes:!0,width:!0,minWidth:!0,maxWidth:!0,innerWidth:"fixed",height:!0,minHeight:!0,maxHeight:!0,editorStyle:!0,iframe:"fixed",iframe_fullPage:"fixed",iframe_attributes:!0,iframe_cssFileName:!0,statusbar:!0,statusbar_showPathLabel:!0,statusbar_resizeEnable:"fixed",charCounter:!0,charCounter_max:!0,charCounter_label:!0,charCounter_type:!0,wordCounter:!0,wordCounter_label:!0},Ye={plugins:"fixed",excludedPlugins:"fixed",buttonList:"fixed",v2Migration:"fixed",strictMode:"fixed",mode:"fixed",blockHandle:"fixed",type:"fixed",theme:!0,lang:"fixed",fontSizeUnits:"fixed",allowedClassName:"fixed",closeModalOutsideClick:"fixed",copyFormatKeepOn:!0,syncTabIndent:!0,tabDisable:!0,autoLinkify:!0,autoStyleify:!0,retainStyleMode:!0,allowedExtraTags:"fixed",events:!0,__textStyleTags:"fixed",textStyleTags:"fixed",convertTextTags:"fixed",__tagStyles:"fixed",tagStyles:"fixed",textDirection:!0,reverseButtons:"fixed",historyStackDelayTime:!0,historyStackSize:"fixed",lineAttrReset:!0,printClass:!0,defaultLine:"fixed",defaultLineBreakFormat:!0,scopeSelectionTags:!0,__defaultElementWhitelist:"fixed",elementWhitelist:"fixed",elementBlacklist:"fixed",__defaultAttributeWhitelist:"fixed",attributeWhitelist:"fixed",attributeBlacklist:"fixed",__defaultFormatLine:"fixed",formatLine:"fixed",__defaultFormatBrLine:"fixed",formatBrLine:"fixed",__defaultFormatClosureBrLine:"fixed",formatClosureBrLine:"fixed",__defaultFormatBlock:"fixed",formatBlock:"fixed",__defaultFormatClosureBlock:"fixed",formatClosureBlock:"fixed",allowedEmptyTags:!0,toolbar_width:!0,toolbar_innerWidth:"fixed",toolbar_container:"fixed",toolbar_sticky:!0,toolbar_hide:!0,subToolbar:"fixed",statusbar_container:"fixed",shortcutsHint:!0,shortcutsDisable:"fixed",shortcuts:"fixed",fullScreenOffset:!0,previewTemplate:!0,printTemplate:!0,componentInsertBehavior:!0,defaultUrlProtocol:!0,allUsedStyles:"fixed",toastMessageTime:!0,icons:"fixed",freeCodeViewMode:!0,finder_panel:"fixed",finder_liveSearch:!0,__lineFormatFilter:!0,__pluginRetainFilter:!0,__listCommonStyle:"fixed",externalLibs:"fixed"},Xe=Ne._d;let Je=0;function Qe(t,e,s,i,n,o){if(!s||s.length<2)return;const l=e?.querySelector(".se-tooltip-text");for(let r,a,h,c,d,u,p,g,m,f,v,b,y,C,w=0;w<s.length;w+=2+C){if(C=0,r=s[w].split("+"),m=null,f=r.at(-1).trim?.(),f.startsWith("~"))m=t,f=r.pop().trim().substring(1);else if(f.startsWith("$~")){const t=r.pop().trim().substring(2).split(".");m=t[0],f=t[1]}else f.startsWith("$")?(C=1,f=s[w+2]):f="";h=c=d=u=p=g=a=null;for(const t of r)switch(t.trim()){case"c":h=!0;break;case"!":d=!0;break;case"s":c=!0;break;case"_":u=!0;break;case"=":g=!0;break;case"/":p=!0;break;default:a=t}a=a.split("|");for(let s=0,l=a.length;s<l;s++)b=h?a[s]+(c?"1000":""):a[s],i.has(b)||(y=n.indexOf(t),y=-1===y?"":Ve.isOdd(y)?n[y+1]:n[y-1],y&&o.add(b),i.set(b,{c:h,s:c,edge:d,space:u,enter:p,textTrigger:g,plugin:m,command:t,method:f,r:y,type:e?.getAttribute("data-type"),button:e,key:b}));(v=s[w+1])&&(l&&ts(l,c,v))}}function ts(t,e,s){const i=Ie.utils.createElement("SPAN",{class:"se-shortcut"},Ne.cmdIcon+(e?Ne.shiftIcon:"")+'+<span class="se-shortcut-key">'+s+"</span>"),n=t.querySelector(".se-shortcut");n?t.replaceChild(i,n):t.appendChild(i)}function es(t,e){return[t,e].reduce(((t,e)=>{for(const s in e)t[s]=(e[s]||"").toLowerCase();return t}),{})}function ss(t,e,s){const i=t.buttonList||je.BUTTON_LIST,n=new Map;if(e.length>1&&!t.toolbar_container&&!/inline|balloon/i.test(t.mode))throw Error('[SUNEDITOR.create.fail] In multi root, The "mode" option cannot be "classic" without using the "toolbar_container" option.');n.set("v2Migration",!!t.v2Migration),n.set("buttons",new Set(i.toString().split(","))),n.set("strictMode",{tagFilter:!0,formatFilter:!0,classFilter:!0,textStyleTagFilter:!0,attrFilter:!0,styleFilter:!0,..."boolean"==typeof t.strictMode?{}:t.strictMode}),n.set("freeCodeViewMode",!!t.freeCodeViewMode),n.set("finder_panel",!1!==t.finder_panel),n.set("finder_liveSearch",!1!==t.finder_liveSearch),n.set("__lineFormatFilter",t.__lineFormatFilter??!0),n.set("__pluginRetainFilter",t.__pluginRetainFilter??!0);const[o,l]=(t.mode||"classic").split(":");n.set("mode",o),n.set("_toolbar_bottom","bottom"===l&&/^(classic|inline)$/i.test(o)),n.set("blockHandle",t.blockHandle?"object"==typeof t.blockHandle?t.blockHandle:{}:null),n.set("type",t.type?.split(":")[0]||""),n.set("theme",t.theme||""),n.set("_themeClass",t.theme?` se-theme-${t.theme}`:""),n.set("_type_options",t.type?.split(":")[1]||""),n.set("externalLibs",t.externalLibs||{}),n.set("fontSizeUnits",Array.isArray(t.fontSizeUnits)&&t.fontSizeUnits.length>0?t.fontSizeUnits.map((t=>t.toLowerCase())):je.SIZE_UNITS),n.set("allowedClassName",new RegExp(`${t.allowedClassName&&"string"==typeof t.allowedClassName?t.allowedClassName+"|":""}${je.CLASS_NAME}`)),n.set("closeModalOutsideClick",!!t.closeModalOutsideClick),n.set("copyFormatKeepOn",!!t.copyFormatKeepOn),n.set("syncTabIndent",t.syncTabIndent??!0),n.set("autoLinkify",t.autoLinkify??!!s.link),n.set("autoStyleify",Array.isArray(t.autoStyleify)?t.autoStyleify:["bold","underline","italic","strike"]);let r=t.retainStyleMode||"repeat";"string"!=typeof r||je.RETAIN_STYLE_MODE.includes(r)||(console.error(`Invalid retainStyleMode: ${r}. Valid options are ${je.RETAIN_STYLE_MODE.join(", ")}. Using default 'repeat'.`),r="repeat"),n.set("retainStyleMode",r);const a={...je.EXTRA_TAG_MAP,...t.allowedExtraTags,"-":!0},h=Object.keys(a),c=h.filter((t=>a[t])).join("|"),d=h.filter((t=>!a[t])).join("|");n.set("_allowedExtraTag",c),n.set("_disallowedExtraTag",d),n.set("events",t.events||{}),n.set("textStyleTags",("string"==typeof t.__textStyleTags?t.__textStyleTags:je.TEXT_STYLE_TAGS)+(t.textStyleTags?"|"+t.textStyleTags:""));const u=es({bold:"strong",underline:"u",italic:"em",strike:"del",subscript:"sub",superscript:"sup"},t.convertTextTags||{});n.set("convertTextTags",u),n.set("_textStyleTags",Object.values(u).concat(["span","li"])),n.set("tagStyles",[{...je.TAG_STYLES,...t.__tagStyles||{}},t.tagStyles||{}].reduce(((t,e)=>{for(const s in e)t[s]=e[s];return t}),{})),n.set("_defaultStyleTagMap",{strong:u.bold,b:u.bold,u:u.underline,ins:u.underline,em:u.italic,i:u.italic,del:u.strike,strike:u.strike,s:u.strike,sub:u.subscript,sup:u.superscript}),n.set("_styleCommandMap",es(Be.swapKeyValue(u),{strong:"bold",b:"bold",u:"underline",ins:"underline",em:"italic",i:"italic",del:"strike",strike:"strike",s:"strike",sub:"subscript",sup:"superscript"})),n.set("_defaultTagCommand",{bold:u.bold,underline:u.underline,italic:u.italic,strike:u.strike,subscript:u.sub,superscript:u.sup}),n.set("textDirection",t.textDirection??"ltr"),n.set("_rtl","rtl"===n.get("textDirection")),n.set("reverseCommands",["indent-outdent"].concat(t.reverseButtons||[])),n.set("_reverseCommandArray",("-"+n.get("reverseCommands").join("-")).split("-")),Ve.isEven(n.get("_reverseCommandArray").length)&&console.warn('[SUNEDITOR.create.warning] The "reverseCommands" option is invalid, Shortcuts key may not work properly.'),n.set("historyStackDelayTime","number"==typeof t.historyStackDelayTime?t.historyStackDelayTime:400),n.set("historyStackSize","number"==typeof t.historyStackSize&&t.historyStackSize>0?t.historyStackSize:100),n.set("_editableClass","sun-editor-editable"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")+("document"===n.get("type")?" se-type-document-editable-a4":"")),n.set("lineAttrReset",["id"].concat(t.lineAttrReset&&"string"==typeof t.lineAttrReset?t.lineAttrReset.toLowerCase().split("|"):[])),n.set("printClass","string"==typeof t.printClass?t.printClass+" "+n.get("_editableClass"):null),n.set("defaultLine","string"==typeof t.defaultLine&&t.defaultLine.length>0?t.defaultLine:"p"),n.set("defaultLineBreakFormat",t.defaultLineBreakFormat||"line"),n.set("scopeSelectionTags",t.scopeSelectionTags||je.SCOPE_SELECTION_TAGS);const p=("string"==typeof t.elementWhitelist?t.elementWhitelist:"").toLowerCase(),g=n.get("externalLibs").mathjax?je.CLASS_MJX+"|":"";n.set("elementWhitelist",p+(p?"|":"")+g+n.get("_allowedExtraTag"));const m=(f=("string"==typeof t.elementBlacklist?t.elementBlacklist:"").toLowerCase(),v=(v=n.get("defaultLine")).toLowerCase(),f.split("|").filter((function(t){return t!==v||(console.warn(`[SUNEDITOR.constructor.createBlacklist.warn] defaultLine("<${v}>") cannot be included in the blacklist and will be removed.`),!1)})).join("|"));var f,v;if(n.set("elementBlacklist",m+(m?"|":"")+n.get("_disallowedExtraTag")),n.set("attributeWhitelist",t.attributeWhitelist&&"object"==typeof t.attributeWhitelist?t.attributeWhitelist:null),n.set("attributeBlacklist",t.attributeBlacklist&&"object"==typeof t.attributeBlacklist?t.attributeBlacklist:null),n.set("formatClosureBrLine",rs(t.formatClosureBrLine,(t.__defaultFormatClosureBrLine="string"==typeof t.__defaultFormatClosureBrLine?t.__defaultFormatClosureBrLine:je.FORMAT_CLOSURE_BR_LINE).toLowerCase(),n.get("elementBlacklist"))),n.set("formatBrLine",rs((t.formatBrLine||"")+"|"+n.get("formatClosureBrLine").str,(t.__defaultFormatBrLine="string"==typeof t.__defaultFormatBrLine?t.__defaultFormatBrLine:je.FORMAT_BR_LINE).toLowerCase(),n.get("elementBlacklist"))),n.set("formatLine",rs(je.REQUIRED_FORMAT_LINE+"|"+(t.formatLine||"")+"|"+n.get("formatBrLine").str,(t.__defaultFormatLine="string"==typeof t.__defaultFormatLine?t.__defaultFormatLine:je.FORMAT_LINE).toLowerCase(),n.get("elementBlacklist"))),!n.get("formatLine").reg.test(n.get("defaultLine")))throw Error(`[SUNEDITOR.create.fail] The "defaultLine(${n.get("defaultLine")})" option must be included in the "formatLine(${n.get("formatLine").str})" option.`);n.set("formatClosureBlock",rs(t.formatClosureBlock,(t.__defaultFormatClosureBlock="string"==typeof t.__defaultFormatClosureBlock?t.__defaultFormatClosureBlock:je.FORMAT_CLOSURE_BLOCK).toLowerCase(),n.get("elementBlacklist"))),n.set("formatBlock",rs((t.formatBlock||"")+"|"+n.get("formatClosureBlock").str,(t.__defaultFormatBlock="string"==typeof t.__defaultFormatBlock?t.__defaultFormatBlock:je.FORMAT_BLOCK).toLowerCase(),n.get("elementBlacklist"))),n.set("allowedEmptyTags",je.ALLOWED_EMPTY_NODE_LIST+(t.allowedEmptyTags?", "+t.allowedEmptyTags:"")),n.set("__defaultElementWhitelist",je.REQUIRED_ELEMENT_WHITELIST+"|"+("string"==typeof t.__defaultElementWhitelist?t.__defaultElementWhitelist:je.ELEMENT_WHITELIST).toLowerCase()),n.set("__defaultAttributeWhitelist",("string"==typeof t.__defaultAttributeWhitelist?t.__defaultAttributeWhitelist:je.ATTRIBUTE_WHITELIST).toLowerCase()),n.set("_editorElementWhitelist","*"===n.get("elementWhitelist")?"*":function(t){const e=t.get("elementBlacklist").split("|"),s=(t.get("__defaultElementWhitelist")+"|"+t.get("elementWhitelist")+"|"+t.get("formatLine").str+"|"+t.get("formatBrLine").str+"|"+t.get("formatClosureBlock").str+"|"+t.get("formatClosureBrLine").str).replace(/(^\||\|$)/g,"").split("|").filter(((t,s,i)=>t&&i.indexOf(t)===s&&!e.includes(t)));return s.join("|")}(n)),n.set("toolbar_width",t.toolbar_width?Ve.is(t.toolbar_width)?t.toolbar_width+"px":t.toolbar_width:"auto"),n.set("toolbar_innerWidth",t.toolbar_innerWidth?Ve.is(t.toolbar_innerWidth)?t.toolbar_innerWidth+"px":t.toolbar_innerWidth:""),n.set("toolbar_container",t.toolbar_container&&!/inline/i.test(n.get("mode"))?"string"==typeof t.toolbar_container?Xe.querySelector(t.toolbar_container):t.toolbar_container:null);const b=t.toolbar_sticky;/balloon/i.test(n.get("mode"))?(n.set("_toolbar_sticky",-1),n.set("_toolbar_sticky_offset",0)):null!==b&&"object"==typeof b?(n.set("_toolbar_sticky",Ve.get(b.top,0)),n.set("_toolbar_sticky_offset",Ve.get(b.offset,0))):(n.set("_toolbar_sticky",void 0===b?0:Ve.is(b)?b:-1),n.set("_toolbar_sticky_offset",0)),n.set("toolbar_hide",!!t.toolbar_hide);let y=null;const C=t.subToolbar;C?.buttonList?.length>0&&(/balloon/.test(n.get("mode"))?console.warn('[SUNEDITOR.create.subToolbar.fail] When the "mode" option is "balloon-*", the "subToolbar" option is omitted.'):(n.set("_subMode",C.mode||"balloon"),n.set("toolbar_sub_width",C.width?Ve.is(C.width)?C.width+"px":C.width:"auto"),y=n.get("_rtl")?C.buttonList.reverse():C.buttonList,n.set("buttons_sub",new Set(y.toString().split(",")))));const w=new Map;for(let s=0,i=e.length;s<i;s++)w.set(e[s].key,ns(e[s].options||{},t));n.set("tabDisable",!!t.tabDisable),n.set("shortcutsHint",void 0===t.shortcutsHint||!!t.shortcutsHint);const _=void 0!==t.shortcutsDisable&&t.shortcutsDisable?{}:[{selectAll:["c+KeyA","A"],bold:["c+KeyB","B"],strike:["c+s+KeyS","S"],underline:["c+KeyU","U"],italic:["c+KeyI","I"],redo:["c+KeyY","Y","c+s+KeyZ","Z"],undo:["c+KeyZ","Z"],indent:["c+BracketRight","]"],outdent:["c+BracketLeft","["],save:["c+KeyS","S"],...n.get("finder_panel")?{finder:["c+KeyF","F"]}:{},link:["c+KeyK","K"],hr:["!+---+=+~shortcut",""],list_numbered:["!+1.+_+~shortcut",""],list_bulleted:["!+*.+_+~shortcut",""],_h1:["c+s+Digit1|Numpad1+$~blockStyle.applyHeaderByShortcut",""],_h2:["c+s+Digit2|Numpad2+$~blockStyle.applyHeaderByShortcut",""],_h3:["c+s+Digit3|Numpad3+$~blockStyle.applyHeaderByShortcut",""]},t.shortcuts||{}].reduce(((t,e)=>{for(const s in e)t[s]=e[s];return t}),{});n.set("shortcuts",_),n.set("fullScreenOffset",void 0===t.fullScreenOffset?0:Ve.is(t.fullScreenOffset)?Ve.get(t.fullScreenOffset,0):0),n.set("previewTemplate","string"==typeof t.previewTemplate?t.previewTemplate:null),n.set("printTemplate","string"==typeof t.printTemplate?t.printTemplate:null),n.set("componentInsertBehavior",["auto","select","line","none"].includes(t.componentInsertBehavior)?t.componentInsertBehavior:"auto"),n.set("defaultUrlProtocol","string"==typeof t.defaultUrlProtocol?t.defaultUrlProtocol:null);const x=n.get("externalLibs").codeMirror;x&&(n.set("codeMirror",x),x.src?n.set("codeMirrorEditor",!0):(console.warn("[SUNEDITOR.options.externalLibs.codeMirror.fail] The codeMirror option is set incorrectly. See: https://github.com/ARA-developer/suneditor/blob/develop/guide/external-libraries.md"),n.set("codeMirror",null))),n.set("__listCommonStyle",t.__listCommonStyle||["fontSize","color","fontFamily","fontWeight","fontStyle"]);const $=t.icons&&"object"==typeof t.icons?[De,t.icons].reduce(((t,e)=>{for(const s in e)t[s]=e[s];return t}),{}):De;n.set("icons",$);const k=new Set(je.CONTENT_STYLES.split("|")),S=n.get("__listCommonStyle");for(const t of Object.values(n.get("tagStyles"))){const e=t.split("|");for(let t=0,s=e.length;t<s;t++)k.add(e[t])}for(let t=0,e=S.length;t<e;t++)k.add(S[t]);const E=("string"==typeof t.allUsedStyles?t.allUsedStyles.split("|"):t.allUsedStyles)||[];for(let t=0,e=E.length;t<e;t++)k.add(E[t]);return n.set("allUsedStyles",k),n.set("toastMessageTime",{copy:1500,...t.toastMessageTime}),{o:n,i:$,l:t.lang||We(),v:t.value="string"==typeof t.value?t.value:null,buttons:n.get("_rtl")?i.reverse():i,subButtons:y,statusbarContainer:"string"==typeof t.statusbar_container?Xe.querySelector(t.statusbar_container):t.statusbar_container,frameMap:w}}function is(t,e){let s=null,i=null,n=null,o=null,l=null;if(t.get("statusbar")){if(e||=Ie.utils.createElement("DIV",{class:"se-status-bar sun-editor-common"}),s=e.querySelector(".se-navigation")||Ie.utils.createElement("DIV",{class:"se-navigation sun-editor-common"}),e.appendChild(s),t.get("wordCounter")){if(o=e.querySelector(".se-word-counter-wrapper")||Ie.utils.createElement("DIV",{class:"se-word-counter-wrapper"}),t.get("wordCounter_label")){const e=o.querySelector(".se-word-label")||Ie.utils.createElement("SPAN",{class:"se-word-label"});e.textContent=t.get("wordCounter_label"),o.appendChild(e)}l=o.querySelector(".se-word-counter")||Ie.utils.createElement("SPAN",{class:"se-word-counter"}),l.textContent="0",o.appendChild(l),e.appendChild(o)}if(t.get("charCounter")){if(i=e.querySelector(".se-char-counter-wrapper")||Ie.utils.createElement("DIV",{class:"se-char-counter-wrapper"}),t.get("wordCounter")&&-1===i.className.indexOf("se-with-word-counter")&&(i.className+=" se-with-word-counter"),t.get("charCounter_label")){const e=i.querySelector(".se-char-label")||Ie.utils.createElement("SPAN",{class:"se-char-label"});e.textContent=t.get("charCounter_label"),i.appendChild(e)}if(n=i.querySelector(".se-char-counter")||Ie.utils.createElement("SPAN",{class:"se-char-counter"}),n.textContent="0",i.appendChild(n),t.get("charCounter_max")>0){const e=i.querySelector(".se-char-max")||Ie.utils.createElement("SPAN",{class:"se-char-max"});e.textContent=" / "+t.get("charCounter_max"),i.appendChild(e)}e.appendChild(i)}}return{statusbar:e,navigation:s,charWrapper:i,charCounter:n,wordWrapper:o,wordCounter:l}}function ns(t,e){const s=new Map;s.set("_origin",t);const i=e.statusbar_container,n=void 0===t.value?e.value:t.value,o=void 0===t.placeholder?e.placeholder:t.placeholder,l=void 0===t.placeholder_line?e.placeholder_line:t.placeholder_line,r=void 0===t.editableFrameAttributes?e.editableFrameAttributes:t.editableFrameAttributes,a=void 0===t.width?e.width:t.width,h=void 0===t.minWidth?e.minWidth:t.minWidth,c=void 0===t.maxWidth?e.maxWidth:t.maxWidth,d=void 0===t.innerWidth?e.innerWidth:t.innerWidth,u=void 0===t.height?e.height:t.height,p=void 0===t.minHeight?e.minHeight:t.minHeight,g=void 0===t.maxHeight?e.maxHeight:t.maxHeight,m=void 0===t.editorStyle?e.editorStyle:t.editorStyle,f=void 0===t.iframe?e.iframe:t.iframe,v=void 0===t.iframe_fullPage?e.iframe_fullPage:t.iframe_fullPage,b=void 0===t.iframe_attributes?e.iframe_attributes:t.iframe_attributes,y=void 0===t.iframe_cssFileName?e.iframe_cssFileName:t.iframe_cssFileName,C=i||void 0===t.statusbar?e.statusbar:t.statusbar,w=i||void 0===t.statusbar_showPathLabel?e.statusbar_showPathLabel:t.statusbar_showPathLabel,_=!i&&(void 0===t.statusbar_resizeEnable?e.statusbar_resizeEnable:t.statusbar_resizeEnable),x=i||void 0===t.charCounter?e.charCounter:t.charCounter,$=i||void 0===t.charCounter_max?e.charCounter_max:t.charCounter_max,k=i||void 0===t.charCounter_label?e.charCounter_label:t.charCounter_label,S=i||void 0===t.charCounter_type?e.charCounter_type:t.charCounter_type,E=i||void 0===t.wordCounter?e.wordCounter:t.wordCounter,T=i||void 0===t.wordCounter_label?e.wordCounter_label:t.wordCounter_label;s.set("value",n),s.set("placeholder",o),s.set("placeholder_line",l),s.set("editableFrameAttributes",{spellcheck:"false",...r}),s.set("width",a?String(Ve.is(a)?a+"px":a):"100%"),s.set("minWidth",h?String(Ve.is(h)?h+"px":h):""),s.set("maxWidth",c?String(Ve.is(c)?c+"px":c):""),s.set("innerWidth",d?String(Ve.is(d)?d+"px":d):""),s.set("height",u?String(Ve.is(u)?u+"px":u):"auto"),s.set("minHeight",p?String(Ve.is(p)?p+"px":p):""),s.set("maxHeight",g?String(Ve.is(g)?g+"px":g):""),s.set("editorStyle",m),s.set("_defaultStyles",Be._setDefaultOptionStyle(s,"string"==typeof m?m:"")),s.set("iframe",!(!v&&!f)),s.set("iframe_fullPage",!!v),s.set("iframe_attributes",b||{}),s.set("iframe_cssFileName",f?("string"==typeof y?[y]:y)||["suneditor"]:null);const M=void 0===C||!!C;return s.set("statusbar",M),s.set("statusbar_showPathLabel",!!M&&("boolean"!=typeof w||w)),s.set("statusbar_resizeEnable",!!M&&(void 0===_||!!_)),s.set("charCounter",$>0||"boolean"==typeof x&&x),s.set("charCounter_max",Ve.is($)&&$>-1?1*$:null),s.set("charCounter_label","string"==typeof k?k.trim():null),s.set("charCounter_type","string"==typeof S?S:"char"),s.set("wordCounter","boolean"==typeof E&&E),s.set("wordCounter_label","string"==typeof T?T.trim():null),s}function os(t,e,s,i,n){const o=i.get("_defaultStyles");s.style.cssText=o.top;const l=Ie.utils.createElement(i.get("iframe")?"IFRAME":"DIV",{class:"se-wrapper-inner se-wrapper-wysiwyg"+("document"===e.get("type")?" se-type-document-iframe-a4":""),"data-root-key":t});if(i.get("iframe")){const t=l,e=i.get("iframe_attributes");let s=e.sandbox;if(s){const t=["allow-same-origin","allow-scripts"],e=s.split(/\s+/),i=t.filter((t=>!e.includes(t)));i.length>0&&(s=e.concat(i).join(" "))}else s="allow-same-origin allow-scripts";t.setAttribute("sandbox",s),t.setAttribute("frameBorder","0");for(const s in e)"sandbox"!==s&&t.setAttribute(s,e[s]);t.allowFullscreen=!0,t.setAttribute("scrolling","auto"===i.get("height")?"no":"auto"),t.style.cssText=o.frame}else l.setAttribute("contenteditable","true"),e.get("_rtl")&&(l.dir="rtl"),l.className+=" "+e.get("_editableClass"),l.style.cssText=o.frame+o.editor;const r=Ie.utils.createElement("TEXTAREA",{id:n+"-code-viewer-"+(t||"default"),class:"se-wrapper-inner se-code-viewer",style:o.frame,autocomplete:"off"}),a=Ie.utils.createElement("TEXTAREA",{id:n+"-markdown-viewer-"+(t||"default"),class:"se-wrapper-inner se-markdown-viewer",style:o.frame,autocomplete:"off"}),h=Ie.utils.createElement("SPAN",{class:"se-placeholder"});return i.get("placeholder")&&(h.textContent=i.get("placeholder")),{bottomBar:is(i,null),wysiwygFrame:l,codeView:r,markdownView:a,placeholder:h}}function ls(t,e,s){let i=null,n=!1;if(t.get("codeMirrorEditor")){const o=t.get("codeMirror"),l=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!1},o.options||{}].reduce(((t,e)=>{for(const s in e)t[s]=e[s];return t}),{});"auto"===e.get("height")&&(l.viewportMargin=1/0,l.height="auto");const r=s.style.cssText,a=o.src.fromTextArea(s,l);e.set("codeMirrorEditor",a),i=a.display.wrapper,i.style.cssText=r,n=!0}return t.set("hasCodeMirror",n),i?(Ie.utils.removeItem(s),i.className+=" se-code-viewer-mirror",i):s}function rs(t,e,s){const i=s.split("|"),n=(e+"|"+("string"==typeof t?t.toLowerCase():"")).replace(/^\||\|$/g,"").split("|").filter((t=>t&&!i.includes(t))).join("|");return{reg:new RegExp(`^(${n})$`,"i"),str:n}}function as(t,e,s,i,n){const o=e?.[t];if(o){const e="function"==typeof o?o:o.constructor;return{className:o.className||e.className||"",title:n[o.title]||o.title||n[e.title]||e.title||t,command:t,type:o.type||e.type||"",icon:i[o.icon]||o.icon||i[e.icon]||e.icon||""}}const l=hs(s.get("_rtl"),i,n)[t];return l?{className:l[0],title:l[1],command:l[2],type:l[3],icon:l[4]}:null}function hs(t,e,s){return{bold:["",s.bold,"bold","",e.bold],underline:["",s.underline,"underline","",e.underline],italic:["",s.italic,"italic","",e.italic],strike:["",s.strike,"strike","",e.strike],subscript:["",s.subscript,"subscript","",e.subscript],superscript:["",s.superscript,"superscript","",e.superscript],removeFormat:["",s.removeFormat,"removeFormat","",e.remove_format],copyFormat:["",s.copyFormat,"copyFormat","",e.format_paint],indent:["se-icon-flip-rtl",s.indent,"indent","",t?e.outdent:e.indent],outdent:["se-icon-flip-rtl",s.outdent,"outdent","",t?e.indent:e.outdent],fullScreen:["se-code-view-enabled se-component-enabled",s.fullScreen,"fullScreen","",e.expansion],showBlocks:["",s.showBlocks,"showBlocks","",e.show_blocks],codeView:["se-code-view-enabled se-component-enabled",s.codeView,"codeView","",e.code_view],markdownView:["se-code-view-enabled se-component-enabled",s.markdownView,"markdownView","",e.markdown_view],undo:["se-component-enabled",s.undo,"undo","",e.undo],redo:["se-component-enabled",s.redo,"redo","",e.redo],preview:["se-component-enabled",s.preview,"preview","",e.preview],print:["se-component-enabled",s.print,"print","",e.print],copy:["",s.copy,"copy","",e.copy],dir:["",s[t?"dir_ltr":"dir_rtl"],"dir","",e[t?"dir_ltr":"dir_rtl"]],dir_ltr:["",s.dir_ltr,"dir_ltr","",e.dir_ltr],dir_rtl:["",s.dir_rtl,"dir_rtl","",e.dir_rtl],finder:["se-component-enabled",s.find,"finder","",e.finder],save:["se-component-enabled",s.save,"save","",e.save],newDocument:["se-component-enabled",s.newDocument,"newDocument","",e.new_document],selectAll:["se-component-enabled",s.selectAll,"selectAll_full","",e.select_all],pageBreak:["se-component-enabled",s.pageBreak,"pageBreak","",e.page_break],pageUp:["se-component-enabled",s.pageUp,"pageUp","",e.page_up],pageDown:["se-component-enabled",s.pageDown,"pageDown","",e.page_down],pageNavigator:["se-component-enabled","","pageNavigator","input",""]}}function cs(){const t=Ie.utils.createElement("UL",{class:"se-menu-list"});return{div:Ie.utils.createElement("DIV",{class:"se-btn-module se-btn-module-border"},t),ul:t}}function ds(t,e,s,i,n,o,l){n||="";const r=Ie.utils.createElement("LI"),a=e||"",h=/^INPUT|FIELD$/i.test(i),c="se-toolbar-separator-vertical"===t?Ie.utils.createElement("DIV",{class:t,tabindex:"-1"},null):Ie.utils.createElement(h?"DIV":"BUTTON",{class:"se-toolbar-btn se-btn se-tooltip"+(t?" "+t:""),"data-command":s,"data-type":i,"aria-label":a.replace(/<span .+<\/span>/,""),tabindex:"-1"});return h||c.setAttribute("type","button"),/^default\./i.test(n)&&(n=l[n.replace(/^default\./i,"")]),/^text\./i.test(n)&&(n=n.replace(/^text\./i,""),c.className+=" se-btn-more-text"),o&&(c.disabled=!0),/^FIELD$/i.test(i)&&Ie.utils.addClass(r,"se-toolbar-hidden-btn"),a&&(n+=Ie.utils.createTooltipInner(a)),n&&(c.innerHTML=n),r.appendChild(c),{li:r,button:c}}function us(t,e,s,i){if(!t)return;const n=!1===e.inner;if(1===e.inner?.nodeType?t.appendChild(e.inner):t.innerHTML=n?"":(e.inner||s[e.icon]||e.icon||'<span class="se-icon-text">!</span>')+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+(i[e.title]||e.title)+"</span></span>",t.setAttribute("aria-label",e.title),e.type&&t.setAttribute("data-type",e.type),e.className&&(t.className+=" "+e.className),e.afterItem&&(Ie.utils.addClass(e.afterItem,"se-toolbar-btn"),t.parentElement.appendChild(e.afterItem),Ie.utils.addClass(t,"se-side-btn-a"),Ie.utils.addClass(e.afterItem,"se-side-btn-after")),e.beforeItem&&(Ie.utils.addClass(e.beforeItem,"se-toolbar-btn"),t.parentElement.insertBefore(e.beforeItem,t),e.afterItem?(Ie.utils.addClass(t,"se-side-btn"),Ie.utils.removeClass(t,"se-side-btn-a")):Ie.utils.addClass(t,"se-side-btn-b"),Ie.utils.addClass(e.beforeItem,"se-side-btn-before")),e.replaceButton&&(t.parentElement.appendChild(e.replaceButton),t.style.display="none"),!e.replaceButton&&/^INPUT$/i.test(t.getAttribute("data-type"))){const e=t.querySelector("input");e&&(Ie.utils.addClass(e,"se-toolbar-btn"),e.setAttribute("data-command",t.getAttribute("data-command")),e.setAttribute("data-type",t.getAttribute("data-type")),t.hasAttribute("disabled")&&(e.disabled=!0))}}function ps(t,e,s,i,n,o){t=JSON.parse(JSON.stringify(t));const l=hs(s.get("_rtl"),i,n),r={},a=[],h=[];let c=null,d=null,u=null,p=null,g=null;const m=Ie.utils.createElement("DIV",{class:"se-toolbar-more-layer"}),f=Ie.utils.createElement("DIV",{class:"se-btn-tray"}),v=Ie.utils.createElement("DIV",{class:"se-toolbar-separator-vertical"});t:for(let s,b,y,C,w,_=0;_<t.length;_++)if(s=!1,w="",C=t[_],p=cs(),"object"==typeof C){for(let f,v=0;v<C.length;v++){if(d=C[v],f=!1,u=e[d],/^%\d+/.test(d)&&0===v){C[0]=d.replace(/[^\d]/g,""),a.push(C),t.splice(_--,1);continue t}if("function"==typeof u)c=[u.className,u.title,d,u.type,u.innerHTML,u._disabled];else if("object"==typeof u){const t=u.constructor;c=[u.className||t.className,u.title||t.title,d,u.type||t.type,u.innerHTML||t.innerHTML,u._disabled||t._disabled]}else{if(/^-/.test(d)){w=d.substring(1),p.div.className+=" module-float-"+w;continue}if(/^#/.test(d)){"fix"===d.substring(1)&&(p.ul.className+=" se-menu-dir-fix");continue}if(/^:/.test(d)){f=!0;const t=d.match(/^:([^-]+)-([^-]+)/);y="__se__more_"+_;const e=t[1].trim(),s=t[2].trim();c=["se-btn-more",/^lang\./i.test(e)?n[e.replace(/^lang\./i,"")]:e,y,"MORE",s]}else"|"===d?c=["se-toolbar-separator-vertical","","","separator",""]:("copy"!==d||Ne.isClipboardSupported||console.warn("[SUNEDITOR.constructor.warn] Clipboard is not supported in this browser. : [copy] button is not rendered."),c=l[d]);if(!c){if(!u)throw Error(`[SUNEDITOR.create.toolbar.fail] The button name of a plugin that does not exist. [${d}]`);u="object"==typeof u?u.constructor:u,c=[u.className,u.title,u.key,u.type,u.innerHTML,u._disabled]}}g=ds(c[0],c[1],c[2],c[3],c[4],c[5],i),(s?b:p.ul).appendChild(g.li),u&&(r[d]?r[d].push(g.button):r[d]=[g.button],o&&h.push({button:g.button,plugin:u,key:d})),f&&(s=!0,b=Ie.utils.createElement("DIV"),b.className="se-more-layer "+y,b.setAttribute("data-ref",y),b.innerHTML='<div class="se-more-form"><ul class="se-menu-list"'+(w?' style="float: '+w+';"':"")+"></ul></div>",m.appendChild(b),b=b.firstElementChild.firstElementChild)}f.appendChild(p.div)}else{if("|"===C){const t=v.cloneNode(!1);f.appendChild(t);continue}if(/^\/$/.test(C)){const t=Ie.utils.createElement("DIV",{class:"se-btn-module-enter"});f.appendChild(t)}}switch(f.children.length){case 0:f.style.display="none";break;case 1:Ie.utils.removeClass(f.firstElementChild,"se-btn-module-border")}var b,y;m.children.length>0&&f.appendChild(m),a.length>0&&a.unshift(t),b=f,y=s.get("toolbar_innerWidth"),b&&y&&("auto"!==y&&(b.style.maxWidth=y),b.style.width="max-content",b.style.marginLeft="auto",b.style.marginRight="auto");const C=Ie.utils.createElement("DIV",{class:"se-toolbar sun-editor-common"+(s.get("shortcutsHint")?"":" se-shortcut-hide")},f);return s.get("toolbar_hide")&&(C.style.display="none"),{element:C,pluginCallButtons:r,responsiveButtons:a,buttonTray:f,updateButtons:h}}const gs=function(t,e){"object"!=typeof e&&(e={});const s={};if(e.plugins){const t=e.excludedPlugins||[],i=e.plugins,n=(Array.isArray(i)?i:Object.keys(i)).filter((e=>!t.includes(e))).map((t=>i[t]));for(let t,e=0,i=n.length;e<i;e++)t=n[e].default||n[e],s[t.key]=t}const i=ss(e,t,s),n=i.o,o=i.i,l=i.l,r=Ie.utils.createElement("DIV",{class:"se-loading-box sun-editor-common"},'<div class="se-loading-effect"></div>'),a="suneditor-"+ ++Je,h=Ie.utils.createElement("DIV",{class:"sun-editor sun-editor-carrier-wrapper sun-editor-common"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),c=Ie.utils.createElement("DIV",{class:"se-menu-tray",popover:"manual"});h.appendChild(c);const d=Ie.utils.createElement("DIV",{class:"se-modal se-modal-area sun-editor-common",popover:"manual"}),u=Ie.utils.createElement("DIV",{class:"se-modal-back"}),p=Ie.utils.createElement("DIV",{class:"se-modal-inner"});d.appendChild(u),d.appendChild(p),h.appendChild(d);const g=Ie.utils.createElement("DIV",{class:"se-alert se-modal-area sun-editor-common",style:"display: none;",popover:"manual"}),m=Ie.utils.createElement("DIV",{class:"se-modal-back"}),f=Ie.utils.createElement("DIV",{class:"se-modal-inner"});g.appendChild(m),g.appendChild(f),h.appendChild(g),h.appendChild(Ie.utils.createElement("DIV",{class:"se-back-wrapper",popover:"manual"}));const v=r.cloneNode(!0);v.setAttribute("popover","manual"),h.appendChild(v);const b=Ie.utils.createElement("DIV",{class:"se-drag-cursor",popover:"manual"});h.appendChild(b),Xe.body.appendChild(h);let y=null,C=null;const w=ps(i.buttons,s,n,o,l,!1),_=w.element;_.style.visibility="hidden",/inline/i.test(n.get("mode"))?(_.className+=" se-toolbar-inline",_.style.width=n.get("toolbar_width")):/balloon/i.test(n.get("mode"))&&(_.className+=" se-toolbar-balloon",_.style.width=n.get("toolbar_width"),_.appendChild(Ie.utils.createElement("DIV",{class:"se-arrow"}))),n.get("_toolbar_bottom")&&(_.className+=" se-toolbar-bottom"),i.subButtons&&(C=ps(i.subButtons,s,n,o,l,!1),y=C.element,y.style.visibility="hidden",y.className+=" se-toolbar-balloon se-toolbar-sub",y.style.width=n.get("toolbar_sub_width"),y.appendChild(Ie.utils.createElement("DIV",{class:"se-arrow"})));const x=t[0].key||null,$=[],k=new Map,S=i.statusbarContainer;let E=null;for(let e=0,s=t.length;e<s;e++){const s=t[e],h=i.frameMap.get(s.key),c=Ie.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),d=Ie.utils.createElement("DIV",{class:"se-container"}),u=!!n.get("blockHandle"),p=Ie.utils.createElement("DIV",{class:"se-wrapper"+(u?" se-mode-block":"")+("document"===n.get("type")?" se-type-document":"")+(n.get("_type_options").includes("header")?" se-type-document-header":"")}),g=h.get("innerWidth");g&&"auto"!==g&&p.style.setProperty("--se-editor-inner-width",g),d.appendChild(Ie.utils.createElement("DIV",{class:"se-toolbar-shadow"}));const m=os(s.key,n,c,h,a),f=m.bottomBar.statusbar,v=m.wysiwygFrame,b=m.placeholder;let y=m.codeView;const C=Ie.utils.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-t",title:l.insertLine},o.line_break),w=Ie.utils.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-b",title:l.insertLine},o.line_break);p.appendChild(C),p.appendChild(w),b&&p.appendChild(b),d.appendChild(Ie.utils.createElement("DIV",{class:"se-toolbar-sticky-dummy"})),d.appendChild(p),f&&(S?E||(S.appendChild(Ie.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")},f)),E=f):d.appendChild(f)),d.appendChild(r.cloneNode(!0));const _=s.key||null;let x=null;if(n.get("buttons").has("codeView")){x=Ie.utils.createElement("DIV",{class:"se-code-wrapper"},y),x.style.setProperty("display","none","important"),p.appendChild(x);const t=ls(n,h,y);if(y===t){const t=Ie.utils.createElement("TEXTAREA",{id:a+"-code-view-line-"+(_||"default"),class:"se-code-view-line",readonly:"true",autocomplete:"off","aria-hidden":"true",tabindex:"-1"},null);x.insertBefore(t,y)}else y=t}let T=null,M=null;if(n.get("buttons").has("markdownView")){M=m.markdownView;const t=Ie.utils.createElement("TEXTAREA",{id:a+"-markdown-view-line-"+(_||"default"),class:"se-markdown-view-line",readonly:"true",autocomplete:"off","aria-hidden":"true",tabindex:"-1"},null);T=Ie.utils.createElement("DIV",{class:"se-markdown-wrapper"}),T.appendChild(t),T.appendChild(M),T.style.setProperty("display","none","important"),p.appendChild(T)}const H={inner:null,page:null,pageMirror:null};n.get("_type_options").includes("header")&&(H.inner=Ie.utils.createElement("DIV",{class:"se-document-lines",style:`height: ${h.get("height")};`},'<div class="se-document-lines-inner"></div>')),n.get("_type_options").includes("page")&&(H.page=Ie.utils.createElement("DIV",{class:"se-document-page"},null),H.pageMirror=Ie.utils.createElement("DIV",{class:"sun-editor-editable se-document-page-mirror-a4",style:"position: absolute; width: 21cm; columns: 21cm; border: 0; overflow: hidden; height: auto; top: -10000px; left: -10000px;"},null));let L=null;if(u){L=Ie.utils.createElement("DIV",{class:"se-block-handle-area"});const t=Ie.utils.createElement("DIV",{class:"se-block-handle",popover:"manual"}),e=Ie.utils.createElement("DIV",{class:"se-block-handle-btn se-block-handle-plus"},o.plus),s=Ie.utils.createElement("DIV",{class:"se-block-handle-btn se-block-handle-drag"},o.dragHandle);t.appendChild(e),t.appendChild(s),L.appendChild(t)}c.appendChild(d),$.push(_),k.set(_,Ze({target:s.target,key:s.key,options:h},c,v,x,y,T,M,E||f,H,L,_))}const T=n.get("toolbar_container");if(T){const t=Ie.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),e=Ie.utils.createElement("DIV",{class:"se-container"});e.appendChild(_),y&&e.appendChild(y),t.appendChild(e),T.appendChild(t),T.appendChild(Ie.utils.createElement("DIV",{class:"se-toolbar-sticky-dummy"}))}else{const t=k.get(x).get("container");if(n.get("_toolbar_bottom")){const e=t.querySelector(".se-statusbar");t.insertBefore(_,e),y&&t.insertBefore(y,_)}else t.insertBefore(_,t.firstElementChild),y&&t.insertBefore(y,t.firstElementChild)}return{context:Ue(_,T,c,y,S),carrierWrapper:h,options:n,plugins:s,icons:o,lang:l,value:i.v,rootId:x,rootKeys:$,frameRoots:k,pluginCallButtons:w.pluginCallButtons,responsiveButtons:w.responsiveButtons,pluginCallButtons_sub:C?C.pluginCallButtons:[],responsiveButtons_sub:C?C.responsiveButtons:[]}},{_w:ms}=Ne,fs=Math.floor(96/72*841.89105);const vs=class{#t;#e;#s;#i;#n;#o;#l;#r;#a;#h;#c;#d;#u;#p;#g;#m;#f=-1;#v=-1;#b=null;#y=null;#C=0;#w=0;#_=-1;#x=0;#$=[];#k=null;#S=0;#E=0;#T=new Map;#M=null;constructor(t,e){const s=t.$;if(this.#t=s.store,this.#e=s.context,this.#s=this.#t.get("isScrollable"),this.#i=s.offset,this.#n=s.selection,this.#o=s.toolbar,this.useHeader=s.options.get("_type_options").includes("header"),this.usePage=s.options.get("_type_options").includes("page"),this.#l=e,this.#r=e.get("wysiwyg"),this.#a=e.get("wysiwygFrame"),this.#h=e.get("documentTypeInner"),this.#p=e.get("documentTypePageMirror"),this.#p){const t=ms.getComputedStyle(this.#p);this.#g=Ve.get(t.paddingTop),this.#m=Ve.get(t.paddingBottom)}if(this.useHeader){const t=this._getHeaders(),e=this.#c=this.#h.querySelector(".se-document-lines-inner");let i="";for(let e,s=0,n=t.length;s<n;s++)e=t[s],i+=`<div class="se-doc-item se-doc-h${Ve.get(e.nodeName)}" title="${e.textContent}">${e.textContent}</div>`;e.innerHTML=i,this.#b=e.querySelectorAll("div"),s.eventManager.addEvent(e,"click",this.#H.bind(this,this.#r))}this.usePage&&(this.#d=e.get("documentTypePage"),this.#u=s.plugins.pageNavigator)}reHeader(){if(!this.useHeader)return;const t=this._getHeaders(),e=this.#c,s=this.#b;for(let i,n,o,l=0,r=t.length;l<r;l++)if(i=t[l],n=`se-doc-h${Ve.get(i.nodeName)}`,o=s[l],l<s.length)o.classList.contains(n)&&o.textContent===i.textContent||(o.textContent=o.title=i.textContent,o.className=`se-doc-item ${n}`);else{const t=document.createElement("div");t.className=`se-doc-item ${n}`,t.textContent=t.title=i.textContent,e.appendChild(t)}if(s.length>t.length)for(let i=t.length;i<s.length;i++)e.removeChild(s[i]);this.#b=e.querySelectorAll("div")}async rePage(t){this.#d&&(this.#M&&ms.clearTimeout(this.#M),this.#M=ms.setTimeout((async()=>{await Ie.utils.waitForMediaLoad(this.#p,1500);const e=this.#r.scrollHeight>this.#p.scrollHeight?this.#r.scrollHeight-this.#p.scrollHeight:0,s=this.#p.scrollHeight+e,i=this.#r.querySelectorAll(".se-page-break");if(!t&&this.#_===s&&this.#x===i.length)return;this.#_=s,this.#x=i.length;let n=0;const o=[];if(i.length>0){n=i[0].offsetHeight;for(let t=0;t<i.length;t++)o.push({top:i[t].offsetTop,end:i[t].offsetTop+n/2})}const l=this.#s(this.#l)?this._getWWScrollTop():0,r=[{number:0,top:0}];for(let t=0;t<o.length;t++)r.push({number:0,top:o[t].top+n/2,isBreak:!0});this.#E=0;const a=this.#r.children,h=this.#p.children;this._initializeCache(h);const c=[0,...o.map((t=>t.end))],d=[...o.map((t=>t.top)),s];for(let t=0;t<c.length;t++){const e=d[t];let s=c[t],i=0===t;for(;s+=fs+(i?this.#g+this.#m:this.#g),i=!1,!(s>=e);)if(!r.some((t=>Math.abs(t.top-s)<3))){const t=this._calcPageBreakTop(s,a,h,r);if(null===t)break;r.push({number:0,top:t})}}if(0===r.length)return this.#k=null,this.#C=1,void this._displayCurrentPage();r.sort(((t,e)=>t.top-e.top)),this.#d.innerHTML="",this.#$=[];const u=this.#a.offsetWidth+1;for(let t,e=0;e<r.length&&(t=r[e].top,!(s<t));e++){const s=Ie.utils.createElement("DIV",{style:`top:${t-l}px`,innerHTML:String(e+1)},`<div class="se-document-page-line" style="width: ${u}px;"></div>${e+1}`);this.#d.appendChild(s),this.#$.push(s)}this.#k=this.#d.querySelectorAll(".se-document-page-line"),this.#C=this.#$.length,this.#L(),this._displayCurrentPage()}),400))}_getDisplayPage(){return this.#s(this.#l)?this.#l.get("wysiwyg"):ms}_calcPageBreakTop(t,e,s,i){const{ci:n}=this._getElementAtPosition(t,s,i),o=s[n],l=e[n];if(!o||!l)return null;const r=t+(l.offsetTop-o.offsetTop)+(l.offsetHeight-o.offsetHeight)/2;return Math.round(r)}_initializeCache(t){this.#T.clear();for(let e=0,s=t.length;e<s;e++){const s=t[e],i=s.offsetTop,n=s.offsetHeight,o=i+n;this.#T.set(e,{top:i,height:n,bottom:o})}}_getElementAtPosition(t,e,s){let i=this.#E,n=e.length-1;if(i>0){const e=this.#T.get(i);e&&t<e.top&&(i=0)}for(;i<=n;){const o=Math.floor((i+n)/2),{top:l,height:r,bottom:a}=this.#T.get(o);if(t>=l&&t<=a){let i=o;if(s&&Ie.utils.hasClass(e[i],"se-page-break")){i=i+1<e.length?i+1:Math.max(0,i-1);const s=this.#T.get(i);return this.#E=i,{ci:i,cm:t-s.bottom,ch:s.height}}return this.#E=i,{ci:i,cm:t-a,ch:r}}t<l?n=o-1:i=o+1}let o=e[i]?i:n;s&&Ie.utils.hasClass(e[o],"se-page-break")&&(o=o+1<e.length?o+1:Math.max(0,o-1)),this.#E=o;const l=this.#T.get(o);return{ci:o,cm:t-l.bottom,ch:l.height}}resizePage(){const t=this.#a.offsetWidth+1,e=this.#a.offsetHeight+1;let s=!1;if(t===this.#f&&(s=e===this.#v))return;t>800?Ie.utils.removeClass(this.#h,"se-document-responsible"):Ie.utils.addClass(this.#h,"se-document-responsible"),this.#f=t,this.#v=e;const i=this.#k;for(let e=0,s=i?.length;e<s;e++)i[e].style.width=`${t}px`;s||this.rePage(!0),this._displayCurrentPage()}scrollPage(){const t=this.#S,e=this._getWWScrollTop();if(t===e)return;const s=this.#$,i=e-t;for(let t=0,e=s.length;t<e;t++)s[t].style.top=Ve.get(s[t].style.top)-i+"px";this.#L(),this.#S=e,this._displayCurrentPage()}#L(){const t=this.#$;if(!t?.length)return;const e=this.#a.offsetHeight;for(let s=0,i=t.length;s<i;s++){const i=Ve.get(t[s].style.top);t[s].style.display=i<0||i>e?"none":""}}scrollWindow(){this.#s(this.#l)||this._displayCurrentPage()}getCurrentPageNumber(){if(this.#C<=1)return 1;let t=0;if(this.#s(this.#l))t=this.#v/2;else{const e=this._getGlobalTop();if(t=ms.scrollY-e+fs/2,t<=0)return 1}const e=this.#$;for(let s=0,i=e.length;s<i;s++)if(e[s].offsetTop>=t)return this.#w=s;return this.#w=this.#C}pageUp(){const t=this.#w-1<=1?1:this.#w-1;this._movePage(t,!1)}pageDown(){const t=this.#w+1>this.#$.length?this.#$.length:this.#w+1;this._movePage(t,!1)}pageGo(t){t<1?t=1:t>this.#$.length&&(t=this.#$.length),this._movePage(t,!0)}on(t){if(!this.useHeader)return;if(this._is(t)||(t=this._findLinesHeader(t)),!t)return;const e=this._findItem(t);e&&(Ie.utils.removeClass(this.#b,"active"),Ie.utils.addClass(e,"active"))}onChangeText(t){if(!this.useHeader)return;if(!this._is(t))return;const e=this._findItem(t);e&&(e.textContent=t.textContent)}_displayCurrentPage(){const t=this.getCurrentPageNumber();this.#u?.display(t,this.#C)}_getWWScrollTop(){const t=this._getDisplayPage();return t.scrollTop||t.scrollY||0}_movePage(t,e){const s=this._getGlobalTop(),i=this.#s(this.#l),n=Be.nodeListToArray(this.#r.children),o=this.#d.offsetTop+Ve.get(this.#$[t-1].style.top)+(i?this._getWWScrollTop():0);for(let l,r=0,a=n.length;r<a;r++)if(l=n[r],l.offsetTop>=o){e||this.#n.setRange(l,0,l,0);const n=0===r&&i?0:l.offsetTop-this.#d.offsetTop-l.offsetHeight+s;this._applyPageScroll(n,(()=>{this.#o.isSticky&&!this.#t.mode.isBottom&&this._getDisplayPage().scrollTo({top:n-this.#e.get("toolbar_main").offsetHeight,behavior:"smooth"})})),this.#w=t;break}}_applyPageScroll(t,e){const s=this._getDisplayPage();s.scrollTo({top:t,behavior:"smooth"});const i=()=>{Math.abs((s.scrollY??s.scrollTop)-t)<1?e():ms.requestAnimationFrame(i)};ms.requestAnimationFrame(i)}_getGlobalTop(){return this.#s(this.#l)?0:this.#i.getGlobal(this.#a).top}_findItem(t){const e=this.#y,s=Array.prototype.indexOf.call(e,t);return-1!==s&&this.#b[s]?this.#b[s]:null}_findLinesHeader(t){for(;t&&t!==this.#r;){if(this._is(t))return t;t=t.previousElementSibling||t.parentElement}return null}_is(t){return/^h[1-6]$/i.test(t?.nodeName)}_getHeaders(){return this.#y=this.#r.querySelectorAll("h1, h2, h3, h4, h5, h6")}#H(t,e){e.preventDefault();try{this.#t.set("_preventBlur",!0);const t=Ie.query.getEventTarget(e);if(Ie.utils.hasClass(t,"se-doc-item")){const e=Array.prototype.indexOf.call(this.#b,t);if(-1===e)return;const s=this.#y[e];s&&this.#n.scrollTo(s)}}finally{this.#t.set("_preventBlur",!1)}}_destroy(){this.#M&&(ms.clearTimeout(this.#M),this.#M=null),this.#T&&(this.#T.clear(),this.#T=null),this.#l=null,this.#r=null,this.#a=null,this.#h=null,this.#c=null,this.#d=null,this.#$=null,this.#k=null,this.#b=null,this.#y=null,this.#u=null,this.#p=null}};const bs=class{#N;#A=new Map;constructor(t){const e=t.options,s=e.get("mode"),i=e.get("_subMode");this._editorInitFinished=!1,this.mode={isClassic:/classic/i.test(s),isInline:/inline/i.test(s),isBalloon:/balloon/i.test(s),isBalloonAlways:/balloon-always/i.test(s),isSubBalloon:/balloon/i.test(i),isSubBalloonAlways:/balloon-always/i.test(i),isBottom:!!e.get("_toolbar_bottom")},this.#N={rootKey:t.rootId,hasFocus:!1,tabSize:4,indentSize:25,codeIndentSize:2,currentNodes:[],currentNodesMap:[],initViewportHeight:0,currentViewportHeight:0,controlActive:!1,_lastSelectionNode:null,isScrollable:t=>{const e=t.get("options"),s=e.get("height"),i=e.get("maxHeight");return"auto"!==s||!!i&&t.get("wysiwyg").offsetHeight>=Ve.get(i)},_range:null,_mousedown:!1,_preventBlur:!1,_preventFocus:!1}}get(t){return this.#N[t]}set(t,e){const s=this.#N[t];this.#N[t]=e,this.#B(t,e,s)}subscribe(t,e){return this.#A.has(t)||this.#A.set(t,new Set),this.#A.get(t).add(e),()=>this.#A.get(t).delete(e)}#B(t,e,s){const i=this.#A.get(t);if(i)for(const n of i)try{n(e,s)}catch(e){console.error(`[Store] Subscriber error for "${t}":`,e)}}_reset(){}_destroy(){this.#A.clear(),this.#N=null}},{_w:ys,_d:Cs}=Ne;class ws{#I;#V;#O;constructor(t){this.#I=t.frameRoots,this.#V=this.#R(t.context),this.#O=this.#P({value:new Map}),this.rootKeys=t.rootKeys,this.carrierWrapper=t.carrierWrapper,this.icons=t.icons,this.lang=t.lang,this.shadowRoot=null}get frameRoots(){return this.#I}get context(){return this.#V}get frameContext(){return this.#O}init(){this.applyToRoots((t=>{this.#z(t)}))}reset(t){this.#O.reset(t)}applyToRoots(t){this.#I.forEach(t)}#z(t){const e=t.get("options");if(t.set("wwComputedStyle",ys.getComputedStyle(t.get("wysiwyg"))),!e.get("iframe")&&"function"==typeof ShadowRoot){let e=t.get("wysiwygFrame");for(;e;){if(e.shadowRoot){this.shadowRoot=e.shadowRoot;break}if(e instanceof ShadowRoot){this.shadowRoot=e;break}e=e.parentNode}}e.get("iframe")?(t.set("_ww",t.get("wysiwygFrame").contentWindow),t.set("_wd",t.get("wysiwygFrame").contentDocument),t.set("wysiwyg",t.get("_wd").body),e.get("_defaultStyles").editor&&(t.get("wysiwyg").style.cssText=e.get("_defaultStyles").editor),"auto"===e.get("height")&&t.set("_iframeAuto",t.get("_wd").body)):(t.set("_ww",ys),t.set("_wd",Cs));const s=e.get("editableFrameAttributes");for(const e in s)t.get("wysiwyg").setAttribute(e,s[e])}#R(t){const e=t;return{get:t=>e.get(t),set:(t,s)=>e.set(t,s),has:t=>e.has(t),delete:t=>e.delete(t),getAll:()=>Object.fromEntries(e.entries()),get size(){return e.size},clear(){e.clear()}}}#P(t){let e=t.value;return{get:t=>e.get(t),set:(t,s)=>e.set(t,s),has:t=>e.has(t),delete:t=>e.delete(t),getAll:()=>Object.fromEntries(e.entries()),reset(s){e=t.value=s},get size(){return e.size},clear(){e.clear()}}}_destroy(){this.applyToRoots((t=>{const e=t.get("documentType");e&&e._destroy(),Ie.utils.removeItem(t.get("topArea")),t.get("options").clear(),t.clear()})),this.#V.clear(),this.#O.clear(),this.#I.clear(),Ie.utils.removeItem(this.carrierWrapper),this.rootKeys=null,this.carrierWrapper=null,this.icons=null,this.lang=null,this.shadowRoot=null}}class _s{#F;#D;#q;#W;constructor(t,e,s){this.#F=t,this.#D=s,this.#q=this.#U({value:e.options}),this.#W=this.#Z({value:new Map})}get options(){return this.#q}get frameOptions(){return this.#W}reset(t){const{$:e}=this.#F,s=e.frameRoots,i=e.context,n=e.eventManager,o=e.format,l=e.html,r=e.char,a=e.viewer,h=e.plugins,c=e.history,d=e.ui,u=this.#F._eventOrchestrator;a.codeView(!1),a.showBlocks(!1);const p=new Map,g=[],m=new Map,f={};for(const e in t)void 0!==Ke[e]&&(f[e]=t[e],delete t[e]);for(const e of s.keys())t[e||""]={...f,...t[e||""]};const v=Object.keys(t);if(this.#G(v,h,""),0===v.length)return;1===s.size&&v.unshift(null);const b=[this.#D,t].reduce(((t,e)=>{for(const i in e)s.has(i||null)?this.#j(i,e,s,p,m,g):t[i]=e[i];return t}),{}),y=this.#q,C=ss(b,g,h),w=C.o,_=C.frameMap;for(let t,e=0,i=v.length;e<i;e++)if(t=v[e]||null,m.has(t)){const e=p.get(t),i=s.get(t),o=i.get("options"),l=_.get(t);for(const[t,e]of l.entries())o.set(t,e);if(e.has("statusbar-changed")){if(Ie.utils.removeItem(i.get("statusbar")),l.get("statusbar")){const t=is(l,null).statusbar;i.get("container").appendChild(t),Ge(t,i),u.__addStatusbarEvent(i,l)}else n.removeEvent(o.get("__statusbarEvent")),l.set("__statusbarEvent",null),Ge(null,i);i.get("statusbar")&&r.display(i)}if(e.has("iframe_attributes")){const t=i.get("wysiwygFrame"),e=o.get("iframe_attributes"),s=l.get("iframe_attributes");for(const s in e)t.removeAttribute(s);for(const e in s)t.setAttribute(e,s[e])}if(e.has("iframe_cssFileName")){const t=i.get("_wd").head,e=t.getElementsByTagName("link");for(;e[0];)t.removeChild(e[0]);const s=(new DOMParser).parseFromString(Be._setIframeStyleLinks(l.get("iframe_cssFileName")),"text/html").head.children,n=t.querySelector("style");for(;s[0];)t.insertBefore(s[0],n)}if(e.has("placeholder")&&(i.get("placeholder").textContent=l.get("placeholder")),e.has("placeholder_line")){const t=l.get("placeholder_line");i.set("placeholder_line",t);const e=i.get("wysiwyg").querySelector(".se-placeholder-line");e&&(t?e.setAttribute("data-se-placeholder-line",t):(e.classList.remove("se-placeholder-line"),e.removeAttribute("data-se-placeholder-line"),e.getAttribute("class")||e.removeAttribute("class")))}d.setEditorStyle(l.get("editorStyle"),i);const a=i.get("wysiwyg"),h=o.get("editableFrameAttributes"),c=l.get("editableFrameAttributes");for(const t in h)a.removeAttribute(t);for(const t in c)a.setAttribute(t,c[t])}else switch(t){case"theme":d.setTheme(w.get("theme"));break;case"events":{const t=w.get("events");for(const e in t)n.events[e]=t[e];break}case"autoStyleify":l.__resetAutoStyleify(w.get("autoStyleify"));break;case"textDirection":d.setDir("rtl"===w.get("textDirection")?"rtl":"ltr");break;case"historyStackDelayTime":c.resetDelayTime(w.get("historyStackDelayTime"));break;case"defaultLineBreakFormat":o.__resetBrLineBreak(w.get("defaultLineBreakFormat"))}y.setMany(w),this.#D=b;const x=i.get("toolbar_main");/inline|balloon/i.test(y.get("mode"))&&v.includes("toolbar_width")&&(x.style.width=y.get("toolbar_width")),y.get("toolbar_hide")?x.style.display="none":x.style.display="",y.get("shortcutsHint")?Ie.utils.removeClass(x,"se-shortcut-hide"):Ie.utils.addClass(x,"se-shortcut-hide")}resetFrame(t){this.#W.reset(t)}#j(t,e,s,i,n,o){const l=e[t],r=Object.keys(l);if(this.#G(r,null,t+"."),0===r.length)return!1;const a=t||null;i.set(a,new Map);const h=s.get(a).get("options").get("_origin"),c={},d=Object.prototype.hasOwnProperty;for(const t in l){if(!d.call(Ke,t))continue;const e=l[t];r.includes(t)&&h[t]!==e&&(i.get(a).set(this.#K(t),!0),c[t]=e)}const u={...h,...c};n.set(a,new Map(Object.entries(u))),o.push({key:a,options:u})}#K(t){return/^statusbar|^charCounter|^wordCounter/.test(t)?"statusbar-changed":t}#G(t,e,s){for(let i,n=0,o=t.length;n<o;n++)i=t[n],("fixed"===Ye[i]||"fixed"===Ke[i]||e&&e[i])&&(console.warn(`[SUNEDITOR.warn.resetOptions] The "[${s+i}]" option cannot be changed after the editor is created.`),t.splice(n--,1),o--)}#U(t){let e=t.value;return{get:t=>e.get(t),set:(t,s)=>e.set(t,s),has:t=>e.has(t),getAll:()=>Object.fromEntries(e.entries()),setMany(t){t.forEach(((t,s)=>e.set(s,t)))},reset(s){e=t.value=s},size:()=>e.size,clear(){e.clear()},entries:()=>e.entries(),keys:()=>e.keys(),values:()=>e.values(),forEach(t){e.forEach(t)}}}#Z(t){let e=t.value;return{get:t=>e.get(t),set:(t,s)=>e.set(t,s),has:t=>e.has(t),getAll:()=>Object.fromEntries(e.entries()),setMany(t){t.forEach(((t,s)=>e.set(s,t)))},reset(s){e=t.value=s},size:()=>e.size,clear(){e.clear()},entries:()=>e.entries(),keys:()=>e.keys(),values:()=>e.values(),forEach(t){e.forEach(t)}}}_destroy(){this.#D=null,this.#q.clear(),this.#W.clear()}}const xs=class{#Y;constructor(t){this.#Y=t}isNode(t){return t&&"number"==typeof t.nodeType||t instanceof this.#X().Node}isElement(t){return t&&1===t.nodeType||t instanceof this.#X().Element}isRange(t){return t&&"Range"===t.constructor?.name||t instanceof this.#X().Range}isSelection(t){return t&&"Selection"===t.constructor?.name||t instanceof this.#X().Selection}#X(){return this.#Y.get("_ww")}},{_w:$s,_d:ks,NO_EVENT:Ss}=Ne;const Es=class{#J;#Y;#Q;#tt=null;#et=null;#st=[];constructor(t,e,s){this.#J=s,this.#Y=t.frameContext,this.#Q=e.frameOptions,this.events=e.options.get("events")||{},this.triggerEvent=async(t,e)=>{if(Ie.check.isNonEditable(e?.frameContext?.get("wysiwyg")))return!1;const s=this.events[t];if("function"==typeof s)try{return await s({$:this.#J,...e})}catch(e){return console.error(`[SUNEDITOR.triggerEvent.${t}]`,e),!1}return Ss}}_bindOrchestrator(t){this.#tt=t}applyTagEffect(t){return this.#tt?.applyTagEffect(t)}addEvent(t,e,s,i){if(!t)return null;if((t===$s||t===ks||"number"!=typeof t.length||t.nodeType||!Array.isArray(t)&&t.length<1)&&(t=[t]),0===t.length)return null;const n=t.length;for(let o=0;o<n;o++)t[o].addEventListener(e,s,i),this.#st.push({target:t[o],type:e,listener:s,useCapture:i});return{target:t,type:e,listener:s,useCapture:i}}removeEvent(t){if(!t)return;let e=t.target;const s=t.type,i=t.listener,n=t.useCapture;if(e&&((e===$s||e===ks||"number"!=typeof e.length||e.nodeType||!Array.isArray(e)&&e.length<1)&&(e=[e]),0!==e.length)){for(let t=0,o=e.length;t<o;t++)e[t].removeEventListener(s,i,n);return null}}addGlobalEvent(t,e,s){return this.#Q.get("iframe")&&this.#Y.get("_ww").addEventListener(t,e,s),$s.addEventListener(t,e,s),{type:t,listener:e,useCapture:s}}removeGlobalEvent(t,e,s){if(t)return"object"==typeof t&&(e=t.listener,s=t.useCapture,t=t.type),this.#Q.get("iframe")&&this.#Y.get("_ww").removeEventListener(t,e,s),$s.removeEventListener(t,e,s),null}_injectActiveEvent(t){Ie.utils.addClass(t,"__se__active"),this.#et=this.addGlobalEvent("mouseup",(()=>{Ie.utils.removeClass(t,"__se__active"),this.#et=this.removeGlobalEvent(this.#et)}))}_init(){for(let t,e=0,s=this.#st.length;e<s;e++)t=this.#st[e],t.target.removeEventListener(t.type,t.listener,t.useCapture);this.#st=null,this.#et&&=this.removeGlobalEvent(this.#et)}};const Ts=class{#J;#t;#it;#nt;#e;#Y;#ot;#Q;constructor(t){this.#J=t.$,this.#t=t.store,this.#it=this.#J.contextProvider.shadowRoot,this.#nt=this.#J.contextProvider.carrierWrapper,this.#e=this.#J.context,this.#Y=this.#J.frameContext,this.#ot=this.#J.options,this.#Q=this.#J.frameOptions}get(t){const e=this.#Y.get("wysiwygFrame"),s=/iframe/i.test(e?.nodeName),i=this.getLocal(t);return{left:i.left+(s?e.parentElement.offsetLeft:0),top:i.top+(s?e.parentElement.offsetTop:0)}}getLocal(t){const e=t;let s=0,i=0,n=0,o=0,l=0,r=3===e.nodeType?e.parentElement:e;const a=e.offsetWidth,h=vt(e,X.bind(this)),c=r;for(;r&&!rt(r,"se-wrapper")&&r!==h;)s+=r.offsetLeft-(c!==r?r.scrollLeft:0),i+=r.offsetTop+(c!==r?r.scrollTop:0),r=r.offsetParent;const d=this.#Y.get("wysiwygFrame");this.#Y.get("wysiwyg").contains(e)&&(n=d.offsetLeft,o=d.offsetTop,l=d.parentElement.offsetWidth-(d.offsetLeft+d.offsetWidth));const u=this.#Y.get("eventWysiwyg");return s+=n-(h?h.scrollLeft:0),i+=o-(h?h.scrollTop:0),{left:s,top:i,right:r?.offsetWidth?r.offsetWidth-(s-n+a)+l:0,scrollX:u.scrollLeft||u.scrollX||0,scrollY:u.scrollTop||u.scrollY||0,scrollH:this.#Y.get("wysiwyg").scrollHeight||0}}getGlobal(t){const e=this.#Y.get("topArea"),s=this.#Y.get("wysiwygFrame");if(t||=e,!W(t))return{top:0,left:0,fixedTop:0,fixedLeft:0,width:0,height:0};const i=t,n=i.getBoundingClientRect();let l=n.top,r=n.left;if(/^iframe$/i.test(s.nodeName)&&s.contentDocument.contains(i)){const t=s.getBoundingClientRect();l+=t.top,r+=t.left}return{top:l+o.scrollY,left:r+o.scrollX,fixedTop:l,fixedLeft:r,width:i.offsetWidth,height:i.offsetHeight}}getGlobalScroll(t){const e=this.#Y.get("topArea");let s=!1,i=!1;t||=e,t===e&&(s=!0),!s&&W(t)&&(i="absolute"===o.getComputedStyle(t).position);let n=0,l=0,r=0,a=0,h=0,c=0,d=0,u=0,p=null,g=null,m=null,f=null,v=t;for(;v;)n+=v.scrollTop,l+=v.scrollLeft,r+=v.scrollHeight,a+=v.scrollWidth,v.scrollTop>0&&(c+=v.offsetTop),v.scrollHeight>=v.clientHeight&&(d=/^html$/i.test(v.nodeName)?d||v.clientHeight:v.clientHeight+(m?-m.clientTop:0),p=m||p||v,m=v),v.scrollLeft>0&&(h+=v.offsetLeft),v.scrollWidth>=v.clientWidth&&(u=/^html$/i.test(v.nodeName)?u||v.clientWidth:v.clientWidth+(f?-f.clientLeft:0),g=f||g||v,f=v),v=v.parentElement;if(!i&&!s&&/^iframe$/i.test(this.#Y.get("wysiwygFrame").nodeName))for(v=this.#Y.get("wrapper"),p=g=e;v;)n+=v.scrollTop,l+=v.scrollLeft,r+=v.scrollHeight,a+=v.scrollWidth,v.scrollTop>0&&(c+=v.offsetTop),v.scrollHeight>=v.clientHeight&&(d=/^html$/i.test(v.nodeName)?d||v.clientHeight:v.clientHeight+(m?-m.clientTop:0),m=v),v.scrollLeft>0&&(h+=v.offsetLeft),v.scrollWidth>=v.clientWidth&&(u=/^html$/i.test(v.nodeName)?u||v.clientWidth:v.clientWidth+(f?-f.clientLeft:0),f=v),v=v.parentElement;for(v=this.#it?.host,v&&(p=g=e);v;)n+=v.scrollTop,l+=v.scrollLeft,r+=v.scrollHeight,a+=v.scrollWidth,v.scrollTop>0&&(c+=v.offsetTop),v.scrollHeight>=v.clientHeight&&(d=/^html$/i.test(v.nodeName)?d||v.clientHeight:v.clientHeight+(m?-m.clientTop:0),m=v),v.scrollLeft>0&&(h+=v.offsetLeft),v.scrollWidth>=v.clientWidth&&(u=/^html$/i.test(v.nodeName)?u||v.clientWidth:v.clientWidth+(f?-f.clientLeft:0),f=v),v=v.parentElement;const b=e.contains(p),y=e.contains(g);p=b?e:p,g=y?e:g;const C=p?p.getBoundingClientRect().top+(!p.parentElement||/^html$/i.test(p.parentElement.nodeName)?o.scrollY:0):0,w=g?g.getBoundingClientRect().left+(!g.parentElement||/^html$/i.test(g.parentElement.nodeName)?o.scrollX:0):0;d=b?e.clientHeight:d,u=y?e.clientWidth:u;const _=ct(this.#Y.get("_wd"));return{top:n,left:l,ts:C,ls:w,width:a,height:r,x:h,y:c,ohOffsetEl:i?window:p,owOffsetEl:i?window:g,oh:i?_.h:d,ow:i?_.w:u,heightEditorRefer:b,widthEditorRefer:y}}getWWScroll(){const t=this.#Y.get("eventWysiwyg"),e=t.scrollTop||t.scrollY||0,s=t.scrollHeight||t.document?.documentElement.scrollHeight||0;return{top:e,left:t.scrollLeft||t.scrollX||0,width:t.scrollWidth||t.document?.documentElement.scrollWidth||0,height:s,bottom:e+s}}setRelPosition(t,e,s,i,{preferUp:n}={}){const r=/^fixed$/i.test(o.getComputedStyle(i).position),a=this.getGlobal(s);if(r)t.style.position="fixed",t.style.top=n?a.fixedTop-t.offsetHeight+"px":`${a.fixedTop+a.height}px`;else{t.style.position="";const r=i.contains(t)?this.getGlobal(e).top:0,h=t.offsetHeight,c=o.scrollY,d=a.top;if(n){const e=r-c+d;if(e<h){const i=ct(l).h-(r-c+d+s.offsetHeight);i>=h?t.style.top=`${d+s.offsetHeight}px`:i>e?(t.style.height=`${i}px`,t.style.top=`${d+s.offsetHeight}px`):(t.style.height=`${e}px`,t.style.top=-1*(e-d+3)+"px")}else t.style.top=d-h+"px"}else{const e=ct(l).h-(r-c+d+s.offsetHeight);if(e<h){let i=-1*(h-d+3);const n=r-c+i,o=h+(n<0?n:0);o>e?(t.style.height=`${o}px`,i=-1*(o-d+3)):(t.style.height=`${e}px`,i=d+s.offsetHeight),t.style.top=`${i}px`}else t.style.top=`${d+s.offsetHeight}px`}}const h=t.offsetWidth,c=a.left,d=this.getGlobal(i).left;if(this.#ot.get("_rtl")){const e=s.getBoundingClientRect(),n=o.innerWidth;let l=n-e.right;if(h>0){const t=i.getBoundingClientRect();n-l-h<t.left&&(l=n-t.left-h)}t.style.left="auto",t.style.right=`${Math.max(0,l)}px`}else{const e=i.offsetWidth+d,s=e<=h?0:e-(c+h);t.style.right="",t.style.left=s<0?`${c+s}px`:`${c}px`}}setAbsPosition(t,e,s){const i={left:0,right:0,top:0,...s.addOffset},n=s.position||"bottom",r=s.inst,a=!this.#ot.get("_rtl");a||(i.left*=-1);const h=this.#Q.get("iframe"),c=this.#Y.get("wrapper").contains(e)||s.isWWTarget||!!h&&this.#Y.get("wysiwyg").contains(e),d=Boolean(vt(e,".se-toolbar")),u=1===e.nodeType,p=c&&!u,g=u&&/inline/.test(o.getComputedStyle(e).display),m=ct(l),f=p?this.getWWScroll():this.#lt(),v=!c||!h&&u?e.getBoundingClientRect():this.#J.selection.getRects(e,"start").rects,b=this.getGlobal(e),y=rt(t.firstElementChild,"se-arrow")?t.firstElementChild:null,C=s.sibling?.offsetHeight||0,w=y?y.offsetHeight:0,_=t.offsetHeight,x=e.offsetHeight,$=v.top,k=m.h-v.bottom,S=this.getGlobal(this.#Y.get("topArea")).top,E=o.scrollY,T=this.#e.get("toolbar_main").offsetHeight,M=this.#ot.get("toolbar_container"),H=this.#t.mode.isBalloon||this.#t.mode.isInline||M,L=M&&S-E-T>0||!this.#J.toolbar.isSticky&&H?0:T+(this.#J.toolbar.isSticky?this.#ot.get("_toolbar_sticky"):0),N=this.#Y.get("statusbar")?.offsetHeight||0,{rmt:A,rmb:B,bMargin:I,rt:V}=this.#rt($,k,L,m,v,p,d);if(c&&(B-N+x<=0||A+V+x-(this.#J.toolbar.isSticky&&g?L:0)<=0)||A+x<0)return;const O=this.#Y.get("topArea").getBoundingClientRect(),R=this.#t.mode.isBottom?O.bottom>=o.innerHeight-T:O.top<=T,P=this.#J.toolbar.isSticky&&"none"!==this.#e.get("toolbar_main").style.display&&(!H||R);let z=i.top,F=0,D="";"bottom"===n?(D="up",z+=v.bottom+w+E,F=B-(_+w),F-C<0&&(D="down",z-=x+_+2*w,F=A-(_+w),F-C<0&&(D="",z-=F-C-Math.max(1,F+_+w)))):(D="down",z+=v.top-_-w+E,F=(P&&!this.#t.mode.isBottom?v.top-L:A)-_-w,F-C<0&&(D="up",z+=x+_+2*w,F=(B>0?I:B)-(_+w)-N,F-C<0&&(D="",z+=F-2))),this.#at(y,D),t.style.top=`${z}px`;const q=(1===t.nodeType?Ve.get(o.getComputedStyle(t).borderRadius):0)||0,W=b.width,U=t.offsetWidth,Z=y?y.offsetWidth:0,G=v.left,j=m.w-v.right;if(c&&(G+W<=0||j+W<=0))return;y&&(y.style.left="",y.style.right="");let K=i.left||(i.right?a?i.right-t.offsetWidth:t.offsetWidth-i.right:0),Y=0,X=0,J=0;return a?(K+=v.left+o.scrollX-(G<0?G:0),Y=W+G,Y<Z&&(J=Z/2-1+(q<=2?0:q-2),X=J),Y=W+j-U,Y<0&&(K+=Y,J=U-1-(Z/2+(q<=2?0:q-2)),X=-(Y-Z/2),X=X>J?J:X),y&&X>0&&(y.style.left=X+"px")):(K+=v.right-U+o.scrollX+(j<0?j:0),Y=W+j,Y<Z&&(J=Z/2-1+(q<=2?0:q-2),X=J),Y=W+G-U,Y<0&&(K-=Y,J=Z/2-1+(q<=2?0:q-2),X=-(Y-Z/2),X=X<J?J:X>U-J?U-J:X),y&&X>0&&(y.style.right=X+"px")),t.style.left=`${K}px`,r.__offset={left:t.offsetLeft+f.left,top:t.offsetTop+f.top,addOffset:i},{position:"up"===D?"bottom":"top"}}setRangePosition(t,e,{position:s,addTop:i}={}){t.style.top="-10000px",t.style.visibility="hidden",t.style.display="block";let n="top"===s;e||=this.#J.selection.getRange();const r=this.#J.selection.getRects(e,n?"start":"end");if(n="start"===r.position,r.rects.noText){let t=e.startContainer;1===t.nodeType&&(t=t.childNodes[e.startOffset]||t);const s=t.parentNode;if(s){const e=it(S);s.insertBefore(e,t);const i=l.createRange();i.setStart(e,1),i.setEnd(e,1);const n=i.getClientRects()[0];n&&(r.rects=n,r.scrollLeft=o.scrollX,r.scrollTop=o.scrollY),s.removeChild(e)}}const a=this.#Y.get("isFullScreen"),h=this.#Y.get("topArea"),c=this.#nt.contains(t),d=r.rects,u=a?0:r.scrollLeft,p=a?0:r.scrollTop,g=c?ct(l).w:h.offsetWidth,m=this.getGlobal(h),f=c?0:m.left,v=t.offsetWidth,b=t.offsetHeight;this.#ht(n,d,t,f,g,u,p,i),this.getGlobal(t).top-m.top<0&&(n=!n,this.#ht(n,d,t,f,g,u,p,i)),v===t.offsetWidth&&b===t.offsetHeight||this.#ht(n,d,t,f,g,u,p,i);const y=!this.#nt.contains(t),C=ct(l),w=d.height,_=d.top,x=C.h-d.bottom,$=this.#J.toolbar.isSticky||!this.#t.mode.isBalloon&&!this.#t.mode.isInline?this.#e.get("toolbar_main").offsetHeight:0,{rmt:k,rmb:E,rt:T}=this.#rt(_,x,$,C,d,y,!1);if(!(E+w<=0||k+T+w<=0))return t.style.visibility="",!0}#ht(t,e,s,i,n,o,r,a=0){const h=s.querySelector(".se-arrow "),c=Math.round(h.offsetWidth/2),d=s.offsetWidth,u=e.noText&&!t?0:s.offsetHeight,p=(t?e.left:e.right)-i-d/2+o,g=p+d-n;let m=(t?e.top-u-c:e.bottom+c)-(e.noText?0:a)+r;const f=p<0?1:g<0?p:p-g-1-1;let v=!1;const b=m+(t?this.getGlobal(this.#Y.get("topArea")).top:s.offsetHeight-this.#Y.get("wysiwyg").offsetHeight);!t&&b>0&&this.#ct()<b?(t=!0,v=!0):t&&l.documentElement.offsetTop>b&&(t=!1,v=!0),v&&(m=(t?e.top-u-c:e.bottom+c)-(e.noText?0:a)+r),s.style.left=Math.floor(f)+"px",s.style.top=Math.floor(m)+"px",t?(ht(h,"se-arrow-up"),at(h,"se-arrow-down")):(ht(h,"se-arrow-down"),at(h,"se-arrow-up"));const y=Math.floor(d/2+(p-f));h.style.left=(y+c>s.offsetWidth?s.offsetWidth-c:y<c?c:y)+"px"}#ct(){const t=this.#Y.get("topArea");return l.documentElement.scrollHeight-(this.getGlobal(t).top+t.offsetHeight)}#rt(t,e,s,i,n,l,r){const a=this.#J.selection.getRects(this.#Y.get("wysiwyg"),"start").rects;let h=0,c=0,d=0,u=0,p=0;const g=this.#Q.get("iframe");u=n.top,p=i.h-n.bottom;const m=this.getGlobal(),f=this.#t.mode.isBottom;if(l){d=r||this.#J.toolbar.isSticky||this.#ot.get("toolbar_container")?0:s;const t=g?0:m.top-o.scrollY+d,e=g?0:this.#t.get("currentViewportHeight")-(m.top+m.height-o.scrollY);let i=t,l=e;f?(s>e?l=this.#J.toolbar.isSticky?s:e+s:this.#ot.get("toolbar_container")&&!this.#J.toolbar.isSticky?s=0:l=e+s,h=n.top-(a.top-t),c=a.bottom-(n.bottom-l)+s,c=c>0?c:c-s):(s>t?i=this.#J.toolbar.isSticky?s:t+s:this.#ot.get("toolbar_container")&&!this.#J.toolbar.isSticky?s=0:i=t+s,h=n.top-(a.top-i)+s,c=a.bottom-(n.bottom-e),h=h>0?h:h-s)}else{const t=m.fixedTop>0?m.fixedTop:0,e=o.innerHeight-(m.fixedTop+m.height);d=r||!this.#J.toolbar.isSticky&&this.#J.toolbar.isBalloonMode?0:s,f?(h=u-(r?0:t),c=p-(e>0?e:0)-d):(h=u-(r?0:t)-d,c=p-(e>0?e:0))}return{rmt:h,rmb:c,rt:d,tMargin:u,bMargin:p}}#at(t,e){"up"===e?(t&&(t.style.visibility=""),at(t,"se-arrow-up"),ht(t,"se-arrow-down")):"down"===e?(t&&(t.style.visibility=""),at(t,"se-arrow-down"),ht(t,"se-arrow-up")):t&&(t.style.visibility="hidden")}#lt(){const t=ct(l);return{top:o.scrollY,left:o.scrollX,width:t.w,height:t.h,bottom:o.scrollY+t.h,rects:{left:0,top:0,right:o.innerWidth,bottom:this.#t.get("currentViewportHeight")||o.innerHeight,noText:!0}}}},{_w:Ms}=Ne;const Hs=class{#F;#J;#t;#it;#dt;#e;#Y;#ot;#Q;#ut=0;#pt=!1;constructor(t){this.#F=t,this.#J=t.$,this.#t=t.store,this.#it=this.#J.contextProvider.shadowRoot,this.#dt=this.#J.instanceCheck,this.#e=this.#J.context,this.#Y=this.#J.frameContext,this.#ot=this.#J.options,this.#Q=this.#J.frameOptions,this.range=null,this.selectionNode=null,this.__iframeFocus=!1}get(){let t=null;return t="function"==typeof this.#it?.getSelection?this.#it.getSelection():this.#Y.get("_ww").getSelection(),t?(this.#t.get("_range")||this.#Y.get("wysiwyg").contains(t.focusNode)||(t.removeAllRanges(),t.addRange(this.#gt())),t):null}isRange(t){return this.#dt.isRange(t)}getRange(){const t=this.#t.get("_range")||this.#gt(),e=this.get();if(t.collapsed===e.isCollapsed||!this.#Y.get("wysiwyg").contains(e.focusNode)){if(this.#J.component.is(t.startContainer)){const e=this.#J.component.get(t.startContainer),s=e?.container;return s?this.setRange(s,0,s,1):t}return t}if(e.rangeCount>0){const t=e.getRangeAt(0);return this.#t.set("_range",t),t}{const t=e.anchorNode,s=e.focusNode,i=e.anchorOffset,n=e.focusOffset,o=Ie.query.compareElements(t,s),l=o.ancestor&&(0===o.result?i<=n:o.result>1);return this.setRange(l?t:s,l?i:n,l?s:t,l?n:i)}}setRange(t,e,s,i){let n,o,l,r;if(this.isRange(t)){const e=t;n=e.startContainer,o=e.startOffset,l=e.endContainer,r=e.endOffset}else n=t,o=e,l=s,r=i;if(!n||!l)return;(Ie.check.isBreak(n)||3===n.nodeType)&&o>n.textContent.length&&(o=n.textContent.length),(Ie.check.isBreak(l)||3===l.nodeType)&&r>l.textContent.length&&(r=l.textContent.length),this.#J.format.isLine(n)&&(n=n.childNodes[o>0?n.childNodes.length-1:0]||n,o=o>0?1!==n.nodeType||Ie.check.isBreak(n)?n.textContent?n.textContent.length:0:1:0),this.#J.format.isLine(l)&&(l=l.childNodes[r>0?l.childNodes.length-1:0]||l,r=r>0?1!==l.nodeType||Ie.check.isBreak(l)?l.textContent?l.textContent.length:0:1:0);const a=this.#Y.get("_wd").createRange();try{o=Math.min(o,n.textContent?.length||0),r=r>0&&0===(l.textContent?.length||0)&&1===l.nodeType?1:Math.min(Math.max(r,0),l.textContent?.length||0),a.setStart(n,o),a.setEnd(l,r),this.#t.set("hasFocus",!0)}catch(t){return console.warn("[SUNEDITOR.selection.focus.warn]",t.message),void this.#J.focusManager.nativeFocus()}const h=this.get();return h.removeAllRanges&&h.removeAllRanges(),h.addRange(a),this.#t.set("_range",a),this.#mt(a,this.get()),this.#Q.get("iframe")&&this.__focus(),a}removeRange(){this.#t.set("_range",null),this.#t.set("_lastSelectionNode",null),this.selectionNode=null,this.#t.get("hasFocus")&&this.get().removeAllRanges(),this.#F._eventOrchestrator.selectionState.reset()}getNearRange(t){const e=t.nextSibling,s=t.previousSibling;return e?{container:e,offset:0}:s?{container:s,offset:1}:null}getRangeAndAddLine(t,e){if(this.#ft(t)){const s=e?.parentElement||this.#Y.get("wysiwyg"),i=Ie.utils.createElement(this.#ot.get("defaultLine"),null,"<br>");s.insertBefore(i,e&&e!==s?e.previousElementSibling?e.nextElementSibling:e:s.firstElementChild),this.setRange(i.firstElementChild,0,i.firstElementChild,1),t=this.#t.get("_range")}return t}getNode(){if(this.#Y.get("wysiwyg").contains(this.selectionNode)||this.init(),!this.selectionNode){const t=Ie.query.getEdgeChild(this.#Y.get("wysiwyg").firstChild,(t=>0===t.childNodes.length||3===t.nodeType),!1);if(t)return this.selectionNode=t,t;this.init()}return this.selectionNode}getRects(t,e){const s=!!Ie.check.isElement(t)&&"absolute"===Ms.getComputedStyle(t).position;t=!t||Ie.check.isText(t)?this.getRange():t;let i="start"===e,n=Ms.scrollX,o=Ms.scrollY,l=t.getClientRects();if(l=l[i?0:l.length-1],!l){const t=this.getNode();if(this.#J.format.isLine(t)){const t=Ie.utils.createTextNode(Ae.zeroWidthSpace);this.#J.html.insertNode(t,{afterNode:null,skipCharCount:!0}),this.setRange(t,1,t,1),this.init(),l=this.getRange().getClientRects(),l=l[i?0:l.length-1]}if(!l){const e=this.#J.offset.get(t);l={left:e.left,top:e.top,right:e.left+t.offsetWidth,bottom:e.top+t.offsetHeight,noText:!0},n=0,o=0}i=!0}const r=/^iframe$/i.test(this.#Y.get("wysiwygFrame").nodeName)?this.#Y.get("wysiwygFrame").getClientRects()[0]:null;return!s&&r&&(l={left:l.left+r.left,top:l.top+r.top,right:l.right+r.right-r.width,bottom:l.bottom+r.bottom-r.height}),{rects:l,position:i?"start":"end",scrollLeft:n,scrollTop:o}}getDragEventLocationRange(t){const e=this.#Y.get("_wd");let s,i,n,o,l;return e.caretPositionFromPoint?(s=e.caretPositionFromPoint(t.clientX,t.clientY),i=s.offsetNode,n=s.offset,o=s.offsetNode,l=s.offset):e.caretRangeFromPoint&&(s=e.caretRangeFromPoint(t.clientX,t.clientY),i=s.startContainer,n=s.startOffset,o=s.endContainer,l=s.endOffset),{sc:i,so:n,ec:o,eo:l}}scrollTo(t,e){const s=e?.noFocus;if(this.#dt.isSelection(t))t=t.getRangeAt(0);else if(this.#dt.isNode(t))if(s){const e=this.#Y.get("_wd").createRange();e.selectNodeContents(t),t=e}else t=this.setRange(t,1,t,1);else void 0===t?.startContainer&&console.warn('[SUNEDITOR.html.scrollTo.warn] "selectionRange" must be Selection or Range or Node object.',t);const i=Ie.query.getParentElement(t?.startContainer,(t=>1===t.nodeType));if(!i)return;delete(e={behavior:"smooth",block:"nearest",inline:"nearest",...e}).noFocus;const n=this.#Y.get("_ww"),o=this.#Y.get("wysiwygFrame"),l=this.#Q.get("iframe"),r=!this.#t.get("isScrollable")(this.#Y),a=this.#t.get("currentViewportHeight"),h=r?Ms.scrollY:l?n.scrollY:o.scrollTop,c=this.#t.mode.isBottom,d=this.#e.get("toolbar_main").offsetHeight,u=this.#J.toolbar.isSticky?d:0,p=this.#J.toolbar.isSticky?u+this.#ot.get("_toolbar_sticky"):u,g=this.#Y.get("statusbar")?.offsetHeight||0;if(this.#pt){const s=this.#J.format.isBrLine(i)?t?.getBoundingClientRect?.():null;return s?.height>0?this.#vt(s,e.behavior):i?.scrollIntoView(e),void("auto"===e?.behavior&&h!==Ms.scrollY&&(p?c?h<Ms.scrollY&&Ms.scrollBy(0,p):h>Ms.scrollY&&Ms.scrollBy(0,-p):r&&Ms.scrollBy(0,g)))}const m=this.#ut,f=r?a-(c?p:0):o.offsetHeight,v=t?.getBoundingClientRect?.(),b=(v?.height>0?v.height:i.offsetHeight)||0,y=e?.behavior,C=c?0:p;if(r)if(l){const e=this.getRects(t,"end").rects,s=e.top+b-C,i=f-m-(e.top+b);if(s>=0&&i>=0)return;const n=h-(s<0?-(s-m):i);Ms.scrollTo({top:n<h?n-C:n,behavior:y})}else{const t=f+h-(v?.height>0?v.top+h:this.#J.offset.getGlobal(i).top)-b;if(t-m>0&&f>t+m+C)return;const e=t<=m?h-t+m+g:h-t+(f-b-m);Ms.scrollTo({top:e<h?e-C:e,behavior:y})}else{const t=v?.height>0?v.top:i.getBoundingClientRect().top,e=l?t:t-o.getBoundingClientRect().top,s=e>=(c?0:u)&&e+m<=f;let r=h+(c?e-m>0?e+m-f+u:e-b:e-m>0?e+m-f:e-(u+b));const p=Ms.scrollY,C=this.#J.offset.getGlobal(),w=c?0:d,_=c?d:0,x=p-C.top+w,$=C.top+C.height-(p+a)+_;if(x>0){const t=(s?e:e+h-r)-b-m-x;t<0&&(r+=w,Ms.scrollTo({top:p+t,behavior:"smooth"}))}if($>0){const t=(s?e:e+h-r)+b+m-(C.height-$);t>0&&(r+=c?_:g,Ms.scrollTo({top:p+t,behavior:"smooth"}))}s||(l?n:o).scrollTo({top:r,behavior:y})}}#vt(t,e){let{top:s,bottom:i}=t;const n=[...this.#F._eventOrchestrator.scrollparents||[],Ms];for(const t of n){const n=t===Ms,o=n?0:t.getBoundingClientRect().top,l=n?this.#t.get("currentViewportHeight"):t.getBoundingClientRect().bottom;let r=0;s<o?r=s-o:i>l&&(r=i-l),0!==r&&(t.scrollBy({top:r,behavior:e}),s-=r,i-=r)}}resetRangeToTextNode(){let t=this.getRange();if(this.#ft(t)){if(!Ie.check.isWysiwygFrame(t.startContainer)||!Ie.check.isWysiwygFrame(t.endContainer))return!1;const e=t.commonAncestorContainer,s=e.children[t.startOffset],i=e.children[t.endOffset];if(!(t=this.setRange(s,0,i,s===i?0:1)))return!1}const e=t,s=e.collapsed;let i,n,o,l=e.startContainer,r=e.startOffset,a=e.endContainer,h=e.endOffset;if(this.#J.format.isLine(l))for(l.childNodes[r]?(l=l.childNodes[r]||l,r=0):(l=l.lastChild||l,r=l.textContent.length);1===l?.nodeType&&l.firstChild;)l=l.firstChild||l,r=0;if(this.#J.format.isLine(a)){for(a=a.childNodes[h]||a.lastChild||a;1===a?.nodeType&&a.lastChild;)a=a.lastChild;s?h=0:h>0&&(h=a.textContent.length)}if(i=Ie.check.isWysiwygFrame(l)?this.#Y.get("wysiwyg").firstChild:l,n=r,Ie.check.isBreak(i)||1===i.nodeType&&i.childNodes.length>0){const t=Ie.check.isBreak(i);if(!t){const t=i;for(;i&&!Ie.check.isBreak(i)&&1===i.nodeType&&(o=i.childNodes,0!==o.length);)i=o[n>0?n-1:n]||!/FIGURE/i.test(o[0].nodeName)?o[0]:i.previousElementSibling||i.previousSibling||l,n=n>0?i.textContent.length:n;let e=this.#J.format.getLine(i,null);e===this.#J.format.getBlock(e,null)&&(i||=t,e=Ie.utils.createElement(Ie.query.getParentElement(i,Ie.check.isTableCell)?"DIV":this.#ot.get("defaultLine")),i.parentNode.insertBefore(e,i),i!==t&&e.appendChild(i))}if(Ie.check.isBreak(i)||this.#J.component.is(i)){const e=Ie.utils.createTextNode(Ae.zeroWidthSpace);i.parentNode.insertBefore(e,i),i=e,t&&l===a&&(a=i,h=1)}}if(l=i,r=n,i=Ie.check.isWysiwygFrame(a)?this.#Y.get("wysiwyg").lastChild:a,n=h,Ie.check.isBreak(i)||1===i.nodeType&&i.childNodes.length>0){const t=Ie.check.isBreak(i);if(!t){for(;i&&!Ie.check.isBreak(i)&&1===i.nodeType&&(o=i.childNodes,0!==o.length);)i=o[n>0?n-1:n]||!/FIGURE/i.test(o[0].nodeName)?o[0]:i.previousElementSibling||i.previousSibling||l,n=n>0?i.textContent.length:n;let t=this.#J.format.getLine(i,null);t===this.#J.format.getBlock(t,null)&&(t=Ie.utils.createElement(Ie.check.isTableCell(t)?"DIV":this.#ot.get("defaultLine")),i.parentNode.insertBefore(t,i),t.appendChild(i))}if(Ie.check.isBreak(i)){const e=Ie.utils.createTextNode(Ae.zeroWidthSpace);i.parentNode.insertBefore(e,i),i=e,n=1,t&&!i.previousSibling&&Ie.utils.removeItem(a)}}return a=i,h=n,this.setRange(l,r,a,h),!0}init(){const t=this.#Y.get("_wd").activeElement;if(Ie.check.isInputElement(t))return this.selectionNode=t,t;const e=this.get();if(!e)return null;let s=null;s=e.rangeCount>0?e.getRangeAt(0):this.#gt(),this.#mt(s,e)}#mt(t,e){let s=null;this.#t.set("_range",t),s=t.collapsed?Ie.check.isWysiwygFrame(t.commonAncestorContainer)&&t.commonAncestorContainer.children[t.startOffset]||t.commonAncestorContainer:e.anchorNode,this.selectionNode=s}#ft(t){const e=t.commonAncestorContainer;return Ie.check.isWysiwygFrame(t.startContainer)&&Ie.check.isWysiwygFrame(t.endContainer)||/FIGURE/i.test(e.nodeName)||this.#J.pluginManager.fileInfo.regExp.test(e.nodeName)&&(!this.#J.pluginManager.fileInfo.tagAttrs[e.nodeName]||this.#J.pluginManager.fileInfo.tagAttrs[e.nodeName]?.every((t=>e.hasAttribute(t))))||this.#J.component.is(e)}#gt(){const t=this.#Y.get("wysiwyg"),e=this.#Y.get("_wd").createRange();let s=t.firstElementChild,i=null;return s?(i=s.firstChild,i||(i=Ie.utils.createElement("BR"),s.appendChild(i))):(i=Ie.utils.createElement("BR"),s=Ie.utils.createElement(this.#ot.get("defaultLine"),null,i),t.appendChild(s)),e.setStart(i,0),e.setEnd(i,0),e}__focus(){try{this.__iframeFocus=!0;const t=Ie.query.getParentElement(this.getNode(),"figcaption");t?t.focus():this.#Y.get("wysiwyg").focus()}finally{Ms.setTimeout((()=>this.__iframeFocus=!1),0)}}__init(){this.#pt=this.#F._eventOrchestrator.scrollparents?.length>0,this.#ut=this.#Y?.get("wysiwyg")?(Ve.get(Ms.getComputedStyle(this.#Y.get("wysiwyg")).scrollMargin,0)||40)+Ve.get(Ms.getComputedStyle(this.#Y.get("wrapper")).paddingBottom,0):40}};function Ls(t,e,s){const i=[];for(let n,o,l=0,r=t.length;l<r;l++)n=t[l],Ie.check.isListCell(n)?(e<0||n.previousElementSibling)&&i.push(n):(o=/\d+/.test(n.style[s])?Ve.get(n.style[s],0):0,o+=e,Ie.utils.setStyle(n,s,o<=0?"":o+"px"));return i}const Ns=class{#J;#t;#ot;#Y;#bt;#yt;#Ct;#wt;#_t;#xt;#$t=null;constructor(t){this.#J=t.$,this.#t=t.store,this.#ot=this.#J.options,this.#Y=this.#J.frameContext,this.#bt=this.#ot.get("formatLine").reg,this.#yt=this.#ot.get("formatBrLine").reg,this.#Ct=this.#ot.get("formatBlock").reg,this.#wt=this.#ot.get("formatClosureBlock").reg,this.#_t=this.#ot.get("formatClosureBrLine").reg,this.#xt=new RegExp("^("+this.#ot.get("textStyleTags")+")$","i"),this.__resetBrLineBreak(this.#ot.get("defaultLineBreakFormat"))}setLine(t){if(!this.isLine(t))throw new Error('[SUNEDITOR.format.setLine.fail] The "element" must satisfy "format.isLine()".');const e=this.#kt(),s=e.lines,i=t.className,n=t.nodeName;let o=e.firstNode,l=e.lastNode;for(let e,r,a=0,h=s.length;a<h;a++)e=s[a],e.nodeName===n&&(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim()===i||this.#J.component.is(e)||(r=t.cloneNode(!1),Ie.utils.copyFormatAttributes(r,e),r.innerHTML=e.innerHTML,e.parentNode.replaceChild(r,e)),0===a&&(o=r||e),a===h-1&&(l=r||e),r=null;this.#J.selection.setRange(Ie.query.getNodeFromPath(e.firstPath,o),e.startOffset,Ie.query.getNodeFromPath(e.lastPath,l),e.endOffset),this.#J.history.push(!1),this.#Y.has("documentType_use_header")&&this.#Y.get("documentType").reHeader()}getLine(t,e){if(!t)return null;for(e||=()=>!0;t;){if(Ie.check.isWysiwygFrame(t))return null;if(this.isBlock(t)){if(this.isLine(t.firstElementChild))return t.firstElementChild;if(this.isLine(t))return t}if(this.isLine(t)&&e(t))return t;t=t.parentNode}return null}setBrLine(t){if(!this.isBrLine(t))throw new Error('[SUNEDITOR.format.setBrLine.fail] The "element" must satisfy "format.isBrLine()".');const e=this.#kt().lines,s=e.length-1;let i=e[s].parentNode,n=t.cloneNode(!1);const o=n;for(let o,l,r,a,h,c,d=s,u=!0;d>=0;d--)if(o=e[d],o!==(e[d+1]?e[d+1].parentNode:null)){if(c=this.#J.component.is(o),l=c?"":o.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),r=Ie.query.getParentElement(o,(t=>t.parentNode===i)),(i!==o.parentNode||c)&&(this.isLine(i)?(i.parentNode.insertBefore(n,i.nextSibling),i=i.parentNode):(i.insertBefore(n,r?r.nextSibling:null),i=o.parentNode),a=n.nextSibling,a&&n.nodeName===a.nodeName&&Ie.check.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,Ie.utils.removeItem(a)),n=t.cloneNode(!1),u=!0),h=n.innerHTML,n.innerHTML=(u||!l||!h||/<br>$/i.test(l)?l:l+"<BR>")+h,0===d){i.insertBefore(n,o),a=o.nextSibling,a&&n.nodeName===a.nodeName&&Ie.check.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,Ie.utils.removeItem(a));const t=n.previousSibling;t&&n.nodeName===t.nodeName&&Ie.check.isSameAttributes(n,t)&&(t.innerHTML+="<BR>"+n.innerHTML,Ie.utils.removeItem(n))}c||Ie.utils.removeItem(o),l&&(u=!1)}this.#J.selection.setRange(o,0,o,0),this.#J.history.push(!1)}getBrLine(t,e){if(!t)return null;for(e||=()=>!0;t;){if(Ie.check.isWysiwygFrame(t))return null;if(this.isBrLine(t)&&e(t))return t;t=t.parentNode}return null}addLine(t,e){if(!t||!t.parentNode)return null;const s=this.getLine(this.#J.selection.getNode(),null);let i=null;if(this.isBrLine(t)||!this.isBrLine(s||t.parentNode)||this.#J.component.is(t)){const t=e?"string"==typeof e?e:e.nodeName:this.isNormalLine(s)?s.nodeName:this.#ot.get("defaultLine");i=Ie.utils.createElement(t,null,"<br>"),(e&&"string"!=typeof e||!e&&this.isLine(s))&&Ie.utils.copyTagAttributes(i,e||s,["id"])}else i=Ie.utils.createElement("BR");return Ie.check.isTableCell(t)?t.insertBefore(i,t.nextElementSibling):t.parentNode.insertBefore(i,t.nextElementSibling),i}addLineAfter(t){if(!t||!t.parentNode)return null;const e=t.nodeName,s=this.#ot.get("lineAttrReset");let i;return/^H[1-6]$|^HR$/i.test(e)||this.isBrLine(t)?i=Ie.utils.createElement(this.#ot.get("defaultLine"),null,"<br>"):(i=Ie.utils.createElement(e,null,"<br>"),Ie.utils.copyTagAttributes(i,t,s)),Ie.check.isTableCell(t)?t.insertBefore(i,t.nextElementSibling):t.parentNode.insertBefore(i,t.nextElementSibling),i}getBlock(t,e){if(!t)return null;for(e||=()=>!0;t;){if(Ie.check.isWysiwygFrame(t))return null;if(this.isBlock(t)&&!/^(THEAD|TBODY|TR)$/i.test(t.nodeName)&&e(t))return t;t=t.parentNode}return null}applyBlock(t){this.#J.selection.getRangeAndAddLine(this.#J.selection.getRange(),null);const e=this.getLinesAndComponents(!1);if(!e||0===e.length)return;t:for(let t,s,i,n,o,l,r=0,a=e.length;r<a;r++)if(t=e[r],Ie.check.isListCell(t))if(s=t.lastElementChild,s&&Ie.check.isListCell(t.nextElementSibling)&&e.includes(t.nextElementSibling)&&(n=s.lastElementChild,e.includes(n))){let t=null;for(;t=n.lastElementChild;)if(Ie.check.isList(t)){if(!e.includes(t.lastElementChild))continue t;n=t.lastElementChild}i=s.firstElementChild,o=e.indexOf(i),l=e.indexOf(n),e.splice(o,l-o+1),a=e.length}else;const s=e.at(-1);let i,n,o;i=this.isBlock(s)||this.isLine(s)?s:this.getBlock(s,null)||this.getLine(s,null),Ie.check.isTableCell(i)?(n=null,o=i):(n=i.nextSibling,o=i.parentNode);const l=t.cloneNode(!1);let r=Ie.query.getNodeDepth(i),a=null;const h=[],c=(t,e,s)=>{let i=null;if(t!==e&&!Ie.check.isTableElements(e)){if(e&&Ie.query.getNodeDepth(t)===Ie.query.getNodeDepth(e))return s;i=this.#J.nodeTransform.removeAllParents(e,null,t)}return i?i.ec:s};for(let t,s,i,d,u,p,g,m=0,f=e.length;m<f;m++)if(t=e[m],s=t.parentNode,s&&!l.contains(s))if(i=Ie.query.getNodeDepth(t),Ie.check.isList(s)){if(null===a&&(p?(a=p,g=!0,p=null):a=s.cloneNode(!1)),h.push(t),u=e[m+1],m===f-1||u?.parentNode!==s){t.contains(u?.parentNode)&&(p=u.parentNode.cloneNode(!1));let e,m=s.parentNode;for(;Ie.check.isList(m);)e=Ie.utils.createElement(m.nodeName),e.appendChild(a),a=e,m=m.parentNode;const f=this.removeBlock(s,{selectedFormats:h,newBlockElement:null,shouldDelete:!0,skipHistory:!0});r>=i?(r=i,o=f.cc,n=c(o,s,f.ec),n&&(o=n.parentNode)):o===f.cc&&(n=f.ec),o!==f.cc&&(d=c(o,f.cc,d),n=void 0!==d?d:f.cc);for(let t=0,e=f.removeArray.length;t<e;t++)a.appendChild(f.removeArray[t]);g||l.appendChild(a),p&&f.removeArray.at(-1).appendChild(p),a=null,g=!1}}else r>=i&&(r=i,o=s,n=t.nextSibling),l.appendChild(t),o!==s&&(d=c(o,s),void 0!==d&&(n=d));if(this.#t.set("_lastSelectionNode",null),this.#J.nodeTransform.mergeSameTags(l,null,!1),this.#J.nodeTransform.mergeNestedTags(l,(t=>Ie.check.isList(t))),n&&Ie.query.getNodeDepth(n)>0&&(Ie.check.isList(n.parentNode)||Ie.check.isList(n.parentNode.parentNode))){const t=Ie.query.getParentElement(n,(t=>this.isBlock(t)&&!Ie.check.isList(t))),e=this.#J.nodeTransform.split(n,null,t?Ie.query.getNodeDepth(t)+1:0);e.parentNode.insertBefore(l,e)}else o.insertBefore(l,n),c(l,n);const d=Ie.query.getEdgeChildNodes(l.firstElementChild,l.lastElementChild);e.length>1?this.#J.selection.setRange(d.sc,0,d.ec,d.ec.textContent.length):this.#J.selection.setRange(d.ec,d.ec.textContent.length,d.ec,d.ec.textContent.length),this.#J.history.push(!1)}removeBlock(t,{selectedFormats:e,newBlockElement:s,shouldDelete:i,skipHistory:n}={}){const o=this.#J.selection.getRange();let l=o.startOffset,r=o.endOffset,a=Ie.query.getListChildNodes(t,null,1),h=t.parentNode,c=null,d=null,u=t.cloneNode(!1);const p=[],g=Ie.check.isList(s);let m=!1,f=!1,v=!1;const b=(e,s,i,n)=>{if(1===s.childNodes.length&&Ie.check.isZeroWidth(s)&&(s.innerHTML=Ae.zeroWidthSpace,l=r=1),3===s.nodeType)return e.insertBefore(s,i),s;const o=(v?s:n).childNodes;let a=s.cloneNode(!1),h=null,c=null;for(;o[0];)c=o[0],!this._isNotTextNode(c)||Ie.check.isBreak(c)||Ie.check.isListCell(a)?a.appendChild(c):(a.childNodes.length>0&&(h||=a,e.insertBefore(a,i),a=s.cloneNode(!1)),e.insertBefore(c,i),h||=c);if(a.childNodes.length>0){if(Ie.check.isListCell(e)&&Ie.check.isListCell(a)&&Ie.check.isList(i))if(g){for(h=i;i;)a.appendChild(i),i=i.nextSibling;e.parentNode.insertBefore(a,e.nextElementSibling)}else{const e=n.nextElementSibling,s=this.#J.listFormat.removeNested(n,!1);if(t!==s||e!==n.nextElementSibling){const e=a.childNodes;for(;e[0];)n.appendChild(e[0]);t=s,f=!0}}else e.insertBefore(a,i);h||=a}return h};for(let n,o,l,r=0,y=a.length;r<y;r++)if(n=a[r],3!==n.nodeType||!Ie.check.isList(u))if(v=!1,i&&0===r&&(c=e&&e.length!==y&&e[0]!==n?u:t.previousSibling),e&&(o=e.indexOf(n)),e&&-1===o)u||=t.cloneNode(!1),u.appendChild(n);else{if(e&&(l=e[o+1]),u&&u.children.length>0&&(h.insertBefore(u,t),u=null),!g&&Ie.check.isListCell(n))if(l&&Ie.query.getNodeDepth(n)!==Ie.query.getNodeDepth(l)&&(Ie.check.isListCell(h)||Ie.utils.arrayFind(n.children,Ie.check.isList))){const e=n.nextElementSibling,s=this.#J.listFormat.removeNested(n,!1);t===s&&e===n.nextElementSibling||(t=s,f=!0)}else{const e=n;n=Ie.utils.createElement(i?e.nodeName:Ie.check.isList(t.parentNode)||Ie.check.isListCell(t.parentNode)?"LI":Ie.check.isTableCell(t.parentNode)?"DIV":this.#ot.get("defaultLine"));const s=Ie.check.isListCell(n),o=e.childNodes;for(;o[0]&&(!Ie.check.isList(o[0])||s);)n.appendChild(o[0]);Ie.utils.copyFormatAttributes(n,e),v=!0}else n=n.cloneNode(!1);if(!f&&(i?(p.push(n),Ie.utils.removeItem(a[r])):(s?(m||(h.insertBefore(s,t),m=!0),n=b(s,n,null,a[r])):n=b(h,n,t,a[r]),f||(e?(d=n,c||=n):c||(c=d=n))),f)){f=v=!1,a=Ie.query.getListChildNodes(t,null,1),u=t.cloneNode(!1),h=t.parentNode,r=-1,y=a.length;continue}}const y=t.parentNode;let C=t.nextSibling;u?.children.length>0&&y.insertBefore(u,C),s?c=s.previousSibling:c||=t.previousSibling,C=t.nextSibling!==u?t.nextSibling:u?u.nextSibling:null,0===t.children.length||0===t.textContent.length?Ie.utils.removeItem(t):this.#J.nodeTransform.removeEmptyNode(t,null,!1);let w=null;if(this.#t.set("_lastSelectionNode",null),i)w={cc:y,sc:c,so:l,ec:C,eo:r,removeArray:p};else{c||=d,d||=c;const t=Ie.query.getEdgeChildNodes(c,d?.parentNode?c:d);t?w={cc:(t.sc||t.ec).parentNode,sc:t.sc,so:l,ec:t.ec,eo:r,removeArray:null}:this.#J.focusManager.focus()}if(n)return w;!i&&w&&(e?this.#J.selection.setRange(w.sc,l,w.ec,r):this.#J.selection.setRange(w.sc,0,w.sc,0)),this.#J.history.push(!1)}indent(){const t=this.#J.selection.getRange(),e=t.startContainer,s=t.endContainer,i=t.startOffset,n=t.endOffset,o=Ls(this.getLines(null),this.#t.get("indentSize"),this.#ot.get("_rtl")?"marginRight":"marginLeft");o.length>0&&this.#J.listFormat.applyNested(o,!1),this.#t.set("_lastSelectionNode",null),this.#J.selection.setRange(e,i,s,n),this.#J.history.push(!1)}outdent(){const t=this.#J.selection.getRange(),e=t.startContainer,s=t.endContainer,i=t.startOffset,n=t.endOffset,o=Ls(this.getLines(null),-1*this.#t.get("indentSize"),this.#ot.get("_rtl")?"marginRight":"marginLeft");o.length>0&&this.#J.listFormat.applyNested(o,!0),this.#t.set("_lastSelectionNode",null),this.#J.selection.setRange(e,i,s,n),this.#J.history.push(!1)}isEdgeLine(t,e,s){if("front"===s){if(e>0)return!1}else if(t?.textContent?.length>e)return!1;let i=!1;const n="front"===s?"previousSibling":"nextSibling";for(;t&&!this.isLine(t)&&!Ie.check.isWysiwygFrame(t);){if(t[n]&&(!Ie.check.isBreak(t[n])||t[n][n]))return!1;i=!0,t=t.parentNode}return i}isTextStyleNode(t){return"string"==typeof t?this.#xt.test(t):1===t?.nodeType&&this.#xt.test(t.nodeName)}isLine(t){return"string"==typeof t?this.#bt.test(t):1===t?.nodeType&&(this.#bt.test(t.nodeName)||Ie.utils.hasClass(t,"__se__format__line_.+|__se__format__br_line_.+"))&&!this.#St(t)}isNormalLine(t){return this.isLine(t)&&(this.#$t||!this.isBrLine(t))&&!this.isBlock(t)}isBrLine(t){return this.#$t&&this.isLine(t)||("string"==typeof t?this.#yt.test(t):1===t?.nodeType&&(this.#yt.test(t.nodeName)||Ie.utils.hasClass(t,"__se__format__br_line_.+"))&&!this.#St(t))}isBlock(t){return"string"==typeof t?this.#Ct.test(t):1===t?.nodeType&&(this.#Ct.test(t.nodeName)||Ie.utils.hasClass(t,"__se__format__block_.+"))&&!this.#St(t)}isClosureBlock(t){return"string"==typeof t?this.#wt.test(t):1===t?.nodeType&&(this.#wt.test(t.nodeName)||Ie.utils.hasClass(t,"__se__format__block_closure_.+"))&&!this.#St(t)}isClosureBrLine(t){return"string"==typeof t?this.#_t.test(t):1===t?.nodeType&&(this.#_t.test(t.nodeName)||Ie.utils.hasClass(t,"__se__format__br_line__closure_.+"))&&!this.#St(t)}getLines(t){if(!this.#J.selection.resetRangeToTextNode())return[];let e=this.#J.selection.getRange();if(Ie.check.isWysiwygFrame(e.startContainer)){const t=this.#Y.get("wysiwyg").children,s=t.length;if(0===s)return[];this.#J.selection.setRange(t[0],0,t[s-1],t[s-1].textContent.trim().length),e=this.#J.selection.getRange()}const s=e.startContainer,i=e.endContainer,n=e.commonAncestorContainer;t||=this.isLine.bind(this);const o=Ie.query.getListChildren(n,(e=>t(e)),null);if(3!==n.nodeType&&(Ie.check.isWysiwygFrame(n)||this.isBlock(n))||o.unshift(this.getLine(n,null)),s===i||1===o.length)return o;const l=this.getLine(s,null),r=this.getLine(i,null);let a=null,h=null;const c=function(t){return!Ie.check.isTableElements(t)||/^TABLE$/i.test(t.nodeName)};let d=this.getBlock(l,c),u=this.getBlock(r,c);Ie.check.isTableElements(d)&&Ie.check.isListCell(d.parentNode)&&(d=d.parentNode),Ie.check.isTableElements(u)&&Ie.check.isListCell(u.parentNode)&&(u=u.parentNode);const p=d===u;for(let t,e=0,s=o.length;e<s;e++)if(t=o[e],l===t||!p&&t===d)a=e;else if(r===t||!p&&t===u){h=e;break}return null===a&&(a=0),null===h&&(h=o.length-1),o.slice(a,h+1)}getLinesAndComponents(t){const e=this.#J.selection.getRange().commonAncestorContainer,s=Ie.query.getParentElement(e,this.#J.component.is.bind(this.#J.component)),i=Ie.check.isTableElements(e)?this.getLines(null):this.getLines((t=>{const e=Ie.query.getParentElement(t,this.#J.component.is.bind(this.#J.component));return this.isLine(t)&&(!e||e===s)||Ie.check.isComponentContainer(t)&&!this.getLine(t)}));if(t)for(let t=0,e=i.length;t<e;t++)for(let s=t-1;s>=0;s--)if(i[s].contains(i[t])){i.splice(t,1),t--,e--;break}return i}_isNotTextNode(t){if(!t)return!1;const e=/^(br|input|select|canvas|img|iframe|audio|video)$/i;return"string"==typeof t?e.test(t):1===t.nodeType&&(this.#J.component.is(t)||e.test(t.nodeName))}_isExcludeSelectionElement(t){return!/FIGCAPTION/i.test(t.nodeName)&&(this.#J.component.is(t)||/FIGURE/i.test(t.nodeName))}#St(t){return Ie.check.isExcludeFormat(t)||this.#J.component.is(t)||Ie.check.isWysiwygFrame(t)}#kt(){let t=this.#J.selection.getRange(),e=this.getLinesAndComponents(!1);if(0===e.length&&(t=this.#J.selection.getRangeAndAddLine(t,null),e=this.getLinesAndComponents(!1),0===e.length))return;const s=t.startOffset,i=t.endOffset;let n=e[0],o=e.at(-1);const l=Ie.query.getNodePath(t.startContainer,n,null),r=Ie.query.getNodePath(t.endContainer,o,null),a=this.#J.listFormat.remove(e,!1);return a.sc&&(n=a.sc),a.ec&&(o=a.ec),this.#J.selection.setRange(Ie.query.getNodeFromPath(l,n),s,Ie.query.getNodeFromPath(r,o),i),{lines:this.getLinesAndComponents(!1),firstNode:n,lastNode:o,firstPath:l,lastPath:r,startOffset:s,endOffset:i}}__resetBrLineBreak(t){return this.#$t="br"===t}};function As(t){const e=t.parentNode;if(!t||3===t.nodeType||!e)return;const s=t.childNodes;for(;s[0];)e.insertBefore(s[0],t);e.removeChild(t)}const Bs=class{#J;#ot;#Et;#Tt;constructor(t){this.#J=t.$,this.#ot=this.#J.options,this.#Et=this.#ot.get("__listCommonStyle"),this.#Tt=Be.camelToKebabCase(this.#ot.get("__listCommonStyle"))}apply(t,{stylesToModify:e,nodesToRemove:s,strictRemove:i}={}){if(Ie.query.getParentElement(this.#J.selection.getNode(),Ie.check.isNonEditable))return;this.#J.selection.resetRangeToTextNode();let n=this.#J.selection.getRangeAndAddLine(this.#J.selection.getRange(),null);e=e?.length>0?e:null,s=s?.length>0?s:null;const o=!t,l=o&&!s&&!e;let r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset;if(l&&n.collapsed&&this.#J.format.isLine(r.parentNode)&&this.#J.format.isLine(h.parentNode)||r===h&&1===r.nodeType&&Ie.check.isNonEditable(r)){const t=r.parentNode;if(!Ie.check.isListCell(t)||!Be.getValues(t.style).some((t=>this.#Tt.includes(t))))return}if(n.collapsed&&!l&&1===r.nodeType&&!Ie.check.isBreak(r)&&!this.#J.component.is(r)){let t=null;const e=r.childNodes[a];e&&(t=e.nextSibling?Ie.check.isBreak(e)?e:e.nextSibling:null);const s=Ie.utils.createTextNode(Ae.zeroWidthSpace);r.insertBefore(s,t),this.#J.selection.setRange(s,1,s,1),n=this.#J.selection.getRange(),r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset}this.#J.format.isLine(r)&&(r=r.childNodes[a]||r.firstChild,a=0),this.#J.format.isLine(h)&&(h=h.childNodes[c]||h.lastChild,c=h.textContent.length),o&&(t=Ie.utils.createElement("DIV"));const d=RegExp,u=t.nodeName;if(!l&&r===h&&!s&&t){let e=r,s=0;const i=[],n=t.style;for(let t=0,e=n.length;t<e;t++)i.push(n[t]);const l=t.className,a=t.classList;for(let t=0,e=a.length;t<e;t++)i.push("."+a[t]);if(i.length>0){for(;!this.#J.format.isLine(e)&&!Ie.check.isWysiwygFrame(e);){for(let t=0;t<i.length;t++)if(1===e.nodeType){const r=i[t],a=!!/^\./.test(r)&&new d("\\s*"+r.replace(/^\./,"")+"(\\s+|$)","ig"),h=e.style,c=e.className,u=o?!!h[r]:!!h[r]&&!!n[r]&&h[r]===n[r],p=!1!==a&&(o?!!c.match(a):!!c.match(a)&&!!l.match(a));(u||p)&&s++}e=e.parentNode}if(s>=i.length)return}}let p,g,m={},f={},v="",b="";if(e){for(let t,s=0,i=e.length;s<i;s++)t=e[s],/^\./.test(t)?b+=(b?"|":"\\s*(?:")+t.replace(/^\./,""):v+=(v?"|":"(?:;|^|\\s)(?:")+t;v&&(v+=")\\s*:[^;]*\\s*(?:;|$)",v=new d(v,"ig")),b&&(b+=")(?=\\s+|$)",b=new d(b,"ig"))}if(s){g="^(?:"+s[0];for(let t=1;t<s.length;t++)g+="|"+s[t];g+=")$",g=new d(g,"i")}const y={v:!1},C=function(t){const e=t.cloneNode(!1);if(3===e.nodeType||Ie.check.isBreak(e))return e;if(l)return null;const s=!g&&o||g?.test(e.nodeName);if(s&&!i)return y.v=!0,null;const n=e.style.cssText;let r="";v&&n.length>0&&(r=n.replace(v,"").trim(),r!==n&&(y.v=!0));const a=e.className;let h="";return b&&a.length>0&&(h=a.replace(b,"").trim(),h!==a&&(y.v=!0)),(!o||!b&&a||!v&&n||r||h||!s)&&(r||h||e.nodeName!==u||Boolean(v)!==Boolean(n)||Boolean(b)!==Boolean(a))?(v&&n.length>0&&(e.style.cssText=r),e.style.cssText||e.removeAttribute("style"),b&&a.length>0&&(e.className=h.trim()),e.className.trim()||e.removeAttribute("class"),e.style.cssText||e.className||e.nodeName!==u&&!s?e:(y.v=!0,null)):(y.v=!0,null)},w=this.#J.format.getLines(null);if(0===w.length)return void console.warn("[SUNEDITOR.inline.apply.warn] There is no line to apply.");n=this.#J.selection.getRange(),r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset,this.#J.format.getLine(r,null)||(r=Ie.query.getEdgeChild(w[0],(function(t){return 3===t.nodeType}),!1),a=0),this.#J.format.getLine(h,null)||(h=Ie.query.getEdgeChild(w.at(-1),(function(t){return 3===t.nodeType}),!1),c=h.textContent.length);const _=this.#J.format.getLine(r,null)===this.#J.format.getLine(h,null),x=w.length-(_?0:1);p=t.cloneNode(!1);const $=l||o&&(t=>{for(let e=0,s=t?.length;e<s;e++)if(this._isNonSplitNode(t[e]))return!0;return!1})(s),k=o||this.#Mt(p),S=this.#Ht.bind(this,$,k),E=this.#Lt.bind(this,$,k);if(_){this.#Nt(w[0],e)&&(n=this.#J.selection.setRange(r,a,h,c));const t=this.#At(w[0],p,C,r,a,h,c,l,o,n.collapsed,y,S,E);m.container=t.startContainer,m.offset=t.startOffset,f.container=t.endContainer,f.offset=t.endOffset,m.container===f.container&&Ie.check.isZeroWidth(m.container)&&(m.offset=f.offset=1),this.#Bt(t.ancestor,null)}else{let s=!1;x>0&&this.#Nt(w[x],e)&&(s=!0),this.#Nt(w[0],e)&&(s=!0),s&&this.#J.selection.setRange(r,a,h,c),x>0&&(p=t.cloneNode(!1),f=this.#It(w[x],p,C,h,c,l,o,y,S,E));for(let s,i=x-1;i>0;i--)this.#Nt(w[i],e),p=t.cloneNode(!1),s=this.#Vt(w[i],p,C,l,o,y,f.container),s.endContainer&&s.ancestor.contains(s.endContainer)&&(f.ancestor=null,f.container=s.endContainer),this.#Bt(s.ancestor,null);p=t.cloneNode(!1),m=this.#Ot(w[0],p,C,r,a,l,o,y,S,E,f.container),m.endContainer&&(f.ancestor=null,f.container=m.endContainer),x<=0?f=m:f.container||(f.ancestor=null,f.container=m.container,f.offset=m.container.textContent.length),this.#Bt(m.ancestor,null),this.#Bt(f.ancestor||this.#J.format.getLine(f.container),null)}return this.#J.ui.offCurrentController(),this.#J.selection.setRange(m.container,m.offset,f.container,f.offset),this.#J.history.push(!1),p}remove(){this.apply(null,{stylesToModify:null,nodesToRemove:null,strictRemove:null})}_isNonSplitNode(t){if(!t)return!1;const e=/^(a|label|code|summary)$/i;return"string"==typeof t?e.test(t):1===t.nodeType&&e.test(t.nodeName)}_isIgnoreNodeChange(t){return t&&1===t.nodeType&&(Ie.check.isNonEditable(t)||!this.#J.format.isTextStyleNode(t)||this.#J.component.is(t))}#At(t,e,s,i,n,o,l,r,a,h,c,d,u){let p=i.parentNode;for(;!(p.nextSibling||p.previousSibling||this.#J.format.isLine(p.parentNode)||Ie.check.isWysiwygFrame(p.parentNode))&&p.nodeName!==e.nodeName;)p=p.parentNode;if(!a&&!r&&p===o.parentNode&&p.nodeName===e.nodeName&&Ie.check.isZeroWidth(i.textContent.slice(0,n))&&Ie.check.isZeroWidth(o.textContent.slice(l))){const s=p.childNodes;let r=!0;for(let t,e,n,l,a=0,h=s.length;a<h;a++)if(t=s[a],l=!Ie.check.isZeroWidth(t),t!==i&&t!==o){if(!e&&l||e&&n&&l){r=!1;break}}else t===i&&(e=!0),t===o&&(n=!0);if(r)return Ie.utils.copyTagAttributes(p,e),{ancestor:t,startContainer:i,startOffset:n,endContainer:o,endOffset:l}}c.v=!1;const g=this,m=t,f=[e],v=t.cloneNode(!1),b=i===o;let y,C,w,_,x,$=i,k=n,S=o,E=l,T=!1,M=!1;const H=RegExp;function L(t){const e=new H("(?:;|^|\\s)(?:"+_+"null)\\s*:[^;]*\\s*(?:;|$)","ig");let s=!1;return e&&t.style.cssText.length>0&&(s=e.test(t.style.cssText)),!s}if(function t(i,n){const o=i.childNodes;for(let i,l=0,a=o.length;l<a;l++){const a=o[l];if(!a)continue;let c,p=n;if(!T&&a===$){let t=v;x=d(a);let o="",l="";if(3===$.nodeType){const t=$;o=t.substringData(0,k),l=t.substringData(k,b&&E>=k?E-k:t.data.length-k)}const r=Ie.utils.createTextNode(o),h=Ie.utils.createTextNode(l);if(x){const e=d(n);if(e.parentNode!==t){let s=e,i=null;for(;s.parentNode!==t;){for(n=i=s.parentNode.cloneNode(!1);s.childNodes[0];)i.appendChild(s.childNodes[0]);s.appendChild(i),s=s.parentNode}s.parentNode.appendChild(e)}x=x.cloneNode(!1)}Ie.check.isZeroWidth(r)||n.appendChild(r);const c=d(n);for(c&&(x=c),x&&(t=x),C=a,y=[],_="";C!==t&&C!==m&&null!==C;)i=u(C)?null:s(C),i&&1===C.nodeType&&L(C)&&(y.push(i),_+=C.style.cssText.substring(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentElement;const p=y.pop()||h;for(w=C=p;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(e.appendChild(p),t.appendChild(e),x&&!d(S)&&(e=e.cloneNode(!1),v.appendChild(e),f.push(e)),$=h,k=0,T=!0,C!==h&&C.appendChild($),!b)continue}if(M||a!==S){if(T){if(1===a.nodeType&&!Ie.check.isBreak(a)){g._isIgnoreNodeChange(a)?(v.appendChild(a.cloneNode(!0)),h||(e=e.cloneNode(!1),v.appendChild(e),f.push(e))):t(a,a);continue}C=a,y=[],_="";const o=[];for(;null!==C.parentNode&&C!==m&&C!==e;)i=M?C.cloneNode(!1):s(C),1===C.nodeType&&!Ie.check.isBreak(a)&&i&&L(C)&&(u(C)?x||o.push(i):y.push(i),_+=C.style.cssText.substring(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentElement;y=y.concat(o);const l=y.pop()||a;for(w=C=l;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(!u(e.parentNode)||u(l)||Ie.check.isZeroWidth(e)||(e=e.cloneNode(!1),v.appendChild(e),f.push(e)),M||x||!u(l))l===a?n=M?v:e:M?(v.appendChild(l),n=C):(e.appendChild(l),n=C);else{e=e.cloneNode(!1);const t=l.childNodes;for(let s=0,i=t.length;s<i;s++)e.appendChild(t[s]);l.appendChild(e),v.appendChild(l),f.push(e),n=e.children.length>0?C:e}if(x&&3===a.nodeType)if(d(a)){const t=Ie.query.getParentElement(n,(t=>g._isNonSplitNode(t.parentNode)||t.parentNode===v));x.appendChild(t),e=t.cloneNode(!1),f.push(e),v.appendChild(e)}else x=null}c=a.cloneNode(!1),n.appendChild(c),1!==a.nodeType||Ie.check.isBreak(a)||(p=c),t(a,p)}else{x=d(a);let t="",n="";if(3===S.nodeType){const e=S;t=e.substringData(E,e.length-E),n=b?"":e.substringData(0,E)}const o=Ie.utils.createTextNode(t),l=Ie.utils.createTextNode(n);if(x?x=x.cloneNode(!1):u(e.parentNode)&&!x&&(e=e.cloneNode(!1),v.appendChild(e),f.push(e)),!Ie.check.isZeroWidth(o)){C=a,_="",y=[];const t=[];for(;C!==v&&C!==m&&null!==C;)1===C.nodeType&&L(C)&&(u(C)?t.push(C.cloneNode(!1)):y.push(C.cloneNode(!1)),_+=C.style.cssText.substring(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentElement;for(y=y.concat(t),c=w=C=y.pop()||o;y.length>0;)C=y.pop(),w.appendChild(C),w=C;v.appendChild(c),C.textContent=o.data}if(x&&c){const t=d(c);t&&(x=t)}for(C=a,y=[],_="";C!==v&&C!==m&&null!==C;)i=u(C)?null:s(C),i&&1===C.nodeType&&L(C)&&(y.push(i),_+=C.style.cssText.substring(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentElement;const p=y.pop()||l;for(w=C=p;y.length>0;)C=y.pop(),w.appendChild(C),w=C;x?((e=e.cloneNode(!1)).appendChild(p),x.insertBefore(e,x.firstChild),v.appendChild(x),f.push(e),x=null):e.appendChild(p),S=l,E=l.data.length,M=!0,!r&&h&&(e=l,l.textContent=Ae.zeroWidthSpace),C!==l&&C.appendChild(S)}}}(t,v),a&&!r&&!c.v)return{ancestor:t,startContainer:i,startOffset:n,endContainer:o,endOffset:l};if(r&&=a,r)for(let t=0;t<f.length;t++){const e=f[t];let s,i,n;if(h)s=Ie.utils.createTextNode(Ae.zeroWidthSpace),v.replaceChild(s,e);else{const t=e.childNodes;for(i=t[0];t[0];)n=t[0],v.insertBefore(n,e);Ie.utils.removeItem(e)}0===t&&(h?$=S=s:($=i,S=n))}else{if(a)for(let t=0;t<f.length;t++)As(f[t]);h&&($=S=e)}this.#J.nodeTransform.removeEmptyNode(v,e,!1),h&&(k=$.textContent.length,E=S.textContent.length);const N=r||0===S.textContent.length;Ie.check.isBreak(S)||0!==S.textContent.length||(Ie.utils.removeItem(S),S=$),E=N?S.textContent.length:E;const A={s:0,e:0},B=Ie.query.getNodePath($,v,A),I=!S.parentNode;I&&(S=$);const V={s:0,e:0},O=Ie.query.getNodePath(S,v,I||N?null:V);k+=A.s,E=h?k:I?$.textContent.length:N?E+A.s:E+V.s;const R=this.#J.nodeTransform.mergeSameTags(v,[B,O],!0);return t.parentNode.replaceChild(v,t),$=Ie.query.getNodeFromPath(B,v),S=Ie.query.getNodeFromPath(O,v),{ancestor:v,startContainer:$,startOffset:k+R[0],endContainer:S,endOffset:E+R[1]}}#Ot(t,e,s,i,n,o,l,r,a,h,c){let d=i.parentNode;for(;!(d.nextSibling||d.previousSibling||this.#J.format.isLine(d.parentNode)||Ie.check.isWysiwygFrame(d.parentNode))&&d.nodeName!==e.nodeName;)d=d.parentNode;if(!l&&!o&&d.nodeName===e.nodeName&&!this.#J.format.isLine(d)&&!d.nextSibling&&Ie.check.isZeroWidth(i.textContent.slice(0,n))){let s=!0,o=i.previousSibling;for(;o;){if(!Ie.check.isZeroWidth(o)){s=!1;break}o=o.previousSibling}if(s)return Ie.utils.copyTagAttributes(d,e),{ancestor:t,container:i,offset:n}}r.v=!1;const u=this,p=t,g=[e],m=t.cloneNode(!1);let f,v,b,y,C=i,w=n,_=!1;if(function t(i,n){const o=i.childNodes;for(let i,l,r=0,d=o.length;r<d;r++){const d=o[r];if(!d)continue;let x=n;if(_&&!Ie.check.isBreak(d)){if(1===d.nodeType){if(u._isIgnoreNodeChange(d)){if(e=e.cloneNode(!1),l=d.cloneNode(!0),m.appendChild(l),m.appendChild(e),g.push(e),c&&d.contains(c)){const t=Ie.query.getNodePath(c,d);c=Ie.query.getNodeFromPath(t,l)}}else t(d,d);continue}v=d,f=[];const o=[];for(;null!==v.parentNode&&v!==p&&v!==e;)i=s(v),1===v.nodeType&&i&&(h(v)?y||o.push(i):f.push(i)),v=v.parentNode;f=f.concat(o);const r=f.length>0,C=f.pop()||d;for(b=v=C;f.length>0;)v=f.pop(),b.appendChild(v),b=v;if(h(e.parentNode)&&!h(C)&&(e=e.cloneNode(!1),m.appendChild(e),g.push(e)),!y&&h(C)){e=e.cloneNode(!1);const t=C.childNodes;for(let s=0,i=t.length;s<i;s++)e.appendChild(t[s]);C.appendChild(e),m.appendChild(C),n=h(v)?e:v,g.push(e)}else r?(e.appendChild(C),n=v):n=e;if(y&&3===d.nodeType)if(a(d)){const t=Ie.query.getParentElement(n,(t=>u._isNonSplitNode(t.parentNode)||t.parentNode===m));y.appendChild(t),e=t.cloneNode(!1),g.push(e),m.appendChild(e)}else y=null}if(_||d!==C)i=_?s(d):d.cloneNode(!1),i&&(n.appendChild(i),1!==d.nodeType||Ie.check.isBreak(d)||(x=i)),t(d,x);else{let t=m;y=a(d);let o="",l="";if(3===C.nodeType){const t=C;o=t.substringData(0,w),l=t.substringData(w,t.length-w)}const r=Ie.utils.createTextNode(o),h=Ie.utils.createTextNode(l);if(y){const e=a(n);if(e&&e.parentNode!==t){let s=e,i=null;for(;s.parentNode!==t;){for(n=i=s.parentNode.cloneNode(!1);s.childNodes[0];)i.appendChild(s.childNodes[0]);s.appendChild(i),s=s.parentNode}s.parentNode.appendChild(e)}y=y.cloneNode(!1)}Ie.check.isZeroWidth(r)||n.appendChild(r);const c=a(n);for(c&&(y=c),y&&(t=y),v=n,f=[];v!==t&&null!==v;)i=s(v),1===v.nodeType&&i&&f.push(i),v=v.parentNode;const u=f.pop()||n;for(b=v=u;f.length>0;)v=f.pop(),b.appendChild(v),b=v;u!==n?(e.appendChild(u),n=v):n=e,Ie.check.isBreak(d)&&e.appendChild(d.cloneNode(!1)),t.appendChild(e),C=h,w=0,_=!0,n.appendChild(C)}}}(t,m),l&&!o&&!r.v)return{ancestor:t,container:i,offset:n,endContainer:c};if(o&&=l,o)for(let t=0;t<g.length;t++){const e=g[t],s=e.childNodes,i=s[0];for(;s[0];)m.insertBefore(s[0],e);Ie.utils.removeItem(e),0===t&&(C=i)}else if(l){e=e.firstChild;for(let t=0;t<g.length;t++)As(g[t])}if(o||0!==m.childNodes.length){this.#J.nodeTransform.removeEmptyNode(m,e,!1),Ie.check.isZeroWidth(m.textContent)&&(C=m.firstChild,w=0);const s={s:0,e:0},i=Ie.query.getNodePath(C,m,s);w+=s.s;const n=this.#J.nodeTransform.mergeSameTags(m,[i],!0);t.parentNode.replaceChild(m,t),C=Ie.query.getNodeFromPath(i,m),w+=n[0]}else t.childNodes?C=t.childNodes[0]:(C=Ie.utils.createTextNode(Ae.zeroWidthSpace),t.appendChild(C));return{ancestor:m,container:C,offset:w,endContainer:c}}#Vt(t,e,s,i,n,o,l){if(!n){let s=null;l&&t.contains(l)&&(s=Ie.query.getNodePath(l,t));const i=t.cloneNode(!0),n=e.nodeName,o=e.style.cssText,r=e.className;let a=i.childNodes,h=0,c=a.length;for(let t;h<c&&(t=a[h],3!==t.nodeType);h++){if(t.nodeName!==n){if(!Ie.check.isBreak(t)&&this._isIgnoreNodeChange(t))continue;if(1===c){a=t.childNodes,c=a.length,h=-1;continue}break}t.style.cssText+=o,Ie.utils.addClass(t,r)}if(c>0&&h===c)return t.innerHTML=i.innerHTML,{ancestor:t,endContainer:s?Ie.query.getNodeFromPath(s,t):null}}o.v=!1;const r=this,a=t.cloneNode(!1),h=[e];let c=!0;if(function t(i,n){const o=i.childNodes;for(let i,d,u=0,p=o.length;u<p;u++){const p=o[u];if(!p)continue;let g=n;if(Ie.check.isBreak(p)||!r._isIgnoreNodeChange(p))i=s(p),i&&(c=!1,n.appendChild(i),1===p.nodeType&&(g=i)),Ie.check.isBreak(p)||t(p,g);else if(e.childNodes.length>0&&(a.appendChild(e),e=e.cloneNode(!1)),d=p.cloneNode(!0),a.appendChild(d),a.appendChild(e),h.push(e),n=e,l&&p.contains(l)){const t=Ie.query.getNodePath(l,p);l=Ie.query.getNodeFromPath(t,d)}}}(t,e),c||n&&!i&&!o.v)return{ancestor:t,endContainer:l};if(a.appendChild(e),i&&n)for(let t=0;t<h.length;t++){const e=h[t],s=e.childNodes;for(;s[0];)a.insertBefore(s[0],e);Ie.utils.removeItem(e)}else if(n){e=e.firstChild;for(let t=0;t<h.length;t++)As(h[t])}return this.#J.nodeTransform.removeEmptyNode(a,e,!1),this.#J.nodeTransform.mergeSameTags(a,null,!0),t.parentNode.replaceChild(a,t),{ancestor:a,endContainer:l}}#It(t,e,s,i,n,o,l,r,a,h){let c=i.parentNode;for(;!(c.nextSibling||c.previousSibling||this.#J.format.isLine(c.parentNode)||Ie.check.isWysiwygFrame(c.parentNode))&&c.nodeName!==e.nodeName;)c=c.parentNode;if(!l&&!o&&c.nodeName===e.nodeName&&!this.#J.format.isLine(c)&&!c.previousSibling&&Ie.check.isZeroWidth(i.textContent.slice(n))){let s=!0,o=i.nextSibling;for(;o;){if(!Ie.check.isZeroWidth(o)){s=!1;break}o=o.nextSibling}if(s)return Ie.utils.copyTagAttributes(c,e),{ancestor:t,container:i,offset:n}}r.v=!1;const d=this,u=t,p=[e],g=t.cloneNode(!1);let m,f,v,b,y=i,C=n,w=!1;if(function t(i,n){const o=i.childNodes;for(let i,l=o.length-1;0<=l;l--){const r=o[l];if(!r)continue;let c=n;if(w&&!Ie.check.isBreak(r)){if(1===r.nodeType){if(d._isIgnoreNodeChange(r)){e=e.cloneNode(!1);const t=r.cloneNode(!0);g.insertBefore(t,n),g.insertBefore(e,t),p.push(e)}else t(r,r);continue}f=r,m=[];const o=[];for(;null!==f.parentNode&&f!==u&&f!==e;)i=s(f),i&&1===f.nodeType&&(h(f)?b||o.push(i):m.push(i)),f=f.parentNode;m=m.concat(o);const l=m.length>0,c=m.pop()||r;for(v=f=c;m.length>0;)f=m.pop(),v.appendChild(f),v=f;if(h(e.parentNode)&&!h(c)&&(e=e.cloneNode(!1),g.insertBefore(e,g.firstChild),p.push(e)),!b&&h(c)){e=e.cloneNode(!1);const t=c.childNodes;for(let s=0,i=t.length;s<i;s++)e.appendChild(t[s]);c.appendChild(e),g.insertBefore(c,g.firstChild),p.push(e),n=e.children.length>0?f:e}else l?(e.insertBefore(c,e.firstChild),n=f):n=e;if(b&&3===r.nodeType)if(a(r)){const t=Ie.query.getParentElement(n,(t=>d._isNonSplitNode(t.parentNode)||t.parentNode===g));b.appendChild(t),e=t.cloneNode(!1),p.push(e),g.insertBefore(e,g.firstChild)}else b=null}if(w||r!==y)i=w?s(r):r.cloneNode(!1),i&&(n.insertBefore(i,n.firstChild),1!==r.nodeType||Ie.check.isBreak(r)||(c=i)),t(r,c);else{b=a(r);let t="",o="";if(3===y.nodeType){const e=y;t=e.substringData(C,e.length-C),o=e.substringData(0,C)}const l=Ie.utils.createTextNode(t),c=Ie.utils.createTextNode(o);if(b){b=b.cloneNode(!1);const t=a(n);if(t.parentNode!==g){let e=t,s=null;for(;e.parentNode!==g;){for(n=s=e.parentNode.cloneNode(!1);e.childNodes[0];)s.appendChild(e.childNodes[0]);e.appendChild(s),e=e.parentNode}e.parentNode.insertBefore(t,e.parentNode.firstChild)}b=b.cloneNode(!1)}else h(e.parentNode)&&!b&&(e=e.cloneNode(!1),g.appendChild(e),p.push(e));for(Ie.check.isZeroWidth(l)||n.insertBefore(l,n.firstChild),f=n,m=[];f!==g&&null!==f;)i=h(f)?null:s(f),i&&1===f.nodeType&&m.push(i),f=f.parentNode;const d=m.pop()||n;for(v=f=d;m.length>0;)f=m.pop(),v.appendChild(f),v=f;d!==n?(e.insertBefore(d,e.firstChild),n=f):n=e,Ie.check.isBreak(r)&&e.appendChild(r.cloneNode(!1)),b?(b.insertBefore(e,b.firstChild),g.insertBefore(b,g.firstChild),b=null):g.insertBefore(e,g.firstChild),y=c,C=c.data.length,w=!0,n.insertBefore(y,n.firstChild)}}}(t,g),l&&!o&&!r.v)return{ancestor:t,container:i,offset:n};if(o&&=l,o)for(let t=0;t<p.length;t++){const e=p[t],s=e.childNodes;let i=null;for(;s[0];)i=s[0],g.insertBefore(i,e);Ie.utils.removeItem(e),t===p.length-1&&(y=i,C=i.textContent.length)}else if(l){e=e.firstChild;for(let t=0;t<p.length;t++)As(p[t])}if(o||0!==g.childNodes.length){if(!l&&0===e.textContent.length)return this.#J.nodeTransform.removeEmptyNode(g,null,!1),{ancestor:null,container:null,offset:0};this.#J.nodeTransform.removeEmptyNode(g,e,!1),Ie.check.isZeroWidth(g.textContent)?(y=g.firstChild,C=y.textContent.length):Ie.check.isZeroWidth(y)&&(y=e,C=1);const s={s:0,e:0},i=Ie.query.getNodePath(y,g,s);C+=s.s;const n=this.#J.nodeTransform.mergeSameTags(g,[i],!0);t.parentNode.replaceChild(g,t),y=Ie.query.getNodeFromPath(i,g),C+=n[0]}else t.childNodes?y=t.childNodes[0]:(y=Ie.utils.createTextNode(Ae.zeroWidthSpace),t.appendChild(y));return{ancestor:g,container:y,offset:1===y.nodeType&&1===C?y.childNodes.length:C}}#Mt(t){return t&&"string"!=typeof t&&3!==t.nodeType&&this.#J.format.isTextStyleNode(t)&&!!t.style.fontSize}#Ht(t,e,s){return!s||t?null:Ie.query.getParentElement(s,this._isNonSplitNode.bind(this))||(e?null:Ie.query.getParentElement(s,this.#Mt.bind(this)))}#Lt(t,e,s){if(!s||t||1!==s.nodeType)return!1;const i=this._isNonSplitNode(s);return Ie.query.getParentElement(s,this._isNonSplitNode.bind(this))?i:i||!e&&this.#Mt(s)}#Bt(t,e){if(!Ie.check.isListCell(t))return;const s=Ie.utils.arrayFilter((e||t).childNodes,(t=>!Ie.check.isBreak(t)));if(e=s[0],!Ie.check.isElement(e)||s.length>1)return;const i=e.style,n=t.style,o=e.nodeName.toLowerCase();let l=!1;this.#ot.get("_defaultStyleTagMap")[o]===this.#ot.get("_defaultTagCommand").bold.toLowerCase()&&(n.fontWeight="bold"),this.#ot.get("_defaultStyleTagMap")[o]===this.#ot.get("_defaultTagCommand").italic.toLowerCase()&&(n.fontStyle="italic");const r=Be.getValues(i);if(r.length>0)for(let t=0,e=this.#Et.length;t<e;t++)r.includes(this.#Tt[t])&&(n[this.#Et[t]]=i[this.#Et[t]],i.removeProperty(this.#Tt[t]),l=!0);if(this.#Bt(t,e),l&&0===i.length){const t=e.childNodes,s=e.parentNode,i=e.nextSibling;for(;t.length>0;)s.insertBefore(t[0],i);Ie.utils.removeItem(e)}}#Nt(t,e){if(!Ie.check.isListCell(t))return;e||=this.#Tt;const s=Ie.utils.arrayFilter(t.childNodes,(t=>!Ie.check.isBreak(t))),i=t.style,n=[],o=[],l=Be.getValues(i);for(let t=0,s=this.#Tt.length;t<s;t++)l.includes(this.#Tt[t])&&e.includes(this.#Tt[t])&&(n.push(this.#Et[t]),o.push(this.#Tt[t]));if(0===n.length)return;const r=Ie.utils.createElement("SPAN");for(let t=0,e=n.length;t<e;t++)r.style[n[t]]=i[o[t]],i.removeProperty(o[t]);let a=r.cloneNode(!1),h=null,c=!1;for(let e,i,o=0,l=s.length;o<l;o++)e=s[o],this.#ot.get("_defaultStyleTagMap")[e.nodeName.toLowerCase()]||(i=Be.getValues(e.style),0===i.length||n.some((function(t){return!i.includes(t)}))&&i.some((function(t){return n.includes(t)}))?(h=e.nextSibling,a.appendChild(e)):a.childNodes.length>0&&(t.insertBefore(a,h),a=r.cloneNode(!1),h=null,c=!0));return a.childNodes.length>0&&(t.insertBefore(a,h),c=!0),0===i.length&&t.removeAttribute("style"),c}};function Is(t){const e=t.parentNode;let s,i,n,o,l,r=e.parentNode,a=e;for(;Ie.check.isListCell(r);){for(o=Ie.query.getPositionIndex(t),s=r.nextElementSibling,i=r.parentNode,n=a;n;){if(a=a.nextSibling,Ie.check.isList(n)){for(l=n.childNodes;l[o];)i.insertBefore(l[o],s);0===l.length&&Ie.utils.removeItem(n)}else i.appendChild(n);n=a}r=i.parentNode}return 0===e.children.length&&Ie.utils.removeItem(e),i}const Vs=class{#J;#t;constructor(t){this.#J=t.$,this.#t=t.store}apply(t,e,s){const i=(t.split(":")[0]||"ol").toUpperCase(),n=t.split(":")[1]||"";let o=this.#J.selection.getRange(),l=e||this.#J.format.getLinesAndComponents(!1);if(0===l.length){if(e)return;if(o=this.#J.selection.getRangeAndAddLine(o,null),l=this.#J.format.getLinesAndComponents(!1),0===l.length)return}Ie.query.sortNodeByDepth(l,!0);const r=l[0],a=l.at(-1);let h=!Ie.check.isListCell(r)&&!this.#J.component.is(r)||r.previousElementSibling?r.previousElementSibling:r.parentElement.previousElementSibling,c=!Ie.check.isListCell(a)&&!this.#J.component.is(a)||a.nextElementSibling?a.nextElementSibling:a.parentElement.nextElementSibling;const d=o.collapsed,u={sc:o.startContainer,so:o.startContainer===o.endContainer&&Ie.check.isZeroWidth(o.startContainer)&&0===o.startOffset&&1===o.endOffset?o.endOffset:o.startOffset,ec:o.endContainer,eo:o.endOffset};let p=null,g=!0;for(let t=0,e=l.length;t<e;t++)if(!Ie.check.isList(this.#J.format.getBlock(l[t],(e=>this.#J.format.getBlock(e)&&e!==l[t])))){g=!1;break}if(!g||h&&r.tagName===h.tagName&&i===h.tagName.toUpperCase()||c&&a.tagName===c.tagName&&i===c.tagName.toUpperCase()){const t=h?h.parentNode:h,e=c?c.parentNode:c;h=t&&!Ie.check.isWysiwygFrame(t)&&t.nodeName===i?t:h,c=e&&!Ie.check.isWysiwygFrame(e)&&e.nodeName===i?e:c;const s=h?.tagName===i,o=c?.tagName===i;let r=s?h:Ie.utils.createElement(i,{style:"list-style-type: "+n}),a=null,d=null;const u=t=>!Ie.check.isComponentContainer(t)&&!Ie.check.isList(t);for(let t,e,o,h,c,p,g,m,f,v=0,b=l.length;v<b;v++)if(e=l[v],0!==e.childNodes.length||this.#J.inline._isIgnoreNodeChange(e)){if(h=l[v+1],c=e.parentNode,p=h?h.parentNode:null,o=Ie.check.isListCell(e),f=this.#J.format.isBlock(c)?c:null,g=o&&!Ie.check.isWysiwygFrame(c)?c.parentNode:c,m=o&&!Ie.check.isWysiwygFrame(c)?!h||Ie.check.isListCell(g)?c:c.nextSibling:e.nextSibling,t=Ie.utils.createElement("LI"),this.#J.component.is(e)){const s=/^HR$/i.test(e.nodeName);s||(t.innerHTML="<br>"),t.innerHTML+=e.outerHTML,s&&(t.innerHTML+="<br>")}else{Ie.utils.copyFormatAttributes(t,e);const s=e.childNodes;for(;s[0];)t.appendChild(s[0])}r.appendChild(t),h&&g===p&&!this.#J.format.isBlock(m)||(a||=r,s&&h&&g===p||h&&Ie.check.isList(p)&&p===c||r.parentNode!==g&&g.insertBefore(r,m)),Ie.utils.removeItem(e),s&&null===d&&(d=r.children.length-1),h&&(this.#J.format.getBlock(p,u)!==this.#J.format.getBlock(c,u)||Ie.check.isList(p)&&Ie.check.isList(c)&&Ie.query.getNodeDepth(p)!==Ie.query.getNodeDepth(c))&&(r=Ie.utils.createElement(i,{style:"list-style-type: "+n})),0===f?.children.length&&Ie.utils.removeItem(f)}else Ie.utils.removeItem(e);d&&(a=a.children[d]),o&&(r.innerHTML+=c.innerHTML,Ie.utils.removeItem(c))}else{if(s)for(let t=0,e=l.length;t<e;t++)for(let s=t-1;s>=0;s--)if(l[s].contains(l[t])){l.splice(t,1),t--,e--;break}const t=this.#J.format.getBlock(r),e=t?.tagName===i;let o,a;const h=t=>!Ie.check.isComponentContainer(t);e||(a=Ie.utils.createElement(i,{style:"list-style-type: "+n}));for(let t,r,c=0,d=l.length;c<d;c++)r=this.#J.format.getBlock(l[c],h),r&&Ie.check.isList(r)&&(t?t!==r?(s&&Ie.check.isListCell(r.parentNode)?this.#Rt(o.f):p=this.#J.format.removeBlock(o.f[0].parentElement,{selectedFormats:o.f,newBlockElement:a,shouldDelete:!1,skipHistory:!0}),r=l[c].parentNode,e||(a=Ie.utils.createElement(i,{style:"list-style-type: "+n})),t=r,o={r:t,f:[Ie.query.getParentElement(l[c],"LI")]}):o.f.push(Ie.query.getParentElement(l[c],"LI")):(t=r,o={r:t,f:[Ie.query.getParentElement(l[c],"LI")]}),c===d-1&&(s&&Ie.check.isListCell(r.parentNode)?this.#Rt(o.f):p=this.#J.format.removeBlock(o.f[0].parentElement,{selectedFormats:o.f,newBlockElement:a,shouldDelete:!1,skipHistory:!0})))}return this.#t.set("_lastSelectionNode",null),g&&d&&p||u}remove(t,e){let s={},i=!1,n=!1,o=null,l=null;const r=t=>!Ie.check.isComponentContainer(t);for(let a,h,c,d,u=0,p=t.length;u<p;u++){if(c=u===p-1,h=this.#J.format.getBlock(t[u],r),d=Ie.check.isList(h),!a&&d)a=h,s={r:a,f:[Ie.query.getParentElement(t[u],"LI")]},0===u&&(i=!0);else if(a&&d)if(a!==h){const r=this.#J.format.removeBlock(s.f[0].parentNode,{selectedFormats:s.f,newBlockElement:null,shouldDelete:e,skipHistory:!0});h=t[u].parentNode,i&&(o=r.sc,i=!1),c&&(l=r.ec),d?(a=h,s={r:a,f:[Ie.query.getParentElement(t[u],"LI")]},c&&(n=!0)):a=null}else s.f.push(Ie.query.getParentElement(t[u],"LI")),c&&(n=!0);if(c&&Ie.check.isList(a)){const t=this.#J.format.removeBlock(s.f[0].parentNode,{selectedFormats:s.f,newBlockElement:null,shouldDelete:e,skipHistory:!0});(n||1===p)&&(l=t.ec),i&&(o=t.sc||l)}}return{sc:o,ec:l}}applyNested(t,e){const s=(t=t||this.#J.format.getLines().filter((function(t){return Ie.check.isListCell(t)}))).length;if(0===s||!e&&!Ie.check.isListCell(t[0].previousElementSibling)&&!Ie.check.isListCell(t.at(-1).nextElementSibling))return{sc:t[0],so:0,ec:t.at(-1),eo:1};let i=t[0].parentElement,n=t.at(-1),o=null;if(e){if(i!==n.parentElement&&Ie.check.isList(n.parentElement?.parentElement)&&n.nextElementSibling)for(n=n.nextElementSibling;n;)t.push(n),n=n.nextElementSibling;o=this.apply(i.nodeName+":"+i.style.listStyleType,t,!0)}else{let e=Ie.utils.createElement(i.nodeName),l=t[0].previousElementSibling,r=n.nextElementSibling;const a={s:null,e:null,sl:i,el:i},{startContainer:h,startOffset:c,endContainer:d,endOffset:u}=this.#J.selection.getRange();for(let n,o=0,h=s;o<h;o++)n=t[o],n.parentElement!==i&&(this.#Pt(i,e,l,r,a),i=n.parentElement,e=Ie.utils.createElement(i.nodeName)),l=n.previousElementSibling,r=n.nextElementSibling,e.appendChild(n);if(this.#Pt(i,e,l,r,a),s>1){const t=Ie.query.getNodeFromPath(a.s,a.sl),e=Ie.query.getNodeFromPath(a.e,a.el);o={sc:t,so:0,ec:e,eo:e.textContent.length}}else o={sc:h,so:c,ec:d,eo:u}}return o}removeNested(t,e){const s=Is(t);let i,n,o;if(s){i=s.cloneNode(!1),n=s.childNodes;const e=Ie.query.getPositionIndex(t);for(;n[e];)i.appendChild(n[e])}else i=t;if(e)o=Ie.query.getListChildren(i,(t=>Ie.check.isListCell(t)&&!t.previousElementSibling),null);else{const e=Ie.query.getNodeDepth(t)+2;o=Ie.query.getListChildren(t,(t=>Ie.check.isListCell(t)&&!t.previousElementSibling&&Ie.query.getNodeDepth(t)===e),null)}for(let t=0,e=o.length;t<e;t++)Is(o[t]);return s&&(s.parentNode.insertBefore(i,s.nextSibling),0===n?.length&&Ie.utils.removeItem(s)),i===t?i.parentNode:i}#Pt(t,e,s,i,n){let o=!1;if(e.tagName===s?.tagName){const t=e.children;for(;t[0];)s.appendChild(t[0]);e=s,o=!0}if(e.tagName===i?.tagName){const t=i.children;for(;t[0];)e.appendChild(t[0]);const s=i.nextElementSibling;i.parentNode.removeChild(i),i=s}if(!o){Ie.check.isListCell(s)&&(t=s,i=null),t.insertBefore(e,i),n.s||(n.s=Ie.query.getNodePath(e.firstElementChild.firstChild,t,null),n.sl=t);const o=t.contains(n.sl)?Ie.query.getNodePath(n.sl,t):null;n.e=Ie.query.getNodePath(e.lastElementChild.firstChild,t,null),n.el=t,this.#J.nodeTransform.mergeSameTags(t,[n.s,n.e,o],!1),this.#J.nodeTransform.mergeNestedTags(t),o&&(n.sl=Ie.query.getNodeFromPath(o,t))}return e}#Rt(t){const e=t[0],s=t.at(-1),i=s.nextElementSibling,n=e.parentElement,o=n.parentElement.nextElementSibling,l=n.parentElement.parentElement;for(let e=0,s=t.length;e<s;e++)l.insertBefore(t[e],o);if(i&&n.children.length>0){const t=n.cloneNode(!1),e=n.childNodes,o=Ie.query.getPositionIndex(i);for(;e[o];)t.appendChild(e[o]);s.appendChild(t)}0===n.children.length&&Ie.utils.removeItem(n),this.#J.nodeTransform.mergeSameTags(l);const r=Ie.query.getEdgeChildNodes(e,s);return{cc:e.parentNode,sc:r.sc,ec:r.ec}}},{_d:Os}=Ne;const Rs=/^<[a-z0-9]+:[a-z0-9]+/i,Ps=/(?!<)[a-zA-Z0-9-]+/,zs=/\s(?:on[a-z]+)\s*=\s*(?:(["'])[^"']*\1|\S+)/gi,Fs=/style=/i,Ds=/style\s*=\s*(?:"|')[^"']*(?:"|')/,qs=/^\s/,Ws=/<[^\s]+\s(.+)/,Us=/^[ \t\n\r\f\v]+$/,Zs=/\ssize="([^"]+)"/i,Gs=/\sface="([^"]+)"/i,js=/\scolor="([^"]+)"/i,Ks=/&quot;/g,Ys=/([a-zA-Z0-9-]+)(:)([^"']+)/,Xs=/inherit|initial|revert|unset/i,Js=/"/g,Qs=/:\s*([^;]+)/,ti=/rgba\(([0-9]+\s*,\s*){3}0\)|windowtext/i,ei=/[^;]+;/g,si=/^span$/i,ii=/^(?:https?|ftps?|mailto|tel|blob|sms|geo|webcal|callto):|^[#/]|^data:image\//i,ni=/^(?:href|src)\s*=/i,oi=/=\s*(?:"([^"]*)"|'([^']*)'|(\S+))/,li=/:/i;function ri(t){const e=function(t){let e,s=5;do{e=t,t=t.replace(/&(#x([0-9a-f]+)|#([0-9]+)|([a-z]+));/gi,((t,e,s,i)=>s?String.fromCharCode(parseInt(s,16)):i?String.fromCharCode(parseInt(i,10)):""))}while(t!==e&&--s);try{t=decodeURIComponent(t)}catch{}return t.replace(/[\u0000-\u0020]+/g,"")}(t);return ii.test(e)||!li.test(e)}function ai(t){if(!ni.test(t))return!0;const e=t.match(oi);if(!e)return!0;return ri(e[1]??e[2]??e[3]??"")}function hi(t,e){return t?"*"===t?"[a-z-]+":e?t+"|"+e:t:"^"}const ci=class{#J;#t;#Y;#Q;#ot;#dt;#zt;#Ft;#Dt;#qt;#Wt;#Ut;#Zt;#Gt;#jt;#Kt;#Yt;#Xt;#Jt;#Qt;#te;#ee;#se;#ie;#ne;constructor(t){this.#J=t.$,this.#t=t.store;const e=this.#ot=this.#J.options;this.#Q=this.#J.frameOptions,this.#Y=this.#J.frameContext,this.#dt=this.#J.instanceCheck,this.#Ft=function(t){return this.test(t)?t:""}.bind(e.get("allowedClassName")),this.#Jt=e.get("_textStyleTags");const s=e.get("tagStyles"),i={};for(const t in s){const e=t.split("|");for(let n,o=0,l=e.length;o<l;o++)n=e[o],i[n]?i[n]+="|":i[n]="",i[n]+=s[t]}for(const t in i)i[t]=new RegExp(`\\s*[^-a-zA-Z](${i[t]})\\s*:[^;]+(?!;)*`,"gi");const n=new Map;for(const t in i)n.set(new RegExp(`^(${t})$`),i[t]);this.#Yt=new RegExp(`^(${Object.keys(i).join("|")})$`,"i"),this.#Xt=n,this.#zt=new RegExp("\\d+("+e.get("fontSizeUnits").join("|")+")$","i");const o=e.get("_allowedExtraTag"),l=e.get("_disallowedExtraTag");this.#Qt=new RegExp(`<(${l})[^>]*>([\\s\\S]*?)<\\/\\1>|<(${l})[^>]*\\/?>`,"gi"),this.#te=new RegExp(`^(${l})$`,"i"),this.#ee=new RegExp(`^(${o})$`,"i");const r=Object.keys(e.get("_defaultStyleTagMap")),a=e.get("elementWhitelist")?e.get("elementWhitelist").split("|").filter((t=>/b|i|ins|s|strike/i.test(t))):[];for(let t=0;t<a.length;t++)r.splice(r.indexOf(a[t].toLowerCase()),1);this.#qt=0===r.length?null:new RegExp("(<\\/?)("+r.join("|")+")\\b\\s*([^>^<]+)?\\s*(?=>)","gi");const h=e.get("__defaultAttributeWhitelist");this.#Dt=e.get("_editorElementWhitelist").includes("//")||"*"===e.get("_editorElementWhitelist"),this.#Wt=new RegExp("^("+hi(e.get("_editorElementWhitelist").replace("|//",""),"")+")$","i"),this.#Ut=new RegExp("^("+(e.get("elementBlacklist")||"^")+")$","i"),this.#Zt=Be.createElementWhitelist(hi(e.get("_editorElementWhitelist").replace("|//","|\x3c!--|--\x3e"),"")),this.#Gt=Be.createElementBlacklist(e.get("elementBlacklist").replace("|//","|\x3c!--|--\x3e"));const c='\\s*=\\s*(")[^"]*\\1',d=e.get("attributeWhitelist");let u={},p="";if(d)for(const t in d)/^on[a-z]+$/i.test(d[t])||("*"===t?p=hi(d[t],h):u[t]=new RegExp("\\s(?:"+hi(d[t],h)+")"+c,"ig"));this.#jt=new RegExp("\\s(?:"+(p||h)+"|data-se-[^\\s]+"+(e.get("v2Migration")?"|data-index|data-file-size|data-file-name|data-exp|data-font-size":"")+")"+c,"ig"),this.#se=u;const g=e.get("attributeBlacklist");if(u={},p="",g)for(const t in g)"*"===t?p=hi(g[t],""):u[t]=new RegExp("\\s(?:"+hi(g[t],"")+")"+c,"ig");this.#Kt=new RegExp("\\s(?:"+(p||"^")+")"+c,"ig"),this.#ie=u,this.__resetAutoStyleify(e.get("autoStyleify"))}filter(t,{tagWhitelist:e,tagBlacklist:s,validate:i,validateAll:n}){if(e&&(t=t.replace(Be.createElementWhitelist(e),"")),s&&(t=t.replace(Be.createElementBlacklist(s),"")),i){const e=(new DOMParser).parseFromString(t,"text/html");e.body.querySelectorAll("*").forEach((t=>{if(n||!t.closest(".se-component")&&!t.closest(".se-flex-component")){const e=i(t);null===e?t.remove():this.#dt.isNode(e)?t.replaceWith(e):"string"==typeof e&&(t.outerHTML=e)}})),t=e.body.innerHTML}return t}clean(t,{forceFormat:e,whitelist:s,blacklist:i,_freeCodeViewMode:n}={}){const{tagFilter:o,formatFilter:l,classFilter:r,textStyleTagFilter:a,attrFilter:h,styleFilter:c}=this.#ot.get("strictMode");let d="";if(t=this.compress(t),o&&(t=t.replace(this.#Qt,""),t=this.#oe(t,this.#Zt,this.#Gt).replace(/<br\/?>$/i,"")),this.#ne){const e=(new DOMParser).parseFromString(t,"text/html");Ie.query.getListChildNodes(e.body,Be.spanToStyleNode.bind(null,this.#ne),null),t=e.body.innerHTML}(h||c)&&(t=t.replace(/(<[a-zA-Z0-9-]+)[^>]*(?=>)/g,this.#le.bind(this,h,c)));const u=Os.createRange().createContextualFragment(t);if(o)try{this.#re(u,this.#Wt,this.#Ut,o,l,r,n)}catch(t){console.warn("[SUNEDITOR.html.clean.fail]",t.message)}const p=u.querySelectorAll("[data-se-iframe-holder]");for(let t=0,e=p.length;t<e;t++){const e=Ie.utils.createElement("iframe"),s=JSON.parse(p[t].getAttribute("data-se-iframe-holder-attrs"));for(const[t,i]of Object.entries(s))/^on/i.test(t)||("src"!==t||ri(String(i)))&&e.setAttribute(t,i);p[t].replaceWith(e)}if(this.#J.pluginManager.applyRetainFormat(u),l){let t=u.childNodes;e||=this.#ae(t),e&&(t=this.#he(u).childNodes);for(let s,i=0,n=t.length;i<n;i++)s=t[i],this.#ee.test(s.nodeName)?d+=s.outerHTML:d+=this.#ce(s,e)}return d||=t,o&&(s&&(d=d.replace("string"==typeof s?Be.createElementWhitelist(s):s,"")),i&&(d=d.replace("string"==typeof i?Be.createElementBlacklist(i):i,""))),a&&(d=this.#de(d)),d}insert(t,{selectInserted:e,skipCharCount:s,skipCleaning:i}={}){this.#Y.get("wysiwyg").contains(this.#J.selection.get().focusNode)||this.#J.focusManager.focus(),this.remove(),this.#J.focusManager.focus();let n=null;if("string"==typeof t){i||(t=this.clean(t,{forceFormat:!1,whitelist:null,blacklist:null}));try{if(Ie.check.isListCell(this.#J.format.getLine(this.#J.selection.getNode(),null))){const e=Os.createRange().createContextualFragment(t).childNodes;this.#ae(e)&&(t=this.#ue(e))}const i=Os.createRange().createContextualFragment(t).childNodes;if(!s){const t="byte-html"===this.#Q.get("charCounter_type")?"outerHTML":"textContent";let e="";for(let s=0,n=i.length;s<n;s++)e+=i[s][t];if(!this.#J.char.check(e))return}let o,l,r,a,h;for(;o=i[0];)3===a?.nodeType&&1===l?.nodeType&&Ie.check.isBreak(o)?(a=o,Ie.utils.removeItem(o)):(r=this.insertNode(o,{afterNode:l,skipCharCount:!0}),l=r.container||r,h||=r,a=o);3===a?.nodeType&&1===l?.nodeType&&(l=a);const c=3===l.nodeType?r.endOffset||l.textContent.length:l.childNodes.length;n=l,e?this.#J.selection.setRange(h.container||h,h.startOffset||0,l,c):this.#J.component.is(l)||this.#J.selection.setRange(l,c,l,c)}catch(t){if(this.#Y.get("isReadOnly")||this.#Y.get("isDisabled"))return;throw Error(`[SUNEDITOR.html.insert.error] ${t.message}`)}}else if(this.#J.component.is(t))this.#J.component.insert(t,{skipCharCount:s,insertBehavior:"none"});else{let e=null;(this.#J.format.isLine(t)||Ie.check.isMedia(t))&&(e=this.#J.format.getLine(this.#J.selection.getNode(),null)),this.insertNode(t,{afterNode:e,skipCharCount:s})}if(this.#t.set("_lastSelectionNode",null),n){const t=Ie.query.getListChildNodes(n,null,null);if(t.length>0){n=t.at(-1);const e=3===n?.nodeType?n.textContent.length:1;this.#J.selection.setRange(n,e,n,e)}else this.#J.focusManager.focus()}else this.#J.focusManager.focus();this.#J.history.push(!1)}insertNode(t,{afterNode:e,skipCharCount:s}={}){let i=null;if(this.#Y.get("isReadOnly")||!s&&!this.#J.char.check(t))return i;let n=null,o=null;if(e){const t=this.#J.format.isLine(e)||this.#J.format.isBlock(e)||this.#J.component.is(e)?this.#J.format.addLine(e,null):e;o=this.#J.selection.setRange(t,1,t,1)}else o=this.#J.selection.getRange();let l,r,a,h=Ie.check.isListCell(o.commonAncestorContainer)?o.commonAncestorContainer:this.#J.format.getLine(this.#J.selection.getNode(),null),c=Ie.check.isListCell(h)&&(Ie.check.isListCell(t)||Ie.check.isList(t)),d=null;const u=this.#J.format.isBrLine(h),p=this.#J.format.isLine(t)||this.#J.format.isBlock(t)||this.#J.component.isBasic(t);if(c&&(a=e||Ie.check.isList(t)?h.lastChild:h.nextElementSibling,d=Ie.check.isList(t)?h:(a||h).parentNode),!e&&(p||this.#J.component.isBasic(t)||Ie.check.isMedia(t))){const t=Ie.check.isEdgePoint(o.endContainer,o.endOffset,"end"),s=this.remove(),i=s.container,n=i===s.prevContainer&&o.collapsed?null:s.prevContainer;if(c&&n)if(d=3===n.nodeType?n.parentNode:n,d.contains(i)){let t=!0;for(a=i;a.parentNode&&a.parentNode!==d;)a=a.parentNode,t=!1;t&&i===n&&(a=a.nextSibling)}else a=null;else if(c&&Ie.check.isListCell(i)&&!h.parentElement)h=Ie.utils.createElement("LI"),d.appendChild(h),i.appendChild(d),a=null;else if(3===i.nodeType||Ie.check.isBreak(i)||c){const n=Ie.query.getParentElement(i,(t=>this.#J.format.isBlock(t)||Ie.check.isListCell(t)));if(e=this.#J.nodeTransform.split(i,s.offset,n?Ie.query.getNodeDepth(n)+1:0))if(c){if(h.contains(i)){const s=Ie.check.isList(h.lastElementChild);let i=null;t||(i=h.cloneNode(!1),i.appendChild(e.textContent.trim()?e:Ie.utils.createTextNode(Ae.zeroWidthSpace))),s&&(i||(i=h.cloneNode(!1),i.appendChild(Ie.utils.createTextNode(Ae.zeroWidthSpace))),i.appendChild(h.lastElementChild)),i&&(h.parentNode.insertBefore(i,h.nextElementSibling),a=e=i)}}else e=e.previousSibling;else Ie.check.isListCell(h)||(a=e=h)}}o=e||p?this.#J.selection.getRange():this.#J.selection.getRangeAndAddLine(this.#J.selection.getRange(),null);const g=o.commonAncestorContainer,m=o.startOffset,f=o.endOffset,v=o.startContainer===g&&this.#J.format.isLine(g),b=v&&(g.childNodes[m]||g.childNodes[0])||o.startContainer,y=v&&(g.childNodes[f]||g.childNodes[g.childNodes.length-1])||o.endContainer;if(!c)if(e)l=e.parentNode,e=e.nextSibling,r=!0;else if(l=b,3===b.nodeType&&(l=b.parentNode),o.collapsed)if(3===g.nodeType)e=g.textContent.length>f?g.splitText(f):g.nextSibling;else if(Ie.check.isBreak(l))e=l,l=l.parentNode;else{const s=l.childNodes[m],i=3===s?.nodeType&&Ie.check.isZeroWidth(s)&&Ie.check.isBreak(s.nextSibling)?s.nextSibling:s;i?!i.nextSibling&&Ie.check.isBreak(i)?(l.removeChild(i),e=null):e=Ie.check.isBreak(i)&&!Ie.check.isBreak(t)?i:i.nextSibling:e=null}else{if(b===y){e=Ie.check.isEdgePoint(y,f)?y.nextSibling:y.splitText(f);let t=b;Ie.check.isEdgePoint(b,m)||(t=b.splitText(m)),l.removeChild(t),0===l.childNodes.length&&p&&(l.innerHTML="<br>")}else{const s=this.remove(),i=s.container,n=s.prevContainer;if(0===i?.childNodes.length&&p&&(this.#J.format.isLine(i)?i.innerHTML="<br>":this.#J.format.isBlock(i)&&(i.innerHTML="<"+this.#ot.get("defaultLine")+"><br></"+this.#ot.get("defaultLine")+">")),Ie.check.isListCell(i)&&3===t.nodeType)l=i,e=null;else if(!p&&n)if(l=3===n.nodeType?n.parentNode:n,l.contains(i)){let t=!0;for(e=i;e.parentNode&&e.parentNode!==l;)e=e.parentNode,t=!1;t&&i===n&&(e=e.nextSibling)}else e=null;else Ie.check.isWysiwygFrame(i)&&!this.#J.format.isLine(t)?(l=i.appendChild(Ie.utils.createElement(this.#ot.get("defaultLine"))),e=null):l=(e=p?y:i===n?i.nextSibling:i)&&e.parentNode?e.parentNode:g;for(;e&&!this.#J.format.isLine(e)&&e.parentNode!==g;)e=e.parentNode}}try{const s=this.#Y.get("wysiwyg");if(!c){if((Ie.check.isWysiwygFrame(e)||l===s.parentNode)&&(l=s,e=null),this.#J.format.isLine(t)||this.#J.format.isBlock(t)||!Ie.check.isListCell(l)&&this.#J.component.isBasic(t)){const t=l;if(Ie.check.isListCell(e))l=e.previousElementSibling||e;else if(!r&&!e){const t=this.remove(),s=3===t.container.nodeType?Ie.check.isListCell(this.#J.format.getLine(t.container,null))?t.container:this.#J.format.getLine(t.container,null)||t.container.parentNode:t.container,i=Ie.check.isWysiwygFrame(s)||this.#J.format.isBlock(s);l=i?s:s.parentNode,e=i?null:s.nextSibling}0===t.childNodes.length&&l!==t&&Ie.utils.removeItem(t)}if(!p||u||this.#J.format.isBlock(l)||Ie.check.isListCell(l)||Ie.check.isWysiwygFrame(l)||(e=l.nextElementSibling,l=l.parentNode),Ie.check.isWysiwygFrame(l)&&(3===t.nodeType||Ie.check.isBreak(t))){const e=Ie.utils.createElement(this.#ot.get("defaultLine"),null,t);n=t,t=e}}if(c?d.parentNode?(l=d,e=a):(l=s,e=null):e=l===e?l.lastChild:e,Ie.check.isListCell(t)&&!Ie.check.isList(l)){if(Ie.check.isListCell(l))e=l.nextElementSibling,l=l.parentNode;else{const t=Ie.utils.createElement("ol");l.insertBefore(t,e),l=t,e=null}c=!0}if(this.#pe(t,l),l.insertBefore(t,e),c)if(Ie.check.isZeroWidth(h.textContent.trim()))Ie.utils.removeItem(h),t=t.lastChild;else{const e=Ie.utils.arrayFind(h.children,Ie.check.isList);e&&(t!==e?(t.appendChild(e),t=e.previousSibling):(l.appendChild(t),t=l),Ie.check.isZeroWidth(h.textContent.trim())&&Ie.utils.removeItem(h))}}catch(e){l.appendChild(t),console.warn("[SUNEDITOR.html.insertNode.warn]",e)}finally{n&&(t=n);const e=l.querySelectorAll("[data-duple]");if(e.length>0)for(let s,i,n,o,l=0,r=e.length;l<r;l++){for(s=e[l],n=s.childNodes,o=s.parentNode;n[0];)i=n[0],o.insertBefore(i,s);s===t&&(t=i),Ie.utils.removeItem(s)}if((this.#J.format.isLine(t)||this.#J.component.isBasic(t))&&b===y){const t=this.#J.format.getLine(g,null);1===t?.nodeType&&Ie.check.isEmptyLine(t)&&Ie.utils.removeItem(t)}if(u&&!Ie.check.isList(t)&&(this.#J.format.isLine(t)||this.#J.format.isBlock(t))&&(t=this.#ge(t)),!this.#J.component.isBasic(t)){let e=1;if(3===t.nodeType)e=t.textContent.length,this.#J.selection.setRange(t,e,t,e);else if(!Ie.check.isBreak(t)&&!Ie.check.isListCell(t)&&this.#J.format.isLine(l)){let s=null;t.previousSibling&&!Ie.check.isBreak(t.previousSibling)||(s=Ie.utils.createTextNode(Ae.zeroWidthSpace),t.parentNode.insertBefore(s,t)),t.nextSibling&&!Ie.check.isBreak(t.nextSibling)||(s=Ie.utils.createTextNode(Ae.zeroWidthSpace),t.parentNode.insertBefore(s,t.nextSibling)),this.#J.inline._isIgnoreNodeChange(t)&&(t=t.nextSibling,e=0),this.#J.selection.setRange(t,e,t,e)}}i=t}return i}remove(){this.#J.selection.resetRangeToTextNode();const t=this.#J.selection.getRange(),e=0===t.startOffset,s=Ie.check.isEdgePoint(t.endContainer,t.endOffset,"end");let i=null,n=null,o=null;e&&(n=this.#J.format.getLine(t.startContainer),i=n?n.previousElementSibling:null,n=n?i:n),s&&(o=this.#J.format.getLine(t.endContainer),o=o?o.nextElementSibling:o);let l,r=0,a=t.startContainer,h=t.endContainer,c=t.startOffset,d=t.endOffset;const u=3===t.commonAncestorContainer.nodeType&&t.commonAncestorContainer.parentNode===a.parentNode?a.parentNode:t.commonAncestorContainer;if(Ie.check.isWysiwygFrame(a)&&Ie.check.isWysiwygFrame(h)){this.set("");return{container:this.#J.selection.getNode(),offset:0,commonCon:u}}if(u===a&&u===h){if(this.#J.component.isBasic(u)){const t=this.#J.component.get(u).container,e=t.parentElement,s=t.nextSibling||t.previousSibling,i=s===t.previousSibling?s?.textContent?.length||1:0,n=e.nextElementSibling||e.previousElementSibling,o=n===e.previousElementSibling?n?.textContent?.length||1:0;return Ie.utils.removeItem(t),this.#J.format.isLine(e)?0===e.childNodes.length?(Ie.utils.removeItem(e),{container:n,offset:o,commonCon:u}):{container:s,offset:i,commonCon:u}:{container:n,offset:o,commonCon:u}}if(1===u.nodeType&&0===c&&1===d||3===u.nodeType&&0===c&&d===u.textContent.length){const t=Ie.query.getNextDeepestNode(u,this.#Y.get("wysiwyg")),e=Ie.query.getPreviousDeepestNode(u,this.#Y.get("wysiwyg")),s=this.#J.format.getLine(u);Ie.utils.removeItem(u);let i=t||e,n=t?0:3===i?.nodeType?i.textContent.length:1;const o=this.#J.format.getLine(i)||this.#J.component.get(i);return s!==o&&(i=o,n=0===n?0:1),Ie.check.isZeroWidth(s)&&!s.contains(i)&&Ie.utils.removeItem(s),{container:i,offset:n,commonCon:u}}a=u.children[c],h=u.children[d],c=d=0}if(!a||!h)return{container:u,offset:0,commonCon:u};if(a===h&&t.collapsed&&Ie.check.isZeroWidth(a.textContent?.substring(c)))return{container:a,offset:c,prevContainer:a&&a.parentNode?a:null,commonCon:u};let p=null,g=null;const m=Ie.query.getListChildNodes(u,null,null);let f=Ie.utils.getArrayIndex(m,a),v=Ie.utils.getArrayIndex(m,h);if(m.length>0&&f>-1&&v>-1){for(let t=f+1,e=a;t>=0;t--)m[t]===e.parentNode&&m[t].firstChild===e&&0===c&&(f=t,e=e.parentNode);for(let t=v-1,e=h;t>f;t--)m[t]===e.parentNode&&1===m[t].nodeType&&(m.splice(t,1),e=e.parentNode,--v)}else{if(0===m.length){if(this.#J.format.isLine(u)||this.#J.format.isBlock(u)||Ie.check.isWysiwygFrame(u)||Ie.check.isBreak(u)||Ie.check.isMedia(u))return{container:u,offset:0,commonCon:u};if(Ie.check.isText(u))return{container:u,offset:d,commonCon:u};m.push(u),a=h=u}else if(a=h=m[0],Ie.check.isBreak(a)||Ie.check.isZeroWidth(a))return{container:Ie.check.isMedia(u)?u:a,offset:0,commonCon:u};f=v=0}const b=Ie.check.isText,y=Ie.check.isElement,C=f===v;let w=null;for(let t=f;t<=v;t++){const e=m[t];if(!b(e)||void 0!==e.data&&0!==e.length)if(e!==a)if(e!==h)w=this.#me(e,C);else{if(b(h))g=Ie.utils.createTextNode(h.substringData(d,h.length-d));else{if(this.#J.component.is(h))continue;g=Ie.utils.createTextNode(h.textContent)}g.length>0?h.data=g.data:w=this.#me(h,C)}else{if(y(a)){if(this.#J.component.is(a))continue;p=Ie.utils.createTextNode(a.textContent)}else{const t=a,s=h;e===h?(p=Ie.utils.createTextNode(t.substringData(0,c)+s.substringData(d,s.length-d)),r=c):p=Ie.utils.createTextNode(t.substringData(0,c))}if(p.length>0?a.data=p.data:w=this.#me(a,C),e===h)break}else w=this.#me(e,C)}const _=Ie.query.getParentElement(h,"ul"),x=Ie.query.getParentElement(a,"li");if(_&&x&&x.contains(_)?(l=_.previousSibling,r=l.textContent.length):(l=h&&h.parentNode?h:a&&a.parentNode?a:t.endContainer||t.startContainer,(e||s)&&(s?1===l.nodeType&&0===l.childNodes.length?(l.appendChild(Ie.utils.createElement("BR")),r=1):r=l.textContent.length:r=0)),this.#J.format.getLine(l)||a&&a.parentNode||(o?(l=o,r=0):n&&(l=n,r=1)),!Ie.check.isWysiwygFrame(l)&&0===l.childNodes.length){const t=this.#J.nodeTransform.removeAllParents(l,null,null);t&&(l=t.sc||t.ec||this.#Y.get("wysiwyg"))}return l&&(1!==l.nodeType||this.#J.format.isLine(l)||Ie.check.isBreak(l))||(l=w?.sc||w?.ec,r=3===l?.nodeType?l.textContent.length:1),this.#J.selection.setRange(l,r,l,r),{container:l,offset:r,prevContainer:i,commonCon:u?.parentElement?u:null}}get({withFrame:t,includeFullPage:e,rootKey:s}={}){s?Array.isArray(s)||(s=[s]):s=[this.#t.get("rootKey")];const i=this.#t.get("rootKey"),n={};for(let i,o=0,l=s.length;o<l;o++){this.#J.facade.changeFrameContext(s[o]);const l=Ie.utils.createElement("DIV",null,this._convertToCode(this.#Y.get("wysiwyg"),!0)),r=l.querySelectorAll(".se-placeholder-line");for(let t=0,e=r.length;t<e;t++)r[t].classList.remove("se-placeholder-line"),r[t].removeAttribute("data-se-placeholder-line"),r[t].getAttribute("class")||r[t].removeAttribute("class");const a=Ie.check.isTableCell,h=Ie.check.isEmptyLine,c=[],d=[];Ie.query.getListChildren(l,(t=>{t.hasAttribute("contenteditable")&&c.push(t);const e=t.parentElement;return a(e)&&e.children.length<=1&&h(t)&&d.push(e),!1}),null);for(let t=0,e=c.length;t<e;t++)c[t].removeAttribute("contenteditable");for(let t=0,e=d.length;t<e;t++)d[t].innerHTML="<br>";this.#fe(l);const u=l.innerHTML;if(this.#Q.get("iframe_fullPage"))if(e){const t=Ie.utils.getAttributesToString(this.#Y.get("_wd").body,["contenteditable"]);i=`<!DOCTYPE html><html>${this.#Y.get("_wd").head.outerHTML}<body ${t}>${u}</body></html>`}else i=u;else i=t?`<div class="${this.#ot.get("_editableClass")+""+(this.#ot.get("_rtl")?" se-rtl":"")}">${u}</div>`:l.innerHTML;n[s[o]]=i}return this.#J.facade.changeFrameContext(i),s.length>1?n:n[s[0]]}set(t,{rootKey:e}={}){this.#J.ui.offCurrentController(),this.#J.selection.removeRange();const s=null==t?"":this.clean(t,{forceFormat:!0,whitelist:null,blacklist:null});e?Array.isArray(e)||(e=[e]):e=[this.#t.get("rootKey")];for(let t=0;t<e.length;t++)if(this.#J.facade.changeFrameContext(e[t]),this.#Y.get("isMarkdownView")){const t=Be.htmlToJson(s);this.#Y.get("markdown").value=Pe.jsonToMarkdown(t)}else if(this.#Y.get("isCodeView")){const t=this._convertToCode(s,!1);this.#J.viewer._setCodeView(t)}else this.#Y.get("wysiwyg").innerHTML=s,this.#J.pluginManager.resetFileInfo(),this.#J.history.push(!1,e[t])}add(t,{rootKey:e}={}){this.#J.ui.offCurrentController(),e?Array.isArray(e)||(e=[e]):e=[this.#t.get("rootKey")];for(let s=0;s<e.length;s++){this.#J.facade.changeFrameContext(e[s]);const i=this.clean(t,{forceFormat:!0,whitelist:null,blacklist:null});if(this.#Y.get("isMarkdownView")){const t=Be.htmlToJson(i);this.#Y.get("markdown").value+="\n"+Pe.jsonToMarkdown(t)}else if(this.#Y.get("isCodeView"))this.#J.viewer._setCodeView(this.#J.viewer._getCodeView()+"\n"+this._convertToCode(i,!1));else{const t=Ie.utils.createElement("DIV",null,i),n=Array.from(t.children);for(let t=0,e=n.length;t<e;t++)this.#Y.get("wysiwyg").appendChild(n[t]);this.#J.history.push(!1,e[s]),this.#J.selection.scrollTo(n.at(-1))}}}getJson({withFrame:t,rootKey:e}={}){return Be.htmlToJson(this.get({withFrame:t,rootKey:e}))}setJson(t,{rootKey:e}={}){this.set(Be.jsonToHtml(t),{rootKey:e})}async copy(t){try{return!("string"!=typeof t&&!Ie.check.isElement(t)&&!Ie.check.isText(t))&&(!1===await Re.write(t)?(this.#J.ui.showToast(this.#J.lang.message_copy_fail,this.#ot.get("toastMessageTime").copy,"error"),!1):(this.#J.ui.showToast(this.#J.lang.message_copy_success,this.#ot.get("toastMessageTime").copy),!0))}catch(t){return console.error("[SUNEDITOR.html.copy.fail] :",t),this.#J.ui.showToast(this.#J.lang.message_copy_fail,this.#ot.get("toastMessageTime").copy,"error"),!1}}setFullPage(t,{rootKey:e}={}){if(!this.#Q.get("iframe"))return!1;e?Array.isArray(e)||(e=[e]):e=[this.#t.get("rootKey")];for(let s=0;s<e.length;s++)this.#J.facade.changeFrameContext(e[s]),t.head&&(this.#Y.get("_wd").head.innerHTML=t.head.replace(this.#Qt,"")),t.body&&(this.#Y.get("_wd").body.innerHTML=this.clean(t.body,{forceFormat:!0,whitelist:null,blacklist:null})),this.#J.pluginManager.resetFileInfo()}compress(t){return t.replace(/>\s+</g,"> <").replace(/\n/g,"").trim()}_convertToCode(t,e){let s="";const i=RegExp,n=new i("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),o="string"==typeof t?Os.createRange().createContextualFragment(t):t,l=t=>this.#J.format.isLine(t)||this.#J.component.is(t),r=e?"":"\n",a=e?0:1*this.#t.get("codeIndentSize"),h=a>0?new Array(a+1).join(" "):"";return function t(e,o){const a=e?.childNodes;if(!a)return;const c=n.test(e.nodeName),d=c?o:"";for(let u,p,g,m,f,v,b=0,y=a.length;b<y;b++)u=a[b],m=n.test(u.nodeName),p=m?r:"",g=!l(u)||c||/^(TH|TD)$/i.test(e.nodeName)?"":r,8!==u.nodeType?3!==u.nodeType?0!==u.childNodes.length?u.outerHTML?(f=u.nodeName.toLowerCase(),v=d||m?o:"",s+=(g||(c?"":p))+v+u.outerHTML.match(i("<"+f+"[^>]*>","i"))[0]+p,t(u,o+h+""),s+=(/\n$/.test(s)?v:"")+"</"+f+">"+(g||p||c||/^(TH|TD)$/i.test(u.nodeName)?r:"")):s+=(new XMLSerializer).serializeToString(u):s+=(/^HR$/i.test(u.nodeName)?r:"")+(/^PRE$/i.test(u.parentElement.nodeName)&&/^BR$/i.test(u.nodeName)?"":d)+u.outerHTML+p:Ie.check.isList(u.parentElement)||(s+=Be.htmlToEntity(/^\n+$/.test(u.data)?"":u.data)):s+="\n\x3c!-- "+u.textContent.trim()+" --\x3e"+p}(o,""),s.trim()+r}#me(t,e){const s=this.#J.format.getLine(t,null);if(Ie.utils.removeItem(t),!Ie.check.isListCell(s)||e)return;const i=this.#J.nodeTransform.removeAllParents(s,null,null);return Ie.check.isList(s?.firstChild)&&s.insertBefore(Ie.utils.createTextNode(Ae.zeroWidthSpace),s.firstChild),i?{sc:i.sc,ec:i.ec}:null}#ge(t){const e=t.parentNode;let s,i;for(;this.#J.format.isLine(t)||this.#J.format.isBlock(t);){for(s=t.childNodes,i=null;s[0];)if(i=s[0],this.#J.format.isLine(i)||this.#J.format.isBlock(i)){if(this.#ge(i),!t.parentNode)break;s=t.childNodes}else e.insertBefore(i,t);0===t.childNodes.length&&Ie.utils.removeItem(t),t=Ie.utils.createElement("BR"),e.insertBefore(t,i.nextSibling)}return t}#ce(t,e){const s=this.#ot.get("defaultLine");if(1===t.nodeType){if(this.#te.test(t.nodeName))return"";if(Ie.check.isExcludeFormat(t))return t.outerHTML;const i=Ie.query.getListChildNodes(t,(t=>Ie.check.isSpanWithoutAttr(t)&&!Ie.query.getParentElement(t,Ie.check.isExcludeFormat)),null)||[];for(let t,e=i.length-1;e>=0;e--)t=i[e],t.outerHTML=t.innerHTML;if(!e||this.#J.format.isLine(t)||this.#J.format.isBlock(t)||this.#J.component.is(t)||Ie.check.isMedia(t)||Ie.check.isFigure(t)||Ie.check.isAnchor(t)&&Ie.check.isMedia(t.firstElementChild)){const e=t;return Ie.check.isSpanWithoutAttr(t)?e.innerHTML:e.outerHTML}{const e=t;return"<"+s+">"+(Ie.check.isSpanWithoutAttr(t)?e.innerHTML:e.outerHTML)+"</"+s+">"}}if(3===t.nodeType){if(!e)return Be.htmlToEntity(t.textContent);const i=t.textContent.split(/\n/g);let n="";for(let t,e=0,o=i.length;e<o;e++)t=i[e].trim(),t.length>0&&(n+="<"+s+">"+Be.htmlToEntity(t)+"</"+s+">");return n}return 8===t.nodeType&&this.#Dt?"\x3c!--"+t.textContent.trim()+"--\x3e":""}#ve(t){return!t||11===t.nodeType||Ie.check.isWysiwygFrame(t)||Ie.check.isList(t)||Ie.check.isTableElements(t)||this.#J.format.isBlock(t)}#re(t,e,s,i,n,o,l){const r=[],a=[],h=[],c=[],d=Ie.query.getListChildNodes(t,(d=>{if(1!==d.nodeType)return n&&Ie.check.isList(d.parentElement)&&r.push(d),3===d.nodeType&&(!d.textContent||Us.test(d.textContent)&&(this.#ve(d.parentNode)||!d.previousSibling!=!d.nextSibling))&&r.push(d),!1;if(i&&(s.test(d.nodeName)||!e.test(d.nodeName)&&0===d.childNodes.length&&Ie.check.isExcludeFormat(d)))return r.push(d),!1;"PRE"===d.nodeName&&this.#be(d);const u=!Ie.query.getParentElement(d,Ie.check.isExcludeFormat);if(n){if(!Ie.check.isTableElements(d)&&!Ie.check.isListCell(d)&&!Ie.check.isAnchor(d)&&(this.#J.format.isLine(d)||this.#J.format.isBlock(d)||this.#J.format.isTextStyleNode(d))&&0===d.childNodes.length&&u)return a.push(d),!1;if(Ie.check.isList(d.parentNode)&&!Ie.check.isList(d)&&!Ie.check.isListCell(d))return h.push(d),!1;if(Ie.check.isTableCell(d)){const t=d.firstElementChild;if(!this.#J.format.isLine(t)&&!this.#J.format.isBlock(t)&&!this.#J.component.is(t))return c.push(d),!1}}if(o&&u&&d.className){const t=Array.from(d.classList).map(this.#Ft).join(" ").trim();t?d.className=t:d.removeAttribute("class")}if(!n)return!1;return!l&&d.parentNode!==t&&u&&(Ie.check.isListCell(d)&&!Ie.check.isList(d.parentNode)||(this.#J.format.isLine(d)||this.#J.component.is(d))&&!this.#J.format.isBlock(d.parentNode)&&!Ie.query.getParentElement(d,this.#J.component.is.bind(this.#J.component)))}),null);for(let t=0,e=r.length;t<e;t++)Ie.utils.removeItem(r[t]);const u=[];for(let t,e,s=0,i=d.length;s<i;s++)if(t=d[s],e=t.parentNode,e&&e.parentNode)if(Ie.query.getParentElement(t,Ie.check.isListCell)){const s=t.childNodes;for(let i=s.length-1;i>=0;i--)e.insertBefore(s[i],t);u.push(t)}else e.parentNode.insertBefore(t,e),u.push(e);for(let t,e=0,s=u.length;e<s;e++)t=u[e],Ie.check.isZeroWidth(t.textContent.trim())&&Ie.utils.removeItem(t);for(let t=0,e=a.length;t<e;t++)Ie.utils.removeItem(a[t]);for(let t,e,s,i,n=0,o=h.length;n<o;n++)if(t=h[n],i=t.parentNode,i)if(e=Ie.utils.createElement("LI"),this.#J.format.isLine(t)){for(s=t.childNodes;s[0];)e.appendChild(s[0]);i.insertBefore(e,t),Ie.utils.removeItem(t)}else t=t.nextSibling,e.appendChild(h[n]),i.insertBefore(e,t);for(let t,e,s=0,i=c.length;s<i;s++){if(t=c[s],e=Ie.utils.createElement("DIV"),e.innerHTML=t.innerHTML,0===t.textContent.trim().length&&this.#ye(t)){let t=e;for(;t.firstElementChild;)t=t.firstElementChild;t.innerHTML="<br>"}t.innerHTML=e.outerHTML}}#ye(t){const e=t.querySelectorAll("*"),s=this.#J.format;for(let t=0;t<e.length;t++)if(!s.isTextStyleNode(e[t]))return!1;return!0}#de(t){if(!this.#qt)return t;const e=this.#ot.get("_defaultStyleTagMap");return t.replace(this.#qt,((t,s,i,n)=>s+("string"==typeof e[i]?e[i]:i)+(n?" "+n:"")))}#he(t){let e,s="";const i=t.childNodes;for(let t,n=0,o=i.length;n<o;n++)t=i[n],this.#ee.test(t.nodeName)?s+=t.outerHTML:8===t.nodeType?s+="\x3c!-- "+t.textContent+" --\x3e":/meta/i.test(t.nodeName)||this.#J.format.isLine(t)||this.#J.format.isBlock(t)||this.#J.component.is(t)||Ie.check.isExcludeFormat(t)?(e&&(s+=e.outerHTML,e=null),s+=t.outerHTML):(e||=Ie.utils.createElement(this.#ot.get("defaultLine")),this.#J.format.isTextStyleNode(t)&&t.removeAttribute("style"),e.appendChild(t),n--,o--);return e&&(s+=e.outerHTML),Os.createRange().createContextualFragment(s)}#ue(t){let e="";for(let s,i=0,n=t.length;i<n;i++)s=t[i],1===s.nodeType?Ie.check.isList(s)?e+=s.innerHTML:Ie.check.isListCell(s)?e+=s.outerHTML:this.#J.format.isLine(s)?e+="<li>"+(s.innerHTML.trim()||"<br>")+"</li>":this.#J.format.isBlock(s)&&!Ie.check.isTableElements(s)?e+=this.#ue(s.children):e+="<li>"+s.outerHTML+"</li>":e+="<li>"+(s.textContent||"<br>")+"</li>";return e}#ae(t){let e=!1;for(let s,i=0,n=t.length;i<n;i++)if(s=t[i],1===s.nodeType&&!this.#J.format.isTextStyleNode(s)&&!Ie.check.isBreak(s)&&!this.#te.test(s.nodeName)){e=!0;break}return e}#Ce(t,e,s){let i=(t.match(Ds)||[])[0];if(this.#Jt.includes(s)&&!i&&(t.match(Ws)||[])[1]){const e=(t.match(Zs)||[])[1],s=(t.match(Gs)||[])[1],n=(t.match(js)||[])[1];(e||s||n)&&(i='style="'+(e?"font-size:"+Ve.get(Number(e)/3.333,1)+"rem;":"")+(s?"font-family:"+s+";":"")+(n?"color:"+n+";":"")+'"')}if(i){let t;e||=[];for(const[e,i]of this.#Xt)if(e.test(s)){t=i;break}if(!t)return e;const n=i.replace(Ks,"").match(t);if(!n)return e;const o=[];for(let t,e=0,s=n.length;e<s;e++)if(t=n[e].match(Ys),t&&!Xs.test(t[3])){const e=Be.kebabToCamelCase(t[1].trim()),s=this.#Y.get("wwComputedStyle")[e]?.replace(Js,""),i=t[3].trim();switch(e){case"fontFamily":if(!this.#J.plugins.font||!this.#J.plugins.font.fontArray.includes(i))continue;break;case"fontSize":if(!this.#J.plugins.fontSize)continue;this.#zt.test(t[0])||(t[0]=t[0].replace((t[0].match(Qs)||[])[1],Be.toFontUnit.bind(null,this.#ot.get("fontSizeUnits")[0])));break;case"color":if(!this.#J.plugins.fontColor||ti.test(i))continue;break;case"backgroundColor":if(!this.#J.plugins.backgroundColor||ti.test(i))continue}s!==i&&o.push(t[0])}o.length>0&&e.push('style="'+o.join(";")+'"')}return e}#oe(t,e,s){return e.test("<font>")&&(t=t.replace(/(<\/?)font(\s?)/gi,"$1span$2")),t.replace(e,"").replace(s,"")}#pe(t,e){const s=t=>{this.#we(t,e);const i=t.childNodes;for(let t=0,e=i.length;t<e;t++)s(i[t])};s(t)}#we(t,e){if(!this.#J.format.isTextStyleNode(t))return;const s=(t.style.cssText.match(ei)||[]).map((function(t){return t.trim()})),i=t.nodeName;if(si.test(i)&&0===s.length)return t;const n=this.#J.format;let o=!1;return function e(l){if(!Ie.check.isWysiwygFrame(l)&&n.isTextStyleNode(l)){if(l.nodeName===i){o=!0;const e=l.style.cssText.match(ei)||[];for(let t,i=0,n=e.length;i<n;i++)(t=s.indexOf(e[i].trim()))>-1&&s.splice(t,1);for(let e=0,s=l.classList.length;e<s;e++)t.classList.remove(l.classList[e])}e(l.parentElement)}}(e),o&&((t.style.cssText=s.join(" "))||(t.setAttribute("style",""),t.removeAttribute("style")),0===t.attributes.length&&t.setAttribute("data-duple","true")),t}#le(t,e,s,i){if(Rs.test(s))return s;let n=null;const o=i.match(Ps)[0].toLowerCase();if(t){const t=this.#ie[o];s=s.replace(zs,""),s=t?s.replace(t,""):s.replace(this.#Kt,"");const e=this.#se[o];n=e?s.match(e):s.match(this.#jt)}if(!e)return s;if("a"===o){const t=s.match(/(?:(?:id|name)\s*=\s*(?:"|')[^"']*(?:"|'))/g);t&&(n||=[],n.push(t[0]))}else n&&Fs.test(n.toString())||(this.#Yt.test(o)?n=this.#Ce(s,n,o):this.#J.format.isLine(o)?n=this.#Ce(s,n,"@line"):this.#Jt.includes(o)&&(n=this.#Ce(s,n,"@text")));if(Ie.check.isMedia(o)||Ie.check.isFigure(o)){const t=s.match(Ds);n||=[],t&&n.push(t[0])}if(n)for(let t,e=0,s=n.length;e<s;e++)t=ai(n[e].trim())?n[e]:"",i+=(qs.test(t)?"":" ")+t;return i}__resetAutoStyleify(t){if(t.length>0){const e=this.#ot.get("convertTextTags"),s={};t.forEach((t=>{switch(t){case"bold":s.bold={regex:/font-weight\s*:\s*bold/i,tag:e.bold};break;case"italic":s.italic={regex:/font-style\s*:\s*italic/i,tag:e.italic};break;case"underline":s.underline={regex:/text-decoration\s*:\s*underline/i,tag:e.underline};break;case"strike":s.strike={regex:/text-decoration\s*:\s*line-through/i,tag:e.strike}}})),this.#ne=s}else this.#ne=null}_destroy(){this.#Xt&&this.#Xt.clear()}#be(t){if(1!==t.children.length||"CODE"!==t.firstElementChild?.nodeName)return;const e=t.firstElementChild,s=(e.className||"").match(/language-(\S+)/);for(s&&(Ie.utils.addClass(t,"language-"+s[1]),t.setAttribute("data-se-lang",s[1]));e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}#fe(t){const e=t.querySelectorAll('pre[class*="language-"]');for(let t,s,i,n=0,o=e.length;n<o;n++)if(t=e[n],s=(t.className.match(/language-(\S+)/)||[])[1],s){for(i=Ie.utils.createElement("CODE",{class:"language-"+s});t.firstChild;)i.appendChild(t.firstChild);t.appendChild(i),t.className=t.className.replace(/\s*language-\S+/g,"").trim(),t.removeAttribute("data-se-lang")}}};const di=class{#J;#ot;constructor(t){this.#J=t.$,this.#ot=this.#J.options}split(t,e,s){if(Ie.check.isWysiwygFrame(t)||this.#J.component.is(t)||!t)return t;if(e&&!Ve.is(e)){const s=t.childNodes;let i=Ie.query.getPositionIndex(e);const n=t.cloneNode(!1),o=t.cloneNode(!1);for(let t=0,e=s.length;t<e;t++){if(t<i)n.appendChild(s[t]);else{if(!(t>i))continue;o.appendChild(s[t])}t--,e--,i--}return n.childNodes.length>0&&t.parentNode.insertBefore(n,t),o.childNodes.length>0&&t.parentNode.insertBefore(o,t.nextElementSibling),t}const i=t.parentNode;let n,o,l,r=0,a=1,h=!0;if((!s||s<0)&&(s=0),Ie.check.isText(t)){if(r=Ie.query.getPositionIndex(t),(e=Number(e))>=0&&t.length!==e){t.splitText(e);const s=Ie.query.getNodeFromPath([r+1],i);Ie.check.isZeroWidth(s)&&(s.data=Ae.zeroWidthSpace)}}else if(1===t.nodeType){if(0===e){for(;t.firstChild;)t=t.firstChild;if(3===t.nodeType){const e=Ie.utils.createTextNode(Ae.zeroWidthSpace);t.parentNode.insertBefore(e,t),t=e}}t.previousSibling?t=t.previousSibling:Ie.query.getNodeDepth(t)===s&&(h=!1)}1===t.nodeType&&(a=0);let c=t;for(;Ie.query.getNodeDepth(c)>s;)for(r=Ie.query.getPositionIndex(c)+a,c=c.parentNode,l=n,n=c.cloneNode(!1),o=c.childNodes,l&&(Ie.check.isListCell(n)&&Ie.check.isList(l)&&l.firstElementChild?(n.innerHTML=l.firstElementChild.innerHTML,Ie.utils.removeItem(l.firstElementChild),l.children.length>0&&n.appendChild(l)):n.appendChild(l));o[r];)n.appendChild(o[r]);1===c.nodeType&&c.childNodes.length<=1&&!c.firstChild?.textContent?.length&&(c.innerHTML="<br>");const d=c.parentNode;return h&&(c=c.nextSibling),n?(this.mergeSameTags(n,null,!1),this.mergeNestedTags(n,Ie.check.isList),n.childNodes.length>0?d.insertBefore(n,c):n=c,Ie.check.isListCell(n)&&n.children&&Ie.check.isList(n.children[0])&&n.insertBefore(Ie.utils.createElement("BR"),n.children[0]),0===i.childNodes.length&&Ie.utils.removeItem(i),n):c}mergeSameTags(t,e,s){const i=e?e.length:0;let n=null;i&&(n=Array.apply(null,new Array(i)).map(Number.prototype.valueOf,0));const o=(t,l,r)=>{const a=t.childNodes;for(let h,c,d=0,u=a.length;d<u&&(h=a[d],c=a[d+1],h);d++)if(!(Ie.check.isBreak(h)||Ie.check.isMedia(h)||Ie.check.isInputElement(h)))if(s&&this.#J.inline._isIgnoreNodeChange(h)||!s&&(Ie.check.isTableElements(h)||Ie.check.isListCell(h)||this.#J.format.isLine(h)&&!this.#J.format.isBrLine(h)))(Ie.check.isTableElements(h)||Ie.check.isListCell(h))&&o(h,l+1,d);else{if(1===u&&t.nodeName===h.nodeName&&t.parentNode){if(i){let s,n,o,r,a;for(let c=0;c<i;c++)if(s=e[c],s&&s[l]===d){for(n=h,o=t,r=l,a=!0;r>=0;){if(Ie.utils.getArrayIndex(o.childNodes,n)!==s[r]){a=!1;break}n=h.parentNode,o=n.parentNode,r--}a&&(s.splice(l,1),s[l]=d)}}Ie.utils.copyTagAttributes(h,t),t.parentNode.insertBefore(h,t),Ie.utils.removeItem(t)}if(!c){1===h.nodeType&&o(h,l+1,d);break}if(h.nodeName===c.nodeName&&Ie.check.isSameAttributes(h,c)&&h.getAttribute?.("href")===c.getAttribute?.("href")){const t=h.childNodes;let s=0;for(let e=0,i=t.length;e<i;e++)t[e].textContent.length>0&&s++;const o=h.lastChild,a=c.firstChild;let u=0;if(o&&a){const t=3===o.nodeType&&3===a.nodeType;u=o.textContent.length;let h=o.previousSibling;for(;h&&3===h.nodeType;)u+=h.textContent.length,h=h.previousSibling;if(s>0&&3===o.nodeType&&3===a.nodeType&&(o.textContent.length>0||a.textContent.length>0)&&s--,i){let h=null;for(let c=0;c<i;c++)if(h=e[c],h&&h[l]>d){if(l>0&&h[l-1]!==r)continue;h[l]-=1,h[l+1]>=0&&h[l]===d&&(h[l+1]+=s,t&&o&&3===o.nodeType&&a&&3===a.nodeType&&(n[c]+=u))}}}if(3===h.nodeType){if(u=h.textContent.length,h.textContent+=c.textContent,i){let t=null;for(let o=0;o<i;o++)if(t=e[o],t&&t[l]>d){if(l>0&&t[l-1]!==r)continue;t[l]-=1,t[l+1]>=0&&t[l]===d&&(t[l+1]+=s,n[o]+=u)}}}else h.innerHTML+=c.innerHTML;Ie.utils.removeItem(c),d--}else 1===h.nodeType&&o(h,l+1,d)}};return o(t,0,0),n}mergeNestedTags(t,e){if("string"==typeof e){const t=new RegExp(`^(${e||".+"})$`,"i");e=e=>t.test(e.nodeName)}else"function"!=typeof e&&(e=()=>!0);!function t(s){let i=s.children;if(1===i.length&&i[0].nodeName===s.nodeName&&e(s)){const t=i[0];for(i=t.children;i[0];)s.appendChild(i[0]);s.removeChild(t)}for(let e=0,i=s.children.length;e<i;e++)t(s.children[e])}(t)}removeAllParents(t,e,s){if(!t)return null;let i=null;return e||=t=>{if(t===s||this.#J.component.is(t))return!1;const e=t.textContent.trim();return 0===e.length||/^(\n|\u200B)+$/.test(e)},function t(s){if(!Ie.check.isWysiwygFrame(s)){const n=s.parentNode;n&&e(s)&&(i={sc:s.previousElementSibling,ec:s.nextElementSibling},Ie.utils.removeItem(s),t(n))}}(t),i}removeEmptyNode(t,e,s){const i=this.#ot.get("allowedEmptyTags");e&&=Ie.query.getParentElement(e,(e=>t===e.parentElement));const n=s=>{if(this.#J.format._isNotTextNode(s)||s===e||Ie.check.isNonEditable(s))return 0;if(s===t||!Ie.check.isZeroWidth(s.textContent)||s.firstChild&&Ie.check.isBreak(s.firstChild)||s.querySelector(i)){const t=s.children;for(let e=0,s=t.length,i=0;e<s;e++)t[e+i]&&!this.#J.component.is(t[e+i])&&(i+=n(t[e+i]))}else if(s.parentNode)return s.parentNode.removeChild(s),-1;return 0};n(t),0===t.childNodes.length&&(s?Ie.utils.removeItem(t):t.innerHTML="<br>")}createNestedNode(t,e){"function"!=typeof e&&(e=()=>!0);const s=t[0].cloneNode(!1);let i=s;for(let s,n=1,o=t.length;n<o;n++)e(t[n])&&(s=t[n].cloneNode(!1),i.appendChild(s),i=s);return i.innerHTML="",{parent:s,inner:i}}};function ui(t){t&&!rt(t,"se-blink")&&(at(t,"se-blink"),o.setTimeout((()=>{ht(t,"se-blink")}),600))}const pi=class{#J;#Y;#Q;constructor(t){this.#J=t.$,this.#Y=this.#J.frameContext,this.#Q=this.#J.frameOptions}check(t){const e=this.#Q.get("charCounter_max");if(e){const s=this.getLength("string"==typeof t?t:"byte-html"===this.#Q.get("charCounter_type")&&1===t.nodeType?t.outerHTML:t.textContent);if(s>0&&s+this.getLength()>e)return ui(this.#Y.get("charWrapper")),!1}return!0}getLength(t){return"string"!=typeof t&&(t="byte-html"===this.#Q.get("charCounter_type")?this.#Y.get("wysiwyg").innerHTML:this.#Y.get("wysiwyg").textContent),/byte/.test(this.#Q.get("charCounter_type"))?this.getByteLength(t):t.length}getByteLength(t){if(!t||!t.toString)return 0;let e,s;return t=t.toString(),u?(s=decodeURIComponent(encodeURIComponent(t)).length,e=0,null!==encodeURIComponent(t).match(/(%0A|%0D)/gi)&&(e=encodeURIComponent(t).match(/(%0A|%0D)/gi).length),s+e):(s=(new TextEncoder).encode(t).length,e=0,null!==encodeURIComponent(t).match(/(%0A|%0D)/gi)&&(e=encodeURIComponent(t).match(/(%0A|%0D)/gi).length),s+e)}getWordCount(t){"string"!=typeof t&&(t=this.#Y.get("wysiwyg").innerText);const e=t.trim();return e?e.split(/\s+/).length:0}display(t){const e=t||this.#Y,s=e.get("charCounter"),i=e.get("wordCounter");(s||i)&&o.setTimeout((()=>{s&&(s.textContent=String(this.getLength())),i&&(i.textContent=String(this.getWordCount()))}),0)}test(t,e){let s=0;t&&(s=this.getLength(t)),this.display();const i=this.#Q.get("charCounter_max");if(i>0){let t=!1;const n=this.getLength();if(n>i){if(t=!0,s>0&&e){this.#J.selection.init();const t=this.#J.selection.getRange(),e=t.endOffset-1,s=this.#J.selection.getNode().textContent,i=t.endOffset-1;this.#J.selection.getNode().textContent=s.slice(0,i<0?0:i)+s.slice(t.endOffset,s.length),this.#J.selection.setRange(t.endContainer,e,t.endContainer,e)}}else n+s>i&&(t=!0);if(t&&(ui(this.#Y.get("charWrapper")),s>0))return!1}return!0}};const gi=class{#J;#ot;#_e=!1;constructor(t){this.#J=t.$,this.#ot=this.#J.options,this.keyMap=new Map,this.reverseKeys=new Set}command(t,e,s,i,n,o,l,r){if(this.#_e)return!1;let a=null;return a=e?this.keyMap.get(i+(s?"1000":"")):this.keyMap.get(n)||this.keyMap.get(n+t.key),!(!a||!s&&a.s||a.space&&!Oe.isSpace(i)||a.enter&&!Oe.isEnter(i)||a.textTrigger&&!t.key.trim()||a.edge&&!o)&&(a.plugin&&"string"==typeof a.method?this.#J.plugins[a.plugin][a.method]?.({range:r,line:l,info:a,event:t,keyCode:i}):"function"==typeof a.method?a.method({range:r,line:l,info:a,event:t,keyCode:i}):this.#J.commandDispatcher.run(a.command,a.type,a.button),!0)}disable(){this.#_e=!0}enable(){this.#_e=!1}_registerShortcuts(){const t=this.#ot.get("shortcuts"),e=this.#ot.get("_reverseCommandArray"),s=this.keyMap=new Map,i=this.reverseKeys;for(const n of Object.keys(t)){if(this.#J.plugins[n])continue;Qe(n.startsWith("_")?"":n,null,t[n],s,e,i)}}_destroy(){this.keyMap.clear(),this.reverseKeys.clear()}},mi=new Map([["__figureInst",null],["__dragInst",null],["__dragHandler",null],["__dragContainer",null],["__dragCover",null],["__dragMove",null],["__overInfo",null]]),fi=mi,{_w:vi,isMobile:bi,ON_OVER_COMPONENT:yi}=Ne,Ci="2147483646",wi="2147483645",_i="2147483642",xi="2147483641",$i={left:0,right:0,top:0};const ki=class{#J;#xe;#$e;#ke;#Se=$i;#Ee=!1;#Te=!1;#Me=null;#He=null;#Le=null;#Ne=[];#Ae=new Map;constructor(t,e,s,i,n){this.#J=e,this.kind=n||t.constructor.key||t.constructor.name,this.host=t,this.form=s,this.isOpen=!1,this.currentTarget=null,this.currentPositionTarget=null,this.isWWTarget=i.isWWTarget??!0,this.position=i.position||"bottom",this.disabled=!!i.disabled,this.parents=i.parents||[],this.parentsForm=[],this.parentsHide=!!i.parentsHide,this.sibling=i.sibling||null,this.siblingMain=!!i.siblingMain,this.isInsideForm=!!i.isInsideForm,this.isOutsideForm=!!i.isOutsideForm,this.toTop=!1,this.__offset={},this.#xe="function"==typeof i.initMethod?i.initMethod:null,this.#$e="function"==typeof i.escGuard?i.escGuard:null,this.#ke={keydown:this.#Be.bind(this),mousedown:this.#Ie.bind(this)};for(const t of this.parents)Ie.check.isElement(t)?this.parentsForm.push(t):(t.#Ne.push(this),this.parentsForm.push(t.form));this.form.setAttribute("popover","manual"),this.#J.contextProvider.carrierWrapper.appendChild(s),this.#J.eventManager.addEvent(s,"click",this.#Ve.bind(this)),this.#J.eventManager.addEvent(s,"mouseenter",this.#Oe.bind(this)),this.#J.eventManager.addEvent(s,"mouseleave",this.#Re.bind(this))}open(t,e,{isWWTarget:s,passive:i,initMethod:n,disabled:o,addOffset:l}={}){if(mi.get("__overInfo")===yi&&(i=!0),!t)return void console.warn("[SUNEDITOR.Controller.open.fail] The target element is required.");if(this.form.removeAttribute("data-se-hidden-by-parent"),this.form.removeAttribute("data-se-hidden-by-children"),this.#Ae.clear(),i||(this.#J.store.mode.isBalloon?this.#J.toolbar.hide():this.#J.store.mode.isSubBalloon&&this.#J.subToolbar.hide(),this.#J.store.get("hasFocus")||(o??this.disabled?this.#J.ui.setControllerOnDisabledButtons(!0):this.#J.ui.setControllerOnDisabledButtons(!1))),this.currentPositionTarget=e||t,this.isWWTarget=s??this.isWWTarget,"function"==typeof n&&(this.#xe=n),i||(this.#J.ui.currentControllerName=this.kind),this.#Se={left:0,right:0,top:0,...l},!i){const t=this.isOutsideForm?this.parentsForm:[];this.#J.ui.opendControllers?.forEach((e=>{t.includes(e.form)||(e.form.style.zIndex=xi)})),this.parentsHide&&this.parentsForm.forEach((t=>{t.style.display="none",t.setAttribute("data-se-hidden-by-children","1")}))}this.#Pe(),this.#ze(this.form,this.currentPositionTarget,!1);const r=this.#J.instanceCheck.isRange(t);this.currentTarget=r?null:t,this.#Fe(this.form,t,r,i),vi.setTimeout((()=>mi.set("__overInfo",!1)),0)}close(t){(t||this.isOpen&&!this.#Te)&&(this.form.removeAttribute("data-se-hidden-by-parent"),this.form.removeAttribute("data-se-hidden-by-children"),this.#Ae.clear(),this.#De("close"),this.toTop=!1,this.isOpen=!1,this.#Te=!1,this.__offset={},this.#Se=$i,this.#qe(),this.#xe?.(),this.#We(),this.parentsHide&&!t&&this.parentsForm.forEach((t=>{t.style.display="block",t.removeAttribute("data-se-hidden-by-children")})),this.host.controllerClose?.(),this.parentsForm.length>0||this.#J.component.deselect())}hide(){this.#De("hide"),this.form.style.display="none"}show(){this.#ze(this.form,this.currentPositionTarget,!1)}bringToTop(t){this.toTop=t,this.form.style.zIndex=t?Ci:wi}resetPosition(t){this.#ze(this.form,t||this.currentPositionTarget,!0)}_scrollReposition(){this.form.hasAttribute("data-se-hidden-by-parent")||this.form.hasAttribute("data-se-hidden-by-children")||this.#ze(this.form,this.currentPositionTarget,!1)&&vi.setTimeout((()=>{this.#De("show")}),0)}#De(t){for(const e of this.#Ne)if("hide"===t&&"none"!==e.form.style.display){const t=this.#Ue(e);e.#Ae.set(this,!0);const s=this.#Ue(e);!t&&s&&(e.form.setAttribute("data-se-hidden-by-parent","1"),e.hide())}else if("show"===t){if(e.form.hasAttribute("data-se-hidden-by-children")){e.#De("show");continue}const t=this.#Ue(e);e.#Ae.set(this,!1);const s=this.#Ue(e);t&&!s&&(e.form.removeAttribute("data-se-hidden-by-parent"),e.show())}else e[t]?.(!0)}#Ue(t){for(const e of t.#Ae.values())if(!0===e)return!0;return!1}async#Fe(t,e,s,i){const n={position:this.position,inst:this,form:t,target:e,isRangeTarget:s,notInCarrier:!this.#J.contextProvider.carrierWrapper.contains(t)};!1!==await this.#J.eventManager.triggerEvent("onBeforeShowController",{caller:this.kind,frameContext:this.#J.frameContext,info:n})&&(t.style.display="block",this.#J.contextProvider.shadowRoot&&(this.#Me=this.#J.eventManager.addEvent(t,"mousedown",(t=>t.stopPropagation()))),i||(this.#J.ui.onControllerContext(),this.#J.store.set("controlActive",!0),this.#J.store.set("_preventBlur",!0)),this.isOpen||this.#J.ui.opendControllers.push(n),this.isOpen=!0,this.host.controllerOn?.(t,e),this.#J.eventManager.triggerEvent("onShowController",{caller:this.kind,frameContext:this.#J.frameContext,info:n}))}#We(){this.form.hidePopover?.(),this.form.style.display="none",this.#J.ui.opendControllers=this.#J.ui.opendControllers.filter((t=>t.form!==this.form)),this.#J.ui.currentControllerName!==this.kind&&this.#J.ui.opendControllers.length>0||(this.#J.ui.setControllerOnDisabledButtons(!1),this.#J.ui.offControllerContext(),this.#J.frameContext.get("lineBreaker_t").style.display=this.#J.frameContext.get("lineBreaker_b").style.display="none",this.#J.store.set("_lastSelectionNode",null),this.#J.ui.currentControllerName="",this.#J.store.set("_preventBlur",!1),vi.setTimeout((()=>{this.#J.store.set("controlActive",!1)}),0),this.#Me&&=this.#J.eventManager.removeEvent(this.#Me))}#ze(t,e,s){if(!e)return!1;if(t.style.visibility="hidden",t.style.display="block",this.sibling&&"block"!==this.sibling.style.display&&(this.sibling.style.visibility="hidden",this.sibling.style.display="block"),this.#J.selection.isRange(e)){if(!this.#J.offset.setRangePosition(this.form,e,{position:"bottom"}))return this.hide(),!1}else{const i=this.#J.offset.setAbsPosition(t,e,{addOffset:this.#Se,position:this.position,isWWTarget:this.isWWTarget,inst:this,sibling:this.sibling});if(!i)return this.hide(),!1;if(s||!this.sibling||this.siblingMain)this.#Ee=!1;else{const e=t.offsetTop-this.#Se.top;"bottom"===i.position?(this.#Ee=!0,t.style.top=e+this.sibling.offsetHeight-1+"px"):(this.#Ee=!1,t.style.top=e-this.sibling.offsetHeight+2+"px")}}return t.style.zIndex=this.toTop?wi:this.#Ee?_i:xi,t.style.visibility="",t.showPopover?.(),!0}#Pe(){this.#qe(),this.#He=this.#J.eventManager.addGlobalEvent("keydown",this.#ke.keydown,!0),this.#Le=this.#J.eventManager.addGlobalEvent(bi?"click":"mousedown",this.#ke.mousedown,!0)}#qe(){this.#J.component.__removeGlobalEvent(),this.#He&&=this.#J.eventManager.removeGlobalEvent(this.#He),this.#Le&&=this.#J.eventManager.removeGlobalEvent(this.#Le)}#Ze(){if(this.#J.ui.selectMenuOn)return!0;const t=this.#J.ui.opendControllers;for(let e=0;e<t.length;e++)if(t[e].inst===this&&t[e].fixed)return!0;return!1}#Ge(t){if(Ie.check.isWysiwygFrame(t)||t.contains(this.form))return!1;if(Ie.utils.hasClass(t,"se-drag-handle"))return!0;let e=!1;this.isInsideForm&&this.parentsForm?.length>0&&this.parentsForm.some((s=>{if(s.contains(t))return e=!0,!0}));const s=this.host._element;return!e&&(!!Ie.query.getParentElement(t,".se-controller")||(this.#J.component.isInline(s)?t===s:t?.contains(s)))}#Ve(t){const e=Ie.query.getEventTarget(t),s=Ie.query.getCommandTarget(e);s&&(t.stopPropagation(),t.preventDefault(),"close"!==s.getAttribute("data-command")?this.host.controllerAction(s):this.close())}#Oe(t){if(this.#J.ui.currentControllerName=this.kind,this.parentsForm.length>0&&this.isInsideForm)return;Ie.query.getEventTarget(t).style.zIndex=this.toTop?Ci:wi}#Re(t){if(this.parentsForm.length>0&&this.isInsideForm)return;Ie.query.getEventTarget(t).style.zIndex=this.toTop?wi:this.#Ee?_i:xi}#Be(t){if(this.#Ze())return;const e=t.code;if(Oe.isCtrl(t)||!Oe.isNonResponseKey(e))return;const s=Ie.query.getEventTarget(t);if(Oe.isEsc(e)){if(this.#Ne.some((({isOpen:t})=>t)))return;if(this.#$e?.())return}else{if(this.form.contains(s)||this.#Ge(s))return;if(this.#J.pluginManager.fileInfo.pluginRegExp.test(this.kind))return}this.#je(s),this.close()}#Ie(t){const e=Ie.query.getEventTarget(t);this.host?._element?.contains(e)?this.#Te=!0:(this.#Te=!1,e===this.host._element||e===this.currentTarget||this.#Ze()||this.form.contains(e)||this.#Ge(e)||Ie.query.getParentElement(e,".se-line-breaker-component")||(this.#je(e),this.close(!0)))}#je(t){this.#J.frameContext.get("wysiwyg").contains(t)||(this.#J.component.__prevent=!1)}},{_w:Si}=Ne;const Ei=class{#J;#Ke;#Ye;#Xe;#Je;#ke;#Qe=null;#ts=null;#es=null;#ss=null;#He=null;#is=null;#ns=null;#os=null;#st=null;#ls=null;#rs=null;#as=new Map;#hs=-1;#cs=-1;#ds=!1;#us=null;constructor(t,e){this.#J=t;const s=e.position.split("-");this.form=null,this.items=[],this.menus=null,this.menuLen=0,this.index=-1,this.item=null,this.isOpen=!1,this.checkList=!!e.checkList,this.position=s[0],this.subPosition=s[1],this.splitNum=e.splitNum||0,this.horizontal=!!this.splitNum,this.openMethod=e.openMethod,this.closeMethod=e.closeMethod,this.subEscMethod=e.subEscMethod||null,this.maxHeight=e.maxHeight||"",this.minWidth=e.minWidth||"",this.#es=e.keydownTarget||null,this.#Ke=/^(left|right)$/.test(this.position)?"left"===this.position?"right":"left":this.position,this.#Ye=/^(left|right)$/.test(this.subPosition)?"left"===this.subPosition?"right":"left":this.subPosition,this.#Xe="ltr"!==e.dir&&("rtl"===e.dir||null),this.#Je={mousedown:this.#ps.bind(this),mousemove:this.#gs.bind(this),click:this.#ms.bind(this),keydown:this.#fs.bind(this)},this.#ke={keydown:this.#vs.bind(this),mousedown:this.#Ie.bind(this),click:this.#bs.bind(this),submenuReposition:this.#ys.bind(this)}}create(t,e){this.form.firstElementChild.innerHTML="";for(const[,t]of this.#as)t.element?.remove();this.#as.clear(),e||=t;let s="";for(let i=0,n=e.length;i<n;i++){i>0&&i%this.splitNum==0&&(this.#Cs(s),s="");const n=t[i],o="string"==typeof e[i]?e[i]:e[i].outerHTML,l=n&&"object"==typeof n?n:{};if(l.children?.length>0){let t="";const e=l.childMenus||l.children;for(let s=0;s<e.length;s++)t+=`<li class="se-select-item" data-parent-index="${i}" data-child-index="${s}">${"string"==typeof e[s]?e[s]:e[s].outerHTML}</li>`;s+=`<li class="se-select-item se-has-submenu" data-index="${i}">${o}<span class="se-submenu-arrow">${this.#J.icons.menu_arrow_right}</span></li>`;const n=Ie.utils.createElement("DIV",{class:"se-select-submenu",popover:"manual","data-parent-index":String(i)},`<ul class="se-list-basic se-list-checked">${t}</ul>`);this.#as.set(i,{items:l.children,menus:e,element:n})}else s+=`<li class="se-select-item" data-index="${i}">${o}</li>`}this.#Cs(s);for(const[,t]of this.#as)this.form.appendChild(t.element);this.items=t,this.menus=Array.from(this.form.querySelectorAll("li[data-index]")),this.menuLen=this.menus.length}on(t,e,s={}){this.#Qe=t,this.#ts=this.#es||(Ie.check.isInputElement(t)?t:this.#J.frameContext.get("_ww")),this.#ss=e;let i="";this.maxHeight&&(i+="max-height:"+this.maxHeight+";overflow-y:auto;"),this.minWidth&&(i+="min-width:"+this.minWidth+";"),this.form=Ie.utils.createElement("DIV",{class:"se-select-menu"+(!0===this.#Xe?" se-rtl":"")+(s.class?" "+s.class:""),style:s.style||""},'<div class="se-list-inner"'+(i?' style="'+i+'"':"")+"></div>"),t.parentNode.insertBefore(this.form,t)}open(t,e){this.#J.ui.selectMenuOn=!0,this.openMethod?.(),this.#ws(),this.#Pe();const s=t?t.split("-"):[],i=s[0]||(null!==this.#Xe&&this.#Xe!==this.#J.options.get("_rtl")?this.#Ke:this.position),n=s[1]||(null!==this.#Xe&&this.#Xe!==this.#J.options.get("_rtl")?this.#Ye:this.subPosition);this.#ls=i,this.#rs=n,this.#_s(i,n,e),this.isOpen=!0}reposition(){this.isOpen&&this.#ls&&this.#_s(this.#ls,this.#rs)}setHidden(t){this.isOpen&&(t?(this.#xs(),this.form.style.display="none"):this.reposition())}close(){this.#J.ui.selectMenuOn=!1,Ie.utils.removeClass(this.#Qe,"on"),this.#$s(),this.form?.removeAttribute("style"),this.isOpen=!1,this.closeMethod?.()}getItem(t){return this.items[t]}setItem(t){this.#ks(t)}hasOpenSubmenu(){return this.#hs>-1}#Ss(t){if(this.#hs===t)return;this.#xs();const e=this.menus[t];if(!e||!Ie.utils.hasClass(e,"se-has-submenu"))return;Ie.utils.addClass(e,"se-submenu-open"),this.#hs=t,this.#cs=-1,this.#ds=!1;const s=this.#as.get(t),i=s?.element;if(i){const t="function"==typeof i.showPopover;i.style.visibility="hidden",t?i.matches(":popover-open")||i.showPopover():i.style.display="block",this.#Es(e,i,t),i.style.visibility="",this.#os=this.#J.eventManager.addGlobalEvent("scroll",this.#ke.submenuReposition,!0)}}#Es(t,e,s){const i=s?{top:0,left:0}:this.form.getBoundingClientRect(),n=t.getBoundingClientRect(),o=e.offsetWidth,l=e.offsetHeight,r=Si.innerWidth,a=Si.innerHeight,h=n.right,c=n.left-o,d=Math.max(0,h+o-r),u=Math.max(0,-c);let p;p=!0===this.#Xe?0===u?c:0===d?h:u<=d?c+u:h-d:0===d?h:0===u?c:d<=u?h-d:c+u,e.style.left=p-i.left+"px",e.style.right="";const g=n.top,m=n.bottom-l,f=Math.max(0,g+l-a),v=Math.max(0,-m);let b;b=0===f?g:0===v?m:f<=v?g-f:m+v,e.style.top=b-i.top+"px"}#ys(){if(this.#hs<0)return;const t=this.#as.get(this.#hs),e=t?.element,s=this.menus[this.#hs];e&&s&&this.#Es(s,e,"function"==typeof e.showPopover)}#xs(){if(this.#us&&(Si.clearTimeout(this.#us),this.#us=null),this.#os&&=this.#J.eventManager.removeGlobalEvent(this.#os),this.#hs>-1){const t=this.menus[this.#hs];t&&Ie.utils.removeClass(t,"se-submenu-open");const e=this.#as.get(this.#hs);e?.element&&("function"==typeof e.element.hidePopover?e.element.matches(":popover-open")&&e.element.hidePopover():e.element.style.display="",Ie.utils.removeClass(e.element.querySelectorAll(".se-select-item"),"se-select-cursor"))}this.#hs=-1,this.#cs=-1,this.#ds=!1}#Ts(t,e){const s=this.#as.get(t);if(s){if(this.checkList){const t=s.element?.querySelectorAll(".se-select-item")[e];t&&Ie.utils.toggleClass(t,"se-checked")}this.#ss(s.items[e])}}#Ms(t){const e=this.#as.get(this.#hs);if(!e?.element)return;const s=e.element.querySelectorAll(".se-select-item"),i=s.length;if(!i)return;t=this.#cs+t;const n=this.#cs=t>=i?0:t<0?i-1:t;Ie.utils.removeClass(this.form,"se-select-menu-mouse-move");for(let t=0;t<i;t++)t===n?Ie.utils.addClass(s[t],"se-select-cursor"):Ie.utils.removeClass(s[t],"se-select-cursor")}#Cs(t){this.form.firstElementChild.innerHTML+=`<ul class="se-list-basic se-list-checked${this.horizontal?" se-list-horizontal":""}">${t}</ul>`}#$s(){this.#Hs(),this.#qe(),this.#xs(),this.index=-1,this.item=null,this._onItem&&(Ie.utils.removeClass(this._onItem,"se-select-on"),this._onItem=null)}#Ls(t){t=this.index+t;const e=this.menuLen,s=this.index=t>=e?0:t<0?e-1:t;this.#ks(s)}#ks(t){Ie.utils.removeClass(this.form,"se-select-menu-mouse-move");const e=this.menuLen;for(let s=0;s<e;s++)s===t?Ie.utils.addClass(this.menus[s],"se-select-cursor"):Ie.utils.removeClass(this.menus[s],"se-select-cursor");this.index=t,this.item=this.items[t]}#_s(t,e,s,i){const n=t,o=this.form,l=this.#Qe;o.style.visibility="hidden",o.style.display="block",Ie.utils.removeClass(o,"se-select-menu-scroll"),Ie.utils.addClass(l,"on");const r=o.offsetWidth,a=l.offsetWidth,h=l.offsetLeft;let c=!1,d=0,u=0;"left"===t?(d=h-r-1,t=e,c=!0):"right"===t&&(d=h+a+1,t=e,c=!0);const p=this.#J.offset.get(l),g=l.offsetTop,m=p.top,f=l.offsetHeight,v=Ie.utils.getClientSize().h-(m-Si.scrollY+f),b=c?f:0;let y=1e4;switch(t){case"middle":{let t=o.offsetHeight;const e=f/2;u=g-t/2+e,m<t/2&&(u+=t/2-m-e+4,o.style.top=u+"px");let s=this.#J.offset.getGlobal(o).top;const i=t-(m-s)-v-f;i>0&&(u-=i+4,o.style.top=u+"px"),s=this.#J.offset.getGlobal(o).top,s<0&&(t+=s-4,u-=s-4),o.style.height=t+"px";break}case"top":if(m<o.offsetHeight-b){if(!i){y=0;break}y=m-4+b,y>=38&&(o.style.height=y+"px")}u=g-o.offsetHeight+b;break;case"bottom":if(v<o.offsetHeight+b){if(!i){y=0;break}y=v-4+b,y>=38&&(o.style.height=y+"px")}u=g+(c?0:f)}if(y<38&&!i&&"middle"!==t)return void this.#_s("top"===t?"bottom":"top",e,s,!0);if(!c)switch(e){case"center":d=h+a/2-r/2;break;case"left":d=h;break;case"right":d=h-(r-a)}o.style.left=d+"px";let C=this.#J.offset.getGlobal(o).fixedLeft,w=0;switch(c+"-"+(c?n:e)){case"true-left":C<0&&(d=h+a+1);break;case"true-right":C+r>Si.innerWidth&&(d=h-r-1);break;case"false-center":w=Si.innerWidth-(C+r),w<0&&(d+=w-4),o.style.left=d+"px",C=this.#J.offset.getGlobal(o).fixedLeft,C<0&&(d-=C-4);break;case"false-left":w=Si.innerWidth-(C+r),w<0&&(d+=w-4);break;case"false-right":C<0&&(d-=C-4)}if(s){const t=o.firstElementChild.querySelector(s);t&&(this._onItem=t,Ie.utils.addClass(t,"se-select-on"))}o.style.left=d+"px",o.style.top=u+"px",o.style.visibility=""}#Ns(t){this.checkList&&Ie.utils.toggleClass(this.menus[t],"se-checked"),this.#ss(this.getItem(t))}#ws(){this.#Hs(),this.#st={mousedown:this.#J.eventManager.addEvent(this.form,"mousedown",this.#Je.mousedown),mousemove:this.#J.eventManager.addEvent(this.form,"mousemove",this.#Je.mousemove),click:this.#J.eventManager.addEvent(this.form,"click",this.#Je.click),keydown:this.#J.eventManager.addEvent(this.#ts,"keydown",this.#Je.keydown)}}#Hs(){this.#st&&(this.#J.eventManager.removeEvent(this.#st.mousedown),this.#J.eventManager.removeEvent(this.#st.mousemove),this.#J.eventManager.removeEvent(this.#st.click),this.#J.eventManager.removeEvent(this.#st.keydown),this.#st=null)}#Pe(){this.#qe(),this.#He=this.#J.eventManager.addGlobalEvent("keydown",this.#ke.keydown,!0),this.#is=this.#J.eventManager.addGlobalEvent("mousedown",this.#ke.mousedown,!0)}#qe(){this.#He&&=this.#J.eventManager.removeGlobalEvent(this.#He),this.#is&&=this.#J.eventManager.removeGlobalEvent(this.#is),this.#ns&&=this.#J.eventManager.removeGlobalEvent(this.#ns)}#fs(t){if(this.#ds)switch(t.code){case"ArrowUp":return t.preventDefault(),t.stopPropagation(),void this.#Ms(-1);case"ArrowDown":return t.preventDefault(),t.stopPropagation(),void this.#Ms(1);case"ArrowLeft":t.preventDefault(),t.stopPropagation(),this.#ds=!1,this.#cs=-1;{const t=this.#as.get(this.#hs);t?.element&&Ie.utils.removeClass(t.element.querySelectorAll(".se-select-item"),"se-select-cursor")}return;case"Enter":case"Space":return void(this.#cs>-1&&(t.preventDefault(),t.stopPropagation(),this.#Ts(this.#hs,this.#cs)))}let e;switch(t.code){case"ArrowUp":if(t.preventDefault(),t.stopPropagation(),this.horizontal&&this.index>-1){const t=this.splitNum;e=this.index-t<0?t:-t}else e=-1;break;case"ArrowDown":if(t.preventDefault(),t.stopPropagation(),this.horizontal&&this.index>-1){const t=this.splitNum;e=this.index+t>this.menuLen?-t:t}else e=1;break;case"ArrowLeft":t.preventDefault(),t.stopPropagation(),e=-1;break;case"ArrowRight":if(t.preventDefault(),t.stopPropagation(),this.index>-1&&this.#as.has(this.index))return this.#Ss(this.index),this.#ds=!0,void this.#Ms(1);e=1;break;case"Enter":case"Space":this.index>-1&&(t.preventDefault(),t.stopPropagation(),this.#as.has(this.index)?(this.#Ss(this.index),this.#ds=!0,this.#Ms(1)):this.#Ns(this.index))}e&&(this.#xs(),this.#Ls(e))}#ps(t){if(Ne.isGecko){const e=Ie.query.getEventTarget(t),s=Ie.query.getParentElement(e,".se-select-item");s&&this.#J.eventManager._injectActiveEvent(s)}}#gs(t){const e=Ie.query.getEventTarget(t);Ie.utils.addClass(this.form,"se-select-menu-mouse-move");const s=e.closest?.("[data-child-index]"),i=s?.getAttribute("data-child-index");if(null!=i){this.#cs=Number(i);const t=this.#as.get(this.#hs);if(t?.element){const e=t.element.querySelectorAll(".se-select-item");Ie.utils.removeClass(e,"se-select-cursor"),Ie.utils.addClass(e[this.#cs],"se-select-cursor")}return}const n=e.closest?.("[data-index]"),o=n?.getAttribute("data-index");if(!o)return;const l=Number(o);if(this.index=l,this.#as.has(l))this.#us&&Si.clearTimeout(this.#us),this.#Ss(l);else if(this.#hs>-1){const t=this.#as.get(this.#hs);t?.element?.contains(e)||this.#xs()}}#ms(t){let e=Ie.query.getEventTarget(t),s=null,i=null;for(;!(s||i||/UL/i.test(e.tagName)||Ie.utils.hasClass(e,"se-select-menu"));)i=e.getAttribute("data-child-index"),i||(s=e.getAttribute("data-index")),e=e.parentElement;if(null!==i){let t=e,s=null;for(;!s&&t;)s=t.getAttribute("data-parent-index")||t.getAttribute("data-index"),t=t.parentElement;return void(null!==s&&this.#Ts(Number(s),Number(i)))}if(!s)return;const n=Number(s);this.#as.has(n)?this.#hs===n?this.#xs():this.#Ss(n):this.#Ns(n)}#vs(t){if(Oe.isEsc(t.code)){if(this.#hs>-1){t.preventDefault(),t.stopPropagation();const e=this.#hs;return this.#xs(),void this.#ks(e)}if(this.subEscMethod?.())return t.preventDefault(),void t.stopPropagation();this.close()}}#Ie(t){const e=Ie.query.getEventTarget(t);this.form.contains(e)||(this.#Qe.contains(e)?Ie.check.isInputElement(e)||(this.#ns=this.#J.eventManager.addGlobalEvent("click",this.#ke.click,!0)):this.close())}#bs(t){this.#ns=this.#J.eventManager.removeGlobalEvent(this.#ns),t.target===this.#Qe&&(t.stopPropagation(),this.close())}},{_w:Ti,ON_OVER_COMPONENT:Mi}=Ne,Hi={tl:"nwse-resize",tr:"nesw-resize",bl:"nesw-resize",br:"nwse-resize",lw:"ew-resize",th:"ns-resize",rw:"ew-resize",bh:"ns-resize"};let Li=!1,Ni=!1,Ai=0,Bi=0;class Ii{#J;#As;#Bs;#Is="";#Vs="";#Os=0;#Rs=0;#Ps=0;#zs=0;#Fs="__se__float-none|__se__float-left|__se__float-center|__se__float-right";#Ds=!1;#qs={w:"",h:""};#Ws=null;constructor(t,e,s,i){this.#J=e,this.kind=t.constructor.key||t.constructor.name,this._alignIcons={none:this.#J.icons.format_float_none,left:this.#J.icons.format_float_left,right:this.#J.icons.format_float_right,center:this.#J.icons.format_float_center},this._action={};const n=function(t,e,s){let i=null;if(s?.length>0){const{lang:n,icons:o}=e;i='<div class="se-arrow se-arrow-up"></div>';for(let e,l=0;l<s.length;l++){e=s[l],i+='<div class="se-btn-group">';for(let s,l=0,r=e.length;l<r;l++){if(s=e[l],"function"==typeof s?.action){const e=s;s={c:`__c__${e.command}`,v:e.value||"",l:e.title,i:e.icon},t._action[s.c]=e.action}else if(s=Ri(s),!s)continue;i+=`\n\t\t\t\t\t<button type="button" data-command="${s.c}" data-value="${s.v}" class="se-btn se-tooltip">\n\t\t\t\t\t\t${o[s.i]||s.i}\n\t\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${n[s.l]||s.l}</span></span>\n\t\t\t\t\t</button>`}i+="</div>"}}return i?Ie.utils.createElement("DIV",{class:"se-controller se-controller-resizing"},i):null}(this,e,s||[]);if(this.controller=n?new ki(this,e,n,{position:"bottom",disabled:!0},this.kind):null,n){this.alignButton=n.querySelector('[data-command="onalign"]');const t=function(t,e,s){if(!s)return null;const i=[t._alignIcons.none,t._alignIcons.left,t._alignIcons.center,t._alignIcons.right],n=[e.lang.basic,e.lang.left,e.lang.center,e.lang.right],o=["none","left","center","right"],l=[],r=[];for(let t=0;t<o.length;t++)l.push(`\n\t\t<button type="button" class="se-btn-list se-tooltip" data-command="${o[t]}" data-type="selectMenu" >\n\t\t\t${i[t]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${n[t]}</span>\n\t\t\t</span>\n\t\t</button>`),r.push(o[t]);return{html:l,items:r}}(this,e,this.alignButton);t&&(this.selectMenu_align=new Ei(e,{checkList:!1,position:"bottom-center"}),this.selectMenu_align.on(this.alignButton,this.#Us.bind(this),{class:"se-figure-select-list"}),this.selectMenu_align.create(t.items,t.html)),this.asButton=n.querySelector('[data-command="onas"]');const s=function(t,e){if(!e)return null;const s=[t.icons.as_block,t.icons.as_inline],i=[t.lang.asBlock,t.lang.asInline],n=["block","inline"],o=[],l=[];for(let t=0;t<n.length;t++)o.push(`\n\t\t<button type="button" class="se-btn-list se-tooltip" data-command="${n[t]}" data-type="selectMenu" >\n\t\t\t${s[t]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${i[t]}</span>\n\t\t\t</span>\n\t\t</button>`),l.push(n[t]);return{html:o,items:l}}(e,this.asButton);s&&(this.selectMenu_as=new Ei(e,{checkList:!1,position:"bottom-center"}),this.selectMenu_as.on(this.asButton,this.#Zs.bind(this),{class:"se-figure-select-list"}),this.selectMenu_as.create(s.items,s.html)),this.resizeButton=n.querySelector('[data-command="onresize"]');const i=function(t,e){if(!e)return null;const s=e.getAttribute("data-value").split(","),i=[];for(let e,n,o,l,r=0;r<s.length;r++)o=s[r],e=Ve.is(o),n=e?"resize_percent"+o:"auto",l=e?o+"%":t.lang.autoSize,i.push('<button type="button" class="se-btn-list" data-command="'+n+'" data-value="'+o+'"><span>'+l+"</span></button>");return{html:i,items:s}}(e,this.resizeButton);i&&(this.selectMenu_resize=new Ei(e,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.selectMenu_resize.on(this.resizeButton,this.#Gs.bind(this)),this.selectMenu_resize.create(i.items,i.html))}this.inst=t,this.sizeUnit=i.sizeUnit||"px",this.autoRatio=i.autoRatio,this.isVertical=!1,this.percentageButtons=n?.querySelectorAll('[data-command="resize_percent"]')||[],this.captionButton=n?.querySelector('[data-command="caption"]'),this.align="none",this.as="block",this.__offset={},this._element=null,this._cover=null,this._inlineCover=null,this._container=null,this._caption=null,this._resizeClientX=0,this._resizeClientY=0,this._resize_direction="",this.__containerResizingOff=this.#js.bind(this),this.__containerResizing=this.#Ks.bind(this),this.__onContainerEvent=null,this.__offContainerEvent=null,this.#As=this.#Ys.bind(this),this.#Bs=this.#Xs.bind(this),this.#J.eventManager.addEvent(this.alignButton,"click",this.#Js.bind(this)),this.#J.eventManager.addEvent(this.asButton,"click",this.#Qs.bind(this)),this.#J.eventManager.addEvent(this.resizeButton,"click",this.#ti.bind(this)),this.#J.contextProvider.applyToRoots((t=>{if(!t.get("wrapper").querySelector(".se-controller.se-resizing-container")){const e=function(){const t='\n\t\t<div class="se-resize-dot">\n\t\t\t<span class="tl"></span>\n\t\t\t<span class="tr"></span>\n\t\t\t<span class="bl"></span>\n\t\t\t<span class="br"></span>\n\t\t\t<span class="lw"></span>\n\t\t\t<span class="th"></span>\n\t\t\t<span class="rw"></span>\n\t\t\t<span class="bh"></span>\n\t\t\t<div class="se-resize-display"></div>\n\t\t</div>';return Ie.utils.createElement("DIV",{class:"se-controller se-resizing-container",style:"display: none;"},t)}(),s=e.querySelectorAll(".se-resize-dot > span");t.set("_figure",{main:e,border:e.querySelector(".se-resize-dot"),display:e.querySelector(".se-resize-display"),handles:s}),t.get("wrapper").appendChild(e),this.#J.eventManager.addEvent(s,"mousedown",this.#ei.bind(this))}}))}static CreateContainer(t,e){return Ie.utils.createElement("DIV",{class:"se-component"+(e?" "+e:"")},Ie.utils.createElement("FIGURE",null,t)),Ii.GetContainer(t)}static CreateInlineContainer(t,e){return Ie.utils.createElement("SPAN",{class:"se-component se-inline-component"+(e?" "+e:"")},t),Ii.GetContainer(t)}static CreateCaption(t,e){const s=Ie.utils.createElement("FIGCAPTION",null,"<div>"+e+"</div>");return t.appendChild(s),s}static GetContainer(t){const e=Ie.query.getParentElement(t,"FIGURE",2),s=Ie.query.getParentElement(t,"SPAN",2),i=e||s;let n=Ie.query.getParentElement(t,(t=>t.parentElement===i),0)||t;if(Ie.check.isAnchor(n)){const t=n.querySelector(":scope > img");t&&(n=t)}return{target:n,container:Ie.query.getParentElement(n,Ii.is,3)||e,cover:e,inlineCover:Ie.utils.hasClass(s,"se-inline-component")?s:null,caption:Ie.query.getEdgeChild(n.parentElement,"FIGCAPTION",!1),isVertical:Oi(n)}}static GetRatio(t,e,s){let i=0,n=0;if(/\d+/.test(t+"")&&/\d+/.test(e+"")){if((!Ve.is(t)&&String(t).replace(/\d+|\./g,"")||s||"px")===(!Ve.is(e)&&String(e).replace(/\d+|\./g,"")||s||"px")){const s=Ve.get(t,4),o=Ve.get(e,4);i=s/o,n=o/s}}return{w:Ve.get(i,4),h:Ve.get(n,4)}}static CalcRatio(t,e,s,i){if(i?.w&&i?.h&&/\d+/.test(t+"")&&/\d+/.test(e+"")){const n=!Ve.is(t)&&String(t).replace(/\d+|\./g,"")||s||"px",o=!Ve.is(e)&&String(e).replace(/\d+|\./g,"")||s||"px";if(n===o){const s="%"===n?2:0,l=t,r=e;e=Ve.get(i.h*Ve.get(l,s),s)+o,t=Ve.get(i.w*Ve.get(r,s),s)+n}}return{w:t,h:e}}static is(t){return Ie.check.isComponentContainer(t)||/^(HR)$/.test(t?.nodeName)}close(){this.#J.store.set("_preventBlur",!1),Ie.utils.removeClass(this._cover,"se-figure-selected"),this.#J.component.__removeDragEvent(),this.#si(),this.controller?.close()}open(t,{nonResizing:e,nonSizeInfo:s,nonBorder:i,figureTarget:n,infoOnly:o}){if(!t)return void console.warn('[SUNEDITOR.modules.Figure.open] The "targetNode" is null.');mi.get("__overInfo")===Mi&&(i=!0);const l=Ii.GetContainer(t),r=l.target;let a=!1;if(!l.container){if(this.#J.options.get("strictMode").formatFilter)return{container:null,cover:null,width:r.style.width||r.width||"",height:r.style.height||r.height||"",isVertical:this.isVertical};l.container=r,l.cover=r,a=!0}mi.set("__figureInst",this),this.#ii(l);const h=n&&(this._cover||this._container)||r,c=h.offsetWidth||null,d=h.offsetHeight||null,{top:u,left:p,scrollX:g,scrollY:m}=this.#J.offset.getLocal(h),f=(r.getAttribute("data-se-size")||"").split(",");let v=Ve.get(r.style.width,2)||c,b=Ve.get(r.style.height,2)||d;this.isVertical&&([v,b]=[b,v]);const y=Ii.GetRatio(v,b,this.sizeUnit),C={container:l.container,cover:l.cover,caption:l.caption,align:this.align,ratio:y,isVertical:this.isVertical,w:c||"",h:d||"",t:u,l:p,width:f[0]||"auto",height:f[1]||"auto",originWidth:r.naturalWidth||r.offsetWidth,originHeight:r.naturalHeight||r.offsetHeight};if(this.#Is=C.width,this.#Vs=C.height,o)return C;const w=this.#J.frameContext.get("_figure");this.#J.ui.setFigureContainer(w.main),this.#J.ui.opendControllers=this.#J.ui.opendControllers.filter((t=>t.form!==w.main)),w.main.style.top=u+"px",w.main.style.left=p+"px",w.main.style.width=(this.isVertical?d:c)+"px",w.main.style.height=(this.isVertical?c:d)+"px",w.border.style.top="0px",w.border.style.left="0px",w.border.style.width=(this.isVertical?d:c)+"px",w.border.style.height=(this.isVertical?c:d)+"px",this.__offset={left:p+g,top:u+m},this.#J.ui.opendControllers.push({position:"none",form:w.main,target:h,inst:this,notInCarrier:!0});const _=/%$/.test(r.style.width)&&/%$/.test(l.container.style.width)?Ve.get(l.container.style.width,0)/100+"":"";for(let t=0,e=this.percentageButtons.length;t<e;t++)this.percentageButtons[t].getAttribute("data-value")===_?Ie.utils.addClass(this.percentageButtons[t],"active"):Ie.utils.removeClass(this.percentageButtons[t],"active");if(this.captionButton&&(l.caption?Ie.utils.addClass(this.captionButton,"active"):Ie.utils.removeClass(this.captionButton,"active")),w.display.style.display=s||this._inlineCover?"none":"",w.border.style.display=i?"none":"",w.main.style.display="block",mi.get("__overInfo")!==Mi){const t=e?"none":"flex",s=w.handles;for(let e=0,i=s.length;e<i;e++)s[e].style.display=t;if(this.controller){const t=this.getSize(r);Ie.utils.changeTxt(w.display,this.#J.lang["none"===this.align?"basic":this.align]+" ("+t.dw+", "+t.dh+")"),this.#ni(),this.#oi(),this.#J.ui._visibleControllers(!0,!0);const e=this.controller.form.querySelectorAll('[data-command="rotate"][data-value="90"], [data-command="rotate"][data-value="-90"], [data-command="caption"], [data-command="onalign"], [data-command="onresize"]'),s=this._inlineCover||a?"none":"";e?.forEach((t=>{t.style.display=s}));const i=this.controller.form.querySelector('[data-command="onas"]');i&&(i.style.display=a?"none":"")}Ie.utils.removeClass(this._cover,"se-figure-over-selected"),this.controller?.open(w.main,null,{initMethod:this.#As,isWWTarget:!1,addOffset:null}),Ti.setTimeout((()=>mi.set("__overInfo",!1)),0)}else Ie.utils.addClass(this._cover,"se-figure-over-selected");return Ie.utils.addClass(this._cover,"se-figure-selected"),this.#Ps=this.#Os=c,this.#zs=this.#Rs=d,this._inlineCover||mi.get("__overInfo")===Mi&&!Ie.utils.hasClass(l.container,"se-input-component")||this.#li(w.main),C}controllerHide(){this.controller?.hide()}controllerShow(){this.controller?.show()}controllerOpen(t,e){this._element=t,this.controller?.open(t,null,e)}setFigureSize(t,e){/%$/.test(t+"")?this._setPercentSize(t,e):t&&"auto"!==t||e&&"auto"!==e?this._applySize(t,e,""):this.autoRatio?this._setPercentSize(100,this.autoRatio.default||this.autoRatio.current):this._setAutoSize()}setSize(t,e){const s=this.isVertical;s&&([t,e]=[e,t]),this.setFigureSize(t,e),s&&this.setTransform(this._element,t,e,0)}getSize(t){t||=this._element;const e=Oi(t);let s="",i="",n="",o="";if(!t)return{w:s,h:i,dw:n,dh:o};const l=Ii.GetContainer(t),r=l.target;return l.container?(s=/%$/.test(r.style.width)?(l.container&&Ve.get(l.container.style.width,2)||100)+"%":r.style.width,i=l.inlineCover?l.inlineCover.style.height||t.style.height||String(t.height||""):Ve.get(l.cover?.style.paddingBottom,0)>0&&!e?l.cover?.style.height:/%$/.test(r.style.height)&&/%$/.test(r.style.width)?(l.container&&Ve.get(l.container.style.height,2)||100)+"%":r.style.height,s||="auto",i||="auto"):this.#J.options.get("strictMode").formatFilter?(s="",i=r.style.height):(s=r.style.width||"auto",i=r.style.height||"auto"),n=e?i:s,o=e?s:i,{w:s,h:i,dw:n,dh:o}}setAlign(t,e){t||=this._element,this.align=e||="none";const s=Ii.GetContainer(t);if(!s.cover)return;const i=s.target,n=s.container,o=s.cover;if(/%$/.test(i.style.width)&&"center"===e&&!this.#J.component.isInline(n)?(n.style.minWidth="100%",o.style.width=n.style.width):(n.style.minWidth="",o.style.width=this.isVertical?i.style.height||i.offsetHeight+"px":i.style.width&&"auto"!==i.style.width?i.style.width||"100%":""),Ie.utils.hasClass(n,"__se__float-"+e)||(Ie.utils.removeClass(n,this.#Fs),Ie.utils.addClass(n,"__se__float-"+e)),this.autoRatio){const{w:t,h:e}=this.getSize(this._element);this.__setCoverPaddingBottom(t,e)}this.#ni()}convertAsFormat(t,e){t||=this._element,this.as=e||"block";const{container:s,inlineCover:i,target:n}=Ii.GetContainer(t),{w:o,h:l}=this.getSize(n),r=Ie.check.isAnchor(n.parentNode)?n.parentNode:null,a=n.cloneNode(!1);a.style.width="",a.style.height="",a.removeAttribute("width"),a.removeAttribute("height");let h=a;if(r){const t=r.cloneNode(!1);t.appendChild(a),h=t}switch(e){case"inline":{if(i)break;this.#J.component.deselect();const t=s.nextElementSibling,e=s.parentElement,n=Ii.CreateInlineContainer(h);Ie.utils.addClass(n.container,s.className.split(" ").filter((t=>"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this.#ri(n,o,l);const r=Ie.utils.createElement(this.#J.options.get("defaultLine"),null,n.container);e.insertBefore(r,t),Ie.utils.removeItem(s);break}case"block":{if(!i)break;this.#J.component.deselect(),this.#J.selection.setRange(s,0,s,1);const t=this.#J.html.remove(),e=this.#J.nodeTransform.split(t.container,t.offset,0);e?.previousElementSibling&&Ie.check.isZeroWidth(e.previousElementSibling)&&Ie.utils.removeItem(e.previousElementSibling);const n=Ii.CreateContainer(h);Ie.utils.addClass(n.container,s.className.split(" ").filter((t=>"se-inline-component"!==t&&"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this.#ri(n,o,l),(e||t.container).parentElement.insertBefore(n.container,e);break}}return a}controllerAction(t){const e=t.getAttribute("data-command"),s=t.getAttribute("data-value"),i=t.getAttribute("data-type"),n=this._element;if(!/^on.+/.test(e)&&"selectMenu"!==i){switch(e){case"mirror":{const t=Vi(n);let e=t.x,i=t.y;"h"===s&&!this.isVertical||"v"===s&&this.isVertical?i=i?"":"180":e=e?"":"180",this._setRotate(n,t.r,e,i);break}case"rotate":this.setTransform(n,null,null,Number(s));break;case"caption":if(this._caption)Ie.utils.removeItem(this._caption),Ti.setTimeout(this.#J.component.select.bind(this.#J.component,n,this.kind),0),this._caption=null;else{const t=Ii.CreateCaption(this._cover,this.#J.lang.caption),e=Ie.query.getEdgeChild(t,(t=>3===t.nodeType),!1);e?this.#J.selection.setRange(e,0,e,e.textContent.length):t.focus(),this._caption=t,this.controller.close()}(/\d+/.test(n.style.height)||this.isVertical&&this._caption)&&(/%$/.test(n.style.width)||/auto/.test(n.style.height)?this.deleteTransform():this.setTransform(n,n.style.width,n.style.height,0));break;case"revert":this._setRevert();break;case"edit":this.inst.componentEdit(n);break;case"copy":this.#J.component.copy(this._container);break;case"remove":this.inst.componentDestroy(n),this.controller.close()}/^__c__/.test(e)?this._action[e](n,s,t):"edit"!==e&&(this.#J.history.push(!1),/^remove|caption$/.test(e)||this.#J.component.select(n,this.kind))}}retainFigureFormat(t,e,s,i){const n=this.#J.component.isInline(t),o=e.parentNode;let l=this.#J.format.isBlock(o)||Ie.check.isWysiwygFrame(o)||o.nodeType>=9?e:Ii.GetContainer(e)?.container||o||e;if(Ie.query.getParentElement(e,Ie.check.isExcludeFormat))l=s&&s!==e?s:e,l.parentNode.replaceChild(t,l);else if(n&&this.#J.format.isLine(l)){const s=n&&/^SPAN$/i.test(e.parentElement.nodeName)?e.parentElement:e;s.parentElement.replaceChild(t,s)}else if(Ie.check.isListCell(l)){const s=Ie.query.getParentElement(e,(t=>t.parentNode===l));l.insertBefore(t,s),Ie.utils.removeItem(e),this.#J.nodeTransform.removeEmptyNode(s,null,!0)}else if(this.#J.format.isLine(l)){const s=Ie.query.getParentElement(e,(t=>t.parentNode===l));l=this.#J.nodeTransform.split(l,s),l.parentNode.insertBefore(t,l),Ie.utils.removeItem(e),this.#J.nodeTransform.removeEmptyNode(l,null,!0)}else if(this.#J.format.isLine(l.parentNode)){const e=l.parentNode;e.parentNode.insertBefore(t,l.previousSibling?e.nextElementSibling:e),(0===i?.__updateTags.map((t=>l.contains(t))).length||Ie.check.isZeroWidth(l))&&Ie.utils.removeItem(l)}else l=Ie.check.isFigure(l.parentNode)?Ie.query.getParentElement(l.parentNode,Ii.is):l,l.parentNode.replaceChild(t,l)}deleteTransform(t){t||=this._element;const e=t,s=(e.getAttribute("data-se-size")||"").split(",");this.isVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",this.#ai(e),this._applySize(s[0]||"auto",s[1]||"","")}setTransform(t,e,s,i){try{this.#Ds=!0;const n=Vi(t),o=n.r+1*(i||0);i=Math.abs(o)>=360?0:o;const l=this.isVertical=Oi(i);e=Ve.get(e,0),s=Ve.get(s,0);const r=t,a=(r.getAttribute("data-se-size")||"auto,auto").split(",");l&&this._setRotate(r,i,n.x,n.y);let h="";if(/auto|%$/.test(a[0])&&!l)"auto"===a[0]&&"auto"===a[1]?this._setAutoSize():this._setPercentSize(a[0],a[1]);else{const t=Ii.GetContainer(r),n=t.cover||t.inlineCover,o=e||r.offsetWidth,a=s||r.offsetHeight,c=(l?a:o)+"px",d=(l?o:a)+"px";if(this.#hi(),this._applySize(o+"px",a+"px",""),n&&(n.style.width=c,n.style.height=t.caption||t.inlineCover?"":d),l){h=90===i||-270===i?a/2+"px "+a/2+"px 0":o/2+"px "+o/2+"px 0"}}r.style.transformOrigin=h,l||this._setRotate(r,i,n.x,n.y),r.style.maxWidth=l?"none":"",this.#ci(r)}finally{this.#Ds=!1}}_displayResizeHandles(t){const e=t?"flex":"none";this.controller&&(this.controller.form.style.display=e);const s=this.#J.frameContext.get("_figure"),i=s.handles;for(let t=0,s=i.length;t<s;t++)i[t].style.display=e;"none"===e?(Ie.utils.addClass(s.main,"se-resize-ing"),this.#Ws=this.#J.eventManager.addGlobalEvent("keydown",this.#Bs)):Ie.utils.removeClass(s.main,"se-resize-ing")}#ri(t,e,s){const i=this.kind;t.target.onload=()=>this.#J.component.select(t.target,i),this.#ii(t),t.inlineCover&&(this.setAlign(t.target,"none"),this.deleteTransform()),this.setFigureSize(e,s)}#ii(t){this._inlineCover=t.inlineCover,this._cover=t.cover||this._inlineCover,this._container=t.container,this._caption=t.caption,this._element=t.target,this.align=(this._container.className.match(/(?:^|\s)__se__float-(none|left|center|right)(?:$|\s)/)||[])[1]||t.target.style.float||"none",this.as=this._inlineCover?"inline":"block",this.isVertical=Oi(t.target)}_setRotate(t,e,s,i){let n=(t.offsetWidth-t.offsetHeight)*(/^-/.test(e+"")?1:-1),o="";if(/[1-9]/.test(e+"")&&(s||i))switch(o=s?"Y":"X",e+""){case"90":o=s&&i?"X":i?o:"";break;case"270":n*=-1,o=s&&i?"Y":s?o:"";break;case"-90":o=s&&i?"Y":s?o:"";break;case"-270":n*=-1,o=s&&i?"X":i?o:"";break;default:o=""}e%180==0&&(t.style.maxWidth=""),t.style.transform="rotate("+e+"deg)"+(s?" rotateX("+s+"deg)":"")+(i?" rotateY("+i+"deg)":"")+(o?" translate"+o+"("+n+"px)":"")}_applySize(t,e,s){const i=/^(rw|lw)$/.test(s)&&/\d+/.test(this._element.style.height),n=/^(th|bh)$/.test(s)&&/\d+/.test(this._element.style.width);e=e||(this.autoRatio?this.autoRatio.current||this.autoRatio.default:e),t=Ve.is(t)?t+this.sizeUnit:t,/%$/.test(t)||/%$/.test(e)||i||n||this.#hi();const o=this._cover||this._element;this.autoRatio&&this._cover&&(this._cover.style.width=t),n||(o.style.width=this._element.style.width=t),i||(e=Ve.is(e)?e+this.sizeUnit:e,o.style.height=this._element.style.height=this.autoRatio&&!this.isVertical?"100%":e,this.autoRatio&&this._cover&&(this._cover.style.height=e,this.__setCoverPaddingBottom(t,e))),"center"===this.align&&this.setAlign(this._element,this.align),this.#di()}__setCoverPaddingBottom(t,e){this._inlineCover!==this._cover&&(this.isVertical&&([t,e]=[e,t]),this._cover.style.height=e,/%$/.test(t)&&"center"===this.align?this._cover.style.paddingBottom=/%$/.test(e)?Ve.get(Ve.get(e,2)/100*Ve.get(t,2),2)+"%":e:this._cover.style.paddingBottom=e)}_setAutoSize(){this._caption&&(this._caption.style.marginTop=""),this.deleteTransform(),this.#hi(),this.autoRatio?this._setPercentSize("100%",this.autoRatio.current||this.autoRatio.default):(this._element.style.maxWidth="",this._element.style.width="",this._element.style.height="",this._cover&&(this._cover.style.width="",this._cover.style.height="")),this.setAlign(this._element,this.align),this.#di()}_setPercentSize(t,e){e||=this.autoRatio?/%$/.test(this.autoRatio.current)?this.autoRatio.current:this.autoRatio.default:e,e=!e||/%$/.test(e+"")||Ve.get(e,0)?Ve.is(e)?e+this.sizeUnit:e||(this.autoRatio?this.autoRatio.default:""):Ve.is(e)?e+"%":e;const s=/%$/.test(e+"");this._container.style.width=String(Ve.is(t)?t+"%":t),this._container.style.height="",this._element!==this._cover||this.#J.options.get("strictMode").formatFilter?(this._inlineCover!==this._cover&&this._cover&&(this._cover.style.width="100%",this._cover.style.height=String(e)),this._element.style.width="100%",this._element.style.maxWidth="",this._element.style.height=String(this.autoRatio?"100%":s?"":e),"center"===this.align&&this.setAlign(this._element,this.align),this.autoRatio&&this.__setCoverPaddingBottom(String(t),String(e)),this.#ci(this._element),this.#di()):this.#di()}#hi(){this._cover&&(this._cover.style.width="",this._cover.style.height=""),this._container.style.width="",this._container.style.height="",Ie.utils.removeClass(this._container,this.#Fs),Ie.utils.addClass(this._container,"__se__float-"+this.align),"center"===this.align&&this.setAlign(this._element,this.align)}_setRevert(){this.setFigureSize(this.#qs.w,this.#qs.h)}#ni(){this.alignButton&&Ie.utils.changeElement(this.alignButton.firstElementChild,this._alignIcons[this.align])}#oi(){this.asButton&&Ie.utils.changeElement(this.asButton.firstElementChild,this.#J.icons[`as_${this.as}`])}#di(){if(this.#Ds)return;const t=(this._element.getAttribute("data-se-size")||",").split(",");this.#qs.w=t[0],this.#qs.h=t[1];const e=this.getSize(this._element);this._element.setAttribute("width",e.w.replace("px","")),this._element.setAttribute("height",e.h.replace("px","")),this._element.setAttribute("data-se-size",e.w+","+e.h),this.autoRatio&&(this.autoRatio.current=/%$/.test(e.h)?e.h:"")}#ci(t){const e=Ie.query.getEdgeChild(Ie.query.getParentElement(t,"FIGURE"),"FIGCAPTION",!1);e&&(e.style.marginTop=(this.isVertical&&!this.autoRatio?t.offsetWidth-t.offsetHeight:0)+"px",this.isVertical&&this.autoRatio?t.style.marginTop=e.offsetHeight+"px":t.style.marginTop="")}#ai(t){const e=Ie.query.getEdgeChild(Ie.query.getParentElement(t,"FIGURE"),"FIGCAPTION",!1);e&&(e.style.marginTop="")}#ui(){this.#J.component.__removeDragEvent(),this.#si(),this._displayResizeHandles(!0),this.#J.ui.offCurrentController(),this.#J.ui.disableBackWrapper()}#si(){this.#J.eventManager.removeGlobalEvent(this.__onContainerEvent),this.#J.eventManager.removeGlobalEvent(this.__offContainerEvent),this.#J.eventManager.removeGlobalEvent(this.#Ws)}#li(t){const e=this.#J.frameContext.get("wrapper").querySelector(".se-drag-handle");Ie.utils.removeClass(e,"se-drag-handle-full"),e.style.opacity="",e.style.width="",e.style.height="",mi.set("__dragHandler",e),mi.set("__dragContainer",this._container),mi.set("__dragCover",this._cover),mi.set("__dragMove",this.#pi.bind(this,e,t)),mi.get("__dragMove")(),e.style.display="block"}#pi(t,e){t.style.display="block",t.style.left=e.offsetLeft+(this.#J.options.get("_rtl")?t.offsetWidth:e.offsetWidth-1.5*t.offsetWidth)+"px",t.style.top=e.offsetTop-t.offsetHeight+.5+"px"}#ei(t){t.stopPropagation(),t.preventDefault();const e=mi.get("__figureInst");if(!e)return;const s=Ie.query.getEventTarget(t),i=e._resize_direction=s.classList[0];e._resizeClientX=t.clientX,e._resizeClientY=t.clientY,this.#J.frameContext.get("_figure").main.style.float=/l/.test(i)?"right":/r/.test(i)?"left":"none",this.#J.ui.enableBackWrapper(Hi[i]);const{w:n,h:o,dw:l,dh:r}=this.getSize(e._element);if(Li=Ni=!1,Ai=Bi=0,!this.isVertical){const t=!n||/auto|%$/.test(n),s=!o||/auto|%$/.test(o);if("tl|bl|tr|br".includes(i)&&t&&s?Li=!0:"lw|rw".includes(i)&&t&&(Ni=!0),Li||Ni){const t=e._cover||e._element;Bi=t.offsetWidth,Ai=Be.getWidthInPercentage(t,this.#J.frameContext.get("wysiwygFrame"))/100}}e.__onContainerEvent=this.#J.eventManager.addGlobalEvent("mousemove",e.__containerResizing),e.__offContainerEvent=this.#J.eventManager.addGlobalEvent("mouseup",e.__containerResizingOff),e._displayResizeHandles(!1);const a=this.#J.frameContext.get("_figure").display;a.style.display="block",Ie.utils.changeTxt(a,l+" * "+r)}#Ks(t){const e=this._resize_direction,s=t.clientX,i=t.clientY,n=this.isVertical;let o=n?this.#zs:this.#Ps,l=n?this.#Ps:this.#zs;const r=o+(/r/.test(e)?s-this._resizeClientX:this._resizeClientX-s),a=l+(/b/.test(e)?i-this._resizeClientY:this._resizeClientY-i),h=l/o*r,c=this.#J.frameContext.get("_figure").border;/t/.test(e)&&(c.style.top=l-(/h/.test(e)?a:h)+"px"),/l/.test(e)&&(c.style.left=o-r+"px"),/r|l/.test(e)&&(c.style.width=r+"px",o=r),/^(t|b)[^h]$/.test(e)?(c.style.height=h+"px",l=h):/^(t|b)h$/.test(e)&&(c.style.height=a+"px",l=a);const d=!n&&/h$/.test(e)?this.#Is:Math.round(o),u=!n&&/w$/.test(e)?this.#Vs:Math.round(l),p=Ai?d/Bi*Ai*100:d;Ie.utils.changeTxt(this.#J.frameContext.get("_figure").display,Ai?Ve.get(p>100?100:p,2).toFixed(2)+"%":p+" * "+u),this.#Os=d,this.#Rs=u}#js(){this.#ui();let t=this.isVertical?this.#Rs:this.#Os,e=this.isVertical?this.#Os:this.#Rs;if(t=Math.round(t)||t,e=Math.round(e)||e,!this.isVertical&&!/%$/.test(t+"")){const s=this.#J.frameContext.get("wysiwygFrame").clientWidth-Ve.get(this.#J.frameContext.get("wwComputedStyle").getPropertyValue("padding-left"))+Ve.get(this.#J.frameContext.get("wwComputedStyle").getPropertyValue("padding-right"))-2;Ve.get(t,0)>s&&(e=Math.round(e/t*s),t=s)}if(Li||Ni){t=t/(this._cover||this._element).offsetWidth*Ai*100;const e=Ve.get(t>100?100:t,2)+"%";this._setPercentSize(e,Ni?this.getSize(this._element).h:"")}else this._applySize(t,e,this._resize_direction),this.isVertical&&this.setTransform(this._element,t,e,0);this.#J.history.push(!1),this.#J.component.select(this._element,this.kind)}#Xs(t){Oe.isEsc(t.code)&&(this.#ui(),this.#J.component.select(this._element,this.kind))}#Us(t){this.setAlign(this._element,t),this.selectMenu_align.close(),this.#J.component.select(this._element,this.kind),this.#J.history.push(!1)}#Zs(t){this.convertAsFormat(this._element,t),this.selectMenu_as.close(),this.#J.history.push(!1)}#Gs(t){if("auto"===t)this.deleteTransform(),this._setAutoSize();else{let e=this.getSize(this._element).h;if(this.isVertical){const t=(this._element.getAttribute("data-se-size")||",").split(",");t[1]&&(e=t[1])}this.deleteTransform(),this._setPercentSize(1*t,null!==Ve.get(e,0)&&/%$/.test(e)?e:"")}this.selectMenu_resize.close(),this.#J.component.select(this._element,this.kind),this.#J.history.push(!1)}#Ys(){const t=this.#J.frameContext.get("_figure");t.main.style.display="none",this.#J.ui.setFigureContainer(null),this.#J.ui.opendControllers=this.#J.ui.opendControllers.filter((e=>e.form!==t.main))}#Js(){this.selectMenu_align.open("",'[data-command="'+this.align+'"]')}#Qs(){this.selectMenu_as.open("",'[data-command="'+this.as+'"]')}#ti(){const t=this.getSize(this._element),e=t.w,s=t.h;let i="";if(this.autoRatio){if(s===this.autoRatio.default&&/%$/.test(e)){const t=Ve.get(e);i=100===t?"auto":"resize_percent"+t}}else"auto"===s&&("auto"===e?i="auto":/%$/.test(e)&&(i="resize_percent"+Ve.get(e)));this.selectMenu_resize.open("",'[data-command="'+i+'"]')}}function Vi(t){const e=t.style.transform;return e?{r:Number((e.match(/rotate\(([-0-9]+)deg\)/)||[])[1]||0),x:(e.match(/rotateX\(([-0-9]+)deg\)/)||[])[1]||"",y:(e.match(/rotateY\(([-0-9]+)deg\)/)||[])[1]||""}:{r:0,x:"",y:""}}function Oi(t){return/^(90|270)$/.test(Math.abs(Ve.is(t)?t:Vi(t).r).toString())}function Ri(t){const e=t.split("_"),s=e[0],i=e[1];let n,o,l,r;switch(s){case"resize":n="onresize",o=i,l="resize",r="resize";break;case"auto":n="auto",l="autoSize",r="auto_size";break;case"rotate":n="rotate",o="l"===i?-90:"r"===i?90:Ve.get(i),l=o<0?"rotateLeft":"rotateRight",r=o<0?"rotate_left":"rotate_right";break;case"mirror":n="mirror",o=i,l="h"===i?"mirrorHorizontal":"mirrorVertical",r="h"===i?"mirror_horizontal":"mirror_vertical";break;case"align":n="onalign",l="align",r="align_justify";break;case"caption":n="caption",l="caption",r="caption";break;case"revert":n="revert",l="revert",r="revert";break;case"edit":n="edit",l="edit",r="edit";break;case"as":n="onas",l="blockStyle",r="as_block";break;case"copy":n="copy",l="copy",r="copy";break;case"remove":n="remove",l="remove",r="delete"}return n?{c:n,v:o,l,t:undefined,i:r}:null}const Pi=Ii,{_w:zi,ON_OVER_COMPONENT:Fi,isMobile:Di}=Ne,qi=/^Arrow(Left|Up|Right|Down)$/,Wi=/^Arrow(Left|Up)$/;function Ui(t,e,s){t.preventDefault(),t.stopPropagation(),Zi(e),s.setData("text/html",e.outerHTML)}function Zi(t){Ie.utils.removeClass(t,"se-component-selected"),Ie.utils.removeClass(t.querySelectorAll(".se-figure-selected"),"se-figure-selected"),Ie.utils.removeClass(t.querySelectorAll(".se-selected-table-cell"),"se-selected-table-cell"),Ie.utils.removeClass(t.querySelector(".se-selected-cell-focus"),"se-selected-cell-focus")}const Gi=class{#F;#J;#t;#gi;#nt;#ot;#Y;#mi;#fi;#vi=null;#bi=null;#yi=null;#is=null;constructor(t){this.#F=t,this.#J=t.$,this.#t=t.store,this.#gi=this.#J.contextProvider,this.#nt=this.#gi.carrierWrapper,this.#ot=this.#J.options,this.#Y=this.#J.frameContext,this.#mi=this.#J.eventManager,this.info=null,this.isSelected=!1,this.currentTarget=null,this.currentPlugin=null,this.currentPluginName="",this.currentInfo=null,this.#fi={copy:this.#Ci.bind(this),cut:this.#wi.bind(this),keydown:this.#_i.bind(this),mousedown:this.#Ie.bind(this)},this.__selectionSelected=!1,this.__prevent=!1}_init(){this.#gi.applyToRoots((t=>{const e=Ie.utils.createElement("DIV",{class:"se-drag-handle",draggable:"true"},this.#gi.icons.selection);t.get("wrapper").appendChild(e),this.#mi.addEvent(e,"mouseenter",this.#xi.bind(this)),this.#mi.addEvent(e,"mouseleave",this.#$i.bind(this)),this.#mi.addEvent(e,"dragstart",this.#ki.bind(this)),this.#mi.addEvent(e,"dragend",this.#Si.bind(this)),this.#mi.addEvent(e,"click",this.#Ei.bind(this))}))}insert(t,{skipCharCount:e=!1,skipHistory:s=!1,scrollTo:i=!0,insertBehavior:n}={}){if(this.#Y.get("isReadOnly")||!e&&!this.#J.char.check(t))return null;void 0===n&&(n=this.#ot.get("componentInsertBehavior"));const o=this.#J.html.remove(),l=this.isInline(t);this.#J.selection.getRangeAndAddLine(this.#J.selection.getRange(),o.container);const r=this.#J.selection.getNode();let a=null,h=this.#J.format.getLine(r,null);try{if(Ie.check.isListCell(h))this.#J.html.insertNode(t,{afterNode:l?null:Ie.check.isZeroWidth(r)?(r||o.container||{}).nextSibling:null,skipCharCount:!0}),l||t.nextSibling||t.parentNode.appendChild(Ie.utils.createElement("BR"));else{if(!l&&this.#J.selection.getRange().collapsed&&(3===o.container?.nodeType||Ie.check.isBreak(o.container))){const t=Ie.query.getParentElement(o.container,this.#J.format.isBlock.bind(this.#J.format));a=this.#J.nodeTransform.split(o.container,o.offset,t?Ie.query.getNodeDepth(t)+1:0),a&&(h=a.previousSibling)}this.#J.html.insertNode(t,{afterNode:l||this.#J.format.isBlock(h)?null:h,skipCharCount:!0}),!l&&h&&Ie.check.isZeroWidth(h)&&Ie.utils.removeItem(h)}if(l){const e=Ie.utils.createTextNode(Ae.zeroWidthSpace);t.parentNode.insertBefore(e,t.nextSibling)}}catch(t){console.error("Component insert error:",t)}s||this.#J.history.push(!1),this.#Y.has("documentType_use_header")&&this.#Y.get("documentType").reHeader();const c=a||t;return i&&this.#J.selection.scrollTo(c,{behavior:"auto"}),null!==n&&this.applyInsertBehavior(t,a,n),c}applyInsertBehavior(t,e,s){const i=this.get(t);if(this.isInline(t)){const e=this.#J.selection.getNearRange(t);e?this.#J.selection.setRange(e.container,e.offset,e.container,e.offset):this.select(i.target,i.pluginName)}else switch(s){case"auto":this.#Ti(t)||this.select(i.target,i.pluginName);break;case"select":this.#J.selection.setRange(t,0,t,0),i?this.select(i.target,i.pluginName):e&&(e=Ie.query.getEdgeChildNodes(e,null).sc||e,this.#J.selection.setRange(e,0,e,0));break;case"line":if(!this.#Ti(t)){const e=this.#J.format.addLine(t,null);e&&this.#J.selection.setRange(e,0,e,0)}}}get(t){if(!t)return null;let e,s="",i={},n=!1,o=null;if(this.is(t)){if(Ie.check.isComponentContainer(t)&&!Ie.utils.hasClass(t,"se-inline-component")&&(t=t.firstElementChild||t),/^FIGURE$/i.test(t.nodeName)&&(t=t.firstElementChild),!t)return null;const n=this.#J.pluginManager.findComponentInfo(t);if(!n)return null;e=n.target,s=n.pluginName,i=n.options,o=n.launcher}if(!e&&t.nodeName){this.#Mi(t)&&(n=!0);const l=this.#J.pluginManager.findComponentInfo(t);if(!l)return null;e=l.target,s=l.pluginName,i=l.options,o=l.launcher}if(!e)return null;const l=Pi.GetContainer(e),r=l.container||l.cover||e;return this.info={target:l.target,pluginName:s,options:i,container:r,cover:l.cover,inlineCover:l.inlineCover,caption:l.caption,isFile:n,launcher:o,isInputType:Ie.utils.hasClass(r,"se-input-component")}}select(t,e,{isInput:s=!1}={}){const i=this.get(t);if(!i||Ie.check.isUneditable(Ie.query.getParentElement(t,this.is.bind(this)))||Ie.check.isUneditable(t))return!1;const n=i.launcher||this.#J.plugins[e];if(!n)return;const o=fi.get("__overInfo")!==Fi;if(!s&&o){if(this.#t.get("_mousedown"))return;this.#t.set("_preventBlur",!0),this.__selectionSelected=!0,this.isInline(i.container)&&this.#J.selection.setRange(i.container,0,i.container,0),this.#J.focusManager.blur(),zi.setTimeout((()=>{this.__selectionSelected=!1}))}let l;this.isSelected=!0,this.__prevent=!0,"function"==typeof n.componentSelect&&(l=n.componentSelect(t));const r=Ie.utils.hasClass(i.target,"se-component-line-break");(r||!l&&!Ie.utils.hasClass(i.container,"se-inline-component"))&&this._setComponentLineBreaker(i.container||i.cover||t),this.currentTarget=t,this.currentPlugin=n,this.currentPluginName=e,this.currentInfo=i,fi.set("__dragInst",this);const a=fi.get("__overInfo");if(zi.setTimeout((()=>{fi.set("__overInfo",a===Fi&&void 0),a!==Fi&&this.#Pe(),i.isFile||this.#Hi(),Ie.utils.addClass(i.container,"se-component-selected")}),0),!o||this.#t.get("hasFocus")||this.#t.get("_preventFocus")||(this.#F._eventOrchestrator.__postFocusEvent(this.#Y,null),this.#t.set("_preventFocus",!0)),r||a===Fi){if(r||!Ie.utils.hasClass(i.container,"se-input-component")){const t=this.#Y.get("wrapper").querySelector(".se-drag-handle");Ie.utils.addClass(t,"se-drag-handle-full"),this.#J.ui._visibleControllers(!1,!1);const e=i.caption?i.target:i.cover||i.container||i.target,s=e.offsetWidth,n=e.offsetHeight,{top:o,left:l}=this.#J.offset.getLocal(e);t.style.opacity="0",t.style.width=s+"px",t.style.height=n+"px",t.style.top=o+"px",t.style.left=l+"px",fi.set("__dragHandler",t),fi.set("__dragContainer",i.container),fi.set("__dragCover",i.cover),t.style.display="block"}}else{if(!this.isInline(i.container))return;const t=i.container;let e=null;t.previousSibling&&!Ie.check.isBreak(t.previousSibling)||(e=Ie.utils.createTextNode(Ae.zeroWidthSpace),t.parentNode.insertBefore(e,t)),t.nextSibling&&!Ie.check.isBreak(t.nextSibling)||(e=Ie.utils.createTextNode(Ae.zeroWidthSpace),t.parentNode.insertBefore(e,t.nextSibling)),this.#t.set("controlActive",!0)}}deselect(){zi.setTimeout((()=>{this.#t.set("controlActive",!1)}),0),this.__deselect(),this.#J.ui.setControllerOnDisabledButtons(!1),!this.#t.get("_preventFocus")||this.#t.get("hasFocus")||this.__prevent||(this.#F._eventOrchestrator.__postBlurEvent(this.#Y,null),this.#t.set("_preventFocus",!1))}is(t){return!!t&&(!(!/^FIGURE$/i.test(t.nodeName)&&!Ie.check.isComponentContainer(t))||!!this.#J.pluginManager.findComponentInfo(t))}isInline(t){if(!t)return!1;if(/^FIGURE$/i.test(t.nodeName)&&(t=t.parentElement),Ie.utils.hasClass(t,"se-inline-component"))return!0;return!(!this.#J.pluginManager.findComponentInfo(t)||!Ie.utils.hasClass(t,"se-inline-component")&&!Ie.utils.hasClass(t.parentElement,"se-inline-component"))}isBasic(t){return this.is(t)&&!this.isInline(t)}async copy(t){const e=Ie.utils.clone(t,!0);Zi(e),!1!==await this.#J.html.copy(e)&&Ie.utils.flashClass(t,"se-copy")}hoverSelect(t){const e=Ie.query.getParentElement(t,Ie.check.isFigure);let s=this.get(t);s||e?(s||=this.get(e),s&&!Ie.utils.hasClass(s.container,"se-component-selected")&&(this.#J.ui.offCurrentController(),fi.set("__overInfo",Fi),this.select(s.target,s.pluginName))):null===fi.get("__overInfo")||Ie.utils.hasClass(t,"se-drag-handle")||(this.__deselect(),fi.set("__overInfo",null))}__deselect(){if(this.#t.set("_preventBlur",!1),fi.set("__overInfo",null),this.__removeDragEvent(),this.currentInfo){const t=this.currentInfo.container,e=this.currentInfo.cover;zi.setTimeout((()=>{Zi(t),Ie.utils.removeClass(e,"se-figure-over-selected")}),0)}this.#Y.get("lineBreaker_t")&&(this.#Y.get("lineBreaker_t").style.display=this.#Y.get("lineBreaker_b").style.display="none"),this.currentPlugin&&this.currentPlugin.componentDeselect?.(this.currentTarget),this.isSelected=!1,this.currentPlugin=null,this.currentTarget=null,this.currentPluginName="",this.currentInfo=null,this.__removeGlobalEvent(),this.#J.ui._offControllers()}_setComponentLineBreaker(t){const e=fi.get("__overInfo")===Fi;this.#F._eventOrchestrator._lineBreakComp=null;const s=this.get(t);if(!s)return;const i=this.#Y,n=s.container,o=Ie.utils.hasClass(n,"se-flex-component"),l=i.get("lineBreaker_t"),r=i.get("lineBreaker_b"),a=l.style,h=r.style,c=n.offsetWidth<t.offsetWidth?n:t,d=this.#J.ui.getVisibleFigure()||c,u=Ie.check.isListCell(n.parentNode);let p,g;const m=this.#ot.get("_rtl"),f=m?["right","left"]:["left","right"],{top:v,left:b,right:y,scrollX:C,scrollY:w}=this.#J.offset.getLocal(c),_=m?y:b;if(u?!Ie.check.isBreak(n.previousElementSibling)&&!n.previousSibling?.textContent?.trim()||this.is(n.previousElementSibling):!this.#J.format.isLine(n.previousElementSibling)){const t=zi.getComputedStyle(l),s=Ve.get(t.height,1),i=Ve.get(t.width,1);this.#F._eventOrchestrator._lineBreakComp=n,p=v,g=d.offsetWidth/2/2,a.top=p-s/2+"px",a[f[0]]=(o?_-i/2:_+g)+"px",a[f[1]]="",l.setAttribute("data-offset",w+","+C),e?Ie.utils.removeClass(l,"se-on-selected"):Ie.utils.addClass(l,"se-on-selected"),a.display="block",a.visibility=""}else a.display="none";if(u?!Ie.check.isBreak(n.nextElementSibling)&&!n.nextSibling?.textContent?.trim()||this.is(n.nextElementSibling):!this.#J.format.isLine(n.nextElementSibling)){const t=zi.getComputedStyle(r),s=Ve.get(t.height,1),i=Ve.get(t.width,1);p||(this.#F._eventOrchestrator._lineBreakComp=n,p=v,g=d.offsetWidth/2/2),h.top=p+d.offsetHeight-s/2+"px",h[f[0]]=_+d.offsetWidth-(o?0:g)-(o?i/2:i)+"px",h[f[1]]="",r.setAttribute("data-offset",w+","+f[0]+","+C),e?Ie.utils.removeClass(r,"se-on-selected"):Ie.utils.addClass(r,"se-on-selected"),h.display="block",h.visibility=""}else h.display="none"}__removeGlobalEvent(){this.#Li(),this.#vi&&=this.#mi.removeGlobalEvent(this.#vi),this.#bi&&=this.#mi.removeGlobalEvent(this.#bi),this.#yi&&=this.#mi.removeGlobalEvent(this.#yi)}__removeDragEvent(){this.#nt.querySelector(".se-drag-cursor").style.left="-10000px",fi.get("__dragHandler")&&(fi.get("__dragHandler").style.display="none"),Ie.utils.removeClass([fi.get("__dragHandler"),fi.get("__dragContainer")],"se-dragging"),Ie.utils.removeClass([fi.get("__dragCover"),fi.get("__dragContainer")],"se-drag-over"),fi.set("__figureInst",null),fi.set("__dragInst",null),fi.set("__dragHandler",null),fi.set("__dragContainer",null),fi.set("__dragCover",null),fi.set("__dragMove",null),fi.set("__overInfo",null)}#Pe(){this.__removeGlobalEvent(),this.#vi=this.#mi.addGlobalEvent("copy",this.#fi.copy),this.#bi=this.#mi.addGlobalEvent("cut",this.#fi.cut),this.#yi=this.#mi.addGlobalEvent("keydown",this.#fi.keydown)}#Hi(){this.#Li(),this.#is=this.#mi.addGlobalEvent(Di?"click":"mousedown",this.#fi.mousedown,!0)}#Li(){this.#is&&=this.#mi.removeGlobalEvent(this.#is)}#Ti(t){const e=t.nextElementSibling;if(!e){const e=this.#J.format.addLine(t,null);return e&&this.#J.selection.setRange(e,0,e,0),!0}return!!this.#J.format.isLine(e)&&(this.#J.selection.setRange(e,0,e,0),!0)}#Mi(t){const e=t.nodeName.toLowerCase();return this.#J.pluginManager.fileInfo.regExp.test(e)&&(!this.#J.pluginManager.fileInfo.tagAttrs[e]||this.#J.pluginManager.fileInfo.tagAttrs[e]?.every((e=>t.hasAttribute(e))))}#xi(){this.#t.set("_preventBlur",!0),this.#J.ui._visibleControllers(!1,Ie.utils.hasClass(fi.get("__dragHandler"),"se-drag-handle-full")),Ie.utils.addClass(fi.get("__dragCover")||fi.get("__dragContainer"),"se-drag-over")}#$i(){this.#t.set("_preventBlur",!1),Ie.utils.hasClass(fi.get("__dragHandler"),"se-drag-handle-full")||this.#J.ui._visibleControllers(!0,!0),Ie.utils.removeClass([fi.get("__dragCover"),fi.get("__dragContainer")],"se-drag-over")}#ki(t){const e=fi.get("__dragCover")||fi.get("__dragContainer");e?(this.#t.set("_preventBlur",!1),Ie.utils.addClass(fi.get("__dragHandler"),"se-dragging"),Ie.utils.addClass(fi.get("__dragContainer"),"se-dragging"),t.dataTransfer.setDragImage(e,this.#ot.get("_rtl")?e.offsetWidth:-5,-5)):t.preventDefault()}#Si(){this.#t.set("_preventBlur",!1),Ie.utils.removeClass([fi.get("__dragHandler"),fi.get("__dragContainer")],"se-dragging"),this.__removeDragEvent()}#Ei(t){const e=Ie.query.getEventTarget(t);if(!Ie.utils.hasClass(e,"se-drag-handle-full"))return;const s=fi.get("__dragInst");s&&(this.__removeDragEvent(),this.select(s.currentTarget,s.currentPluginName))}#Ie(t){const e=Ie.query.getEventTarget(t);this.currentTarget?.contains(e)||Ie.query.getParentElement(e,".se-controller")||Ie.utils.hasClass(e,"se-drag-handle")||this.currentPluginName===this.#J.ui.currentControllerName&&this.#J.ui.opendControllers.some((({form:t})=>t.contains(e)))||this.deselect()}#Ci(t){const e=Ie.query.getEventTarget(t);if(Ie.check.isInputElement(e)&&Ie.query.getParentElement(e,".se-modal"))return;const s=this.info;if(!s)return;const i=s.container.cloneNode(!0);"function"==typeof this.#J.plugins[s.pluginName]?.componentCopy&&!1!==this.#J.plugins[s.pluginName].componentCopy({event:t,cloneContainer:i,info:s})||Ui(t,i,t.clipboardData),Ie.utils.flashClass(s.container,"se-copy")}#wi(t){const e=this.info;if(!e)return;const s=e.container.cloneNode(!0);Ie.utils.removeClass(s,"se-component-selected"),Ui(t,s,t.clipboardData),this.deselect(),Ie.utils.removeItem(e.container)}async#_i(t){if(this.#J.ui.selectMenuOn)return;const e=t.code;if(Oe.isCtrl(t)){if("ControlRight"!==e&&"ControlLeft"!==e){const s=this.#J.shortcuts.keyMap.get(e+(t.shiftKey?"1000":""));/^(redo|undo)$/.test(s?.command)&&(t.preventDefault(),t.stopPropagation(),this.#J.commandDispatcher.run(s.command,s.type,s.button))}}else if(!Oe.isRemoveKey(e)||(t.preventDefault(),t.stopPropagation(),"function"!=typeof this.currentPlugin?.componentDestroy||this.info.isInputType&&this.#t.get("hasFocus"))){if(Oe.isEnter(e)){t.preventDefault();const e=this.currentInfo||this.get(this.currentTarget),s=e.container||e.target,i=s.previousElementSibling||s.nextElementSibling;let n=null;n=Ie.check.isListCell(s.parentNode)?Ie.utils.createElement("BR"):Ie.utils.createElement(this.#J.format.isLine(i)?i.nodeName:this.#ot.get("defaultLine"),null,"<br>");const o=this.currentPluginName;return this.deselect(),s.parentNode.insertBefore(n,s),!1===this.select(e.target,o)&&this.#J.focusManager.blur(),void this.#J.history.push(!1)}if(qi.lastIndex=0,qi.test(e)){const{container:s}=this.get(this.currentTarget);let i=null,n=1;if(this.isInline(s||this.currentTarget))switch(e){case"ArrowLeft":i=s.previousSibling,n=3===i?.nodeType?i.textContent.length:1;break;case"ArrowRight":i=s.nextSibling,n=0;break;case"ArrowUp":{const t=this.#J.format.getLine(s,null);i=t?.previousElementSibling,n=0;break}case"ArrowDown":{const t=this.#J.format.getLine(s,null);i=t?.nextElementSibling;break}}else Wi.lastIndex=0,Wi.test(e)?i=s.previousElementSibling:(i=s.nextElementSibling,n=0);if(!i)return;this.deselect();const o=this.get(i);if(o?.container)t.stopPropagation(),t.preventDefault(),this.select(o.target,o.pluginName);else try{this.#t.set("_preventBlur",!0),t.stopPropagation(),t.preventDefault(),this.#J.selection.setRange(i,n,i,n)}finally{this.#t.set("_preventBlur",!1)}}else Oe.isEsc(e)&&this.deselect()}else{const t=this.info.container.previousSibling;if(await this.currentPlugin.componentDestroy(this.currentTarget),this.deselect(),t){const e=3===t.nodeType?t.textContent.length:1;this.#J.selection.setRange(t,e,t,e)}else this.#J.focusManager.focus()}}_destroy(){this.__removeGlobalEvent(),this.__removeDragEvent()}};const ji=class{#F;#J;#Ni;#gi;#ot;#Ai;#Bi;#Ii=[];#Vi=[];#Oi={tags:null,regExp:null,pluginRegExp:null,pluginMap:null};#Ri=[];#Pi=new Map;#zi=new Map([["onMouseMove",[]],["onMouseLeave",[]],["onMouseDown",[]],["onMouseUp",[]],["onScroll",[]],["onClick",[]],["onBeforeInput",[]],["onInput",[]],["onKeyDown",[]],["onKeyUp",[]],["onFocus",[]],["onBlur",[]],["onPaste",[]],["onFilePasteAndDrop",[]]]);constructor(t,e){this.#F=t,this.#J=t.$,this.#Ni=e.plugins||{},this.#gi=this.#J.contextProvider,this.#ot=this.#J.options,this.#Ai=e.pluginCallButtons,this.#Bi=e.pluginCallButtons_sub}get plugins(){return this.#Ni}get fileInfo(){return this.#Oi}findComponentInfo(t){for(const e of this.#Ri){const s=e(t);if(s)return s}return null}applyRetainFormat(t){let e;(e=this.#ot.get("__pluginRetainFilter"))&&this.#Pi.forEach(((s,i)=>{const n=t.querySelectorAll(i);for(let t=0,i=n.length;t<i;t++)!0!==e&&!1===e[s.key]||s.method(n[t])}))}emitEvent(t,e){const s=this.#zi.get(t);for(let t,i=0;i<s.length;i++)if(t=s[i](e),"boolean"==typeof t)return t}async emitEventAsync(t,e){const s=this.#zi.get(t);for(let t,i=0;i<s.length;i++)if(t=await s[i](e),"boolean"==typeof t)return t}checkFileInfo(t){for(let e=0,s=this.#Ii.length;e<s;e++)this.#Ii[e](t)}resetFileInfo(){for(let t=0,e=this.#Vi.length;t<e;t++)this.#Vi[t]()}register(t,e,s){let i=this.#Ni[t];if(!i)throw Error(`[SUNEDITOR.registerPlugin.fail] The called plugin does not exist or is in an invalid format. (pluginName: "${t}")`);if("function"==typeof this.#Ni[t]&&(i=this.#Ni[t]=new this.#Ni[t](this.#F,s||{})),e){const{icons:s,lang:n}=this.#gi;for(let t=0,o=e.length;t<o;t++)us(e[t],i,s,n);this.#J.commandDispatcher.activeCommands.includes(t)||"function"!=typeof this.#Ni[t].active||this.#J.commandDispatcher.activeCommands.push(t)}}init(t){this.#Oi.tags=[],this.#Oi.pluginMap={},this.#Oi.tagAttrs={};const e=this.#Ni,s=[];let i;for(const n in e){if(this.register(n,this.#Ai[n],t[n]),this.register(n,this.#Bi[n],t[n]),i=this.#Ni[n],"object"==typeof i.__fileManagement){const t=i.__fileManagement;if(this.#Ii.push(t._checkInfo.bind(t)),this.#Vi.push(t._resetInfo.bind(t)),Array.isArray(t.tagNames)){const e=t.tagNames;this.#Oi.tags=this.#Oi.tags.concat(e),s.push(n);for(let s,i=0,o=e.length;i<o;i++)s=e[i].toLowerCase(),this.#Oi.pluginMap[s]=n,t.tagAttrs&&(this.#Oi.tagAttrs[s]=t.tagAttrs)}}"function"==typeof i.constructor.component&&this.#Ri.push(function(t,e){return e&&(e=t.component?.(e))?{target:e,pluginName:t.key,options:t.options}:null}.bind(null,i.constructor));const e=i.constructor.options||{};if(this.#zi.forEach(((t,s)=>{if("function"==typeof i[s]){const n=i[s].bind(i);n.index=e[`eventIndex_${s}`]||e.eventIndex||0,t.push(n)}})),i.retainFormat){const t=i.retainFormat();this.#Pi.set(t.query,{key:i.constructor.key,method:t.method})}}for(const t of this.#zi.values())t.sort(((t,e)=>t.index-e.index));(this.#ot.get("buttons").has("pageBreak")||this.#ot.get("buttons_sub")?.has("pageBreak"))&&this.#Ri.push(function(t,e,s){if(!s||!Ie.utils.hasClass(s,"se-page-break"))return null;return{target:s,launcher:{componentDestroy:s=>{const i=s.previousElementSibling||s.nextElementSibling;Ie.utils.removeItem(s),t.focusEdge(i),e.push(!1)}}}}.bind(null,this.#J.focusManager,this.#J.history)),this.#Oi.regExp=new RegExp(`^(${this.#Oi.tags.join("|")||"\\^"})$`,"i"),this.#Oi.pluginRegExp=new RegExp(`^(${0===s.length?"\\^":s.join("|")})$`,"i"),this.#Ai=null,this.#Bi=null}get(t){return this.#Ni[t]}_destroy(){for(const t in this.#Ni){const e=this.#Ni[t];e._destroy?.(),e.editor=null}this.#Ni=null,this.#Oi=null,this.#Ri=null,this.#zi?.clear(),this.#Pi?.clear()}};class Ki{#F;#J;#t;#ot;#Y;#Q;constructor(t){this.#F=t,this.#J=t.$,this.#t=t.store,this.#ot=this.#J.options,this.#Y=this.#J.frameContext,this.#Q=this.#J.frameOptions}focus(t){if(t&&this.#J.facade.changeFrameContext(t),"none"!==this.#Y.get("wysiwygFrame").style.display){if(this.#t.set("_preventBlur",!1),this.#Q.get("iframe")||!this.#Y.get("wysiwyg").contains(this.#J.selection.getNode()))this.nativeFocus();else try{const t=this.#J.selection.getRange();if(t.startContainer===t.endContainer&&Ie.check.isWysiwygFrame(t.startContainer)){const e=t.commonAncestorContainer.children[t.startOffset];if(!this.#J.format.isLine(e)&&!this.#J.component.is(e)){const t=Ie.utils.createElement("BR"),s=Ie.utils.createElement(this.#ot.get("defaultLine"),null,t);return this.#Y.get("wysiwyg").insertBefore(s,e),void this.#J.selection.setRange(t,0,t,0)}}this.#J.selection.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}catch(t){console.warn("[SUNEDITOR.focus.warn] ",t),this.nativeFocus()}this.#t.mode.isBalloon&&this.#F._eventOrchestrator._toggleToolbarBalloon()}}focusEdge(t){this.#t.set("_preventBlur",!1),t||=this.#Y.get("wysiwyg").lastElementChild;const e=this.#J.component.get(t);e?this.#J.component.select(e.target,e.pluginName):t?(3!==t.nodeType&&(t=Ie.query.getEdgeChild(t,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!0)),t?this.#J.selection.setRange(t,t.textContent.length,t,t.textContent.length):this.nativeFocus()):this.focus()}nativeFocus(){this.#J.selection.__focus(),this.#J.selection.init()}blur(){this.#Q.get("iframe")?this.#Y.get("wysiwygFrame").blur():this.#Y.get("wysiwyg").blur()}}const Yi=/^H[1-6]$/,Xi=/^(UL|OL)$/,Ji=/^LI$/,Qi=/^(THEAD|TBODY|TR|TD|TH)$/;function tn(t){let e=t;for(;e&&!X(e);){if("TABLE"===e.nodeName)return e;e=e.parentNode}return null}function en(t){let e=t;for(;e&&!X(e);){if(1===e.nodeType&&Y(e))return!0;e=e.parentNode}return!1}function sn(t,e){const s=t.querySelector(":scope > ul, :scope > ol");if(!s)return null;if(e<s.getBoundingClientRect().top)return null;const i=s.children;let n=null,o=1/0;for(let t=0;t<i.length;t++){const s=i[t];if(!Ji.test(s.nodeName))continue;const l=s.getBoundingClientRect();if(e>=l.top&&e<=l.bottom)return sn(s,e)||s;const r=Math.min(Math.abs(e-l.top),Math.abs(e-l.bottom));r<o&&(o=r,n=s)}return n}function nn(t,e,s,i){if(!t||!s)return null;if(3===t.nodeType&&!(t=t.parentNode))return null;if(X(t))return null;if(en(t))return null;let n=null;if(Qi.test(t.nodeName))n=tn(t);else if(Xi.test(t.nodeName))n=t;else if(Ji.test(t.nodeName))n=t;else if(G(t.parentNode))n=tn(t);else{const s=e.getLine(t,null);if(s&&(n=s),!n){const s=e.getBlock(t,null);s&&(n=Qi.test(s.nodeName)?tn(s):s)}}if(!n){let e=t;for(;e&&!X(e);){if(1===e.nodeType&&e.parentNode&&X(e.parentNode)){n=e;break}e=e.parentNode}}if(!n)return null;if(en(n))return null;if(void 0!==i)if(Xi.test(n.nodeName)){const t=function(t,e){const s=t.children;let i=null,n=1/0;for(let t=0;t<s.length;t++){const o=s[t];if(!Ji.test(o.nodeName))continue;const l=o.getBoundingClientRect();if(e>=l.top&&e<=l.bottom)return sn(o,e)||o;const r=Math.min(Math.abs(e-l.top),Math.abs(e-l.bottom));r<n&&(n=r,i=o)}return i}(n,i);t&&(n=t)}else if(Ji.test(n.nodeName)){const t=sn(n,i);t&&(n=t)}const{depth:o,parent:l}=function(t,e){let s=0,i=null,n=t.parentNode;for(;n&&!X(n);)1===n.nodeType&&(e.isBlock(n)||e.isLine(n))&&(i||(i=n),s++),n=n.parentNode;return{depth:s,parent:i}}(n,e),r={prev:(a=n).previousElementSibling,next:a.nextElementSibling};var a;return{element:n,type:function(t){const e=t.nodeName;return"P"===e||"DIV"===e?"p":Yi.test(e)?"heading":"LI"===e?"list-item":Xi.test(e)?"list":"BLOCKQUOTE"===e?"blockquote":"PRE"===e?"pre":"FIGURE"===e?"figure":"TABLE"===e?"table":"p"}(n),depth:o,parent:l,siblings:r,rect:n.getBoundingClientRect()}}const{_w:on}=Ne;const ln=class{#J;#Fi;#Di;#qi=null;#Wi;#Ui=new Map;#Zi=null;#Gi=[];#ji=[];selectMenu;constructor(t,e,s){this.#J=e,this.#Fi=s.resolveButton,this.#Di=Array.isArray(s.items)?s.items:[],this.#Wi="function"==typeof s.renderCustomItem?s.renderCustomItem:null;const i=s.selectMenuParams?.closeMethod;this.selectMenu=new Ei(e,{...s.selectMenuParams,closeMethod:()=>{this.#Ki(),this.#Yi(),i?.()},subEscMethod:()=>{if(!this.#Zi)return!1;const t=this.#Zi.anchorLi;this.#Ki();const e=t?Number(t.getAttribute("data-index")):NaN;return Number.isNaN(e)||this.selectMenu.setItem(e),!0}})}attach(t,e,s={}){this.selectMenu.on(t,e,s),this.#J.eventManager.addEvent(this.selectMenu.form,"mousedown",(t=>{Ne.isMobile?this.#J.store.set("_preventBlur",!0):t.preventDefault()})),this.#J.eventManager.addEvent(this.selectMenu.form,"mousemove",this.#Xi.bind(this))}setItems(t){this.#Di=Array.isArray(t)?t:[],this.#qi=null}getItems(){if(this.#qi)return this.#qi;const t=[];for(const i of this.#Di)if("string"==typeof i){const e=this.#Fi(i,this.#J.plugins,this.#J.options,this.#J.icons,this.#J.lang);if(!e)continue;const s=e.type||"";if(/dropdown-free/.test(s)){t.push({kind:"dropdownFree",title:e.title,iconHTML:e.icon||"",search:(e.title+" "+i).toLowerCase(),name:i,type:s});continue}if(/dropdown/.test(s)){const s=this.#J.menu?.itemsMap?.[i]||[];if(s.length>0){t.push({kind:"submenu",title:e.title,iconHTML:e.icon||"",search:(e.title+" "+i).toLowerCase(),name:i,children:s.map((t=>({pluginName:i,element:t._element}))),childMenus:s.map((t=>{const e=t._element?.querySelector(".se-list-icon")||t._element?.querySelector("svg"),s=e?e.outerHTML:"";return`<span class="se-block-submenu-item">${s?`${s}<span>${t.title}</span>`:t.title}</span>`}))});continue}}t.push({kind:"plugin",title:e.title,iconHTML:e.icon||"",search:(e.title+" "+i).toLowerCase(),name:i,type:s,command:e.command})}else if(i&&"object"==typeof i&&"function"==typeof i.action){const n=i.title||i.key||"",o=Array.isArray(i.keywords)?i.keywords.join(" "):"";t.push({kind:"custom",title:n,iconHTML:(e=i.icon,s=this.#J.icons,e&&"string"==typeof e?"<"===e.charAt(0)?e:s[e]||"":""),search:(n+" "+o).toLowerCase(),raw:i})}var e,s;return this.#qi=t,t}filter(t,e=1/0){const s=this.getItems(),i=(t||"").toLowerCase().trim(),n=[];for(const t of s)if(i&&-1===t.search.indexOf(i)||n.push(t),n.length>=e)break;return n}renderRows(t){const e={icons:this.#J.icons},s=`<span class="se-submenu-arrow">${this.#J.icons.menu_arrow_right}</span>`;return t.map((t=>{if("custom"===t.kind&&this.#Wi)return this.#Wi(t.raw,e);const i=(n=t.title,`<button type="button" class="se-cmd-row">${(o=t.iconHTML)?`<span class="se-block-menu-icon">${o}</span><span class="se-block-menu-label">${n}</span>`:`<span class="se-block-menu-label se-block-menu-label-full">${n}</span>`}</button>`);var n,o;return"dropdownFree"===t.kind?i+s:i}))}createRows(t){this.#Yi();const e=t.map((t=>"submenu"===t.kind?{children:t.children,childMenus:t.childMenus}:t));this.selectMenu.create(e,this.renderRows(t)),this.#Ui.clear(),this.#Gi.length=0,t.forEach(((t,e)=>{"dropdownFree"===t.kind&&this.#Ui.set(e,{name:t.name,plugin:this.#J.plugins[t.name],li:this.selectMenu.menus[e]}),"plugin"!==t.kind&&"dropdownFree"!==t.kind||this.#Gi.push({name:t.name,idx:e})})),this.selectMenu.isOpen&&this.#Ji()}open(t){this.selectMenu.open(t),0===this.#ji.length&&this.#Ji()}close(){this.#Yi(),this.selectMenu.close()}hasOpenSubPanel(){return this.selectMenu.hasOpenSubmenu()||!!this.#Zi}#Ji(){const t=this.#J.commandDispatcher;for(const{name:e,idx:s}of this.#Gi){const i=this.#Qi(s);i&&(t.registerTargets(e,i),this.#ji.push({name:e,target:i}))}this.#J.store.set("_lastSelectionNode",null),this.#J.eventManager.applyTagEffect()}#Yi(){if(0===this.#ji.length)return;const t=this.#J.commandDispatcher;for(const{name:e,target:s}of this.#ji)t.unregisterTargets(e,s);this.#ji.length=0}#Qi(t){const e=this.selectMenu.menus[t];return e?e.querySelector("button.se-cmd-row")||e:null}setItem(t){this.selectMenu.setItem(t)}setHidden(t){this.selectMenu.setHidden(t)}get isOpen(){return this.selectMenu.isOpen}dispatch(t,e){if(!t)return!1;const s=t;if(s.pluginName&&s.element){const t=this.#J.plugins[s.pluginName];return t?.action?.(s.element),this.#J.history.push(!1),!0}const i=t;if("custom"===i.kind){try{i.raw.action(this.#J,e)}catch(t){console.error("[SUNEDITOR.commandMenu.customAction]",t)}return!1}if("dropdownFree"===i.kind){const t=this.#J.plugins[i.name];if(!t)return!1;if(this.#Zi?.plugin===t)return this.#Ki(),!1;const e=this.selectMenu.items.indexOf(i),s=e>=0?this.selectMenu.menus[e]:null;return s&&this.#tn(i.name,t,s),!1}const n=i.name?this.#J.plugins[i.name]:null;if(n){const t=i.type||"";return/modal/.test(t)?n.open?.():/browser/.test(t)?n.open?.(null):/popup/.test(t)?n.show?.():n.action?.(Ie.utils.createElement("BUTTON",{"data-command":i.name})),this.#J.history.push(!1),!0}return i.command&&this.#J.commandDispatcher.run(i.command,null,null),!1}#Xi(t){if(0===this.#Ui.size)return;const e=t.target;if(this.#Zi?.dropdown?.contains(e))return;const s=e.closest?.("li[data-index]");if(!s)return;const i=Number(s.getAttribute("data-index")),n=this.#Ui.get(i);n?this.#Zi?.plugin!==n.plugin&&this.#tn(n.name,n.plugin,n.li):this.#Zi&&this.#Ki()}#tn(t,e,s){this.#Zi&&this.#Ki();const i=this.#J.menu?.targetMap?.[t];if(!i||!this.selectMenu.form)return;const n=i.parentNode;this.selectMenu.form.appendChild(i),this.#en(i,s,this.selectMenu.form),Ie.utils.addClass(s,"se-submenu-open"),e.on?.(s);const o=this.#J.eventManager.addEvent(i,"click",(()=>on.setTimeout((()=>{this.#Ki(),this.selectMenu.close()}),0)));this.#Zi={dropdown:i,plugin:e,originalParent:n,anchorLi:s,evClick:o}}#Ki(){const t=this.#Zi;t&&(this.#Zi=null,this.#J?.eventManager.removeEvent(t.evClick),t.dropdown.style.cssText="",t.dropdown.style.display="none",t.anchorLi&&Ie.utils.removeClass(t.anchorLi,"se-submenu-open"),t.originalParent&&t.originalParent!==t.dropdown.parentNode&&t.originalParent.appendChild(t.dropdown),t.plugin?.off?.())}#en(t,e,s){const i=e.getBoundingClientRect(),n=s.getBoundingClientRect(),o=!!this.#J.options.get("_rtl");t.style.position="absolute",t.style.right="",t.style.visibility="hidden",t.style.display="block";const l=t.offsetWidth,r=t.offsetHeight,a=on.innerWidth,h=on.innerHeight,c=i.right+4,d=i.left-l-4,u=Math.max(0,c+l-a),p=Math.max(0,-d);let g;g="right"===(o?"left":"right")?0===u?c:0===p?d:u<=p?c-u:d+p:0===p?d:0===u?c:p<=u?d+p:c-u,t.style.left=g-n.left+"px";const m=i.top,f=i.bottom-r,v=Math.max(0,m+r-h),b=Math.max(0,-f);let y;y=0===v?m:0===b?f:v<=b?m-v:f+b,t.style.top=y-n.top+"px",t.style.visibility=""}},{_w:rn,_d:an}=Ne;const hn=class{#J;#sn;#in;#nn;#on;#ln;#rn=null;#an=null;#hn=null;#cn=null;#dn=void 0;#un=null;#pn=[];#gn=!1;#mn=null;#fn=null;#vn=null;#bn=null;#yn=null;constructor(t,e,s,i,n,o){this.#J=t,this.#sn=e,this.#in=s,this.#nn=i,this.#on=n,this.#ln=o||null,this.#J.contextProvider.carrierWrapper.appendChild(this.#in);const l=this.#J.eventManager;l.addEvent(this.#in,"mousedown",this.#Cn.bind(this)),this.#mn=Ie.utils.createElement("DIV",{class:"se-block-drag-indicator"}),this.#mn.style.display="none",this.#sn.parentElement?.appendChild(this.#mn),l.addEvent(this.#nn,"click",this.#wn.bind(this)),this.#on.draggable=!0,l.addEvent(this.#on,"dragstart",this.#_n.bind(this)),l.addEvent(this.#on,"dragend",this.#xn.bind(this)),l.addEvent(this.#on,"click",this.#$n.bind(this)),l.addEvent(this.#sn,"mousemove",this.#kn.bind(this)),l.addEvent(this.#sn,"mouseleave",this.#Sn.bind(this));const r=this.#sn.parentElement;r&&(l.addEvent(r,"mouseleave",this.#En.bind(this)),l.addEvent(r,"dragover",this.#Tn.bind(this)),l.addEvent(r,"drop",this.#Mn.bind(this))),l.addEvent(this.#J.frameContext.get("eventWysiwyg"),"keydown",this.#Hn.bind(this),!0)}#Ln(){this.#in.style.display="flex";try{this.#in.showPopover?.()}catch{}}#Nn(){try{this.#in.hidePopover?.()}catch{}this.#in.style.display="none"}positionForTarget(t,e){this.#An(),this.#rn?.isOpen||this.#gn||(this.#cn=t,this.#dn=e,this.#hn||(this.#hn=rn.requestAnimationFrame((()=>{this.#hn=null,this.#cn&&this.#Bn(this.#cn,this.#dn)}))))}hide(t){if(this.#rn?.isOpen)return;const e=t?.relatedTarget;e&&(this.#sn.contains(e)||this.#in?.contains(e))||this.#In()}hideNow(){this.#An(),this.#Nn(),this.#rn?.close(),this.#Vn(null)}syncScroll(){this.#an&&(Ie.utils.addClass(this.#in,"se-no-transition"),this.#On(this.#an),this.#in.offsetHeight,Ie.utils.removeClass(this.#in,"se-no-transition"),this.#rn?.isOpen&&this.#rn.setHidden("none"===this.#in.style.display))}destroy(){this.#hn&&(rn.cancelAnimationFrame(this.#hn),this.#hn=null),this.#gn=!1,this.#An(),this.#on&&(this.#on.draggable=!1),this.#mn?.remove(),this.#in?.remove(),this.#rn?.close(),this.#rn=null,this.#Vn(null),this.#cn=null,this.#dn=void 0,this.#J=null,this.#sn=null,this.#in=null,this.#nn=null,this.#on=null}#Vn(t){if(this.#Rn(),this.#an=t,!t)return;const e=this.#Pn(t);if(e){this.#pn=e;for(let t=0;t<e.length;t++)Ie.utils.addClass(e[t],"se-block-hover")}else Ie.utils.addClass(t,"se-block-hover")}#Pn(t){try{const e=this.#J.selection.getRange();if(!e||e.collapsed)return null;const s=this.#J.format.getLine(e.startContainer,null),i=this.#J.format.getLine(e.endContainer,null);if(!s||!i||s===i)return null;const n=Ie.query.getListChildren(e.commonAncestorContainer,(t=>this.#J.format.isLine(t)),null),o=n.indexOf(s),l=n.indexOf(i);if(-1===o||-1===l)return null;const r=n.slice(Math.min(o,l),Math.max(o,l)+1);return-1===r.indexOf(t)?null:r}catch{}return null}#zn(t){this.#Rn(),this.#pn=t||[];for(let t=0;t<this.#pn.length;t++)Ie.utils.addClass(this.#pn[t],"se-block-hover")}#Rn(){this.#an&&Ie.utils.removeClass(this.#an,"se-block-hover");for(let t=0;t<this.#pn.length;t++)Ie.utils.removeClass(this.#pn[t],"se-block-hover");this.#pn=[]}#In(){this.#un||(this.#un=rn.setTimeout((()=>{this.#un=null,this.#Nn(),this.#rn?.close(),this.#Vn(null)}),200))}#An(){this.#un&&(rn.clearTimeout(this.#un),this.#un=null)}#kn(t){if(!this.#J)return;if(this.#gn)return;if(this.#An(),this.#rn?.isOpen)return;const e=this.#J.frameContext.get("wysiwyg");if(!e)return;const s=this.#J.frameContext.get("wysiwygFrame");let i;if(s&&"IFRAME"===s.nodeName){const e=s.getBoundingClientRect(),n=s.contentDocument;n&&(i=n.elementFromPoint(e.width/2,t.clientY-e.top))}else{const s=e.getBoundingClientRect();i=document.elementFromPoint(s.left+s.width/2,t.clientY)}i&&e.contains(i)&&this.#Bn(i,t.clientY)}#Sn(t){this.#rn?.isOpen||this.#Fn(t?.relatedTarget)||this.hideNow()}#En(t){this.#rn?.isOpen||this.#Fn(t?.relatedTarget)||this.hideNow()}#Fn(t){if(!t)return!1;const e=this.#sn?.parentElement;return!(!this.#in?.contains(t)&&!e?.contains(t))}#Bn(t,e){if(!this.#J)return;const s=this.#J.format,i=this.#J.frameContext.get("wysiwyg");if(!i)return;let n=t;if(n===i&&void 0!==e){const t=i.getBoundingClientRect(),s=document.elementFromPoint(t.left+t.width/2,e);s&&i.contains(s)&&s!==i&&(n=s)}const o=nn(n,{getLine:(t,e)=>s.getLine(t,e),getBlock:(t,e)=>s.getBlock(t,e),isLine:t=>s.isLine(t),isBlock:t=>s.isBlock(t)},i,e);if(o){if(o.element!==this.#an||"flex"!==this.#in.style.display){if(this.#an?.isConnected&&"flex"===this.#in.style.display&&void 0!==e&&!this.#an.contains(o.element)){const t=this.#an.getBoundingClientRect();if(e>=t.top&&e<=t.bottom)return}this.#Vn(o.element),this.#On(o.element)}}else this.#In()}#On(t){if(!t.isConnected)return void this.hideNow();const e=t.getBoundingClientRect(),s=this.#sn.getBoundingClientRect(),i=this.#J.frameContext.get("wysiwygFrame"),n=/^iframe$/i.test(i.nodeName),o=n?i.getBoundingClientRect():null;if(n){const t=i.clientHeight||0;if(e.bottom<=0||e.top>=t)return void this.#Nn()}else{const t=i.getBoundingClientRect();if(e.bottom<=t.top||e.top>=t.bottom)return void this.#Nn()}const l=rn.scrollX,r=rn.scrollY,a=(n?e.top+o.top:e.top)+r,h=!!this.#J.options.get("_rtl"),c=this.#Dn(t,h);let d=0;if(this.#J.frameOptions.get("innerWidth")){const t=this.#J.frameContext.get("wysiwyg");if(t){const e=rn.getComputedStyle(t),s=parseFloat(h?e.paddingRight:e.paddingLeft)||0,i=function(t,e){const s=(t||"").trim(),i=parseFloat(s);return i?/rem$/.test(s)?i*(parseFloat(rn.getComputedStyle(an.documentElement).fontSize)||16):/em$/.test(s)?i*(parseFloat(e.fontSize)||16):i:0}(e.getPropertyValue("--se-edit-inner-padding"),e);d=Math.max(0,s-i)}}const u=c+d,p="flex"!==this.#in.style.display;p&&Ie.utils.addClass(this.#in,"se-no-transition"),this.#in.style.top=a+"px",h?(this.#in.style.left="",this.#in.style.right=rn.innerWidth-s.right-l+u+"px"):(this.#in.style.right="",this.#in.style.left=s.left+l+u+"px"),this.#Ln(),p&&(this.#in.offsetHeight,Ie.utils.removeClass(this.#in,"se-no-transition"))}#Dn(t,e){const s=this.#J.frameContext.get("wysiwyg");if(!s)return 0;const i=this.#J.format,n=e?"marginRight":"marginLeft",o=e?"paddingRight":"paddingLeft";let l=0;l+=parseFloat(rn.getComputedStyle(t)[n])||0;let r=t.parentElement;for(;r&&r!==s;){if(i.isBlock(r)){const t=rn.getComputedStyle(r);l+=(parseFloat(t[o])||0)+(parseFloat(t[n])||0)}r=r.parentElement}return l}#qn(){if(!this.#an)return;const t=this.#an,e=this.#Pn(t),s=e?e[0]:t,i=e?e[e.length-1]:t;this.#J.selection.setRange(s,0,i,i.childNodes.length)}#wn(t){if(t.preventDefault(),t.stopPropagation(),!this.#an)return;const e=this.#J.format.addLineAfter(this.#an);e&&(this.#J.selection.setRange(e,1,e,1),this.#J.history.push(!1))}#Cn(t){const e=this.#on&&(t.target===this.#on||this.#on.contains(t.target));Ne.isMobile?this.#J.store.set("_preventBlur",!0):e||t.preventDefault()}#Hn(){this.#Rn()}#_n(t){if(!this.#an)return void t.preventDefault();this.#fn=this.#an,this.#gn=!0,this.#rn?.close(),Ie.utils.addClass(this.#fn,"se-block-dragging");const e=this.#J.frameContext.get("wysiwyg");this.#bn=e||null,this.#yn=e?Array.from(e.children):null;const s=!!this.#J.options.get("_rtl"),i=this.#fn;t.dataTransfer.setDragImage(i,s?i.offsetWidth:-5,-5),t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("application/x-suneditor-block-drag","1")}#Tn(t){this.#gn&&(t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect="move",this.#Wn(t.clientY))}#Mn(t){this.#gn&&(t.preventDefault(),t.stopPropagation(),this.#Un())}#xn(){if(this.#fn&&Ie.utils.removeClass(this.#fn,"se-block-dragging"),this.#mn.style.display="none",this.#gn=!1,this.#fn=null,this.#vn=null,this.#bn=null,this.#yn=null,this.#on?.parentNode){const t=this.#on.parentNode,e=this.#on.nextSibling;t.removeChild(this.#on),t.insertBefore(this.#on,e)}}#Wn(t){if(!this.#J||!this.#fn)return;const e=this.#bn,s=this.#yn;if(!e||!s)return;const i=e.getBoundingClientRect(),n=this.#sn.parentElement.getBoundingClientRect();let o=null,l="after",r=0,a=1/0;for(let e=0;e<s.length;e++){const i=s[e],n=i.getBoundingClientRect(),h=Math.abs(t-n.top);h<a&&(a=h,o=i,l="before",r=n.top);const c=Math.abs(t-n.bottom);c<a&&(a=c,o=i,l="after",r=n.bottom)}if(o&&o!==this.#fn){this.#vn={element:o,position:l};const t=this.#mn;t.style.display="block",t.style.top=r-n.top+"px",t.style.left=i.left-n.left+"px",t.style.width=i.width+"px"}else this.#vn=null,this.#mn.style.display="none"}#Un(){const t=this.#fn,e=this.#vn;if(!t||!e||e.element===t)return;t.parentNode&&("before"===e.position?e.element.parentNode.insertBefore(t,e.element):e.element.parentNode.insertBefore(t,e.element.nextSibling),this.#Vn(t),this.#On(t),this.#J.history.push(!1))}#$n(t){if(t.preventDefault(),t.stopPropagation(),!this.#gn&&this.#ln)if(this.#rn||(this.#rn=this.#Zn()),this.#rn.isOpen)this.#rn.close();else{this.#qn();const t=this.#J.format.getLines(null);t.length>0&&this.#zn(t);const e=this.#J.offset.getGlobal(this.#on),s=Ie.utils.getClientSize().h-(e.top-rn.scrollY+e.height),i=e.top-rn.scrollY,n=`${this.#J.options.get("_rtl")?"left":"right"}-${s>=i?"bottom":"top"}`;this.#rn.open(n)}}#Zn(){const t=new ln(this,this.#J,{items:this.#ln,resolveButton:as,selectMenuParams:{position:"right-top",dir:this.#J.options.get("_rtl")?"rtl":"ltr",minWidth:"200px",keydownTarget:rn,closeMethod:()=>{Ie.utils.removeClass(this.#on,"on"),this.#Rn()},openMethod:()=>{Ie.utils.addClass(this.#on,"on")}}});return t.attach(this.#on,this.#Gn.bind(this),{class:"se-block-action-menu"}),t.createRows(t.getItems()),t}#Gn(t){this.#an&&this.#J&&t&&(this.#rn?.dispatch(t,{block:this.#an}),"dropdownFree"!==t.kind&&this.#rn?.close())}},{NO_EVENT:cn}=Ne,dn={bold:["font-weight"],underline:["text-decoration"],italic:["font-style"],strike:["text-decoration"]};class un{#F;#J;#t;#Y;#ot;#mi;#jn=null;#Kn=null;#Yn=null;#Xn=null;constructor(t){this.#F=t,this.#J=t.$,this.#t=t.store,this.#Y=this.#J.frameContext,this.#ot=this.#J.options,this.#mi=this.#J.eventManager}async execute(t,e){if(!this.#Y.get("isReadOnly")||/copy|cut|selectAll|selectAll_full|codeView|markdownView|fullScreen|print|preview|showBlocks|finder/.test(t))switch(t){case"selectAll":this.#Jn();break;case"selectAll_full":this.#Qn();break;case"copy":{const t=this.#J.selection.getRange();if(t.collapsed)break;const e=Ie.utils.createElement("div",null,t.cloneContents());await this.#J.html.copy(e.innerHTML);break}case"newDocument":this.#J.html.set(`<${this.#ot.get("defaultLine")}><br></${this.#ot.get("defaultLine")}>`),this.#J.focusManager.focus(),this.#J.history.push(!1),this.#Y.has("documentType_use_header")&&this.#Y.get("documentType").reHeader();break;case"finder":this.#J.finder.open(!0);break;case"codeView":this.#J.viewer.codeView(!this.#Y.get("isCodeView"));break;case"markdownView":this.#J.viewer.markdownView(!this.#Y.get("isMarkdownView"));break;case"fullScreen":this.#J.viewer.fullScreen(!this.#Y.get("isFullScreen"));break;case"indent":this.#J.format.indent();break;case"outdent":this.#J.format.outdent();break;case"undo":this.#J.history.undo();break;case"redo":this.#J.history.redo();break;case"removeFormat":this.#J.inline.remove(),this.#J.focusManager.focus();break;case"print":this.#J.viewer.print();break;case"preview":this.#J.viewer.preview();break;case"showBlocks":this.#J.viewer.showBlocks(!this.#Y.get("isShowBlocks"));break;case"dir":this.#J.ui.setDir(this.#ot.get("_rtl")?"ltr":"rtl");break;case"dir_ltr":this.#J.ui.setDir("ltr");break;case"dir_rtl":this.#J.ui.setDir("rtl");break;case"save":await this.#to();break;case"copyFormat":this.#eo(e);break;case"pageBreak":this.#so();break;case"pageUp":this.#Y.get("documentType").pageUp();break;case"pageDown":this.#Y.get("documentType").pageDown();break;default:this.#io(t)}}copyFormat(){if(this.#Yn?.length)try{const t=[...this.#Yn],e=t.pop();if(this.#J.inline.remove(),e){const s=this.#J.inline.apply(e,{stylesToModify:null,nodesToRemove:[e.nodeName],strictRemove:!1}),{parent:i,inner:n}=this.#J.nodeTransform.createNestedNode(t);s.parentNode.insertBefore(i,s),n.appendChild(s),this.#J.selection.setRange(s,Ie.check.isZeroWidth(s)?1:0,s,1)}if(this.#ot.get("copyFormatKeepOn"))return;this.#Xn()}catch(t){console.warn("[SUNEDITOR.copyFormat.error] ",t),this.#Xn?.()||(this.#Yn=null,this.#Xn=null)}}#Jn(){this.#J.ui.offCurrentController(),this.#J.menu.containerOff();const t=this.#Y.get("wysiwyg");let e=null,s="";const i=this.#ot.get("scopeSelectionTags"),n=this.#J.selection.getRange();if(!n.collapsed){let o=e=n.commonAncestorContainer,l=s=o.nodeName?.toLowerCase();if(0===n.startOffset&&n.endOffset===n.endContainer.textContent?.length){const t=o.parentElement;(Ie.check.isList(t)||Ie.check.isListCell(t))&&t.firstChild.contains?.(n.startContainer)&&t.lastChild?.contains(n.endContainer)&&(e=o=t.parentElement,s=o.nodeName?.toLowerCase())}for(l=o.nodeName?.toLowerCase();o&&(!o.nextSibling&&!o.previousSibling&&!i.includes(l)||Ie.check.isContentLess(l))&&o!==t;)o=o.parentElement,l=o.nodeName?.toLowerCase();i.includes(l)&&(e=o,s=l)}const o=i.filter((t=>t!==s));let l=Ie.query.getParentElement(e||this.#J.selection.getNode(),(t=>o.includes(t.nodeName?.toLowerCase())))||t,{first:r,last:a}=pn(l);if(!r||!a)return;const h=Ie.check.isZeroWidth;for(;h(r)&&h(a)&&l!==t;)l=l.parentElement,({first:r,last:a}=pn(Ie.query.getParentElement(l,(t=>o.includes(t.nodeName?.toLowerCase())))||t));if(!r||!a)return;let c=null;if(Ie.check.isMedia(r)||(c=this.#J.component.get(r))||Ie.check.isTableElements(r)){c||=this.#J.component.get(r);const t=Ie.utils.createElement("BR"),e=Ie.utils.createElement(this.#ot.get("defaultLine"),null,t);r=c?c.container||c.cover:r,r.parentElement.insertBefore(e,r),r=t}if(Ie.check.isMedia(a)||(c=this.#J.component.get(a))||Ie.check.isTableElements(a)){c||=this.#J.component.get(a);const t=Ie.utils.createElement("BR"),e=Ie.utils.createElement(this.#ot.get("defaultLine"),null,t);a=c?c.container||c.cover:a,a.parentElement.appendChild(e),a=t}this.#J.toolbar._showBalloon(this.#J.selection.setRange(r,0,a,a.textContent.length))}#Qn(){this.#J.ui.offCurrentController(),this.#J.menu.containerOff();const t=this.#Y.get("wysiwyg");let{first:e,last:s}=pn(t);if(!e||!s)return;let i=null;if(Ie.check.isMedia(e)||(i=this.#J.component.get(e))||Ie.check.isTableElements(e)){i||=this.#J.component.get(e);const t=Ie.utils.createElement("BR"),s=Ie.utils.createElement(this.#ot.get("defaultLine"),null,t);e=i?i.container||i.cover:e,e.parentElement.insertBefore(s,e),e=t}if(Ie.check.isMedia(s)||(i=this.#J.component.get(s))||Ie.check.isTableElements(s)){i||=this.#J.component.get(s);const t=Ie.utils.createElement("BR"),e=Ie.utils.createElement(this.#ot.get("defaultLine"),null,t);s=i?i.container||i.cover:s,s.parentElement.appendChild(e),s=t}this.#J.toolbar._showBalloon(this.#J.selection.setRange(e,0,s,s.textContent.length))}async#to(){const t=this.#Y;if(!t.get("isChanged"))return;const e=this.#J.html.get(),s=await this.#mi.triggerEvent("onSave",{frameContext:t,data:e});if(s===cn){const s=t.get("originElement");/^TEXTAREA$/i.test(s.nodeName)?s.value=e:s.innerHTML=e}else if(!1===s)return;t.set("isChanged",!1),t.set("savedIndex",this.#J.history.getRootStack()[this.#t.get("rootKey")].index),this.#J.commandDispatcher.applyTargets("save",(t=>{t.disabled=!0}))}#eo(t){if("function"==typeof this.#Xn)return void this.#Xn();const e=this.#Y.get("wysiwyg");this.#Yn=[...this.#F._eventOrchestrator.__cacheStyleNodes],this.#Xn=this.#no.bind(this,this.#mi,e,t),Ie.utils.addClass(e,"se-copy-format-cursor"),Ie.utils.addClass(t,"on"),this.#jn=this.#mi.addGlobalEvent("keydown",(t=>{Oe.isEsc(t.code)&&this.#Xn?.()})),this.#Kn=this.#mi.addGlobalEvent("mousedown",(s=>{e.contains(s.target)||s.target===t||this.#Xn?.()}))}#no(t,e,s){return this.#jn=t.removeGlobalEvent(this.#jn),this.#Kn=t.removeGlobalEvent(this.#Kn),this.#Yn=null,this.#Xn=null,Ie.utils.removeClass(e,"se-copy-format-cursor"),Ie.utils.removeClass(s,"on"),!0}#io(t){t=this.#ot.get("_defaultTagCommand")[t.toLowerCase()]||t;let e=this.#ot.get("convertTextTags")[t]||t;const s=this.#t.get("currentNodesMap"),i=s.includes(this.#ot.get("_styleCommandMap")[e])?null:Ie.utils.createElement(e);/^sub$/i.test(e)&&s.includes("superscript")?e="sup":/^sup$/i.test(e)&&s.includes("subscript")&&(e="sub"),this.#J.inline.apply(i,{stylesToModify:dn[t]||null,nodesToRemove:[e],strictRemove:!1}),this.#J.focusManager.focus()}#so(){const t=Ie.utils.createElement("DIV",{class:"se-component se-component-line-break se-page-break"});this.#J.component.insert(t,{skipCharCount:!0,insertBehavior:"line"});const e=t.nextElementSibling||this.#J.format.addLine(t);this.#J.selection.setRange(e,1,e,1),this.#J.history.push(!1)}}const pn=function(t){const e=Ie.check.isContentLess;return{first:Ie.query.getEdgeChild(Ie.query.getEdgeChild(t,(t=>!e(t)),!1),(t=>0===t.childNodes.length||3===t.nodeType||Z(t)||U(t)),!1)||t.firstChild,last:Ie.query.getEdgeChild(t.lastChild,(t=>0===t.childNodes.length||3===t.nodeType||Z(t)||U(t)),!0)||t.lastChild}},gn=".se-menu-list .se-toolbar-btn[data-command]",mn=["bold","underline","italic","strike","subscript","superscript","indent","outdent"],fn=mn.concat(["undo","redo","save","fullScreen","showBlocks","codeView","markdownView","finder","dir","dir_ltr","dir_rtl"]);class vn{#J;#e;#ot;#oo;#lo=new Map;#ro=mn;constructor(t){this.#J=t.$,this.#e=this.#J.context,this.#ot=this.#J.options,this.#oo=new un(t),this.allCommandButtons=new Map,this.subAllCommandButtons=new Map}get targets(){return this.#lo}get activeCommands(){return this.#ro}run(t,e,s){if(e){if(/more/i.test(e)){const e=Ie.query.getParentElement(s,".se-toolbar"),i=Ie.utils.hasClass(e,"se-toolbar-sub")?this.#J.subToolbar:this.#J.toolbar;if(s!==i.currentMoreLayerActiveButton){const n=e.querySelector("."+t);n&&(i._moreLayerOn(s,n),i._showBalloon(),i._showInline()),Ie.utils.addClass(s,"on")}else i.currentMoreLayerActiveButton&&(i._moreLayerOff(),i._showBalloon(),i._showInline());return void this.#J.viewer._resetFullScreenHeight()}if(/container/.test(e)&&(null===this.#J.menu.targetMap[t]||s!==this.#J.menu.currentContainerActiveButton))return void this.#J.menu.containerOn(s);if(this.#J.ui.isButtonDisabled(s))return;if(/dropdown/.test(e)&&(null===this.#J.menu.targetMap[t]||s!==this.#J.menu.currentDropdownActiveButton))return void this.#J.menu.dropdownOn(s);if(/modal/.test(e))return void this.#J.plugins[t].open(s);/command/.test(e)?this.#J.plugins[t].action(s):/browser/.test(e)?this.#J.plugins[t].open(null):/popup/.test(e)&&this.#J.plugins[t].show()}else t&&this.#oo.execute(t,s);/dropdown/.test(e)?this.#J.menu.dropdownOff():/command/.test(e)||(this.#J.menu.dropdownOff(),this.#J.menu.containerOff())}runFromTarget(t){if(Ie.check.isInputElement(t))return;const e=Ie.query.getCommandTarget(t);if(!e)return;const s=e.getAttribute("data-command"),i=e.getAttribute("data-type");(s||i)&&(e.disabled||this.run(s,i,t))}applyTargets(t,e){this.#lo.has(t)&&this.#lo.get(t).forEach(e)}registerTargets(t,e){if(!t||!e)return;(fn.includes(t)||this.#J.plugins[t])&&(this.#lo.get(t)?this.#lo.get(t).includes(e)||this.#lo.get(t).push(e):this.#lo.set(t,[e]))}unregisterTargets(t,e){const s=this.#lo.get(t);if(!s)return;const i=s.indexOf(e);-1!==i&&s.splice(i,1),0===s.length&&this.#lo.delete(t)}resetTargets(){this.#lo=new Map,this._initCommandButtons()}_initCommandButtons(){const t=this.#e;this.#ao(this.allCommandButtons,t.get("toolbar_buttonTray")),this.#ao(this.subAllCommandButtons,t.get("toolbar_sub_buttonTray"))}_copyFormat(){this.#oo.copyFormat()}#ao(t,e){if(!e)return;const s=e.querySelectorAll(gn),i=this.#ot.get("shortcuts"),n=this.#ot.get("_reverseCommandArray"),o=this.#J.shortcuts.keyMap,l=this.#J.shortcuts.reverseKeys;for(let e,r,a=0,h=s.length;a<h;a++)e=s[a],r=e.getAttribute("data-command"),t.set(r,e),this.registerTargets(r,e),Qe(r,e,i[r],o,n,l)}_destroy(){this.#lo.clear(),this.allCommandButtons.clear(),this.subAllCommandButtons.clear(),this.#ro=null}}const bn=`${gn}:not([class~="se-code-view-enabled"]):not([data-type="MORE"])`,yn=`${gn}:not([class~="se-component-enabled"]):not([data-type="MORE"])`,{_w:Cn}=Ne;const wn=class{#F;#J;#t;#gi;#nt;#ot;#e;#I;#Y;#mi;#ho;#co;#do;#uo;#po=null;#go;#mo=!1;#fo=null;#vo=null;#bo=[];#yo=[];#Co=!1;#wo=null;#_o=null;#xo=null;constructor(t){this.#F=t,this.#J=t.$,this.#t=t.store,this.#gi=this.#J.contextProvider,this.#nt=this.#gi.carrierWrapper,this.#ot=this.#J.options,this.#e=this.#J.context,this.#I=this.#J.frameRoots,this.#Y=this.#J.frameContext,this.#mi=this.#J.eventManager;const e=function({lang:t,icons:e}){const s='<div><button class="close" data-command="close" title="'+t.close+'">'+e.cancel+"</button></div><div><span></span></div>";return Ie.utils.createElement("DIV",{class:"se-alert-content"},s)}(this.#gi);this.alertModal=e,this.alertMessage=e.querySelector("span");const s=function(){const t='<div class="se-toast-container"><span></span></div>';return Ie.utils.createElement("DIV",{class:"se-toast"},t)}();s.setAttribute("popover","manual"),this.toastPopup=s,this.toastContainer=s.querySelector(".se-toast-container"),this.toastMessage=s.querySelector("span"),this.#nt.appendChild(s),this.#ho=this.#nt.querySelector(".se-alert"),this.#co=this.#nt.querySelector(".se-alert .se-modal-inner"),this.#co.appendChild(e),this.#do=[this.#$o.bind(this),this.#ko.bind(this)],this.#uo=!1,this.#go=this.#nt.querySelector(".se-back-wrapper"),this.selectMenuOn=!1,this.opendControllers=[],this.controllerTargetContext=null,this._figureContainer=null}setEditorStyle(t,e){e||=this.#Y;const s=e.get("options");s.set("editorStyle",t);const i=Be._setDefaultOptionStyle(s,t);s.set("_defaultStyles",i),e.get("topArea").style.cssText=i.top;const n=e.get("code");if(this.#ot.get("hasCodeMirror")){const t=s.get("_defaultStyles").frame.split(";");for(let e,s=0,i=t.length;s<i;s++){if(e=t[s].trim(),!e)continue;const[i,o]=e.split(":");n.style.setProperty(i.trim(),o.trim())}}else n.style.cssText=s.get("_defaultStyles").frame;s.get("iframe")?(e.get("wysiwygFrame").style.cssText=i.frame,e.get("wysiwyg").style.cssText=i.editor):e.get("wysiwygFrame").style.cssText=i.frame+i.editor}setTheme(t){if("string"!=typeof t)return;const e=this.#ot,s=e.get("_themeClass").trim();e.set("theme",t||""),e.set("_themeClass",t?` se-theme-${t}`:""),t=e.get("_themeClass").trim();const i=e=>{e&&(s&&Ie.utils.removeClass(e,s),t&&Ie.utils.addClass(e,t))};i(this.#nt),this.#gi.applyToRoots((t=>{i(t.get("topArea")),i(t.get("wysiwyg"))})),i(this.#e.get("statusbar_wrapper")),i(this.#e.get("toolbar_wrapper"))}setDir(t){const e="rtl"===t;if(this.#ot.get("_rtl")===e)return;const s=this.#ot.get("textDirection"),i=this.#ot.get("_editableClass"),n=this.#ot.get("printClass");try{this.#ot.set("_rtl",e),this.#ot.set("textDirection",t);const s=e?this.#ot.get("_editableClass").replace(/\s*se-rtl/,"")+" se-rtl":this.#ot.get("_editableClass").replace(/\s*se-rtl/,"");this.#ot.set("_editableClass",s),this.#ot.get("printClass")&&this.#ot.set("printClass",e?this.#ot.get("printClass").replace(/\s*se-rtl/,"")+" se-rtl":this.#ot.get("printClass").replace(/\s*se-rtl/,"")),this.offCurrentController();const i=this.#Y,n=this.#J.pluginManager.plugins;for(const e in n)n[e].setDir?.(t);const o=this.#e.get("toolbar_wrapper"),l=this.#e.get("statusbar_wrapper");e?(this.#gi.applyToRoots((t=>{Ie.utils.addClass([t.get("topArea"),t.get("wysiwyg"),t.get("documentTypePageMirror")],"se-rtl"),t.get("wysiwyg").dir="rtl"})),Ie.utils.addClass([this.#nt,o,l],"se-rtl")):(this.#gi.applyToRoots((t=>{Ie.utils.removeClass([t.get("topArea"),t.get("wysiwyg"),t.get("documentTypePageMirror")],"se-rtl"),t.get("wysiwyg").removeAttribute("dir")})),Ie.utils.removeClass([this.#nt,o,l],"se-rtl"));const r=Ie.query.getListChildren(i.get("wysiwyg"),(t=>this.#J.format.isLine(t)&&!!(t.style.marginRight||t.style.marginLeft||t.style.textAlign)),null);for(let t,e,s,i=0;t=r[i];i++)t=r[i],s=t.style.marginRight,e=t.style.marginLeft,(s||e)&&(t.style.marginRight=e,t.style.marginLeft=s),s=t.style.textAlign,"left"===s?t.style.textAlign="right":"right"===s&&(t.style.textAlign="left");this.#So(e),this.#Eo(this.#e.get("toolbar_buttonTray")),this.#e.has("toolbar_sub_buttonTray")&&this.#Eo(this.#e.get("toolbar_sub_buttonTray")),this.#t.mode.isBalloon?this.#J.toolbar._showBalloon():this.#t.mode.isSubBalloon&&this.#J.subToolbar._showBalloon()}catch(t){this.#ot.set("_rtl",!e),this.#ot.set("textDirection",s),this.#ot.set("_editableClass",i),null!==n&&this.#ot.set("printClass",n),console.warn(`[SUNEDITOR.ui.setDir.fail] ${t.toString()}`)}this.#t.set("_lastSelectionNode",null),this.#F._eventOrchestrator.applyTagEffect()}readOnly(t,e){const s=e?this.#I.get(e):this.#Y;s.set("isReadOnly",!!t),this._toggleControllerButtons(!!t),t?(this.offCurrentController(),this.offCurrentModal(),this.#J.toolbar?.currentMoreLayerActiveButton?.disabled&&this.#J.toolbar._moreLayerOff(),this.#J.subToolbar?.currentMoreLayerActiveButton?.disabled&&this.#J.subToolbar._moreLayerOff(),this.#J.menu?.currentDropdownActiveButton?.disabled&&this.#J.menu.dropdownOff(),this.#J.menu?.currentContainerActiveButton?.disabled&&this.#J.menu.containerOff(),s.get("code").setAttribute("readOnly","true"),Ie.utils.addClass(s.get("wysiwyg"),"se-read-only")):(s.get("code").removeAttribute("readOnly"),Ie.utils.removeClass(s.get("wysiwyg"),"se-read-only")),this.#ot.get("hasCodeMirror")&&this.#J.viewer._codeMirrorEditor("readonly",!!t,e)}disable(t){const e=t?this.#I.get(t):this.#Y;this.#J.toolbar.disable(),this.offCurrentController(),this.offCurrentModal(),e.get("wysiwyg").setAttribute("contenteditable","false"),e.set("isDisabled",!0),this.#ot.get("hasCodeMirror")?this.#J.viewer._codeMirrorEditor("readonly",!0,t):e.get("code").disabled=!0}enable(t){const e=t?this.#I.get(t):this.#Y;this.#J.toolbar.enable(),e.get("wysiwyg").setAttribute("contenteditable","true"),e.set("isDisabled",!1),this.#ot.get("hasCodeMirror")?this.#J.viewer._codeMirrorEditor("readonly",!1,t):e.get("code").disabled=!1}show(t){const e=(t?this.#I.get(t):this.#Y).get("topArea").style;"none"===e.display&&(e.display="block")}hide(t){(t?this.#I.get(t):this.#Y).get("topArea").style.display="none"}showLoading(t){const e=(t?this.#I.get(t).get("container"):this.#nt).querySelector(".se-loading-box");e.style.display="block",e.showPopover?.()}hideLoading(t){const e=(t?this.#I.get(t).get("container"):this.#nt).querySelector(".se-loading-box");e.hidePopover?.(),e.style.display="none"}alertOpen(t,e){this.alertMessage.textContent=t,Ie.utils.removeClass(this.alertModal,"se-alert-error|se-alert-success"),e&&Ie.utils.addClass(this.alertModal,`se-alert-${e}`),this.#uo&&(this.#po=this.#mi.addEvent(this.#co,"click",this.#do[1])),this.#fo&&=this.#mi.removeGlobalEvent(this.#fo),this.#fo=this.#mi.addGlobalEvent("keydown",this.#do[0]),this.#ho.style.display="block",this.#ho.showPopover?.(),Ie.utils.addClass(this.alertModal,"se-modal-show")}alertClose(){Ie.utils.removeClass(this.alertModal,"se-modal-show"),Ie.utils.removeClass(this.alertModal,"se-alert-*"),this.#ho.hidePopover?.(),this.#ho.style.display="none",this.#po&&=this.#mi.removeEvent(this.#po),this.#fo&&=this.#mi.removeGlobalEvent(this.#fo)}showToast(t,e=1e3,s){Ie.utils.hasClass(this.toastContainer,"se-toast-show")&&this.closeToast(),Ie.utils.removeClass(this.toastPopup,"se-toast-error|se-toast-success"),s&&Ie.utils.addClass(this.toastPopup,`se-toast-${s}`),this.toastPopup.style.display="block",this.toastPopup.showPopover?.(),this.toastMessage.textContent=t,Ie.utils.addClass(this.toastContainer,"se-toast-show"),this.#vo=Cn.setTimeout((()=>{this.closeToast()}),e)}closeToast(){this.#vo&&Cn.clearTimeout(this.#vo),this.#vo=null,Ie.utils.removeClass(this.toastContainer,"se-toast-show"),this.toastPopup.hidePopover?.(),this.toastPopup.style.display="none"}setControllerOnDisabledButtons(t){return t&&!this.#mo?(this._toggleControllerButtons(!0),this.#mo=!0):!t&&this.#mo&&(this._toggleControllerButtons(!1),this.#mo=!1),this.#mo}onControllerContext(){this.controllerTargetContext=this.#Y.get("topArea")}offControllerContext(){this.controllerTargetContext=null}enableBackWrapper(t){this.#go.style.cursor=t,this.#go.style.display="block",this.#go.showPopover?.()}disableBackWrapper(){this.#go.hidePopover?.(),this.#go.style.display="none",this.#go.style.cursor="default"}offCurrentController(){this.#J.component.__deselect()}offCurrentModal(){this.opendModal?.close()}getVisibleFigure(){return"block"===this._figureContainer?.style.display?this._figureContainer:null}setFigureContainer(t){this._figureContainer=t}preventToolbarHide(t){this.#Co=t}get isPreventToolbarHide(){return this.#Co}get blockHandle(){return this.#xo}reset(t){t.set("_editorHeight",t.get("wysiwygFrame").offsetHeight),this.#wo=t.get("lineBreaker_t"),this.#_o=t.get("lineBreaker_b");const e=this.#ot.get("blockHandle");e&&t.get("blockHandleArea")&&!this.#xo&&(this.#xo=new hn(this.#J,t.get("blockHandleArea"),t.get("blockHandle"),t.get("blockHandlePlus"),t.get("blockHandleDrag"),e.menu))}_offControllers(){const t=this.opendControllers,e=[];for(let s,i=0;i<t.length;i++)s=t[i],s.fixed?e.push(s):(s.inst.controllerClose?.(),s.form&&(s.form.style.display="none"));this.opendControllers=e,this.currentControllerName="",this.#t.set("_preventBlur",!1)}_syncScrollPosition(t){const e=t.scrollTop||t.scrollY||0,s=t.scrollLeft||t.scrollX||0;this.#t.mode.isBalloon&&"block"===this.#e.get("toolbar_main").style.display?(this.#e.get("toolbar_main").style.top=this.#J.toolbar.balloonOffset.top-e+"px",this.#e.get("toolbar_main").style.left=this.#J.toolbar.balloonOffset.left-s+"px"):this.#t.mode.isSubBalloon&&"block"===this.#e.get("toolbar_sub_main").style.display&&(this.#e.get("toolbar_sub_main").style.top=this.#J.subToolbar.balloonOffset.top-e+"px",this.#e.get("toolbar_sub_main").style.left=this.#J.subToolbar.balloonOffset.left-s+"px"),this.#xo?.syncScroll(),this.controllerTargetContext!==this.#Y.get("topArea")&&this.offCurrentController(),this.#To(s,e)}_repositionControllers(){const t=this.opendControllers;if(0!==t.length){fi.get("__dragMove")&&fi.get("__dragMove")();for(let e=0;e<t.length;e++)t[e].notInCarrier||t[e].inst?._scrollReposition()}}#To(t,e){if(this.#wo){const s=this.#wo.style;if("none"!==s.display){const i=(this.#wo.getAttribute("data-offset")||",").split(",");s.top=Ve.get(s.top,0)-(e-Ve.get(i[0],0))+"px",s.left=Ve.get(s.left,0)-(t-Ve.get(i[1],0))+"px",this.#wo.setAttribute("data-offset",e+","+t)}}if(this.#_o){const s=this.#_o.style;if("none"!==s.display){const i=(this.#_o.getAttribute("data-offset")||",").split(",");s.top=Ve.get(s.top,0)-(e-Ve.get(i[0],0))+"px",s[i[1]]=Ve.get(s[i[1]],0)-(t-Ve.get(i[2],0))+"px",this.#_o.setAttribute("data-offset",e+","+i[1]+","+t)}}const s=this.opendControllers;for(let i=0;i<s.length;i++)s[i].notInCarrier&&(s[i].form.style.top=s[i].inst.__offset.top-e+"px",s[i].form.style.left=s[i].inst.__offset.left-t+"px")}_visibleControllers(t,e){const s=t?"":"hidden",i=e??s?"":"hidden",n=this.opendControllers;for(let t,e=0;e<n.length;e++)t=n[e],t.form&&(t.form.style.visibility=s);this.#wo.style.visibility=i,this.#_o.style.visibility=i}setCurrentControllerContext;#So(t){const e=this.#gi.icons,s=this.#J.commandDispatcher?.targets;if(!s)return;const i=this.#J.shortcuts?.keyMap;this.#J.shortcuts?.reverseKeys?.forEach((t=>{const e=i?.get(t);e&&([e.command,e.r]=[e.r,e.command])})),this.#J.commandDispatcher.applyTargets("dir",(s=>{Ie.utils.changeTxt(s.querySelector(".se-tooltip-text"),this.#gi.lang[t?"dir_ltr":"dir_rtl"]),Ie.utils.changeElement(s.firstElementChild,e[t?"dir_ltr":"dir_rtl"])})),t?(Ie.utils.addClass(s.get("dir_rtl"),"active"),Ie.utils.removeClass(s.get("dir_ltr"),"active")):(Ie.utils.addClass(s.get("dir_ltr"),"active"),Ie.utils.removeClass(s.get("dir_rtl"),"active"))}#Eo(t){if(!t)return;const e=t.querySelector(".se-toolbar-more-layer"),s=Array.from(t.children).filter((t=>t!==e));for(let e=s.length-1;e>=0;e--)t.appendChild(s[e]);e&&t.appendChild(e)}_initToggleButtons(){const t=this.#e;this.#yo=Be.nodeListToArray(t.get("toolbar_buttonTray").querySelectorAll(bn)),this.#bo=Be.nodeListToArray(t.get("toolbar_buttonTray").querySelectorAll(yn)),this.#ot.has("_subMode")&&(this.#yo=this.#yo.concat(Be.nodeListToArray(t.get("toolbar_sub_buttonTray").querySelectorAll(bn))),this.#bo=this.#bo.concat(Be.nodeListToArray(t.get("toolbar_sub_buttonTray").querySelectorAll(yn))))}_toggleCodeViewButtons(t){Ie.utils.setDisabled(this.#yo,t)}_toggleControllerButtons(t){Ie.utils.setDisabled(this.#bo,t)}isButtonDisabled(t){return!(!this.#Y.get("isReadOnly")||!Ie.utils.arrayIncludes(this.#bo,t))}_updatePlaceholder(t){t||=this.#Y;const e=t.get("isMarkdownView")||t.get("isCodeView"),s=!e&&this.#Mo(t),i=t.get("placeholder");i&&(i.style.display=e||s||!this.#J.facade.isEmpty(t)?"none":"block")}#Mo(t){const e=t.get("placeholder_line");if(!e)return!1;const s=t.get("wysiwyg").querySelector(".se-placeholder-line"),i=this.#t.get("hasFocus")?this.#J.format.getLine(this.#J.selection.selectionNode):null,n=Ie.check.isEmptyLine(i)&&!Ie.check.isListCell(i)?i:null;return s&&s!==n&&(s.classList.remove("se-placeholder-line"),s.removeAttribute("data-se-placeholder-line"),s.getAttribute("class")||s.removeAttribute("class")),!!n&&(n.classList.add("se-placeholder-line"),n.setAttribute("data-se-placeholder-line",e),!0)}_syncFrameState(t){t&&(this._iframeAutoHeight(t),this._updatePlaceholder(t),t.has("documentType_use_page")&&(t.get("documentTypePageMirror").innerHTML=t.get("wysiwyg").innerHTML,t.get("documentType").rePage(!0)))}_iframeAutoHeight(t){if(!t)return;const e=t.get("_iframeAuto");if(e)Cn.setTimeout((()=>{const s=e.offsetHeight,i=t.get("wysiwygFrame");if(!i)return;i.style.height=s+"px";const n=t.get("options");if(n?.get("iframe")){const t=n.get("maxHeight");t&&i.setAttribute("scrolling",s>Ve.get(t)?"auto":"no")}Ne.isResizeObserverSupported||this._emitResizeEvent(t,s,null)}),0);else if(!Ne.isResizeObserverSupported){const e=t.get("wysiwygFrame");e&&this._emitResizeEvent(t,e.offsetHeight,null)}}_emitResizeEvent(t,e,s){e=-1===e?s?.borderBoxSize&&s.borderBoxSize[0]?s.borderBoxSize[0].blockSize:s.contentRect.height+Ve.get(t.get("wwComputedStyle").getPropertyValue("padding-left"))+Ve.get(t.get("wwComputedStyle").getPropertyValue("padding-right")):e,t.get("_editorHeight")!==e&&(this.#mi.triggerEvent("onResizeEditor",{height:e,prevHeight:t.get("_editorHeight"),frameContext:t,observerEntry:s}),t.set("_editorHeight",e)),t.has("documentType_use_page")&&t.get("documentType").resizePage()}init(){this.#uo=!this.#mi.addEvent(this.alertModal.querySelector('[data-command="close"]'),"click",this.alertClose.bind(this)),this._initToggleButtons()}#ko(t){const e=Ie.query.getEventTarget(t);(/close/.test(e.getAttribute("data-command"))||e===this.#co)&&this.alertClose()}#$o(t){Oe.isEsc(t.code)&&this.alertClose()}_destroy(){this.#vo&&Cn.clearTimeout(this.#vo),this.#fo&&=this.#mi.removeGlobalEvent(this.#fo),this.#po&&=this.#mi.removeEvent(this.#po),this.opendModal=null,this.opendBrowser=null,this.#wo=null,this.#_o=null,this.#xo?.destroy(),this.#xo=null,this.#bo=null,this.#yo=null}};function _n(t){const e=t.$,s=t.store,i=e.contextProvider,n=e.eventManager,l=i.frameRoots,r=i.context,a=i.frameContext;let h=e.options.get("historyStackDelayTime");const c=e.options.get("historyStackSize");let d,u,p,g,m=null,f=!1,v=null;function b(i,o,l){l&&s.get("hasFocus")&&t._eventOrchestrator.applyTagEffect(),e.history.resetButtons(i.get("key"),o),n.triggerEvent("onChange",{frameContext:i,data:i.get("wysiwyg").innerHTML}),"block"===r.get("toolbar_main").style.display?e.toolbar._showBalloon():s.mode.isSubBalloon&&"block"===r.get("toolbar_sub_main").style.display&&e.subToolbar._showBalloon()}function y(t){const s=u[d],i=p[s];d+=t;const n=t<0&&s!==u[d]&&i.index>0?s:u[d],o=p[n];o.index+=t;const r=o.value[o.index];if(!r)return console.warn("[SunEditor.history.setContent.fail] History state desynchronized. Aborting undo/redo operation."),o.index-=t,void(d-=t);l.get(n).get("wysiwyg").innerHTML=r.content,s!==n&&t<0&&1===d?d=0:s!==n&&t>0&&1===o.index?d++:(t<0&&o.index<1||t>0&&o.index>o.value.length)&&(d+=t);let h=n,c=r;if(t<0&&d>0&&0===o.index){const e=u[d+t];if(e!==n){const t=p[e];h=e,c=t.value[t.index]}}e.facade.changeFrameContext(h),e.selection.setRange(gt(c.s.path,c.frame),c.s.offset,gt(c.e.path,c.frame),c.e.offset),e.focusManager.focus(),d<0?d=0:d>=u.length&&(d=u.length-1),e.ui.offCurrentController(),e.pluginManager.checkFileInfo(!1),e.char.display(),e.ui._syncFrameState(a),a.has("documentType_use_header")&&a.get("documentType").reHeader(),b(a,o.index,!0)}function C(t,e,s,i){let n,o;e?(n={path:pt(e.startContainer,null,null),offset:e.startOffset},o={path:pt(e.endContainer,null,null),offset:e.endOffset}):(n={path:[0,0],offset:[0,0]},o={path:0,offset:0}),d+=i,u[d]=s;const r=p[s];r.index+=i,r.value[r.index]={content:t,s:n,e:o,frame:l.get(s).get("wysiwyg")}}function w(t){p[t]={value:[],index:-1},g[t]=l.get(t).get("wysiwyg").innerHTML}function _(t,s){e.pluginManager.checkFileInfo(!1);const i=l.get(t),n=i.get("wysiwyg").innerHTML,o=p[t];if(n&&(!o.value[o.index]||n!==o.value[o.index].content)){if(u.length>d+1&&function(t){const s=[];for(let t=d+1,e=u.length;t<e;t++)s.includes(u[t])||s.push(u[t]);u=u.slice(0,d+1),t.value.splice(t.index+1),e.commandDispatcher.applyTargets("redo",(t=>{t.disabled=!0}));for(let t=0,e=s.length;t<e;t++)u.includes(s[t])||w(s[t])}(o),0===o.value.length&&function(t){d++,u[d]=t;const e=p[t];e.index=0,e.value[0]={content:g[t],s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0},frame:l.get(t).get("wysiwyg")}}(t),C(n,s,t,1),o.value.length>c){const e=o.value.length-c;o.value.splice(0,e),o.index-=e;let s=0;for(let i=u.length-1;i>=0&&s<e;i--)if(u[i]===t)for(let e=0;e<u.length;e++)if(u[e]===t){u.splice(e,1),s++;break}d-=e}1===d&&e.commandDispatcher.applyTargets("undo",(t=>{t.disabled=!1})),e.char.display(),b(i,o.index,!1)}}return{push(t,i){if(f)return;i=i||null===i?i:s.get("rootKey");const n=s.get("_range");o.setTimeout(e.ui._syncFrameState.bind(e.ui,l.get(i)),0);const r="number"==typeof t?t>0?t:0:t?h:0;r&&!m||(o.clearTimeout(m),r)?m=o.setTimeout((()=>{o.clearTimeout(m),m=null,_(i,n)}),r):_(i,n)},check(t,e){m&&(o.clearTimeout(m),m=null,_(t,e))},undo(){d>0&&y(-1)},redo(){u.length-1>d&&y(1)},overwrite(t){C(l.get(t||s.get("rootKey")).get("wysiwyg").innerHTML,null,s.get("rootKey"),0)},pause(){f=!0,v&&(o.clearTimeout(v),v=null),v=o.setTimeout((()=>{f=!1}),5e3)},resume(){v&&(o.clearTimeout(v),v=null),f=!1},reset(){e.commandDispatcher.applyTargets("undo",(t=>t.disabled=!0)),e.commandDispatcher.applyTargets("redo",(t=>t.disabled=!0)),e.commandDispatcher.applyTargets("save",(t=>t.disabled=!0)),i.applyToRoots((t=>t.set("historyIndex",-1))),i.applyToRoots((t=>t.set("isChanged",!1))),d=-1,u=[],p={},g={},f=!1;const t=i.rootKeys;for(let e=0,s=t.length;e<s;e++)w(t[e])},resetButtons(t,s){const i=!Ve.is(s),o=p[void 0===t?u[d]:t];s=i?o.index:s;const r=l.get(t),a=o.value.length-1;e.commandDispatcher.applyTargets("undo",(t=>{t.disabled=!(s>0&&s<=a)})),e.commandDispatcher.applyTargets("redo",(t=>{t.disabled=!(s>-1&&s<a)}));const h=r.get("savedIndex"),c=r.get("historyIndex"),g=h>-1?h!==s:i?o.index>0:s>0&&c!==s;r.set("historyIndex",s),r.set("isChanged",g),e.commandDispatcher.applyTargets("save",(t=>{t.disabled=!g})),n.triggerEvent("onResetButtons",{rootKey:t})},getRootStack:()=>p,resetDelayTime(t){h=t},_destroy(){m&&o.clearTimeout(m),v&&o.clearTimeout(v),d=u=p=g=null}}}const{_w:xn}=Ne;const $n=class{#F;#J;#t;#Ho;#Lo;#e;#Y;#ot;#mi;#No;#Ao;#Bo;#Io="default";#Vo=null;#Oo=null;#Ro=!1;#Po=!1;#zo=!1;constructor(t,{keyName:e,balloon:s,inline:i,balloonAlways:n,res:o}){this.#F=t,this.#J=t.$,this.#t=t.store,this.#Ho=this.#J.icons,this.#Lo=this.#J.lang,this.#e=this.#J.context,this.#Y=this.#J.frameContext,this.#ot=this.#J.options,this.#mi=this.#J.eventManager,this.isSub="toolbar_sub"===e,this.keyName={main:this.isSub?"toolbar_sub_main":"toolbar_main",buttonTray:this.isSub?"toolbar_sub_buttonTray":"toolbar_buttonTray",width:this.isSub?"toolbar_sub_width":"toolbar_width"},this.currentMoreLayerActiveButton=null,this.isBalloonMode=s,this.isInlineMode=i,this.isBalloonAlwaysMode=n,this.inlineToolbarAttr={top:"",width:"",isShow:!1},this.balloonOffset={top:0,left:0},this.#No=o,this.#Ao=o,this.#Bo="visualViewport"in xn;const l=!this.isSub&&!s&&!i,r=this.#ot.get("_toolbar_sticky");if(this.#Ro=l&&r>=0&&!this.#ot.get("toolbar_container")&&"undefined"!=typeof CSS&&CSS.supports("position","sticky"),this.isBottomMode=this.#t.mode.isBottom,this.#Ro){const t=this.#e.get(this.keyName.main);this.isBottomMode?(t.style.bottom=r+"px",t.style.top="auto"):r>0&&(t.style.top=r+"px")}else l&&Ie.utils.addClass(this.#e.get(this.keyName.main),"se-toolbar-relative");this._setResponsive()}get isSticky(){if(this.isSub)return!1;const t=this.#ot.get("_toolbar_sticky");if(t<0)return!1;if(this.#Ro){const e=this.#e.get(this.keyName.main);if(!e||0===e.offsetWidth||"none"===e.style.display)return!1;if(this.isBottomMode){const s=this.#Bo?xn.visualViewport.height:xn.innerHeight;return e.getBoundingClientRect().bottom>=s-t-1}return e.getBoundingClientRect().top<=t+1}return this.#Po}get isCSSSticky(){return this.#Ro}disable(){this._moreLayerOff(),this.#J.menu.dropdownOff(),this.#J.menu.containerOff(),Ie.utils.setDisabled(this.#e.get(this.keyName.buttonTray).querySelectorAll(".se-menu-list .se-toolbar-btn[data-type]"),!0)}enable(){Ie.utils.setDisabled(this.#e.get(this.keyName.buttonTray).querySelectorAll(".se-menu-list .se-toolbar-btn[data-type]"),!1)}show(){this.isInlineMode?this._showInline():this.isBalloonMode?this._showBalloon():(this.#e.get(this.keyName.main).style.display="",this.isSub||(this.#Y.get("_stickyDummy").style.display="")),this.isSub||this.resetResponsiveToolbar()}hide(){this.isInlineMode?(this.#e.get(this.keyName.main).style.display="none",this.#e.get(this.keyName.main).style.top="0px",this.inlineToolbarAttr.isShow=!1):(this.#e.get(this.keyName.main).style.display="none",this.isSub||(this.#Y.get("_stickyDummy").style.display="none"),this.isBalloonMode&&(this.balloonOffset={top:0,left:0}))}resetResponsiveToolbar(){this.#J.menu.containerOff();const t=this.#Oo;if(t){let e=0;e=(this.isBalloonMode||this.isInlineMode)&&"auto"===this.#ot.get("toolbar_width")||this.#t.mode.isSubBalloon&&"auto"===this.#ot.get("toolbar_sub_width")?this.#Y.get("topArea").offsetWidth:this.#e.get(this.keyName.main).offsetWidth;let s="default";for(let i=1,n=t.length;i<n;i++)if(e<t[i]){s=t[i]+"";break}this.#Io!==s&&(this.#Io=s,this.setButtons(this.#Vo[s]))}}setButtons(t){this._moreLayerOff(),this.#J.menu.dropdownOff(),this.#J.menu.containerOff();const e=ps(t,this.#J.plugins,this.#ot,this.#Ho,this.#Lo,!0);e.updateButtons.forEach((t=>us(t.button,t.plugin,this.#Ho,this.#Lo))),this.#e.get(this.keyName.main).replaceChild(e.buttonTray,this.#e.get(this.keyName.buttonTray)),this.#e.set(this.keyName.buttonTray,e.buttonTray),this.#Fo(),this.#mi.triggerEvent("onSetToolbarButtons",{buttonTray:e.buttonTray,frameContext:this.#Y})}_resetSticky(){if(this.#Ro)return void this.#Do();const t=this.#Y.get("wrapper");if(!t)return;const e=this.#e.get(this.keyName.main),s=this.#ot.get("_toolbar_sticky");if(this.#Y.get("isFullScreen")||0===e.offsetWidth||s<0)return;const i=this.#Bo?xn.visualViewport.pageTop:xn.scrollY,n=this.#Y.get("_minHeight"),o=t.offsetHeight,l=this.#J.offset.getGlobal(this.#Y.get("topArea"));if(this.isBottomMode){const t=i+xn.innerHeight,r=l.top+o,a=t-s-(this.isInlineMode?e.offsetHeight:0),h=this.#ot.get("toolbar_container")?t-s-l.top-n-e.offsetHeight:a-l.top-n;a>r?this.#qo():h<0?(this.isSticky||this.#Wo(1),e.style.bottom=1+h+this.#Uo()+"px",e.style.top="auto"):this.#Wo(1)}else{const t=i+s,r=(this.isBalloonMode||this.isInlineMode?l.top:this.#J.offset.getGlobal(this.#ot.get("toolbar_container")).top)-(this.isInlineMode?e.offsetHeight:0),a=this.#ot.get("toolbar_container")?l.top-i+o-n-s-e.offsetHeight:o+r+s-t-n;t<r?this.#qo():a<0?(this.isSticky||this.#Wo(1),e.style.top=1+a+this.#Uo()+"px"):this.#Wo(1)}}#Fo(){this.#J.shortcuts._registerShortcuts(),this.#J.commandDispatcher.resetTargets(),this.#J.ui._initToggleButtons(),this.#J.history.resetButtons(this.#Y.get("key"),null),this._resetSticky(),this.#t.set("_lastSelectionNode",null),this.#J.viewer._setButtonsActive(),this.#t.get("hasFocus")&&this.#F._eventOrchestrator.applyTagEffect(),this.#Y.get("isReadOnly")&&this.#J.ui.setControllerOnDisabledButtons(!0)}_setResponsive(){if(0===this.#Ao?.length)return void(this.#Ao=null);this.#Io="default";const t=this.#Oo=[],e=this.#No,s=this.#Vo={default:e[0]};for(let i,n,o=1,l=e.length;o<l;o++)n=e[o],i=1*n[0],t.push(i),s[i]=n[1];t.sort(((t,e)=>t-e)).unshift("default")}_showBalloon(t){if(!this.isBalloonMode)return;this.isSub&&this.resetResponsiveToolbar();const e=t||this.#J.selection.getRange(),s=this.#e.get(this.keyName.main),i=this.#J.selection.get();let n;if(this.isBalloonAlwaysMode&&e.collapsed)n=!0;else if(i.focusNode===i.anchorNode)n=i.focusOffset<i.anchorOffset;else{const t=Ie.query.getListChildNodes(e.commonAncestorContainer,null,null);n=Ie.utils.getArrayIndex(t,i.focusNode)<Ie.utils.getArrayIndex(t,i.anchorNode)}this._setBalloonOffset(n,e),this.#mi.triggerEvent("onShowToolbar",{toolbar:s,mode:"balloon",frameContext:this.#Y})}_setBalloonOffset(t,e){const s=this.#e.get(this.keyName.main),i=this.#Y.get("topArea"),n=this.#J.offset.getGlobal(i).top;if(!this.#J.offset.setRangePosition(s,e,{position:t?"top":"bottom",addTop:n}))return void this.hide();if(this.#ot.get("toolbar_container")){const t=i.parentElement;let e=this.#ot.get("toolbar_container"),n=e.offsetLeft,o=e.offsetTop;for(;!e.parentElement.contains(t)&&!/^(BODY|HTML)$/i.test(e.parentElement.nodeName);)e=e.offsetParent,n+=e.offsetLeft,o+=e.offsetTop;s.style.left=s.offsetLeft-n+i.offsetLeft+"px",s.style.top=s.offsetTop-o+i.offsetTop+"px"}const o=this.#J.offset.getWWScroll();this.balloonOffset={top:s.offsetTop+o.top,left:s.offsetLeft+o.left,position:t?"top":"bottom"}}_showInline(){if(!this.isInlineMode)return;const t=this.#e.get(this.keyName.main);if(t.style.visibility="hidden",t.style.display="block",this.#qo(),t.style.top="0px",this.inlineToolbarAttr.width=t.style.width=this.#ot.get(this.keyName.width),this.isBottomMode){const e=this.#Y.get("topArea");this.inlineToolbarAttr.top=t.style.top=this.#J.offset.getGlobal(e).top+e.offsetHeight-this.#J.offset.getGlobal(t).top+"px"}else this.inlineToolbarAttr.top=t.style.top=this.#J.offset.getGlobal(this.#Y.get("topArea")).top-this.#J.offset.getGlobal(t).top-t.offsetHeight-1+"px";this._resetSticky(),this.inlineToolbarAttr.isShow=!0,this.#mi.triggerEvent("onShowToolbar",{toolbar:t,mode:"inline",frameContext:this.#Y}),t.style.visibility=""}_moreLayerOn(t,e){this._moreLayerOff(),this.currentMoreLayerActiveButton=t,e.style.display="block"}_moreLayerOff(){if(this.currentMoreLayerActiveButton){this.#e.get(this.keyName.main).querySelector("."+this.currentMoreLayerActiveButton.getAttribute("data-command")).style.display="none",Ie.utils.removeClass(this.currentMoreLayerActiveButton,"on"),this.currentMoreLayerActiveButton=null}}#Wo(t){const e=this.#e.get(this.keyName.main);if(!this.isInlineMode){const t=this.#ot.get("toolbar_container")?this.#e.get("_stickyDummy"):this.#Y.get("_stickyDummy");t.style.height=e.offsetHeight+"px",t.style.display="block"}if(this.isBottomMode){const t=this.#ot.get("_toolbar_sticky")+this.#Uo();e.style.bottom=`${t}px`,e.style.top="auto"}else{const s=this.#ot.get("_toolbar_sticky")+t+this.#Uo();e.style.top=`${s}px`}e.style.width=this.isInlineMode?this.inlineToolbarAttr.width:e.offsetWidth+"px",Ie.utils.addClass(e,"se-toolbar-sticky"),this.#Po=!0}#Uo(){return this.#Bo?xn.visualViewport.offsetTop:0}#Do(){if(!this.#Bo)return;if(this.#F._eventOrchestrator.scrollparents.length>0)return;const t=Math.round(xn.visualViewport.offsetTop);if(0===t&&!this.#zo)return;const e=this.#e.get(this.keyName.main),s=this.#ot.get("_toolbar_sticky_offset");if(t>0)if(this.#zo=!0,this.isBottomMode){const i=Math.round(xn.innerHeight-xn.visualViewport.height-t);e.style.bottom=s+i+"px",e.style.top="auto"}else e.style.top=s+t+"px";else{this.#zo=!1;const t=this.#ot.get("_toolbar_sticky");this.isBottomMode?(e.style.bottom=t+"px",e.style.top="auto"):e.style.top=t>0?t+"px":""}}#qo(){(this.#ot.get("toolbar_container")?this.#e.get("_stickyDummy"):this.#Y.get("_stickyDummy")).style.display="none";const t=this.#e.get(this.keyName.main);this.isBottomMode?(t.style.bottom=this.isInlineMode?-t.offsetHeight+"px":"",t.style.top="auto",this.#Y.get("wrapper").style.marginBottom=""):(t.style.top=this.isInlineMode?this.inlineToolbarAttr.top:"",this.#Y.get("wrapper").style.marginTop=""),t.style.width=this.isInlineMode?this.inlineToolbarAttr.width:"",Ie.utils.removeClass(t,"se-toolbar-sticky"),this.#Po=!1}_destroy(){this._moreLayerOff()}},{isMobile:kn,_w:Sn}=Ne;function En(t){return/free$/.test(t)}const Tn=class{#J;#t;#gi;#e;#mi;#Zo;#Go=[];#jo=null;#Ko=null;#Yo=null;#Xo=null;#Jo=null;#Qo=null;#tl=null;#el=null;#sl=null;#il=null;constructor(t){this.#J=t.$,this.#t=t.store,this.#gi=this.#J.contextProvider,this.#e=this.#J.context,this.#mi=this.#J.eventManager,this.targetMap={},this.itemsMap={},this.index=-1,this.menus=[],this.currentButton=null,this.currentDropdown=null,this.currentDropdownActiveButton=null,this.currentDropdownName="",this.currentDropdownType="",this.currentContainer=null,this.currentContainerActiveButton=null,this.currentContainerName="",this.currentDropdownPlugin=null,this.#Zo={mousedown:this.#nl.bind(this),containerDown:this.containerOff.bind(this),keydown:this.#ol.bind(this),mousemove:this.#ll.bind(this),mouseout:this.#rl.bind(this)},this.#jo=null,this.#Ko=null,this.#Yo=null,this.#Qo=null,this.#tl=null,this.#il=Sn.visualViewport||null}initDropdownTarget({key:t,type:e},s,i){if(!t)throw Error("[SUNEDITOR.init.fail] The plugin's key is not added.");let n;if(Array.isArray(s)){n=function(t,e={}){let s="";for(let e=0,i=t.length;e<i;e++){const i=t[e];let n="";if(i.attrs){const t=Object.keys(i.attrs);for(let e=0;e<t.length;e++)n+=` ${t[e]}="${i.attrs[t[e]]}"`}s+=`\n\t\t<li>\n\t\t\t<button type="button" class="se-btn se-btn-list${i.className?" "+i.className:""}" data-command="${i.command}"${void 0!==i.value?` data-value="${i.value}"`:""} title="${i.title}" aria-label="${i.title}"${n}>${i.innerHTML}</button>\n\t\t</li>`}return Ie.utils.createElement("DIV",{class:"se-dropdown se-list-layer"+(e.className?" "+e.className:"")},`<div class="se-list-inner"><ul class="se-list-basic">${e.prependHTML||""}${s}</ul></div>`)}(s,i);const e=n.querySelectorAll(".se-list-inner li > button"),o=e.length-s.length;for(let t=0;t<s.length;t++)s[t]._element=e[o+t]||null;this.itemsMap[t]=s}else n=s;return En(e)||(n.setAttribute("data-key",t),this.#Go.push(t)),this.#e.get("menuTray").appendChild(n),this.targetMap[t]=n,n}dropdownOn(t){this.#qe();const e=this.#al(t);if(e){const s=Ie.query.getParentElement(e,".se-btn-tray").querySelector('[data-command="'+e.getAttribute("data-ref")+'"]');if(s)return this.#J.commandDispatcher.runFromTarget(s),void this.dropdownOn(t)}const s=this.currentButton=t,i=this.currentDropdownName=s.getAttribute("data-command");this.currentDropdownType=s.getAttribute("data-type");const n=this.currentDropdown=this.targetMap[i];this.currentDropdownActiveButton=s,kn?this.#hl(s,n):this.#cl(s,n),this.#e.get("menuTray").showPopover?.(),this.#jo=this.#mi.addGlobalEvent("mousedown",this.#Zo.mousedown,!1),this.#Go.includes(i)&&(this.menus=Be.nodeListToArray(n.querySelectorAll("[data-command]")),this.menus.length>0&&(this.#Ko=this.#mi.addGlobalEvent("keydown",this.#Zo.keydown,!1),this.#Xo=this.#mi.addEvent(n,"mousemove",this.#Zo.mousemove,!1),this.#Jo=this.#mi.addEvent(n,"mouseout",this.#Zo.mouseout,!1))),this.currentDropdownPlugin=this.#J.plugins[i],this.currentDropdownPlugin?.on(s),this.#t.set("_preventBlur",!0)}dropdownOff(){this.#dl(),this.#qe(),En(this.currentDropdownType)&&this.currentDropdownPlugin?.off?.(),this.index=-1,this.menus=[],this.#Qo=null,this.#tl=null,this.currentButton=null,this.currentDropdown&&(this.currentDropdownName="",this.currentDropdownType="",this.currentDropdown.style.display="none",this.currentDropdown=null,this.currentDropdownActiveButton&&Ie.utils.removeClass(this.currentDropdownActiveButton.parentElement.children,"on"),this.currentDropdownActiveButton=null,this.#J.ui.preventToolbarHide(!1),this.#e.get("menuTray").hidePopover?.()),this.#t.set("_preventBlur",!1),this.currentDropdownPlugin=null}dropdownShow(){this.currentButton&&this.dropdownOn(this.currentButton)}dropdownHide(){this.currentDropdown&&(this.currentDropdown.style.display="none")}containerOn(t){this.#qe(),this.currentContainerActiveButton=t;const e=this.currentContainerName=this.currentContainerActiveButton.getAttribute("data-command");this.currentContainer=this.targetMap[e],kn?this.#hl(t,this.currentContainer):this.#cl(t,this.currentContainer),this.#e.get("menuTray").showPopover?.(),this.#Yo=this.#mi.addGlobalEvent("mousedown",this.#Zo.containerDown,!1),this.#J.plugins[e].on&&this.#J.plugins[e].on(t),this.#t.set("_preventBlur",!0)}containerOff(){this.#dl(),this.#qe(),this.currentContainer&&(this.currentContainerName="",this.currentContainer.style.display="none",this.currentContainer=null,Ie.utils.removeClass(this.currentContainerActiveButton,"on"),this.currentContainerActiveButton=null,this.#J.ui.preventToolbarHide(!1),this.#e.get("menuTray").hidePopover?.()),this.#t.set("_preventBlur",!1)}__resetMenuPosition(t,e){this.#J.offset.setRelPosition(e,this.#gi.carrierWrapper,t.parentElement,Ie.query.getParentElement(t,".se-toolbar"),{preferUp:this.#t.mode.isBottom})}__restoreMenuPosition(){this.#Qo&&this.#tl&&(this.#sl||this.#el||this.#cl(this.#Qo,this.#tl))}#cl(t,e){e.style.visibility="hidden",e.style.display="block",e.style.height="",Ie.utils.addClass(t.parentElement.children,"on"),this.#J.offset.setRelPosition(e,this.#gi.carrierWrapper,t.parentElement,Ie.query.getParentElement(t,".se-toolbar"),{preferUp:this.#t.mode.isBottom}),e.style.visibility="",this.#Qo=t,this.#tl=e}#hl(t,e){this.#dl(),e.style.display="none",Ie.utils.addClass(t.parentElement.children,"on"),this.#Qo=t,this.#tl=e;let s=!1;const i=i=>{s||(s=!0,this.#dl(),this.#el=Sn.setTimeout((()=>{this.#el=null,this.#Qo===t&&this.#cl(t,e)}),i))};this.#il&&(this.#sl=()=>i(10),this.#il.addEventListener("resize",this.#sl,{once:!0})),this.#el=Sn.setTimeout((()=>i(0)),50)}#dl(){this.#el&&(Sn.clearTimeout(this.#el),this.#el=null),this.#sl&&(this.#il?.removeEventListener("resize",this.#sl),this.#sl=null)}#al(t){const e=Ie.query.getParentElement(t,".se-more-layer");return e&&"block"!==e.style.display&&e.getAttribute("data-ref")?e:null}#Ls(t){Ie.utils.removeClass(this.currentDropdown,"se-select-menu-mouse-move"),Ie.utils.addClass(this.currentDropdown,"se-select-menu-key-action"),t=this.index+t;const e=this.menus.length,s=this.index=t>=e?0:t<0?e-1:t;for(let t=0;t<e;t++)t===s?Ie.utils.addClass(this.menus[t],"on"):Ie.utils.removeClass(this.menus[t],"on")}#qe(){this.#jo&&=this.#mi.removeGlobalEvent(this.#jo),this.#Yo&&=this.#mi.removeGlobalEvent(this.#Yo),this.#Ko&&(this.#Ko=this.#mi.removeGlobalEvent(this.#Ko),this.#Xo&&=this.#mi.removeEvent(this.#Xo),this.#Jo&&=this.#mi.removeEvent(this.#Jo),Ie.utils.removeClass(this.menus,"on"),Ie.utils.removeClass(this.currentDropdown,"se-select-menu-key-action|se-select-menu-mouse-move"))}#nl(t){const e=Ie.query.getEventTarget(t);Ie.query.getParentElement(e,".se-dropdown")||this.dropdownOff()}#rl(){this.index=-1}#ol(t){switch(t.code){case"ArrowUp":case"ArrowLeft":t.preventDefault(),t.stopPropagation(),this.#Ls(-1);break;case"ArrowDown":case"ArrowRight":t.preventDefault(),t.stopPropagation(),this.#Ls(1);break;case"Enter":case"Space":{if(this.index<0)break;const e=this.menus[this.index];if(!e||"function"!=typeof this.#J.plugins[this.currentDropdownName].action)return;t.preventDefault(),t.stopPropagation(),this.#J.plugins[this.currentDropdownName].action(e),this.dropdownOff();break}}}#ll(t){Ie.utils.addClass(this.currentDropdown,"se-select-menu-mouse-move"),Ie.utils.removeClass(this.currentDropdown,"se-select-menu-key-action");const e=this.menus.indexOf(t.target);-1!==e&&(this.index=1*e)}_destroy(){this.#qe()}},{_w:Mn,_d:Hn}=Ne;function Ln(t,e){const s="markdown"===e?"markdownNumbers":"codeNumbers",i="markdown"===e?"markdown":"code",n=t.get(s);if(!n)return;const o=t.get(i),l=(o.value.match(/\n/g)||[]).length+1;let r="";for(let t=1;t<=l;t++)r+=`${t}\n`;const a=Mn.getComputedStyle(o);n.style.lineHeight=a.lineHeight,n.style.fontSize=a.fontSize,n.style.fontFamily=a.fontFamily,n.style.paddingTop=a.paddingTop,n.style.paddingBottom=a.paddingBottom,n.value=r}const Nn=class{#F;#J;#t;#Ho;#Lo;#I;#e;#Y;#ot;#Q;#mi;#te;#ul="";#pl="";#gl="";#ml="";#fl="";#vl="";#bl="";#yl="";#Cl="";#wl="";#_l="";#xl=0;#$l=!1;#kl=!1;#Sl=!1;#El=null;#Tl="";constructor(t){this.#F=t,this.#J=t.$,this.#t=t.store,this.#Ho=this.#J.icons,this.#Lo=this.#J.lang,this.#I=this.#J.frameRoots,this.#e=this.#J.context,this.#Y=this.#J.frameContext,this.#ot=this.#J.options,this.#Q=this.#J.frameOptions,this.#mi=this.#J.eventManager,this.#te=new RegExp(`^(${this.#ot.get("_disallowedExtraTag")})$`,"i")}codeView(t){const e=this.#Y;if(!e.get("codeWrapper"))return;if(void 0===t&&(t=!e.get("isCodeView")),t===e.get("isCodeView"))return;t&&e.get("isMarkdownView")&&this.markdownView(!1),e.set("isCodeView",t),this.#J.ui.offCurrentController(),this.#J.ui.offCurrentModal();const s=e.get("codeWrapper"),i=e.get("code"),n=e.get("wysiwygFrame"),o=e.get("wrapper");t?(this.#J.finder.close(),this.#Ml(),s.style.setProperty("display","flex","important"),n.style.display="none",e.get("isFullScreen")?i.style.height="100%":"auto"!==this.#Q.get("height")||this.#ot.get("hasCodeMirror")||(i.style.height=i.scrollHeight>0?i.scrollHeight+"px":"auto"),this.#ot.get("hasCodeMirror")&&this._codeMirrorEditor("refresh",null,null),e.get("isFullScreen")||(this.#J.ui.preventToolbarHide(!0),this.#t.mode.isBalloon&&(this.#e.get("toolbar_arrow").style.display="none",this.#e.get("toolbar_main").style.left="",this.#t.mode.isInline=this.#J.toolbar.isInlineMode=!0,this.#t.mode.isBalloon=this.#J.toolbar.isBalloonMode=!1,this.#J.toolbar._showInline())),this.#t.mode.isBalloon&&this.#J.subToolbar.hide(),Ln(e),this.#t.set("_range",null),i.focus(),Ie.utils.addClass(this.#J.commandDispatcher.targets.get("codeView"),"active"),Ie.utils.addClass(o,"se-source-view-status")):(Ie.check.isNonEditable(n)||this.#Hl(),n.scrollTop=0,s.style.setProperty("display","none","important"),n.style.display="block","auto"!==this.#Q.get("height")||this.#ot.get("hasCodeMirror")||(e.get("code").style.height="0px"),e.get("isFullScreen")||(this.#J.ui.preventToolbarHide(!1),/balloon/.test(this.#ot.get("mode"))&&(this.#e.get("toolbar_arrow").style.display="",this.#t.mode.isInline=this.#J.toolbar.isInlineMode=!1,this.#t.mode.isBalloon=this.#J.toolbar.isBalloonMode=!0,this.#F._eventOrchestrator._hideToolbar())),this.#J.focusManager.nativeFocus(),Ie.utils.removeClass(this.#J.commandDispatcher.targets.get("codeView"),"active"),Ie.check.isNonEditable(n)||(this.#J.history.push(!1),this.#J.history.resetButtons(e.get("key"),null)),Ie.utils.removeClass(o,"se-source-view-status")),this.#J.ui._updatePlaceholder(e),this.#J.ui._toggleCodeViewButtons(t),e.has("documentType_use_header")&&(t?e.get("documentTypeInner").style.display="none":(e.get("documentTypeInner").style.display="",e.get("documentType").reHeader())),this.#mi.triggerEvent("onToggleCodeView",{frameContext:e,is:e.get("isCodeView")})}markdownView(t){const e=this.#Y;if(!e.get("markdownWrapper"))return;if(void 0===t&&(t=!e.get("isMarkdownView")),t===e.get("isMarkdownView"))return;t&&e.get("isCodeView")&&this.codeView(!1),e.set("isMarkdownView",t),this.#J.ui.offCurrentController(),this.#J.ui.offCurrentModal();const s=e.get("markdownWrapper"),i=e.get("markdown"),n=e.get("wysiwygFrame"),o=e.get("wrapper");t?(this.#J.finder.close(),this.#Ll(),s.style.setProperty("display","flex","important"),n.style.display="none",e.get("isFullScreen")?i.style.height="100%":"auto"===this.#Q.get("height")&&(i.style.height=i.scrollHeight>0?i.scrollHeight+"px":"auto"),e.get("isFullScreen")||(this.#J.ui.preventToolbarHide(!0),this.#t.mode.isBalloon&&(this.#e.get("toolbar_arrow").style.display="none",this.#e.get("toolbar_main").style.left="",this.#t.mode.isInline=this.#J.toolbar.isInlineMode=!0,this.#t.mode.isBalloon=this.#J.toolbar.isBalloonMode=!1,this.#J.toolbar._showInline())),this.#t.mode.isBalloon&&this.#J.subToolbar.hide(),Ln(e,"markdown"),this.#t.set("_range",null),i.focus(),Ie.utils.addClass(this.#J.commandDispatcher.targets.get("markdownView"),"active"),Ie.utils.addClass(o,"se-source-view-status")):(Ie.check.isNonEditable(n)||this.#Nl(),n.scrollTop=0,s.style.setProperty("display","none","important"),n.style.display="block","auto"===this.#Q.get("height")&&(i.style.height="0px"),e.get("isFullScreen")||(this.#J.ui.preventToolbarHide(!1),/balloon/.test(this.#ot.get("mode"))&&(this.#e.get("toolbar_arrow").style.display="",this.#t.mode.isInline=this.#J.toolbar.isInlineMode=!1,this.#t.mode.isBalloon=this.#J.toolbar.isBalloonMode=!0,this.#F._eventOrchestrator._hideToolbar())),this.#J.focusManager.nativeFocus(),Ie.utils.removeClass(this.#J.commandDispatcher.targets.get("markdownView"),"active"),Ie.check.isNonEditable(n)||(this.#J.history.push(!1),this.#J.history.resetButtons(e.get("key"),null)),Ie.utils.removeClass(o,"se-source-view-status")),this.#J.ui._updatePlaceholder(e),this.#J.ui._toggleCodeViewButtons(t),e.has("documentType_use_header")&&(t?e.get("documentTypeInner").style.display="none":(e.get("documentTypeInner").style.display="",e.get("documentType").reHeader())),this.#mi.triggerEvent("onToggleMarkdownView",{frameContext:e,is:e.get("isMarkdownView")})}fullScreen(t){const e=this.#Y;if(void 0===t&&(t=!e.get("isFullScreen")),t===e.get("isFullScreen"))return;e.set("isFullScreen",t);const s=e.get("topArea"),i=this.#e.get("toolbar_main"),n=e.get("wrapper"),o=e.get("wysiwygFrame"),l=e.get("codeWrapper"),r=e.get("code"),a=e.get("codeNumbers"),h=e.get("markdownWrapper"),c=e.get("markdown"),d=e.get("markdownNumbers"),u=this.#Y.get("isCodeView"),p=this.#Y.get("isMarkdownView"),g=this.#e.get("toolbar_arrow");this.#J.ui.offCurrentController();const m="none"===i.style.display||this.#t.mode.isInline&&!this.#J.toolbar.inlineToolbarAttr.isShow;if(t){this.#Tl=s.style.cssText,this.#pl=n.style.cssText,this.#gl=o.style.cssText,this.#ml=l?.style.cssText,this.#fl=r.style.cssText,this.#vl=a?.style.cssText,this.#bl=h?.style.cssText,this.#yl=c?.style.cssText,this.#Cl=d?.style.cssText,this.#wl=i.style.cssText,g&&(this.#_l=g.style.cssText),(this.#t.mode.isBalloon||this.#t.mode.isInline)&&(g&&(g.style.display="none"),this.#Sl=this.#t.mode.isInline,this.#kl=this.#t.mode.isBalloon,this.#t.mode.isInline=this.#J.toolbar.isInlineMode=!1,this.#t.mode.isBalloon=this.#J.toolbar.isBalloonMode=!1),this.#ot.get("toolbar_container")&&(this.#El=i.parentElement,e.get("container").insertBefore(i,n)),s.style.position="fixed",s.style.top="0",s.style.left="0",s.style.width="100%",s.style.maxWidth="100%",s.style.height="100%",s.style.zIndex="2147483639","none"!==e.get("_stickyDummy").style.display&&""!==e.get("_stickyDummy").style.display&&(this.#$l=!0,e.get("_stickyDummy").style.display="none",Ie.utils.removeClass(i,"se-toolbar-sticky")),this.#ul=Hn.body.style.overflow,Hn.body.style.overflow="hidden",n.style.cssText=i.style.cssText="",o.style.cssText=(o.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+this.#Q.get("_defaultStyles").editor+(u||p?"display: none;":""),l&&(l.style.cssText=(l.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+`display: ${u?"flex":"none"} !important;`,l.style.overflow="auto",l.style.height="100%"),h&&(h.style.cssText=(h.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+`display: ${p?"flex":"none"} !important;`,h.style.overflow="auto",h.style.height="100%"),r.style.height="",c&&(c.style.height=""),i.style.width=o.style.height="100%",i.style.position="relative",i.style.display="block",this.#xl=Mn.innerHeight-i.offsetHeight,n.style.height=this.#xl-(e.has("statusbar")?e.get("statusbar").offsetHeight:0)-this.#ot.get("fullScreenOffset")+"px",this.#Q.get("iframe")&&"auto"===this.#Q.get("height")&&(n.style.overflow="auto",this.#J.ui._iframeAutoHeight(e)),e.get("topArea").style.marginTop=this.#ot.get("fullScreenOffset")+"px";const t=this.#Ho.reduction;this.#J.commandDispatcher.applyTargets("fullScreen",(e=>{Ie.utils.changeElement(e.firstElementChild,t),Ie.utils.addClass(e,"active")}))}else{o.style.cssText=this.#gl.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+(u||p?"display: none;":""),l&&(l.style.cssText=this.#ml.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+`display: ${u?"flex":"none"} !important;`),r.style.cssText=this.#fl,a&&(a.style.cssText=this.#vl),h&&(h.style.cssText=this.#bl.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+`display: ${p?"flex":"none"} !important;`),c&&(c.style.cssText=this.#yl),d&&(d.style.cssText=this.#Cl),i.style.cssText=this.#wl,n.style.cssText=this.#pl,s.style.cssText=this.#Tl,g&&(g.style.cssText=this.#_l),Hn.body.style.overflow=this.#ul,"auto"!==this.#Q.get("height")||this.#ot.get("hasCodeMirror")||this._codeViewAutoHeight(e.get("code"),e.get("codeNumbers"),!0),this.#El&&(this.#El.appendChild(i),this.#El=null),this.#ot.get("_toolbar_sticky")>-1&&Ie.utils.removeClass(i,"se-toolbar-sticky"),this.#$l&&!this.#ot.get("toolbar_container")&&(this.#$l=!1,e.get("_stickyDummy").style.display="block",Ie.utils.addClass(i,"se-toolbar-sticky")),this.#t.mode.isInline=this.#J.toolbar.isInlineMode=this.#Sl,this.#t.mode.isBalloon=this.#J.toolbar.isBalloonMode=this.#kl,e.get("isCodeView")||(this.#t.mode.isInline?this.#J.toolbar._showInline():this.#t.mode.isBalloon&&this.#J.toolbar._showBalloon()),this.#J.toolbar._resetSticky(),e.get("topArea").style.marginTop="";const t=this.#Ho.expansion;this.#J.commandDispatcher.applyTargets("fullScreen",(e=>{Ie.utils.changeElement(e.firstElementChild,t),Ie.utils.removeClass(e,"active")}))}!m||e.get("isCodeView")||e.get("isMarkdownView")||this.#J.toolbar.hide(),this.#mi.triggerEvent("onToggleFullScreen",{frameContext:e,is:e.get("isFullScreen")})}showBlocks(t){const e=this.#Y;void 0===t&&(t=!e.get("isShowBlocks")),e.set("isShowBlocks",!!t),t?(Ie.utils.addClass(e.get("wysiwyg"),"se-show-block"),Ie.utils.addClass(this.#J.commandDispatcher.targets.get("showBlocks"),"active")):(Ie.utils.removeClass(e.get("wysiwyg"),"se-show-block"),Ie.utils.removeClass(this.#J.commandDispatcher.targets.get("showBlocks"),"active")),this.#J.ui._syncFrameState(e)}_setButtonsActive(){const t=this.#Y;if(t.get("isCodeView")?Ie.utils.addClass(this.#J.commandDispatcher.targets.get("codeView"),"active"):Ie.utils.removeClass(this.#J.commandDispatcher.targets.get("codeView"),"active"),t.get("isFullScreen")){const t=this.#Ho.reduction;this.#J.commandDispatcher.applyTargets("fullScreen",(e=>{Ie.utils.changeElement(e.firstElementChild,t),Ie.utils.addClass(e,"active")}))}else{const t=this.#Ho.expansion;this.#J.commandDispatcher.applyTargets("fullScreen",(e=>{Ie.utils.changeElement(e.firstElementChild,t),Ie.utils.removeClass(e,"active")}))}t.get("isMarkdownView")?Ie.utils.addClass(this.#J.commandDispatcher.targets.get("markdownView"),"active"):Ie.utils.removeClass(this.#J.commandDispatcher.targets.get("markdownView"),"active"),t.get("isShowBlocks")?Ie.utils.addClass(this.#J.commandDispatcher.targets.get("showBlocks"),"active"):Ie.utils.removeClass(this.#J.commandDispatcher.targets.get("showBlocks"),"active")}print(){const t=Ie.utils.createElement("IFRAME",{style:"display: none;"});Hn.body.appendChild(t);const e=Mn.getComputedStyle(this.#Y.get("wysiwyg")).padding,s=this.#ot.get("printTemplate")?this.#ot.get("printTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.#J.html.get()):this.#J.html.get(),i=Ie.query.getIframeDocument(t),n=this.#Y.get("_wd"),o=this.#ot.get("_rtl")?" se-rtl":"",l=(this.#ot.get("_themeClass")||"").trim(),r=t=>l?t.replace(l,"").trim():t,a=`\n\t\t\t<style>\n\t\t\t\t@page {\n\t\t\t\t\tsize: A4;\n\t\t\t\t\tmargin: ${e};\n\t\t\t\t}\n\t\t\t</style>`;if(this.#Q.get("iframe")){const t=this.#ot.get("printClass")?'class="'+r(this.#ot.get("printClass"))+o+'"':this.#Q.get("iframe_fullPage")?Ie.utils.getAttributesToString(n.body,["contenteditable"]).replace(l,""):'class="'+r(this.#ot.get("_editableClass"))+o+'"';i.write(`\n\t\t\t\t<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t${n.head.innerHTML}\n\t\t\t\t\t\t${a}\n\t\t\t\t\t</head>\n\t\t\t\t\t<body ${t} style="padding: 0; padding-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 0;">\n\t\t\t\t\t\t${s}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}else{const t=Hn.head.getElementsByTagName("link"),e=Hn.head.getElementsByTagName("style");let n="";for(let e=0,s=t.length;e<s;e++)n+=t[e].outerHTML;for(let t=0,s=e.length;t<s;t++)n+=e[t].outerHTML;i.write(`\n\t\t\t\t<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t${n}\n\t\t\t\t\t\t${a}\n\t\t\t\t\t</head>\n\t\t\t\t\t<body class="${r(this.#ot.get("printClass")||this.#ot.get("_editableClass"))+o}" style="padding: 0; padding-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 0;">\n\t\t\t\t\t\t${s}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}this.#J.ui.showLoading(),Mn.setTimeout((()=>{try{if(t.focus(),Ne.isEdge||Ne.isChromium||"StyleMedia"in Ne._w)try{t.contentWindow.document.execCommand("print",!1,null)}catch(e){console.warn("[SUNEDITOR.print.warn]",e),t.contentWindow.print()}else t.contentWindow.print()}catch(t){throw Error(`[SUNEDITOR.print.fail] error: ${t.message}`)}finally{this.#J.ui.hideLoading(),Ie.utils.removeItem(t)}}),1e3)}preview(){this.#J.menu.dropdownOff(),this.#J.menu.containerOff(),this.#J.ui.offCurrentController(),this.#J.ui.offCurrentModal();const t=this.#ot.get("previewTemplate")?this.#ot.get("previewTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.#J.html.get({withFrame:!0})):this.#J.html.get({withFrame:!0}),e=Mn.open("","_blank"),s=this.#Y.get("_wd"),i=this.#ot.get("_rtl")?" se-rtl":"";if(this.#Q.get("iframe")){const n=this.#ot.get("printClass")?'class="'+this.#ot.get("printClass")+i+'"':this.#Q.get("iframe_fullPage")?Ie.utils.getAttributesToString(s.body,["contenteditable"]):'class="'+this.#ot.get("_editableClass")+i+'"';e.document.write(`<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t${s.head.innerHTML}\n\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\tbody {overflow:auto !important; height:auto !important;}\n\t\t\t\t\t\t</style>\n\t\t\t\t\t</head>\n\t\t\t\t\t<body ${n}>\n\t\t\t\t\t\t${t}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}else{const s=Hn.head.getElementsByTagName("link"),n=Hn.head.getElementsByTagName("style");let o="";for(let t=0,e=s.length;t<e;t++)o+=s[t].outerHTML;for(let t=0,e=n.length;t<e;t++)o+=n[t].outerHTML;e.document.write(`<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t<meta charset="utf-8" />\n\t\t\t\t\t\t<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">\n\t\t\t\t\t\t<title>${this.#Lo.preview}</title>\n\t\t\t\t\t\t${o}\n\t\t\t\t\t</head>\n\t\t\t\t\t<body class="${(this.#ot.get("printClass")?this.#ot.get("printClass"):this.#ot.get("_editableClass"))+i}" style="height:auto">\n\t\t\t\t\t\t${t}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}}_resetFullScreenHeight(){if(this.#Y.get("isFullScreen"))return this.#xl+=Mn.innerHeight-this.#e.get("toolbar_main").offsetHeight-(this.#Y.has("statusbar")?this.#Y.get("statusbar").offsetHeight:0)-this.#xl,this.#Y.get("wrapper").style.height=this.#xl+"px",!0}_codeMirrorEditor(t,e,s){const i=s?this.#I.get(s).get("options"):this.#Q;switch(t){case"set":i.get("codeMirrorEditor").getDoc().setValue(e);break;case"get":return i.get("codeMirrorEditor").getDoc().getValue();case"readonly":i.get("codeMirrorEditor").setOption("readOnly",e);break;case"refresh":i.get("codeMirrorEditor").refresh()}}_setCodeView(t){this.#ot.get("hasCodeMirror")?this._codeMirrorEditor("set",t,null):this.#Y.get("code").value=t}_getCodeView(){return this.#ot.get("hasCodeMirror")?this._codeMirrorEditor("get",null,null):this.#Y.get("code").value}_codeViewAutoHeight(t,e,s){s&&(t.style.height=t.scrollHeight+"px"),this.#Al(e,t)}_scrollLineNumbers(t){t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft}_markdownViewAutoHeight(t,e,s){s&&(t.style.height=t.scrollHeight+"px"),this.#Al(e,t)}_scrollMarkdownLineNumbers(t){t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft}#Hl(){const t=this._getCodeView();if(this.#Q.get("iframe_fullPage")){const e=this.#Y.get("_wd"),s=(new DOMParser).parseFromString(t,"text/html");if(!this.#te.test("script")){const t=s.head.children;for(let e=0,i=t.length;e<i;e++)/^script$/i.test(t[e].tagName)&&(s.head.removeChild(t[e]),e--,i--)}let i=s.head.innerHTML;s.head.querySelector('link[rel="stylesheet"]')&&("auto"!==this.#Q.get("height")||s.head.querySelector("style"))||(i+=Be._setIframeStyleLinks(this.#Q.get("iframe_cssFileName"))+Be._setAutoHeightStyle(this.#Q.get("height"))),e.head.innerHTML=i,e.body.innerHTML=this.#J.html.clean(s.body.innerHTML,{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.#ot.get("freeCodeViewMode")});const n=s.body.attributes;for(let t=0,s=n.length;t<s;t++)"contenteditable"!==n[t].name&&e.body.setAttribute(n[t].name,n[t].value);if(!Ie.utils.hasClass(e.body,"sun-editor-editable")){const t=this.#ot.get("_editableClass").split(" ");for(let s=0;s<t.length;s++)Ie.utils.addClass(e.body,t[s])}}else this.#Y.get("wysiwyg").innerHTML=t.length>0?this.#J.html.clean(t,{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.#ot.get("freeCodeViewMode")}):"<"+this.#ot.get("defaultLine")+"><br></"+this.#ot.get("defaultLine")+">"}#Ml(){const t=this.#J.html._convertToCode(this.#Y.get("wysiwyg"),!1);let e="";if(this.#Q.get("iframe_fullPage")){const s=Ie.utils.getAttributesToString(this.#Y.get("_wd").body,null);e="<!DOCTYPE html>\n<html>\n"+this.#Y.get("_wd").head.outerHTML.replace(/>(?!\n)/g,">\n")+"<body "+s+">\n"+t+"</body>\n</html>"}else e=t;this._setCodeView(e)}#Ll(){const t=Be.htmlToJson(this.#Y.get("wysiwyg").innerHTML),e=Pe.jsonToMarkdown(t);this.#Y.get("markdown").value=e}#Nl(){const t=this.#Y.get("markdown").value,e=Pe.markdownToHtml(t,this.#ot.get("defaultLine"));this.#Y.get("wysiwyg").innerHTML=e.length>0?this.#J.html.clean(e,{forceFormat:!0,whitelist:null,blacklist:null}):"<"+this.#ot.get("defaultLine")+"><br></"+this.#ot.get("defaultLine")+">"}#Al(t,e){if(!t)return;const s=(e.value.match(/\n/g)||[]).length+1;if(s!==(t.value.match(/\n/g)||[]).length){let e="";for(let t=1;t<=s;t++)e+=`${t}\n`;t.value=e}}_destroy(){}},{_d:An,_w:Bn}=Ne;class In{#J;#t;#Bl;#Il;#Vl;#Ol;#Rl;#Pl;#zl;#Fl;#Dl;#ql;#Wl;#Ul;#Zl=!1;#Gl=!0;#jl=[];#Kl=-1;#Yl="";#Xl={matchCase:!1,wholeWord:!1,regex:!1};#Jl;#Ql=[];#tr=null;#er=null;#sr=null;#ir=null;#nr=null;#or=!1;static#lr=!1;static#rr(){if(In.#lr)return;In.#lr=!0;const t=An.createElement("style");t.textContent="::highlight(se-find-match){background-color:var(--se-find-match-color,rgba(255,213,0,.4));color:inherit}::highlight(se-find-current){background-color:var(--se-find-current-color,rgba(255,150,50,.7));color:inherit}",An.head.appendChild(t)}constructor(t){if(this.#J=t.$,this.#t=t.store,this.#Jl=!!Bn.Highlight&&!!CSS?.highlights,this.#J.options.get("finder_panel")){const t=function({lang:t,icons:e}){const s=`\n\t<div class="se-find-replace-row">\n\t\t<div class="se-find-input-wrapper">\n\t\t\t<input class="se-find-replace-input" type="text" placeholder="${t.find||"Find"}" spellcheck="false" autocomplete="off" />\n\t\t\t<div class="se-find-replace-toggle">\n\t\t\t\t<div class="se-find-replace-info">\n\t\t\t\t\t<span class="se-find-replace-count"></span>\n\t\t\t\t</div>\n\t\t\t\t<button class="se-btn se-find-replace-btn se-find-opt-case" type="button" data-command="opt-case" title="${t.finder_matchCase}">\n\t\t\t\t\t${e.match_case}\n\t\t\t\t</button>\n\t\t\t\t<button class="se-btn se-find-replace-btn se-find-opt-word" type="button" data-command="opt-word" title="${t.finder_wholeWord}">\n\t\t\t\t\t${e.whole_word}\n\t\t\t\t</button>\n\t\t\t\t<button class="se-btn se-find-replace-btn se-find-opt-regex" type="button" data-command="opt-regex" title="${t.finder_regex}">\n\t\t\t\t\t${e.regex}\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class="se-find-replace-buttons">\n\t\t\t<button class="se-btn se-find-replace-btn" type="button" data-command="prev" title="${t.finder_prev}\n(${Ne.shiftIcon} + Enter)">\n\t\t\t\t${e.arrow_up_small}\n\t\t\t</button>\n\t\t\t<button class="se-btn se-find-replace-btn" type="button" data-command="next" title="${t.finder_next}\n(Enter)">\n\t\t\t\t${e.arrow_down_small}\n\t\t\t</button>\n\t\t\t<button class="se-btn se-find-replace-btn se-find-toggle-replace" type="button" data-command="toggle-replace" title="${t.replace}">\n\t\t\t\t${e.swap_vert}\n\t\t\t</button>\n\t\t\t<button class="se-btn se-find-replace-btn" type="button" data-command="close" title="${t.close}">\n\t\t\t\t${e.cancel}\n\t\t\t</button>\n\t\t</div>\n\t</div>\n\t<div class="se-find-replace-row se-find-replace-row-replace">\n\t\t<div class="se-find-input-wrapper">\n\t\t\t<input class="se-find-replace-input se-replace-input" type="text" placeholder="${t.replace}" spellcheck="false" autocomplete="off" />\n\t\t</div>\n\t\t<div class="se-find-replace-buttons">\n\t\t\t<button class="se-btn se-find-replace-btn" type="button" data-command="replace" title="${t.replace}\n(Enter)">\n\t\t\t\t${e.replaceText}\n\t\t\t</button>\n\t\t\t<button class="se-btn se-find-replace-btn" type="button" data-command="replace-all" title="${t.replaceAll}">\n\t\t\t\t${e.relaceTextAll}\n\t\t\t</button>\n\t\t</div>\n\t</div>`,i=Ie.utils.createElement("DIV",{class:"se-find-replace"},s);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"]')}}(this.#J);this.#Bl=t.panel,this.#Il=t.findInput,this.#Vl=t.replaceInput,this.#Ol=t.countDisplay,this.#Rl=t.replaceRow,this.#Pl=t.btnCase,this.#zl=t.btnWord,this.#Fl=t.btnRegex,this.#Dl=t.btnPrev,this.#ql=t.btnNext,this.#Wl=t.btnReplace,this.#Ul=t.btnReplaceAll,this.#ar();const e=this.#J.frameRoots.values().next().value.get("container");if(this.#t.mode.isBottom){const t=this.#J.context.get("toolbar_main");e.insertBefore(this.#Bl,t)}else{const t=e.querySelector(".se-wrapper");e.insertBefore(this.#Bl,t)}Ne.isResizeObserverSupported&&(this.#sr=new ResizeObserver((()=>this.#hr())).observe(this.#J.context.get("toolbar_main")))}}get isOpen(){return this.#Zl}open(t=!0){const e=this.#J.frameContext;if(!e.get("isCodeView")&&!e.get("isMarkdownView")&&(this.#Zl=!0,this.#cr(),this.#Bl)){this.#Dl.disabled=!0,this.#ql.disabled=!0,this.#Wl.disabled=!0,this.#Ul.disabled=!0,this.#hr();const e=this.#J.selection.get(),s=e&&!e.isCollapsed?e.toString().trim():"";Ie.utils.addClass(this.#Bl,"se-find-replace-open"),this.#t.set("_preventBlur",!0),this.#dr(),t&&this.#ur(t),s&&(this.#Il.value=s),this.#Il.focus(),this.#Il.select(),this.#Il.value&&this.#pr()}}#hr(){if(!this.#Zl||!this.#Bl)return;const t=this.#J.options.get("_toolbar_sticky");this.#t.mode.isBottom?(this.#Bl.style.top="auto",this.#Bl.style.bottom=t>=0?t+this.#J.context.get("toolbar_main").offsetHeight+"px":"0px"):this.#Bl.style.top=t>=0?t+this.#J.context.get("toolbar_main").offsetHeight+"px":"0px"}close(){this.#Zl&&(this.#Zl=!1,this.#gr(),this.#jl=[],this.#Kl=-1,this.#mr(),this.#fr(),this.#Bl&&(Ie.utils.removeClass(this.#Bl,"se-find-replace-open"),this.#vr(),this.#t.set("_preventBlur",!1),this.#J.focusManager.nativeFocus()))}findNext(){this.#Zl&&0!==this.#jl.length&&(this.#Kl=(this.#Kl+1)%this.#jl.length,this.#br())}findPrev(){this.#Zl&&0!==this.#jl.length&&(this.#Kl=(this.#Kl-1+this.#jl.length)%this.#jl.length,this.#br())}search(t,{matchCase:e,wholeWord:s,regex:i}={}){return this.#Zl||this.open(),void 0!==e&&(this.#Xl.matchCase=e),void 0!==s&&(this.#Xl.wholeWord=s),void 0!==i&&(this.#Xl.regex=i),this.#Yl=t||"",this.#Il&&(this.#Il.value=this.#Yl),this.#pr(),this.#jl.length}replace(t){this.#yr(t)}replaceAll(t){this.#Cr(t)}get matchInfo(){return{current:this.#Kl+1,total:this.#jl.length}}refresh(){this.#Zl&&this.#Yl&&!this.#or&&(this.#or=!0,this.#wr(),this.#Ql=[],this.#or=!1,clearTimeout(this.#er),this.#er=setTimeout((()=>this.#pr()),300))}#dr(){this.#vr(),this.#ir=this.#J.eventManager.addGlobalEvent("keydown",(t=>{"Escape"===t.key&&(t.preventDefault(),t.stopPropagation(),this.close())}),!0)}#vr(){this.#ir&&=this.#J.eventManager.removeGlobalEvent(this.#ir)}#cr(){this.#fr();const t=this.#J.frameContext.get("wysiwyg");this.#nr=new MutationObserver((()=>this.refresh())),this.#nr.observe(t,{childList:!0,subtree:!0,characterData:!0})}#fr(){this.#nr&&(this.#nr.disconnect(),this.#nr=null)}#ar(){const t=this.#J.eventManager;t.addEvent(this.#Il,"input",this.#_r.bind(this)),t.addEvent(this.#Il,"keydown",this.#xr.bind(this)),t.addEvent(this.#Vl,"keydown",this.#$r.bind(this)),t.addEvent(this.#Bl,"click",this.#kr.bind(this)),Ne.isGecko&&t.addEvent(this.#Bl,"mousedown",(t=>{if("BUTTON"===t.target.tagName){t.preventDefault();const e=Ie.query.getCommandTarget(t.target);e&&this.#J.eventManager._injectActiveEvent(e)}this.#t.set("_preventBlur",!0)}))}#_r(){this.#J.options.get("finder_liveSearch")&&(clearTimeout(this.#er),this.#er=setTimeout((()=>this.#pr()),120))}#xr(t){"Escape"===t.key?(t.preventDefault(),this.close()):"Enter"===t.key&&(t.preventDefault(),this.#J.options.get("finder_liveSearch")||this.#Il.value===this.#Yl?t.shiftKey?this.findPrev():this.findNext():this.#pr())}#$r(t){"Escape"===t.key?(t.preventDefault(),this.close()):"Enter"===t.key&&(t.preventDefault(),this.#yr())}#kr(t){const e=Ie.query.getEventTarget(t),s=Ie.query.getCommandTarget(e);if(!s)return;t.preventDefault();switch(s.getAttribute("data-command")){case"prev":this.findPrev();break;case"next":this.findNext();break;case"toggle-replace":this.#ur(!this.#Gl);break;case"close":this.close();break;case"replace":this.#yr();break;case"replace-all":this.#Cr();break;case"opt-case":this.#Xl.matchCase=!this.#Xl.matchCase,Ie.utils.toggleClass(this.#Pl,"on",this.#Xl.matchCase),this.#pr();break;case"opt-word":this.#Xl.wholeWord=!this.#Xl.wholeWord,Ie.utils.toggleClass(this.#zl,"on",this.#Xl.wholeWord),this.#pr();break;case"opt-regex":this.#Xl.regex=!this.#Xl.regex,Ie.utils.toggleClass(this.#Fl,"on",this.#Xl.regex),this.#pr()}}#ur(t){this.#Gl=t,this.#Rl.style.display=t?"":"none",Ie.utils.toggleClass(this.#Bl.querySelector(".se-find-toggle-replace"),"on",t),t&&this.#Vl.focus()}#pr(){const t=this.#Il?this.#Il.value:this.#Yl;if(this.#or=!0,this.#gr(),this.#jl=[],this.#Kl=-1,!t)return this.#Yl="",this.#mr(),void Ie.utils.removeClass(this.#Il,"se-find-no-match");this.#Yl=t;const e=this.#J.frameContext.get("wysiwyg");this.#tr=this.#Sr(),this.#jl=this.#Er(t,e),this.#jl.length>0?(this.#Kl=0,this.#Tr(),this.#br(),Ie.utils.removeClass(this.#Il,"se-find-no-match")):this.#Il&&Ie.utils.toggleClass(this.#Il,"se-find-no-match",t.length>0),this.#mr(),this.#or=!1}#Er(t,e){const s=[];if(!t||!e)return s;const i=this.#Xl.matchCase?"g":"gi";let n;if(this.#Xl.regex)try{n=new RegExp(t,i)}catch{return s}else{const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=this.#Xl.wholeWord?new RegExp(`\\b${e}\\b`,i):new RegExp(e,i)}const o=this.#tr,l=this.#J.format,r=o.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),a=[];let h,c,d="",u=null;for(;h=r.nextNode();){const t=l.getLine(h,null)||e;u&&t!==u&&(d+="\n"),u=t,a.push({node:h,start:d.length}),d+=h.textContent.replace(/\u00A0/g," ")}if(!d)return s;n.lastIndex=0;let p=0;for(;null!==(c=n.exec(d));){if(0===c[0].length){n.lastIndex++;continue}const t=c.index,e=t+c[0].length,i=o.createRange();let l=!1;for(let s=p;s<a.length;s++){const n=a[s],o=n.start+n.node.textContent.length;if(!l&&t>=n.start&&t<o&&(i.setStart(n.node,t-n.start),l=!0,p=s),l&&e>n.start&&e<=o){i.setEnd(n.node,e-n.start);break}}l&&s.push(i)}return s}#Tr(){if(0===this.#jl.length)return;const t=this.#J.frameContext.get("options").get("iframe");this.#Jl&&!t?this.#Mr():this.#Hr()}#Mr(){In.#rr();const t=new Highlight(...this.#jl);CSS.highlights.set("se-find-match",t),this.#Lr()}#Lr(){if(this.#Kl>=0&&this.#Kl<this.#jl.length){const t=new Highlight(this.#jl[this.#Kl]);CSS.highlights.set("se-find-current",t)}else CSS.highlights.delete("se-find-current")}#Hr(){this.#wr();const t=this.#tr;for(let e=this.#jl.length-1;e>=0;e--){const s=this.#jl[e],i=this.#Nr(t,s,e);for(let t=0;t<i.length;t++)this.#Ql.push(i[t])}this.#Ql.reverse(),this.#Ar()}#Nr(t,e,s){const i=e.startContainer,n=e.endContainer,o=[];if(i===n)o.push(this.#Br(t,i,e.startOffset,e.endOffset,s));else{const l=[i];let r=i;for(;r&&r!==n;)r=this.#Ir(r,e.commonAncestorContainer),r&&l.push(r);for(let r=l.length-1;r>=0;r--){const a=l[r],h=a===i?e.startOffset:0,c=a===n?e.endOffset:a.textContent.length;h>=c||o.push(this.#Br(t,a,h,c,s))}}return o}#Br(t,e,s,i,n){const o=s>0?e.splitText(s):e;i-s<o.textContent.length&&o.splitText(i-s);const l=t.createElement("mark");return l.className="se-find-mark",l.setAttribute("data-se-find-idx",String(n)),o.parentNode.insertBefore(l,o),l.appendChild(o),l}#Ir(t,e){let s=t;for(;s;){if(s.firstChild)s=s.firstChild;else{for(;s&&!s.nextSibling;)if(s=s.parentNode,s===e)return null;if(!s)return null;s=s.nextSibling}if(3===s.nodeType)return s}return null}#Ar(){for(const t of this.#Ql)Ie.utils.removeClass(t,"se-find-current");if(this.#Kl>=0)for(const t of this.#Ql)t.getAttribute("data-se-find-idx")===String(this.#Kl)&&Ie.utils.addClass(t,"se-find-current")}#gr(){const t=this.#J.frameContext.get("options").get("iframe");this.#Jl&&!t&&(CSS.highlights.delete("se-find-match"),CSS.highlights.delete("se-find-current")),this.#wr()}#wr(){const t=this.#J.frameContext.get("wysiwyg").querySelectorAll("mark.se-find-mark");if(0!==t.length){for(const e of t){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e),t.normalize()}}this.#Ql=[]}}#br(){if(this.#Kl<0||this.#Kl>=this.#jl.length)return;const t=this.#J.frameContext.get("options").get("iframe");if(this.#Jl&&!t){this.#Lr();const t=this.#jl[this.#Kl];this.#J.selection.scrollTo(t,{behavior:"auto"})}else{this.#Ar();const t=this.#Ql.find((t=>t.getAttribute("data-se-find-idx")===String(this.#Kl)));t&&this.#J.selection.scrollTo(t,{behavior:"auto",noFocus:!0})}this.#mr()}#yr(t){if(this.#Kl<0||0===this.#jl.length)return;this.#gr();const e=this.#J.frameContext.get("wysiwyg"),s=this.#Er(this.#Yl,e);this.#Kl>=s.length||(this.#Vr(s[this.#Kl],t??(this.#Vl?this.#Vl.value:"")),this.#J.history.push(!1),this.#pr(),this.#Kl>=this.#jl.length&&this.#jl.length>0&&(this.#Kl=0,this.#br()))}#Cr(t){if(0===this.#jl.length)return;this.#gr();const e=this.#J.frameContext.get("wysiwyg"),s=this.#Er(this.#Yl,e);if(0!==s.length){t=t??(this.#Vl?this.#Vl.value:"");for(let e=s.length-1;e>=0;e--)this.#Vr(s[e],t);e.normalize(),this.#J.history.push(!1),this.#pr()}}#Vr(t,e){const s=t.startContainer,i=this.#tr.createTextNode(e);if(s===t.endContainer)return t.deleteContents(),t.insertNode(i),void s.parentNode?.normalize();t.deleteContents(),3===s.nodeType?s.parentNode&&(s.parentNode.insertBefore(i,s.nextSibling),s.parentNode.normalize()):(t.insertNode(i),i.parentNode?.normalize())}#mr(){if(!this.#Bl)return;const t=this.#jl.length>0;this.#Ol.textContent=t?`${this.#Kl+1}/${this.#jl.length}`:this.#Yl?"0":"",this.#Dl.disabled=!t,this.#ql.disabled=!t,this.#Wl.disabled=!t,this.#Ul.disabled=!t}#Sr(){const t=this.#J.frameContext;return t.get("options").get("iframe")?t.get("_wd"):An}_destroy(){this.#vr(),this.#fr(),this.#sr&&=this.#sr.disconnect(),clearTimeout(this.#er)}}const Vn=In;const On=class{$;constructor(t){this.$=t.$}},{isMobile:Rn,_w:Pn}=Ne;function zn(t){const e=Ie.query.getEventTarget(t);let s=e;this.$.store.mode.isBalloon&&!this.$.context.get("toolbar_sub_main")?.contains(s)&&this._hideToolbar_sub();const i=Ie.check.isInputElement(s);if(i?this.$.store.set("_preventBlur",!1):this.$.frameContext.get("wysiwyg").contains(this.$.selection.getNode())||this.$.focusManager.focus(),Ie.query.getParentElement(s,".se-dropdown"))t.stopPropagation(),this.$.ui.preventToolbarHide(!0);else{let n=s.getAttribute("data-command"),o=s.className;for(;s&&!n&&!/(se-menu-list|sun-editor-common|se-menu-tray)/.test(o);)s=s.parentElement,n=s.getAttribute("data-command"),o=s.className;if(i&&/^INPUT$/i.test(s?.getAttribute("data-type"))){if(this.$.store.set("_preventBlur",!0),this._inputFocus=!0,this.$.store.get("hasFocus")||this.applyTagEffect(),!Ie.check.isInputElement(e)||e.disabled)return;const t=this.$.plugins[n];if(!t)return;if(this.__inputBlurEvent&&this.__removeInput(),"function"==typeof t.toolbarInputChange&&(this.__inputPlugin={obj:t,target:e,value:e.value}),this.__inputBlurEvent=this.$.eventManager.addEvent(e,"blur",(s=>{if(!t.isInputActive)try{const i=e.value.trim();"function"==typeof t.toolbarInputChange&&i!==this.__inputPlugin.value&&t.toolbarInputChange({target:e,value:i,event:s})}finally{Pn.setTimeout((()=>this._inputFocus=!1),0),this.__removeInput()}})),!t)return;"function"==typeof t.toolbarInputKeyDown&&(this.__inputKeyEvent=this.$.eventManager.addEvent(e,"keydown",(s=>{t.toolbarInputKeyDown({target:e,event:s})})))}else{if(this.__inputBlurEvent&&this.__inputPlugin){const e=this.__inputPlugin.target.value.trim();return e!==this.__inputPlugin.value&&this.__inputPlugin.obj.toolbarInputChange({target:this.__inputPlugin.target,value:e,event:t}),void this.__removeInput()}this.$.frameContext.get("isCodeView")||(Rn?this.$.store.set("_preventBlur",!0):(t.preventDefault(),Ne.isGecko&&n&&this.$.eventManager._injectActiveEvent(s)))}n!==this.$.menu.currentDropdownName&&n!==this.$.menu.currentContainerName||t.stopPropagation()}}function Fn(t){const e=Ie.query.getEventTarget(t),s=Ie.query.getCommandTarget(e);if(!s)return;let i=s,n="";for(;i&&!/se-menu-tray/.test(i.className)&&!n;)i=i.parentElement,n=i?.getAttribute("data-key");if(!n)return;const o=this.$.plugins[n];o&&"function"==typeof o.action&&(t.stopPropagation(),o.action(s))}function Dn(t){const e=Ie.query.getEventTarget(t);this.$.commandDispatcher.runFromTarget(e)}const{_w:qn}=Ne,Wn=new WeakMap;async function Un(t,e){const s=Ie.query.getEventTarget(e);this.$.store.set("_mousedown",!0),this.__onDownEv&&Zn.call(this),this.__onDownEv=this.$.eventManager.addGlobalEvent("mouseup",Zn.bind(this)),t.get("isReadOnly")||Ie.check.isNonEditable(t.get("wysiwyg"))||(this.$.format._isExcludeSelectionElement(s)?e.preventDefault():(this._setSelectionSync(),qn.setTimeout(this.$.selection.init.bind(this.$.selection),0),!1!==await this.$.eventManager.triggerEvent("onMouseDown",{frameContext:t,event:e})&&!1!==await this._callPluginEventAsync("onMouseDown",{frameContext:t,event:e})&&(this.$.store.mode.isBalloon?this._hideToolbar():this.$.store.mode.isSubBalloon&&this._hideToolbar_sub(),/FIGURE/i.test(s?.nodeName)&&e.preventDefault())))}function Zn(){this.$.store.set("_mousedown",!1),this.__onDownEv=this.$.eventManager.removeGlobalEvent(this.__onDownEv)}async function Gn(t,e){!1!==await this.$.eventManager.triggerEvent("onMouseUp",{frameContext:t,event:e})&&await this._callPluginEventAsync("onMouseUp",{frameContext:t,event:e})}async function jn(t,e){const s=Ie.query.getEventTarget(e);if(t.get("isReadOnly"))return e.preventDefault(),Ie.check.isAnchor(s)&&qn.open(s.href,s.target),!1;if(Ie.check.isNonEditable(t.get("wysiwyg")))return;if(!1===await this.$.eventManager.triggerEvent("onClick",{frameContext:t,event:e}))return;if(!1===await this._callPluginEventAsync("onClick",{frameContext:t,event:e}))return;const i=this.$.component.get(s);if(i)return e.preventDefault(),void this.$.component.select(i.target,i.pluginName);if(this.$.selection.init(),3===e.detail){const t=this.$.selection.getRange();this.$.format.isLine(t.endContainer)&&0===t.endOffset&&this.$.selection.setRange(t.startContainer,t.startOffset,t.startContainer,t.startContainer.textContent.length)}const n=this.$.selection.getNode(),o=this.$.format.getLine(n,null),l=this.$.format.getBlock(n,null);if(!o&&!Ie.check.isNonEditable(s)&&!Ie.check.isList(l)){const t=this.$.selection.getRange();if(this.$.format.getLine(t.startContainer)===this.$.format.getLine(t.endContainer))if(Ie.check.isList(l)){e.preventDefault();const t=n.nextElementSibling,s=Ie.utils.createElement("LI",null,n);l.insertBefore(s,t),this.$.focusManager.focus()}else Ie.check.isWysiwygFrame(n)||this.$.component.is(n)||Ie.check.isTableElements(n)&&!Ie.check.isTableCell(n)||null===this._setDefaultLine(this.$.format.isBlock(l)?"DIV":this.$.options.get("defaultLine"))||(e.preventDefault(),this.$.focusManager.focus())}this.$.commandDispatcher._copyFormat(),(this.$.store.mode.isBalloon||this.$.store.mode.isSubBalloon)&&qn.setTimeout(this._toggleToolbarBalloon.bind(this),0)}function Kn(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return!1;let s=Wn.get(t);s||(s={rafId:null,event:null},Wn.set(t,s)),s.event=e,null===s.rafId&&(s.rafId=qn.requestAnimationFrame((()=>{const e=s.event;if(s.rafId=null,s.event=null,!e)return;const i=Ie.query.getEventTarget(e);!1===fi.get("__overInfo")||this.$.ui.selectMenuOn||this.$.component.hoverSelect(i),this.$.ui.blockHandle?.positionForTarget(i,e.clientY),this._callPluginEvent("onMouseMove",{frameContext:t,event:e})})))}async function Yn(t,e){this.$.ui.blockHandle?.hide(e),!1!==await this.$.eventManager.triggerEvent("onMouseLeave",{frameContext:t,event:e})&&await this._callPluginEventAsync("onMouseLeave",{frameContext:t,event:e})}const Xn={"event.prevent":({ctx:t})=>t.e.preventDefault(),"event.stop":({ctx:t})=>t.e.stopPropagation(),"event.prevent.stop":({ctx:t})=>{t.e.preventDefault(),t.e.stopPropagation()},"cache.styleNode":({ports:t})=>t.styleNodeCache(),"cache.formatAttrsTemp":({ports:t},{attrs:e})=>t.formatAttrsTempCache(e),"focusManager.nativeFocus":({ports:t})=>t.focusManager.nativeFocus(),"history.push":({ports:t},e)=>t.history.push(e),"documentType.refreshHeader":({ctx:t})=>{o.setTimeout((()=>{t.fc.get("documentType").reHeader()}),0)},"component.deselect":({ports:t})=>t.component.deselect(),"selection.setRange":({ports:t},{sc:e,so:s,ec:i,eo:n})=>t.selection.setRange(e,s,i,n),"format.removeBlock":({ports:t},{rangeEl:e,selectedFormats:s,newBlockElement:i,shouldDelete:n,skipHistory:o})=>t.format.removeBlock(e,{selectedFormats:s,newBlockElement:i,shouldDelete:n,skipHistory:o}),"dom.utils.removeItem":(t,{item:e})=>Ie.utils.removeItem(e),"select.component.fallback":({ports:t},{cmponentInfo:e})=>{!1===t.component.select(e.target,e.pluginName)&&t.focusManager.blur()}},Jn={"del.format.removeAndMove":({ports:t},{container:e,formatEl:s})=>{const i=t.html.remove();if(i.commonCon!==i.container&&s.parentElement)if(s.contains(e)){const e=function(t){const e=t.lastChild,s=t.nextElementSibling;if(!s)return e;if(Ie.check.isZeroWidth(s))return Ie.utils.removeItem(s),e;const i=s.childNodes;for(;i[0];)t.appendChild(i[0]);return Ie.utils.removeItem(s),e}(s);t.selection.setRange(e,e.textContent.length,e,e.textContent.length)}else{const{focusNode:e,focusOffset:i}=function(t){const e=t.childNodes,s=t.previousElementSibling;let i=e[0],n=0;if(!s)return{focusNode:i,focusOffset:n};if(Ie.check.isZeroWidth(s))return Ie.utils.removeItem(s),{focusNode:i,focusOffset:n};if(e.length>1||e[0]?.textContent.length>0)for(;e[0];)s.appendChild(e[0]);else i=s.lastChild,n=i.textContent.length;return Ie.utils.removeItem(t),{focusNode:i,focusOffset:n}}(s);t.selection.setRange(e,i,e,i)}},"backspace.brline.strip":({ctx:t,ports:e},{formatEl:s})=>{const i=t.options.get("defaultLine"),n=s.parentNode,o=Ie.utils.createElement(i);for(;s.firstChild&&!Ie.check.isBreak(s.firstChild);)o.appendChild(s.firstChild);s.firstChild&&Ie.check.isBreak(s.firstChild)&&s.removeChild(s.firstChild),o.firstChild||(o.innerHTML="<br>"),n.insertBefore(o,s),s.firstChild&&(s.textContent.trim()||s.querySelector("br"))||n.removeChild(s);const l=o.firstChild;e.selection.setRange(l,0,l,0)},"backspace.format.maintain":({ctx:t},{formatEl:e})=>{if(e.nodeName.toUpperCase()===t.options.get("defaultLine").toUpperCase()){e.innerHTML="<br>";const t=e.attributes;for(;t[0];)e.removeAttribute(t[0].name)}else e.parentNode.replaceChild(Ie.utils.createElement(t.options.get("defaultLine"),null,"<br>"),e)},"backspace.component.select":({ports:t},{selectionNode:e,range:s,fileComponentInfo:i})=>{let n=null;Ie.check.isBreak(e)?Ie.utils.removeItem(e):Ie.check.isBreak(n=s.startContainer.childNodes?.[s.startOffset])&&Ie.utils.removeItem(n),!1===t.component.select(i.target,i.pluginName)&&t.focusManager.blur()},"backspace.component.remove":({ports:t},{isList:e,sel:s,formatEl:i,fileComponentInfo:n})=>{e&&Ie.utils.removeItem(s),0===i.textContent.length&&Ie.utils.removeItem(i),!1===t.component.select(n.target,n.pluginName)&&t.focusManager.blur()},"backspace.list.mergePrev":({ports:t},{prev:e,formatEl:s,rangeEl:i})=>{let n=e===i.parentNode?i.previousSibling:e.lastChild;n||(n=Ie.utils.createTextNode(Ae.zeroWidthSpace),i.parentNode.insertBefore(n,i.parentNode.firstChild));const o=3===n.nodeType?n.textContent.length:1,l=s.childNodes;let r=n,a=l[0];for(;a=l[0];)e.insertBefore(a,r.nextSibling),r=a;Ie.utils.removeItem(s),0===i.children.length&&Ie.utils.removeItem(i),t.selection.setRange(n,o,n,o)},"backspace.list.removeNested":({ports:t},{range:e})=>{t.html.remove(),3===e.startContainer.nodeType&&t.selection.setRange(e.startContainer,e.startContainer.textContent.length,e.startContainer,e.startContainer.textContent.length)},"backspace.emptyLine.mergePrev":({ports:t},{formatEl:e,prev:s})=>{Ie.utils.removeItem(e),Qn(t,s,!0)},"backspace.brline.rowMerge":({ports:t},{rowEndBr:e,rowStartBr:s})=>{const i=s.nextSibling;i!==e&&3===i?.nodeType&&Ie.check.isZeroWidth(i)&&Ie.utils.removeItem(i);const n=s.previousSibling;if(Ie.utils.removeItem(s),n&&3===n.nodeType)t.selection.setRange(n,n.textContent.length,n,n.textContent.length);else if(Ie.check.isBreak(n))t.selection.setRange(e,0,e,0);else{const s=e.parentNode;t.selection.setRange(s,0,s,0)}},"delete.component.select":({ports:t},{formatEl:e,fileComponentInfo:s})=>{if(Ie.check.isListCell(e)){const t=s.container.previousSibling;Ie.check.isZeroWidth(t)&&Ie.utils.removeItem(t)}else Ie.check.isZeroWidth(e)&&Ie.utils.removeItem(e);!1===t.component.select(s.target,s.pluginName)&&t.focusManager.blur()},"delete.component.selectNext":({ports:t,ctx:e},{formatEl:s,nextEl:i})=>{if(Ie.check.isZeroWidth(s)&&(Ie.utils.removeItem(s),Ie.check.isTable(i))){let e=Ie.query.getEdgeChild(i,Ie.check.isTableCell,!1);return e=e.firstElementChild||e,void t.selection.setRange(e,0,e,0)}const n=t.component.get(i);n?(e.e.stopPropagation(),!1===t.component.select(n.target,n.pluginName)&&t.focusManager.blur()):t.component.is(i)&&(e.e.stopPropagation(),Ie.utils.removeItem(i))},"delete.list.removeNested":({ports:t,ctx:e},{range:s,formatEl:i,rangeEl:n})=>{s.startContainer!==s.endContainer&&t.html.remove();const o=Ie.utils.arrayFind(i.children,Ie.check.isList)||i.nextElementSibling||n.parentElement.nextElementSibling;if(o&&(Ie.check.isList(o)||Ie.utils.arrayFind(o.children,Ie.check.isList))){let s,n;if(e.e.preventDefault(),Ie.check.isList(o)){const t=o.firstElementChild;for(n=t.childNodes,s=n[0];n[0];)i.insertBefore(n[0],o);Ie.utils.removeItem(t)}else{for(s=o.firstChild,n=o.childNodes;n[0];)i.appendChild(n[0]);Ie.utils.removeItem(o)}t.selection.setRange(s,0,s,0),t.history.push(!0)}},"delete.emptyLine.mergeNext":({ports:t},{formatEl:e,next:s})=>{Ie.utils.removeItem(e),Qn(t,s,!1)},"delete.brline.rowMerge":({ports:t},{rowEndBr:e})=>{let s=e.nextSibling;3===s?.nodeType&&Ie.check.isZeroWidth(s)&&(s=s.nextSibling);const i=e.parentNode;Ie.utils.removeItem(e),s&&(3===s.nodeType||Ie.check.isBreak(s))?t.selection.setRange(s,0,s,0):t.selection.setRange(i,i.childNodes.length,i,i.childNodes.length)},"tab.format.indent":({ports:t,ctx:e},{range:s,formatEl:i,shift:n})=>{const o=t.format.getLines(null),l=[],r=[],a=Ie.check.isListCell(o[0]),h=Ie.check.isListCell(o.at(-1));let c={sc:s.startContainer,so:s.startOffset,ec:s.endContainer,eo:s.endOffset};for(let t,e=0,s=o.length;e<s;e++)if(t=o[e],Ie.check.isListCell(t)){if(!t.previousElementSibling&&!n)continue;l.push(t)}else r.push(t);if(l.length>0&&(c=t.listFormat.applyNested(l,n)),r.length>0)if(n){const t=r.length-1;for(let e,s=0;s<=t;s++){e=r[s].childNodes;for(let t,s=0,i=e.length;s<i&&(t=e[s],t);s++)if(!Ie.check.isZeroWidth(t)){/^\s{1,4}$/.test(t.textContent)?Ie.utils.removeItem(t):/^\s{1,4}/.test(t.textContent)&&(t.textContent=t.textContent.replace(/^\s{1,4}/,""));break}}const e=Ie.query.getEdgeChild(r[0],"text",!1),s=Ie.query.getEdgeChild(r[t],"text",!0);!a&&e&&(c.sc=e,c.so=0),!h&&s&&(c.ec=s,c.eo=s.textContent.length)}else if(1===r.length){let n=e.store.get("tabSize")+1;if(e.options.get("syncTabIndent")){const e=Ie.query.findTextIndexOnLine(i,s.startContainer,s.startOffset,(e=>t.component.is(e))),o=t.format.isLine(i.previousElementSibling)?Ie.query.findTabEndIndex(i.previousElementSibling,e,2):0;o>e&&(n=o-e)}const o=Ie.utils.createTextNode(new Array(n).join(" "));if(!t.html.insertNode(o,{afterNode:null,skipCharCount:!1}))return!1;a||(c.sc=o,c.so=o.length),h||(c.ec=o,c.eo=o.length)}else{const t=Ie.utils.createTextNode(new Array(e.store.get("tabSize")+1).join(" ")),s=r.length-1;for(let e,i=0;i<=s;i++)e=r[i].firstChild,e&&(Ie.check.isBreak(e)?r[i].insertBefore(t.cloneNode(!1),e):e.textContent=t.textContent+e.textContent);const i=Ie.query.getEdgeChild(r[0],"text",!1),n=Ie.query.getEdgeChild(r[s],"text",!0);!a&&i&&(c.sc=i,c.so=0),!h&&n&&(c.ec=n,c.eo=n.textContent.length)}t.selection.setRange(c.sc,c.so,c.ec,c.eo)},"enter.scrollTo":({ports:t},{range:e})=>{t.enterScrollTo(e)},"enter.line.addDefault":({ports:t},{formatEl:e})=>{const s=t.format.addLineAfter(e).firstChild;t.selection.setRange(s,0,s,0)},"enter.list.addItem":({ports:t},{formatEl:e,selectionNode:s})=>{const i=Ie.utils.createElement("BR"),n=Ie.utils.createElement("LI",null,i);e.parentNode.insertBefore(n,e.nextElementSibling),n.appendChild(s.nextSibling),t.selection.setRange(i,1,i,1)},"enter.format.exitEmpty":({ports:t,ctx:e},{formatEl:s,rangeEl:i})=>{let n=null;if(Ie.check.isListCell(i.parentElement)){const t=s.parentNode.parentElement;i=t.parentElement;const o=Ie.utils.createElement("LI");o.innerHTML="<br>",Ie.utils.copyTagAttributes(o,s,e.options.get("lineAttrReset")),n=o,i.insertBefore(n,t.nextElementSibling)}else{let o;o=Ie.check.isTableCell(i.parentElement)?"DIV":Ie.check.isList(i.parentElement)?"LI":t.format.isLine(i.nextElementSibling)?i.nextElementSibling.nodeName:t.format.isLine(i.previousElementSibling)?i.previousElementSibling.nodeName:e.options.get("defaultLine"),n=Ie.utils.createElement(o);const l=t.format.removeBlock(i,{selectedFormats:[s],newBlockElement:null,shouldDelete:!0,skipHistory:!0});l.cc.insertBefore(n,l.ec)}n.innerHTML="<br>",t.nodeTransform.removeAllParents(s,null,null),t.selection.setRange(n,1,n,1)},"enter.format.cleanBrAndZWS":({ports:t},{selectionNode:e,selectionFormat:s,brBlock:i,children:n,offset:o})=>{s?Ie.utils.removeItem(n[o-1]):Ie.utils.removeItem(e);const l=i.nextElementSibling,r=t.format.addLine(i,t.format.isLine(l)?l:null);Ie.utils.copyFormatAttributes(r,i),t.selection.setRange(r,1,r,1)},"enter.format.insertBrHtml":({ports:t},{brBlock:e,range:s,wSelection:i,offset:n})=>{t.html.insert(s.collapsed&&Ie.check.isBreak(s.startContainer.childNodes[s.startOffset-1])?"<br>":"<br><br>",{selectInserted:!1,skipCharCount:!0,skipCleaning:!0});let o=i.focusNode;const l=i.focusOffset;e===o&&(o=o.childNodes[l-n>1?l-1:l]),t.selection.setRange(o,1,o,1),t.setOnShortcutKey(!0)},"enter.brline.insert":({ports:t},{range:e})=>{t.selection.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset),e.collapsed||t.html.remove();const s=Ie.utils.createElement("BR");t.html.insertNode(s,{afterNode:null,skipCharCount:!0}),s.nextSibling||s.parentNode.appendChild(Ie.utils.createElement("BR"));const i=s.nextSibling;t.selection.setRange(i,0,i,0),t.setOnShortcutKey(!0)},"enter.brline.exit":({ports:t},{brBlock:e})=>{const s=e.lastChild;s&&(Ie.check.isBreak(s)||Ie.check.isZeroWidth(s.textContent))&&Ie.utils.removeItem(s);const i=e.nextElementSibling,n=t.format.addLine(e,t.format.isLine(i)?i:null);Ie.utils.copyFormatAttributes(n,e),t.selection.setRange(n,1,n,1)},"enter.format.insertBrNode":({ports:t},{wSelection:e})=>{const s=e.focusNode.nextSibling,i=Ie.utils.createElement("BR");t.html.insertNode(i,{afterNode:null,skipCharCount:!0});const n=i.previousSibling,o=i.nextSibling;Ie.check.isBreak(s)||Ie.check.isBreak(n)||o&&!Ie.check.isZeroWidth(o)?t.selection.setRange(o,0,o,0):(i.parentNode.insertBefore(i.cloneNode(!1),i),t.selection.setRange(i,1,i,1)),t.setOnShortcutKey(!0)},"enter.format.breakAtEdge":({ports:t,ctx:e},{formatEl:s,selectionNode:i,formatStartEdge:n,formatEndEdge:o,bidiSwapped:l})=>{const r=Ie.utils.createElement("BR"),a=Ie.utils.createElement(s.nodeName,null,r);Ie.utils.copyTagAttributes(a,s,e.options.get("lineAttrReset"));let h=r,c=i;do{if(!Ie.check.isBreak(c)&&1===c.nodeType){const t=c.cloneNode(!1);t.appendChild(h),h=t}c=c.parentElement}while(s!==c&&s.contains(c));if(a.appendChild(h),s.parentNode.insertBefore(a,n&&!o?s:s.nextElementSibling),o)t.selection.setRange(r,1,r,1);else if(l)t.selection.setRange(s,1,s,1);else{const e=s.firstChild||s;t.selection.setRange(e,0,e,0)}},"enter.format.breakWithSelection":({ports:t,ctx:e},{formatEl:s,range:i,formatStartEdge:n,formatEndEdge:o})=>{const l=t.format.getLine(i.startContainer,null)!==t.format.getLine(i.endContainer,null),r=s.cloneNode(!1);r.innerHTML="<br>";const a=i.commonAncestorContainer,h=a===i.startContainer&&a===i.endContainer&&Ie.check.isZeroWidth(a)?{container:a,offset:i.endOffset,prevContainer:a.previousElementSibling,commonCon:a}:t.html.remove();let c=t.format.getLine(h.container,null),d=0;if(!c)return void(Ie.check.isWysiwygFrame(h.container)&&(t.enterPrevent(e.e),e.fc.get("wysiwyg").appendChild(r),c=r,Ie.utils.copyTagAttributes(c,s,e.options.get("lineAttrReset")),t.selection.setRange(c,d,c,d)));const u=t.format.getBlock(h.container);c=c.contains(u)?Ie.query.getEdgeChild(u,(e=>Boolean(t.format.getLine(e))),!1):c,l?o&&!n?(c.parentNode.insertBefore(r,h.prevContainer&&h.container!==h.prevContainer?c:c.nextElementSibling),c=r,d=0):(d=h.offset,n&&(c.parentNode.insertBefore(r,c),o&&(d=0))):o&&n?(c.parentNode.insertBefore(r,c),d=0):o?(c=c.parentNode.insertBefore(r,c.nextElementSibling),c=r,d=0):c=t.nodeTransform.split(h.container,h.offset,Ie.query.getNodeDepth(s)),t.enterPrevent(e.e),Ie.utils.copyTagAttributes(c,s,e.options.get("lineAttrReset")),t.selection.setRange(c,d,c,d)},"enter.format.breakAtCursor":({ports:t,ctx:e},{formatEl:s,range:i})=>{let n=null;n=Ie.check.isZeroWidth(s)?t.format.addLine(s,s.cloneNode(!1)):t.nodeTransform.split(i.endContainer,i.endOffset,Ie.query.getNodeDepth(s)),t.enterPrevent(e.e),Ie.utils.copyTagAttributes(n,s,e.options.get("lineAttrReset")),t.selection.setRange(n,0,n,0)},"enter.figcaption.exitInList":({ports:t},{formatEl:e})=>{const s=t.format.addLine(e,null);t.selection.setRange(s,0,s,0)},"keydown.input.insertNbsp":({ports:t})=>{const e=t.html.insertNode(Ie.utils.createTextNode(" "),{afterNode:null,skipCharCount:!0});e&&t.selection.setRange(e,e.length,e,e.length)},"keydown.input.insertZWS":({ports:t})=>{const e=Ie.utils.createTextNode(Ae.zeroWidthSpace);t.html.insertNode(e,{afterNode:null,skipCharCount:!0}),t.selection.setRange(e,1,e,1)}};function Qn(t,e,s){const i=s?e.childNodes.length:0;t.selection.setRange(e,i,e,i)}async function to(t,e){const s={...Xn,...Jn};for(const i of t){if("action.stop"===i.t)return!1;const t=s[i.t];if(t){if(!1===await t(e,i.p))return!1}}}function eo(t,{_styleNodes:e}){const{frameContext:s,ui:i,focusManager:n,selection:o,format:l,listFormat:r,component:a,html:h,nodeTransform:c,history:d,char:u,menu:p}=t.$;return{focusManager:{nativeFocus:()=>n.nativeFocus(),blur:()=>n.blur()},selection:{getRange:()=>o.getRange(),getNode:()=>o.getNode(),setRange:(t,e,s,i)=>o.setRange(t,e,s,i),get:()=>o.get()},format:{isLine:t=>l.isLine(t),getLine:(t,e)=>l.getLine(t,e),getLines:t=>l.getLines(t),getBrLine:(t,e)=>l.getBrLine(t,e),getBlock:(t,e)=>l.getBlock(t,e),isNormalLine:t=>l.isNormalLine(t),isBrLine:t=>l.isBrLine(t),isClosureBrLine:t=>l.isClosureBrLine(t),isClosureBlock:t=>l.isClosureBlock(t),isEdgeLine:(t,e,s)=>l.isEdgeLine(t,e,s),removeBlock:(t,e)=>l.removeBlock(t,e),addLine:(t,e)=>l.addLine(t,e),addLineAfter:t=>l.addLineAfter(t)},listFormat:{applyNested:(t,e)=>r.applyNested(t,e)},component:{deselect:()=>a.deselect(),is:t=>a.is(t),get:t=>a.get(t),select:(t,e)=>a.select(t,e)},html:{remove:()=>h.remove(),insert:(t,e)=>h.insert(t,e),insertNode:(t,e)=>h.insertNode(t,e)},history:{push:t=>d.push(!!t)},nodeTransform:{removeAllParents:(t,e,s)=>c.removeAllParents(t,e,s),split:(t,e,s)=>c.split(t,e,s)},char:{check:t=>u.check(t)},menu:{dropdownOff:()=>p.dropdownOff()},setDefaultLine:e=>t._setDefaultLine(e),hideToolbar:()=>t._hideToolbar(),hideToolbar_sub:()=>t._hideToolbar_sub(),styleNodeCache:()=>e.value=t.__cacheStyleNodes,formatAttrsTempCache:e=>t._formatAttrsTemp=e,setOnShortcutKey:e=>t._onShortcutKey=e,enterScrollTo(t){i._iframeAutoHeight(s),o.scrollTo(o.getRange()||t,{behavior:"auto",block:"nearest",inline:"nearest"})},enterPrevent(t){t.preventDefault()}}}function so(t){const e=t.selection.getRange(),s=e.startContainer,i=e.endContainer,n=t.format.getBlock(s),o=t.format.getBlock(i),l=Ie.check.isTableCell(n),r=Ie.check.isTableCell(o);if((l&&!n.previousElementSibling&&!n.parentElement.previousElementSibling||r&&!o.nextElementSibling&&!o.parentElement.nextElementSibling)&&n!==o){const s=Ie.query.getParentElement(e.commonAncestorContainer,Ie.check.isFigure)?.parentElement||e.commonAncestorContainer;if(l){if(r)return Ie.utils.removeItem(Ie.query.getParentElement(n,(t=>s===t.parentNode))),t.focusManager.nativeFocus(),!0;Ie.utils.removeItem(Ie.query.getParentElement(n,(t=>s===t.parentNode)))}else Ie.utils.removeItem(Ie.query.getParentElement(o,(t=>s===t.parentNode)))}const a=1===s.nodeType?Ie.query.getParentElement(s,".se-component"):null,h=1===i.nodeType?Ie.query.getParentElement(i,".se-component"):null;return a&&Ie.utils.removeItem(a),h&&Ie.utils.removeItem(h),!1}function io(t,e,s){const i=s?e.startContainer:e.endContainer,n=s?e.startOffset:e.endOffset,o=s?"previousSibling":"nextSibling";let l;return 1===i.nodeType?(l=no(t,i.childNodes[n],o,i),Ie.check.isComponentContainer(l)||Ie.check.isNonEditable(l)?l:null):(l=no(t,i,o,i),Ie.check.isEdgePoint(i,n,s?"front":"end")&&(Ie.check.isComponentContainer(l)||Ie.check.isNonEditable(l))?l:null)}function no(t,e,s,i){if(!e)return null;let n=e[s];if(!n){if(n=t.format.getLine(i),n=n?n[s]:null,!n||t.component.is(n))return null;n="previousSibling"===s?n.firstChild:n.lastChild}return n}function oo(t,e,s,i){if(!t.collapsed||!e)return!1;const n=t.getBoundingClientRect();if(n.height<=0)return!1;const o=i.createRange();o.selectNodeContents(e);const l=o.getBoundingClientRect();return!(l.width<=2)&&("front"===s?n.left<=l.left+2:n.left>=l.right-2)}const lo=()=>({t:"event.prevent"}),ro=()=>({t:"event.prevent.stop"}),ao=()=>({t:"cache.styleNode"}),ho=t=>({t:"cache.formatAttrsTemp",p:{attrs:t}}),co=()=>({t:"component.deselect"}),uo=()=>({t:"focusManager.nativeFocus"}),po=t=>({t:"history.push",p:t}),go=()=>({t:"documentType.refreshHeader"}),mo=(t,e,s,i,n)=>({t:"format.removeBlock",p:{rangeEl:t,selectedFormats:e,newBlockElement:s,shouldDelete:i,skipHistory:n}}),fo=t=>({t:"dom.utils.removeItem",p:{item:t}}),vo=t=>({t:"select.component.fallback",p:{cmponentInfo:t}}),bo=(t,e)=>({t:"del.format.removeAndMove",p:{container:t,formatEl:e}}),yo=t=>({t:"backspace.format.maintain",p:{formatEl:t}}),Co=t=>({t:"backspace.brline.strip",p:{formatEl:t}}),wo=(t,e,s)=>({t:"backspace.component.select",p:{selectionNode:t,range:e,fileComponentInfo:s}}),_o=(t,e,s,i)=>({t:"backspace.component.remove",p:{isList:t,sel:e,formatEl:s,fileComponentInfo:i}}),xo=(t,e,s)=>({t:"backspace.list.mergePrev",p:{prev:t,formatEl:e,rangeEl:s}}),$o=t=>({t:"backspace.list.removeNested",p:{range:t}}),ko=(t,e)=>({t:"backspace.emptyLine.mergePrev",p:{formatEl:t,prev:e}}),So=(t,e)=>({t:"backspace.brline.rowMerge",p:{rowEndBr:t,rowStartBr:e}}),Eo=(t,e)=>({t:"delete.component.select",p:{formatEl:t,fileComponentInfo:e}}),To=(t,e)=>({t:"delete.component.selectNext",p:{formatEl:t,nextEl:e}}),Mo=(t,e,s)=>({t:"delete.list.removeNested",p:{range:t,formatEl:e,rangeEl:s}}),Ho=(t,e)=>({t:"delete.emptyLine.mergeNext",p:{formatEl:t,next:e}}),Lo=t=>({t:"delete.brline.rowMerge",p:{rowEndBr:t}}),No=(t,e,s)=>({t:"tab.format.indent",p:{range:t,formatEl:e,shift:s}}),Ao=t=>({t:"enter.scrollTo",p:{range:t}}),Bo=t=>({t:"enter.line.addDefault",p:{formatEl:t}}),Io=(t,e)=>({t:"enter.list.addItem",p:{formatEl:t,selectionNode:e}}),Vo=(t,e)=>({t:"enter.format.exitEmpty",p:{formatEl:t,rangeEl:e}}),Oo=(t,e,s,i)=>({t:"enter.format.insertBrHtml",p:{brBlock:t,range:e,wSelection:s,offset:i}}),Ro=t=>({t:"enter.format.insertBrNode",p:{wSelection:t}}),Po=t=>({t:"enter.brline.insert",p:{range:t}}),zo=t=>({t:"enter.brline.exit",p:{brBlock:t}}),Fo=(t,e,s,i,n)=>({t:"enter.format.breakAtEdge",p:{formatEl:t,selectionNode:e,formatStartEdge:s,formatEndEdge:i,bidiSwapped:n}}),Do=(t,e,s,i)=>({t:"enter.format.breakWithSelection",p:{formatEl:t,range:e,formatStartEdge:s,formatEndEdge:i}}),qo=(t,e)=>({t:"enter.format.breakAtCursor",p:{formatEl:t,range:e}}),Wo=t=>({t:"enter.figcaption.exitInList",p:{formatEl:t}}),Uo=()=>({t:"keydown.input.insertNbsp"}),Zo=()=>({t:"keydown.input.insertZWS"});function Go(t,e,s){const{format:i,char:n,selection:o}=e,{frameOptions:l,range:r,formatEl:a,selectionNode:h,shift:c,e:d}=s,u=!r.collapsed||r.startContainer!==r.endContainer;t.push(co());const p=i.getBrLine(h,null),g=i.getBlock(a,null);if("byte-html"===l.get("charCounter_type")){let e="";if(e=!c&&p||c?"<br>":"<"+a.nodeName+"><br></"+a.nodeName+">",!n.check(e))return t.push(lo()),!1}if(!c){let n=i.isEdgeLine(r.endContainer,r.endOffset,"end"),l=i.isEdgeLine(r.startContainer,r.startOffset,"front"),c=!1;if(s.options.get("_rtl")&&a&&r.collapsed&&l!==n){const t=s.fc.get("_wd");l&&oo(r,a,"front",t)?(l=!1,n=!0,c=!0):n&&oo(r,a,"end",t)&&(n=!1,l=!0,c=!0)}if(n&&(/^H[1-6]$/i.test(a.nodeName)||/^HR$/i.test(a.nodeName)))return e.enterPrevent(d),t.push(Bo(a)),t.push(Ao(r)),!0;if(g&&a&&!Ie.check.isTableCell(g)&&!/^FIGCAPTION$/i.test(g.nodeName)){const s=o.getRange();if(Ie.check.isEdgePoint(s.endContainer,s.endOffset)&&Ie.check.isList(h.nextSibling))return e.enterPrevent(d),t.push(Io(a,h)),t.push(Ao(r)),!0;if((3!==s.commonAncestorContainer.nodeType||!s.commonAncestorContainer.nextElementSibling)&&Ie.check.isZeroWidth(a.innerText.trim())&&!Ie.check.isListCell(a.nextElementSibling))return e.enterPrevent(d),t.push(Vo(a,g)),!0}if(p||g===a&&i.isClosureBlock(g)&&i.isLine(a)){if(e.enterPrevent(d),p&&!i.isClosureBrLine(p))return!function(t,e){const s=Array.from(t.childNodes),i=[[]];for(const t of s)Ie.check.isBreak(t)?i.push([]):i[i.length-1].push(t);s.length&&Ie.check.isBreak(s[s.length-1])&&i.pop();const n=t=>!t||t.every((t=>Ie.check.isZeroWidth(t.textContent))),o=e.anchorNode;let l=0;if(o===t)for(let t=0;t<e.anchorOffset&&t<s.length;t++)Ie.check.isBreak(s[t])&&l++;else for(const t of s){if(t===o||1===t.nodeType&&t.contains(o))break;Ie.check.isBreak(t)&&l++}const r=Math.max(i.length,1),a=Math.min(l,r-1);return{shouldExit:a===r-1&&n(i[a])&&a>=1&&n(i[a-1])}}(p,o.get()).shouldExit?t.push(Po(r)):t.push(zo(p)),t.push(Ao(r)),!0;const s=o.get();return h===p?t.push(Oo(p,r,s,s.focusOffset)):t.push(Ro(s)),t.push(Ao(r)),!0}if(r.collapsed&&(l||n))return e.enterPrevent(d),t.push(Fo(a,h,l,n,c)),t.push(Ao(r)),!0;if(a){if(t.push(lo()),u){if(s.options.get("_rtl")&&l&&!n){const t=s.fc.get("_wd"),e=t.createRange();e.setStart(r.startContainer,r.startOffset),e.collapse(!0),oo(e,a,"front",t)&&(l=!1,n=!0,c=!0)}t.push(Do(a,r,l,n))}else t.push(qo(a,r));return t.push(Ao(r)),!0}}return u?(t.push(Ao(r)),!0):(g&&Ie.query.getParentElement(g,"FIGCAPTION")&&Ie.query.getParentElement(g,Ie.check.isList)&&(e.enterPrevent(d),t.push(Wo(a)),t.push(Ao(r))),!0)}function jo(t,e,s){const{format:i,component:n}=e,{fc:o,options:l,range:r,selectionNode:a}=s;let{formatEl:h}=s;const c=!r.collapsed||r.startContainer!==r.endContainer,d=l.get("_rtl")&&!c&&0===r.startOffset&&oo(r,h,"front",o.get("_wd"));if(t.push(co()),t.push(ao()),c&&so(e))return t.push(ro()),!0;if(!(i.isNormalLine(h)||i.isBrLine(h)||o.get("wysiwyg").firstElementChild||n.is(a)||null===function(t,e){return t.setDefaultLine(e)}(e,l.get("defaultLine"))))return t.push(ro()),!1;if(i.isLine(h)&&c&&Ie.check.isEdgePoint(r.startContainer,r.startOffset,"front")&&(!r.startContainer.previousSibling||Ie.check.isZeroWidth(r.startContainer.previousSibling))&&i.getLine(r.startContainer)!==i.getLine(r.endContainer)&&(i.isLine(h.previousElementSibling)||Ie.check.isListCell(h)))return t.push(ro()),t.push(bo(r.startContainer,h)),t.push(po(!0)),!1;if(!c&&!d&&!h.previousElementSibling&&0===r.startOffset&&!a.previousSibling&&!Ie.check.isListCell(h)&&i.isLine(h)&&(!i.isBrLine(h)||i.isClosureBrLine(h)||Ie.check.isWysiwygFrame(h.parentNode)))return i.isClosureBlock(h.parentNode)?(t.push(ro()),!1):i.isBrLine(h)&&Ie.check.isWysiwygFrame(h.parentNode)?(t.push(ro()),t.push(Co(h)),t.push(po(!0)),!1):(Ie.check.isWysiwygFrame(h.parentNode)&&h.childNodes.length<=1&&(!h.firstChild||Ie.check.isZeroWidth(h.textContent))&&(t.push(ro()),t.push(yo(h))),t.push(uo()),!1);const u=r.startContainer;if(h&&!d&&!h.previousElementSibling&&0===r.startOffset&&3===u.nodeType&&Ie.check.isZeroWidth(u)&&!0===function(t,e,s){let i=e.parentNode.previousSibling;const n=e.parentNode.nextSibling;i||(n?i=n:(i=Ie.utils.createElement("BR"),s.appendChild(i)));let o=e;for(;s.contains(o)&&!o.previousSibling;)o=o.parentNode;if(!s.contains(o))return e.textContent="",t.nodeTransform.removeAllParents(e,null,s),!0}(e,u,h))return!0;if(!c&&h&&(0===r.startOffset||a===h)){const s=a===h?io(e,r,!0):Ie.check.isElement(a.previousSibling)?a.previousSibling:Ie.check.isEdgePoint(r.startContainer,r.startOffset)?Ie.query.getPreviousDeepestNode(r.startContainer):null;if(n.is(s)){const e=n.get(s);if(e)return t.push(ro()),t.push(wo(a,r,e)),!0}}if(io(e,r,!0))return t.push(ro()),!0;c||d||!i.isEdgeLine(r.startContainer,r.startOffset,"front")||i.isLine(h.previousElementSibling)&&t.push(ho(h.previousElementSibling.attributes)),h=i.getLine(r.startContainer,null);const p=i.getBlock(h,null),g=r.commonAncestorContainer;if(p&&h&&!Ie.check.isTableCell(p)&&!/^FIGCAPTION$/i.test(p.nodeName)){if(Ie.check.isListCell(h)&&Ie.check.isList(p)&&(Ie.check.isListCell(p.parentElement)||h.previousElementSibling)&&(a===h||3===a.nodeType&&(!a.previousSibling||Ie.check.isList(a.previousSibling)))&&(i.getLine(r.startContainer,null)!==i.getLine(r.endContainer,null)?p.contains(r.startContainer):0===r.startOffset&&r.collapsed&&!d)){if(r.startContainer!==r.endContainer)t.push(lo()),t.push($o(r)),t.push(po(!0));else{let e=h.previousElementSibling||p.parentElement;if(Ie.check.isListCell(e)){t.push(lo());let s=e;if(!e.contains(h)&&Ie.check.isListCell(s)&&Ie.check.isList(s.lastElementChild)){for(s=s.lastElementChild.lastElementChild;Ie.check.isListCell(s)&&Ie.check.isList(s.lastElementChild);)s=s.lastElementChild&&s.lastElementChild.lastElementChild;e=s}t.push(xo(e,h,p)),t.push(po(!0))}}return!0}if(!c&&0===r.startOffset&&!d){let e=!0,s=g;for(;s&&s!==p&&!Ie.check.isWysiwygFrame(s);){if(s.previousSibling&&(1===s.previousSibling.nodeType||!Ie.check.isZeroWidth(s.previousSibling.textContent.trim()))){e=!1;break}s=s.parentNode}if(e&&p.parentNode)return t.push(lo()),t.push(mo(p,Ie.check.isListCell(h)?[h]:null,null,!1,!1)),t.push(po(!0)),!0}}if(!c&&h&&Ie.check.isEmptyLine(h)&&n.is(h.previousElementSibling)){const e=n.get(h.previousElementSibling);if(e)return t.push(ro()),t.push(_o(!1,h.firstChild,h,e)),!0}if(!c&&h&&(0===r.startOffset||a===h&&h.childNodes[r.startOffset])){const e=Ie.check.isListCell(h),s=a===h?h.childNodes[r.startOffset]:a,i=(e?s:h).previousSibling,o=e||(3===g.nodeType||Ie.check.isBreak(g))&&!g.previousSibling&&0===r.startOffset;if(s&&(e||!s.previousSibling)&&(g&&n.is(g.previousSibling)||o&&n.is(i))){const o=n.get(i);return o?(t.push(ro()),t.push(_o(e,s,h,o))):n.is(i)&&(t.push(ro()),t.push(fo(i))),!0}if(s&&Ie.check.isNonEditable(s.previousSibling))return t.push(ro()),t.push(fo(s.previousSibling)),!0}if(!c&&i.isBrLine(h)&&Ie.check.isBreak(r.startContainer)&&0===r.startOffset){let e=r.startContainer.previousSibling;if(3===e?.nodeType&&Ie.check.isZeroWidth(e)&&(e=e.previousSibling),Ie.check.isBreak(e))return t.push(ro()),t.push(So(r.startContainer,e)),t.push(po(!0)),!1}const m=h?.previousElementSibling;return!(!c&&h&&i.isNormalLine(h)&&!Ie.check.isListCell(h)&&Ie.check.isEmptyLine(h)&&(i.isNormalLine(m)||i.isBrLine(m)))||(t.push(ro()),t.push(ko(h,m)),t.push(po(!0)),!1)}const{isOSX_IOS:Ko}=Ne;async function Yo(t,e){const s=[];switch(e.keyCode){case"Backspace":if(!1===jo(s,t,e))return s;break;case"Delete":if(!1===function(t,e,s){const{format:i,component:n}=e,{fc:o,range:l,selectionNode:r}=s;let{formatEl:a}=s;const h=!l.collapsed||l.startContainer!==l.endContainer,c=s.options.get("_rtl")&&!h&&l.endOffset>=(l.endContainer.textContent?.length||0)&&oo(l,a,"end",o.get("_wd"));if(t.push(co()),t.push(ao()),h&&so(e))return t.push(ro()),!0;if(!h&&!c&&i.isEdgeLine(l.endContainer,l.endOffset,"end")&&!a.nextSibling)return t.push(ro()),!1;if(i.isLine(a)&&h&&Ie.check.isEdgePoint(l.endContainer,l.endOffset,"end")&&(!l.endContainer.nextSibling||Ie.check.isZeroWidth(l.endContainer.nextSibling))&&i.getLine(l.startContainer)!==i.getLine(l.endContainer)&&(i.isLine(a.nextElementSibling)||Ie.check.isListCell(a)))return t.push(ro()),t.push(bo(l.endContainer,a)),t.push(po(!0)),!1;if(!h&&a&&(l.endOffset===l.endContainer.textContent.length||r===a)){const s=r===a?io(e,l,!1):Ie.check.isElement(r.nextSibling)?r.nextSibling:Ie.check.isEdgePoint(l.endContainer,l.endOffset)?Ie.query.getNextDeepestNode(l.endContainer,null):null;if(n.is(s)){const e=n.get(s);if(e)return t.push(ro()),t.push(Eo(a,e)),!0}}if(io(e,l,!1))return t.push(ro()),!0;if((i.isLine(r)||null===r.nextSibling||Ie.check.isZeroWidth(r.nextSibling)&&null===r.nextSibling.nextSibling)&&l.startOffset===r.textContent.length){const e=a.nextElementSibling;if(!e)return!0;if(n.is(e))return t.push(lo()),t.push(To(a,e)),!0}if(!h&&(Ie.check.isEdgePoint(l.endContainer,l.endOffset)||r===a&&a.childNodes[l.startOffset])){const e=r===a&&a.childNodes[l.startOffset]||r;if(e&&Ie.check.isNonEditable(e.nextSibling))return t.push(ro()),t.push(fo(e.nextSibling)),!0;if(n.is(e))return t.push(ro()),t.push(fo(e)),!0}h||c||!i.isEdgeLine(l.endContainer,l.endOffset,"end")||i.isLine(a.nextElementSibling)&&t.push(ho(a.attributes)),a=i.getLine(l.startContainer,null);const d=i.getBlock(a,null);if(Ie.check.isListCell(a)&&Ie.check.isList(d)&&(r===a||3===r.nodeType&&(!r.nextSibling||Ie.check.isList(r.nextSibling))&&(i.getLine(l.startContainer,null)!==i.getLine(l.endContainer,null)?d.contains(l.endContainer):l.endOffset===r.textContent.length&&l.collapsed&&!c)))return t.push(Mo(l,a,d)),!0;if(!h&&i.isBrLine(a)&&Ie.check.isBreak(l.startContainer)&&0===l.startOffset){let e=l.startContainer.previousSibling;if(3===e?.nodeType&&Ie.check.isZeroWidth(e)&&(e=e.previousSibling),Ie.check.isBreak(e))return t.push(ro()),t.push(Lo(l.startContainer)),t.push(po(!0)),!1}const u=a?.nextElementSibling;return!(!h&&a&&i.isNormalLine(a)&&!Ie.check.isListCell(a)&&Ie.check.isEmptyLine(a)&&(i.isNormalLine(u)||i.isBrLine(u))&&(t.push(ro()),t.push(Ho(a,u)),t.push(po(!0)),1))}(s,t,e))return s;break;case"Tab":if(!1===function(t,e,s){const{options:i,selectionNode:n,range:o,formatEl:l,ctrl:r,alt:a,shift:h}=s;return!!i.get("tabDisable")||(t.push(lo()),r||a||Ie.check.isWysiwygFrame(n)||(t.push(No(o,l,h)),t.push(po(!1))),!0)}(s,0,e))return s}const{fc:i,keyCode:n,shift:o,alt:l,ctrl:r,range:a}=e;if(o&&(Ko?l:r)&&Oe.isSpace(n))return s.push(ro()),s.push(Uo()),s;const h=!a.collapsed||a.startContainer!==a.endContainer;return r||l||h||Oe.isNonTextKey(n)||!Ie.check.isBreak(a.commonAncestorContainer)?!i.has("documentType_use_header")||!h||r||l||o||Oe.isDirectionKey(n)?(function(t,e,s){const{component:i}=e,{formatEl:n,range:o,selectionNode:l,keyCode:r}=s,a=s.options.get("_rtl"),h="ArrowLeft"===r?a?"forward":"back":"ArrowRight"===r?a?"back":"forward":null;let c=null;switch(r){case"ArrowUp":i.is(n.previousElementSibling)&&(c=i.get(n.previousElementSibling));break;case"ArrowLeft":case"ArrowRight":if("forward"===h){if(Ie.check.isEdgePoint(l,o.endOffset,"end")){const t=l.nextElementSibling||Ie.query.getNextDeepestNode(l);t?i.is(t)&&(c=i.get(t)):i.is(n.nextElementSibling)&&(c=i.get(n.nextElementSibling))}}else if("back"===h&&Ie.check.isEdgePoint(l,o.startOffset,"front")){const t=l.previousElementSibling||Ie.query.getPreviousDeepestNode(l);t?i.is(t)&&(c=i.get(t)):i.is(n.previousElementSibling)&&(c=i.get(n.previousElementSibling))}break;case"ArrowDown":i.is(n.nextElementSibling)&&(c=i.get(n.nextElementSibling))}c&&!c.options?.isInputComponent&&(t.push(lo()),t.push(vo(c)))}(s,t,e),s):(s.push(go()),s):(s.push(Zo()),s)}const Xo={value:[]};async function Jo(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;if("insertParagraph"===e.inputType||"insertLineBreak"===e.inputType)return void await Qo.call(this,t,e);const s=(null===e.data?"":void 0===e.data?" ":e.data)||"";if(Oe.isComposing(e))this._handledInBefore=!1;else{if(!this.$.char.test(s,!1))return e.preventDefault(),e.stopPropagation(),!1;this._handledInBefore=!0}!1!==await this.$.eventManager.triggerEvent("onBeforeInput",{frameContext:t,event:e,data:s})&&await this._callPluginEventAsync("onBeforeInput",{frameContext:t,event:e,data:s})}async function Qo(t,e){if(e.isComposing||this.isComposing)return;if(this.$.ui.selectMenuOn)return;let s=this.$.selection.getNode();if(Ie.check.isInputElement(s))return;if(this.$.menu.currentDropdownName)return;Ie.check.isWysiwygFrame(s)&&(this._setDefaultLine(this.$.options.get("defaultLine")),s=this.$.selection.getNode());const i=this._normalizeEnterRange();i&&(s=i);const n=this.$.selection.getRange(),o=this.$.format.getLine(s,null)||s,l="insertLineBreak"===e.inputType,r={e,fc:t,store:this.$.store,options:this.$.options,frameOptions:this.$.frameOptions,range:n,selectionNode:s,formatEl:o,keyCode:"Enter",ctrl:!1,alt:!1,shift:l},a=eo(this,{_styleNodes:Xo}),h=[];Go(h,a,r),h.some((t=>"event.prevent"===t.t||"event.prevent.stop"===t.t))&&e.preventDefault(),await to(h,{ports:a,ctx:r})}async function tl(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;const s=this.$.selection.getRange(),i=this.$.selection.getNode(),n=this.$.format.getLine(i,null);if(!this.$.format.isNormalLine(n)&&!this.$.format.isBrLine(n)&&s.collapsed&&!this.$.component.is(i)&&!Ie.check.isList(i)){const t=this.$.format.getBlock(i,null);this._setDefaultLine(this.$.format.isBlock(t)?"DIV":this.$.options.get("defaultLine"))}this.$.selection.init();const o=(null===e.data?"":void 0===e.data?" ":e.data)||"";if(!this._handledInBefore&&!this.$.char.test(o,!0))return e.preventDefault(),e.stopPropagation(),!1;this._handledInBefore=!1,!1!==await this.$.eventManager.triggerEvent("onInput",{frameContext:t,event:e,data:o})&&(await this._callPluginEventAsync("onInput",{frameContext:t,event:e,data:o}),this.$.history.push(!0))}const{_w:el}=Ne,sl=new RegExp(Ae.zeroWidthSpace+"+",""),il={ctrl:!1,alt:!1},nl=Object.preventExtensions({value:[]});async function ol(t,e){if(this.isComposing=Oe.isComposing(e))return!0;if(this.$.ui.selectMenuOn||!e.isTrusted)return;let s=this.$.selection.getNode();if(Ie.check.isInputElement(s))return;if(this.$.menu.currentDropdownName)return;const i=e.code,n=Oe.isShift(e),o=il.ctrl=Oe.isCtrl(e),l=il.alt=Oe.isAlt(e);if(!o&&t.get("isReadOnly")&&!Oe.isDirectionKey(i))return e.preventDefault(),!1;this.$.menu.dropdownOff(),this.$.store.mode.isBalloon?this.$.store.mode.isBalloonAlways||this._hideToolbar():this.$.store.mode.isSubBalloon&&(this.$.store.mode.isSubBalloonAlways||this._hideToolbar_sub());const r=this.$.selection.getRange(),a=this.$.format.getLine(s,null)||s;if(o&&!Oe.isNonTextKey(i)&&this.$.shortcuts.command(e,o,n,i,"",!1,null,null))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1;if(!o&&!Oe.isNonTextKey(i)&&this.$.format.isLine(a)&&r.collapsed&&Ie.check.isEdgePoint(r.startContainer,0,"front")){const t=r.startContainer.substringData?.(0,r.startOffset);if(t&&this.$.shortcuts.command(e,!1,n,i,t,!0,a,r))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1}else this._onShortcutKey&&(this._onShortcutKey=!1);const h={e,fc:t,store:this.$.store,options:this.$.options,frameOptions:this.$.frameOptions,range:r,selectionNode:s,formatEl:a,keyCode:i,ctrl:o,alt:l,shift:n},c=eo(this,{_styleNodes:nl}),d=await Yo(c,h);!1!==await this.$.eventManager.triggerEvent("onKeyDown",{frameContext:t,event:e})&&!1!==await this._callPluginEventAsync("onKeyDown",{frameContext:t,event:e,range:r,line:a})&&await to(d,{ports:c,ctx:h})}async function ll(t,e){if(this._onShortcutKey||this.$.menu.currentDropdownName)return;const s=e.code,i=Oe.isCtrl(e),n=Oe.isAlt(e);if(i&&(il.ctrl=!1),n&&(il.alt=!1),t.get("isReadOnly"))return;const o=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)&&!Oe.isEsc(s)||!o.collapsed)){if(!this.$.store.mode.isBalloonAlways&&!this.$.store.mode.isSubBalloonAlways)return void(this.$.store.mode.isSubBalloon?this.$.subToolbar._showBalloon():this.$.toolbar._showBalloon());Oe.isEsc(s)||this._showToolbarBalloonDelay()}if(Oe.isBackspace(s)&&Ie.check.isWysiwygFrame(l)&&""===l.textContent&&0===l.children.length){e.preventDefault(),e.stopPropagation(),l.innerHTML="";const i=this.$.store.get("currentNodes")[0],n=Ie.utils.createElement(this.$.format.isLine(i)&&!Ie.check.isListCell(i)?i:this.$.options.get("defaultLine"),null,"<br>");return l.appendChild(n),this.$.selection.setRange(n,0,n,0),this.applyTagEffect(),this.$.history.push(!1),void(t.has("documentType_use_header")&&Oe.isDocumentTypeObserverKey(s)&&t.get("documentType").reHeader())}const r=this.$.format.getLine(l,null),a=this.$.format.getBlock(l,null),h=this._formatAttrsTemp;if(r&&h){for(let t=0,e=h.length;t<e;t++)Oe.isEnter(s)&&/^id$/i.test(h[t].name)?r.removeAttribute("id"):r.setAttribute(h[t].name,h[t].value);this._formatAttrsTemp=null}this.$.format.isNormalLine(r)||this.$.format.isBrLine(r)||!o.collapsed||this.$.component.is(l)||Ie.check.isList(l)||null===this._setDefaultLine(this.$.format.isBlock(a)?"DIV":this.$.options.get("defaultLine"))||(l=this.$.selection.getNode());if(!il.ctrl&&!il.alt&&!Oe.isNonTextKey(s)&&3===l.nodeType&&Ae.zeroWidthRegExp.test(l.textContent)&&!(void 0!==e.isComposing?e.isComposing:this.isComposing)){let t=o.startOffset,e=o.endOffset;const s=(l.textContent.substring(0,e).match(sl)||"").length;t=o.startOffset-s,e=o.endOffset-s,l.textContent=l.textContent.replace(Ae.zeroWidthRegExp,""),this.$.selection.setRange(l,t<0?0:t,l,e<0?0:e)}if(Oe.isRemoveKey(s)&&Ie.check.isZeroWidth(r?.textContent)&&!r.previousElementSibling&&!Ie.check.isListCell(r)){const t=this.$.options.get("retainStyleMode");"none"!==t&&nl.value?.length>0?"repeat"===t?this.__retainTimer?(this.__retainTimer=el.clearTimeout(this.__retainTimer),this._clearRetainStyleNodes(r)):(this.__retainTimer=el.setTimeout((()=>{this.__retainTimer=null}),0),this._retainStyleNodes(r,nl.value)):(this.__retainTimer=null,this._retainStyleNodes(r,nl.value)):this._clearRetainStyleNodes(r)}if(t.has("documentType_use_header"))if(Oe.isDocumentTypeObserverKey(s)){t.get("documentType").reHeader();const e=Ie.query.getParentElement(this.$.selection.selectionNode,this.$.format.isLine.bind(this.$.format));t.get("documentType").on(e)}else{const e=Ie.query.getParentElement(l,(t=>1===t.nodeType));t.get("documentType").onChangeText(e)}!1!==await this.$.eventManager.triggerEvent("onKeyUp",{frameContext:t,event:e})&&!1!==await this._callPluginEventAsync("onKeyUp",{frameContext:t,event:e,range:o,line:r})&&Oe.isHistoryRelevantKey(s)&&this.$.history.push(!0)}const{_w:rl}=Ne;function al(t,e){const s=e.clipboardData;return!s||this._dataTransferAction("paste",e,s,t)}async function hl(t,e){const s=e.clipboardData;if(!1===await this.$.eventManager.triggerEvent("onCopy",{frameContext:t,event:e,clipboardData:s}))return e.preventDefault(),e.stopPropagation(),!1;const i=t.get("_ww").getSelection();this.__secopy=i.toString()}async function cl(t,e){const s=e.clipboardData;if(!1===await this.$.eventManager.triggerEvent("onCut",{frameContext:t,event:e,clipboardData:s}))return e.preventDefault(),e.stopPropagation(),!1;const i=t.get("_ww").getSelection();this.__secopy=i.toString(),rl.setTimeout((()=>{this.$.history.push(!1)}),0)}const{_w:dl}=Ne;function ul(t,e,s,i,n){if(n.dataTransfer&&Array.from(n.dataTransfer.types||[]).includes("application/x-suneditor-block-drag"))return;const{sc:o,so:l,ec:r,eo:a}=this.$.selection.getDragEventLocationRange(n);if(!o)return;n.preventDefault();const h=t.get("_wd").createRange();h.setStart(o,l),h.setEnd(r,a);const c={y:0,x:0};if(s){const t=this.$.offset.getGlobal(s),e=i?this.$.context.get("toolbar_main").offsetHeight:0;c.y=t.top+e-dl.scrollY,c.x=t.left-dl.scrollX}const d=h.getBoundingClientRect();if(d.height>0){const s=t.get("wysiwygFrame");let i=0,n=0;/^iframe$/i.test(s.nodeName)&&(i=s.offsetLeft,n=s.offsetTop),e.style.left=`${d.right+dl.scrollX+c.x+i}px`,e.style.top=`${d.top+dl.scrollY+c.y-5+n}px`,e.style.height=`${d.height+10}px`,e.style.display="block";try{e.showPopover?.()}catch{}}else{try{e.hidePopover?.()}catch{}e.style.display="none"}}function pl(t){try{t.hidePopover?.()}catch{}t.style.display="none"}function gl(t,e,s){try{if(t.get("isReadOnly"))return s.preventDefault(),s.stopPropagation(),!1;const e=s.dataTransfer;if(!e)return!0;if(Array.from(e.types||[]).includes("application/x-suneditor-block-drag"))return;const{sc:i,so:n,ec:o,eo:l}=this.$.selection.getDragEventLocationRange(s);if(!i)return;if(Ie.query.getParentElement(i,".se-disable-pointer"))return void s.preventDefault();if(fi.get("__dragContainer")){if(s.preventDefault(),fi.get("__dragContainer").contains(s.target))return void this.$.component.deselect();const e=fi.get("__dragContainer");return this.$.component.deselect(),this.$.selection.setRange(i,n,o,l),this.$.html.insertNode(e,{afterNode:null,skipCharCount:!0}),void(t.has("documentType_use_page")&&(t.get("documentTypePageMirror").innerHTML=t.get("wysiwyg").innerHTML,t.get("documentType").rePage(!0)))}return this.$.html.remove(),this.$.selection.setRange(i,n,o,l),this._dataTransferAction("drop",s,e,t)}finally{try{e.hidePopover?.()}catch{}e.style.display="none"}}class ml{#J;constructor({$:t}){this.#J=t}execute(t){if(!this.#J.options.get("__lineFormatFilter"))return null;if(this.#J.pluginManager.fileInfo.pluginRegExp.test(this.#J.ui.currentControllerName))return;const e=this.#J.selection.getRange(),s=e.commonAncestorContainer,i=e.startContainer,n=e.endOffset,o=this.#J.format.getBlock(s,null);let l,r,a;if(o)return a=Ie.utils.createElement(t||this.#J.options.get("defaultLine")),a.innerHTML=o.innerHTML,0===a.childNodes.length&&(a.innerHTML=Ae.zeroWidthSpace),o.innerHTML=a.outerHTML,a=o.firstChild,l=a.childNodes[n]||Ie.query.getEdgeChildNodes(a,null).sc,l||(l=Ie.utils.createTextNode(Ae.zeroWidthSpace),a.insertBefore(l,a.firstChild)),r=l.textContent.length,void this.#J.selection.setRange(l,r,l,r);if(3===s.nodeType&&this.#J.component.is(s.parentElement)){const t=this.#J.component.get(s.parentElement);if(!t)return;const e=t.container;if(s.parentElement===e){const t=s.nextElementSibling?e:e.nextElementSibling,i=Ie.utils.createElement(this.#J.options.get("defaultLine"),null,s);return e.parentElement.insertBefore(i,t),void this.#J.focusManager.focusEdge(i)}return this.#J.component.select(t.target,t.pluginName),null}if(1===s.nodeType&&"true"===s.getAttribute("data-se-embed")){let t=s.nextElementSibling;return this.#J.format.isLine(t)||(t=this.#J.format.addLine(s,this.#J.options.get("defaultLine"))),void this.#J.selection.setRange(t.firstChild,0,t.firstChild,0)}if(!this.#J.format.isBlock(i)&&!Ie.check.isWysiwygFrame(i)||!this.#J.component.is(i.children[e.startOffset])&&!this.#J.component.is(i.children[e.startOffset-1])){if(Ie.query.getParentElement(s,Ie.check.isExcludeFormat))return null;if(this.#J.format.isBlock(s)&&s.childNodes.length<=1){let t=null;return 1===s.childNodes.length&&Ie.check.isBreak(s.firstChild)?t=s.firstChild:(t=Ie.utils.createTextNode(Ae.zeroWidthSpace),s.appendChild(t)),void this.#J.selection.setRange(t,1,t,1)}try{if(3===s.nodeType&&(a=Ie.utils.createElement(t||this.#J.options.get("defaultLine")),s.parentNode.insertBefore(a,s),a.appendChild(s)),Ie.check.isBreak(a.nextSibling)&&Ie.utils.removeItem(a.nextSibling),Ie.check.isBreak(a.previousSibling)&&Ie.utils.removeItem(a.previousSibling),Ie.check.isBreak(l)){const t=Ie.utils.createTextNode(Ae.zeroWidthSpace);l.parentNode.insertBefore(t,l),l=t}}catch{return this.#J.frameContext.get("_wd").execCommand("formatBlock",!1,`<${t||this.#J.options.get("defaultLine")}>`),this.#J.store.set("_lastSelectionNode",null),void this.#J.selection.init()}if(a&&(Ie.check.isBreak(a.nextSibling)&&Ie.utils.removeItem(a.nextSibling),Ie.check.isBreak(a.previousSibling)&&Ie.utils.removeItem(a.previousSibling),Ie.check.isBreak(l))){const t=Ie.utils.createTextNode(Ae.zeroWidthSpace);l.parentNode.insertBefore(t,l),l=t}this.#J.store.set("_lastSelectionNode",null),i?this.#J.selection.setRange(i,1,i,1):this.#J.focusManager.nativeFocus()}}}class fl{#Or;#J;#Rr;constructor(t){this.#Or=t,this.#J=t.$,this.#Rr=new RegExp(`^(${Object.keys(this.#J.options.get("_defaultStyleTagMap")).join("|")})$`,"i")}update(t){if(t||=this.#J.selection.getNode(),t===this.#J.store.get("_lastSelectionNode"))return;this.#J.store.set("_lastSelectionNode",t);const e=this.#J.options.get("_rtl")?"marginRight":"marginLeft",s=this.#J.plugins,i=this.#J.commandDispatcher.targets,n=this.#Rr,o=this.#J.options.get("_styleCommandMap"),l=[],r=[],a=this.#J.options.get("_textStyleTags"),h=[],c=[],d=this.#J.commandDispatcher.activeCommands,u=d.length;let p="";if(this.#J.component.is(t)&&!this.#J.component.__selectionSelected){const e=this.#J.component.get(t);if(!e)return;return this.#J.store.set("_lastSelectionNode",null),void this.#J.component.select(e.target,e.pluginName)}for(;t.firstChild;)t=t.firstChild;const g=this.#J.frameContext,m=!g.get("isReadOnly");for(let g=t;!Ie.check.isWysiwygFrame(g)&&g;g=g.parentElement)if(1===g.nodeType&&!Ie.check.isBreak(g)){if(this.#Pr(g))return void this.#J.focusManager.blur();if(p=g.nodeName.toLowerCase(),r.push(p),a.includes(p)&&!this.#J.format.isLine(p)&&h.push(g),m)for(let t,e=0;e<u;e++)t=d[e],!l.includes(t)&&!c.includes(t)&&i.get(t)&&i.get(t).filter((e=>{const i=s[t]?.active(g,e);return void 0===i&&c.push(t),i})).length>0&&l.push(t);if(this.#J.format.isLine(g)){if(!l.includes("outdent")&&i.has("outdent")&&(Ie.check.isListCell(g)||g.style[e]&&Ve.get(g.style[e],0)>0)&&i.get("outdent").filter((t=>!Ie.check.isImportantDisabled(t)&&(t.disabled=!1,!0))).length>0&&l.push("outdent"),!l.includes("indent")&&i.has("indent")){const t=Ie.check.isListCell(g)&&!g.previousElementSibling;i.get("indent").filter((e=>!Ie.check.isImportantDisabled(e)&&(e.disabled=t,!0))).length>0&&l.push("indent")}}else n.test(p)&&(p=o[p]||p,l.push(p),Ie.utils.addClass(i.get(p),"active"))}return this.#zr(l),this.#Or.__cacheStyleNodes=h.reverse(),this.#J.store.set("currentNodes",r.reverse()),this.#J.store.set("currentNodesMap",l),this.#J.frameOptions.get("statusbar_showPathLabel")&&g.get("navigation")&&(g.get("navigation").textContent=this.#J.options.get("_rtl")?this.#J.store.get("currentNodes").reverse().join(" < "):this.#J.store.get("currentNodes").join(" > ")),t}reset(){this.#zr([])}#zr(t){const e=this.#J.commandDispatcher.activeCommands,s=this.#J.commandDispatcher.targets,i=this.#J.plugins;for(let n,o,l,r=0,a=e.length;r<a;r++)if(n=e[r],!t.includes(n)&&(o=s.get(n))){l=i[n];for(let t,e=0,s=o.length;e<s;e++)t=o[e],t&&(l?l.active(null,t):/^outdent$/i.test(n)?Ie.check.isImportantDisabled(t)||(t.disabled=!0):/^indent$/i.test(n)?Ie.check.isImportantDisabled(t)||(t.disabled=!1):Ie.utils.removeClass(t,"active"))}}#Pr(t){return Ie.check.isElement(t)&&"true"===t.getAttribute("data-se-non-focus")}}const{_w:vl,isMobile:bl,isTouchDevice:yl}=Ne;function Cl(t){if("Tab"!==t.key)return;t.preventDefault();const e=t.target,s=e.selectionStart,i=e.selectionEnd;e.value=e.value.substring(0,s)+"\t"+e.value.substring(i),e.selectionStart=e.selectionEnd=s+1}const wl=class extends On{#t;#gi;#e;#ot;#mi;#o;#Fr;#Dr;#qr=null;#Wr=null;#Ur=null;#Zr=null;constructor(t){super(t),this.#t=this.$.store,this.#gi=this.$.contextProvider,this.#e=this.$.context,this.#ot=this.$.options,this.#mi=this.$.eventManager,this.#o=this.$.toolbar,this.#Fr=this.$.ui,this.#Dr=this.$.menu,this.isComposing=!1,this.scrollparents=[],this.defaultLineManager=new ml(this),this.selectionState=new fl(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}applyTagEffect(t){return this.selectionState.update(t)}_showToolbarBalloonDelay(){this.#qr&&vl.clearTimeout(this.#qr),this.#qr=vl.setTimeout((()=>{vl.clearTimeout(this.#qr),this.#qr=null,this.#t.mode.isSubBalloon?this.$.subToolbar._showBalloon():this.#o._showBalloon()}),250)}#Gr(){this.#qr&&vl.clearTimeout(this.#qr),this.#qr=vl.setTimeout((()=>{vl.clearTimeout(this.#qr),this.#qr=null,this._toggleToolbarBalloon()}),250)}_toggleToolbarBalloon(){this.$.selection.init();const t=this.$.selection.getRange(),e=this.#ot.has("_subMode");!(e?this.#t.mode.isSubBalloonAlways:this.#t.mode.isBalloonAlways)&&t.collapsed?e?this._hideToolbar_sub():this._hideToolbar():e?this.$.subToolbar._showBalloon(t):this.#o._showBalloon(t)}_hideToolbar(){this.#Fr.isPreventToolbarHide||this.$.frameContext.get("isFullScreen")||this.#o.hide()}_hideToolbar_sub(){this.$.subToolbar&&!this.#Fr.isPreventToolbarHide&&this.$.subToolbar.hide()}_setDefaultLine(t){return this.defaultLineManager.execute(t)}_normalizeEnterRange(){if(!this.$.format.isLine(this.$.selection.getRange()?.startContainer))return null;this.$.selection.resetRangeToTextNode();const t=this.$.selection.getRange();if(t.startContainer===t.endContainer&&t.startOffset!==t.endOffset&&3===t.startContainer.nodeType&&Ie.check.isZeroWidth(t.startContainer)){const e=t.startContainer.nextSibling;e&&Ie.check.isBreak(e)?this.$.selection.setRange(e,0,e,0):this.$.selection.setRange(t.endContainer,t.endOffset,t.endContainer,t.endOffset)}return this.$.selection.getNode()}async _dataTransferAction(t,e,s,i){try{return this.#Fr.showLoading(),await this.#jr(t,e,s,i),e.preventDefault(),e.stopPropagation(),!1}catch(t){console.warn("[SUNEDITOR.paste.error]",t)}finally{this.#Fr.hideLoading()}}async#jr(t,e,s,i){e.preventDefault(),e.stopPropagation();let n=s.getData("text/plain"),o=s.getData("text/html");const l=!o,r=this.__secopy===n,a=/class=["']*Mso(Normal|List)/i.test(o)||/content=["']*Word.Document/i.test(o)||/content=["']*OneNote.File/i.test(o)||/content=["']*Excel.Sheet/i.test(o),h=r?"SE":a?"MS":"";if(l?o=Be.htmlToEntity(n).replace(/\n/g,"<br>"):(o=o.replace(/^<html>\r?\n?<body>\r?\n?\x3C!--StartFragment-->|\x3C!--EndFragment-->\r?\n?<\/body>\r?\n?<\/html>$/g,""),a&&(o=o.replace(/\n/g," "),n=n.replace(/\n/g," "),o=ze.cleanHTML(o))),!r){if(this.#ot.get("autoLinkify")){const t=(new DOMParser).parseFromString(o,"text/html");Ie.query.getListChildNodes(t.body,Be.textToAnchor,null),o=t.body.innerHTML}}l||(o=this.$.html.clean(o,{forceFormat:!1,whitelist:null,blacklist:null}));const c=this.$.char.test("byte-html"===this.$.frameOptions.get("charCounter_type")?o:n,!1);if("paste"===t){const t=await this.#mi.triggerEvent("onPaste",{frameContext:i,event:e,data:o,maxCharCount:c,from:h});if(!1===t)return!1;if("string"==typeof t){if(!t)return!1;o=t}}if("drop"===t){const t=await this.#mi.triggerEvent("onDrop",{frameContext:i,event:e,data:o,maxCharCount:c,from:h});if(!1===t)return!1;if("string"==typeof t){if(!t)return!1;o=t}}const d=s.files;if(d.length>0&&!a){for(let t=0,s=d.length;t<s;t++)await this._callPluginEventAsync("onFilePasteAndDrop",{frameContext:i,event:e,file:d[t]});return!1}if(!c)return!1;if(o){const t=(new DOMParser).parseFromString(o,"text/html");return!1!==await this._callPluginEventAsync("onPaste",{frameContext:i,event:e,data:o,doc:t})&&this.$.html.insert(o,{selectInserted:!1,skipCharCount:!0,skipCleaning:!0}),i.has("documentType_use_header")&&i.get("documentType").reHeader(),!1}}_addCommonEvents(){const t=zn.bind(this),e=Dn.bind(this);this.#mi.addEvent(this.#e.get("menuTray"),"mousedown",t,!1),this.#mi.addEvent(this.#e.get("menuTray"),"click",Fn.bind(this),!0),this.#mi.addEvent(this.#e.get("toolbar_main"),"mousedown",t,!1),this.#mi.addEvent(this.#e.get("toolbar_main"),"click",e,!1),this.#ot.has("_subMode")&&(this.#mi.addEvent(this.#e.get("toolbar_sub_main"),"mousedown",t,!1),this.#mi.addEvent(this.#e.get("toolbar_sub_main"),"click",e,!1)),this.#o._setResponsive(),Ne.isResizeObserverSupported&&(this._toolbarObserver=new ResizeObserver((()=>{vl.setTimeout((()=>{this.#o.resetResponsiveToolbar()}),0)})),this._wwFrameObserver=new ResizeObserver((t=>{vl.setTimeout((()=>{t.forEach((t=>{this.#Fr._emitResizeEvent(this.$.frameRoots.get(t.target.getAttribute("data-root-key")),-1,t)})),this.#t.mode.isInline&&this.#t.mode.isBottom&&this.#o._resetSticky()}),0)}))),this.#ot.get("closeModalOutsideClick")&&this.#mi.addEvent(this.#gi.carrierWrapper.querySelector(".se-modal .se-modal-inner"),"click",(t=>{t.target===this.#gi.carrierWrapper.querySelector(".se-modal .se-modal-inner")&&this.#Fr.offCurrentModal()}),!1),this.#mi.addEvent(vl,"resize",this.#Kr.bind(this),!1),this.#mi.addEvent(vl.visualViewport,"resize",this.#Yr.bind(this),!1),this.#mi.addEvent(vl,"scroll",this.#Xr.bind(this),!1),yl&&this.#mi.addEvent(vl.visualViewport,"scroll",this.#Jr.bind(this),!1)}_addFrameEvents(t){const e=t.get("options").get("iframe"),s=e?t.get("_ww"):t.get("wysiwyg");t.set("eventWysiwyg",s);const i=t.get("code"),n=this.#gi.carrierWrapper.querySelector(".se-drag-cursor"),o=Kn.bind(this,t);this.#mi.addEvent(s,"mousemove",o,!1),this.#mi.addEvent(s,"mouseleave",Yn.bind(this,t),!1),this.#mi.addEvent(s,"mousedown",Un.bind(this,t),!1),this.#mi.addEvent(s,"mouseup",Gn.bind(this,t),!1),this.#mi.addEvent(s,"click",jn.bind(this,t),!1),this.#mi.addEvent(s,"beforeinput",Jo.bind(this,t),!1),this.#mi.addEvent(s,"input",tl.bind(this,t),!1),this.#mi.addEvent(s,"keydown",ol.bind(this,t),!1),this.#mi.addEvent(s,"keyup",ll.bind(this,t),!1),this.#mi.addEvent(s,"paste",al.bind(this,t),!1),this.#mi.addEvent(s,"copy",hl.bind(this,t),!1),this.#mi.addEvent(s,"cut",cl.bind(this,t),!1),this.#mi.addEvent(s,"dragover",ul.bind(this,t,n,e?this.$.frameContext.get("topArea"):null,!this.#ot.get("toolbar_container")&&!this.#t.mode.isBalloon&&!this.#t.mode.isInline),!1),this.#mi.addEvent(s,"dragend",pl.bind(this,n),!1),this.#mi.addEvent(s,"drop",gl.bind(this,t,n),!1),this.#mi.addEvent(s,"scroll",this.#Qr.bind(this,t,s),{passive:!0,capture:!1}),this.#mi.addEvent(s,"focus",this.#ta.bind(this,t),!1),this.#mi.addEvent(s,"blur",this.#ea.bind(this,t),!1),this.#mi.addEvent(i,"mousedown",this.#sa.bind(this,t),!1);const l=t.get("wrapper").querySelector(".se-drag-handle");if(this.#mi.addEvent(l,"wheel",(t=>{t.preventDefault(),this.$.component.deselect()}),!1),this.#mi.addEvent(t.get("lineBreaker_t"),"pointerdown",this.#ia.bind(this,"t"),!1),this.#mi.addEvent(t.get("lineBreaker_b"),"pointerdown",this.#ia.bind(this,"b"),!1),yl&&this.#mi.addEvent(s,"touchstart",o,{passive:!0,capture:!1}),!this.#ot.get("hasCodeMirror")){const e=t.get("codeNumbers"),s=this.$.viewer._codeViewAutoHeight.bind(this.$.viewer,t.get("code"),e,"auto"===this.$.frameOptions.get("height"));this.#mi.addEvent(i,"keydown",s,!1),this.#mi.addEvent(i,"keyup",s,!1),this.#mi.addEvent(i,"paste",s,!1),this.#ot.get("tabDisable")||this.#mi.addEvent(i,"keydown",Cl,!1),e&&this.#mi.addEvent(i,"scroll",this.$.viewer._scrollLineNumbers.bind(i,e),!1)}const r=t.get("markdown");if(r){this.#mi.addEvent(r,"mousedown",this.#na.bind(this,t),!1);const e=t.get("markdownNumbers"),s=this.$.viewer._markdownViewAutoHeight.bind(this.$.viewer,r,e,"auto"===this.$.frameOptions.get("height"));this.#mi.addEvent(r,"keydown",s,!1),this.#mi.addEvent(r,"keyup",s,!1),this.#mi.addEvent(r,"paste",s,!1),this.#ot.get("tabDisable")||this.#mi.addEvent(r,"keydown",Cl,!1),e&&this.#mi.addEvent(r,"scroll",this.$.viewer._scrollMarkdownLineNumbers.bind(r,e),!1)}t.has("statusbar")&&this.__addStatusbarEvent(t,t.get("options"));const a=this.#oa.bind(this),h=Ie.query.getScrollParents(t.get("originElement"));for(const t of h)this.scrollparents.push(t),this.#mi.addEvent(t,"scroll",a,!1);this.__eventDoc!==t.get("_wd")&&(this.__eventDoc=t.get("_wd"),this.#mi.addEvent(this.__eventDoc,"selectionchange",this.#la.bind(this,this.__eventDoc),!1))}__addStatusbarEvent(t,e){/\d+/.test(e.get("height"))&&e.get("statusbar_resizeEnable")?e.set("__statusbarEvent",this.#mi.addEvent(t.get("statusbar"),"mousedown",this.#ra.bind(this),!1)):Ie.utils.addClass(t.get("statusbar"),"se-resizing-none")}_removeAllEvents(){this.#mi._init(),this._wwFrameObserver&&(this._wwFrameObserver.disconnect(),this._wwFrameObserver=null),this._toolbarObserver&&(this._toolbarObserver.disconnect(),this._toolbarObserver=null),this.#qr&&(vl.clearTimeout(this.#qr),this.#qr=null),this.__retainTimer&&(vl.clearTimeout(this.__retainTimer),this.__retainTimer=null),this.#Ur&&=this.#mi.removeGlobalEvent(this.#Ur),this.#Zr&&=this.#mi.removeGlobalEvent(this.#Zr),this.#Wr&&=this.#mi.removeGlobalEvent(this.#Wr),this._formatAttrsTemp=null,this.__cacheStyleNodes=null,this.__inputPlugin=null,this.__inputBlurEvent=null,this.__inputKeyEvent=null,this.__eventDoc=null,this.__secopy=null,this._lineBreakComp=null,this.scrollparents=null}_setSelectionSync(){this.#mi.removeGlobalEvent(this.#Ur),this.#Ur=this.#mi.addGlobalEvent("mouseup",(()=>{this.$.selection.init(),this.#mi.removeGlobalEvent(this.#Ur)}))}_retainStyleNodes(t,e){let s=e[0].cloneNode(!1);for(let t,i=1,n=e.length;i<n;i++)t=e[i].cloneNode(!1),s.appendChild(t),s=t;const{parent:i,inner:n}=this.$.nodeTransform.createNestedNode(e,null),o=Ie.utils.createTextNode(Ae.zeroWidthSpace);n.appendChild(o),t.innerHTML="",t.appendChild(i),this.$.selection.setRange(o,1,o,1)}_clearRetainStyleNodes(t){t.innerHTML="<br>",this.$.selection.setRange(t,0,t,0)}_callPluginEvent(t,e){return this.$.pluginManager.emitEvent(t,e)}async _callPluginEventAsync(t,e){return await this.$.pluginManager.emitEventAsync(t,e)}__removeInput(){this.#t.set("_preventBlur",!1),this._inputFocus=!1,this.__inputBlurEvent=this.#mi.removeEvent(this.__inputBlurEvent),this.__inputKeyEvent=this.#mi.removeEvent(this.__inputKeyEvent),this.__inputPlugin=null}__postFocusEvent(t,e){(this.#t.mode.isInline||this.#t.mode.isBalloonAlways)&&this.#o.show(),this.#t.mode.isSubBalloonAlways&&this.$.subToolbar.show(),this.#o._resetSticky(),this.#Fr._updatePlaceholder(t),this.#mi.triggerEvent("onFocus",{frameContext:t,event:e}),this._callPluginEvent("onFocus",{frameContext:t,event:e})}__postBlurEvent(t,e){this.#t.mode.isInline?vl.setTimeout((()=>{this.#t.get("hasFocus")||this._hideToolbar()}),0):this.#t.mode.isBalloon&&this._hideToolbar(),this.#t.mode.isSubBalloon&&this._hideToolbar_sub(),this.#mi.triggerEvent("onBlur",{frameContext:t,event:e}),this._callPluginEvent("onBlur",{frameContext:t,event:e})}__setViewportSize(){this.#t.set("currentViewportHeight",Ve.get(vl.visualViewport.height,0))}#aa(){this.#Dr.currentDropdownActiveButton&&this.#Dr.currentDropdown&&this.#Dr.__resetMenuPosition(this.#Dr.currentDropdownActiveButton,this.#Dr.currentDropdown),this.#Fr._repositionControllers()}#ha(){Ne.isResizeObserverSupported||(this.#o.resetResponsiveToolbar(),this.#ot.get("_subMode")&&this.$.subToolbar.resetResponsiveToolbar());const t=this.#e.get("toolbar_main"),e="none"===t.style.display||this.#t.mode.isInline&&!this.#o.inlineToolbarAttr.isShow;if(0===t.offsetWidth&&!e)return;const s=this.#Fr.opendBrowser;if(s&&"block"===s.area.style.display&&(s.body.style.maxHeight=Ie.utils.getClientSize().h-s.header.offsetHeight-50+"px"),this.#Dr.currentDropdownActiveButton&&this.#Dr.currentDropdown&&this.#Dr.__resetMenuPosition(this.#Dr.currentDropdownActiveButton,this.#Dr.currentDropdown),this.$.viewer._resetFullScreenHeight())return;const i=this.$.frameContext;i.get("isCodeView")&&this.#t.mode.isInline?this.#o._showInline():(this.#Fr._iframeAutoHeight(i),this.#o.isSticky&&(this.#o.isCSSSticky||(this.#e.get("toolbar_main").style.width=i.get("topArea").offsetWidth-2+"px"),this.#o._resetSticky()))}#Qr(t,e,s){this.#Fr._syncScrollPosition(e),this.#aa(),this._callPluginEvent("onScroll",{frameContext:t,event:s}),t.has("documentType_use_page")&&t.get("documentType").scrollPage(),this.#mi.triggerEvent("onScroll",{frameContext:t,event:s})}#ta(t,e){if(this.$.selection.__iframeFocus||t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),!1;this.#t.set("hasFocus",!0),this.$.component.__prevent=!1,this.#mi.triggerEvent("onNativeFocus",{frameContext:t,event:e});const s=t.get("key");this._inputFocus?this.#t.mode.isInline&&vl.setTimeout((()=>{this.#o._showInline()}),0):this.#t.get("rootKey")===s&&this.#t.get("_preventBlur")||this.#t.get("_preventFocus")||(this.#t.set("_preventFocus",!0),Ie.utils.removeClass(this.$.commandDispatcher.targets.get("codeView"),"active"),this.#Fr._toggleCodeViewButtons(!1),this.$.facade.changeFrameContext(s),this.$.history.resetButtons(s,null),vl.setTimeout((()=>{this.__postFocusEvent(t,e)}),0))}#ea(t,e){t.get("isCodeView")||t.get("isReadOnly")||t.get("isDisabled")||(this.#t.set("hasFocus",!1),this.#t.set("_lastSelectionNode",null),this.#mi.triggerEvent("onNativeBlur",{frameContext:t,event:e}),this.#Fr._updatePlaceholder(t),this._inputFocus||this.#t.get("_preventBlur")||(this.#t.set("_preventFocus",!1),this.selectionState.reset(),this.#t.set("currentNodes",[]),this.#t.set("currentNodesMap",[]),this.#Fr.offCurrentController(),this.#gi.applyToRoots((t=>{t.get("navigation")&&(t.get("navigation").textContent="")})),this.$.history.check(t.get("key"),this.#t.get("_range")),this.__postBlurEvent(t,e)))}#ra(t){t.stopPropagation(),this._resizeClientY=t.clientY,this.#Fr.enableBackWrapper("ns-resize"),this.#Zr=this.#mi.addGlobalEvent("mousemove",this.#ca.bind(this)),this.#Wr=this.#mi.addGlobalEvent("mouseup",this.#da.bind(this))}#ca(t){const e=this.$.frameContext,s=e.get("wrapper").offsetHeight+(t.clientY-this._resizeClientY),i=s<e.get("_minHeight")?e.get("_minHeight"):s;e.get("wysiwygFrame").style.height=e.get("code").style.height=i+"px",this._resizeClientY=t.clientY,Ne.isResizeObserverSupported||this.#Fr._emitResizeEvent(e,i,null)}#da(){this.#Fr.disableBackWrapper(),this.#Zr&&=this.#mi.removeGlobalEvent(this.#Zr),this.#Wr&&=this.#mi.removeGlobalEvent(this.#Wr)}#ia(t,e){e.preventDefault();const s=this._lineBreakComp;if(!s)return;const i=Ie.check.isListCell(s.parentElement),n=Ie.utils.createElement(i?"BR":Ie.check.isTableCell(s.parentElement)?"DIV":this.#ot.get("defaultLine"));if(i||(n.innerHTML="<br>"),"byte-html"!==this.$.frameOptions.get("charCounter_type")||this.$.char.check(n.outerHTML)){s.parentNode.insertBefore(n,"t"===t?s:s.nextSibling),this.$.component.deselect();try{const t=i?n:n.firstChild;this.$.selection.setRange(t,1,t,1),this.$.history.push(!1)}catch(t){console.warn("[SUNEDITOR.lineBreaker.error]",t)}}}#Kr(){this.#t.set("initViewportHeight",vl.visualViewport.height),bl||this.#Fr.offCurrentController(),this.#t.mode.isBalloon?this.#o.hide():this.#t.mode.isSubBalloon&&this.$.subToolbar.hide(),this.#ha()}#Yr(){bl&&this.#ot.get("_toolbar_sticky")>-1&&(this.#o._resetSticky(),this.#Dr.__restoreMenuPosition()),this.#aa();const t=this.#t.get("currentViewportHeight");this.__setViewportSize(),bl&&t>0&&t-vl.visualViewport.height>100&&this.#t.get("hasFocus")&&this.$.selection.scrollTo(this.$.selection.getRange(),{behavior:"auto",block:"nearest",inline:"nearest"})}#Xr(){this.#ot.get("_toolbar_sticky")>-1&&this.#o._resetSticky(),this.#t.mode.isBalloon&&"block"===this.#e.get("toolbar_main").style.display?this.#o._setBalloonOffset("top"===this.#o.balloonOffset.position):this.#t.mode.isSubBalloon&&"block"===this.#e.get("toolbar_sub_main").style.display&&this.$.subToolbar._setBalloonOffset("top"===this.$.subToolbar.balloonOffset.position),this.#aa(),this.$.frameContext.has("documentType_use_page")&&this.$.frameContext.get("documentType").scrollWindow()}#Jr(){this.#ot.get("_toolbar_sticky")>-1&&(this.#o._resetSticky(),this.#Dr.__restoreMenuPosition())}#la(t){let e=t.getSelection().anchorNode;this.#gi.applyToRoots((t=>{if(e&&t.get("wysiwyg").contains(e)){if(t.get("isReadOnly")||t.get("isDisabled"))return;if(e=null,this.$.selection.init(),this.applyTagEffect(),this.#Fr._updatePlaceholder(t),yl&&(this.#t.mode.isBalloon||this.#t.mode.isSubBalloon)&&this.#Gr(),t.has("documentType_use_header")){const e=Ie.query.getParentElement(this.$.selection.selectionNode,this.$.format.isLine.bind(this.$.format));t.get("documentType").on(e)}}}))}#oa(){this.#Dr.dropdownOff(),this.#aa()}#sa(t){this.$.facade.changeFrameContext(t.get("key")),Ie.utils.addClass(this.$.commandDispatcher.targets.get("codeView"),"active"),this.#Fr._toggleCodeViewButtons(!0)}#na(t){this.$.facade.changeFrameContext(t.get("key")),Ie.utils.addClass(this.$.commandDispatcher.targets.get("markdownView"),"active"),this.#Fr._toggleCodeViewButtons(!0)}};const _l=class{#ua=new Map;#pa=new Map;$=null;constructor(t,e){const{product:s,options:i}=e;this.store=new bs(s),this.$={facade:t,store:this.store},this.#ga(s,i),this.#ma(),this.#fa(s),this.#va(),this.#ba(),this._eventOrchestrator=new wl(this),this.#ua.get("eventManager")._bindOrchestrator(this._eventOrchestrator)}#ga(t,e){const s=new ws(t),i=new _s(this,t,e);this.#ua.set("contextProvider",s),this.#ua.set("optionProvider",i),this.#ua.set("instanceCheck",new xs(s.frameContext)),this.#ua.set("eventManager",new Es(s,i,this.$))}#ma(){const t=this.#ua.get("contextProvider"),e=this.#ua.get("optionProvider");Object.assign(this.$,{contextProvider:t,optionProvider:e,instanceCheck:this.#ua.get("instanceCheck"),eventManager:this.#ua.get("eventManager"),frameRoots:t.frameRoots,context:t.context,options:e.options,icons:t.icons,lang:t.lang,frameContext:t.frameContext,frameOptions:e.frameOptions})}#fa(t){this.#pa.set("offset",new Ts(this)),this.#pa.set("selection",new Hs(this)),this.#pa.set("html",new ci(this)),this.#pa.set("nodeTransform",new di(this)),this.#pa.set("format",new Ns(this)),this.#pa.set("inline",new Bs(this)),this.#pa.set("listFormat",new Vs(this)),this.#pa.set("char",new pi(this)),this.#pa.set("shortcuts",new gi(this)),this.#pa.set("component",new Gi(this)),this.#pa.set("pluginManager",new ji(this,t)),this.#pa.set("focusManager",new Ki(this)),this.#pa.set("ui",new wn(this)),this.#pa.set("commandDispatcher",new vn(this)),this.#pa.set("toolbar",new $n(this,{keyName:"toolbar",balloon:this.store.mode.isBalloon,balloonAlways:this.store.mode.isBalloonAlways,inline:this.store.mode.isInline,res:t.responsiveButtons})),this.$.options.has("_subMode")&&this.#pa.set("subToolbar",new $n(this,{keyName:"toolbar_sub",balloon:this.store.mode.isSubBalloon,balloonAlways:this.store.mode.isSubBalloonAlways,inline:!1,res:t.responsiveButtons_sub})),this.#pa.set("menu",new Tn(this)),this.#pa.set("viewer",new Nn(this)),this.#pa.set("finder",new Vn(this)),this.#pa.set("history",_n(this))}#ba(){for(const[,t]of this.#pa)"function"==typeof t?._init&&t._init()}#va(){const t=this.#pa.get("pluginManager");Object.assign(this.$,{offset:this.#pa.get("offset"),selection:this.#pa.get("selection"),format:this.#pa.get("format"),inline:this.#pa.get("inline"),listFormat:this.#pa.get("listFormat"),html:this.#pa.get("html"),nodeTransform:this.#pa.get("nodeTransform"),char:this.#pa.get("char"),component:this.#pa.get("component"),focusManager:this.#pa.get("focusManager"),pluginManager:t,plugins:t.plugins,ui:this.#pa.get("ui"),commandDispatcher:this.#pa.get("commandDispatcher"),history:this.#pa.get("history"),shortcuts:this.#pa.get("shortcuts"),toolbar:this.#pa.get("toolbar"),subToolbar:this.#pa.get("subToolbar"),menu:this.#pa.get("menu"),viewer:this.#pa.get("viewer"),finder:this.#pa.get("finder")})}_destroy(){if(null===this.$)return;const t=[];for(const[e,s]of this.#pa)try{s?._destroy?.()}catch(s){t.push(`[Logic:${e}] ${s.message}`)}this.#pa.clear();try{this._eventOrchestrator?._removeAllEvents()}catch(e){t.push(`[EventOrchestrator] ${e.message}`)}this._eventOrchestrator=null;for(const[e,s]of this.#ua)try{s?._destroy?.()}catch(s){t.push(`[Config:${e}] ${s.message}`)}this.#ua.clear(),t.length>0&&console.warn("[CoreKernel._destroy] Cleanup completed with errors:",t),this.$=null,this.store._destroy(),this.store=null,this.facade=null}};const xl=class{#F;$;constructor(t,e){const s=gs(t,e),i=new _l(this,{product:s,options:e});this.#F=i,this.$=i.$,this.#ya(e).catch((t=>{console.error("[SUNEDITOR:E_CREATE_FAIL] Failed to create editor instance.",t)}))}isEmpty(t){const e=(t||this.$.frameContext).get("wysiwyg");return Ie.check.isZeroWidth(e.textContent)&&!e.querySelector(this.$.options.get("allowedEmptyTags"))&&(e.innerText.match(/\n/g)||"").length<=1}resetOptions(t){this.$.optionProvider.reset(t),this.$.store.set("_lastSelectionNode",null),this.#Ca(this.$.frameRoots.get(this.$.store.get("rootKey")));for(const t of Object.values(this.$.plugins))t.init?.()}changeFrameContext(t){t!==this.$.store.get("rootKey")&&(this.$.store.set("rootKey",t),this.#Ca(this.$.frameRoots.get(t)),this.$.toolbar._resetSticky())}destroy(){this.$.options.get("hasCodeMirror")&&this.$.contextProvider.applyToRoots((t=>{const e=t.get("options").get("codeMirrorEditor");e&&e.toTextArea()})),Ie.utils.removeItem(this.$.context.get("toolbar_wrapper")),Ie.utils.removeItem(this.$.context.get("toolbar_sub_wrapper")),Ie.utils.removeItem(this.$.context.get("statusbar_wrapper"));for(const t in this.events)this.events[t]=null;return this.events=null,this.#F._destroy(),null}#Ca(t){this.$.contextProvider.reset(t),this.$.optionProvider.resetFrame(t.get("options")),this.$.ui.reset(t)}#wa(t){this.$.store.set("initViewportHeight",Ne._w.visualViewport.height),this.#F._eventOrchestrator.__setViewportSize(),this.$.contextProvider.init(),this.#Ca(this.$.frameRoots.get(this.$.store.get("rootKey"))),this.#$s(t),this.$.contextProvider.applyToRoots((t=>{this.#F._eventOrchestrator._addFrameEvents(t),this.#_a(t,t.get("options").get("value")),t.get("options").get("iframe")&&"auto"===t.get("options").get("height")&&this.$.ui._emitResizeEvent(t,t.get("wysiwygFrame").offsetHeight,null)})),this.#F._eventOrchestrator.__eventDoc=null,this.$.store._editorInitFinished=!0,this.$.pluginManager.checkFileInfo(!0),this.$.history.reset(),Ne._w.setTimeout((()=>{if(this.$.context?.size){this.$.context.get("toolbar_main").style.visibility="",this.$.contextProvider.applyToRoots((t=>{this.#F._eventOrchestrator._wwFrameObserver&&this.#F._eventOrchestrator._wwFrameObserver.observe(t.get("wysiwygFrame")),this.#F._eventOrchestrator._toolbarObserver&&this.#F._eventOrchestrator._toolbarObserver.observe(t.get("_toolbarShadow")),this.$.ui._syncFrameState(t)}));for(const t of Object.values(this.$.plugins))t.init?.();this.$.selection.__init(),this.$.eventManager.triggerEvent("onload",{})}else console.warn("[SUNEDITOR:E_INIT_FAIL] Editor instance was destroyed before initialization completed. Check if destroy() was called.")}),0)}#_a(t,e){t.get("wysiwyg").innerHTML=this.$.html.clean("string"==typeof e?e:(/^TEXTAREA$/i.test(t.get("originElement").nodeName)?t.get("originElement").value:t.get("originElement").innerHTML)||"",{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.$.options.get("freeCodeViewMode")})||"<"+this.$.options.get("defaultLine")+"><br></"+this.$.options.get("defaultLine")+">",t.has("charCounter")&&(t.get("charCounter").textContent=String(this.$.char.getLength())),t.has("wordCounter")&&(t.get("wordCounter").textContent=String(this.$.char.getWordCount())),"document"===this.$.options.get("type")&&(t.set("documentType",new vs(this.#F,t)),t.get("documentType").useHeader&&t.set("documentType_use_header",!0),t.get("documentType").usePage&&(t.set("documentType_use_page",!0),t.get("documentTypePageMirror").innerHTML=t.get("wysiwyg").innerHTML))}#$s(t){this.$.pluginManager.init(t),this.$.shortcuts._registerShortcuts(),this.$.commandDispatcher._initCommandButtons(),this.$.ui.init()}#xa(t,e,s){t.contentDocument.documentElement.className="sun-editor",t.contentDocument.head.innerHTML='<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">'+Be._setIframeStyleLinks(s.get("iframe_cssFileName"))+Be._setAutoHeightStyle(s.get("height")),t.contentDocument.body.className=e.get("_editableClass"),t.contentDocument.body.setAttribute("contenteditable","true"),e.get("_rtl")&&(t.contentDocument.body.dir="rtl")}async#ya(t){this.#F._eventOrchestrator._addCommonEvents();const e=[];this.$.contextProvider.applyToRoots((t=>{const s=t.get("originElement"),i=t.get("topArea");if(s.style.display="none",i.style.display="block",s.parentNode.insertBefore(i,s.nextElementSibling),t.get("options").get("iframe")){const s=new Promise((e=>{const s=s=>{this.#xa(s,this.$.optionProvider.options,t.get("options")),e()};if(Ne.isGecko){let e=null;this.$.eventManager.addEvent(t.get("wysiwygFrame"),"load",(({target:t})=>{clearTimeout(e),e=setTimeout((()=>{this.$&&s(t)}),60)}))}else this.$.eventManager.addEvent(t.get("wysiwygFrame"),"load",(({target:t})=>{s(t)}))}));e.push(s)}})),this.$.contextProvider.applyToRoots((t=>{t.get("wrapper").appendChild(t.get("wysiwygFrame")),t.get("documentTypeInner")&&t.get("wrapper").insertBefore(t.get("documentTypeInner"),t.get("wysiwygFrame")),t.get("documentTypePage")&&(t.get("wrapper").appendChild(t.get("documentTypePage")),t.get("wrapper").appendChild(t.get("documentTypePageMirror"))),t.get("blockHandleArea")&&t.get("wrapper").insertBefore(t.get("blockHandleArea"),t.get("wysiwygFrame"))})),e.length>0&&await Promise.all(e),this.#wa(t)}};function $l(t){let e;try{e=t.responseText}catch{return`status ${t.status}`}if(!e)return`status ${t.status}`;try{return JSON.parse(e)}catch{return e}}const kl=class{#J;#$a;constructor(t,e,s){this.#J=e,this.kind=t.constructor.key||t.constructor.name,this.#$a=Ne.getXMLHttpRequest(),this.method=s?.method,this.url=s?.url,this.headers=s?.headers,this.data=s?.data,this.callBack=s?.callBack,this.errorCallBack=s?.errorCallBack,this.responseType=s?.responseType}call({method:t,url:e,headers:s,data:i,callBack:n,errorCallBack:o,responseType:l}){if(this.cancel(),t||=this.method,e=this.#ka(e||this.url),s||=this.headers,i||=this.data,n||=this.callBack,o||=this.errorCallBack,l||=this.responseType,"function"!=typeof n)throw new Error(`[SUNEDITOR.ApiManager[${this.kind}].upload.callBack.fail] callBack is not a function`);const r=this.#$a;if(l&&(r.responseType=l),r.onreadystatechange=this.#Sa.bind(this,r,n,o),r.open(t,e,!0),null!==s&&"object"==typeof s&&Object.keys(s).length>0)for(const t in s)r.setRequestHeader(t,s[t]);r.send(i)}asyncCall({method:t,url:e,headers:s,data:i,responseType:n}){this.cancel(),t||=this.method,e=this.#ka(e||this.url),s||=this.headers,i||=this.data,n||=this.responseType;const o=this.#$a;return n&&(o.responseType=n),new Promise(((n,l)=>{if(o.open(t,e,!0),null!==s&&"object"==typeof s&&Object.keys(s).length>0)for(const t in s)o.setRequestHeader(t,s[t]);o.onload=()=>{if(200===o.status)try{n(o)}finally{this.#J.ui.hideLoading()}else{console.error(`[SUNEDITOR.ApiManager[${this.kind}].upload.serverException]`,o);try{l($l(o))}finally{this.#J.ui.hideLoading()}}},o.onerror=()=>{this.#J.ui.hideLoading(),l(new Error("Network error"))},o.send(i)}))}cancel(){this.#$a&&(this.#$a.onreadystatechange=null,this.#$a.onload=null,this.#$a.onerror=null,this.#$a.abort())}#ka(t){return t?t.replace(/([^:])\/+/g,"$1/").replace(/\/(\?|#|$)/,"$1"):""}async#Sa(t,e,s){if(4===t.readyState)if(200===t.status)try{await e(t)}catch(t){throw Error(`[SUNEDITOR.ApiManager[${this.kind}].upload.callBack.fail] ${t.message}`)}finally{this.#J.ui.hideLoading()}else{console.error(`[SUNEDITOR.ApiManager[${this.kind}].upload.serverException]`,t);try{const e=$l(t);let i="";"function"==typeof s&&(i=await s(e,t));const n=`[SUNEDITOR.ApiManager[${this.kind}].upload.serverException] status: ${t.status}, response: ${i||e.errorMessage||("string"==typeof e?e:JSON.stringify(e))}`;this.#J.ui.alertOpen(n,"error")}catch(t){throw Error(`[SUNEDITOR.ApiManager[${this.kind}].upload.errorCallBack.fail] ${t.message}`)}finally{this.#J.ui.hideLoading()}}}};function Sl(t){const e=t.src.split("/").pop(),s=t.thumbnail||"",i=s||t.src,n=this.props?.map((e=>`data-${e}="${t[e]}"`)).join(" ")||"",o=`data-type="${t.type}" data-command="${t.src}" data-name="${t.name||e}" data-thumbnail="${s}" data-extension="${t.src.split(".").pop()}" ${n}`,l=`class="${s||"se-browser-empty-image"}" src="${i}" alt="${t.alt||e}" ${o}`;return`\n\t\t<div class="se-file-item-img">\n\t\t\t${this.thumbnail&&!s&&"image"!==t.type?`<div class="se-browser-empty-thumbnail" ${l}>${this.thumbnail(t)}</div>`:`<img class="${s||"se-browser-empty-image"}" ${l}>`}\n\t\t\t<div class="se-file-name-image se-file-name-back"></div>\n\t\t\t<div class="se-file-name-image">${t.name||e}</div>\n\t\t</div>`}const El=class{#J;#Ea;#Zo;#Ta=[];#Ma;#Ha;#uo=!1;#fo=null;constructor(t,e,s){this.#J=e,this.useSearch=s.useSearch??!0;const i=Ie.utils.createElement("DIV",{class:"se-browser sun-editor-common"+(s.className?` ${s.className}`:"")}),n=function(t,e){const s=t.lang,i=t.icons,n=`\n\t\t<div class="se-browser-content">\n\t\t\t<div class="se-browser-header">\n\t\t\t\t<button type="button" data-command="close" class="se-btn se-browser-close" class="close" title="${s.close}" aria-label="${s.close}">\n\t\t\t\t\t${i.cancel}\n\t\t\t\t</button>\n\t\t\t\t<span class="se-browser-title"></span>\n\t\t\t</div>\n\t\t\t<div class="se-browser-wrapper">\n\t\t\t\t<div class="se-browser-side"></div>\n\t\t\t\t<div class="se-browser-main"> \n\t\t\t\t\t<div class="se-browser-bar">\n\t\t\t\t\t\t<div class="se-browser-search">\n\t\t\t\t\t\t\t<button class="se-btn se-side-open-btn">${i.side_menu_hamburger}</button>\n\t\t\t\t\t\t\t${e?`\n\t\t\t\t\t\t\t\t\t\t<form class="se-browser-search-form">\n\t\t\t\t\t\t\t\t\t\t\t<div class="se-browser-search-input-wrap">\n\t\t\t\t\t\t\t\t\t\t\t\t<input type="text" class="se-input-form" placeholder="${s.search}" aria-label="${s.search}">\n\t\t\t\t\t\t\t\t\t\t\t\t<button type="button" class="se-btn se-btn-plain se-browser-search-clear" title="${s.cancel}" aria-label="${s.cancel}" style="display:none">${i.cancel}</button>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t<button type="submit" class="se-btn" title="${s.search}" aria-label="${s.search}">${i.search}</button>\n\t\t\t\t\t\t\t\t\t\t</form>`:""}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class="se-browser-body">\n\t\t\t\t\t\t<div class="se-browser-tags"></div>\n\t\t\t\t\t\t<div class="se-loading-box sun-editor-common"><div class="se-loading-effect"></div></div>\n\t\t\t\t\t\t<div class="se-browser-menus"></div>\n\t\t\t\t\t\t<div class="se-browser-list"></div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>`,o=Ie.utils.createElement("DIV",{class:"se-browser-inner"},n);return{html:o,header:o.querySelector(".se-browser-header"),titleArea:o.querySelector(".se-browser-title"),tagArea:o.querySelector(".se-browser-tags"),body:o.querySelector(".se-browser-body"),list:o.querySelector(".se-browser-list"),side:o.querySelector(".se-browser-side"),wrapper:o.querySelector(".se-browser-wrapper"),_loading:o.querySelector(".se-loading-box")}}(this.#J,this.useSearch),o=n.html;this.kind=t.constructor.key||t.constructor.name,this.host=t,this.area=i,this.header=n.header,this.titleArea=n.titleArea,this.tagArea=n.tagArea,this.body=n.body,this.list=n.list,this.side=n.side,this.wrapper=n.wrapper,this.#Ea=n._loading,this.title=s.title,this.listClass=s.listClass||"se-preview-list",this.directData=s.data,this.url=s.url,this.headers=s.headers,this.searchUrl=s.searchUrl,this.searchHeaders=s.searchHeaders,this.drawItemHandler=(s.drawItemHandler||Sl).bind({thumbnail:s.thumbnail,props:s.props||[]}),this.selectorHandler=s.selectorHandler,this.columnSize=s.columnSize||4,this.expand=s.expand??1,this.folderDefaultPath="",this.closeArrow=this.#J.icons.menu_arrow_right,this.openArrow=this.#J.icons.menu_arrow_down,this.icon_folder=this.#J.icons.side_menu_folder_item,this.icon_folder_item=this.#J.icons.side_menu_folder,this.icon_item=this.#J.icons.side_menu_item,this.items=[],this.folders={},this.tree={},this.data={},this.selectedTags=[],this.keyword="",this.sideInner=null,this.apiManager=new kl(this,e,{method:"GET"}),this.#Zo=t=>{Oe.isEsc(t.code)&&this.close()},i.appendChild(Ie.utils.createElement("DIV",{class:"se-browser-back"})),i.appendChild(o),i.setAttribute("popover","manual"),this.#J.contextProvider.carrierWrapper.appendChild(i),this.#J.eventManager.addEvent(this.tagArea,"click",this.#La.bind(this)),this.#J.eventManager.addEvent(this.list,"click",this.#Na.bind(this)),this.#J.eventManager.addEvent(this.side,"click",this.#Aa.bind(this)),this.#J.eventManager.addEvent(o,"mousedown",this.#Ba.bind(this)),this.#J.eventManager.addEvent(o,"click",this.#Ia.bind(this)),this.#J.eventManager.addEvent(this.sideOpenBtn=i.querySelector(".se-side-open-btn"),"click",this.#Va.bind(this)),this.#J.eventManager.addEvent([this.header,i.querySelector(".se-browser-main")],"mousedown",this.#Oa.bind(this));const l=i.querySelector("form.se-browser-search-form");this.#Ma=l?.querySelector('input[type="text"]'),this.#Ha=i.querySelector(".se-browser-search-clear"),this.#J.eventManager.addEvent(l,"submit",this.#Ra.bind(this)),this.#J.eventManager.addEvent(this.#Ha,"click",this.#Pa.bind(this))}open(t={}){this.#Pe();const e=t.listClass||this.listClass;Ie.utils.hasClass(this.list,e)||(this.list.className="se-browser-list "+e),this.titleArea.textContent=t.title||this.title,this.area.style.display="block",this.area.showPopover?.(),this.#J.ui.opendBrowser=this,this.closeArrow=this.#J.options.get("_rtl")?this.#J.icons.menu_arrow_left:this.#J.icons.menu_arrow_right,this.directData?this.#za(this.directData):this.#Fa(t.url||this.url,t.headers||this.headers,!1),this.body.style.maxHeight=Ie.utils.getClientSize().h-(this.#J.offset.getGlobal(this.body).top-o.scrollY)-20+"px"}close(){this.#qe(),this.apiManager.cancel(),this.area.hidePopover?.(),this.area.style.display="none",this.selectedTags=[],this.items=[],this.#Ta=[],this.folders={},this.tree={},this.data={},this.keyword="",this.list.innerHTML=this.tagArea.innerHTML=this.titleArea.textContent="",this.#Ma&&(this.#Ma.value=""),this.#Ha&&(this.#Ha.style.display="none"),this.#J.ui.opendBrowser=null,this.sideInner=null,this.host.browserInit?.()}search(t){if(this.searchUrl){this.keyword=t;const e=this.searchUrl.includes("?")?"&":"?";this.#Fa(this.searchUrl+e+"keyword="+o.encodeURIComponent(t),this.searchHeaders,!1)}else this.keyword=t.toLowerCase(),this.#Da(this.#Ta.length>0?this.#Ta:this.items,!1)}#qa(){const t=[];for(const e in this.data){const s=this.data[e];if(Array.isArray(s))for(let e=0;e<s.length;e++)t.push(s[e])}return t}tagfilter(t){const e=this.selectedTags;return 0===e.length?t:t.filter((t=>!Array.isArray(t.tag)||t.tag.some((t=>e.includes(t)))))}showBrowserLoading(){this.#Ea.style.display="block"}closeBrowserLoading(){this.#Ea.style.display="none"}#Fa(t,e,s){this.apiManager.call({method:"GET",url:t,headers:e,callBack:this.#Wa.bind(this),errorCallBack:this.#Ua.bind(this)}),s||(this.sideOpenBtn.style.display="none",this.showBrowserLoading())}#Da(t,e){const s=this.keyword,i=[],n=(t=this.tagfilter(t).filter((t=>t.name.toLowerCase().indexOf(s)>-1))).length,o=this.columnSize,l=o<=1?1:Math.round(n/o)||1,r=this.drawItemHandler;let a="",h='<div class="se-file-item-column">',c=1;for(let s,d,u=0;u<n;u++)if(s=t[u],d=s.tag?"string"==typeof s.tag?s.tag.split(","):s.tag:[],d=s.tag=d.map((t=>t.trim())),h+=r(s),(u+1)%l==0&&c<o&&u+1<n&&(c++,h+='</div><div class="se-file-item-column">'),e&&d.length>0)for(let t,e=0,s=d.length;e<s;e++)t=d[e],t&&!i.includes(t)&&(i.push(t),a+=`<a title="${t}" aria-label="${t}">${t}</a>`);h+="</div>",this.list.innerHTML=h,s&&this.#Za(s),e&&(this.items=t,this.tagArea.innerHTML=a)}#Pe(){this.#qe(),this.#fo=this.#J.eventManager.addGlobalEvent("keydown",this.#Zo,!0)}#qe(){this.#fo&&=this.#J.eventManager.removeGlobalEvent(this.#fo)}#za(t){if(Array.isArray(t))return t.length>0&&this.#Da(t,!0),!0;if("object"==typeof t){this.sideOpenBtn.style.display="",this.#Ga(t),this.#Ta=this.#qa(),this.side.innerHTML="";const e=this.sideInner=Ie.utils.createElement("div",null);if(this.#ja(this.tree,e),this.side.appendChild(e),this.folderDefaultPath){const t=e.querySelector(`[data-command="${this.folderDefaultPath}"]`);t.click(),this.folderDefaultPath.includes("/")&&(Ie.utils.removeClass(t.parentElement,"se-menu-hidden"),t.parentElement.previousElementSibling.querySelector("button").innerHTML=this.openArrow)}return!0}return!1}#Ga(t,e){let s=this.tree;if(t._data){this.data[e]=t._data,this.folderDefaultPath&&!t.default||(this.folderDefaultPath=e);const i=e.split("/"),n=i.length-1;i.forEach(((t,i)=>{s[t]||={children:{}},i===n?(s[t].key=e,s[t].name=this.folders[e].name):s=s[t].children}))}else e&&(s[e]={name:this.folders[e].name,children:{}});Object.entries(t).forEach((([t,s])=>{if("_data"===t||!s||"object"!=typeof s)return;const i=s,n=e?`${e}/${t}`:t;this.folders[n]={name:i.name||t,meta:i.meta||{}},this.#Ga(i,n)}))}#ja(t,e,s=0){const i=s<this.expand;for(const n in t){const o=t[n];if(o)if(Object.keys(o.children).length>0){const t=Ie.utils.createElement("div",o.key?{"data-command":o.key,"aria-label":o.name}:null,`<span class="se-menu-icon">${o.key?this.icon_folder:this.icon_folder_item}</span><span>${o.name}</span>`),n=Ie.utils.createElement("div",{class:"se-menu-folder"},t);t.insertBefore(Ie.utils.createElement("button",null,i?this.openArrow:this.closeArrow),t.firstElementChild);const l=document.createElement("div");Ie.utils.addClass(l,i?"se-menu-child":"se-menu-child|se-menu-hidden"),this.#ja(o.children,l,s+1),n.appendChild(l),e.appendChild(n)}else{const t=Ie.utils.createElement("div",{"data-command":o.key,"aria-label":o.name,class:"se-menu-folder-item"},`<span class="se-menu-icon">${this.icon_item}</span><span>${o.name}</span>`);if(e===this.sideInner){const s=Ie.utils.createElement("div",{class:"se-menu-folder"},t);e.appendChild(s)}else e.appendChild(t)}}}#Wa(t){try{const e=JSON.parse(t.responseText),s=e.result;if(this.#za(s))return;e.nullMessage&&(this.list.innerHTML=e.nullMessage)}catch(t){throw Error(`[SUNEDITOR.browser.drawList.fail] cause: "${t.message}"`)}finally{this.closeBrowserLoading()}}#Ua(t,e){throw this.closeBrowserLoading(),Error(`[SUNEDITOR.browser.get.serverException] status: ${e.status}, response: ${t.errorMessage||e.responseText}`)}#La(t){const e=Ie.query.getEventTarget(t);if(!Ie.check.isAnchor(e))return;const s=e.textContent,i=this.tagArea.querySelector('a[title="'+s+'"]'),n=this.selectedTags.indexOf(s);n>-1?(this.selectedTags.splice(n,1),Ie.utils.removeClass(i,"on")):(this.selectedTags.push(s),Ie.utils.addClass(i,"on")),this.#Da(this.items,!1)}#Na(t){const e=Ie.query.getEventTarget(t);if(t.preventDefault(),t.stopPropagation(),e===this.list)return;const s=Ie.query.getCommandTarget(e);s&&(this.close(),this.selectorHandler(s))}#Aa(t){const e=Ie.query.getEventTarget(t);if(t.stopPropagation(),/^button$/i.test(e.nodeName)){const t=e.parentElement.parentElement.querySelector(".se-menu-child");return void(Ie.utils.hasClass(t,"se-menu-hidden")?(Ie.utils.removeClass(t,"se-menu-hidden"),e.innerHTML=this.openArrow):(Ie.utils.addClass(t,"se-menu-hidden"),e.innerHTML=this.closeArrow))}const s=Ie.query.getCommandTarget(e);if(!s||Ie.utils.hasClass(s,"active"))return;const i=this.data[s.getAttribute("data-command")];Ie.utils.removeClass(this.side.querySelectorAll(".active"),"active"),Ie.utils.addClass([s,Ie.query.getParentElement(s,".se-menu-folder")],"active"),this.tagArea.innerHTML="",this.selectedTags=[],"string"==typeof i?this.#Fa(i,this.headers,!0):this.#Da(i,!0)}#Ba(t){const e=Ie.query.getEventTarget(t);/se-browser-inner/.test(e.className)?this.#uo=!0:this.#uo=!1}#Ia(t){const e=Ie.query.getEventTarget(t);t.stopPropagation(),(/close/.test(e.getAttribute("data-command"))||this.#uo)&&this.close()}#Ra(t){t.preventDefault();const e=this.#Ma.value;this.search(e),this.#Ha&&(this.#Ha.style.display=e?"":"none")}#Pa(){this.#Ma&&(this.#Ma.value=""),this.#Ha&&(this.#Ha.style.display="none"),this.keyword="",this.#Da(this.items,!1)}#Za(t){const e=this.list.querySelectorAll(".se-file-name-image:not(.se-file-name-back)");for(let s=0;s<e.length;s++){const i=e[s],n=i.textContent,o=n.toLowerCase().indexOf(t);o>-1&&(i.innerHTML=n.substring(0,o)+"<mark>"+n.substring(o,o+t.length)+"</mark>"+n.substring(o+t.length))}}#Va(t){const e=Ie.query.getEventTarget(t);Ie.utils.hasClass(e,"active")?(Ie.utils.removeClass(this.side,"se-side-show"),Ie.utils.removeClass(e,"active")):(Ie.utils.addClass(this.side,"se-side-show"),Ie.utils.addClass(e,"active"))}#Oa({target:t}){t!==this.sideOpenBtn&&Ie.utils.hasClass(this.sideOpenBtn,"active")&&(Ie.utils.removeClass(this.side,"se-side-show"),Ie.utils.removeClass(this.sideOpenBtn,"active"))}},{isTouchDevice:Tl}=Ne,Ml=240,Hl=120,Ll={hex:"#FFFFFF",r:255,g:255,b:255,h:0,s:1,l:1};let Nl,Al=0,Bl=!1,Il=!1,Vl=120,Ol=120,Rl=Ll,Pl=!1;const{slider:zl,offscreenCanvas:Fl,offscreenCtx:Dl,wheel:ql,wheelCtx:Wl,wheelPointer:Ul,gradientBar:Zl,gradientPointer:Gl,fanalColorHex:jl,fanalColorBackground:Kl}=function(){const t=document.createElement("canvas");t.width=Ml,t.height=Ml;const e=`\n\t<div class="se-hue-slider-container" style="width: 240px; height: 240px;">\n <canvas class="se-hue-wheel" width="240" height="240"></canvas>\n <div class="se-hue-wheel-pointer"></div>\n </div>\n <div class="se-hue-gradient-container">\n <canvas class="se-hue-gradient" width="240" height="28"></canvas>\n <div class="se-hue-gradient-pointer"></div>\n </div>\n <div class="se-hue-final-hex" style="width:240px; height: 28px;">\n\t\t<div style="flex: 3; line-height: 1.5;">${Ll.hex}</div>\n\t\t<div style="flex: 1; height: 100%; border: 1px solid #fff; outline: 1px solid #000;"></div>\n\t</div>\n\t`,s=Ie.utils.createElement("DIV",{class:"se-hue-slider"},e),i=s.querySelector(".se-hue-wheel"),n=s.querySelector(".se-hue-gradient"),o=s.querySelector(".se-hue-final-hex").children;return{slider:s,offscreenCanvas:t,offscreenCtx:t.getContext("2d"),wheel:i,wheelCtx:i.getContext("2d"),wheelPointer:s.querySelector(".se-hue-wheel-pointer"),gradientBar:n,gradientPointer:s.querySelector(".se-hue-gradient-pointer"),fanalColorHex:o[0],fanalColorBackground:o[1]}}();function Yl(t){const{target:e,touches:s}=t,i=s[0].clientX,n=s[0].clientY;e===ql?(t.preventDefault(),Il=!1,Bl=!0,tr(i,n)):e===Zl&&(t.preventDefault(),Il=!0,Bl=!1,er(i))}function Xl(t){t.preventDefault();const{touches:e}=t,s=e[0].clientX,i=e[0].clientY;Bl?tr(s,i):Il&&er(s)}function Jl({target:t,clientX:e,clientY:s}){t===ql?(Il=!1,Bl=!0,tr(e,s)):t===Zl&&(Il=!0,Bl=!1,er(e))}function Ql({clientX:t,clientY:e}){Bl?tr(t,e):Il&&er(t)}function tr(t,e){const s=ql.getBoundingClientRect();t=t-s.left-Hl,e=e-s.top-Hl;const i=180*Math.atan2(e,t)/Math.PI,n=Math.min(Math.sqrt(t*t+e*e),Hl),o=Hl+n*Math.cos(i*Math.PI/180),l=Hl+n*Math.sin(i*Math.PI/180);Ul.style.left=`${o}px`,Ul.style.top=`${l}px`,function(t,e){Vl=t,Ol=e,sr(ir())}(o,l),nr()}function er(t){const e=Zl.getBoundingClientRect();let s=t-e.left;s=Math.max(14,Math.min(s,e.width-14)),Gl.style.left=`${s}px`,function(t){const e=Zl.getBoundingClientRect();let s=t-e.left;s<0&&(s=0);s>e.width&&(s=e.width);const i=14;s>=Zl.width-i?s=Zl.width:s<=i&&(s=0);const n=1-s/e.width;Al=n,rr()}(t),nr()}function sr(t){const e=Zl.getContext("2d"),s=e.createLinearGradient(0,0,Zl.width,0);s.addColorStop(0,"black"),s.addColorStop(1,t.hex),e.fillStyle=s,e.fillRect(0,0,Zl.width,Zl.height)}function ir(){return lr(Dl)}function nr(){Nl.color=Rl=lr(Wl),or(Rl.hex)}function or(t){Kl.style.backgroundColor=jl.textContent=t}function lr(t){const e=t.getImageData(Vl,Ol,1,1).data;let[s,i,n]=function([t,e,s]){t/=255,e/=255,s/=255;const i=Math.max(t,e,s),n=Math.min(t,e,s);let o,l;const r=(i+n)/2;if(i===n)o=l=0;else{const a=i-n;switch(l=r>.5?a/(2-i-n):a/(i+n),i){case t:o=(e-s)/a+(e<s?6:0);break;case e:o=(s-t)/a+2;break;case s:o=(t-e)/a+4}o/=6}return[hr(o),hr(l),hr(r)]}(e);const o=Vl-Hl,l=Ol-Hl;Math.sqrt(o*o+l*l)<3&&(n=1-Al),n>1&&(n=1),n<0&&(n=0);const{r,g:a,b:h}=function([t,e,s]){let i,n,o;if(0===e)i=n=o=s;else{const l=function(t,e,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+6*(e-t)*s:s<.5?e:s<2/3?t+(e-t)*(2/3-s)*6:t},r=s<.5?s*(1+e):s+e-s*e,a=2*s-r;i=l(a,r,t+1/3),n=l(a,r,t),o=l(a,r,t-1/3)}return{r:Math.round(255*i),g:Math.round(255*n),b:Math.round(255*o)}}([s,i,n]),c=`#${function({r:t,g:e,b:s}){let i=Math.floor(t).toString(16);t<16&&(i=`0${i}`);let n=Math.floor(e).toString(16);e<16&&(n=`0${n}`);let o=Math.floor(s).toString(16);s<16&&(o=`0${o}`);return`${i}${n}${o}`.toUpperCase()}({r,g:a,b:h})}`;return{hex:c,r,g:a,b:h,h:s,s:i,l:hr(n)}}function rr(){Wl.clearRect(0,0,Ml,Ml),Wl.drawImage(Fl,0,0),Wl.globalAlpha=Al,Wl.fillStyle="black",Wl.beginPath(),Wl.arc(Hl,Hl,Hl,0,2*Math.PI),Wl.fill(),Wl.globalAlpha=1}function ar(t){return t*Math.PI/180}function hr(t){const e=Math.pow(10,10);return Math.round(t*e)/e}function cr(){!function(t){if(!t)return void console.warn("[HueSlider.fail] Context not found.");for(let e=0;e<=360;e+=.5)for(let s=0;s<=Hl;s+=1){t.beginPath();const i=50+(Hl-s)/Hl*50;t.fillStyle=`hsl(${e}, 100%, ${i}%)`;const n=Hl+Math.cos(ar(e))*s,o=Hl-Math.sin(ar(e))*s;t.arc(n,o,1.5,0,2*Math.PI),t.fill()}Pl=!0}(Dl),Pl&&rr()}cr();const dr=class{#J;#Ka;#Ya;#Xa;#Ja;#Qa;#th;constructor(t,e,s={},i=""){if(this.#J=e,this.inst=t,this.ctx={wheelX:Vl,wheelY:Ol,lightness:Al,wheelPointerX:"50%",wheelPointerY:"50%",gradientPointerX:"calc(100% - 14px)",color:Ll},this.isOpen=!1,this.controlle=null,this.#Ka=null,this.#Ya=null,this.#Xa=null,this.#Ja=null,this.#Qa=null,this.#th=null,!s.isNewForm){const n=function({lang:t,icons:e},s){const i=Ie.utils.createElement("DIV",{class:`se-controller ${s}`},`\n\t\t<div class="se-hue"></div>\n\t\t<div class="se-form-group se-form-w0 se-form-flex-btn">\n\t\t\t<button type="button" class="se-btn se-btn-success" title="${t.submitButton}" aria-label="${t.submitButton}" data-command="submit">${e.checked}</button>\n\t\t\t<button type="button" class="se-btn se-btn-danger" title="${t.close}" aria-label="${t.close}" data-command="close">${e.cancel}</button>\n\t\t</div>\n\t`);return i}(e,i);this.circle=n.querySelector(".se-hue"),this.controller=new ki(this,e,n,{position:"bottom",isWWTarget:!1,parents:[t.form],parentsHide:!0,...s.controllerOptions})}}controllerAction(t){const e=t.getAttribute("data-command");"submit"===e?(this.inst.hueSliderAction?.(this.get()),this.close()):"close"===e&&this.close()}controllerClose(){this.init(),this.inst.hueSliderCancelAction?.()}get(){return Rl}open(t){this.attach(),this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null})}close(){this.ctx={gradientPointerX:Gl.style.left,wheelPointerX:Ul.style.left,wheelPointerY:Ul.style.top,wheelX:Vl,wheelY:Ol,lightness:Al,color:Nl?.color||""},this.controller.close()}attach(t){Pl||cr(),this.init(),(t||this.circle).appendChild(zl),Nl=this.ctx,Nl&&(Vl=Nl.wheelX,Ol=Nl.wheelY,Al=Nl.lightness,Ul.style.left=Nl.wheelPointerX,Ul.style.top=Nl.wheelPointerY,Gl.style.left=Nl.gradientPointerX,or(Nl.color.hex),rr(),sr(ir())),Tl&&(this.#Qa=this.#J.eventManager.addGlobalEvent("touchstart",Yl,{passive:!1,capture:!0}),this.#Ya=this.#J.eventManager.addGlobalEvent("touchmove",Xl,!0),this.#th=this.#J.eventManager.addGlobalEvent("touchend",(()=>{Bl=!1,Il=!1}),!0)),this.#Ka=this.#J.eventManager.addGlobalEvent("mousedown",Jl,{passive:!1,capture:!0}),this.#Ja=this.#J.eventManager.addGlobalEvent("mousemove",Ql,!0),this.#Xa=this.#J.eventManager.addGlobalEvent("mouseup",(()=>{Bl=!1,Il=!1}),!0),this.isOpen=!0}init(){this.isOpen=!1,Bl=!1,Il=!1,this.#Ka&&=this.#J.eventManager.removeGlobalEvent(this.#Ka),this.#Ja&&=this.#J.eventManager.removeGlobalEvent(this.#Ja),this.#Xa&&=this.#J.eventManager.removeGlobalEvent(this.#Xa),this.#Qa&&=this.#J.eventManager.removeGlobalEvent(this.#Qa),this.#Ya&&=this.#J.eventManager.removeGlobalEvent(this.#Ya),this.#th&&=this.#J.eventManager.removeGlobalEvent(this.#th)}},ur=["#ef4444","#f97316","#eab308","#22c55e","#06b6d4","#3b82f6","#8b5cf6","#ec4899","#000000","#fca5a5","#fdba74","#fcd34d","#6ee7b7","#5eead4","#7dd3fc","#c4b5fd","#f9a8d4","#e5e7eb","#fee2e2","#ffedd5","#fef9c3","#dcfce7","#cffafe","#dbeafe","#ede9fe","#fce7f3","#f3f4f6","#f87171","#fb923c","#facc15","#4ade80","#22d3ee","#60a5fa","#a78bfa","#f472b6","#9ca3af","#b91c1c","#c2410c","#a16207","#15803d","#0e7490","#1d4ed8","#6d28d9","#be185d","#4b5563","#7f1d1d","#7c2d12","#713f12","#14532d","#164e63","#1e3a8a","#4c1d95","#831843","#1f2937"];function pr(t,e){const s=`<ul class="se-color-pallet${e?" se-list-horizontal":""}">`;let i=s;for(let n,o,l,r=0,a=t.length;r<a;r++)n=t[r],"string"==typeof n?(o=n,l=n):"object"==typeof n&&(o=n.value,l=n.name||o),r>0&&r%e==0&&(i+=`</ul>${s}`),i+=`<li><button type="button" data-value="${o}" title="${l}" aria-label="${l}" style="background-color:${o};"></button></li>`;return i+="</ul>",i}const gr=class{#J;constructor(t,e,s,i){this.#J=e,this.kind=t.constructor.key||t.constructor.name,this.host=t,this.form=i.form,this.target=function({lang:t,icons:e},{colorList:s,disableHEXInput:i,disableRemove:n,splitNum:o}){s||=ur,o=s===ur?9:o;let l="";for(let t,e=0,i=s.length,n=[];e<i;e++)t=s[e],t&&(("string"==typeof t||t.value)&&(n.push(t),e<i-1)||(n.length>0&&(l+=`<div class="se-selector-color">${pr(n,o)}</div>`,n=[]),"object"==typeof t&&(l+=`<div class="se-selector-color">${pr(t,o)}</div>`)));return l+=`\n\t\t<form class="se-form-group se-form-w0">\n\t\t\t${i?"":`<button type="button" class="se-btn __se_hue" title="${t.colorPicker}" aria-label="${t.colorPicker}">${e.color_palette}</button>`}\n\t\t\t<input type="text" class="se-color-input" ${i?"readonly":""} placeholder="${t.color}" />\n\t\t\t${i?"":`<button type="submit" class="se-btn se-btn-success" title="${t.submitButton}" aria-label="${t.submitButton}">${e.checked}</button>`}\n\t\t\t${n?"":`<button type="button" class="se-btn __se_remove" title="${t.remove}" aria-label="${t.remove}">${e.remove_color}</button>`}\n\t\t</form>`,Ie.utils.createElement("DIV",{class:"se-list-inner"},l)}(this.#J,i),this.targetButton=null,this.inputElement=this.target.querySelector(".se-color-input"),this.styleProperties=s,this.splitNum=i.splitNum||0,this.defaultColor=i.defaultColor||"",this.hueSliderOptions=i.hueSliderOptions,this.currentColor="",this.colorList=this.target.querySelectorAll("li button")||[],this.hueSlider=null;const n=(new DOMParser).parseFromString(this.#J.icons.color_checked,"image/svg+xml");this.checkedIcon=n.documentElement,i.disableHEXInput||(this.hueSlider=new dr(this,e,i.hueSliderOptions,"se-dropdown"),this.#J.eventManager.addEvent(this.target.querySelector(".__se_hue"),"click",this.#eh.bind(this)),this.#J.eventManager.addEvent(this.inputElement,"input",this.#sh.bind(this)),this.#J.eventManager.addEvent(this.target.querySelector("form"),"submit",this.#ih.bind(this))),i.disableRemove||this.#J.eventManager.addEvent(this.target.querySelector(".__se_remove"),"click",this.#nh.bind(this)),this.#J.eventManager.addEvent(this.target,"click",this.#oh.bind(this)),this.form.appendChild(this.target)}init(t,e,s){this.targetButton=e,"function"!=typeof s&&(s=()=>!1);let i=("string"==typeof t?t:this.#lh(t,s))||this.defaultColor;i=Be.isHexColor(i)?i:Be.rgb2hex(i)||i||"";const n=this.colorList;for(let t,e=0,s=n.length;e<s;e++)t=n[e],i.toLowerCase()===t.getAttribute("data-value").toLowerCase()?(t.appendChild(this.checkedIcon),Ie.utils.addClass(t,"active")):(Ie.utils.removeClass(t,"active"),t.contains(this.checkedIcon)&&Ie.utils.removeItem(this.checkedIcon));this.#rh(this.#ah(i))}setHexColor(t){this.currentColor=t,this.inputElement.style.borderColor=t}hueSliderClose(){this.hueSlider.close()}hueSliderAction(t){this.#rh(t.hex)}hueSliderCancelAction(){this.form.style.display="block",this.host.colorPickerHueSliderClose?.()}#rh(t){t=!t||/^#/.test(t)?t:"#"+t,this.inputElement.value=t,this.setHexColor.call(this,t)}#lh(t,e){let s="";const i=this.styleProperties;for(;t&&!e(t)&&!Ie.check.isWysiwygFrame(t)&&0===s.length;)W(t)&&t.style[i]&&(s=t.style[i]),t=t.parentNode;return s}#ah(t){if(!t||/^#/.test(t))return t;const e=Ie.utils.createElement("div",{style:"display: none; color: "+t}),s=Ne._w.getComputedStyle(Ne._d.body.appendChild(e)).color.match(/\d+/g).map((function(t){return parseInt(t,10)}));return Ie.utils.removeItem(e),s.length>=3?"#"+((1<<24)+(s[0]<<16)+(s[1]<<8)+s[2]).toString(16).substring(1):""}#eh(){this.hueSlider.open(this.targetButton),this.host.colorPickerHueSliderOpen?.()}#ih(t){t.preventDefault(),this.host.colorPickerAction?.(this.currentColor)}#oh(t){const e=Ie.query.getEventTarget(t).getAttribute("data-value");e&&this.host.colorPickerAction?.(e)}#nh(){this.host.colorPickerAction?.(null)}#sh(t){const e=Ie.query.getEventTarget(t);this.setHexColor(e.value)}},{_w:mr}=Ne,fr={w:"ns-resize",h:"ew-resize",c:"nwse-resize",wRTL:"ns-resize",hRTL:"ew-resize",cRTL:"nesw-resize"};const vr=class{#J;#hh;#ch;#dh;#uh;#do;#ke;#fo=null;#ph=!1;#gh=null;#mh=null;#fh="";#vh=0;#bh=0;#yh=null;#Ch=null;constructor(t,e,s){this.#J=e,this.inst=t,this.kind=t.constructor.key||t.constructor.name,this.form=s,this.isUpdate=!1,this.focusElement=s.querySelector("[data-focus]"),this.#ch=this.#J.contextProvider.carrierWrapper.querySelector(".se-modal"),this.#dh=this.#J.contextProvider.carrierWrapper.querySelector(".se-modal .se-modal-inner"),this.#do=[this.#wh.bind(this),this.#_h.bind(this)],this.#dh.appendChild(s),this.#J.eventManager.addEvent(s.querySelector("form"),"submit",this.#Ve.bind(this)),this.#ph=!this.#J.eventManager.addEvent(s.querySelector('[data-command="close"]'),"click",this.close.bind(this)),(s.querySelector(".se-modal-resize-handle-w")||s.querySelector(".se-modal-resize-handle-h")||s.querySelector(".se-modal-resize-handle-c")||s.querySelector(".se-modal-resize-form"))&&!(this.#uh=s.querySelector(".se-modal-resize-form"))&&(this.#uh=s.querySelector(".se-modal-body"))&&(this.#J.eventManager.addEvent(s.querySelector(".se-modal-resize-handle-w"),"mousedown",this.#xh.bind(this,"w")),this.#J.eventManager.addEvent(s.querySelector(".se-modal-resize-handle-h"),"mousedown",this.#xh.bind(this,"h")),this.#J.eventManager.addEvent(s.querySelector(".se-modal-resize-handle-c"),"mousedown",this.#xh.bind(this,"c")),this.#ke={mousemove:this.#$h.bind(this),mouseup:this.#kh.bind(this)})}static CreateFileInput({icons:t,lang:e},{acceptedFormats:s,allowMultiple:i}){return`\n\t\t<div class="se-modal-form-files">\n\t\t\t<div class="se-flex-input-wrapper">\n\t\t\t\t<div class="se-input-form-abs">\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<div class="se-input-file-w">\n\t\t\t\t\t\t\t<div class="se-input-file-icon-up">${t.upload_tray}</div>\n\t\t\t\t\t\t\t<div class="se-input-file-icon-files">${t.file_plus}</div>\n\t\t\t\t\t\t\t<span class="se-input-file-cnt"></span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<input class="se-input-form __se__file_input" data-focus type="file" accept="${s}"${i?' multiple="multiple"':""}/>\n\t\t\t</div>\n\t\t\t<button type="button" class="se-btn se-modal-files-edge-button se-file-remove se-tooltip" aria-label="${e.remove}">\n\t\t\t\t${t.selection_remove}\n\t\t\t\t${Ie.utils.createTooltipInner(e.remove)}\n\t\t\t</button>\n\t\t</div>`}static OnChangeFile(t,e){if(!t||!e)return;const s=t.querySelector(".se-input-file-cnt"),i=t.querySelector(".se-input-file-icon-up"),n=t.querySelector(".se-input-file-icon-files");e.length>1?(i.style.display="none",n.style.display="inline-block",s.style.display="",s.textContent=` ..${e.length}`):e.length>0?(i.style.display="none",n.style.display="none",s.style.display="block",s.textContent=e[0].name):(i.style.display="inline-block",n.style.display="none",s.style.display="",s.textContent="")}open(){if(this.#J.ui.offCurrentModal(),this.#Sh(!0),this.#ph&&(this.#gh&&this.#J.eventManager.removeEvent(this.#gh),this.#gh=this.#J.eventManager.addEvent(this.#dh,"click",this.#do[1])),this.#fo&&=this.#J.eventManager.removeGlobalEvent(this.#fo),this.#fo=this.#J.eventManager.addGlobalEvent("keydown",this.#do[0]),this.isUpdate=this.kind===this.#J.ui.currentControllerName,this.#J.ui.opendModal=this,this.isUpdate||this.inst.modalInit?.(),this.inst.modalOn?.(this.isUpdate),Ie.utils.addClass(this.#ch,"se-backdrop-show"),Ie.utils.addClass(this.form,"se-modal-show"),this.#ch.showPopover?.(),this.#uh){const t=this.#Eh(),{maxWidth:e,maxHeight:s}=mr.getComputedStyle(this.form),i=this.form.offsetWidth-t.width+"px",n=`${this.form.offsetTop+(this.form.offsetHeight-this.#uh.offsetHeight)}px`;e&&"string"==typeof this.#fh&&Ie.utils.setStyle(this.#uh,"max-width",`calc(${e} - ${i})`),s&&Ie.utils.setStyle(this.#uh,"max-height",`calc(${s} - ${n})`)}this.focusElement&&this.focusElement.focus(),this.#hh=this.#J.component.currentTarget}close(){this.#qe(),this.#Sh(!1),mr.setTimeout((()=>{this.#J.ui.opendModal=null}),0),this.#ph&&this.#gh&&(this.#J.eventManager.removeEvent(this.#gh),this.#gh=null),this.#fo&&=this.#J.eventManager.removeGlobalEvent(this.#fo),this.#ch.hidePopover?.(),Ie.utils.removeClass(this.#ch,"se-backdrop-show"),Ie.utils.removeClass(this.form,"se-modal-show"),this.inst.modalInit?.(),this.inst.modalOff?.(this.isUpdate),this.isUpdate?this.#hh&&this.inst.componentSelect?.(this.#hh):this.#J.focusManager.focus(),this.#hh=null}#Sh(t){const e=this.#J.ui.opendControllers;for(let s=0;s<e.length;s++)e[s].fixed=t,e[s].form.style.display=t?"none":"block"}#Eh(){const t=this.#J.offset.getGlobal(this.#uh);return this.#vh=t.top,this.#bh=t.left,t}#Pe(t){this.#qe(),this.#J.ui.enableBackWrapper(fr[t]),this.#yh=this.#J.eventManager.addGlobalEvent("mousemove",this.#ke.mousemove,!0),this.#Ch=this.#J.eventManager.addGlobalEvent("mouseup",this.#ke.mouseup,!0)}#qe(){this.#J.ui.disableBackWrapper(),this.#yh&&=this.#J.eventManager.removeGlobalEvent(this.#yh),this.#Ch&&=this.#J.eventManager.removeGlobalEvent(this.#Ch)}async#Ve(t){t.preventDefault(),t.stopPropagation(),this.#J.ui.showLoading();try{const t=await this.inst.modalAction();!1===t?this.#J.ui.hideLoading():void 0===t?this.close():(this.close(),this.#J.ui.hideLoading())}catch(t){throw this.close(),this.#J.ui.hideLoading(),Error(`[SUNEDITOR.Modal[${this.kind}].warn] ${t.message}`)}}#_h(t){const e=Ie.query.getEventTarget(t);(/close/.test(e.getAttribute("data-command"))||e===this.#dh)&&this.close()}#wh(t){Oe.isEsc(t.code)&&this.close()}#xh(t,e){this.#mh=Ie.query.getEventTarget(e),Ie.utils.addClass(this.#mh,"active"),this.#Pe(this.#fh=t+(this.#J.options.get("_rtl")?"RTL":""))}#$h(t){switch(this.#fh){case"w":case"wRTL":{const e=t.clientY-this.#vh-this.#uh.offsetHeight;this.#uh.style.height=this.#uh.offsetHeight+e+"px";break}case"h":{const e=t.clientX-this.#bh-this.#uh.offsetWidth;this.#uh.style.width=this.#uh.offsetWidth+e+"px";break}case"hRTL":{const e=this.#bh-t.clientX;this.#uh.style.width=this.#uh.offsetWidth+e+"px";break}case"c":{const e=t.clientX-this.#bh-this.#uh.offsetWidth,s=t.clientY-this.#vh-this.#uh.offsetHeight;this.#uh.style.width=this.#uh.offsetWidth+e+"px",this.#uh.style.height=this.#uh.offsetHeight+s+"px";break}case"cRTL":{const e=this.#bh-t.clientX,s=t.clientY-this.#vh-this.#uh.offsetHeight;this.#uh.style.width=this.#uh.offsetWidth+e+"px",this.#uh.style.height=this.#uh.offsetHeight+s+"px";break}}this.#Eh(),this.inst.modalResize?.()}#kh(){Ie.utils.removeClass(this.#mh,"active"),this.#mh=null,this.#qe()}};function br(t,e){const s=t.getAttribute(`data-se-${e}`);if(s)return s;const i=t.getAttribute(`data-${e}`);return i?(t.removeAttribute(`data-${e}`),t.setAttribute(`data-se-${e}`,i),i):null}const yr=class{#J;constructor(t,e,s){this.#J=e,t.__fileManagement=this,this.kind=t.constructor.key||t.constructor.name,this.inst=t,this.query=s.query,this.loadEventName=s.loadEventName,this.actionEventName=s.actionEventName,this.infoList=[],this.infoIndex=0,this.uploadFileLength=0,this.__updateTags=[],this.apiManager=new kl(this,e),this._resetInfo,this._checkInfo}upload(t,e,s,i,n){this.#J.ui.showLoading();let o=null;if("length"in s){o=new FormData;for(let t=0,e=s.length;t<e;t++)o.append("file-"+t,s[t]);this.uploadFileLength=s.length}else o=s.formData,this.uploadFileLength=s.size;this.apiManager.call({method:"POST",url:t,headers:e,data:o,callBack:i,errorCallBack:n})}async asyncUpload(t,e,s){this.#J.ui.showLoading();let i=null;if("length"in s){i=new FormData;for(let t=0,e=s.length;t<e;t++)i.append("file-"+t,s[t]);this.uploadFileLength=s.length}else i=s.formData,this.uploadFileLength=s.size;return await this.apiManager.asyncCall({method:"POST",url:t,headers:e,data:i})}setFileData(t,{name:e,size:s}){t&&(t.setAttribute("data-se-file-name",e),t.setAttribute("data-se-file-size",s+""))}getSize(){let t=0;for(let e=0,s=this.infoList.length;e<s;e++)t+=1*this.infoList[e].size;return t}_checkInfo(t){const e=[].slice.call(this.#J.frameContext.get("wysiwyg").querySelectorAll(this.query)),s=this.infoList;if(e.length===s.length){let t=!1;for(let i,n=0,o=s.length;n<o;n++)if(i=s[n],0===e.filter((function(t){return i.src===t.src&&i.index.toString()===br(t,"index")})).length){t=!0;break}if(!t)return}const i=[],n=[];for(let t=0,e=s.length;t<e;t++)n[t]=s[t].index;for(this.__updateTags=e;e.length>0;){const t=e.shift();br(t,"index")&&n.includes(Number(br(t,"index")))?i.push(Number(br(t,"index"))):(i.push(this.infoIndex),t.removeAttribute("data-se-index"),this.#Th(t,null))}if(t&&this.loadEventName)this.#J.eventManager.triggerEvent(this.loadEventName,{infoList:s});else for(let t,e=0;e<s.length;e++){if(t=s[e].index,i.includes(t))continue;s.splice(e,1);const n={element:null,index:t,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind};this.actionEventName&&this.#J.eventManager.triggerEvent(this.actionEventName,n),this.#J.eventManager.triggerEvent("onFileManagerAction",{...n,pluginName:this.kind}),e--}}_resetInfo(){const t={element:null,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind};for(let e=0,s=this.infoList.length;e<s;e++)this.actionEventName&&this.#J.eventManager.triggerEvent(this.actionEventName,{...t,index:this.infoList[e].index,pluginName:this.kind}),this.#J.eventManager.triggerEvent("onFileManagerAction",{...t,index:this.infoList[e].index,pluginName:this.kind});this.infoList=[],this.infoIndex=0}#Mh(t){if(t>=0)for(let e=0,s=this.infoList.length;e<s;e++)if(t===this.infoList[e].index)return this.infoList.splice(e,1),void(this.actionEventName&&this.#J.eventManager.triggerEvent(this.actionEventName,{element:null,index:t,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind}))}#Th(t,e){let s=Number(br(t,"index")),i=null,n="";if(e||={name:br(t,"file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:Number(br(t,"file-size"))||0},s&&this.#J.store._editorInitFinished){n="update",s*=1;for(let t=0,e=this.infoList.length;t<e;t++)if(s===this.infoList[t].index){i=this.infoList[t];break}i||(s=this.infoIndex++,i={index:s},this.infoList.push(i)),i.src=t.src,i.name=br(t,"file-name"),i.size=Number(br(t,"file-size"))}else n="create",s=this.infoIndex++,t.setAttribute("data-se-index",s+""),t.setAttribute("data-se-file-name",e.name),t.setAttribute("data-se-file-size",e.size+""),i={src:t.src,index:s,name:e.name,size:e.size},this.infoList.push(i);i.element=t,i.delete=function(t,e){this.inst.componentDestroy?.(e),t(Number(br(e,"index")))}.bind(this,this.#Mh.bind(this),t),i.select=function(t,e){e.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"});const s=t.get(e);s?t.select(s.target,s.pluginName):this.inst.componentSelect?.(e)}.bind(this,this.#J.component,t);const o={element:t,index:s,state:n,info:i,remainingFilesCount:--this.uploadFileLength<0?0:this.uploadFileLength,pluginName:this.kind};this.actionEventName&&this.#J.eventManager.triggerEvent(this.actionEventName,o),this.#J.eventManager.triggerEvent("onFileManagerAction",{...o,pluginName:this.kind})}},{_w:Cr,NO_EVENT:wr}=Ne;const _r=class{#J;#Hh;#Lh;#Nh;#Ah;constructor(t,e,s){this.#J=t,this.openNewWindow=!!s.openNewWindow,this.relList=Array.isArray(s.relList)?s.relList:[],this.defaultRel=s.defaultRel||{},this.noAutoPrefix=!!s.noAutoPrefix,s.enableFileUpload&&(this.uploadUrl="string"==typeof s.uploadUrl?s.uploadUrl:null,this.uploadHeaders=s.uploadHeaders||null,this.uploadSizeLimit=Ve.get(s.uploadSizeLimit,0)||null,this.uploadSingleSizeLimit=Ve.get(s.uploadSingleSizeLimit,0)||null,this.input=Ie.utils.createElement("input",{type:"file",accept:s.acceptedFormats||"*"}),this.#J.eventManager.addEvent(this.input,"change",this.#Bh.bind(this)),this.fileManager=new yr(this,t,{query:"a[download]:not([data-se-file-download])",loadEventName:"onFileLoad",actionEventName:"onFileAction"}));const i=function(t,e,s){const i=t.lang,n=t.icons,o=e.textToDisplay?"":'style="display: none;"',l=e.title?"":'style="display: none;"';let r=`\n\t\t<div class="se-modal-body">\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<label>${i.link_modal_url}</label>\n\t\t\t\t<div class="se-modal-form-files">\n\t\t\t\t\t<input data-focus class="se-input-form se-input-url" type="text" placeholder="${t.options.get("defaultUrlProtocol")||""}" />\n\t\t\t\t\t${e.enableFileUpload?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button _se_upload_button" aria-label="${i.fileUpload}">\n\t\t\t\t\t\t\t\t\t${n.file_upload}\n\t\t\t\t\t\t\t\t\t${Ie.utils.createTooltipInner(i.fileUpload)}\n\t\t\t\t\t\t\t\t</button>`:""}\n\t\t\t\t\t<button type="button" class="se-btn se-tooltip se-modal-files-edge-button _se_bookmark_button" aria-label="${i.link_modal_bookmark}">\n\t\t\t\t\t\t${n.bookmark}\n\t\t\t\t\t\t${Ie.utils.createTooltipInner(i.link_modal_bookmark)}\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t<div class="se-anchor-preview-form">\n\t\t\t\t\t<span class="se-svg se-anchor-preview-icon _se_anchor_bookmark_icon">${n.bookmark}</span>\n\t\t\t\t\t<span class="se-svg se-anchor-preview-icon _se_anchor_download_icon">${n.download}</span>\n\t\t\t\t\t<pre class="se-link-preview"></pre>\n\t\t\t\t</div>\n\t\t\t\t<label ${o}>${i.link_modal_text}</label>\n\t\t\t\t<input class="se-input-form _se_display_text" type="text" ${o} />\n\t\t\t\t<label ${l}>${i.title}</label>\n\t\t\t\t<input class="se-input-form _se_title" type="text" ${l} />\n\t\t\t</div>\n\t\t\t<div class="se-modal-form-footer">\n\t\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_anchor_check" />&nbsp;${i.link_modal_newWindowCheck}</label>\n\t\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_anchor_download" />&nbsp;${i.link_modal_downloadLinkCheck}</label>`;s.length>0&&(r+=`\n\t\t\t<div class="se-anchor-rel">\n\t\t\t\t<button type="button" class="se-btn se-tooltip se-anchor-rel-btn" title="${i.link_modal_relAttribute}" aria-label="${i.link_modal_relAttribute}">\n\t\t\t\t\t${n.link_rel}\n\t\t\t\t\t${Ie.utils.createTooltipInner(i.link_modal_relAttribute)}\n\t\t\t\t</button>\n\t\t\t\t<div class="se-anchor-rel-wrapper"><pre class="se-link-preview se-anchor-rel-preview"></pre></div>\n\t\t\t</div>\n\t\t</div>`);return r+="</div></div>",Ie.utils.createElement("DIV",null,r)}(t,s,this.relList);if(this.host=(Cr.location.origin+Cr.location.pathname).replace(/\/$/,""),this.urlInput=i.querySelector(".se-input-url"),this.displayInput=i.querySelector("._se_display_text"),this.titleInput=i.querySelector("._se_title"),this.newWindowCheck=i.querySelector("._se_anchor_check"),this.downloadCheck=i.querySelector("._se_anchor_download"),this.download=i.querySelector("._se_anchor_download_icon"),this.preview=i.querySelector(".se-link-preview"),this.bookmark=i.querySelector("._se_anchor_bookmark_icon"),this.bookmarkButton=i.querySelector("._se_bookmark_button"),this.currentRel=[],this.currentTarget=null,this.linkValue="",this.#Lh=this.relList.length>0,this.#Lh){this.relButton=i.querySelector(".se-anchor-rel-btn"),this.relPreview=i.querySelector(".se-anchor-rel-preview");const e=this.relList,s=(this.defaultRel.default||"").split(" "),n=[];for(let t,i=0,o=e.length;i<o;i++)t=e[i],n.push(Ie.utils.createElement("BUTTON",{type:"button",class:"se-btn-list"+(s.includes(t)?" se-checked":""),"data-command":t,title:t,"aria-label":t},t+'<span class="se-svg">'+this.#J.icons.checked+"</span>"));this.#Nh=new Ei(t,{checkList:!0,position:"right-middle",dir:"ltr"}),this.#Nh.on(this.relButton,this.#Ih.bind(this)),this.#Nh.create(n),this.#J.eventManager.addEvent(this.relButton,"click",this.#Vh.bind(this))}this.#Hh=e,this.#Hh.querySelector(".se-anchor-editor").appendChild(i),this.#Ah=new Ei(t,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.#Ah.on(this.urlInput,this.#Oh.bind(this)),this.#J.eventManager.addEvent(this.newWindowCheck,"change",this.#Rh.bind(this)),this.#J.eventManager.addEvent(this.downloadCheck,"change",this.#Ph.bind(this)),this.#J.eventManager.addEvent(this.urlInput,"input",this.#zh.bind(this)),this.#J.eventManager.addEvent(this.urlInput,"focus",this.#Fh.bind(this)),this.#J.eventManager.addEvent(this.bookmarkButton,"click",this.#Dh.bind(this)),this.#J.eventManager.addEvent(i.querySelector("._se_upload_button"),"click",(()=>this.input.click()))}set(t){this.currentTarget=t}on(t){if(t){if(this.currentTarget){const t=this.currentTarget.href;this.linkValue=this.preview.textContent=this.urlInput.value=this.#qh(t)?t.substring(t.lastIndexOf("#")):t,this.displayInput.value=this.currentTarget.textContent,this.titleInput.value=this.currentTarget.title,this.newWindowCheck.checked=!!/_blank/i.test(this.currentTarget.target),this.downloadCheck.checked=!!this.currentTarget.download}}else this.init(),this.displayInput.value=this.#J.selection.get().toString().trim(),this.newWindowCheck.checked=this.openNewWindow,this.titleInput.value="";this.#Wh(t&&this.currentTarget?this.currentTarget.rel:this.defaultRel.default||""),this.#Uh(this.linkValue)}create(t,e){const s=this.linkValue||e||"";if(0===s.length)return null;const i=0===this.displayInput.value.length?s:this.displayInput.value,n=this.currentTarget||Ie.utils.createElement("A");return this.#Zh(n,s,i,this.titleInput.value,t),this.linkValue=this.preview.textContent=this.urlInput.value=this.displayInput.value="",n}init(){this.currentTarget=null,this.linkValue=this.preview.textContent=this.urlInput.value="",this.displayInput.value="",this.newWindowCheck.checked=!1,this.downloadCheck.checked=!1,this.#Wh(this.defaultRel.default||"")}#Zh(t,e,s,i,n){!this.#qh(e)&&this.downloadCheck.checked?t.setAttribute("download",s||e):t.removeAttribute("download"),this.newWindowCheck.checked?t.target="_blank":t.removeAttribute("target");const o=this.currentRel.join(" ");o?t.rel=o:t.removeAttribute("rel"),t.href=e,i?t.title=i:t.removeAttribute("title"),n?0===t.children.length&&(t.textContent=""):t.textContent=s}#qh(t){const e=Cr.location.href.replace(/\/$/,"");return 0===t.indexOf("#")||0===t.indexOf(e)&&t.indexOf("#")===(e.includes("#")?e.substring(0,e.indexOf("#")).length:e.length)}#Wh(t){if(!this.#Lh)return;const e=this.currentRel=t?t.split(" "):[],s=this.#Nh.form.querySelectorAll("button");for(let t,i=0,n=s.length;i<n;i++)t=s[i].getAttribute("data-command"),e.includes(t)?Ie.utils.addClass(s[i],"se-checked"):Ie.utils.removeClass(s[i],"se-checked");this.relPreview.title=this.relPreview.textContent=e.join(" "),e.length>0?Ie.utils.addClass(this.relButton,"on"):Ie.utils.removeClass(this.relButton,"on")}#Gh(t){const e=Ie.query.getListChildren(this.#J.frameContext.get("wysiwyg"),(t=>/h[1-6]/i.test(t.nodeName)||Ie.check.isAnchor(t)&&!!t.id),null);if(0===e.length)return;const s=new RegExp(`^${t.replace(/^#/,"")}`,"i"),i=[],n=[];for(let t,o=0,l=e.length;o<l;o++)t=e[o],s.test(t.textContent)&&(i.push(t),n.push(Ie.check.isAnchor(t)?`<div><span class="se-text-prefix-icon">${this.#J.icons.bookmark_anchor}</span>${t.id}</div>`:`<div style="${t.style.cssText}">${t.textContent}</div>`));0===i.length?this.#Ah.close():(this.#Ah.create(i,n),this.#Ah.open(this.#J.options.get("_rtl")?"bottom-right":""))}#Uh(t){const e=this.preview,s=this.#J.options.get("defaultUrlProtocol"),i=this.noAutoPrefix,n=/^(mailto:|tel:|sms:|https*:\/\/|#)/.test(t)||0===t.indexOf(s),o=!!s&&RegExp("^"+Ae.escapeStringRegexp(t.substring(0,s.length))).test(s);t=this.linkValue=e.textContent=t?i?t:!s||n||o?n?t:/^www\./.test(t)?"http://"+t:this.host+(/^\//.test(t)?"":"/")+t:s+t:"",this.#qh(t)?(this.bookmark.style.display="block",Ie.utils.addClass(this.bookmarkButton,"active")):(this.bookmark.style.display="none",Ie.utils.removeClass(this.bookmarkButton,"active")),!this.#qh(t)&&this.downloadCheck.checked?this.download.style.display="block":this.download.style.display="none"}#jh(t){const e=this.currentRel;if(!t)return e.join(" ");if(/^only:/.test(t))return t=t.replace(/^only:/,"").trim(),this.currentRel=t.split(" "),t;const s=t.split(" ");for(let t=0,i=s.length;t<i;t++)e.includes(s[t])||e.push(s[t]);return e.join(" ")}#Kh(t){if(!t)return this.currentRel.join(" ");/^only:/.test(t)&&(t=t.replace(/^only:/,"").trim());const e=this.currentRel.join(" ").replace(RegExp(t+"\\s*"),"");return this.currentRel=e.split(" "),e}#Yh(t){const e=t.result[0];this.linkValue=this.preview.textContent=this.urlInput.value=e.url,this.displayInput.value=e.name,this.downloadCheck.checked=!0,this.download.style.display="block"}async#Xh(t){const e=await this.#J.eventManager.triggerEvent("onFileUploadError",{error:t});if(!1===e)return;const s=e===wr?t.errorMessage:e||t.errorMessage;this.#J.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.fileUpload.error]",s)}#Jh(t){const e=JSON.parse(t.responseText);e.errorMessage?this.#Xh(e):this.#Yh(e)}async#Bh(t){const e=Ie.query.getEventTarget(t).files;if(!e[0])return;const s={url:this.uploadUrl,uploadHeaders:this.uploadHeaders,files:e},i=async function(t,e,s){e=s||e;t(await this.fileManager.asyncUpload(e.url,e.uploadHeaders,e.files))}.bind(this,this.#Jh.bind(this),s),n=await this.#J.eventManager.triggerEvent("onFileUploadBefore",{info:s,handler:i});return void 0===n||!1!==n&&(null!==n&&"object"==typeof n&&i(n),void(!0!==n&&n!==wr||i(null)))}#Vh(){this.#Nh.open(this.#J.options.get("_rtl")?"left-middle":"")}#Oh(t){const e=t.id||"h_"+Math.random().toString().replace(/.+\./,"");t.id=e,this.urlInput.value="#"+e,this.#Uh(this.urlInput.value),this.#Ah.close(),this.urlInput.focus()}#Ih(t){const e=t.getAttribute("data-command");if(!e)return;const s=this.currentRel,i=s.indexOf(e);-1===i?s.push(e):s.splice(i,1),this.relPreview.title=this.relPreview.textContent=s.join(", ")}#zh(t){const e=Ie.query.getEventTarget(t).value.trim();this.#Uh(e),this.#qh(e)?this.#Gh(e):this.#Ah.close()}#Fh(){const t=this.urlInput.value;this.#qh(t)&&this.#Gh(t)}#Dh(){let t=this.urlInput.value;this.#qh(t)?(t=t.substring(1),this.bookmark.style.display="none",Ie.utils.removeClass(this.bookmarkButton,"active")):(t="#"+t,this.bookmark.style.display="block",Ie.utils.addClass(this.bookmarkButton,"active"),this.downloadCheck.checked=!1,this.download.style.display="none",this.#Gh(t)),this.urlInput.value=t,this.#Uh(t),this.urlInput.focus()}#Rh(t){if("string"!=typeof this.defaultRel.check_new_window)return;Ie.query.getEventTarget(t).checked?this.#Wh(this.#jh(this.defaultRel.check_new_window)):this.#Wh(this.#Kh(this.defaultRel.check_new_window))}#Ph(t){Ie.query.getEventTarget(t).checked?(this.download.style.display="block",this.bookmark.style.display="none",Ie.utils.removeClass(this.bookmarkButton,"active"),this.linkValue=this.preview.textContent=this.urlInput.value=this.urlInput.value.replace(/^#+/,""),"string"==typeof this.defaultRel.check_bookmark&&this.#Wh(this.#jh(this.defaultRel.check_bookmark))):(this.download.style.display="none","string"==typeof this.defaultRel.check_bookmark&&this.#Wh(this.#Kh(this.defaultRel.check_bookmark)))}},xr={init(t){return{create:(e,s)=>this.create(e,s,t)}},create(t,e,s){if("object"!=typeof e&&(e={}),s&&(e=[s,e].reduce(((t,e)=>(Object.entries(e).forEach((([e,s])=>{if("plugins"===e&&s&&t[e]){const i=Array.isArray(t[e])?t[e]:Object.values(t[e]),n=Array.isArray(s)?s:Object.values(s);t[e]=[...n.filter((t=>!i.includes(t))),...i]}else t[e]=s})),t)),{})),!t)throw Error('[SUNEDITOR.create.fail] The first parameter "target" is missing.');const i=[];if("string"==typeof t){const e=document.querySelector(t);if(!e)throw Error(`[SUNEDITOR.create.fail]-[document.querySelector(${t})] Cannot find target element. Make sure "${t}" is a valid selector and exists in the document.`);i.push({key:null,target:e})}else if(1===t.nodeType)i.push({key:null,target:t});else{let e;for(const s in t){if(e=t[s],!e.target||1!==e.target.nodeType)throw Error('[SUNEDITOR.create.fail] suneditor multi root requires textarea\'s element at the "target" property.');e.key=s,i.push(e)}}return new xl(i,e)}};class $r extends On{static type="";static key="";static className="";static options={};constructor(t){super(t),this.title="",this.icon="",this.inner=null,this.beforeItem=null,this.afterItem=null,this.replaceButton=null}}class kr extends $r{static type="browser";open(t){throw new Error(`[${this.constructor.name}] Abstract method 'open()' must be implemented`)}close(){throw new Error(`[${this.constructor.name}] Abstract method 'close()' must be implemented`)}}class Sr extends $r{static type="command";action(t){throw new Error(`[${this.constructor.name}] Abstract method 'action()' must be implemented`)}}class Er extends $r{static type="dropdown";on(t){}action(t){throw new Error(`[${this.constructor.name}] Abstract method 'action()' must be implemented`)}}class Tr extends $r{static type="dropdown-free";on(t){}off(){}}class Mr extends $r{static type="field"}class Hr extends $r{static type="input";toolbarInputKeyDown(t){}toolbarInputChange(t){}}class Lr extends $r{static type="modal";open(t){throw new Error(`[${this.constructor.name}] Abstract method 'open()' must be implemented`)}}class Nr extends $r{static type="popup";show(){throw new Error(`[${this.constructor.name}] Abstract method 'show()' must be implemented`)}}const Ar=class extends Sr{static key="blockquote";static className="";constructor(t){super(t),this.title=this.$.lang.tag_blockquote,this.icon="blockquote",this.quoteTag=Ie.utils.createElement("BLOCKQUOTE")}active(t,e){return/blockquote/i.test(t?.nodeName)?(Ie.utils.addClass(e,"active"),!0):(Ie.utils.removeClass(e,"active"),!1)}action(){const t=Ie.query.getParentElement(this.$.selection.getNode(),"blockquote");t?this.$.format.removeBlock(t,{selectedFormats:null,newBlockElement:null,shouldDelete:!1,skipHistory:!1}):this.$.format.applyBlock(this.quoteTag.cloneNode(!1))}},Br=["javascript","typescript","html","css","json","python","java","c","cpp","csharp","go","rust","ruby","php","swift","kotlin","sql","bash","markdown","xml","yaml"];class Ir extends Sr{static key="codeBlock";static className="";#Qh;#tc;#ec;#sc;#ic;#nc;#oc;#lc;#rc;constructor(t,e){if(super(t),this.title=this.$.lang.codeBlock||"Code Block",this.icon="code_block",this.#Qh=Ie.utils.createElement("PRE"),this.#ec=e?.langs??Br,!this.#ec.length)return;this.afterItem=Ie.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn",type:"button","data-command":Ir.key,"data-type":"dropdown"},`${this.$.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.codeLanguage||"Language"}</span></span>`);const s=function(t,e){const s=t.lang.codeLanguage_none||"None";let i='<div class="se-list-inner"><ul class="se-list-basic">';i+=`<li><button type="button" class="se-btn se-btn-list" data-command="codeBlock" data-value="" title="${s}">${s}</button></li>`;for(const t of e)i+=`<li><button type="button" class="se-btn se-btn-list" data-command="codeBlock" data-value="${t}" title="${t}">${t}</button></li>`;return i+="</ul></div>",Ie.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-code-block"},i)}(this.$,this.#ec);this.#tc=s.querySelectorAll("li button"),this.$.menu.initDropdownTarget({key:Ir.key,type:"dropdown"},s);const i=Ie.utils.createElement("DIV",{class:"se-controller se-code-lang"});this.#sc=Ie.utils.createElement("DIV",{class:"se-code-lang-button"}),this.#ac(""),i.appendChild(this.#sc),this.#nc=new ki(this,this.$,i,{position:"top",isWWTarget:!0}),this.#rc=Be.debounce((t=>{this.#lc=this.$.eventManager.removeEvent(this.#lc),t&&i.contains(t.relatedTarget)?this.#hc():this.#cc()}),0),this.#ic=new Ei(this.$,{position:"bottom-right",dir:this.$.options.get("_rtl")?"rtl":"ltr",maxHeight:"214px",minWidth:"132px",closeMethod:this.#rc}),this.#ic.on(this.#sc,this.#dc.bind(this)),this.#uc(""),this.$.eventManager.addEvent(this.#sc,"click",(t=>{if(t.preventDefault(),t.stopPropagation(),this.#ic.isOpen)this.#ic.close();else{const t=this.#pc(this.#oc);this.#uc(t);const e=this.#ic.items,s=t?e.indexOf(t):0;this.#ic.open(null,s>=0?`[data-index="${s}"]`:null)}}))}onMouseMove({event:t}){if(!this.#nc)return;const e=Ie.query.getEventTarget(t).closest("pre");e&&!this.#gc()&&0===this.$.ui.opendControllers.length&&this.#mc(e)}active(t,e){return/^PRE$/i.test(t?.nodeName)?(Ie.utils.addClass(e,"active"),!0):(Ie.utils.removeClass(e,"active"),!1)}action(t){const e=t?.getAttribute("data-value")||"",s=this.$.selection.getNode(),i=Ie.query.getParentElement(s,(t=>/^PRE$/i.test(t.nodeName)));if(i&&!e)this.$.format.setLine(Ie.utils.createElement(this.$.options.get("defaultLine")));else if(i||this.$.format.setBrLine(this.#Qh.cloneNode(!1)),e){const t=Ie.query.getParentElement(this.$.selection.getNode(),(t=>/^PRE$/i.test(t.nodeName)));t&&this.#fc(t,e)}this.$.menu.dropdownOff(),this.$.focusManager.focus(),this.$.history.push(!1)}on(){if(!this.#tc)return;const t=this.#pc(this.$.selection.getNode());for(let e=0,s=this.#tc.length;e<s;e++){const s=this.#tc[e];Ie.utils.toggleClass(s,"active",s.getAttribute("data-value")===t)}}#mc(t){this.#oc===t&&this.#nc.isOpen||(this.#oc&&this.#oc!==t&&Ie.utils.removeClass(this.#oc,"se-pre-code-focus"),this.#oc=t,Ie.utils.addClass(t,"se-pre-code-focus"),this.#nc.open(t,null,{passive:!0,addOffset:{right:t.offsetWidth}}),this.#ac(this.#pc(t)),this.#vc())}#cc(){this.#ic?.isOpen||this.#bc()}#bc(){this.#ic?.isOpen&&this.#ic.close(),Ie.utils.removeClass(this.#oc,"se-pre-code-focus"),this.#nc.close(!0)}controllerClose(){this.#oc&&(Ie.utils.removeClass(this.#oc,"se-pre-code-focus"),this.#oc=null)}#dc(t){this.#oc&&(this.#fc(this.#oc,t),this.#ac(t),this.#ic.close(),this.#cc(),this.$.focusManager.focus(),this.$.history.push(!1))}#vc(){this.#lc??=this.$.eventManager.addEvent(this.#oc,"mouseleave",this.#rc)}#hc(){this.#lc??=this.$.eventManager.addEvent(this.#nc.form,"mouseleave",this.#rc)}#uc(t){const e=this.$.lang.codeLanguage_none||"None",s=t&&!this.#ec.includes(t),i=s?["",t,...this.#ec]:["",...this.#ec],n=s?[e,t,...this.#ec]:[e,...this.#ec];this.#ic.create(i,n)}#ac(t){this.#sc.innerHTML=`<span class="se-code-lang-icon">&lt;/&gt;</span><span class="se-code-lang-text">${t||this.$.lang.codeLanguage||"Language"}</span>`}#gc(){return this.#ic?.isOpen||this.#nc?.isOpen}#pc(t){const e="PRE"===t?.nodeName?t:Ie.query.getParentElement(t,(t=>/^PRE$/i.test(t.nodeName)));return e&&e.className.match(/language-(\S+)/)?.[1]||""}#fc(t,e){t.className=t.className.replace(/\s*language-\S+/g,"").trim(),e?(Ie.utils.addClass(t,"language-"+e),t.setAttribute("data-se-lang",e)):t.removeAttribute("data-se-lang")}destroy(){this.#oc&&Ie.utils.removeClass(this.#oc,"se-pre-code-focus"),this.#nc?.form?.parentNode?.removeChild(this.#nc.form),this.#oc=null}}const Vr=Ir,{_w:Or,_d:Rr}=Ne;const Pr=class extends Sr{static key="exportPDF";static className="se-component-enabled";constructor(t,e){super(t),this.title=this.$.lang.exportPDF,this.icon="PDF",this.apiUrl=e.apiUrl,this.fileName=e.fileName||"suneditor-pdf",this.apiUrl?this.apiManager=new kl(this,this.$,{method:"POST",url:this.apiUrl,headers:{"Content-Type":"application/json"},responseType:"blob"}):console.warn('[SUNEDITOR.plugins.exportPDF.error] Requires exportPDF."apiUrl" options.')}async action(){if(!this.apiUrl)return void console.warn('[SUNEDITOR.plugins.exportPDF.error] Requires exportPDF."apiUrl" options.');this.$.ui.showLoading();let t=null;try{const e=this.$.frameContext.get("documentTypePageMirror")||this.$.frameContext.get("wysiwygFrame"),s=(this.$.options.get("_themeClass")||"").trim(),i=s?e.className.replace(s,"").trim():e.className,n=Ie.utils.createElement("div",{class:i},e.innerHTML);t=Ie.utils.createElement("div",{style:"position: absolute; top: -10000px; left: -10000px; width: 21cm; columns: 21cm; height: auto;"},n);const o=Or.getComputedStyle(e).padding,l=Ie.utils.applyInlineStylesAll(n,!0,this.$.options.get("allUsedStyles"));if(l.style.padding=l.style.paddingTop=l.style.paddingBottom=l.style.paddingLeft=l.style.paddingRight="0",t.innerHTML=`\n\t\t\t\t<style>\n\t\t\t\t\t@page {\n\t\t\t\t\t\tsize: A4;\n\t\t\t\t\t\tmargin: ${o};\n\t\t\t\t\t}\n\t\t\t\t</style>\n\t\t\t\t${l.outerHTML}`,Rr.body.appendChild(t),!1===await this.$.eventManager.triggerEvent("onExportPDFBefore",{target:t}))return;return void await this.#yc(t)}catch(t){console.error("[SUNEDITOR.plugins.exportPDF.error]",t.message)}finally{Ie.utils.removeItem(t),this.$.ui.hideLoading()}}async#yc(t){const e={fileName:this.fileName,htmlContent:t.innerHTML},s=await this.apiManager.asyncCall({data:JSON.stringify(e)});if(200!==s.status){let t;try{t=JSON.parse(s.responseText).errorMessage}catch{}throw Error(`[SUNEDITOR.plugins.exportPDF.error] ${t||s.statusText}`)}const i=new Blob([s.response],{type:"application/pdf"}),n=s.getResponseHeader("Content-Disposition"),o=URL.createObjectURL(i),l=(n.match(/filename="([^"]+)/)||[])[1]||this.fileName+".pdf",r=Ie.utils.createElement("A",{href:o,download:l,style:"display: none;"},null);try{Rr.body.appendChild(r),r.click()}finally{Or.setTimeout((()=>{Ie.utils.removeItem(r),URL.revokeObjectURL(o)}),100)}}},{NO_EVENT:zr}=Ne;class Fr extends Sr{static key="fileUpload";static className="";static options={eventIndex:1e4};static component(t){return Ie.check.isAnchor(t)&&t.hasAttribute("data-se-file-download")?t:null}#Cc;#wc=null;constructor(t,e){super(t),this.title=this.$.lang.fileUpload,this.icon="file_upload",e.uploadUrl||console.warn('[SUNEDITOR.fileUpload.warn] "fileUpload" plugin must be have "uploadUrl" option.'),this.uploadUrl=e.uploadUrl,this.uploadHeaders=e.uploadHeaders,this.uploadSizeLimit=Ve.get(e.uploadSizeLimit,0),this.uploadSingleSizeLimit=Ve.get(e.uploadSingleSizeLimit,0),this.allowMultiple=!!e.allowMultiple,this.acceptedFormats="string"!=typeof e.acceptedFormats?"*":e.acceptedFormats.trim()||"*",this.as=e.as||"box",this.insertBehavior=e.insertBehavior,this.input=Ie.utils.createElement("input",{type:"file",accept:this.acceptedFormats}),this.allowMultiple&&this.input.setAttribute("multiple","multiple"),this.#Cc=this.acceptedFormats.split(", ");const s={"custom-download":{command:"download",title:this.$.lang.download,icon:"download",action:t=>{const e=t.getAttribute("href");e&&Ie.utils.createElement("A",{href:e},null).click()}},"custom-as":{command:"as",value:"link",title:this.$.lang.asLink,icon:"reduction",action:(t,e)=>{this.convertFormat(t,e)}}},i=(e.controls||[["custom-as","align","edit","custom-download","copy","remove"]]).map((t=>t.map((t=>t.startsWith("custom-")?s[t]:t))));if(this.figure=new Pi(this,this.$,i,{}),this.fileManager=new yr(this,this.$,{query:"a[download][data-se-file-download]",loadEventName:"onFileLoad",actionEventName:"onFileAction"}),/\bedit\b/.test(JSON.stringify(i))){const t=function({lang:t,icons:e}){const s=`\n\t\t<div class="se-arrow se-arrow-up"></div>\n\t\t<form>\n\t\t\t<div class="se-btn-group se-form-group">\n\t\t\t\t<input type="text" />\n\t\t\t\t<button type="submit" data-command="edit" class="se-btn se-tooltip se-btn-success">\n\t\t\t\t\t${e.checked}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.save}</span></span>\n\t\t\t\t</button>\n\t\t\t\t<button type="button" data-command="cancel" class="se-btn se-tooltip se-btn-danger">\n\t\t\t\t\t${e.cancel}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.cancel}</span></span>\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</form>\n\t\t`;return Ie.utils.createElement("DIV",{class:"se-controller se-controller-simple-input"},s)}(this.$);this.controller=new ki(this,this.$,t,{position:"bottom",disabled:!0},Fr.key),this.editInput=t.querySelector("input")}this.$.eventManager.addEvent(this.input,"change",this.#Bh.bind(this))}action(){this.$.store.set("_preventBlur",!0),this.input.click()}onFilePasteAndDrop({file:t}){const e=t.type;this.#Cc.some((t=>!!t.startsWith("*")||(!!t.startsWith(e)||void 0)))&&(this.submitFile([t]),this.$.focusManager.focus())}controllerAction(t){const e=t.getAttribute("data-command");if(e){if("edit"===e){if(0===this.editInput.value.trim().length)return;this.#wc.textContent=this.editInput.value}this.controller.close(),this.$.component.select(this.#wc,Fr.key)}}componentSelect(t){this.#wc=t;const e=this.figure.controller.form.querySelector('[data-command="__c__as"]');if(e)return Ie.check.isFigure(t.parentElement)?(e.innerHTML=this.$.icons.reduction+Ie.utils.createTooltipInner(this.$.lang.asLink),e.setAttribute("data-value","link"),void this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,infoOnly:!1})):(e.innerHTML=this.$.icons.expansion+Ie.utils.createTooltipInner(this.$.lang.asBlock),e.setAttribute("data-value","box"),this.figure.controllerOpen(t,{isWWTarget:!0}),!0)}componentEdit(t){this.editInput.value=t.textContent,this.figure.controllerHide(),this.controller.open(t,null,{isWWTarget:!Ie.check.isFigure(t.parentElement),initMethod:null,addOffset:null}),this.editInput.focus()}async componentDestroy(t){if(!t)return;const e=Pi.GetContainer(t),s=Ie.query.getParentElement(t,".se-component")||t;if(!1===await this.$.eventManager.triggerEvent("onFileDeleteBefore",{element:e.target,container:e,url:e.target.getAttribute("href")}))return;const i=this.$.component.isInline(s)?s.previousSibling||s.nextSibling:s.previousElementSibling||s.nextElementSibling;Ie.utils.removeItem(s),this.$.ui.offCurrentController(),this.$.focusManager.focusEdge(i),this.$.history.push(!1)}async submitFile(t){if(0===t.length)return;let e=0;const s=[],i=this.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++){if(n=t[l],o=n.size,i>0&&o>i){const t="[SUNEDITOR.fileUpload.fail] Size of uploadable single file: "+i/1e3+"KB",e=await this.$.eventManager.triggerEvent("onFileUploadError",{error:t,limitSize:i,uploadSize:o,file:n});return this.$.ui.alertOpen(e===zr?t:e||t,"error"),!1}s.push(n),e+=o}const n=this.uploadSizeLimit,o=this.fileManager.getSize();if(n>0&&e+o>n){const t="[SUNEDITOR.fileUpload.fail] Size of uploadable total files: "+n/1e3+"KB",s=await this.$.eventManager.triggerEvent("onFileUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.$.ui.alertOpen(s===zr?t:s||t,"error"),!1}const l={url:this.uploadUrl,uploadHeaders:this.uploadHeaders,files:s},r=async function(t,e,s){e=s||e;t(await this.fileManager.asyncUpload(e.url,e.uploadHeaders,e.files))}.bind(this,this.#Jh.bind(this),l),a=await this.$.eventManager.triggerEvent("onFileUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==zr||r(null)))}convertFormat(t,e){if("link"===e){this.figure.close();const{container:e}=Pi.GetContainer(t),s=e.nextElementSibling,i=e.parentElement;t.removeAttribute("data-se-non-focus"),t.setAttribute("contenteditable","false"),Ie.utils.addClass(t,"se-component|se-inline-component");const n=Ie.utils.createElement(this.$.options.get("defaultLine"),null,t);i.insertBefore(n,s),Ie.utils.removeItem(e)}else{this.$.selection.setRange(t,0,t,1);const e=this.$.html.remove(),s=this.$.nodeTransform.split(e.container,e.offset,0);s?.previousElementSibling&&Ie.check.isZeroWidth(s.previousElementSibling)&&Ie.utils.removeItem(s.previousElementSibling),t.setAttribute("data-se-non-focus","true"),t.removeAttribute("contenteditable"),Ie.utils.removeClass(t,"se-component|se-component-selected|se-inline-component");const i=Pi.CreateContainer(t,"se-file-figure se-flex-component");(s||e.container).parentElement.insertBefore(i.container,s)}this.$.history.push(!1),this.$.component.select(t,Fr.key)}create(t,e,s){const i=e.name||t,n=Ie.utils.createElement("A",{href:t,title:i,download:i,"data-se-file-download":"",contenteditable:"false","data-se-non-focus":"true","data-se-non-link":"true"},i);if(this.fileManager.setFileData(n,e),"link"===this.as)return n.className="se-component se-inline-component",void this.$.component.insert(n,{scrollTo:!!s,insertBehavior:s?this.insertBehavior:null});const o=Pi.CreateContainer(n);if(Ie.utils.addClass(o.container,"se-file-figure|se-flex-component"),this.$.component.insert(o.container,{scrollTo:!!s,insertBehavior:s?this.insertBehavior:null})){if(s)if(this.$.options.get("componentInsertBehavior"))this.$.component.select(n,Fr.key);else{const t=this.$.format.addLine(o.container,null);t&&this.$.selection.setRange(t,0,t,0)}}else this.$.focusManager.focus()}#Yh(t){t.result.forEach(((t,e,s)=>{this.create(t.url,{name:t.name,size:t.size},e===s.length-1)}))}async#Xh(t){const e=await this.$.eventManager.triggerEvent("onFileUploadError",{error:t});if(!1===e)return;const s=e===zr?t.errorMessage:e||t.errorMessage;this.$.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.fileUpload.error]",s)}#Jh(t){const e=JSON.parse(t.responseText);e.errorMessage?this.#Xh(e):this.#Yh(e)}async#Bh(t){const e=Ie.query.getEventTarget(t);await this.submitFile(e.files)}}const Dr=Fr;class qr extends Sr{static key="list_bulleted";static className="se-icon-flip-rtl";#_c;constructor(t){super(t),this.title=this.$.lang.bulletedList,this.icon="list_bulleted",this.afterItem=Ie.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn",type:"button","data-command":qr.key,"data-type":"dropdown"},`${this.$.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.bulletedList}</span></span>`);const e=function(){const t=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic se-list-horizontal se-list-carrier">\n\t\t\t${e=["disc","circle","square"],e.map((t=>`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-icon-flip-rtl" data-command="${t}" title="${t}" aria-label="${t}">\n\t\t\t\t\t<ul style="list-style-type: ${t};">\n\t\t\t\t\t\t<li></li><li></li><li></li>\n\t\t\t\t\t</ul>\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t`)).join("")}\n\t\t</ul>\n\t</div>`;var e;return Ie.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.#_c=e.querySelectorAll("li button ul"),this.$.menu.initDropdownTarget({key:qr.key,type:"dropdown"},e)}active(t,e){return Ie.check.isListCell(t)&&/^UL$/i.test(t.parentElement.nodeName)?(Ie.utils.addClass(e,"active"),!0):(Ie.utils.removeClass(e,"active"),!1)}action(t){const e=this.$.format.getBlock(this.$.selection.getNode()),s=t?.querySelector("ul")?.style.listStyleType;Ie.check.isList(e)&&s?e.style.listStyleType=s:this.submit(s),this.$.menu.dropdownOff()}on(){const t=this.#_c,e=this.$.format.getBlock(this.$.selection.getNode()),s=e?.style?e.style.listStyleType||"disc":"";for(let e,i=0,n=t.length;i<n;i++)e=t[i],s===e.style.listStyleType?Ie.utils.addClass(e.parentElement,"active"):Ie.utils.removeClass(e.parentElement,"active")}shortcut({range:t,info:e}){const{startContainer:s}=t;if(Ie.check.isText(s)){const t=s.substringData(e.key.length,s.textContent.length-1);s.textContent=t}this.submit()}submit(t){const e=this.$.listFormat.apply(`ul:${t||""}`,null,!1);e&&this.$.selection.setRange(e.sc,e.so,e.ec,e.eo),this.$.focusManager.focus(),this.$.history.push(!1)}}const Wr=qr;class Ur extends Sr{static key="list_numbered";static className="se-icon-flip-rtl";#_c;constructor(t){super(t),this.title=this.$.lang.numberedList,this.icon="list_numbered",this.afterItem=Ie.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn",type:"button","data-command":Ur.key,"data-type":"dropdown"},`${this.$.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.numberedList}</span></span>`);const e=function(){const t=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic se-list-horizontal se-list-carrier">\n\t\t\t${Zr(["decimal","upper-roman","lower-roman"])}\n\t\t</ul>\n\t\t<ul class="se-list-basic se-list-horizontal se-list-carrier">\n\t\t${Zr(["lower-latin","upper-latin","lower-greek"])}\n\t\t</ul>\n\t</div>`;return Ie.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.#_c=e.querySelectorAll("li button ol"),this.$.menu.initDropdownTarget({key:Ur.key,type:"dropdown"},e)}active(t,e){return Ie.check.isListCell(t)&&/^OL$/i.test(t.parentElement.nodeName)?(Ie.utils.addClass(e,"active"),!0):(Ie.utils.removeClass(e,"active"),!1)}action(t){const e=this.$.format.getBlock(this.$.selection.getNode()),s=t?.querySelector("ol")?.style.listStyleType;Ie.check.isList(e)&&s?e.style.listStyleType=s:this.submit(s),this.$.menu.dropdownOff()}on(){const t=this.#_c,e=this.$.format.getBlock(this.$.selection.getNode()),s=e?.style?e.style.listStyleType||"decimal":"";for(let e,i=0,n=t.length;i<n;i++)e=t[i],s===e.style.listStyleType?Ie.utils.addClass(e.parentElement,"active"):Ie.utils.removeClass(e.parentElement,"active")}shortcut({range:t,info:e}){const{startContainer:s}=t;if(Ie.check.isText(s)){const t=s.substringData(e.key.length,s.textContent.length-1);s.textContent=t}this.submit()}submit(t){const e=this.$.listFormat.apply(`ol:${t||""}`,null,!1);e&&this.$.selection.setRange(e.sc,e.so,e.ec,e.eo),this.$.focusManager.focus(),this.$.history.push(!1)}}function Zr(t){return t.map((t=>`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-icon-flip-rtl" data-command="${t}" title="${t}" aria-label="${t}">\n\t\t\t\t\t<ol style="list-style-type: ${t};">\n\t\t\t\t\t\t<li></li><li></li><li></li>\n\t\t\t\t\t</ol>\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t`)).join("")}const Gr=Ur,{debounce:jr}=Be;function Kr(t){return`<div class="se-autocomplete-item"><span>${t.key}</span>${t.name?`<span>${t.name}</span>`:""}</div>`}function Yr(t,e){return{tag:"span",attrs:{"data-se-autocomplete":e+t.key},text:e+t.key}}const Xr=class extends Mr{static key="autocomplete";static className="";#xc=0;#$c=0;#kc=null;#Sc=null;constructor(t,e){super(t);const s=e.limitSize||5,i=e.searchStartLength||0,n="number"==typeof e.delayTime?e.delayTime:120,o=e.useCachingData??!0,l=e.useCachingFieldData??!0;this.triggerContexts=new Map;const r=e.triggers||{};for(const[t,e]of Object.entries(r)){const n=e.limitSize??s;this.triggerContexts.set(t,{trigger:t,limitSize:n,searchStartLength:e.searchStartLength??i,directData:e.data||null,apiUrl:e.apiUrl?.replace(/\s/g,"").replace(/\{limitSize\}/i,String(n))||"",apiHeaders:e.apiHeaders||null,transformResponse:e.transformResponse||null,renderItem:e.renderItem||Kr,onSelect:e.onSelect||Yr,apiManager:e.apiUrl?new kl(this,this.$,{headers:e.apiHeaders}):null,cachingData:e.useCachingData??o?new Map:null,cachingFieldData:e.useCachingFieldData??l?[]:null})}this.sortedTriggers=[...this.triggerContexts.keys()].sort(((t,e)=>e.length-t.length));const a=Ie.utils.createElement("DIV",{class:"se-controller se-empty-controller"},"<div></div>");this.selectMenu=new Ei(this.$,{position:"right-bottom",dir:"ltr",closeMethod:()=>this.controller.close()}),this.controller=new ki(this,this.$,a,{position:"bottom",initMethod:()=>{this.#Ec(),this.selectMenu.close()}},null),this.selectMenu.on(a.firstElementChild,this.#Tc.bind(this)),this.onInput=jr(this.onInput.bind(this),n)}#Ec(){this.#Sc?.apiManager&&this.#Sc.apiManager.cancel()}async onInput(){this.#Ec();const t=this.$.selection.get();if(!t.rangeCount)return void this.selectMenu.close();const e=t.anchorNode,s=t.anchorOffset,i=e.textContent.substring(0,s);for(const t of this.sortedTriggers){const n=i.lastIndexOf(t);if(-1===n)continue;const o=i.substring(n+t.length,s),l=i[n-1]?.trim();if(!/\s/.test(o)&&(!l||Ie.check.isZeroWidth(l))){const i=this.triggerContexts.get(t);if(o.length<i.searchStartLength)return;const l=e.parentNode;if(Ie.check.isAnchor(l)&&!l.getAttribute("data-se-autocomplete"))return;try{return this.#Sc=i,await this.#Mc(i,o,e),this.#xc=n,this.#kc=e,void(this.#$c=s)}catch(t){console.warn("[SUNEDITOR.autocomplete.api] ",t)}}}this.selectMenu.close()}async#Mc(t,e,s){const i=t.limitSize,n=e.toLowerCase();let o=null;if(t.cachingData&&(o=t.cachingData.get(e)),!o)if(t.directData)o=t.directData.filter((t=>t.key.toLowerCase().startsWith(n))).slice(0,i);else{const s=await t.apiManager.asyncCall({method:"GET",url:this.#Hc(t,e)}),i=JSON.parse(s.responseText);o=t.transformResponse?t.transformResponse(i,s):i}if(t.cachingFieldData){const e=new Set;o=t.cachingFieldData.concat(o).filter((({key:t})=>!e.has(t)&&(e.add(t),t.toLowerCase().startsWith(n)))).slice(0,i)}if(!o?.length)return this.selectMenu.close(),!1;const l=[],r=[];for(let e,s=0,i=o.length;s<i;s++)e=o[s],l.push(e),r.push(t.renderItem(e,t.trigger));return this.controller.open(s,null,{isWWTarget:!0,initMethod:null,addOffset:null}),this.selectMenu.create(l,r),this.selectMenu.open(),this.selectMenu.setItem(0),t.cachingData&&t.cachingData.set(e,l),!0}#Hc(t,e){return t.apiUrl.replace(/\{key\}/i,e)}#Tc(t){if(!t)return!1;const e=this.#Sc;if(!e)return!1;const s=e.onSelect(t,e.trigger);let i=null;const n=this.#kc.parentNode;if("string"==typeof s){if(this.$.selection.setRange(this.#kc,this.#xc,this.#kc,this.#$c),i=Ie.utils.createTextNode(s),!this.$.html.insertNode(i,{afterNode:null,skipCharCount:!1}))return!1}else{let t;if(s?.nodeType)t=s;else{if(!s?.tag)return!1;t=Ie.utils.createElement(s.tag.toUpperCase(),s.attrs||{},s.text||"")}if(n.getAttribute?.("data-se-autocomplete")){for(const t of[...n.attributes])n.removeAttribute(t.name);for(const e of[...t.attributes])n.setAttribute(e.name,e.value);n.textContent=t.textContent,i=n}else{if(this.$.selection.setRange(this.#kc,this.#xc,this.#kc,this.#$c),!this.$.html.insertNode(t,{afterNode:null,skipCharCount:!1}))return!1;i=t}}this.selectMenu.close();const o=Ie.utils.createTextNode(" ");i.parentNode.insertBefore(o,i.nextSibling),this.$.selection.setRange(o,1,o,1),e.cachingFieldData&&!e.cachingFieldData.some((e=>e.key===t.key))&&e.cachingFieldData.push(t)}},{debounce:Jr}=Be;const Qr=class extends Mr{static key="slashCommand";static className="";#Lc;#Nc;#Ac;#Dr;#xc=0;#$c=0;#kc=null;#Bc=!1;constructor(t,e){super(t),this.#Lc="string"==typeof e.triggerChar&&e.triggerChar.length>0?e.triggerChar:"/",this.#Nc="number"==typeof e.limitSize&&e.limitSize>0?e.limitSize:10,this.#Ac="string"==typeof e.emptyMessage?e.emptyMessage:"";const s="number"==typeof e.delayTime?e.delayTime:120;this.#Dr=new ln(this,this.$,{items:Array.isArray(e.items)?e.items:[],resolveButton:as,renderCustomItem:"function"==typeof e.renderItem?e.renderItem:null,selectMenuParams:{position:"bottom-left",dir:"ltr",minWidth:"200px",maxHeight:"320px",closeMethod:()=>this.#Ic()}});const i=Ie.utils.createElement("DIV",{class:"se-controller se-empty-controller"},"<div></div>");this.controller=new ki(this,this.$,i,{position:"bottom",escGuard:()=>this.#Dr.hasOpenSubPanel()},null),this.#Dr.attach(i.firstElementChild,this.#Tc.bind(this),{class:"se-block-action-menu se-slash-command-menu"}),this.onInput=Jr(this.onInput.bind(this),s)}onKeyDown({event:t}){Oe.isEsc(t.code)&&this.onInput.cancel?.()}onInput(){if(0===this.#Dr.getItems().length)return;const t=this.$.selection.get();if(!t.rangeCount)return void this.#Vc();const e=t.anchorNode,s=t.anchorOffset;if(!e||"string"!=typeof e.textContent)return void this.#Vc();const i=e.textContent.substring(0,s),n=this.#Lc,o=i.lastIndexOf(n);if(-1===o)return void this.#Vc();const l=i.substring(o+n.length,s);if(/\s/.test(l))return void this.#Vc();const r=i[o-1];if(r&&""!==r.trim()&&!Ie.check.isZeroWidth(r))return void this.#Vc();const a=this.#Dr.filter(l,this.#Nc);0!==a.length?(this.controller.open(e,null,{isWWTarget:!0,initMethod:null,addOffset:null}),this.#Dr.createRows(a),this.#Dr.open(),this.#Dr.setItem(0),this.#Oc(e,o,s)):this.#Ac?(this.#Rc(e),this.#Oc(e,o,s)):this.#Vc()}#Vc(){this.#Bc=!0,this.#Dr.close(),this.#Bc=!1}#Ic(){this.#Bc||this.#Pc(),this.#kc=null,this.controller.close()}#Pc(){const t=this.#kc;if(!t||!t.parentNode)return;if(t.textContent?.[this.#xc]!==this.#Lc)return;this.$.selection.setRange(t,this.#xc,t,this.#$c);const e=this.$.selection.getRange();e&&!e.collapsed&&this.$.html.remove()}#Oc(t,e,s){this.#kc=t,this.#xc=e,this.#$c=s}#Rc(t){this.controller.open(t,null,{isWWTarget:!0,initMethod:null,addOffset:null}),this.#Dr.selectMenu.create([null],[`<span class="se-slash-empty">${this.#Ac}</span>`]),this.#Dr.open()}#Tc(t){if(!t)return!1;const e=this.#kc;if(!e)return!1;const s=this.#Lc,i=e.textContent.substring(this.#xc+s.length,this.#$c);this.$.selection.setRange(e,this.#xc,e,this.#$c);const n=this.$.selection.getRange();n&&!n.collapsed&&this.$.html.remove(),this.#Vc(),this.#Dr.dispatch(t,{triggerChar:s,query:i,item:t.raw})}};class ta extends Er{static key="align";static className="";constructor(t,e){super(t),this.title=this.$.lang.align,this.icon=this.$.options.get("_rtl")?"align_right":"align_left",this.defaultDir="",this.alignIcons={justify:this.$.icons.align_justify,left:this.$.icons.align_left,right:this.$.icons.align_right,center:this.$.icons.align_center};const s=this.$.menu.initDropdownTarget(ta,function({lang:t,icons:e,options:s},i){return(Array.isArray(i)?i:s.get("_rtl")?["right","center","left","justify"]:["left","center","right","justify"]).map((s=>{const i=t["align"+s.charAt(0).toUpperCase()+s.slice(1)];return{command:s,title:i,innerHTML:`<span class="se-list-icon">${e["align_"+s]}</span>${i}`}}))}(this.$,e.items),{className:"se-list-align"});this._itemMenu=s.querySelector("ul"),this.alignList=s.querySelectorAll("li button")}active(t,e){const s=e.firstElementChild;if(t){if(this.$.format.isLine(t)){const i=t.style.textAlign;return i?(Ie.utils.changeElement(s,this.alignIcons[i]||this.alignIcons[this.defaultDir]),e.setAttribute("data-focus",i),!0):void 0}}else Ie.utils.changeElement(s,this.alignIcons[this.defaultDir]),e.removeAttribute("data-focus");return!1}on(t){const e=t.getAttribute("data-focus")||this.defaultDir;if(!e)return;const s=this.alignList;for(let t=0,i=s.length;t<i;t++)e===s[t].getAttribute("data-command")?Ie.utils.addClass(s[t],"active"):Ie.utils.removeClass(s[t],"active")}action(t){const e=t.getAttribute("data-command");if(!e)return;const s=this.defaultDir,i=this.$.format.getLines();for(let t=0,n=i.length;t<n;t++)Ie.utils.setStyle(i[t],"textAlign",e===s?"":e);this.$.store.set("_lastSelectionNode",null),this.$.menu.dropdownOff(),this.$.focusManager.focus(),this.$.history.push(!1)}setDir(){const t=this.#zc();if(this.defaultDir===t)return;this.defaultDir=t;const e=this._itemMenu.querySelector('[data-command="left"]'),s=this._itemMenu.querySelector('[data-command="right"]');if(e&&s){const t=e.parentElement,i=s.parentElement;t.appendChild(s),i.appendChild(e)}}init(){this.defaultDir=this.#zc()}#zc(){const t=this.$.frameContext.get("wwComputedStyle").getPropertyValue("text-align");return["left","center","right","justify"].includes(t)?t:this.$.options.get("_rtl")?"right":"left"}}const ea=ta;class sa extends Er{static key="font";static className="se-btn-select se-btn-tool-font";#Fc;constructor(t,e){super(t),this.title=this.$.lang.font,this.inner='<span class="se-txt">'+this.$.lang.font+"</span>"+this.$.icons.arrow_down;const s=e.items||["Arial","Comic Sans MS","Courier New","Impact","Georgia","tahoma","Trebuchet MS","Verdana"],i=`<li><button type="button" class="se-btn se-btn-list default_value" data-command="" title="${this.$.lang.default}" aria-label="${this.$.lang.default}">${this.$.lang.default}</button></li><li class="se-btn-list se-sub-list"><span></span></li>`,n=this.$.menu.initDropdownTarget(sa,function(t){return t.map((t=>{const e=t.split(",")[0];return{command:t,title:e,innerHTML:e,attrs:{"data-txt":e,style:`font-family:${t};`}}}))}(s),{className:"se-list-font-family",prependHTML:i});this.currentFont="",this.fontList=n.querySelectorAll("ul li button"),this.fontArray=s,this.#Fc=n.querySelector(".se-sub-list span")}active(t,e){const s=e.querySelector(".se-txt"),i=e.parentNode.querySelector(".se-tooltip-text");let n="";if(t){if(this.$.format.isLine(t))return;if(n=Ie.utils.getStyle(t,"fontFamily")){const t=n.replace(/["']/g,"");return Ie.utils.changeTxt(s,t),Ie.utils.changeTxt(i,this.$.lang.font+" ("+t+")"),!0}}else{const t=this.$.store.get("hasFocus")?this.$.frameContext.get("wwComputedStyle").fontFamily:this.$.lang.font;Ie.utils.changeTxt(s,t),Ie.utils.changeTxt(i,this.$.store.get("hasFocus")?this.$.lang.font+(t?" ("+t+")":""):t)}return!1}on(t){const e=this.fontList,s=t.querySelector(".se-txt").textContent;if(s!==this.currentFont){let t=!1;for(let i=0,n=e.length;i<n;i++)s===(e[i].getAttribute("data-command")||"").replace(/'|"/g,"")?(Ie.utils.addClass(e[i],"active"),t=!0):Ie.utils.removeClass(e[i],"active");this.currentFont=s,t?this.#Fc.style.display="none":(this.#Fc.textContent=s,this.#Fc.style.display="block")}}async action(t){let e=t.getAttribute("data-command");if(e){if(/[\s\d\W]/.test(e)&&!/^['"].*['"]$/.test(e)&&(e=`"${e}"`),!1===await this.$.eventManager.triggerEvent("onFontActionBefore",{value:e}))return;const t=Ie.utils.createElement("SPAN",{style:"font-family: "+e+";"});this.$.inline.apply(t,{stylesToModify:["font-family"],nodesToRemove:null,strictRemove:null})}else this.$.inline.apply(null,{stylesToModify:["font-family"],nodesToRemove:["span"],strictRemove:!0});this.$.menu.dropdownOff()}}const ia=sa;class na extends Tr{static key="fontColor";static className="";constructor(t,e){super(t),this.title=this.$.lang.fontColor,this.icon="font_color";const s=Ie.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new gr(this,this.$,"color",{form:s,colorList:e.items,splitNum:e.splitNum,disableHEXInput:e.disableHEXInput,hueSliderOptions:{controllerOptions:{isOutsideForm:!0}}}),this.$.menu.initDropdownTarget(na,s)}active(t,e){const s=e.querySelector(".se-svg-color-helper");if(!s)return;let i="";if(t){if(this.$.format.isLine(t))return;if(i=Ie.utils.getStyle(t,"color"))return s.style.color=i,!0}else s.style.color=i;return!1}on(t){this.colorPicker.init(this.$.selection.getNode(),t,(t=>this.$.format.isLine(t)))}off(){this.colorPicker.hueSliderClose()}colorPickerAction(t){if(t){const e=Ie.utils.createElement("SPAN",{style:"color: "+t+";"});this.$.inline.apply(e,{stylesToModify:["color"],nodesToRemove:null,strictRemove:null})}else this.$.inline.apply(null,{stylesToModify:["color"],nodesToRemove:["span"],strictRemove:!0});this.$.menu.dropdownOff()}}const oa=na;class la extends Tr{static key="backgroundColor";static className="";constructor(t,e){super(t),this.title=this.$.lang.backgroundColor,this.icon="background_color";const s=Ie.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new gr(this,this.$,"backgroundColor",{form:s,colorList:e.items,splitNum:e.splitNum,disableHEXInput:e.disableHEXInput,hueSliderOptions:{controllerOptions:{isOutsideForm:!0}}}),this.$.menu.initDropdownTarget(la,s)}active(t,e){const s=e.querySelector("path.se-svg-color-helper");if(!s)return;let i="";if(t){if(this.$.format.isLine(t))return;if(i=Ie.utils.getStyle(t,"backgroundColor"))return s.style.color=i,!0}else s.style.color=i;return!1}on(t){this.colorPicker.init(this.$.selection.getNode(),t,(t=>this.$.format.isLine(t)))}off(){this.colorPicker.hueSliderClose()}colorPickerAction(t){if(t){const e=Ie.utils.createElement("SPAN",{style:"background-color: "+t+";"});this.$.inline.apply(e,{stylesToModify:["background-color"],nodesToRemove:null,strictRemove:null})}else this.$.inline.apply(null,{stylesToModify:["background-color"],nodesToRemove:["span"],strictRemove:!0});this.$.menu.dropdownOff()}}const ra=la;class aa extends Er{static key="hr";static className="";static component(t){return/^hr$/i.test(t?.nodeName)?t:null}constructor(t,e){super(t),this.title=this.$.lang.horizontalLine,this.icon="horizontal_line";const s=this.$.menu.initDropdownTarget(aa,function({lang:t},e){return(e||[{name:t.hr_solid,class:"__se__solid",style:null},{name:t.hr_dashed,class:"__se__dashed",style:null},{name:t.hr_dotted,class:"__se__dotted",style:null}]).map((t=>({command:"hr",title:t.name,innerHTML:`<hr${t.class?` class="${t.class}"`:""}${t.style?` style="${t.style}"`:""}/>`})))}(this.$,e.items),{className:"se-list-line"});this.list=s.querySelectorAll("button")}componentSelect(t){Ie.utils.addClass(t,"on")}componentDeselect(t){Ie.utils.removeClass(t,"on")}componentDestroy(t){if(!t)return;const e=t.previousElementSibling||t.nextElementSibling;Ie.utils.removeItem(t),this.$.focusManager.focusEdge(e),this.$.history.push(!1)}shortcut({line:t,range:e}){const s=this.$.nodeTransform.split(e.endContainer,e.endOffset,0);this.submit("__se__solid"),Ie.utils.removeItem(t),this.$.selection.setRange(s,0,s,0)}action(t){const e=this.submit(t.firstElementChild.className),s=this.$.format.addLine(e);this.$.selection.setRange(s,1,s,1),this.$.menu.dropdownOff()}submit(t){const e=Ie.utils.createElement("hr",{class:t});return this.$.focusManager.focus(),this.$.component.insert(e,{insertBehavior:"line"}),e}}const ha=aa;class ca extends Er{static key="list";static className="se-icon-flip-rtl";#_c;#Dc;constructor(t){super(t),this.title=this.$.lang.list,this.icon="list_numbered",this.#Dc={bulleted:this.$.icons.list_bulleted,numbered:this.$.icons.list_numbered};const e=this.$.menu.initDropdownTarget(ca,function({lang:t,icons:e}){return[{command:"ol",title:t.numberedList,innerHTML:e.list_numbered,className:"se-tooltip se-icon-flip-rtl"},{command:"ul",title:t.bulletedList,innerHTML:e.list_bulleted,className:"se-tooltip se-icon-flip-rtl"}]}(this.$));this.#_c=e.querySelectorAll("li button")}active(t,e){const s=e.firstElementChild;if(Ie.check.isList(t)){const i=t.nodeName.toLowerCase();return e.setAttribute("data-focus",i),Ie.utils.addClass(e,"active"),/^ul$/.test(i)?Ie.utils.changeElement(s,this.#Dc.bulleted):Ie.utils.changeElement(s,this.#Dc.numbered),!0}return e.removeAttribute("data-focus"),Ie.utils.changeElement(s,this.#Dc.numbered),Ie.utils.removeClass(e,"active"),!1}on(t){const e=t.getAttribute("data-focus")||"",s=this.#_c;for(let t=0,i=s.length;t<i;t++)e===s[t].getAttribute("data-command")?Ie.utils.addClass(s[t],"active"):Ie.utils.removeClass(s[t],"active")}action(t){const e=t.getAttribute("data-command"),s=t.getAttribute("data-value")||"",i=this.$.listFormat.apply(`${e}:${s}`,null,!1);i&&this.$.selection.setRange(i.sc,i.so,i.ec,i.eo),this.$.menu.dropdownOff(),this.$.history.push(!1)}}const da=ca,ua=".se-table-resize-line",pa=".se-table-resize-line-prev",ga=".se-table-resize-row",ma=".se-table-resize-row-prev",fa=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],va={all:"border_all",inside:"border_inside",horizon:"border_horizontal",vertical:"border_vertical",outside:"border_outside",left:"border_left",top:"border_top",right:"border_right",bottom:"border_bottom",none:"border_none"},ba=["all","inside","horizon","vertical"],ya="borderLeft",Ca="borderTop",wa="borderRight",_a="borderBottom",xa=["#bbf7d0","#fde68a","#fecaca","#e9d5ff","#bfdbfe","#22c55e","#eab308","#ef4444","#a855f7","#3b82f6","#15803d","#ca8a04","#b91c1c","#7e22ce","#1d4ed8","#e5e7eb","#9ca3af","#6b7280","#374151","#000000"],$a={physical_cellCnt:0,logical_cellCnt:0,cellCnt:0,rowCnt:0,rowIndex:0,physical_cellIndex:0,logical_cellIndex:0,current_colSpan:0,current_rowSpan:0,isShiftPressed:!1,ref:null,figureElement:null,selectedTable:null,trElement:null,trElements:null,tdElement:null,fixedCell:null,selectedCell:null,selectedCells:null},{_w:ka}=Ne,Sa=new WeakMap,Ea=new WeakMap;function Ta(t){return/^(TD|TH|TR)$/i.test(t?.nodeName)}function Ma(t){return/^CAPTION$/i.test(t.nodeName)}function Ha(t,e){const s=t.clientX,i=Ve.get(ka.getComputedStyle(e).width,0),n=e.getBoundingClientRect(),o=Math.round(s-n.left),l=o<=6;return{is:l||i-o<=6,isLeft:l,startX:s}}function La(t,e){const s=t.clientY,i=Ve.get(ka.getComputedStyle(e).height,0),n=e.getBoundingClientRect();return{is:Math.ceil(i+n.top-s)<=6,startY:s}}function Na(t,e){return`<${t=t.toLowerCase()}><div><br></div></${t}>`.repeat(e)}function Aa(t){return t=t.toLowerCase(),Ie.utils.createElement(t,null,"<div><br></div>")}function Ba(t,e,s){let i=Ea.get(t);return i||(i=function(t){const e=[],s=t.rows,i=[];for(let t=0,n=s.length;t<n;t++){const n=s[t].cells;e[t]=[];let o=0;for(let s=0,l=n.length;s<l;s++){for(;i[t]?.[o];)o++;e[t][s]=o;const l=n[s],r=l.colSpan||1,a=l.rowSpan||1;if(a>1)for(let e=1;e<a;e++){i[t+e]||(i[t+e]=[]);for(let s=0;s<r;s++)i[t+e][o+s]=!0}o+=r}}return e}(t),Ea.set(t,i)),i[e]?.[s]??0}function Ia(t,e){const s=Ie.utils.clone(t,!0),i=Array.from(t.querySelectorAll("td, th")),n=Array.from(s.querySelectorAll("td, th"));return{clonedTable:s,clonedSelectedCells:e.map((t=>{const e=i.indexOf(t);return e>-1?n[e]:null})).filter((t=>null!==t))}}function Va(t){t&&(Sa.delete(t),Ea.delete(t))}function Oa(t,e,s){const i=[];let n="";for(const o in va){if(s.includes(o))continue;const l=va[o];i.push(o),n+=`\n\t\t\t<button type="button" class="se-btn se-tooltip">\n\t\t\t\t${e[l]}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t[l]}</span>\n\t\t\t\t</span>\n\t\t\t</button>`}return{items:i,menus:Ie.utils.createElement("DIV",null,n).querySelectorAll("button")}}const Ra=class{#qc;#J;#N;constructor(t,{mergeButton:e,unmergeButton:s,splitButton:i,openCellMenuFunc:n,closeCellMenuFunc:o}){this.#qc=t,this.#J=t.$,this.#N=t.state,this.mergeButton=e,this.unmergeButton=s,this.splitButton=i;const l=(r=this.#J.lang,{items:["vertical","horizontal"],menus:Ie.utils.createElement("DIV",null,`\n\t\t<div title="${r.verticalSplit}" aria-label="${r.verticalSplit}">\n\t\t\t${r.verticalSplit}\n\t\t</div>\n\t\t<div title="${r.horizontalSplit}" aria-label="${r.horizontalSplit}">\n\t\t\t${r.horizontalSplit}\n\t\t</div>`).querySelectorAll("div")});var r;this.selectMenu_split=new Ei(this.#J,{checkList:!1,position:"bottom-center",openMethod:n,closeMethod:o}),this.selectMenu_split.on(this.splitButton,this._OnSplitCells.bind(this)),this.selectMenu_split.create(l.items,l.menus)}get#Wc(){return this.#qc.selectionService}openSplitMenu(){this.selectMenu_split.open()}mergeCells(t,e=!1){const s=t[0].closest("table");Va(s);const{clonedTable:i,clonedSelectedCells:n}=e?{clonedTable:s,clonedSelectedCells:t}:Ia(s,t);this.#qc.setTableInfo(i),t=n,this.#qc.setState("ref",null),this.#Wc.setMultiCells(t[0],Ie.query.findVisualLastCell(t));const o=this.#N.ref,l=t[0];let r=null,a=null;const h=o.ce-o.cs+1;let c=o.re-o.rs+1,d="",u=null;for(let e,s,i=1,n=t.length;i<n;i++){e=t[i],u!==e.parentNode&&(u=e.parentNode),s=e.children;for(let t=0,e=s.length;t<e;t++)this.#J.format.isLine(s[t])&&Ie.check.isZeroWidth(s[t].textContent)&&Ie.utils.removeItem(s[t]);d+=e.innerHTML,Ie.utils.removeItem(e),0===u.cells.length&&(r?a=u:r=u,c-=1)}if(r){const t=this.#N.trElements,e=Ie.utils.getArrayIndex(t,r),s=Ie.utils.getArrayIndex(t,a||r),i=[];for(let n,o=0;o<=s;o++)if(n=t[o].cells,0!==n.length)for(let t,i,l=0,r=n.length;l<r;l++)t=n[l],i=t.rowSpan-1,i>0&&o+i>=e&&(t.rowSpan-=Ve.getOverlapRangeAtIndex(e,s,o,o+i));else i.push(t[o]);for(let t=0,e=i.length;t<e;t++)Ie.utils.removeItem(i[t])}l.innerHTML+=d,l.colSpan=h,l.rowSpan=c,e||(s.replaceWith(i),this.#qc._closeTableSelectInfo(),this.#qc._setController(l),this.#Wc.focusCellEdge(l),this.#Wc.initCellSelection(l),this.#qc.setState("ref",null),this.#qc.setState("selectedCells",[l]),this.#qc.setCellInfo(l,!0),this.setUnMergeButton(),this.setMergeSplitButton(),this.#qc.historyPush())}unmergeCells(t,e=!1){if(!t?.length)return;const s=t[0].closest("table");Va(s);const{clonedTable:i,clonedSelectedCells:n}=e?{clonedTable:s,clonedSelectedCells:t}:Ia(s,t);this.#qc.setState("ref",null),this.#qc.setTableInfo(i);let o=(t=n)[0],l=Ie.query.findVisualLastCell(t),r=null;const a=o.closest("table"),h=a.rows;for(const e of t){const t=e.parentElement.rowIndex,s=e.cellIndex,i=e.rowSpan,n=e.colSpan;if(1===i&&1===n)continue;this.#qc.setCellInfo(e,!0);const a=e.innerHTML;e.remove();for(let c=0;c<i;c++){const i=h[t+c];for(let t=0;t<n;t++){const n=Aa("td");0===c&&0===t?(o===e&&(o=n),l===e&&(l=n),n.innerHTML=a,i.insertBefore(n,i.cells[s])):(i.insertBefore(n,i.cells[s+t]),r=n)}}}this.#qc.setState("selectedCells",null),e||(s.replaceWith(i),this.#qc._closeTableSelectInfo(),this.#qc.setTableInfo(i),o!==l?(l=!r||l.closest("tr").rowIndex>r.closest("tr").rowIndex||l.cellIndex>r.cellIndex?l:r,this.#Wc.setMultiCells(o,l),this.#qc.setState("selectedCells",Array.from(a.querySelectorAll(".se-selected-table-cell")))):this.#qc.setCellInfo(l,!0),this.#Wc.initCellSelection(o),this.#qc.setState("selectedCell",l),this.setUnMergeButton(),this.#qc.controller_cell.resetPosition(l),this.#qc.historyPush())}findMergedCells(t){const e=[];return t?.forEach((t=>{t&&(t.rowSpan>1||t.colSpan>1)&&e.push(t)})),e}setMergeSplitButton(){this.#N.ref?(this.splitButton.style.display="none",this.mergeButton.style.display="block"):(this.splitButton.style.display="block",this.mergeButton.style.display="none")}setUnMergeButton(){this.findMergedCells(this.#N.selectedCells?.length?this.#N.selectedCells:[this.#N.fixedCell]).length>0?this.unmergeButton.disabled=!1:this.unmergeButton.disabled=!0}_OnSplitCells(t){Va(this.#qc._element);const e="vertical"===t,s=this.#N.tdElement,i=this.#N.trElements,n=this.#N.trElement,o=this.#N.logical_cellIndex,l=this.#N.rowIndex,r=Aa(s.nodeName);if(e){const t=s.colSpan;if(r.rowSpan=s.rowSpan,t>1)r.colSpan=Math.floor(t/2),s.colSpan=t-r.colSpan,n.insertBefore(r,s.nextElementSibling);else{let e=[],l=[];for(let n,r,a=0,h=this.#N.rowCnt;a<h;a++){n=i[a].cells,r=0;for(let i,h,c,d,u=0,p=n.length;u<p;u++){if(i=n[u],h=i.colSpan-1,c=i.rowSpan-1,d=u+r,l.length>0)for(let t,e=0;e<l.length;e++)t=l[e],t.row>a||(d>=t.index?(r+=t.cs,d+=t.cs,t.rs-=1,t.row=a+1,t.rs<1&&(l.splice(e,1),e--)):u===p-1&&(t.rs-=1,t.row=a+1,t.rs<1&&(l.splice(e,1),e--)));if(d<=o&&c>0&&e.push({index:d,cs:h+1,rs:c,row:-1}),i!==s&&d<=o&&d+h>=o+t-1){i.colSpan+=1;break}if(d>o)break;r+=h}l=l.concat(e).sort((function(t,e){return t.index-e.index})),e=[]}n.insertBefore(r,s.nextElementSibling)}}else{const t=s.rowSpan;if(r.colSpan=s.colSpan,t>1){r.rowSpan=Math.floor(t/2);const e=t-r.rowSpan,l=[],a=Ie.utils.getArrayIndex(i,n)+e;for(let t,e,s=0;s<a;s++){t=i[s].cells,e=0;for(let i,n,r,h=0,c=t.length;h<c&&(r=h+e,!(r>=o));h++)i=t[h],n=i.rowSpan-1,n>0&&n+s>=a&&r<o&&l.push({index:r,cs:i.colSpan}),e+=i.colSpan-1}const h=i[a],c=h.cells;let d=l.shift();for(let t,e,s,i,n=0,a=c.length,u=0;n<a;n++){if(s=n+u,t=c[n],e=t.colSpan-1,i=s+e+1,d&&i>=d.index&&(u+=d.cs,i+=d.cs,d=l.shift()),i>=o||n===a-1){h.insertBefore(r,t.nextElementSibling);break}u+=e}s.rowSpan=e}else{r.rowSpan=s.rowSpan;const t=Ie.utils.createElement("TR");t.appendChild(r);for(let t,e=0;e<l;e++){if(t=i[e].cells,0===t.length)return;for(let s=0,i=t.length;s<i;s++)e+t[s].rowSpan-1>=l&&(t[s].rowSpan+=1)}const e=this.#N.physical_cellIndex,o=n.cells;for(let t=0,s=o.length;t<s;t++)t!==e&&(o[t].rowSpan+=1);n.parentNode.insertBefore(t,n.nextElementSibling)}}this.selectMenu_split.close(),this.#Wc.focusCellEdge(s),this.#Wc.deleteStyleSelectedCells(),this.#J.history.push(!1),this.#qc._setController(s),this.#qc.setState("selectedCell",s),this.#qc.setState("fixedCell",s),this.#N.selectedCells?.length||this.#qc.setState("selectedCells",[s])}};const Pa=class{#qc;#N;constructor(t){this.#qc=t,this.#N=t.state}get#Wc(){return this.#qc.selectionService}get#Uc(){return this.#qc.gridService}get#Zc(){return this.#qc.cellService}copySelectedTableCells(t,e,s){t.preventDefault(),t.stopPropagation();const i=s[0].closest("table"),n=i.cloneNode(!1),o=Ie.utils.createElement("tbody");n.appendChild(o);const l=new Map;s.forEach((t=>{l.set(t,!0)}));const r=i.rows,a=r.length,h=Array.from(r[0].cells).reduce(((t,e)=>t+(e.colSpan||1)),0),c=Array.from({length:a},(()=>Array(h).fill(null)));for(let t=0;t<a;t++){const e=r[t].cells;for(let s=0,n=e.length;s<n;s++){const n=Ba(i,t,s),o=e[s],l=o.rowSpan||1,r=o.colSpan||1;for(let e=0;e<l;e++)for(let s=0;s<r;s++)c[t+e][n+s]=o}}for(let t=0;t<a;t++){let e;for(let s=0;s<h;s++){const i=c[t][s];if(!i||!l.has(i))continue;if(e||(e=Ie.utils.createElement("tr"),o.appendChild(e)),e.lastChild&&c[t][s-1]===i)continue;if(t>0&&c[t-1][s]===i)continue;const n=i.cloneNode(!0);let r=1,d=1;for(;t+r<a&&c[t+r][s]===i;)r++;for(;s+d<h&&c[t][s+d]===i;)d++;r>1&&(n.rowSpan=r),d>1&&(n.colSpan=d),e.appendChild(n)}}const d=Ie.utils.createElement("figure");d.className=e.className,d.appendChild(n);const u=`<html><body>\x3c!--StartFragment--\x3e${d.outerHTML}\x3c!--EndFragment--\x3e</body></html>`;t.clipboardData.setData("text/html",u)}pasteTableCellMatrix(t,e){if(!t||!e)return;Va(e.closest("table"));const s=t.rows;let i=0;const n=[];for(let t=0;t<s.length;t++){const e=s[t].cells;let o=0;for(let s=0;s<e.length;s++){const l=e[s];for(;n[t]?.[o];)o++;const r=l.rowSpan||1,a=l.colSpan||1;0===o&&(i+=r);for(let e=0;e<r;e++)for(let s=0;s<a;s++)n[t+e]||(n[t+e]=[]),n[t+e][o+s]=!0;o+=a}}let o=0;for(let t=0,e=s[0].cells,i=e.length;t<i;t++){o+=e[t].colSpan||1}const l={rowCnt:i,logicalCellCnt:o};this.#Wc.deleteStyleSelectedCells();const r=e.closest("table"),{clonedTable:a,clonedSelectedCells:h}=Ia(r,[e]),c=a;e=h[0];let d=c.rows;this.#qc.setTableInfo(c),this.#qc.setCellInfo(e,!0);const u={physicalCellCnt:this.#N.physical_cellCnt,logicalCellCnt:this.#N.logical_cellCnt,rowCnt:this.#N.rowCnt,rowIndex:this.#N.rowIndex,physicalCellIndex:this.#N.physical_cellIndex,logicalCellIndex:this.#N.logical_cellIndex,currentColSpan:this.#N.current_colSpan,currentRowSpan:this.#N.current_rowSpan},p=l.rowCnt-(u.rowCnt-(u.rowIndex+1))-1,g=l.logicalCellCnt-(u.logicalCellCnt-(u.logicalCellIndex+1))-1;if(u.rowCnt+=p,u.logicalCellCnt+=g,u.physicalCellCnt+=g,p>0||g>0){const t=d[d.length-1],e=t.cells[t.cells.length-1];for(let t=0;t<p;t++)this.#Uc.editRow("down",e);for(let t=0;t<g;t++)this.#Uc.editColumn("right",e);this.#qc.setState("trElements",d=c.rows)}const m=u.rowIndex,f=u.logicalCellIndex,v=f+l.logicalCellCnt-1,b=[],y=[];for(let t=0,e=m+l.rowCnt;t<e;t++){const e=d[t]?.cells;if(!e)continue;let s=0,i=0;for(let n=0;n<e.length;n++){for(;y[t]?.[s];)s++;const n=e[i++];if(!n)break;const o=n.colSpan||1,l=n.rowSpan||1,r=s,a=s+o-1;if(l>1||o>1)for(let e=1;e<l;e++){const i=t+e;y[i]||=[];for(let t=0;t<o;t++)y[i][s+t]=!0}r<=v&&a>=f&&(o>1||l>1)&&b.push(n),s+=o}}b.length>0&&(this.#Zc.unmergeCells(b,!0),this.#qc.setState("trElements",d=c.rows));const C=[],w=[],_=[];for(let t=0,e=l.rowCnt;t<e;t++){const e=s[t]?.cells;if(!e)break;let i=0;for(let s=0;s<e.length;s++){const n=e[s],o=n.colSpan||1,l=n.rowSpan||1;for(;w[t]?.[i];)i++;for(let e=1;e<l;e++){const s=t+e;w[s]||=[];for(let t=0;t<o;t++)w[s][i+t]=!0}if(o<=1&&l<=1){i+=o;continue}const r=i+u.logicalCellIndex,a=r+o-1,h=[];for(let e=u.rowIndex+t,s=e+l,i=0;e<s;e++,i++){const t=d[e].cells;let s=0,i=0;for(;i<t.length&&s<=a;){for(;_[e]?.[s];)s++;const n=t[i++],o=n.colSpan||1,l=n.rowSpan||1,c=s,d=s+o-1;if(l>1)for(let t=1;t<l;t++){const i=e+t;_[i]||=[];for(let t=0;t<o;t++)_[i][s+t]=!0}d>=r&&c<=a&&h.push(n),s+=o}}h.length>0&&C.push(h),i+=o}}if(C.length>0){for(const t of C)this.#qc.setState("ref",null),this.#qc.setState("trElements",c.rows),this.#Zc.mergeCells(t,!0);this.#qc.setState("trElements",d=c.rows)}const x=[],$=[];for(let t=0;t<l.rowCnt;t++){const e=d[u.rowIndex+t],i=s[t];if(!e||!i)break;const n=e.cells,o=i.cells;let l=0,r=0,a=0;for(;r<n.length&&a<o.length&&l<=v;){for(;$[t]?.[l];)l++;const e=n[r++],s=o[a];if(!e||!s)break;const i=e.colSpan||1,h=e.rowSpan||1;if(h>1)for(let e=1;e<h;e++){const s=t+e;$[s]||=[];for(let t=0;t<i;t++)$[s][l+t]=!0}l>=f&&l+i-1<=v&&(e.innerHTML=s.innerHTML,x.push(e),a++),l+=i}}return r.replaceWith(c),this.#qc._closeTableSelectInfo(),this.#qc.setTableInfo(c),this.#Zc.setMergeSplitButton(),this.#Zc.setUnMergeButton(),this.#Wc.focusCellEdge(x[0]),this.#qc.historyPush(),x}};const za=class{#qc;#J;#N;constructor(t,{columnButton:e,rowButton:s,openCellMenuFunc:i,closeCellMenuFunc:n}){this.#qc=t,this.#J=t.$,this.#N=t.state;const o=(l=this.#J.lang,r=this.#J.icons,{items:["insert-left","insert-right","delete"],menus:Ie.utils.createElement("DIV",null,`\n\t\t<div title="${l.insertColumnBefore}" aria-label="${l.insertColumnBefore}">\n\t\t\t<span class="se-list-icon">${r.insert_column_left}</span><span class="se-txt">${l.insertColumnBefore}</span>\n\t\t</div>\n\t\t<div title="${l.insertColumnAfter}" aria-label="${l.insertColumnAfter}">\n\t\t\t<span class="se-list-icon">${r.insert_column_right}</span><span class="se-txt">${l.insertColumnAfter}</span>\n\t\t</div>\n\t\t<div title="${l.deleteColumn}" aria-label="${l.deleteColumn}">\n\t\t\t<span class="se-list-icon">${r.delete_column}</span><span class="se-txt">${l.deleteColumn}</span>\n\t\t</div>`).querySelectorAll("div")});var l,r;this.selectMenu_column=new Ei(this.#J,{checkList:!1,position:"bottom-center",openMethod:i,closeMethod:n}),this.selectMenu_column.on(e,this.#Gc.bind(this)),this.selectMenu_column.create(o.items,o.menus);const a=function(t,e){return{items:["insert-above","insert-below","delete"],menus:Ie.utils.createElement("DIV",null,`\n\t\t<div title="${t.insertRowAbove}" aria-label="${t.insertRowAbove}">\n\t\t\t<span class="se-list-icon">${e.insert_row_above}</span><span class="se-txt">${t.insertRowAbove}</span>\n\t\t</div>\n\t\t<div title="${t.insertRowBelow}" aria-label="${t.insertRowBelow}">\n\t\t\t<span class="se-list-icon">${e.insert_row_below}</span><span class="se-txt">${t.insertRowBelow}</span>\n\t\t</div>\n\t\t<div title="${t.deleteRow}" aria-label="${t.deleteRow}">\n\t\t\t<span class="se-list-icon">${e.delete_row}</span><span class="se-txt">${t.deleteRow}</span>\n\t\t</div>`).querySelectorAll("div")}}(this.#J.lang,this.#J.icons);this.selectMenu_row=new Ei(this.#J,{checkList:!1,position:"bottom-center",openMethod:i,closeMethod:n}),this.selectMenu_row.on(s,this.#jc.bind(this)),this.selectMenu_row.create(a.items,a.menus)}get#Wc(){return this.#qc.selectionService}openColumnMenu(){this.selectMenu_column.open()}openRowMenu(){this.selectMenu_row.menus[0].style.display=this.selectMenu_row.menus[1].style.display=/^TH$/i.test(this.#N.tdElement?.nodeName)?"none":"",this.selectMenu_row.open()}editTable(t,e){const s=this.#qc._element,i="row"===t;if(i){const t=this.#N.trElement.parentElement;if(/^THEAD$/i.test(t.nodeName)){if("up"===e)return;if(!t.nextElementSibling||!/^TBODY$/i.test(t.nextElementSibling.nodeName))return void(e?s.innerHTML+="<tbody><tr>"+Na("td",this.#N.logical_cellCnt)+"</tr></tbody>":(Ie.utils.removeItem(this.#N.figureElement),this.#qc._closeTableSelectInfo()))}}if(this.#N.ref){const t=this.#N.tdElement,s=this.#N.selectedCells;if(i)if(e)this.#qc.setCellInfo("up"===e?s[0]:s.at(-1),!0),this.editRow(e,null,t);else{let t=s[0].parentNode;const i=[s[0]];for(let e,n=1,o=s.length;n<o;n++)e=s[n],t!==e.parentNode&&(i.push(e),t=e.parentNode);for(let t=0,s=i.length;t<s;t++)this.#qc.setCellInfo(i[t],!0),this.editRow(e)}else{const i=s[0].parentNode;if(e){let n=null;for(let t=0,e=s.length-1;t<e;t++)if(i!==s[t+1].parentNode){n=s[t];break}this.#qc.setCellInfo("left"===e?s[0]:n||s[0],!0),this.editColumn(e,null,t)}else{const t=[s[0]];for(let e,n=1,o=s.length;n<o&&(e=s[n],i===e.parentNode);n++)t.push(e);for(let s=0,i=t.length;s<i;s++)this.#qc.setCellInfo(t[s],!0),this.editColumn(e)}}e||this.#qc.resetInfo()}else this[i?"editRow":"editColumn"](e);if(!e){const t=s.children;for(let e=0;e<t.length;e++)0===t[e].children.length&&(Ie.utils.removeItem(t[e]),e--);0===s.children.length&&Ie.utils.removeItem(s)}}editColumn(t,e,s){e&&this.#qc.setCellInfo(e,!0);const i=!t,n="left"===t,o=this.#N.current_colSpan,l=this.#N.logical_cellIndex+(i||n?0:o+1),r=this.#N.trElements;let a,h=[],c=[],d=0;const u=[],p=[];for(let t,e,s,n,g,m=0,f=this.#N.rowCnt;m<f;m++){t=r[m],a=l,n=!1,e=t.cells,g=0;for(let t,s,r,f,v=0,b=e.length;v<b&&(t=e[v],t);v++)if(s=t.rowSpan-1,r=t.colSpan-1,i){if(f=v+g,c.length>0){const t=!e[v+1];for(let e,s=0;s<c.length;s++)e=c[s],e.row>m||(f>=e.index?(g+=e.cs,f=v+g,e.rs-=1,e.row=m+1,e.rs<1&&(c.splice(s,1),s--)):t&&(e.rs-=1,e.row=m+1,e.rs<1&&(c.splice(s,1),s--)))}s>0&&h.push({rs:s,cs:r+1,index:f,row:-1}),f>=a&&f+r<=a+o?u.push(t):f<=a+o&&f+r>=a?t.colSpan-=Ve.getOverlapRangeAtIndex(l,l+o,f,f+r):s>0&&(f<a||f+r>a+o)&&p.push({cell:t,i:m,rs:m+s}),g+=r}else{if(v>=a)break;if(r>0){if(d<1&&r+v>=a){t.colSpan+=1,a=null,d=s+1;break}a-=r}if(!n){for(let t,e=0;e<c.length;e++)t=c[e],a-=t.cs,t.rs-=1,t.rs<1&&(c.splice(e,1),e--);n=!0}}if(c=c.concat(h).sort((function(t,e){return t.index-e.index})),h=[],!i){if(d>0){d-=1;continue}null!==a&&e.length>0&&(s=Aa(e[0].nodeName),s=t.insertBefore(s,e[a]))}}const g=this.#qc._element.querySelector("colgroup");if(g){const t=g.querySelectorAll("col");if(i)Ie.utils.removeItem(t[a]);else{if(!(!Ie.utils.hasClass(this.#qc._element,"se-table-layout-fixed")&&"fixed"!==this.#qc._element.style.tableLayout)&&Array.prototype.some.call(t,(t=>Ve.get(t.style.width)>0))){let e=0;for(let s,i=0,n=t.length;i<n;i++)s=Ve.get(t[i].style.width),s-=Math.round(s*n*.1/2),e+=s,t[i].style.width=`${s}%`;const s=Ie.utils.createElement("col",{style:`width:${100-e}%`});g.insertBefore(s,t[a])}else g.insertBefore(Ie.utils.createElement("col"),t[a]||null)}}if(i){let t,e;for(let s,i=0,n=u.length;i<n;i++)s=u[i].parentNode,Ie.utils.removeItem(u[i]),0===s.cells.length&&(t||=Ie.utils.getArrayIndex(r,s),e=Ie.utils.getArrayIndex(r,s),Ie.utils.removeItem(s));for(let s,i=0,n=p.length;i<n;i++)s=p[i],s.cell.rowSpan=Ve.getOverlapRangeAtIndex(t,e,s.i,s.rs);this.#qc._closeController()}else this.#qc._setCellControllerPosition(s||this.#N.tdElement,!0);return s||this.#N.tdElement}editRow(t,e,s){this.#Wc.deleteStyleSelectedCells(),e&&this.#qc.setCellInfo(e,!0);const i=!t,n="up"===t,o=this.#N.rowIndex,l=i||n?o:o+this.#N.current_rowSpan+1,r=i?-1:1,a=this.#N.trElements;let h=this.#N.logical_cellCnt;for(let t,e=0,s=o+(i?-1:0);e<=s;e++){if(t=a[e].cells,0===t.length)return;for(let s,i,n=0,o=t.length;n<o;n++)s=t[n].rowSpan,i=t[n].colSpan,s<2&&i<2||s+e>l&&l>e&&(t[n].rowSpan=s+r,h-=i)}if(i){const t=a[o+1];if(t){const e=[];let s=a[o].cells,i=0;for(let t,n,o=0,l=s.length;o<l;o++)t=s[o],n=o+i,i+=t.colSpan-1,t.rowSpan>1&&(t.rowSpan-=1,e.push({cell:t.cloneNode(!0),index:n}));if(e.length>0){let n=e.shift();s=t.cells,i=0;for(let o,l,r=0,a=s.length;r<a&&(o=s[r],l=r+i,i+=o.colSpan-1,!(l>=n.index)||(r--,i--,i+=n.cell.colSpan-1,t.insertBefore(n.cell,o),n=e.shift(),n));r++);if(n){t.appendChild(n.cell);for(let s=0,i=e.length;s<i;s++)t.appendChild(e[s].cell)}}}this.#qc._element.deleteRow(l)}else this.insertBodyRow(this.#qc._element,l,h);i?this.#qc._closeController():this.#qc._setCellControllerPosition(s||this.#N.tdElement,!0)}insertBodyRow(t,e,s){const i=t.insertRow(e);return i.innerHTML=Na("td",s),i}#Gc(t){switch(Va(this.#qc._element),t){case"insert-left":this.editTable("cell","left");break;case"insert-right":this.editTable("cell","right");break;case"delete":this.editTable("cell",null)}this.#qc.historyPush()}#jc(t){switch(Va(this.#qc._element),t){case"insert-above":this.editTable("row","up");break;case"insert-below":this.editTable("row","down");break;case"delete":this.editTable("row",null)}this.#qc.historyPush()}},{_w:Fa}=Ne;const Da=class{#qc;#J;#N;#fi;#Kc=!1;#Yc=null;#Xc=null;constructor(t){this.#qc=t,this.#J=t.$,this.#N=t.state,this.#fi={resize:null,resizeStop:null,resizeKeyDown:null}}get#Wc(){return this.#qc.selectionService}isResizing(){return this.#Kc}onResizeGuide(t,e){const s=Ha(t,e);if(s.is)return this.#qc._element&&(this.#qc._element.style.cursor=""),this.#si(),"block"===this.#Yc?.style.display&&(this.#Yc.style.display="none"),this.#Yc=this.#J.frameContext.get("wrapper").querySelector(ua),this.#Jc(Ie.query.getParentElement(e,Ie.check.isTable),e,this.#Yc,s.isLeft),this.#Yc.style.display="block",!1;return La(t,e).is?(this.#si(),this.#qc._element=Ie.query.getParentElement(e,Ie.check.isTable),this.#qc._element.style.cursor="ns-resize","block"===this.#Yc?.style.display&&(this.#Yc.style.display="none"),this.#Yc=this.#J.frameContext.get("wrapper").querySelector(ga),this.#Qc(Ie.query.getParentElement(e,Ie.check.isTable),e,this.#Yc),this.#Yc.style.display="block",!1):void 0}offResizeGuide(){this.#td()}readyResizeFromEdge(t,e){const s=Ha(t,e);if(s.is){try{this.#Wc.deleteStyleSelectedCells(),this.#qc.setCellInfo(e,!0);const t=this.#N.logical_cellIndex+this.#N.current_colSpan-(s.isLeft?1:0);if(this.#J.ui.enableBackWrapper("ew-resize"),this.#Yc||=this.#J.frameContext.get("wrapper").querySelector(ua),this.#Xc=this.#J.frameContext.get("wrapper").querySelector(pa),t<0||t===this.#N.logical_cellCnt-1)return this._startFigureResizing(s.startX,t<0),this.#qc._editorEnable(!1),!1;const i=this.#qc._element.querySelector("colgroup").querySelectorAll("col")[t<0?0:t];this._startCellResizing(i,s.startX,Ve.get(Fa.getComputedStyle(i).width,0),s.isLeft),this.#qc._editorEnable(!1)}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.#qc._editorEnable(!0),this.#si()}finally{this.#qc.setState("fixedCell",null),this.#qc.setState("selectedCell",null),this.#qc.controller_table.hide(),this.#qc.controller_cell.hide()}return!1}const i=La(t,e);if(i.is){try{let t=Ie.query.getParentElement(e,Ie.check.isTableRow),s=e.rowSpan;if(s>1)for(;Ie.check.isTableRow(t)&&s>1;)t=t.nextElementSibling,--s;this.#Wc.deleteStyleSelectedCells(),this.#qc.setRowInfo(t),this.#J.ui.enableBackWrapper("ns-resize"),this.#Yc||=this.#J.frameContext.get("wrapper").querySelector(ga),this.#Xc=this.#J.frameContext.get("wrapper").querySelector(ma),this._startRowResizing(t,i.startY,Ve.get(Fa.getComputedStyle(t).height,0)),this.#qc._editorEnable(!1)}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.#qc._editorEnable(!0),this.#si()}finally{this.#qc.setState("fixedCell",null),this.#qc.setState("selectedCell",null),this.#qc.controller_table.hide(),this.#qc.controller_cell.hide()}return!1}}#ed(t){const e=t.querySelector("colgroup").querySelectorAll("col"),s=t.offsetWidth;e.forEach((t=>{const e=t.style.width;if(!e.endsWith("%")){const i=(t.offsetWidth||Ve.get(e,0))/s*100;t.style.width=i+"%"}}))}_startCellResizing(t,e,s,i){const n=this.#N.figureElement;Ie.utils.removeClass(n,"se-component-selected"),this.#ed(this.#qc._element),this.#Jc(n,this.#N.tdElement,this.#Xc,i),this.#Xc.style.display="block";const o=t.style.width,l=t.nextElementSibling,r=l.style.width,a=Ie.utils.hasClass(this.#qc._element,"se-table-layout-fixed")?r:Be.getWidthInPercentage(l||t);fi.get("__dragHandler")&&(fi.get("__dragHandler").style.display="none"),this.#sd(this.#id.bind(this,t,l,n,this.#N.tdElement,this.#Yc,i,e,s,Ve.get(o,0),Ve.get(a,0),this.#qc._element.offsetWidth),(()=>{this.#si(),this.#ed(this.#qc._element),this.#J.history.push(!0),this.#J.component.hoverSelect(this.#qc._element),this.#qc._editorEnable(!0)}),(e=>{this._stopResize(t,o,"width",e),this._stopResize(l,r,"width",e)}))}#id(t,e,s,i,n,o,l,r,a,h,c,d){const u=(r+(d.clientX-l))/c*100;if(u>0){t.style.width=`${u}%`;const l=a-u;e.style.width=`${h+l}%`,this.#Jc(s,i,n,o)}}_startRowResizing(t,e,s){const i=this.#N.figureElement;Ie.utils.removeClass(i,"se-component-selected"),this.#Qc(i,t,this.#Xc),this.#Xc.style.display="block";const n=t.style.height;fi.get("__dragHandler")&&(fi.get("__dragHandler").style.display="none"),this.#sd(this.#nd.bind(this,t,i,this.#Yc,e,s),(()=>{this.#si(),this.#J.history.push(!0),this.#J.component.hoverSelect(this.#qc._element),this.#qc._editorEnable(!0)}),this._stopResize.bind(this,t,n,"height"))}#nd(t,e,s,i,n,o){const l=n+(o.clientY-i);t.style.height=`${l}px`,this.#Qc(e,t,s)}_startFigureResizing(t,e){const s=this.#N.figureElement;Ie.utils.removeClass(s,"se-component-selected"),this.#Jc(s,s,this.#Xc,e),this.#Xc.style.display="block";const i=Be.getWidthInPercentage(s);fi.get("__dragHandler")&&(fi.get("__dragHandler").style.display="none"),this.#sd(this.#od.bind(this,s,this.#Yc,e,t,s.offsetWidth,Ve.get(i,0)),(()=>{this.#si(),Ve.get(s.style.width,0)>100&&(s.style.width="100%"),this.#J.history.push(!0),this.#J.component.hoverSelect(this.#qc._element),this.#qc._editorEnable(!0)}),this._stopResize.bind(this,s,s.style.width,"width"))}#od(t,e,s,i,n,o,l){const r=(n+(s?i-l.clientX:l.clientX-i))/n*o;r>0&&(t.style.width=`${r}%`,this.#Jc(t,t,e,s))}#Jc(t,e,s,i){const n=this.#J.offset.getLocal(e),o=this.#J.offset.getLocal(t);s.style.left=`${n.left+(i?0:e.offsetWidth)}px`,s.style.top=`${o.top}px`,s.style.height=`${t.offsetHeight}px`}#Qc(t,e,s){const i=this.#J.offset.getLocal(e),n=this.#J.offset.getLocal(t);s.style.top=`${i.top+e.offsetHeight}px`,s.style.left=`${n.left}px`,s.style.width=`${t.offsetWidth}px`}_stopResize(t,e,s,i){Oe.isEsc(i.code)&&(this.#si(),this.#J.component.hoverSelect(this.#qc._element),this.#qc._editorEnable(!0),t.style[s]=e,"width"===s&&this.#J.component.select(this.#qc._element,this.#qc.constructor.key,{isInput:!0}))}#sd(t,e,s){this.#fi.resize=this.#J.eventManager.addGlobalEvent("mousemove",t,!1),this.#fi.resizeStop=this.#J.eventManager.addGlobalEvent("mouseup",e,!1),this.#fi.resizeKeyDown=this.#J.eventManager.addGlobalEvent("keydown",s,!1),this.#Kc=!0}#si(){this.#Kc=!1,this.#J.ui.disableBackWrapper(),this.#td(),this.#Xc&&(this.#Xc.style.display="none",this.#Xc=null);const t=this.#fi;for(const e in t)t[e]&&=this.#J.eventManager.removeGlobalEvent(t[e]);this.#Kc=!1,this.#Yc=null}#td(){this.#Yc&&(this.#Yc.style.display="none",this.#Yc=null),this.#qc._element&&(this.#qc._element.style.cursor="")}init(){this.#si()}};const qa=class{#qc;#J;#N;#ld;#rd;#ad;#hd;#fi;#cd=null;constructor(t){this.#qc=t,this.#J=t.$,this.#N=t.state,this.#ld=this.#dd.bind(this),this.#rd=this.#ud.bind(this),this.#ad=this.#pd.bind(this),this.#hd=this.#gd.bind(this),this.#fi={on:null,off:null,shiftOff:null,touchOff:null,resize:null,resizeStop:null,resizeKeyDown:null}}get#Zc(){return this.#qc.cellService}selectCells(t){const e=t[0],s=Ie.query.findVisualLastCell(t);return this.#cd=e.nodeName,this.setMultiCells(e,s),{fixedCell:e,selectedCell:s}}setMultiCells(t,e){const s=this.#N.selectedTable,i=s.rows;if(this.deleteStyleSelectedCells(),Ie.utils.addClass(t,"se-selected-table-cell"),t===e&&!this.#N.isShiftPressed)return;const n=function(t,e){const s=t.parentNode,i=e.parentNode;return`${s.rowIndex},${t.cellIndex}-${i.rowIndex},${e.cellIndex}`}(t,e);let o=Sa.get(s);const l=o?.get(n);if(l)return this.#qc.setState("ref",l),void this.#md(i,l);const r=this.#fd(i,t,e);this.#qc.setState("ref",r),o||(o=new Map,Sa.set(s,o)),o.set(n,r),this.#md(i,r)}#fd(t,e,s){let i=!0,n=[],o=[];const l={_i:0,cs:null,ce:null,rs:null,re:null};for(let r,a,h=0,c=t.length;h<c;h++){r=t[h].cells,a=0;for(let t,c,d,u,p=0,g=r.length;p<g;p++){if(t=r[p],d=t.colSpan-1,u=t.rowSpan-1,c=p+a,n.length>0)for(let t,e=0;e<n.length;e++)t=n[e],t.row>h||(c>=t.index?(a+=t.cs,c+=t.cs,t.rs-=1,t.row=h+1,t.rs<1&&(n.splice(e,1),e--)):p===g-1&&(t.rs-=1,t.row=h+1,t.rs<1&&(n.splice(e,1),e--)));if(i){if(t!==e&&t!==s||(l.cs=null!==l.cs&&l.cs<c?l.cs:c,l.ce=null!==l.ce&&l.ce>c+d?l.ce:c+d,l.rs=null!==l.rs&&l.rs<h?l.rs:h,l.re=null!==l.re&&l.re>h+u?l.re:h+u,l._i+=1),2===l._i){i=!1,n=[],o=[],h=-1;break}}else{const t=l.cs<c?l.cs:c,e=l.ce>c+d?l.ce:c+d,s=l.rs<h?l.rs:h,i=l.re>h+u?l.re:h+u;if(Ve.getOverlapRangeAtIndex(l.cs,l.ce,c,c+d)&&Ve.getOverlapRangeAtIndex(l.rs,l.re,h,h+u)&&(l.cs!==t||l.ce!==e||l.rs!==s||l.re!==i)){l.cs=t,l.ce=e,l.rs=s,l.re=i,h=-1,n=[],o=[];break}}u>0&&o.push({index:c,cs:d+1,rs:u,row:-1}),a+=t.colSpan-1}n=n.concat(o).sort(((t,e)=>t.index-e.index)),o=[]}return l}#md(t,e){let s=[],i=[];for(let n,o,l=0,r=t.length;l<r;l++){n=t[l].cells,o=0;for(let t,r,a,h,c=0,d=n.length;c<d;c++){if(t=n[c],a=t.colSpan-1,h=t.rowSpan-1,r=c+o,s.length>0)for(let t,e=0;e<s.length;e++)t=s[e],t.row>l||(r>=t.index?(o+=t.cs,r+=t.cs,t.rs-=1,t.row=l+1,t.rs<1&&(s.splice(e,1),e--)):c===d-1&&(t.rs-=1,t.row=l+1,t.rs<1&&(s.splice(e,1),e--)));Ve.getOverlapRangeAtIndex(e.cs,e.ce,r,r+a)&&Ve.getOverlapRangeAtIndex(e.rs,e.re,l,l+h)&&Ie.utils.addClass(t,"se-selected-table-cell"),h>0&&i.push({index:r,cs:a+1,rs:h,row:-1}),o+=t.colSpan-1}s=s.concat(i).sort(((t,e)=>t.index-e.index)),i=[]}}initCellSelection(t){this.#qc.setState("fixedCell",t),this.#N.selectedCells?.length||this.#qc.setState("selectedCells",[t]),this.#cd=t.nodeName,this.#qc.setState("selectedTable",Ie.query.getParentElement(t,"TABLE")),this.deleteStyleSelectedCells(),Ie.utils.addClass(t,"se-selected-cell-focus")}startCellSelection(t,e){this.#N.isShiftPressed||this.#N.ref||this.#si(),this.#qc.setState("isShiftPressed",e),this.initCellSelection(t),e?(this.#fi.shiftOff=this.#J.eventManager.addGlobalEvent("keyup",this.#ad,!1),this.#fi.on=this.#J.eventManager.addGlobalEvent("mousedown",this.#ld,!1)):this.#fi.on=this.#J.eventManager.addGlobalEvent("mousemove",this.#ld,!1),this.#fi.off=this.#J.eventManager.addGlobalEvent("mouseup",this.#rd,!1),this.#fi.touchOff=this.#J.eventManager.addGlobalEvent("touchmove",this.#hd,!1)}deleteStyleSelectedCells(){Ie.utils.removeClass([this.#N.fixedCell,this.#N.selectedCell],"se-selected-cell-focus");const t=this.#N.fixedCell?.closest("table");if(t){const e=t.querySelectorAll(".se-selected-table-cell");for(let t=0,s=e.length;t<s;t++)Ie.utils.removeClass(e[t],"se-selected-table-cell")}}recallStyleSelectedCells(){if(this.#N.selectedCells){const t=this.#N.selectedCells;for(let e=0,s=t.length;e<s;e++)Ie.utils.addClass(t[e],"se-selected-table-cell")}}focusCellEdge(t){Ne.isMobile||this.#J.focusManager.focusEdge(t)}#dd(t){this.#J.store.set("_preventBlur",!0);const e=Ie.query.getParentElement(Ie.query.getEventTarget(t),Ie.check.isTableCell);if(this.#N.isShiftPressed){if(e===this.#N.fixedCell)return this.#qc.setState("isShiftPressed",!1),this.deleteStyleSelectedCells(),this.#qc._editorEnable(!0),void this.#si();this.#qc._editorEnable(!1)}else if(!this.#N.ref){if(e===this.#N.fixedCell)return;this.#qc._editorEnable(!1)}e&&e!==this.#N.selectedCell&&this.#cd===e.nodeName&&this.#N.selectedTable===Ie.query.getParentElement(e,"TABLE")&&(this.#qc.setState("selectedCell",e),this.setMultiCells(this.#N.fixedCell,this.#N.selectedCell))}#ud(t){t.stopPropagation(),this.#N.isShiftPressed?this.#fi.touchOff&&=this.#J.eventManager.removeGlobalEvent(this.#fi.touchOff):(this.#qc._editorEnable(!0),this.#si());const e=this.#N.fixedCell;if(!e||!this.#N.selectedTable)return;if(this.#Zc.setMergeSplitButton(),this.#qc.setState("selectedCells",Array.from(this.#N.selectedTable.querySelectorAll(".se-selected-table-cell"))),this.#N.isShiftPressed)return;e&&this.#N.selectedCell&&(this.focusCellEdge(e),e===this.#N.selectedCell&&Ie.utils.removeClass(e,"se-selected-table-cell"));const s=this.#N.selectedCells?.length>0?this.#N.selectedCell:e;this.#qc._setController(s)}#pd(){if(this.#N.ref){this.#si(),this.#qc._editorEnable(!0),this.focusCellEdge(this.#N.fixedCell);const t=this.#N.selectedCells?.length>0?this.#N.selectedCell:this.#N.fixedCell;this.#qc._setController(t)}else this.#qc._closeController()}#gd(){this.#qc.resetInfo()}#si(){this.#J.ui.disableBackWrapper();const t=this.#fi;for(const e in t)t[e]&&=this.#J.eventManager.removeGlobalEvent(t[e])}init(){this.#si()}},{_w:Wa}=Ne;const Ua=class{#qc;#N;#J;constructor(t,{pluginOptions:e,controller_table:s}){this.#qc=t,this.#N=t.state,this.#J=t.$,this.sliderType="",this.resizeButton=s.querySelector("._se_table_resize"),this.resizeText=s.querySelector("._se_table_resize > span > span"),this.columnFixedButton=s.querySelector("._se_table_fixed_column"),this.headerButton=s.querySelector("._se_table_header"),this.captionButton=s.querySelector("._se_table_caption");const i=function({lang:t,icons:e,options:s}){const i=s.get("_rtl")?["right","center","left","justify"]:["left","center","right","justify"];let n="";for(let s,o,l=0;l<i.length;l++)s=i[l],o=t["align"+s.charAt(0).toUpperCase()+s.slice(1)],n+=`\n\t\t<button type="button" class="se-btn se-tooltip" data-command="props_align" data-value="${s}" title="${o}" aria-label="${o}">\n\t\t\t${e["align_"+s]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${o}</span>\n\t\t\t</span>\n\t\t</button>`;const o=["top","middle","bottom"];let l="";for(let s,i,n=0;n<o.length;n++)s=o[n],i=t["align"+s.charAt(0).toUpperCase()+s.slice(1)],l+=`\n\t\t<button type="button" class="se-btn se-tooltip" data-command="props_align_vertical" data-value="${s}" title="${i}" aria-label="${i}">\n\t\t\t${e["align_"+s]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${i}</span>\n\t\t\t</span>\n\t\t</button>`;const r=`\n\t\t<div class="se-controller-content">\n\t\t\t<div class="se-controller-header">\n\t\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn close" title="${t.close}" aria-label="${t.close}">${e.cancel}</button>\n\t\t\t\t<span class="se-controller-title">${t.tableProperties}</span>\n\t\t\t</div>\n\t\t\t<div class="se-controller-body">\n\n\t\t\t\t<span>${t.border}</span>\n\t\t\t\t<div class="se-form-group se-form-w0">\n\t\t\t\t\t<button type="button" data-command="props_onborder_format" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e[va.all]}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.border}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_onborder_style" class="se-btn se-btn-select se-tooltip se-border-style">\n\t\t\t\t\t\t<span class="se-txt"></span>\n\t\t\t\t\t\t${e.arrow_down}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.border}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-color-input __se_border_color" placeholder="${t.color}" />\n\t\t\t\t\t<button type="button" data-command="props_onpalette" data-value="border" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.color_palette}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.colorPicker}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-input-control __se__border_size" placeholder="${t.width}" />\n\t\t\t\t</div>\n\n\t\t\t\t<span>${t.color}</span>\n\t\t\t\t<div class="se-form-group se-form-w0">\n\t\t\t\t\t<button type="button" data-command="props_onpalette" data-value="font" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.font_color}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.fontColor}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-color-input __se_font_color" placeholder="${t.fontColor}" />\n\t\t\t\t\t<button type="button" data-command="props_onpalette" data-value="back" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.background_color}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.backgroundColor}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-color-input __se_back_color" placeholder="${t.backgroundColor}" />\n\t\t\t\t</div>\n\n\t\t\t\t<span>${t.font}</span>\n\t\t\t\t<div class="se-form-group se-form-w0">\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="bold" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.bold}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.bold}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="underline" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.underline}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.underline}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="italic" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.italic}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.italic}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="strike" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.strike}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.strike}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\n\t\t\t\t<div class="se-table-props-align">\n\t\t\t\t\t<span>${t.align} <span class="__se__a_table_t">( ${t.table} )</span></span>\n\t\t\t\t\t<div class="se-form-group se-form-w0 se-list-inner">\n\t\t\t\t\t\t<div class="__se__a_h">\n\t\t\t\t\t\t\t${n}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="__se__a_v">\n\t\t\t\t\t\t\t${l}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="se-form-group se-form-w0 se-form-flex-btn">\n\t\t\t\t<button type="button" class="se-btn se-btn-success" data-command="props_submit" title="${t.submitButton}" aria-label="${t.submitButton}">${e.checked}</button>\n\t\t\t\t<button type="button" class="se-btn se-btn-danger" data-command="revert" title="${t.revert}" aria-label="${t.revert}">${e.revert}</button>\n\t\t\t</div>\n\t\t</div>`,a=Ie.utils.createElement("DIV",{class:"se-controller se-table-props"},r);return{html:a,controller_props_title:a.querySelector(".se-controller-title"),borderButton:a.querySelector('[data-command="props_onborder_style"]'),borderFormatButton:a.querySelector('[data-command="props_onborder_format"]'),cell_alignment:a.querySelector(".se-table-props-align .__se__a_h"),cell_alignment_vertical:a.querySelector(".se-table-props-align .__se__a_v"),cell_alignment_table_text:a.querySelector(".se-table-props-align .__se__a_table_t"),border_style:a.querySelector('[data-command="props_onborder_style"] .se-txt'),border_color:a.querySelector(".__se_border_color"),border_width:a.querySelector(".__se__border_size"),back_color:a.querySelector(".__se_back_color"),font_color:a.querySelector(".__se_font_color"),palette_border_button:a.querySelector('[data-command="props_onpalette"][data-value="border"]'),font_bold:a.querySelector('[data-command="props_font_style"][data-value="bold"]'),font_underline:a.querySelector('[data-command="props_font_style"][data-value="underline"]'),font_italic:a.querySelector('[data-command="props_font_style"][data-value="italic"]'),font_strike:a.querySelector('[data-command="props_font_style"][data-value="strike"]')}}(this.#J),n=[this.#qc.controller_table,this.#qc.controller_cell];this.controller_props=new ki(this,this.#J,i.html,{position:"bottom",parents:n,isInsideForm:!0}),this.controller_props_title=i.controller_props_title;const o=Ie.utils.createElement("DIV",{class:"se-controller se-list-layer"},null);this.controller_colorPicker=new ki(this,this.#J,o,{position:"bottom",parents:[this.controller_props].concat(n),isInsideForm:!0,isWWTarget:!1,initMethod:()=>{this.colorPicker.hueSlider.close(),Ie.utils.removeClass(this.controller_colorPicker.currentTarget,"on")}}),this.colorPicker=new gr(this,this.#J,"",{form:o,colorList:e.colorList||xa,splitNum:5,disableRemove:!0,hueSliderOptions:{controllerOptions:{isOutsideForm:!0,parents:[this.controller_colorPicker],parentsHide:!0}}});const l=function(){let t="";for(let e,s=0,i=fa.length;s<i;s++)e=fa[s],t+=`\n\t\t<div title="${e}" aria-label="${e}" style="padding: 0 12px;">\n\t\t\t<span class="se-txt">${e}</span>\n\t\t</div>`;const e=Ie.utils.createElement("DIV",null,t);return{items:fa,menus:e.querySelectorAll("div")}}(),r=i.borderButton;this.selectMenu_props_border=new Ei(this.#J,{checkList:!1,position:"bottom-center"}),this.selectMenu_props_border.on(r,this.#vd.bind(this)),this.selectMenu_props_border.create(l.items,l.menus);const a=Oa(this.#J.lang,this.#J.icons,[]),h=i.borderFormatButton;this.selectMenu_props_border_format=new Ei(this.#J,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:5}),this.selectMenu_props_border_format.on(h,this.#bd.bind(this,"all")),this.selectMenu_props_border_format.create(a.items,a.menus);const c=Oa(this.#J.lang,this.#J.icons,ba);this.selectMenu_props_border_format_oneCell=new Ei(this.#J,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:6}),this.selectMenu_props_border_format_oneCell.on(h,this.#bd.bind(this,"outside")),this.selectMenu_props_border_format_oneCell.create(c.items,c.menus),this.maxText=this.#J.lang.maxSize,this.minText=this.#J.lang.minSize,this.propTargets={cell_alignment:i.cell_alignment,cell_alignment_vertical:i.cell_alignment_vertical,cell_alignment_table_text:i.cell_alignment_table_text,border_format:h,border_style:i.border_style,border_color:i.border_color,border_width:i.border_width,back_color:i.back_color,font_color:i.font_color,palette_border_button:i.palette_border_button,font_bold:i.font_bold,font_underline:i.font_underline,font_italic:i.font_italic,font_strike:i.font_strike},this._propsCache=[],this._currentFontStyles=[],this._propsAlignCache="",this._propsVerticalAlignCache="",this._typeCache=""}get#Wc(){return this.#qc.selectionService}colorPickerAction(t){this.applyColorPicker(t)}controllerAction(t){const e=t.getAttribute("data-command");if(!e)return;const s=t.getAttribute("data-value");switch(e){case"props_onborder_format":this.openBorderFormatMenu();break;case"props_onborder_style":this.openBorderStyleMenu();break;case"props_onpalette":this.openColorPalette(t,s);break;case"props_font_style":this.toggleFontStyle(s);break;case"props_submit":this.submitProps(t);break;case"props_align":this.setAlignProps(t.getAttribute("data-value"));break;case"props_align_vertical":this.setVerticalAlignProps(t.getAttribute("data-value"))}}openTableProps(t){this.controller_props.currentTarget===t&&"block"===this.controller_props.form?.style.display?this.controller_props.close():(this.controller_props_title.textContent=this.#J.lang.tableProperties,this.#yd("table"),this.controller_props.open(t,this.#qc.controller_table.form,{isWWTarget:!1,initMethod:null,addOffset:null}))}openCellProps(t){this.controller_props.currentTarget===t&&"block"===this.controller_props.form?.style.display?this.controller_props.close():(this.controller_props_title.textContent=this.#J.lang.cellProperties,this.#yd("cell"),this.controller_props.open(t,this.#qc.controller_cell.form,{isWWTarget:!1,initMethod:null,addOffset:null}))}openBorderFormatMenu(){1===this._propsCache.length?this.selectMenu_props_border_format_oneCell.open():this.selectMenu_props_border_format.open()}openBorderStyleMenu(){this.selectMenu_props_border.open()}openColorPalette(t,e){const{back_color:s,font_color:i,border_color:n}=this.propTargets,o="border"===e?n:"back"===e?s:i;this.controller_colorPicker.isOpen&&e===this.sliderType?this.controller_colorPicker.close():(this.sliderType=e,Ie.utils.addClass(t,"on"),this.colorPicker.init(o?.value||"",t),this.controller_colorPicker.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null}))}toggleFontStyle(t){Ie.utils.toggleClass(this.propTargets[`font_${t}`],"on")}toggleHeader(){const t=this.headerButton,e=Ie.utils.hasClass(t,"active"),s=this.#qc._element;if(Va(s),e)Ie.utils.removeItem(s.querySelector("thead"));else{const t=Ie.utils.createElement("THEAD");t.innerHTML="<tr>"+Na("th",this.#N.logical_cellCnt)+"</tr>",s.insertBefore(t,s.querySelector("tbody"))}Ie.utils.toggleClass(t,"active"),/TH/i.test(this.#N.tdElement.nodeName)?this.#qc._closeController():this.#qc._setCellControllerPosition(this.#N.tdElement,!1)}toggleCaption(){const t=this.captionButton,e=Ie.utils.hasClass(t,"active"),s=this.#qc._element;if(e)Ie.utils.removeItem(s.querySelector("caption"));else{const t=Ie.utils.createElement("CAPTION",{class:`se-table-caption-${this.#qc.captionPosition}`});t.innerHTML="<div><br></div>",s.insertBefore(t,s.firstElementChild)}Ie.utils.toggleClass(t,"active"),this.#qc._setCellControllerPosition(this.#N.tdElement,!1)}resetHeaderButton(t){t.querySelector("thead")?Ie.utils.addClass(this.headerButton,"active"):Ie.utils.removeClass(this.headerButton,"active")}resetCaptionButton(t){t.querySelector("caption")?Ie.utils.addClass(this.captionButton,"active"):Ie.utils.removeClass(this.captionButton,"active")}resetPropsAlign(){const{cell_alignment:t}=this.propTargets,e=t.querySelector('[data-value="left"]'),s=t.querySelector('[data-value="right"]'),i=e.parentElement,n=s.parentElement;i.appendChild(s),n.appendChild(e)}revertProps(){const t=this._propsCache;for(let e=0,s=t.length;e<s;e++)t[e][0].style.cssText=t[e][1];this.#Cd(this.propTargets.cell_alignment,this._propsAlignCache,!0),this.#Cd(this.propTargets.cell_alignment_vertical,this._propsVerticalAlignCache,!0),Ie.check.isTable(t[0][0])&&this.#N.figureElement&&(this.#N.figureElement.style.float=this._propsAlignCache)}applyColorPicker(t){const e=this.propTargets[`${this.sliderType}_color`];e.style.borderColor=e.value=t,this.controller_colorPicker.close()}setAlignProps(t){this.#Cd(this.propTargets.cell_alignment,t,!1)}setVerticalAlignProps(t){this.#Cd(this.propTargets.cell_alignment_vertical,t,!1)}setTableLayout(t,e,s,i){if(t.includes("width")){const t=this.#N.figureElement;if(!t)return;let s,n;e?(s=this.#J.icons.reduction,n=this.minText,i||(t.style.width="100%")):(s=this.#J.icons.expansion,n=this.maxText,i||(t.style.width="max-content")),Ie.utils.changeElement(this.resizeButton.firstElementChild,s),Ie.utils.changeTxt(this.resizeText,n)}t.includes("column")&&(s?(Ie.utils.removeClass(this.#qc._element,"se-table-layout-auto"),Ie.utils.addClass(this.#qc._element,"se-table-layout-fixed"),Ie.utils.addClass(this.columnFixedButton,"active")):(Ie.utils.removeClass(this.#qc._element,"se-table-layout-fixed"),Ie.utils.addClass(this.#qc._element,"se-table-layout-auto"),Ie.utils.removeClass(this.columnFixedButton,"active")))}submitProps(t){try{t.disabled=!0;const e=this.#qc.controller_table.form.contains(this.controller_props.currentTarget),s=e?[this.#qc._element]:this.#N.selectedCells,i=s[0],n=Wa.getComputedStyle(i),{border_format:o,border_color:l,border_style:r,border_width:a,back_color:h,font_color:c,cell_alignment:d,cell_alignment_vertical:u}=this.propTargets,p=o.getAttribute("se-border-format")||"",g="all"!==p,m=("none"===r.textContent?"":r.textContent)||"",f="none"===p||!m,v=d.getAttribute("se-cell-align")||"",b=u.getAttribute("se-cell-align")||"",y=f?"":l.value.trim()||n.borderColor;let C=f?"":a.value.trim()||n.borderWidth;C+=Ve.is(C)?"px":"";const w=h.value.trim(),_=c.value.trim(),x=g&&!f&&C,$=`${C} ${m} ${y}`,k={left:[],top:[],right:[],bottom:[],middle:[],all:null};if(e){const t=i.style;this.#N.figureElement&&(this.#N.figureElement.style.float=v,this.#N.figureElement.style.verticalAlign=b),t.backgroundColor=w,t.color=_,this.#wd(t),x||(t.border=f?t.borderLeft=t.borderTop=t.borderRight=t.borderBottom="":$),k.left=k.top=k.right=k.bottom=s}else{const t=i.parentElement;let{rs:e,re:n,cs:o,ce:l}=this.#N.ref||{rs:t.rowIndex||0,re:t.rowIndex||0,cs:i.cellIndex||0,ce:i.cellIndex||0};const r=new Array(n-e+1).fill(0).map((()=>new Array(l-o+1).fill(0))),a=o;n-=e,e-=e,l-=o,o-=o;let h=t;for(let t,i,c,d,u,p=0,g=0,m=s.length,y=0;p<m;p++,g++){t=s[p],d=t.colSpan,u=t.rowSpan,c=t.cellIndex-a,h!==t.parentElement&&(y++,g=0,h=t.parentElement);let m=0;for(;m<=c;)c+=r[y][m]||0,m++;try{if(u>1){const t=u-1;for(let e=y;e<=y+t;e++)r[e][c]+=d-(y===e?1:0)}else d>1&&(r[y][c]+=d-1)}catch{}const C=y+u-1===n;y===e&&k.top.push(t),(y===n||C)&&k.bottom.push(t),c===o&&k.left.push(t),c!==l&&c+d-1!==l||k.right.push(t),C||y===e||y===n||c===o||c===l||k.middle.push(t),i=t.style,i.textAlign=v,i.verticalAlign=b,i.backgroundColor=w,i.color=_,this.#wd(i),x||(i.border=f?i.borderLeft=i.borderTop=i.borderRight=i.borderBottom="":$)}0===k.middle.length&&(k.middle=s)}k.all=s,x&&this.#_d(k,p,$),this.#qc.historyPush(),this.controller_props.close(),this.#N.tdElement&&(this.#Wc.recallStyleSelectedCells(),this.#qc.setCellInfo(this.#N.tdElement,!0),Ie.utils.addClass(this.#N.tdElement,"se-selected-cell-focus"))}catch(t){console.warn("[SUNEDITOR.plugins.table.setProps.error]",t)}finally{t.disabled=!1}}closeProps(){this.controller_props.close(),this.controller_colorPicker.close()}#yd(t){this._typeCache=t;const e="table"===t,s=e?[this.#qc._element]:this.#N.selectedCells;if(!s?.[0])return;const{border_format:i,border_color:n,border_style:o,border_width:l,back_color:r,font_color:a,cell_alignment:h,cell_alignment_vertical:c,cell_alignment_table_text:d,font_bold:u,font_underline:p,font_italic:g,font_strike:m}=this.propTargets,{border:f,backgroundColor:v,color:b,textAlign:y,verticalAlign:C,fontWeight:w,textDecoration:_,fontStyle:x}=Wa.getComputedStyle(s[0]),$=this.#xd(f);h.querySelector('[data-value="justify"]').style.display=e?"none":"",d.style.display=e?"":"none",c.style.display=e?"none":"";let k=Be.rgb2hex($.c),S=$.s,E=$.w,T=Be.rgb2hex(v),M=Be.rgb2hex(b),H=/.+/.test(w),L=/underline/i.test(_),N=/line-through/i.test(_),A=/italic/i.test(x),B=e?this.#N.figureElement?.style.float:y,I=C;this._propsCache=[];for(let t,i,n=0;t=s[n];n++){const{cssText:s,border:n,backgroundColor:o,color:l,textAlign:r,verticalAlign:a,fontWeight:h,textDecoration:c,fontStyle:d}=t.style;if(this._propsCache.push([t,s]),i)continue;const{c:u,s:p,w:g}=this.#xd(n);let m=o,f=l;if(m||f){const e=Wa.getComputedStyle(t);m&&(m=e.backgroundColor),f&&(f=e.color)}k&&$.c!==u&&(k=""),S&&$.s!==p&&(S=""),E&&$.w!==g&&(E=""),T!==Be.rgb2hex(m)&&(T=""),M!==Be.rgb2hex(f)&&(M=""),B!==(e?this.#N.figureElement?.style.float:r)&&(B=""),I&&I!==a&&(I=""),H&&H!==/.+/.test(h)&&(H=!1),L&&L!==/underline/i.test(c)&&(L=!1),N&&N!==/line-through/i.test(c)&&(N=!1),A&&A!==/italic/i.test(d)&&(A=!1),k&&S&&E&&T&&M||(i=!0)}i.firstElementChild.innerHTML=this.#J.icons[va[1===s.length?"outside":"all"]],i.setAttribute("se-border-format","all"),Ie.utils.removeClass(i,"active"),S||=fa[0],o.textContent=S,n.style.borderColor=n.value=k,l.value=E,this.#$d(S===fa[0]),r.value=r.style.borderColor=T,a.value=a.style.borderColor=M,H&&Ie.utils.addClass(u,"on"),L&&Ie.utils.addClass(p,"on"),N&&Ie.utils.addClass(m,"on"),A&&Ie.utils.addClass(g,"on"),this.#Cd(h,this._propsAlignCache=B,!0),this.#Cd(c,this._propsVerticalAlignCache=I,!0)}#wd(t){const{font_bold:e,font_italic:s,font_strike:i,font_underline:n}=this.propTargets;t.fontWeight=Ie.utils.hasClass(e,"on")?"bold":"",t.fontStyle=Ie.utils.hasClass(s,"on")?"italic":"",t.textDecoration=((Ie.utils.hasClass(i,"on")?"line-through ":"")+(Ie.utils.hasClass(n,"on")?"underline":"")).trim()}#xd(t){const e=t.split(/\s(?![^()]*\))/);let s="",i="",n="";return 3===e.length?(s=e[0],i=e[1],n=e[2]):2===e.length?/\d/.test(e[0])?(s=e[0],i=e[1]):(i=e[0],n=e[1]):1===e.length&&(/\d/.test(e[0])?s=e[0]:i=e[0]),{w:s,s:i,c:Be.rgb2hex(n)}}#_d(t,e,s){const{left:i,top:n,right:o,bottom:l,all:r}=t;switch(e){case"inside":if(1===r.length)return;Ie.utils.setStyle(r.filter((t=>!l.includes(t))),_a,s),Ie.utils.setStyle(r.filter((t=>!o.includes(t))),wa,s);break;case"horizon":if(1===r.length)return;Ie.utils.setStyle(r.filter((t=>!l.includes(t))),_a,s);break;case"vertical":if(1===r.length)return;Ie.utils.setStyle(r.filter((t=>!o.includes(t))),wa,s);break;case"outside":Ie.utils.setStyle(i,ya,s),Ie.utils.setStyle(n,Ca,s),Ie.utils.setStyle(o,wa,s),Ie.utils.setStyle(l,_a,s);break;case"left":Ie.utils.setStyle(i,ya,s);break;case"top":Ie.utils.setStyle(n,Ca,s);break;case"right":Ie.utils.setStyle(o,wa,s);break;case"bottom":Ie.utils.setStyle(l,_a,s)}}#$d(t){const{border_color:e,border_width:s,palette_border_button:i}=this.propTargets;t?(e.disabled=!0,s.disabled=!0,i.disabled=!0,s.disabled=!0):(e.disabled=!1,s.disabled=!1,i.disabled=!1,s.disabled=!1)}#Cd(t,e,s){Ie.utils.removeClass(t.querySelectorAll("button"),"on"),s||t.getAttribute("se-cell-align")!==e?(Ie.utils.addClass(t.querySelector(`[data-value="${e}"]`),"on"),t.setAttribute("se-cell-align",e)):t.setAttribute("se-cell-align","")}#vd(t){this.propTargets.border_style.textContent=t,this.#$d(t===fa[0]),this.selectMenu_props_border.close()}#bd(t,e){const{border_format:s}=this.propTargets;s.setAttribute("se-border-format",e),s.firstElementChild.innerHTML=this.#J.icons[va[e]],e!==t?Ie.utils.addClass(s,"active"):Ie.utils.removeClass(s,"active"),this.selectMenu_props_border_format.close(),this.selectMenu_props_border_format_oneCell.close()}init(){const{border_format:t,border_color:e,border_style:s,border_width:i,back_color:n,font_color:o,cell_alignment:l,cell_alignment_vertical:r,font_bold:a,font_underline:h,font_italic:c,font_strike:d}=this.propTargets;Ie.utils.removeClass([t,e,s,i,n,o,l,r,a,h,c,d],"on")}},{_w:Za,ON_OVER_COMPONENT:Ga}=Ne;class ja extends Tr{static key="table";static className="";static options={isInputComponent:!0};static component(t){return Ie.check.isTable(t)?t:null}#kd;#Sd;#Ed;#Td;#Md;#Hd=[];#Ld=!0;#Nd=!1;#Ad=!1;constructor(t,e){super(t),this.title=this.$.lang.table,this.icon="table",this.figureScrollList=["se-scroll-figure-xy","se-scroll-figure-x","se-scroll-figure-y"],this.figureScroll="string"==typeof e.scrollType?e.scrollType.toLowerCase():"x",this.captionPosition="bottom"!==e.captionPosition?"top":"bottom",this.cellControllerTop="table"==("cell"!==e.cellControllerPosition?"table":"cell");const s=Ie.utils.createElement("DIV",{class:"se-dropdown se-selector-table"},'\n\t<div class="se-table-size">\n\t\t<div class="se-table-size-picker se-controller-table-picker"></div>\n\t\t<div class="se-table-size-highlighted"></div>\n\t\t<div class="se-table-size-unhighlighted"></div>\n\t</div>\n\t<div class="se-table-size-display">1 x 1</div>'),i=s.querySelector(".se-controller-table-picker"),n=function({lang:t,icons:e}){const s=`\n\t<div class="se-arrow se-arrow-down se-visible-hidden"></div>\n\t<div class="se-btn-group">\n\t\t<button type="button" data-command="openTableProperties" class="se-btn se-tooltip">\n\t\t\t${e.table_properties}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.tableProperties}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="layout" class="se-btn se-tooltip _se_table_fixed_column">\n\t\t\t${e.fixed_column_width}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.fixedColumnWidth}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="header" class="se-btn se-tooltip _se_table_header">\n\t\t\t${e.table_header}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.tableHeader}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="caption" class="se-btn se-tooltip _se_table_caption">\n\t\t\t${e.caption}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.caption}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="resize" class="se-btn se-tooltip _se_table_resize">\n\t\t\t${e.reduction}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.minSize}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="copy" class="se-btn se-tooltip">\n\t\t\t${e.copy}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.copy}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="remove" class="se-btn se-tooltip">\n\t\t\t${e.delete}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.remove}</span>\n\t\t\t</span>\n\t\t</button>\n\t</div>`;return Ie.utils.createElement("DIV",{class:"se-controller se-controller-table"},s)}(this.$),o=function({lang:t,icons:e},s){const i=`\n\t<div class="se-arrow se-arrow-${s?"down se-visible-hidden":"up"}"></div>\n <div class="se-btn-group">\n\t\t<button type="button" data-command="openCellProperties" class="se-btn se-tooltip">\n\t\t\t${e.cell_properties}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.cellProperties}</span>\n\t\t\t</span>\n\t\t</button>\n <button type="button" data-command="oncolumn" class="se-btn se-tooltip">\n ${e.table_column}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.column}</span>\n </span>\n </button>\n <button type="button" data-command="onrow" class="se-btn se-tooltip">\n ${e.table_row}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.row}</span>\n </span>\n </button>\n <button type="button" data-command="merge" class="se-btn se-tooltip" style="display: none;">\n ${e.merge_cell}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.mergeCells}</span>\n </span>\n </button>\n <button type="button" data-command="onsplit" class="se-btn se-tooltip">\n ${e.split_cell}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.splitCells}</span>\n </span>\n </button>\n\t\t<button type="button" data-command="unmerge" class="se-btn se-tooltip">\n ${e.unmerge_cell}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.unmergeCells}</span>\n </span>\n </button>\n </div>`,n=Ie.utils.createElement("DIV",{class:"se-controller se-controller-table-cell"},i);return{html:n,splitButton:n.querySelector('[data-command="onsplit"]'),columnButton:n.querySelector('[data-command="oncolumn"]'),rowButton:n.querySelector('[data-command="onrow"]'),mergeButton:n.querySelector('[data-command="merge"]'),unmergeButton:n.querySelector('[data-command="unmerge"]')}}(this.$,this.cellControllerTop);this.$.contextProvider.applyToRoots((t=>{t.get("wrapper").appendChild(Ie.utils.createElement("DIV",{class:ua.replace(/^\./,"")})),t.get("wrapper").appendChild(Ie.utils.createElement("DIV",{class:pa.replace(/^\./,"")})),t.get("wrapper").appendChild(Ie.utils.createElement("DIV",{class:ga.replace(/^\./,"")})),t.get("wrapper").appendChild(Ie.utils.createElement("DIV",{class:ma.replace(/^\./,"")}))})),this.cellControllerTop?(this.controller_cell=new ki(this,this.$,o.html,{position:"top"}),this.controller_table=new ki(this,this.$,n,{position:"top"}),this.controller_cell.sibling=this.controller_table.form,this.controller_table.sibling=this.controller_cell.form,this.controller_table.siblingMain=!0):(this.controller_table=new ki(this,this.$,n,{position:"top"}),this.controller_cell=new ki(this,this.$,o.html,{position:"bottom"})),this.figure=new Pi(this,this.$,null,{}),this._element=null,this.state=$a,this.#kd=s,this.#Sd=s.querySelector(".se-table-size-highlighted"),this.#Ed=s.querySelector(".se-table-size-unhighlighted"),this.#Td=s.querySelector(".se-table-size-display");const l=Ka.bind(this,!0),r=Ka.bind(this,!1),a={...o,openCellMenuFunc:l,closeCellMenuFunc:r};this.cellService=new Ra(this,a),this.clipboardService=new Pa(this),this.gridService=new za(this,a),this.resizeService=new Da(this),this.selectionService=new qa(this),this.styleService=new Ua(this,{pluginOptions:e,controller_table:n}),this.$.menu.initDropdownTarget(ja,s),this.$.eventManager.addEvent(i,"mousemove",this.#Bd.bind(this)),this.$.eventManager.addEvent(i,"click",this.#Id.bind(this))}setState(t,e){this.state[t]=e}#Vd(){Object.assign(this.state,$a)}off(){this.#Od()}componentSelect(t){if(this.#Rd(t),this.state.figureElement||this.setTableInfo(t),this.#Ld="100%"===this.state.figureElement?.style.width,this.#Nd=Ie.utils.hasClass(t,"se-table-layout-fixed")||"fixed"===t.style.tableLayout,this.styleService.setTableLayout(this.#Ld?"width|column":"width",this.#Ld,this.#Nd,!0),fi.get("__overInfo")===Ga)return;if(!this.state.tdElement)return;this.setCellInfo(this.state.tdElement,!0);const e=this.state.selectedCells?.length>1,s=Ie.query.getParentElement(t,Ie.check.isFigure);this.controller_table.open(s,null,{isWWTarget:!1,initMethod:null,addOffset:null,disabled:e}),this.state.fixedCell&&(this.cellService.setUnMergeButton(),this.controller_cell.open(this.state.tdElement,this.cellControllerTop?s:null,{isWWTarget:!1,initMethod:null,addOffset:null,disabled:e}))}componentDeselect(){this.resetInfo()}componentDestroy(t){if(!t)return;const e=t.parentNode;Ie.utils.removeItem(t),this._closeTableSelectInfo(),e!==this.$.frameContext.get("wysiwyg")&&this.$.nodeTransform.removeAllParents(e,(function(t){return 0===t.childNodes.length}),null),this.$.focusManager.focus(),this.$.history.push(!1)}componentCopy({event:t,cloneContainer:e}){const s=e.querySelectorAll(".se-selected-table-cell");Ie.utils.removeClass(s,"se-selected-table-cell|se-selected-cell-focus"),s.length>0&&(this.clipboardService.copySelectedTableCells(t,e,s),this.$.ui.showToast(this.$.lang.message_copy_success,550))}onPaste({event:t,doc:e}){const s=Ie.query.getParentElement(Ie.query.getEventTarget(t),Ie.check.isTableCell);if(!s)return;const i=e.body;if(1!==i.childElementCount)return;const n=this.$.component.get(i.firstElementChild);if(n?.pluginName!==ja.key)return;const o=n.target,l=this.clipboardService.pasteTableCellMatrix(o,s),{fixedCell:r,selectedCell:a}=this.selectionService.selectCells(l);return this.setState("selectedCells",l),this.setState("fixedCell",r),this.setState("selectedCell",a),this.setState("selectedTable",Ie.query.getParentElement(r,"TABLE")),!1}retainFormat(){return{query:"table",method:t=>{const e=t.querySelector("colgroup");let s=Ie.check.isFigure(t.parentNode)?t.parentNode:null;if(!e){const e=t.rows,s=function(t){const e=t.rows;let s=0;for(let t=0,i=e.length;t<i;t++){const i=e[t].cells;let n=0;for(let t=0,e=i.length;t<e;t++)n+=i[t].colSpan;s=Math.max(s,n)}return s}(t),i=new Array(s).fill(null);for(let t,n=0,o=e.length;n<o;n++){const o=e[n].cells;t=o.length;let l=0;const r=new Array(s).fill(!1);for(let e=0;e<t;e++){const t=o[e],n=t.style.width,a=t.colSpan||1;for(;l<s&&r[l];)l++;if(l>=s)break;n&&!i[l]&&(i[l]=n);for(let t=0;t<a;t++){if(l+t>=s||!n)continue;r[l+t]=!0;const e=parseFloat(n);for(let t=0;t<a;t++){const o=l+t;if(o>=s)continue;const r=i[o];if(null===r)i[o]=`width: ${n};`;else{const t=parseFloat(r.replace("width: ","").replace(";",""));1===a&&e!==t&&(i[o]=`width: ${n};`)}}}l+=a}if(t===s)break}const n=[];for(let t=0;t<s;t++){const e=i[t]?` style="${i[t]}"`:"";n.push(`<col${e}>`)}const o=Ie.utils.createElement("colgroup",null,n.join(""));t.insertBefore(o,t.firstElementChild);for(let t=0;t<e.length;t++){const s=e[t].cells;for(let t=0;t<s.length;t++)Ie.utils.setStyle(s[t],"width","")}}s?Ie.utils.addClass(s,"se-flex-component|se-input-component"):(s=Ie.utils.createElement("FIGURE",{class:"se-flex-component se-input-component"}),t.parentNode.insertBefore(s,t),s.appendChild(t));const i=t.style.width;if(i&&(s.style.width="auto"===i?"max-content":i,Ie.utils.setStyle(t,"width","")),this.figureScroll){const t=`se-scroll-figure-${this.figureScroll}`;Ie.utils.addClass(s,t),Ie.utils.removeClass(s,this.figureScrollList.filter((e=>e!==t)).join("|"))}else Ie.utils.removeClass(s,this.figureScrollList.join("|"))}}}setDir(){this.#Od(),this.styleService.resetPropsAlign()}onMouseMove({event:t}){if(this.resizeService.isResizing())return;const e=Ie.query.getEventTarget(t),s=Ie.query.getParentElement(e,Ta);s&&1!==t.buttons?!1!==this.resizeService.onResizeGuide(t,s)&&(this._element&&(this._element.style.cursor=""),this.resizeService.offResizeGuide()):this.resizeService.offResizeGuide()}onMouseDown({event:t}){this.setState("ref",null),this.setState("selectedCell",null);const e=Ie.query.getEventTarget(t);if(this._element&&Ie.query.getParentElement(e,Ma))return void this._closeController();const s=Ie.query.getParentElement(e,Ta);s&&(this.cellControllerTop||this.controller_cell.hide(),!1!==this.resizeService.readyResizeFromEdge(t,s)&&(this.state.isShiftPressed&&s!==this.state.fixedCell||(this.selectionService.deleteStyleSelectedCells(),/^TR$/i.test(s.nodeName)||(this.#Ad=!1,this.selectionService.startCellSelection(s,!1)))))}onMouseUp(){this.setState("isShiftPressed",!1)}onMouseLeave(){this.resizeService.offResizeGuide()}onKeyDown({event:t,range:e,line:s}){this.setState("ref",null);const i=t.code,n=Oe.isTab(i);if(this.$.ui.selectMenuOn||this.resizeService.isResizing()||!n&&this.#Ad||Oe.isCtrl(t))return;if(this.cellControllerTop||this.controller_cell.hide(),this.#Ad=Oe.isShift(t),n){this.selectionService.deleteStyleSelectedCells();const i=Ie.query.getParentElement(s,Ie.check.isTableCell);if(i&&e.collapsed&&Ie.check.isEdgePoint(e.startContainer,e.startOffset)){this._closeController();const e=this.#Ad;this.setState("isShiftPressed",this.#Ad=!1);const s=Ie.query.getParentElement(i,"table"),n=Ie.query.getListChildren(s,Ie.check.isTableCell,null),o=e?Ie.utils.prevIndex(n,i):Ie.utils.nextIndex(n,i);if(o===n.length&&!e){if(!Ie.query.getParentElement(i,"thead")){const t=s.rows,e=this.gridService.insertBodyRow(s,t.length,this.state.cellCnt).querySelector("td div");this.$.selection.setRange(e,0,e,0)}return t.preventDefault(),t.stopPropagation(),!1}if(-1===o&&e)return!1;const l=n[o];if(!l)return;const r=l.firstElementChild||l;return this.$.selection.setRange(r,0,r,0),t.preventDefault(),t.stopPropagation(),!1}}let o=null;if(!Oe.isShift(t)){if(o=Ie.query.getParentElement(s,Ie.check.isTableCell),!Ie.utils.hasClass(o,"se-selected-cell-focus"))return;return this.selectionService.deleteStyleSelectedCells(),this._editorEnable(!0),this.#Pd(),void this._closeController()}return this.state.isShiftPressed||this.state.ref?void 0:(o||=Ie.query.getParentElement(s,Ie.check.isTableCell),o?(this.#Ad=t.shiftKey,this.setState("fixedCell",o),this._closeController(),this.selectionService.startCellSelection(o,this.#Ad),!1):void 0)}onKeyUp({line:t}){this.#Ad=!1,this.state.isShiftPressed&&Ie.query.getParentElement(t,Ie.check.isTableCell)===this.state.fixedCell&&(this.selectionService.deleteStyleSelectedCells(),this._editorEnable(!0),this.#Pd()),this.setState("isShiftPressed",!1)}onScroll(){this.resizeService.offResizeGuide()}controllerAction(t){const e=t.getAttribute("data-command");if(e){switch(e){case"header":this.styleService.toggleHeader(),this.historyPush();break;case"caption":this.styleService.toggleCaption(),this.historyPush();break;case"onsplit":this.cellService.openSplitMenu();break;case"oncolumn":this.gridService.openColumnMenu();break;case"onrow":this.gridService.openRowMenu();break;case"openTableProperties":this.styleService.openTableProps(t);break;case"openCellProperties":this.styleService.openCellProps(t);break;case"revert":this.styleService.revertProps();break;case"merge":this.cellService.mergeCells(this.state.selectedCells);break;case"unmerge":this.cellService.unmergeCells(this.state.selectedCells);break;case"resize":this.#Ld=!this.#Ld,this.styleService.setTableLayout("width",this.#Ld,this.#Nd,!1),this.historyPush(),Za.setTimeout((()=>{this.$.component.select(this._element,ja.key,{isInput:!0})}),0);break;case"layout":this.#Nd=!this.#Nd,this.styleService.setTableLayout("column",this.#Ld,this.#Nd,!1),this.historyPush(),Za.setTimeout((()=>{this.$.component.select(this._element,ja.key,{isInput:!0})}),0);break;case"copy":this.$.component.copy(this.state.figureElement);break;case"remove":this.componentDestroy(this.state.figureElement)}/(^revert|Properties$)/.test(e)||this.styleService.closeProps(),/^(remove|on|open)/.test(e)||this._setCellControllerPosition(this.state.tdElement,this.state.isShiftPressed)}}setCellInfo(t,e){const s=this.setTableInfo(t);if(s&&(this.setState("fixedCell",t),this.setState("trElement",t.parentNode),this.styleService.resetHeaderButton(s),this.styleService.resetCaptionButton(s),e||0===this.state.physical_cellCnt)){this.state.tdElement!==t&&this.setState("tdElement",t),this.state.selectedCells?.length||this.setState("selectedCells",[t]);const e=s.rows;this.setState("trElements",e);const i=t.cellIndex;let n=0;for(let t=0,s=e[0].cells,i=e[0].cells.length;t<i;t++)n+=s[t].colSpan;const o=this.state.trElement.rowIndex;this.setState("rowIndex",o),this.setState("rowCnt",e.length),this.setState("physical_cellCnt",this.state.trElement.cells.length),this.setState("logical_cellCnt",n),this.setState("cellCnt",n),this.setState("physical_cellIndex",i),this.setState("current_colSpan",this.state.tdElement.colSpan-1),this.setState("current_rowSpan",this.state.trElement.cells[i].rowSpan-1);const l=Ba(s,o,i);this.setState("logical_cellIndex",l)}}setRowInfo(t){const e=this.setTableInfo(t).rows;this.setState("trElements",e),this.setState("rowCnt",e.length),this.setState("rowIndex",t.rowIndex)}setTableInfo(t){const e=this._element=Ie.query.getParentElement(t,"TABLE");return this.setState("selectedTable",e),this.setState("figureElement",Ie.query.getParentElement(e,Ie.check.isFigure)||e),e}resetInfo(){this.#Pd(),this.selectionService.deleteStyleSelectedCells(),this._editorEnable(!0),this._element=null,this.#Vd(),this.#Hd=[],this.#Ld=!1,this.#Nd=!1}historyPush(){this.selectionService.deleteStyleSelectedCells(),this.$.history.push(!1),this.selectionService.recallStyleSelectedCells()}_setController(t){if(!this.$.selection.get().isCollapsed&&!this.state.selectedCell)return void this.selectionService.deleteStyleSelectedCells();this.cellService.setUnMergeButton(),this.setState("tdElement",t),this.state.fixedCell===t&&Ie.utils.addClass(t,"se-selected-cell-focus"),this.state.selectedCells?.length||this.setState("selectedCells",[t]);const e=this.state.selectedTable||this._element||Ie.query.getParentElement(t,"TABLE");this.$.component.select(e,ja.key,{isInput:!0})}_setCellControllerPosition(t,e){this.setCellInfo(t,e),this.cellControllerTop||this.controller_cell.resetPosition(t)}_editorEnable(t){const e=this.$.frameContext.get("wysiwyg");e.setAttribute("contenteditable",t.toString()),t?Ie.utils.removeClass(e,"se-disabled"):Ie.utils.addClass(e,"se-disabled")}_closeController(){this.controller_table.close(!0),this.controller_cell.close(!0)}_closeTableSelectInfo(){this.$.component.deselect(),this._closeController()}#Rd(t){this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,infoOnly:!1})}#Od(){if(!this.#Sd)return;const t=this.#Sd.style,e=this.#Ed.style;t.width="1em",t.height="1em",e.width="5em",e.height="5em",Ie.utils.changeTxt(this.#Td,"1 x 1")}#Bd(t){t.stopPropagation();let e=Math.ceil(t.offsetX/18),s=Math.ceil(t.offsetY/18);e=e<1?1:e,s=s<1?1:s;const i=this.$.options.get("_rtl");i&&(e=11-e),this.#Sd.style.width=e+"em",this.#Sd.style.height=s+"em";const n=e<5?5:e>8?10:e+2,o=s<5?5:s>8?10:s+2;if(this.#Ed.style.width=n+"em",this.#Ed.style.height=o+"em",i){const t=n-(this.#Md||5);if(0!==t){const e=Ve.get(this.#kd.style.left);this.#kd.style.left=e-18*t+"px",this.#Md=n}}Ie.utils.changeTxt(this.#Td,e+" x "+s),this.#Hd=[e,s]}#Id(){const t=Ie.utils.createElement("TABLE"),e=this.#Hd[0],s=this.#Hd[1],i=`<tbody>${`<tr>${Na("td",e)}</tr>`.repeat(s)}</tbody>`,n=`<colgroup>${`<col style="width: ${Ve.get(100/e,0)}%;">`.repeat(e)}</colgroup>`;t.innerHTML=n+i;let o="";this.figureScroll&&(o=` se-scroll-figure-${this.figureScroll}`);const l=Ie.utils.createElement("FIGURE",{class:"se-flex-component se-input-component"+o,style:"width: 100%;"});if(l.appendChild(t),this.#Ld=!0,this.$.component.insert(l,{insertBehavior:"none"})){this.#Od(),this.$.menu.dropdownOff();const e=t.querySelector("td div");this.$.selection.setRange(e,0,e,0)}}#Pd(){this.resizeService.init(),this.selectionService.init(),this.styleService.init()}}function Ka(t){this.controller_cell.bringToTop(t)}const Ya=ja;class Xa extends Er{static key="blockStyle";static className="se-btn-select se-btn-tool-format";constructor(t,e){super(t),this.title=this.$.lang.formats,this.inner='<span class="se-txt">'+this.$.lang.formats+"</span>"+this.$.icons.arrow_down;const s=this.$.menu.initDropdownTarget(Xa,function({lang:t},e){const s=["p","blockquote","h1","h2","h3","h4","h5","h6"],i=e&&0!==e.length?e:s,n=[];for(let e,o,l,r,a,h,c,d=0,u=i.length;d<u;d++){if(e=i[d],"string"==typeof e){if(!s.includes(e))continue;o=e.toLowerCase(),l="blockquote"===o?"block":"pre"===o?"br-line":"line",a=/^h/.test(o)?o.match(/\d+/)[0]:"",r=t["tag_"+(a?"h":o)]+a,c="",h=""}else o=e.tag.toLowerCase(),l=e.command,r=e.name||o,c=e.class,h=c?' class="'+c+'"':"";n.push({command:l,value:o,title:r,innerHTML:`<${o}${h}>${r}</${o}>`,attrs:{"data-class":c||""}})}return n}(this.$,e.items),{className:"se-list-format"});this.formatList=s.querySelectorAll("li button"),this.currentFormat=""}active(t,e){let s=this.$.lang.formats;const i=e.querySelector(".se-txt");if(t){if(this.$.format.isLine(t)){const e=this.formatList,n=t.nodeName.toLowerCase(),o=(t.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let t,i=0,l=e.length;i<l;i++)if(t=e[i],n===t.getAttribute("data-value")&&o===t.getAttribute("data-class")){s=t.title;break}return Ie.utils.changeTxt(i,s),i.setAttribute("data-value",n),i.setAttribute("data-class",o),!0}}else Ie.utils.changeTxt(i,s);return!1}on(t){const e=this.formatList,s=t.querySelector(".se-txt"),i=(s.getAttribute("data-value")||"")+(s.getAttribute("data-class")||"");if(i!==this.currentFormat){for(let t,s=0,n=e.length;s<n;s++)t=e[s],i===t.getAttribute("data-value")+t.getAttribute("data-class")?Ie.utils.addClass(t,"active"):Ie.utils.removeClass(t,"active");this.currentFormat=i}}action(t){const e=t.getAttribute("data-command"),s=t.firstElementChild;"block"===e?this.$.format.applyBlock(s):"br-line"===e?this.$.format.setBrLine(s):this.$.format.setLine(s),this.$.menu.dropdownOff()}applyHeaderByShortcut({keyCode:t}){const e=t.match(/\d+$/)?.[0],s=Ie.utils.createElement(`H${e}`);this.$.format.setLine(s)}}const Ja=Xa;class Qa extends Er{static key="layout";static className="";constructor(t,e){super(t),this.title=this.$.lang.layout,this.icon="layout",this.selectedIndex=-1,this.items=e.items,this.$.menu.initDropdownTarget(Qa,function(t){t&&0!==t.length||console.warn('[SUNEDITOR.plugins.layout.warn] To use the "layout" plugin, please define the "layouts" option.');return(t||[]).map(((t,e)=>({command:"layout",value:String(e),title:t.name,innerHTML:t.name})))}(this.items))}action(t){const e=Number(t.getAttribute("data-value")),s=this.items[this.selectedIndex=e];if(!s.html)throw this.$.menu.dropdownOff(),Error('[SUNEDITOR.layout.fail] cause : "layouts[i].html not found"');this.$.html.set(s.html),this.$.menu.dropdownOff()}}const th=Qa;class eh extends Er{static key="lineHeight";static className="";#Fc;constructor(t,e){super(t),this.title=this.$.lang.lineHeight,this.icon="line_height";const s=`<li><button type="button" class="se-btn se-btn-list default_value" data-command="" title="${this.$.lang.default}" aria-label="${this.$.lang.default}">${this.$.lang.default}</button></li><li class="se-btn-list se-sub-list"><span></span></li>`,i=this.$.menu.initDropdownTarget(eh,(e.items||[{text:"1",value:"1em"},{text:"1.2",value:"1.2em"},{text:"1.7",value:"1.7em"},{text:"2",value:"2em"}]).map((t=>({command:t.value,title:t.text,innerHTML:t.text}))),{prependHTML:s});this.sizeList=i.querySelectorAll("li button"),this.currentSize=null,this.#Fc=i.querySelector(".se-sub-list span")}active(t,e){return this.$.format.isLine(t)&&t.style.lineHeight.length>0?(Ie.utils.addClass(e,"active"),!0):(Ie.utils.removeClass(e,"active"),!1)}on(){const t=this.$.format.getLine(this.$.selection.getNode()),e=t?t.style.lineHeight+"":"";if(e!==this.currentSize){let t=!1;const s=this.sizeList;for(let i=0,n=s.length;i<n;i++)e===s[i].getAttribute("data-command")?(Ie.utils.addClass(s[i],"active"),t=!0):Ie.utils.removeClass(s[i],"active");this.currentSize=e,t?this.#Fc.style.display="none":(this.#Fc.textContent=e,this.#Fc.style.display="block")}}action(t){const e=t.getAttribute("data-command")||"",s=this.$.format.getLines();for(let t=0,i=s.length;t<i;t++)s[t].style.lineHeight=e;this.$.menu.dropdownOff(),this.$.store.set("_lastSelectionNode",null),this.$.history.push(!1)}}const sh=eh;class ih extends Er{static key="template";static className="";constructor(t,e){super(t),this.title=this.$.lang.template,this.icon="template",this.selectedIndex=-1,this.items=e.items,this.$.menu.initDropdownTarget(ih,function(t){t&&0!==t.length||console.warn('[SUNEDITOR.plugins.template.warn] To use the "template" plugin, please define the "templates" option.');return(t||[]).map(((t,e)=>({command:"template",value:String(e),title:t.name,innerHTML:t.name})))}(this.items))}action(t){const e=Number(t.getAttribute("data-value")),s=this.items[this.selectedIndex=e];if(!s.html)throw this.$.menu.dropdownOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.$.html.insert(s.html,{selectInserted:!1,skipCharCount:!1,skipCleaning:!1}),this.$.menu.dropdownOff()}}const nh=ih;class oh extends Er{static key="paragraphStyle";static className="";constructor(t,e){super(t),this.title=this.$.lang.paragraphStyle,this.icon="paragraph_style";const s=this.$.menu.initDropdownTarget(oh,function({lang:t},e){const s={spaced:{name:t.menu_spaced,class:"__se__p-spaced",_class:""},bordered:{name:t.menu_bordered,class:"__se__p-bordered",_class:""},neon:{name:t.menu_neon,class:"__se__p-neon",_class:""}},i=e&&0!==e.length?e:["spaced","bordered","neon"],n=[];for(let t,e,o,l=0,r=i.length;l<r;l++){if(t=i[l],"string"==typeof t){const e=s[t.toLowerCase()];if(!e)continue;t=e}e=t.name,o=t.class?` class="${t.class}"`:"",n.push({command:t.class,title:e,innerHTML:`<div${o}>${e}</div>`,className:t._class||void 0})}return n}(this.$,e.items),{className:"se-list-format"});this.classList=s.querySelectorAll("li button")}on(){const t=this.classList,e=this.$.format.getLine(this.$.selection.getNode());for(let s=0,i=t.length;s<i;s++)Ie.utils.hasClass(e,t[s].getAttribute("data-command"))?Ie.utils.addClass(t[s],"active"):Ie.utils.removeClass(t[s],"active")}action(t){const e=t.getAttribute("data-command");let s=this.$.format.getLines();if(0!==s.length||(this.$.selection.getRangeAndAddLine(this.$.selection.getRange(),null),s=this.$.format.getLines(),0!==s.length)){for(let t=0,i=s.length;t<i;t++)Ie.utils.toggleClass(s[t],e);this.$.menu.dropdownOff(),this.$.history.push(!1)}}}const lh=oh;class rh extends Er{static key="textStyle";static className="";constructor(t,e){super(t),this.title=this.$.lang.textStyle,this.icon="text_style";const s=this.$.menu.initDropdownTarget(rh,function({lang:t},e){const s={code:{name:t.menu_code,class:"__se__t-code",tag:"code"},shadow:{name:t.menu_shadow,class:"__se__t-shadow",tag:"span"}},i=e||Object.keys(s),n=[];for(let t,e,o,l,r=0,a=i.length;r<a;r++){if(t=i[r],"string"==typeof t){const e=s[t.toLowerCase()];if(!e)continue;t=e}o=t.name,e=t.tag||"span",l=`.${t.class.trim().replace(/\s+/g,",.")}`.replace(/,$/,""),n.push({command:e,value:l,title:o,innerHTML:`<${e} class="${t.class}">${o}</${e}>`})}return n}(this.$,e.items),{className:"se-list-format"});this.styleList=s.querySelectorAll("li button")}on(){const t=this.styleList,e=this.$.selection.getNode();for(let s,i,n,o=0,l=t.length;o<l;o++){s=t[o],i=s.getAttribute("data-value").split(",");for(let t,o,l=0;l<i.length;l++){for(t=e,n=!1;t&&!this.$.format.isLine(t)&&!this.$.component.is(t);){if(t.nodeName.toLowerCase()===s.getAttribute("data-command").toLowerCase()&&(o=i[l],/^\./.test(o)?Ie.utils.hasClass(t,o.replace(/^\./,"")):t.style[o])){n=!0;break}t=t.parentNode}if(!n)break}n?Ie.utils.addClass(s,"active"):Ie.utils.removeClass(s,"active")}}action(t){const e=t.firstElementChild,s=e.style.cssText.replace(/:.+(;|$)/g,",").split(",");s.pop();const i=e.classList;for(let t=0,e=i.length;t<e;t++)s.push("."+i[t]);const n=Ie.utils.hasClass(t,"active")?null:e.cloneNode(!1),o=n?null:[e.nodeName];this.$.inline.apply(n,{stylesToModify:s,nodesToRemove:o,strictRemove:!0}),this.$.menu.dropdownOff()}}const ah=rh;const hh=class extends Lr{static key="link";static className="se-icon-flip-rtl";#zd;constructor(t,e){super(t),this.title=this.$.lang.link,this.icon="link",e.textToDisplay=!0,e.title=!0;const s=function({lang:t,icons:e}){const s=`\n\t<form>\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n\t\t\t\t${e.cancel}\n\t\t\t</button>\n\t\t\t<span class="se-modal-title">${t.link_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-anchor-editor"></div>\n\t\t<div class="se-modal-footer">\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}">\n\t\t\t\t<span>${t.submitButton}</span>\n\t\t\t</button>\n\t\t</div>\n\t</form>`;return Ie.utils.createElement("DIV",{class:"se-modal-content"},s)}(this.$),i=function({lang:t,icons:e}){const s=`\n\t<div class="se-arrow se-arrow-up"></div>\n\t<div class="link-content">\n\t\t<span><a target="_blank" href=""></a>&nbsp;</span>\n\t\t<div class="se-btn-group">\n\t\t\t<button type="button" data-command="update" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.edit}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.edit}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t<button type="button" data-command="copy" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.copy}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.copy}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t<button type="button" data-command="unlink" tabindex="-1" class="se-btn se-tooltip se-icon-flip-rtl">\n\t\t\t\t${e.unlink}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.unlink}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t<button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.delete}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.remove}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t</div>\n\t</div>`;return Ie.utils.createElement("DIV",{class:"se-controller se-controller-link"},s)}(this.$),n="string"==typeof e.uploadUrl?e.uploadUrl:null;this.target=null,this.isUpdateState=!1,this.pluginOptions={...e,uploadUrl:n,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:Ve.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Ve.get(e.uploadSingleSizeLimit,0),acceptedFormats:"string"==typeof e.acceptedFormats?e.acceptedFormats.trim():null,enableFileUpload:!!n},this.anchor=new _r(this.$,s,this.pluginOptions),this.modal=new vr(this,this.$,s),this.controller=new ki(this,this.$,i,{position:"bottom",disabled:!1}),this.#zd=this.controller.form.querySelector("a")}active(t){if(Ie.check.isAnchor(t)&&!t.hasAttribute("data-se-non-link")){const e=this.#zd,s=t.getAttribute("href");return e.href=s,e.textContent=e.title=t.textContent,e.target=s?.startsWith("#")?t.target:"_blank",Ie.utils.addClass(t,"on"),this.anchor.set(t),this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null}),this.target=t,!0}return this.controller.close(),!1}open(){this.modal.open()}modalOn(t){this.isUpdateState=t,this.anchor.on(t)}async modalAction(){const t=this.anchor.create(!1);if(null===t)return!1;if(this.isUpdateState){const t=this.controller.currentTarget.childNodes[0];this.$.selection.setRange(t,0,t,t.textContent.length)}else{const e=this.$.format.getLines();if(e.length>1){if(!this.$.html.insertNode(Ie.utils.createElement(e[0].nodeName,null,t),{afterNode:null,skipCharCount:!1}))return!0}else if(!this.$.html.insertNode(t,{afterNode:null,skipCharCount:!1}))return!0;this.$.selection.setRange(t.childNodes[0],0,t.childNodes[0],t.textContent.length)}return this.$.history.push(!1),!0}modalInit(){this.controller.close(),this.anchor.init()}controllerAction(t){const e=t.getAttribute("data-command");if(/update/.test(e))this.modal.open();else if(/copy/.test(e))this.$.html.copy(this.target);else if(/unlink/.test(e)){const t=Ie.query.getEdgeChild(this.controller.currentTarget,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!1),e=Ie.query.getEdgeChild(this.controller.currentTarget,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!0);this.$.selection.setRange(t,0,e,e.textContent.length),this.$.inline.apply(null,{stylesToModify:null,nodesToRemove:["A"],strictRemove:!1})}else Ie.utils.removeItem(this.controller.currentTarget),this.controller.currentTarget=null,this.$.focusManager.focus(),this.$.history.push(!1)}controllerClose(){Ie.utils.removeClass(this.controller.currentTarget,"on")}},ch="%",dh="px",uh={BLOCK:"block",INLINE:"inline"},ph="image/*";const gh=class{#qc;#J;#N;#Fd;#Kc;#Dd;#qd;#Wd={w:0,h:0};#Ud=null;#Zd=null;#Gd=null;constructor(t,e){if(this.#qc=t,this.#J=t.$,this.#N=t.state,this.#Fd=t.pluginOptions,this.#Kc=this.#Fd.canResize,this.#Dd="auto"===this.#Fd.defaultWidth?"":this.#Fd.defaultWidth,this.#qd="auto"===this.#Fd.defaultHeight?"":this.#Fd.defaultHeight,this.#Kc){this.#Ud=e.proportion,this.#Zd=e.inputX,this.#Gd=e.inputY,this.#Zd.value=this.#Fd.defaultWidth,this.#Gd.value=this.#Fd.defaultHeight;const t=this.#jd.bind(this);this.#J.eventManager.addEvent(this.#Zd,"keyup",this.#Kd.bind(this,"x")),this.#J.eventManager.addEvent(this.#Gd,"keyup",this.#Kd.bind(this,"y")),this.#J.eventManager.addEvent(this.#Zd,"change",t),this.#J.eventManager.addEvent(this.#Gd,"change",t),this.#J.eventManager.addEvent(this.#Ud,"change",t),this.#J.eventManager.addEvent(e.revertBtn,"click",this.#Yd.bind(this))}}setInputSize(t,e){this.#Zd.value="auto"===t?"":t,this.#N.onlyPercentage||(this.#Gd.value="auto"===e?"":e)}getInputSize(){return{w:this.#Zd?.value||"",h:this.#Gd?.value||""}}setOriginSize(t,e){this.#Dd=t,this.#qd=e}applySize(t,e){t||=this.#Zd?.value||this.#Fd.defaultWidth,e||=this.#Gd?.value||this.#Fd.defaultHeight,this.#N.onlyPercentage&&(t?/%$/.test(t)||(t+=ch):t="100%"),this.#qc.figure.setSize(t,e)}on(){if(!this.#Kc)return;const t=this.#Fd.defaultWidth,e=this.#Fd.defaultHeight;this.setInputSize(t,e),this.setOriginSize(t,e)}ready(t,e,s){this.setInputSize(e,s);const i=this.#N.onlyPercentage&&this.#qc.figure.isVertical;this.#Ud.checked=!0,this.#Zd.disabled=i,this.#Gd.disabled=i,this.#Ud.disabled=i,this.#Wd=this.#Ud.checked?t.ratio:{w:0,h:0}}init(){this.#Wd={w:0,h:0},this.#Kc&&(this.setInputSize(this.#Fd.defaultWidth,this.#Fd.defaultHeight),this.#Ud.checked=!0)}#Kd(t,e){if(Oe.isSpace(e.code))return void e.preventDefault();const s=e.target;if("x"===t&&this.#N.onlyPercentage&&Number(s.value)>100)s.value="100";else if(this.#Ud.checked){const e=Pi.CalcRatio(this.#Zd.value,this.#Gd.value,this.#N.sizeUnit,this.#Wd);"x"===t?this.#Gd.value=String(e.h):this.#Zd.value=String(e.w)}}#jd(){this.#Wd=this.#Ud.checked?Pi.GetRatio(this.#Zd.value,this.#Gd.value,this.#N.sizeUnit):{w:0,h:0}}#Yd(){this.#N.onlyPercentage?this.#Zd.value=Number(this.#Dd)>100?"100":this.#Dd:(this.#Zd.value=this.#Dd,this.#Gd.value=this.#qd)}},{NO_EVENT:mh}=Ne;const fh=class{#qc;#J;#Fd;#Kc;constructor(t){this.#qc=t,this.#J=t.$,this.#Fd=t.pluginOptions,this.#Kc=this.#Fd.canResize,this._base64RenderIndex=0}get#Xd(){return this.#qc.sizeService}serverUpload(t){if(!t.files)return;const e=this.#Fd.uploadUrl;"string"==typeof e&&e.length>0?this.#qc.fileManager.upload(e,this.#Fd.uploadHeaders,t.files,this.#Jd.bind(this,t),this.#Xh.bind(this)):this.#Qd(t)}urlUpload(t){this.#qc.setState("produceIndex",0);const e=t.url;this.#qc.modal.isUpdate?this.#tu(e,t.element,t.files):this.#eu(e,t.anchor,t.inputWidth,t.inputHeight,t.align,t.files,t.alt,!0)}#eu(t,e,s,i,n,o,l,r){this.#qc.as!==uh.INLINE?this.#qc.create(t,e,s,i,n,o,l,r):this.#qc.createInline(t,e,s,i,o,l,r)}#tu(t,e,s){e.src=t,this.#qc.fileManager.setFileData(e,s),this.#J.component.select(e,this.#qc.constructor.key)}#Yh(t,e){this.#qc.setState("produceIndex",0);const s=e.result;for(let e,i=0,n=s.length;i<n;i++){if(e={name:s[i].name,size:s[i].size},t.isUpdate){this.#tu(s[i].url,t.element,e);break}this.#eu(s[i].url,t.anchor,t.inputWidth,t.inputHeight,t.align,e,t.alt,i===n-1)}}#Qd(t){try{const{files:e,element:s,anchor:i,inputWidth:n,inputHeight:o,align:l,alt:r,isUpdate:a}=t,h=this.#qc.modal.isUpdate?1:e.length;if(0===h)return this.#J.ui.hideLoading(),void console.warn("[SUNEDITOR.image.base64.fail] cause : No applicable files");this._base64RenderIndex=h;const c=new Array(h);this.#Kc&&this.#Xd.setInputSize(n,o);for(let t,d,u=0,p=this.#su.bind(this);u<h;u++)t=new FileReader,d=e[u],t.onload=function(t,e,s,a,h,d){c[d]={result:e.result,file:h},0==--this._base64RenderIndex&&(t(s,c,a,i,n,o,l,r),this.#J.ui.hideLoading())}.bind(this,p,t,a,s,d,u),t.readAsDataURL(d)}catch(t){throw this.#J.ui.hideLoading(),Error(`[SUNEDITOR.plugins.image._setBase64.fail] ${t.message}`)}}#su(t,e,s,i,n,o,l,r){this.#qc.setState("produceIndex",0);for(let a=0,h=e.length;a<h;a++)t?this.#tu(e[a].result,s,e[a].file):this.#eu(e[a].result,i,n,o,l,e[a].file,r,a===h-1)}async#Xh(t){const e=await this.#J.eventManager.triggerEvent("onImageUploadError",{error:t}),s=e===mh?t.errorMessage:e||t.errorMessage;this.#J.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.image.error]",s)}async#Jd(t,e){if(await this.#J.eventManager.triggerEvent("imageUploadHandler",{xmlHttp:e,info:t})===mh){const s=JSON.parse(e.responseText);s.errorMessage?this.#Xh(s):this.#Yh(t,s)}}},{NO_EVENT:vh}=Ne;const bh=class extends Lr{static key="image";static className="";static component(t){const e=Ie.check.isFigure(t)||/^span$/i.test(t.nodeName)&&Ie.check.isComponentContainer(t)?t.firstElementChild:t;return/^IMG$/i.test(e?.nodeName)?e:Ie.check.isAnchor(e)&&/^IMG$/i.test(e?.firstElementChild?.nodeName)?e?.firstElementChild:null}#Kc;#iu;#nu=null;#ou="";#lu="none";#ru="30%";#wc=null;#au=null;#hu=null;#cu=null;constructor(t,e){super(t),this.title=this.$.lang.image,this.icon="image",this.pluginOptions={canResize:void 0===e.canResize||e.canResize,showHeightInput:void 0===e.showHeightInput||!!e.showHeightInput,defaultWidth:e.defaultWidth?Ve.is(e.defaultWidth)?e.defaultWidth+dh:e.defaultWidth:"auto",defaultHeight:e.defaultHeight?Ve.is(e.defaultHeight)?e.defaultHeight+dh:e.defaultHeight:"auto",percentageOnlySize:!!e.percentageOnlySize,createFileInput:void 0===e.createFileInput||e.createFileInput,createUrlInput:void 0===e.createUrlInput||!e.createFileInput||e.createUrlInput,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:Ve.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Ve.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?ph:e.acceptedFormats.trim()||ph,useFormatType:e.useFormatType??!0,defaultFormatType:[uh.BLOCK,uh.INLINE].includes(e.defaultFormatType)?e.defaultFormatType:uh.BLOCK,keepFormatType:e.keepFormatType??!1,insertBehavior:e.insertBehavior};const s=this.pluginOptions.percentageOnlySize?ch:dh,i=function({lang:t,icons:e,plugins:s},i){const n=i.createFileInput?`\n\t\t<div class="se-modal-form">\n\t\t\t<label>${t.image_modal_file}</label>\n\t\t\t${vr.CreateFileInput({icons:e,lang:t},i)}\n\t\t</div>`:"",o=i.createUrlInput?`\n\t\t<div class="se-modal-form">\n\t\t\t<label>${t.image_modal_url}</label>\n\t\t\t<div class="se-modal-form-files">\n\t\t\t\t<input class="se-input-form se-input-url" data-focus type="text" />\n\t\t\t\t${s.imageGallery?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button __se__gallery" aria-label="${t.imageGallery}">\n\t\t\t\t\t\t\t${e.image_gallery}\n\t\t\t\t\t\t\t${Ie.utils.createTooltipInner(t.imageGallery)}\n\t\t\t\t\t\t\t</button>`:""}\n\t\t\t</div>\n\t\t\t<pre class="se-link-preview"></pre>\n\t\t</div>`:"",l=i.canResize?`\n\t\t<div class="se-modal-form">\n\t\t\t<div class="se-modal-size-text">\n\t\t\t\t<label class="size-w">${t.width}</label>\n\t\t\t\t<label class="se-modal-size-x">&nbsp;</label>\n\t\t\t\t<label class="size-h">${t.height}</label>\n\t\t\t</div>\n\t\t\t<input class="se-input-control _se_size_x" placeholder="auto" type="text" />\n\t\t\t<label class="se-modal-size-x">x</label>\n\t\t\t<input type="text" class="se-input-control _se_size_y" placeholder="auto" />\n\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_check_proportion" checked/>&nbsp;${t.proportion}</label>\n\t\t\t<button type="button" aria-label="${t.revert}" class="se-btn se-tooltip se-modal-btn-revert">\n\t\t\t\t${e.revert}\n\t\t\t\t${Ie.utils.createTooltipInner(t.revert)}\n\t\t\t</button>\n\t\t</div>`:"",r=i.useFormatType?`\n\t\t<div class="se-modal-form">\n\t\t\t<div class="se-modal-flex-form">\n\t\t\t\t<button type="button" data-command="asBlock" class="se-btn se-tooltip" aria-label="${t.inlineStyle}">\n\t\t\t\t\t${e.as_block}\n\t\t\t\t\t${Ie.utils.createTooltipInner(t.blockStyle)}\n\t\t\t\t</button>\n\t\t\t\t<button type="button" data-command="asInline" class="se-btn se-tooltip" aria-label="${t.inlineStyle}">\n\t\t\t\t\t${e.as_inline}\n\t\t\t\t\t${Ie.utils.createTooltipInner(t.inlineStyle)}\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</div>`:"",a=`\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn close" title="${t.close}" aria-label="${t.close}">${e.cancel}</button>\n\t\t\t<span class="se-modal-title">${t.image_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-modal-tabs">\n\t\t\t<button type="button" class="_se_tab_link active" data-tab-link="image">${t.image}</button>\n\t\t\t<button type="button" class="_se_tab_link" data-tab-link="url">${t.link}</button>\n\t\t</div>\n\t\t<form method="post" enctype="multipart/form-data">\n\t\t\t<div class="_se_tab_content _se_tab_content_image">\n\t\t\t\t<div class="se-modal-body">\n\t\t\t\t\t${n}\n\t\t\t\t\t${o}\n\t\t\t\t\t<div class="se-modal-hr"></div>\n\t\t\t\t\t<div class="se-modal-form">\n\t\t\t\t\t\t<label>${t.image_modal_altText}</label><input class="se-input-form _se_image_alt" type="text" />\n\t\t\t\t\t</div>\n\t\t\t\t\t${l}\n\t\t\t\t\t${r}\n\t\t\t\t\t<div class="se-modal-form se-modal-form-footer">\n\t\t\t\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_image_check_caption" />&nbsp;${t.caption}</label>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="se-anchor-editor _se_tab_content _se_tab_content_url" style="display: none;">\n\t\t\t</div>\n\t\t\t<div class="se-modal-footer">\n\t\t\t\t<div class="se-figure-align">\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="none" checked>${t.basic}</label>\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="left">${t.left}</label>\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="center">${t.center}</label>\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="right">${t.right}</label>\n\t\t\t\t</div>\n\t\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}"><span>${t.submitButton}</span></button>\n\t\t\t</div>\n\t\t</form>`,h=Ie.utils.createElement("DIV",{class:"se-modal-content"},a);return{html:h,alignForm:h.querySelector(".se-figure-align"),fileModalWrapper:h.querySelector(".se-flex-input-wrapper"),imgInputFile:h.querySelector(".__se__file_input"),imgUrlFile:h.querySelector(".se-input-url"),altText:h.querySelector("._se_image_alt"),captionCheckEl:h.querySelector("._se_image_check_caption"),previewSrc:h.querySelector("._se_tab_content_image .se-link-preview"),tabs:h.querySelector(".se-modal-tabs"),galleryButton:h.querySelector(".__se__gallery"),proportion:h.querySelector("._se_check_proportion"),inputX:h.querySelector("._se_size_x"),inputY:h.querySelector("._se_size_y"),revertBtn:h.querySelector(".se-modal-btn-revert"),asBlock:h.querySelector('[data-command="asBlock"]'),asInline:h.querySelector('[data-command="asInline"]'),fileRemoveBtn:h.querySelector(".se-file-remove")}}(this.$,this.pluginOptions),n=this.pluginOptions.useFormatType?"as":"",o=e.controls||(this.pluginOptions.canResize?[[n,"resize_auto,100,75,50","rotate_l","rotate_r","mirror_h","mirror_v"],["edit","align","caption","revert","copy","remove"]]:[[n,"mirror_h","mirror_v","align","caption","edit","revert","copy","remove"]]);this.alignForm=i.alignForm,o.some((t=>t.includes("align")))||(this.alignForm.style.display="none");const l=this.$.plugins.link?this.$.plugins.link.pluginOptions:{};this.anchor=new _r(this.$,i.html,{...l,textToDisplay:!1,title:!0}),this.modal=new vr(this,this.$,i.html),this.figure=new Pi(this,this.$,o,{sizeUnit:s}),this.fileManager=new yr(this,this.$,{query:"img",loadEventName:"onImageLoad",actionEventName:"onImageAction"}),this.state={sizeUnit:s,onlyPercentage:this.pluginOptions.percentageOnlySize,produceIndex:0},this.fileModalWrapper=i.fileModalWrapper,this.imgInputFile=i.imgInputFile,this.imgUrlFile=i.imgUrlFile,this.focusElement=this.imgInputFile||this.imgUrlFile,this.altText=i.altText,this.captionCheckEl=i.captionCheckEl,this.captionEl=this.captionCheckEl?.parentElement,this.previewSrc=i.previewSrc,this.as=uh.BLOCK,this.#Kc=this.pluginOptions.canResize,this.#iu=!this.#Kc||!this.pluginOptions.showHeightInput||this.pluginOptions.percentageOnlySize,this.sizeService=new gh(this,i),this.uploadService=new fh(this),this.$.eventManager.addEvent(i.tabs,"click",this.#du.bind(this)),this.imgInputFile&&this.$.eventManager.addEvent(i.fileRemoveBtn,"click",this.#uu.bind(this)),this.imgUrlFile&&this.$.eventManager.addEvent(this.imgUrlFile,"input",this.#pu.bind(this)),this.imgInputFile&&this.imgUrlFile&&this.$.eventManager.addEvent(this.imgInputFile,"change",this.#gu.bind(this));const r=i.galleryButton;r&&this.$.eventManager.addEvent(r,"click",this.#mu.bind(this)),this.pluginOptions.useFormatType&&(this.as=this.pluginOptions.defaultFormatType,this.asBlock=i.asBlock,this.asInline=i.asInline,this.$.eventManager.addEvent([this.asBlock,this.asInline],"click",this.#fu.bind(this)))}setState(t,e){this.state[t]=e}open(){this.state.produceIndex=0,this.modal.open()}retainFormat(){return{query:"img",method:t=>{const e=Pi.GetContainer(t);if(e&&e.container&&(e.cover||e.inlineCover))return;const{w:s,h:i}=this.#vu(t,!0);this.#bu(s,i)}}}onFilePasteAndDrop({file:t}){/^image/.test(t.type)&&(this.submitFile([t]),this.$.focusManager.focus())}modalOn(t){t?this.imgInputFile&&this.pluginOptions.allowMultiple&&this.imgInputFile.removeAttribute("multiple"):(this.sizeService.on(),this.imgInputFile&&this.pluginOptions.allowMultiple&&this.imgInputFile.setAttribute("multiple","multiple")),this.anchor.on(t)}async modalAction(){return this.#lu=this.modal.form.querySelector('input[name="suneditor_image_radio"]:checked').value,this.modal.isUpdate&&(this.#yu(),this.$.history.push(!1)),this.imgInputFile&&this.imgInputFile.files.length>0?await this.submitFile(this.imgInputFile.files):!!(this.imgUrlFile&&this.#ou.length>0)&&await this.submitURL(this.#ou)}modalInit(){vr.OnChangeFile(this.fileModalWrapper,[]),this.imgInputFile&&(this.imgInputFile.value=""),this.imgUrlFile&&(this.#ou=this.previewSrc.textContent=this.imgUrlFile.value=""),this.imgInputFile&&this.imgUrlFile&&(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),this.altText.value="",this.modal.form.querySelector('input[name="suneditor_image_radio"][value="none"]').checked=!0,this.captionCheckEl.checked=!1,this.#wc=null,this.#du("init"),this.sizeService.init(),this.pluginOptions.useFormatType&&this.#Cu((this.pluginOptions.keepFormatType?this.as:this.pluginOptions.defaultFormatType)===uh.INLINE),this.anchor.init()}componentSelect(t){this.#vu(t)}componentEdit(){this.modal.open()}async componentDestroy(t){const e=t||this.#wc,s=Ie.query.getParentElement(e,Pi.is)||e,i=s.previousElementSibling||s.nextElementSibling,n=s.parentNode;!1!==await this.$.eventManager.triggerEvent("onImageDeleteBefore",{element:e,container:s,align:this.#lu,alt:this.altText.value,url:this.#ou})&&(Ie.utils.removeItem(s),this.modalInit(),n!==this.$.frameContext.get("wysiwyg")&&this.$.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.$.focusManager.focusEdge(i),this.$.history.push(!1))}async submitFile(t){if(0===t.length)return!1;let e=0;const s=[],i=this.pluginOptions.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++)if(n=t[l],/image/i.test(n.type)){if(o=n.size,i>0&&o>i){const t="[SUNEDITOR.imageUpload.fail] Size of uploadable single file: "+i/1e3+"KB",e=await this.$.eventManager.triggerEvent("onImageUploadError",{error:t,limitSize:i,uploadSize:o,file:n});return this.$.ui.alertOpen(e===vh?t:e||t,"error"),!1}s.push(n),e+=o}const n=this.pluginOptions.uploadSizeLimit,o=this.fileManager.getSize();if(n>0&&e+o>n){const t="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+n/1e3+"KB",s=await this.$.eventManager.triggerEvent("onImageUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.$.ui.alertOpen(s===vh?t:s||t,"error"),!1}const l={files:s,...this.#wu()},r=function(t,e,s){t(e=s||e)}.bind(this,this.uploadService.serverUpload.bind(this.uploadService),l),a=await this.$.eventManager.triggerEvent("onImageUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==vh||r(null)))}async submitURL(t){if(!(t||=this.#ou))return!1;const e={name:t.split("/").pop(),size:0},s={url:t,files:e,...this.#wu()},i=function(t,e,s){t(e=s||e)}.bind(this,this.uploadService.urlUpload.bind(this.uploadService),s),n=await this.$.eventManager.triggerEvent("onImageUploadBefore",{info:s,handler:i});return void 0===n||!1!==n&&(null!==n&&"object"==typeof n&&i(n),!0!==n&&n!==vh||i(null),!0)}create(t,e,s,i,n,o,l,r){const a=Ie.utils.createElement("IMG");a.src=t,a.alt=l,e=this.#_u(a,e?e.cloneNode(!1):null);const h=Pi.CreateContainer(e,"se-image-container"),c=h.cover,d=h.container;this.captionCheckEl.checked&&(this.#cu=Pi.CreateCaption(c,this.$.lang.caption)),this.#wc=a,this.#au=c,this.#hu=d,this.figure.open(a,{nonResizing:this.#iu,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0}),this.sizeService.applySize(s,i),this.figure.setAlign(a,n),this.fileManager.setFileData(a,o),this.setState("produceIndex",this.state.produceIndex+1),a.onload=this.#xu.bind(this,a,this.#ru,d),this.$.component.insert(d,{scrollTo:!!r,insertBehavior:r?null:"line"})}createInline(t,e,s,i,n,o,l){const r=Ie.utils.createElement("IMG");r.src=t,r.alt=o,e=this.#_u(r,e?e.cloneNode(!1):null);const a=Pi.CreateInlineContainer(e,"se-image-container").container;this.#wc=r,this.#hu=a,this.figure.open(r,{nonResizing:this.#iu,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0}),this.sizeService.applySize(s,i),this.fileManager.setFileData(r,n),this.setState("produceIndex",this.state.produceIndex+1),r.onload=this.#xu.bind(this,r,this.#ru,a),this.$.component.insert(a,{scrollTo:!!l,insertBehavior:l?null:"line"})}#vu(t,e=!1){if(!t)return;const s=this.figure.open(t,{nonResizing:this.#iu,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:e});this.anchor.set(Ie.check.isAnchor(t.parentNode)?t.parentNode:null),this.#nu=this.anchor.currentTarget,this.#wc=t,this.#au=s.cover,this.#hu=s.container,this.#cu=s.caption,this.#lu=s.align,t.style.float="",this.sizeService.setOriginSize(String(s.originWidth||s.w||""),String(s.originHeight||s.h||"")),this.altText.value=this.#wc.alt,this.imgUrlFile&&(this.#ou=this.previewSrc.textContent=this.imgUrlFile.value=this.#wc.src);(this.modal.form.querySelector('input[name="suneditor_image_radio"][value="'+this.#lu+'"]')||this.modal.form.querySelector('input[name="suneditor_image_radio"][value="none"]')).checked=!0,this.captionCheckEl.checked=!!this.#cu;const{dw:i,dh:n}=this.figure.getSize(t);return this.#Kc?(this.sizeService.ready(s,i,n),this.pluginOptions.useFormatType&&this.#Cu(this.$.component.isInline(s.container)),{w:i,h:n}):{w:i,h:n}}#wu(){const{w:t,h:e}=this.sizeService.getInputSize();return{element:this.#wc,anchor:this.anchor.create(!0),inputWidth:t,inputHeight:e,align:this.#lu,isUpdate:this.modal.isUpdate,alt:this.altText.value}}#Cu(t){t?(Ie.utils.addClass(this.asInline,"on"),Ie.utils.removeClass(this.asBlock,"on"),this.as=uh.INLINE,this.alignForm&&(this.alignForm.style.display="none"),this.captionEl&&(this.captionEl.style.display="none")):(Ie.utils.addClass(this.asBlock,"on"),Ie.utils.removeClass(this.asInline,"on"),this.as=uh.BLOCK,this.alignForm&&(this.alignForm.style.display=""),this.captionEl&&(this.captionEl.style.display=""))}#yu(){const{w:t,h:e}=this.sizeService.getInputSize(),s=t||"auto",i=e||"auto";let n=this.#wc;(this.as===uh.BLOCK&&!this.#au||this.as===uh.INLINE&&this.#au)&&(n=this.figure.convertAsFormat(n,this.as));const o=this.#au,l=this.#hu===this.#au?null:this.#hu;let r;const a=Ve.is(s)?s+this.state.sizeUnit:s,h=Ve.is(i)?i+this.state.sizeUnit:i;r=/%$/.test(n.style.width)?a!==l.style.width||h!==l.style.height:a!==n.style.width||h!==n.style.height,n.alt=this.altText.value;let c=!1;this.captionCheckEl.checked?this.#cu||(this.#cu=Pi.CreateCaption(o,this.$.lang.caption),c=!0):this.#cu&&(Ie.utils.removeItem(this.#cu),this.#cu=null,c=!0);let d=!1;const u=this.anchor.create(!0);if(u)this.#nu===u&&l.contains(u)||(this.#nu=u.cloneNode(!1),o.insertBefore(this.#_u(n,this.#nu),this.#cu),d=!0);else if(null!==this.#nu&&o.contains(this.#nu)){const t=n.cloneNode(!0);o.removeChild(this.#nu),o.insertBefore(t,this.#cu),n=t}d&&Ie.utils.removeItem(u),this.#Kc&&r&&this.sizeService.applySize(s,i),(c||!this.state.onlyPercentage&&r)&&(/\d+/.test(n.style.height)||this.figure.isVertical&&this.captionCheckEl.checked)&&(/auto|%$/.test(s)||/auto|%$/.test(i)?this.figure.deleteTransform(n):this.#Kc&&r&&this.figure.isVertical||this.figure.setTransform(n,s,i,0)),this.figure.setAlign(n,this.#lu),n.onload=()=>{this.componentSelect(n)}}#bu(t,e){const{w:s,h:i}=this.sizeService.getInputSize();t||=s||"auto",e||=i||"auto";let n=this.#wc,o=this.#au,l=null,r=this.#hu===this.#au?null:this.#hu,a=!1;if(!o||!r){a=!0,n=this.#wc.cloneNode(!0);const e=this.pluginOptions.useFormatType&&"auto"!==t&&(/^span$/i.test(this.#wc.parentElement?.nodeName)||this.$.format.isLine(this.#wc.parentElement))?Pi.CreateInlineContainer(n,"se-image-container"):Pi.CreateContainer(n,"se-image-container");o=e.cover,r=e.container,l=e.inlineCover,this.figure.open(n,{nonResizing:!0,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0})}n.alt=this.altText.value;let h=!1;l||(this.captionCheckEl.checked?this.#cu&&!a||(this.#cu=Pi.CreateCaption(o,this.$.lang.caption),h=!0):this.#cu&&(Ie.utils.removeItem(this.#cu),this.#cu=null,h=!0));let c=null;const d=this.anchor.create(!0,Ie.check.isAnchor(this.#wc.parentElement)?this.#wc.parentElement.href:null);if(d)(this.#nu!==d||a&&!r.contains(d))&&(this.#nu=d.cloneNode(!1),o.insertBefore(this.#_u(n,this.#nu),this.#cu),c=this.#wc);else if(null!==this.#nu&&o.contains(this.#nu)){const t=n.cloneNode(!0);o.removeChild(this.#nu),o.insertBefore(t,this.#cu),n=t}a&&(n=this.#wc,this.figure.retainFigureFormat(r,this.#wc,c?d:null,this.fileManager),this.#wc=n=r.querySelector("img"),this.#au=o,this.#hu=r),n.style.width="",n.style.height="",n.removeAttribute("width"),n.removeAttribute("height"),this.sizeService.applySize(t,e),c&&(a?(Ie.utils.removeItem(c),0===Ie.query.getListChildren(d,(t=>/IMG/i.test(t.tagName)),null).length&&Ie.utils.removeItem(d)):Ie.utils.removeItem(d)),!h&&this.state.onlyPercentage||(/\d+/.test(n.style.height)||this.figure.isVertical&&this.captionCheckEl.checked)&&(/auto|%$/.test(t)||/auto|%$/.test(e)?this.figure.deleteTransform(n):this.figure.setTransform(n,t,e,0)),this.figure.setAlign(n,this.#lu)}#_u(t,e){return e?(e.setAttribute("data-se-non-link","true"),e.appendChild(t),e):t}#du(t){const e=this.modal.form,s="string"==typeof t?e.querySelector("._se_tab_link"):Ie.query.getEventTarget(t);if(!/^BUTTON$/i.test(s.tagName))return!1;const i=s.getAttribute("data-tab-link");let n;const o=e.getElementsByClassName("_se_tab_content");for(n=0;n<o.length;n++)o[n].style.display="none";const l=e.getElementsByClassName("_se_tab_link");for(n=0;n<l.length;n++)Ie.utils.removeClass(l[n],"active");return e.querySelector("._se_tab_content_"+i).style.display="block",Ie.utils.addClass(s,"active"),"init"!==t&&("image"===i?this.focusElement.focus():"url"===i&&this.anchor.urlInput.focus()),!1}#uu(){this.imgInputFile.value="",this.imgUrlFile&&(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),vr.OnChangeFile(this.fileModalWrapper,[])}#fu({target:t}){this.#Cu("asInline"===t.getAttribute("data-command"))}#pu(t){const e=t.target.value.trim();this.#ou=this.previewSrc.textContent=e?this.$.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.$.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#gu({target:t}){this.imgInputFile.value?(this.imgUrlFile.disabled=!0,this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),vr.OnChangeFile(this.fileModalWrapper,t.files)}#mu(){this.$.plugins.imageGallery.open(this.#$u.bind(this))}#$u(t){this.altText.value=t.getAttribute("data-value")||t.alt,this.#ou=this.previewSrc.textContent=this.imgUrlFile.value=t.getAttribute("data-command")||t.src,this.imgUrlFile.focus()}#xu(t,e,s){this.setState("produceIndex",this.state.produceIndex-1),delete t.onload,0===t.offsetWidth&&this.sizeService.applySize(e,""),0===this.state.produceIndex&&(this.$.component.applyInsertBehavior(s,null,this.pluginOptions.insertBehavior||this.$.options.get("componentInsertBehavior")),this.$.ui._iframeAutoHeight(this.$.frameContext),this.$.history.push(!1))}};const yh=class{#qc;#J;#N;#Fd;#Kc;#ku;#Su;#Eu;#Dd;#qd;#Wd={w:0,h:0};#Ud=null;#Zd=null;#Gd=null;#Tu=null;constructor(t,e){if(this.#qc=t,this.#J=t.$,this.#N=t.state,this.#Fd=t.pluginOptions,this.#Kc=this.#Fd.canResize,this.#ku=this.#N.defaultRatio,this.#Su="100%",this.#Eu=100*this.#Fd.defaultRatio+"%",this.#Dd="100%"===this.#Fd.defaultWidth?"":this.#Fd.defaultWidth,this.#qd=this.#Fd.defaultHeight===this.#N.defaultRatio?"":this.#Fd.defaultHeight,this.#Kc){this.#Ud=e.proportion,this.frameRatioOption=e.frameRatioOption,this.#Zd=e.inputX,this.#Gd=e.inputY,this.#Zd.value=this.#Fd.defaultWidth,this.#Gd.value=this.#Fd.defaultHeight;const t=this.#jd.bind(this);this.#J.eventManager.addEvent(this.#Zd,"keyup",this.#Kd.bind(this,"x")),this.#J.eventManager.addEvent(this.#Gd,"keyup",this.#Kd.bind(this,"y")),this.#J.eventManager.addEvent(this.#Zd,"change",t),this.#J.eventManager.addEvent(this.#Gd,"change",t),this.#J.eventManager.addEvent(this.#Ud,"change",t),this.#J.eventManager.addEvent(this.frameRatioOption,"change",this.#Mu.bind(this)),this.#J.eventManager.addEvent(e.revertBtn,"click",this.#Yd.bind(this))}}setInputSize(t,e){this.#Zd.value=t===this.#Su?"":t,this.#N.onlyPercentage||(this.#Gd.value=e===this.#Eu?"":e)}getInputSize(){return{w:this.#Zd?.value||"",h:this.#Gd?.value||""}}setOriginSize(t,e){this.#Dd=t,this.#qd=e}applySize(t,e){t||=this.#Zd?.value||this.#Fd.defaultWidth,e||=this.#Gd?.value||this.#Fd.defaultHeight,this.#N.onlyPercentage&&(t?/%$/.test(t+"")||(t+="%"):t="100%"),this.#qc.figure.setSize(t,e)}resolveSize(t,e,s,i){t||=this.#Su,e||=this.#ku;const n=this.#qc.figure.getSize(s),o=n.w!==t||n.h!==e,l=!i||o;return l&&(this.#Tu!==this.frameRatioOption?.value&&this.#qc.figure.deleteTransform(),this.applySize(t,e)),{width:t,height:e,isChanged:l}}on(t){if(this.#Kc){if(!t){const t=this.#Fd.defaultWidth,e=this.#Fd.defaultHeight;this.setInputSize(t,e),this.setOriginSize(t,e),this.#Ud.disabled=!0}this.#Hu(this.#qc.figure.isVertical?"":this.#qd||this.#N.defaultRatio),this.#Tu=this.frameRatioOption?.value}}ready(t,e){const{dw:s,dh:i}=this.#qc.figure.getSize(e);this.setInputSize(s,i);const n=t.height||t.h||this.#qd||"";this.#Hu(n)||(this.#Gd.value=String(this.#N.onlyPercentage?Ve.get(n,2):n));const o=this.#N.onlyPercentage&&this.#qc.figure.isVertical;this.#Zd.disabled=o,this.#Gd.disabled=o,this.#Ud.checked=!t.isVertical,this.#Ud.disabled=o,this.#Wd=this.#Ud.checked?t.ratio:{w:0,h:0}}init(){this.#Wd={w:0,h:0},this.#Kc&&(this.setInputSize(this.#Fd.defaultWidth,this.#Fd.defaultHeight),this.#Ud.checked=!1,this.#Ud.disabled=!0,this.#Hu(this.#N.defaultRatio))}#Yd(){this.#N.onlyPercentage?this.#Zd.value=Number(this.#Dd)>100?"100":this.#Dd:(this.#Zd.value=this.#Dd,this.#Gd.value=this.#qd)}#Hu(t){if(!this.frameRatioOption)return;let e=!1;const s=this.frameRatioOption.options;/%$/.test(t+"")||this.#N.onlyPercentage?t=Ve.get(t,2)/100+"":(!Ve.is(t)||Number(t)>=1)&&(t=""),this.#Gd.placeholder="";for(let i=0,n=s.length;i<n;i++)s[i].value===t?(e=s[i].selected=!0,this.#Gd.placeholder=t?100*Number(t)+"%":""):s[i].selected=!1;return e}#Mu(t){const e=Ie.query.getEventTarget(t),s=e.options[e.selectedIndex].value;this.#Eu=this.#qc.figure.autoRatio.current=this.#ku=s?100*Number(s)+"%":this.#Eu,this.#Gd.placeholder=s?100*Number(s)+"%":"",this.#Gd.value=""}#jd(){this.#Wd=this.#Ud.checked?Pi.GetRatio(this.#Zd.value,this.#Gd.value,this.#N.sizeUnit):{w:0,h:0}}#Kd(t,e){if(Oe.isSpace(e.code))return void e.preventDefault();const s=Ie.query.getEventTarget(e);if("x"===t&&this.#N.onlyPercentage&&Number(s.value)>100)s.value="100";else if(this.#Ud.checked&&!this.frameRatioOption?.value){const e=Pi.CalcRatio(this.#Zd.value,this.#Gd.value,this.#N.sizeUnit,this.#Wd);"x"===t?this.#Gd.value=String(e.h):this.#Zd.value=String(e.w)}"y"===t&&this.#Hu(s.value||this.#N.defaultRatio)}},{NO_EVENT:Ch}=Ne;const wh=class{#qc;#J;#Fd;constructor(t){this.#qc=t,this.#J=t.$,this.#Fd=t.pluginOptions}serverUpload(t,e){if(!e)return;const s=this.#Fd.uploadUrl;"string"==typeof s&&s.length>0&&this.#qc.fileManager.upload(s,this.#Fd.uploadHeaders,e,this.#Jd.bind(this,t),this.#Xh.bind(this))}#Yh(t,e){const s=e.result,i=this.#qc.createVideoTag();for(let e=0,n=s.length;e<n;e++){const o=t.isUpdate?t.element:i.cloneNode(!1);this.#qc.create(o,s[e].url,t.inputWidth,t.inputHeight,t.align,t.isUpdate,{name:s[e].name,size:s[e].size},e===n-1)}}async#Xh(t){const e=await this.#J.eventManager.triggerEvent("onVideoUploadError",{error:t}),s=e===Ch?t.errorMessage:e||t.errorMessage;this.#J.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.video.error]",e)}async#Jd(t,e){if(await this.#J.eventManager.triggerEvent("videoUploadHandler",{xmlHttp:e,info:t})===Ch){const s=JSON.parse(e.responseText);s.errorMessage?this.#Xh(s):this.#Yh(t,s)}}};const{_w:_h,NO_EVENT:xh}=Ne;class $h extends Lr{static key="video";static className="";static component(t){return/^(VIDEO)$/i.test(t?.nodeName)||/^(IFRAME)$/i.test(t?.nodeName)&&this.#Lu(t.src)?t:null}static#Lu(t){return t=t?.toLowerCase()||"",!(!this.#Nu.some((e=>t.endsWith(e)))&&!this.#Au.some((e=>e.test(t))))}static#Nu=[".mp4",".avi",".mov",".webm",".flv",".mkv",".m4v",".ogv"];static#Au=[/youtu\.?be/,/vimeo\.com\//,/dailymotion\.com\/video\//,/facebook\.com\/.+\/videos\//,/facebook\.com\/watch\/\?v=/,/twitter\.com\/.+\/status\//,/twitch\.tv\/videos\//,/twitch\.tv\/[^/]+$/,/tiktok\.com\/@[^/]+\/video\//,/instagram\.com\/p\//,/instagram\.com\/tv\//,/instagram\.com\/reel\//,/linkedin\.com\/posts\//,/\.(wistia\.com|wi\.st)\/(medias|embed)\//,/loom\.com\/share\//];#Kc;#iu;#ou="";#lu="none";#wc=null;#hu=null;constructor(t,e){super(t),this.title=this.$.lang.video,this.icon="video",this.pluginOptions={canResize:void 0===e.canResize||e.canResize,showHeightInput:void 0===e.showHeightInput||!!e.showHeightInput,defaultWidth:e.defaultWidth&&Ve.get(e.defaultWidth,0)?Ve.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight&&Ve.get(e.defaultHeight,0)?Ve.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"",percentageOnlySize:!!e.percentageOnlySize,createFileInput:!!e.createFileInput,createUrlInput:void 0===e.createUrlInput||!e.createFileInput||e.createUrlInput,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:Ve.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Ve.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?"video/*":e.acceptedFormats.trim()||"video/*",defaultRatio:Ve.get(e.defaultRatio,4)||.5625,showRatioOption:void 0===e.showRatioOption||!!e.showRatioOption,ratioOptions:e.ratioOptions?e.ratioOptions:null,videoTagAttributes:e.videoTagAttributes||null,iframeTagAttributes:e.iframeTagAttributes||null,query_youtube:e.query_youtube||"",query_vimeo:e.query_vimeo||"",insertBehavior:e.insertBehavior};const s=this.pluginOptions.percentageOnlySize?"%":"px",i=function({lang:t,icons:e,plugins:s},i){let n=`\n\t<form method="post" enctype="multipart/form-data">\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n\t\t\t${e.cancel}\n\t\t\t</button>\n\t\t\t<span class="se-modal-title">${t.video_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-modal-body">`;if(i.createFileInput&&(n+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<label>${t.video_modal_file}</label>\n\t\t\t\t${vr.CreateFileInput({lang:t,icons:e},i)}\n\t\t\t</div>`),i.createUrlInput&&(n+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<label>${t.video_modal_url}</label>\n\t\t\t\t<div class="se-modal-form-files">\n\t\t\t\t\t<input class="se-input-form se-input-url" type="text" data-focus />\n\t\t\t\t\t${s.videoGallery?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button __se__gallery" aria-label="${t.videoGallery}">\n\t\t\t\t\t\t\t\t${e.video_gallery}\n\t\t\t\t\t\t\t\t${Ie.utils.createTooltipInner(t.videoGallery)}\n\t\t\t\t\t\t\t\t</button>`:""}\n\t\t\t\t</div>\n\t\t\t\t<pre class="se-link-preview"></pre>\n\t\t\t</div>`),i.canResize){const s=i.ratioOptions||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285},{name:"9:16",value:1.78}],o=i.defaultRatio,l=i.percentageOnlySize,r=l?' style="display: none !important;"':"",a=i.showHeightInput?"":' style="display: none !important;"',h=i.showRatioOption?"":' style="display: none !important;"',c=l||i.showHeightInput||i.showRatioOption?"":' style="display: none !important;"';n+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<div class="se-modal-size-text">\n\t\t\t\t\t<label class="size-w">${t.width}</label>\n\t\t\t\t\t<label class="se-modal-size-x">&nbsp;</label>\n\t\t\t\t\t<label class="size-h"${a}>${t.height}</label>\n\t\t\t\t\t<label class="size-h"${h}>(${t.ratio})</label>\n\t\t\t\t</div>\n\t\t\t\t<input class="se-input-control _se_size_x" placeholder="100%"${l?' type="number" min="1"':'type="text"'}${l?' max="100"':""}/>\n\t\t\t\t<label class="se-modal-size-x"${c}>${l?"%":"x"}</label>\n\t\t\t\t<input class="se-input-control _se_size_y" placeholder="${100*i.defaultRatio}%"\n\t\t\t\t${l?' type="number" min="1"':'type="text"'}${l?' max="100"':""}${a}/>\n\t\t\t\t<select class="se-input-select se-modal-ratio" title="${t.ratio}" aria-label="${t.ratio}"${h}>\n\t\t\t\t\t${a?"":'<option value=""> - </option>'} \n\t\t\t\t\t${s.map((t=>`<option value="${t.value}"${o.toString()===t.value.toString()?" selected":""}>${t.name}</option>`)).join("")}\n\t\t\t\t</select>\n\t\t\t\t<button type="button" title="${t.revert}" aria-label="${t.revert}" class="se-btn se-modal-btn-revert">${e.revert}</button>\n\t\t\t</div>\n\t\t\t<div class="se-modal-form se-modal-form-footer"${r}${c}>\n\t\t\t\t<label>\n\t\t\t\t\t<input type="checkbox" class="se-modal-btn-check _se_check_proportion" />&nbsp;\n\t\t\t\t\t<span>${t.proportion}</span>\n\t\t\t\t</label>\n\t\t\t</div>`}n+=`\n\t\t</div>\n\t\t<div class="se-modal-footer">\n\t\t\t<div class="se-figure-align">\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="none" checked>${t.basic}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="left">${t.left}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="center">${t.center}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="right">${t.right}</label>\n\t\t\t</div>\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}"><span>${t.submitButton}</span></button>\n\t\t</div>\n\t</form>`;const o=Ie.utils.createElement("DIV",{class:"se-modal-content"},n);return{html:o,alignForm:o.querySelector(".se-figure-align"),fileModalWrapper:o.querySelector(".se-flex-input-wrapper"),videoInputFile:o.querySelector(".__se__file_input"),videoUrlFile:o.querySelector(".se-input-url"),previewSrc:o.querySelector(".se-link-preview"),galleryButton:o.querySelector(".__se__gallery"),proportion:o.querySelector("._se_check_proportion"),frameRatioOption:o.querySelector(".se-modal-ratio"),inputX:o.querySelector("._se_size_x"),inputY:o.querySelector("._se_size_y"),revertBtn:o.querySelector(".se-modal-btn-revert"),fileRemoveBtn:o.querySelector(".se-file-remove")}}(this.$,this.pluginOptions),n=e.controls||(this.pluginOptions.canResize?[["resize_auto,75,50","align","edit","revert","copy","remove"]]:[["align","edit","copy","remove"]]);n.some((t=>t.includes("align")))||(i.alignForm.style.display="none");const o=100*this.pluginOptions.defaultRatio+"%";this.modal=new vr(this,this.$,i.html),this.figure=new Pi(this,this.$,n,{sizeUnit:s,autoRatio:{current:o,default:o}}),this.fileManager=new yr(this,this.$,{query:"iframe, video",loadEventName:"onVideoLoad",actionEventName:"onVideoAction"}),this.fileModalWrapper=i.fileModalWrapper,this.videoInputFile=i.videoInputFile,this.videoUrlFile=i.videoUrlFile,this.focusElement=this.videoUrlFile||this.videoInputFile,this.previewSrc=i.previewSrc,this.#Kc=this.pluginOptions.canResize,this.#iu=!this.#Kc||!this.pluginOptions.showHeightInput||this.pluginOptions.percentageOnlySize,this.query={youtube:{pattern:/youtu\.?be/i,action:t=>(t=this.convertUrlYoutube(t),Be.addUrlQuery(t,this.pluginOptions.query_youtube)),tag:"iframe"},vimeo:{pattern:/vimeo\.com/i,action:t=>(t=this.convertUrlVimeo(t),Be.addUrlQuery(t,this.pluginOptions.query_vimeo)),tag:"iframe"},...e.embedQuery};const l=[];for(const t in this.query)l.push(this.query[t].pattern);$h.#Nu=$h.#Nu.concat(this.pluginOptions.extensions||[]),$h.#Au=$h.#Au.concat(e.urlPatterns||[]),this.state={onlyPercentage:this.pluginOptions.percentageOnlySize,sizeUnit:s,defaultRatio:100*this.pluginOptions.defaultRatio+"%"},this.sizeService=new yh(this,i),this.uploadService=new wh(this);const r=i.galleryButton;r&&this.$.eventManager.addEvent(r,"click",this.#mu.bind(this)),this.videoInputFile&&this.$.eventManager.addEvent(i.fileRemoveBtn,"click",this.#uu.bind(this)),this.videoUrlFile&&this.$.eventManager.addEvent(this.videoUrlFile,"input",this.#pu.bind(this)),this.videoInputFile&&this.videoUrlFile&&this.$.eventManager.addEvent(this.videoInputFile,"change",this.#gu.bind(this))}setState(t,e){this.state[t]=e}open(){this.modal.open()}retainFormat(){return{query:"iframe, video",method:async t=>{if(/^(iframe)$/i.test(t?.nodeName)&&!$h.#Lu(t.src))return;const e=Pi.GetContainer(t);if(e&&e.container&&e.cover)return;this.#vu(t,!0);const s=this.$.format.getLine(t);s&&(this.#lu=s.style.textAlign||s.style.float),this.#yu(t)}}}onFilePasteAndDrop({file:t}){/^video/.test(t.type)&&(this.submitFile([t]),this.$.focusManager.focus())}modalOn(t){t?this.videoInputFile&&this.pluginOptions.allowMultiple&&this.videoInputFile.removeAttribute("multiple"):this.videoInputFile&&this.pluginOptions.allowMultiple&&this.videoInputFile.setAttribute("multiple","multiple"),this.sizeService.on(t)}async modalAction(){this.#lu=this.modal.form.querySelector('input[name="suneditor_video_radio"]:checked').value;let t=!1;return this.videoInputFile&&this.videoInputFile.files.length>0?t=await this.submitFile(this.videoInputFile.files):this.videoUrlFile&&this.#ou.length>0&&(t=await this.submitURL(this.#ou)),t&&_h.setTimeout(this.$.component.select.bind(this.$.component,this.#wc,$h.key),0),t}modalInit(){vr.OnChangeFile(this.fileModalWrapper,[]),this.videoInputFile&&(this.videoInputFile.value=""),this.videoUrlFile&&(this.#ou=this.previewSrc.textContent=this.videoUrlFile.value=""),this.videoInputFile&&this.videoUrlFile&&(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),this.modal.form.querySelector('input[name="suneditor_video_radio"][value="none"]').checked=!0,this.#iu=!1,this.sizeService.init()}componentSelect(t){this.#vu(t)}componentEdit(){this.modal.open()}async componentDestroy(t){const e=t||this.#wc,s=Ie.query.getParentElement(e,Pi.is)||e,i=s.previousElementSibling||s.nextElementSibling,n=s.parentNode;!1!==await this.$.eventManager.triggerEvent("onVideoDeleteBefore",{element:e,container:s,align:this.#lu,url:this.#ou})&&(Ie.utils.removeItem(s),this.modalInit(),n!==this.$.frameContext.get("wysiwyg")&&this.$.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.$.focusManager.focusEdge(i),this.$.history.push(!1))}findProcessUrl(t){const e=this.query;for(const s in e){const i=e[s];if(i.pattern.test(t))return{origin:t,url:i.action(t),tag:i.tag}}return null}convertUrlYoutube(t){return/^http/.test(t)||(t="https://"+t),t=t.replace("watch?v=",""),/^\/\/.+\/embed\//.test(t)||(t=t.replace(t.match(/\/\/.+\//)[0],"//www.youtube.com/embed/").replace("&","?&")),t}convertUrlVimeo(t){return t.endsWith("/")&&(t=t.slice(0,-1)),t="https://player.vimeo.com/video/"+t.slice(t.lastIndexOf("/")+1)}addQuery(t,e){if(e.length>0)if(/\?/.test(t)){const s=t.split("?");t=s[0]+"?"+e+"&"+s[1]}else t+="?"+e;return t}create(t,e,s,i,n,o,l,r){let a=null;if(o){if((t=this.#wc).src!==e){const s=this.findProcessUrl(e);if(/^iframe$/i.test(s?.tag)&&!/^iframe$/i.test(t.nodeName)){const s=this.createIframeTag();s.src=e,t.replaceWith(s),this.#wc=t=s}else if(/^video$/i.test(s?.tag)&&!/^video$/i.test(t.nodeName)){const s=this.createVideoTag();s.src=e,t.replaceWith(s),this.#wc=t=s}else t.src=e}a=this.#hu}else{t.src=e,this.#wc=t;a=Pi.CreateContainer(t,"se-video-container").container}this.#wc=t,this.#hu=a,this.figure.open(t,{nonResizing:this.#iu,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0});const h=this.sizeService.resolveSize(s,i,t,o);s=h.width,i=h.height,this.figure.setAlign(t,n),this.fileManager.setFileData(t,l),o?(this.#Kc&&h.isChanged&&this.figure.isVertical||this.figure.setTransform(t,s,i,0),this.$.history.push(!1)):this.$.component.insert(a,{scrollTo:!!r,insertBehavior:r?this.pluginOptions.insertBehavior:"line"})}createIframeTag(t){const e=Ie.utils.createElement("IFRAME");if(t)for(const s in t)e[s]=t[s];return this.#Bu(e),e}createVideoTag(t){const e=Ie.utils.createElement("VIDEO");if(t)for(const s in t)e[s]=t[s];return this.#Iu(e),e}async submitFile(t){if(0===t.length)return;let e=0;const s=[],i=this.pluginOptions.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++)if(n=t[l],/video/i.test(n.type)){if(o=n.size,i>0&&o>i){const t="[SUNEDITOR.videoUpload.fail] Size of uploadable single file: "+i/1e3+"KB",e=await this.$.eventManager.triggerEvent("onVideoUploadError",{error:t,limitSize:i,uploadSize:o,file:n});return this.$.ui.alertOpen(e===xh?t:e||t,"error"),!1}s.push(n),e+=o}const n=this.pluginOptions.uploadSizeLimit,o=this.fileManager.getSize();if(n>0&&e+o>n){const t="[SUNEDITOR.videoUpload.fail] Size of uploadable total videos: "+n/1e3+"KB",s=await this.$.eventManager.triggerEvent("onVideoUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.$.ui.alertOpen(s===xh?t:s||t,"error"),!1}const l={url:null,files:s,...this.#wu()},r=function(t,e,s){t(e=s||e,e.files)}.bind(this,this.uploadService.serverUpload.bind(this.uploadService),l),a=await this.$.eventManager.triggerEvent("onVideoUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==xh||r(null)))}async submitURL(t){if(!(t=this.#ou))return!1;if(/^<iframe.*\/iframe>$/.test(t)){if(0===(t=(new DOMParser).parseFromString(t,"text/html").querySelector("iframe").src).length)return!1}const e=this.findProcessUrl(t);e&&(t=e.url);const s={name:t.split("/").pop(),size:0},i={url:t,files:s,...this.#wu(),process:e},n=function(t,e){t=e||t,this.create(this[/^iframe$/i.test(t.process?.tag)?"createIframeTag":"createVideoTag"](),t.url,t.inputWidth,t.inputHeight,t.align,t.isUpdate,t.files,!0)}.bind(this,i),o=await this.$.eventManager.triggerEvent("onVideoUploadBefore",{info:i,handler:n});return void 0===o||!1!==o&&(null!==o&&"object"==typeof o&&n(o),!0!==o&&o!==xh||n(null),!0)}#vu(t,e=!1){if(!t)return;const s=this.figure.open(t,{nonResizing:this.#iu,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:e});this.#wc=t,this.#hu=s.container,this.#lu=s.align,t.style.float="";const i=String(s.width||s.originWidth||s.w||""),n=String(s.height||s.originHeight||s.h||"");this.sizeService.setOriginSize(i,n),this.videoUrlFile&&(this.#ou=this.previewSrc.textContent=this.videoUrlFile.value=this.#wc.src||this.#wc.querySelector("source")?.src||"");(this.modal.form.querySelector('input[name="suneditor_video_radio"][value="'+this.#lu+'"]')||this.modal.form.querySelector('input[name="suneditor_video_radio"][value="none"]')).checked=!0,this.#Kc&&this.sizeService.ready(s,t)}#wu(){const{w:t,h:e}=this.sizeService.getInputSize();return{inputWidth:t,inputHeight:e,align:this.#lu,isUpdate:this.modal.isUpdate,element:this.#wc}}#yu(t){if(!t)return;/^video$/i.test(t.nodeName)?this.#Iu(t):/^iframe$/i.test(t.nodeName)&&this.#Bu(t);const e=t,s=t.cloneNode(!0),i=Pi.CreateContainer(s,"se-video-container"),n=i.container,o=Pi.GetContainer(e)?.container?.querySelector("figcaption");let l=null;o&&(l=Ie.utils.createElement("figcaption"),l.innerHTML=o.innerHTML,Ie.utils.removeItem(o),i.cover.appendChild(l)),this.figure.open(s,{nonResizing:this.#iu,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0});const r=(s.getAttribute("data-se-size")||",").split(","),a=r[0]||e.width||"",h=r[1]||e.height||this.state.defaultRatio||"";this.sizeService.applySize(a,h);const c=this.$.format.getLine(e);return c&&(this.#lu=c.style.textAlign||c.style.float),this.figure.setAlign(s,this.#lu),this.figure.retainFigureFormat(n,this.#wc,null,this.fileManager),s}#Iu(t){t.setAttribute("controls","true");const e=this.pluginOptions.videoTagAttributes;if(e)for(const s in e)t.setAttribute(s,e[s])}#Bu(t){t.frameBorder="0",t.allowFullscreen=!0;const e=this.pluginOptions.iframeTagAttributes;if(e)for(const s in e)t.setAttribute(s,e[s])}#uu(){this.videoInputFile.value="",this.videoUrlFile&&(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),vr.OnChangeFile(this.fileModalWrapper,[])}#pu(t){const e=Ie.query.getEventTarget(t).value.trim();/^<iframe.*\/iframe>$/.test(e)?(this.#ou=e,this.previewSrc.textContent='<IFrame :src=".."></IFrame>'):this.#ou=this.previewSrc.textContent=e?this.$.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.$.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#mu(){this.$.plugins.videoGallery.open(this.#$u.bind(this))}#$u(t){this.#ou=this.previewSrc.textContent=this.videoUrlFile.value=t.getAttribute("data-command")||t.src,this.videoUrlFile.focus()}#gu(t){this.videoInputFile.value?(this.videoUrlFile.disabled=!0,this.previewSrc.style.textDecoration="line-through"):(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration="");const e=Ie.query.getEventTarget(t);vr.OnChangeFile(this.fileModalWrapper,e.files)}}const kh=$h,{NO_EVENT:Sh,ON_OVER_COMPONENT:Eh}=Ne;class Th extends Lr{static key="audio";static className="";static component(t){return/^AUDIO$/i.test(t?.nodeName)?t:null}#Vu;#Ou;#Ru="";#wc=null;constructor(t,e){super(t),this.title=this.$.lang.audio,this.icon="audio",this.pluginOptions={defaultWidth:e.defaultWidth?Ve.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight?Ve.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"",createFileInput:!!e.createFileInput,createUrlInput:void 0===e.createUrlInput||!e.createFileInput||e.createUrlInput,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:Ve.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Ve.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?"audio/*":e.acceptedFormats.trim()||"audio/*",audioTagAttributes:e.audioTagAttributes||null,insertBehavior:e.insertBehavior};const s=function({lang:t,icons:e,plugins:s},i){let n=`\n <form method="post" enctype="multipart/form-data">\n <div class="se-modal-header">\n <button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n ${e.cancel}\n </button>\n <span class="se-modal-title">${t.audio_modal_title}</span>\n </div>\n <div class="se-modal-body">`;i.createFileInput&&(n+=`\n <div class="se-modal-form">\n <label>${t.audio_modal_file}</label>\n ${vr.CreateFileInput({lang:t,icons:e},i)}\n </div>`);i.createUrlInput&&(n+=`\n <div class="se-modal-form">\n <label>${t.audio_modal_url}</label>\n\t\t\t<div class="se-modal-form-files">\n\t\t\t\t<input class="se-input-form se-input-url" data-focus type="text" />\n\t\t\t\t${s.audioGallery?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button __se__gallery" aria-label="${t.audioGallery}">\n\t\t\t\t\t\t\t${e.audio_gallery}\n\t\t\t\t\t\t\t${Ie.utils.createTooltipInner(t.audioGallery)}\n\t\t\t\t\t\t\t</button>`:""}\n\t\t\t</div>\n <pre class="se-link-preview"></pre>\n </div>`);return n+=`\n </div>\n <div class="se-modal-footer">\n <button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}">\n <span>${t.submitButton}</span>\n </button>\n </div>\n </form>`,Ie.utils.createElement("DIV",{class:"se-modal-content"},n)}(this.$,this.pluginOptions),i=function({lang:t,icons:e}){const s=`\n <div class="se-arrow se-arrow-up"></div>\n <div class="link-content">\n <div class="se-btn-group">\n <button type="button" data-command="update" tabindex="-1" class="se-btn se-tooltip">\n ${e.edit}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.edit}</span>\n </span>\n </button>\n <button type="button" data-command="copy" tabindex="-1" class="se-btn se-tooltip">\n ${e.copy}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.copy}</span>\n </span>\n </button>\n <button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n ${e.delete}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.remove}</span>\n </span>\n </button>\n </div>\n </div>`;return Ie.utils.createElement("DIV",{class:"se-controller"},s)}(this.$);this.modal=new vr(this,this.$,s),this.controller=new ki(this,this.$,i,{position:"bottom",disabled:!0}),this.fileManager=new yr(this,this.$,{query:"audio",loadEventName:"onAudioLoad",actionEventName:"onAudioAction"}),this.figure=new Pi(this,this.$,null,{}),this.fileModalWrapper=s.querySelector(".se-flex-input-wrapper"),this.audioInputFile=s.querySelector(".__se__file_input"),this.audioUrlFile=s.querySelector(".se-input-url"),this.preview=s.querySelector(".se-link-preview"),this.#Vu=this.pluginOptions.defaultWidth,this.#Ou=this.pluginOptions.defaultHeight;const n=s.querySelector(".__se__gallery");n&&this.$.eventManager.addEvent(n,"click",this.#mu.bind(this)),this.audioInputFile&&(this.$.eventManager.addEvent(s.querySelector(".se-modal-files-edge-button"),"click",this.#uu.bind(this,this.audioUrlFile,this.preview)),this.audioUrlFile&&this.$.eventManager.addEvent(this.audioInputFile,"change",this.#Pu.bind(this))),this.audioUrlFile&&this.$.eventManager.addEvent(this.audioUrlFile,"input",this.#pu.bind(this))}open(){this.modal.open()}retainFormat(){return{query:"audio",method:t=>{const e=Pi.GetContainer(t);if(e&&e.container&&e.cover)return;this.#Iu(t);const s=Pi.CreateContainer(t.cloneNode(!0),"se-flex-component");this.figure.retainFigureFormat(s.container,t,null,this.fileManager)}}}onFilePasteAndDrop({file:t}){/^audio/.test(t.type)&&(this.submitFile([t]),this.$.focusManager.focus())}modalOn(t){t?this.#wc?(this.#Ru=this.preview.textContent=this.audioUrlFile.value=this.#wc.src,this.audioInputFile&&this.pluginOptions.allowMultiple&&this.audioInputFile.removeAttribute("multiple")):this.audioInputFile&&this.pluginOptions.allowMultiple&&this.audioInputFile.removeAttribute("multiple"):this.audioInputFile&&this.pluginOptions.allowMultiple&&this.audioInputFile.setAttribute("multiple","multiple")}async modalAction(){return this.audioInputFile&&this.audioInputFile?.files.length>0?await this.submitFile(this.audioInputFile.files):!!(this.audioUrlFile&&this.#Ru.length>0)&&await this.submitURL(this.#Ru)}modalInit(){vr.OnChangeFile(this.fileModalWrapper,[]),this.audioInputFile&&(this.audioInputFile.value=""),this.audioUrlFile&&(this.#Ru=this.preview.textContent=this.audioUrlFile.value=""),this.audioInputFile&&this.audioUrlFile&&(this.audioUrlFile.disabled=!1,this.preview.style.textDecoration="")}controllerAction(t){switch(t.getAttribute("data-command")){case"update":this.audioUrlFile&&(this.#Ru=this.preview.textContent=this.audioUrlFile.value=this.#wc.src),this.open();break;case"copy":{const t=Pi.GetContainer(this.#wc);this.$.component.copy(t.container);break}case"delete":this.componentDestroy(null)}}componentSelect(t){this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,infoOnly:!1}),this.#vu(t)}async componentDestroy(t){const e=t||this.#wc,s=Pi.GetContainer(e),i=s.container||e,n=i.previousElementSibling||i.nextElementSibling;if(!1===await this.$.eventManager.triggerEvent("onAudioDeleteBefore",{element:e,container:s,url:e.getAttribute("src")}))return;const o=i.parentNode;Ie.utils.removeItem(i),this.modalInit(),this.controller.close(),o!==this.$.frameContext.get("wysiwyg")&&this.$.nodeTransform.removeAllParents(o,(function(t){return 0===t.childNodes.length}),null),this.$.focusManager.focusEdge(n),this.$.history.push(!1)}async submitFile(t){if(0===t.length)return!1;let e=0;const s=[],i=this.pluginOptions.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++)if(n=t[l],/audio/i.test(n.type)){if(o=n.size,i>0&&o>i){const t="[SUNEDITOR.audioUpload.fail] Size of uploadable single file: "+i/1e3+"KB",e=await this.$.eventManager.triggerEvent("onAudioUploadError",{error:t,limitSize:i,uploadSize:o,file:n});return this.$.ui.alertOpen(e===Sh?t:e||t,"error"),!1}s.push(n),e+=o}const n=this.pluginOptions.uploadSizeLimit;if(n>0&&e+this.fileManager.getSize()>n){const t="[SUNEDITOR.audioUpload.fail] Size of uploadable total audios: "+n/1e3+"KB",s=await this.$.eventManager.triggerEvent("onAudioUploadError",{error:t,limitSize:n,currentSize:this.fileManager.getSize(),uploadSize:e});return this.$.ui.alertOpen(s===Sh?t:s||t,"error"),!1}const o={files:s,isUpdate:this.modal.isUpdate,element:this.#wc},l=function(t,e,s){t(s=e||s,s.files)}.bind(this,this.#zu.bind(this),o),r=await this.$.eventManager.triggerEvent("onAudioUploadBefore",{info:o,handler:l});return void 0===r||!!r&&(null!==r&&"object"==typeof r&&l(r),!0!==r&&r!==Sh||l(null),!0)}async submitURL(t){if(0===t.length)return!1;const e={name:t.split("/").pop(),size:0},s={url:t,files:e,isUpdate:this.modal.isUpdate,element:this.#Fu()},i=function(t,e,s){t((s=e||s).element,s.url,s.files,s.isUpdate,!0)}.bind(this,this.create.bind(this),s),n=await this.$.eventManager.triggerEvent("onAudioUploadBefore",{info:s,handler:i});return void 0===n||!!n&&(null!==n&&"object"==typeof n&&i(n),!0!==n&&n!==Sh||i(null),!0)}create(t,e,s,i,n){if(i){if(this.#wc&&(t=this.#wc),this.fileManager.setFileData(t,s),!t||t.src===e)return void this.$.component.select(t,Th.key);t.src=e,this.$.component.select(t,Th.key)}else{this.fileManager.setFileData(t,s),t.src=e;const i=Pi.CreateContainer(t,"se-flex-component");if(!this.$.component.insert(i.container,{scrollTo:!!n,insertBehavior:n?this.pluginOptions.insertBehavior:"line"}))return void(n&&this.$.focusManager.focus());if(!this.$.options.get("componentInsertBehavior")){const t=this.$.format.addLine(i.container,null);t&&this.$.selection.setRange(t,0,t,0)}}i&&this.$.history.push(!1)}#vu(t){fi.get("__overInfo")!==Eh&&(this.#wc=t,this.controller.open(t,null,{isWWTarget:!1,addOffset:null}))}#Yh(t,e){const s=e.result;for(let e,i,n=0,o=s.length;n<o;n++)i=t.isUpdate?t.element:this.#Fu(),e={name:s[n].name,size:s[n].size},this.create(i,s[n].url,e,t.isUpdate,n===o-1)}#Fu(){const t=this.#Vu,e=this.#Ou,s=Ie.utils.createElement("AUDIO",{style:(t?"width:"+t+"; ":"")+(e?"height:"+e+";":"")});return this.#Iu(s),s}#Iu(t){t.setAttribute("controls","true");const e=this.pluginOptions.audioTagAttributes;if(e)for(const s in e)t.setAttribute(s,e[s])}#zu(t,e){if(!e)return;const s=this.modal.isUpdate?[e[0]]:e;this.fileManager.upload(this.pluginOptions.uploadUrl,this.pluginOptions.uploadHeaders,s,this.#Jd.bind(this,t),this.#Xh.bind(this))}async#Xh(t){const e=await this.$.eventManager.triggerEvent("onAudioUploadError",{error:t}),s=e===Sh?t.errorMessage:e||t.errorMessage;this.$.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.audio.error]",s)}async#Jd(t,e){if(await this.$.eventManager.triggerEvent("audioUploadHandler",{xmlHttp:e,info:t})===Sh){const s=JSON.parse(e.responseText);s.errorMessage?this.#Xh(s):this.#Yh(t,s)}}#pu(t){const e=Ie.query.getEventTarget(t).value.trim();this.#Ru=this.preview.textContent=e?this.$.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.$.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#mu(){this.$.plugins.audioGallery.open(this.#$u.bind(this))}#$u(t){this.#Ru=this.preview.textContent=this.audioUrlFile.value=t.getAttribute("data-command")||t.src,this.audioUrlFile.focus()}#uu(t,e){this.audioInputFile.value="",t&&(t.disabled=!1,e.style.textDecoration=""),vr.OnChangeFile(this.fileModalWrapper,[])}#Pu(t){const e=Ie.query.getEventTarget(t);this.audioInputFile.value?(this.audioUrlFile.disabled=!0,this.preview.style.textDecoration="line-through"):(this.audioUrlFile.disabled=!1,this.preview.style.textDecoration=""),vr.OnChangeFile(this.fileModalWrapper,e.files)}}const Mh=Th,{_w:Hh,NO_EVENT:Lh}=Ne;class Nh extends Lr{static key="embed";static className="";static component(t){const e=t.children;let s="",i=null;if(Ie.check.isIFrame(t)&&(i=t,s=t.src),!s&&/^DIV$/i.test(t?.nodeName)&&Ie.check.isIFrame(e[0])&&(i=e[0],s=i.src),!s&&Ie.utils.hasClass(t,"se-embed-container")){i=Ie.query.getChildNode(t,(t=>t.src||t.href)),s=i?.src||i?.href}if(/^BLOCKQUOTE$/i.test(t?.nodeName)){const e=t.querySelector("a");if(e&&e.href)return i=t,s=e.href,this.#Lu(s)?i:null}return s?this.#Lu(s)?i:null:i}static#Lu(t){return t=t?.toLowerCase()||"",!!this.#Au.some((e=>e.test(t)))}static#Du(t,e){return!!t&&e.some((e=>e instanceof RegExp?e.test(t):t.startsWith(e)))}static#Au=null;#Su;#Eu;#Dd;#qd;#Kc;#qu;#iu;#ou="";#lu="none";#wc=null;#au=null;#hu=null;#Wd={w:0,h:0};constructor(t,e){super(t),this.title=this.$.lang.embed,this.icon="embed",this.pluginOptions={canResize:void 0===e.canResize||e.canResize,showHeightInput:void 0===e.showHeightInput||!!e.showHeightInput,defaultWidth:e.defaultWidth&&Ve.get(e.defaultWidth,0)?Ve.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight&&Ve.get(e.defaultHeight,0)?Ve.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"",percentageOnlySize:!!e.percentageOnlySize,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:Ve.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Ve.get(e.uploadSingleSizeLimit,0),iframeTagAttributes:e.iframeTagAttributes||null,query_youtube:e.query_youtube||"",query_vimeo:e.query_vimeo||"",scriptSrcWhitelist:Array.isArray(e.scriptSrcWhitelist)?e.scriptSrcWhitelist:[],insertBehavior:e.insertBehavior};const s=this.pluginOptions.percentageOnlySize?"%":"px",i=function({lang:t,icons:e},s){let i=`\n\t<form method="post" enctype="multipart/form-data">\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n\t\t\t${e.cancel}\n\t\t\t</button>\n\t\t\t<span class="se-modal-title">${t.embed_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-modal-body">\n\t\t\t<div class='se-modal-form'>\n\t\t\t\t<label>${t.embed_modal_source}</label>\n\t\t\t\t<input class='se-input-form se-input-url' type='text' data-focus />\n\t\t\t\t<pre class='se-link-preview'></pre>\n\t\t\t</div>`;if(s.canResize){const n=s.percentageOnlySize,o=n?' style="display: none !important;"':"",l=s.showHeightInput?"":' style="display: none !important;"',r=s.showRatioOption?"":' style="display: none !important;"',a=n||s.showHeightInput||s.showRatioOption?"":' style="display: none !important;"';i+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<div class="se-modal-size-text">\n\t\t\t\t\t<label class="size-w">${t.width}</label>\n\t\t\t\t\t<label class="se-modal-size-x">&nbsp;</label>\n\t\t\t\t\t<label class="size-h"${l}>${t.height}</label>\n\t\t\t\t\t<label class="size-h"${r}>(${t.ratio})</label>\n\t\t\t\t</div>\n\t\t\t\t<input class="se-input-control _se_size_x" placeholder="auto"${n?' type="number" min="1"':'type="text"'}${n?' max="100"':""}/>\n\t\t\t\t<label class="se-modal-size-x"${a}>${n?"%":"x"}</label>\n\t\t\t\t<input class="se-input-control _se_size_y" placeholder="auto"\n\t\t\t\t${n?' type="number" min="1"':'type="text"'}${n?' max="100"':""}${l}/>\n\t\t\t\t<button type="button" title="${t.revert}" aria-label="${t.revert}" class="se-btn se-modal-btn-revert">${e.revert}</button>\n\t\t\t</div>\n\t\t\t<div class="se-modal-form se-modal-form-footer"${o}${a}>\n\t\t\t\t<label>\n\t\t\t\t\t<input type="checkbox" class="se-modal-btn-check _se_check_proportion" />&nbsp;\n\t\t\t\t\t<span>${t.proportion}</span>\n\t\t\t\t</label>\n\t\t\t</div>`}i+=`\n\t\t</div>\n\t\t<div class="se-modal-footer">\n\t\t\t<div class="se-figure-align">\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="none" checked>${t.basic}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="left">${t.left}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="center">${t.center}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="right">${t.right}</label>\n\t\t\t</div>\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}"><span>${t.submitButton}</span></button>\n\t\t</div>\n\t</form>`;const n=Ie.utils.createElement("DIV",{class:"se-modal-content"},i);return{html:n,figureAlignBtn:n.querySelector(".se-figure-align"),fileModalWrapper:n.querySelector(".se-flex-input-wrapper"),embedInput:n.querySelector(".se-input-url"),previewSrc:n.querySelector(".se-link-preview"),proportion:n.querySelector("._se_check_proportion"),inputX:n.querySelector("._se_size_x"),inputY:n.querySelector("._se_size_y"),revertBtn:n.querySelector(".se-modal-btn-revert")}}(this.$,this.pluginOptions),n=e.controls||(this.pluginOptions.canResize?[["resize_auto,75,50","align","edit","revert","copy","remove"]]:[["align","edit","copy","remove"]]);n.some((t=>t.includes("align")))||(i.figureAlignBtn.style.display="none"),this.modal=new vr(this,this.$,i.html),this.figure=new Pi(this,this.$,n,{sizeUnit:s}),this.fileModalWrapper=i.fileModalWrapper,this.embedInput=i.embedInput,this.focusElement=this.embedInput,this.previewSrc=i.previewSrc,this.sizeUnit=s,this.proportion=null,this.inputX=null,this.inputY=null,this.#Su=this.pluginOptions.defaultWidth,this.#Eu=this.pluginOptions.defaultHeight,this.#Dd="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.#qd="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.#Kc=this.pluginOptions.canResize,this.#qu=this.pluginOptions.percentageOnlySize,this.#iu=!this.#Kc||!this.pluginOptions.showHeightInput||this.#qu,this.query={facebook:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:facebook\.com)\/(.+)/i,action:t=>`https://www.facebook.com/plugins/post.php?href=${encodeURIComponent(t)}&show_text=true&width=500`,tag:"iframe"},twitter:{pattern:/^(?:https?:\/\/)?(?:(?:www\.)?(?:twitter\.com|x\.com)\/(?:[^/?#]+\/)?status\/\d+(?:[/?#]|$)|platform\.twitter\.com\/embed\/Tweet\.html(?:[?#].*)?$)/i,action:t=>`https://platform.twitter.com/embed/Tweet.html?url=${encodeURIComponent(t)}`,tag:"iframe"},instagram:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:instagram\.com)\/p\/(.+)/i,action:t=>`https://www.instagram.com/p/${t.match(this.query.instagram.pattern)[1]}/embed`,tag:"iframe"},linkedin:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:linkedin\.com)\/(.+)\/(.+)/i,action:t=>`https://www.linkedin.com/embed/feed/update/${encodeURIComponent(t.split("/").pop())}`,tag:"iframe"},pinterest:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:pinterest\.com)\/pin\/(.+)/i,action:t=>`https://assets.pinterest.com/ext/embed.html?id=${t.match(this.query.pinterest.pattern)[1]}`,tag:"iframe"},spotify:{pattern:/(?:https?:\/\/)?(?:open\.)?(?:spotify\.com)\/(track|album|playlist|show|episode)\/(.+)/i,action:t=>{const e=t.match(this.query.spotify.pattern);return`https://open.spotify.com/embed/${e[1]}/${e[2]}`},tag:"iframe"},codepen:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:codepen\.io)\/(.+)\/pen\/(.+)/i,action:t=>{const[,e,s]=t.match(this.query.codepen.pattern);return`https://codepen.io/${e}/embed/${s}`},tag:"iframe"},...e.embedQuery};const o=[];for(const t in this.query)o.push(this.query[t].pattern);Nh.#Au=o.concat(e.urlPatterns||[]),this.$.eventManager.addEvent(this.embedInput,"input",this.#pu.bind(this)),this.#Kc&&(this.proportion=i.proportion,this.inputX=i.inputX,this.inputY=i.inputY,this.inputX.value=this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight,this.$.eventManager.addEvent(this.inputX,"keyup",this.#Kd.bind(this,"x")),this.$.eventManager.addEvent(this.inputY,"keyup",this.#Kd.bind(this,"y")),this.$.eventManager.addEvent(i.revertBtn,"click",this.#Yd.bind(this)))}open(){this.modal.open()}retainFormat(){return{query:"iframe",method:async t=>{if(!Nh.#Lu(t.src))return;const e=Pi.GetContainer(t);if(e&&e.container&&e.cover)return;this.#vu(t,!0);const s=this.$.format.getLine(t);s&&(this.#lu=s.style.textAlign||s.style.float),this.#yu(t)}}}modalOn(t){!t&&this.#Kc?(this.inputX.value=this.#Dd="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.inputY.value=this.#qd="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.proportion.disabled=!0):t&&(this.#ou=this.previewSrc.textContent=this.embedInput.value=this.#au.getAttribute("data-se-origin")||"")}async modalAction(){this.#lu=this.modal.form.querySelector('input[name="suneditor_embed_radio"]:checked').value;let t=!1;return this.#ou.length>0&&(t=await this.submitSRC(this.#ou)),t&&Hh.setTimeout(this.$.component.select.bind(this.$.component,this.#wc,Nh.key),0),t}modalInit(){vr.OnChangeFile(this.fileModalWrapper,[]),this.#ou=this.previewSrc.textContent=this.embedInput.value="",this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="none"]').checked=!0,this.#Wd={w:0,h:0},this.#iu=!1,this.#Kc&&(this.inputX.value=this.pluginOptions.defaultWidth===this.#Su?"":this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight===this.#Eu?"":this.pluginOptions.defaultHeight,this.proportion.checked=!1,this.proportion.disabled=!0)}componentSelect(t){this.#vu(t)}componentEdit(){this.modal.open()}async componentDestroy(t){const e=t||this.#wc,s=Ie.query.getParentElement(e,Pi.is)||e,i=s.previousElementSibling||s.nextElementSibling,n=s.parentNode;!1!==await this.$.eventManager.triggerEvent("onEmbedDeleteBefore",{element:e,container:s,align:this.#lu,url:this.#ou})&&(Ie.utils.removeItem(s),this.modalInit(),n!==this.$.frameContext.get("wysiwyg")&&this.$.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.$.focusManager.focusEdge(i),this.$.history.push(!1))}findProcessUrl(t){const e=this.query;for(const s in e){const i=e[s];if(i.pattern.test(t))return{origin:t,url:i.action(t),tag:i.tag}}return null}async submitSRC(t){if(!(t||=this.#ou))return!1;let e=null;if(/^<iframe\s|^<blockquote\s/i.test(t)){const s=(new DOMParser).parseFromString(t,"text/html").body.children;if(0===s.length)return!1;for(let t=0;t<s.length;t++){const e=s[t];if(/^iframe$/i.test(e.nodeName)&&!Nh.#Lu(e.getAttribute("src")||""))return!1;const i=e.querySelectorAll?.("iframe");if(i)for(let t=0;t<i.length;t++)if(!Nh.#Lu(i[t].getAttribute("src")||""))return!1}e={children:s,...this.#wu(),process:null}}else{const s=this.findProcessUrl(t);if(!s)return!1;t=s.url,e={...this.#wu(),url:t,process:s}}const s=function(e,s,i){e(t,(s=i||s).process,s.url,s.children,s.inputWidth,s.inputHeight,s.align,s.isUpdate)}.bind(this,this.#Wu.bind(this),e),i=await this.$.eventManager.triggerEvent("onEmbedInputBefore",{...e,handler:s});return void 0===i||!1!==i&&(null!==i&&"object"==typeof i&&s(i),!0!==i&&i!==Lh||s(null),!0)}#vu(t,e=!1){if(!t)return;const s=this.figure.open(t,{nonResizing:this.#iu,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:e});if(this.#wc=t,this.#au=s.cover,this.#hu=s.container,this._caption=s.caption,this.#lu=s.align,!this.#au?.getAttribute?.("data-se-origin")){const e=t?.getAttribute?.("src")||t?.querySelector?.("a")?.href;e&&Nh.#Lu(e)&&this.#au.setAttribute("data-se-origin",e)}t.style.float="",this.#Dd=String(s.originWidth||s.w||""),this.#qd=String(s.originHeight||s.h||"");if((this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="'+this.#lu+'"]')||this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="none"]')).checked=!0,!this.#Kc)return;const i=this.#qu&&this.figure.isVertical,{dw:n,dh:o}=this.figure.getSize(t);this.inputX.value="auto"===n?"":n,this.inputY.value="auto"===o?"":o,this.proportion.checked=!0,this.inputX.disabled=!!i,this.inputY.disabled=!!i,this.proportion.disabled=!!i,this.#Wd=this.proportion.checked?s.ratio:{w:0,h:0}}#Uu(){const t=Ie.utils.createElement("IFRAME");return this.#Bu(t),t}#Zu(){return Ie.utils.createElement("BLOCKQUOTE")}#Wu(t,e,s,i,n,o,l,r){let a=null,h=null,c=null,d=null;if(r){if(a=this.#wc,a.src!==s){const t=this.findProcessUrl(s);if(/^iframe$/i.test(t?.tag)&&!/^iframe$/i.test(a.nodeName)){const t=this.#Uu();t.src=s,a.replaceWith(t),a=t}else if(/^blockquote$/i.test(t?.tag)&&!/^blockquote$/i.test(a.nodeName)){const t=this.#Zu();t.setAttribute("src",s),a.replaceWith(t),a=t}else a.src=s}c=this.#hu,h=Ie.query.getParentElement(a,"FIGURE")}else if(e){a=this.#Uu(),a.src=s;const t=Pi.CreateContainer(a,"se-embed-container");h=t.cover,c=t.container}else{a=i[0];const t=Pi.CreateContainer(a,"se-embed-container");h=t.cover,c=t.container;const e=Array.from(i),s=this.pluginOptions.scriptSrcWhitelist;for(const t of e)if(/^script$/i.test(t.nodeName)){const e=t.getAttribute("src")||"";if(!Nh.#Du(e,s))continue;d=Ie.utils.createElement("script",{src:e,async:"true"},null)}else h.appendChild(t)}this.#wc=a,this.#au=h,this.#hu=c,this.figure.open(a,{nonResizing:this.#iu,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0}),n||=this.#Su,o||=this.#Eu;const u=this.figure.getSize(a),p=u.w!==n||u.h!==o,g=!r||p;if(g&&this.#Gu(n,o),this.figure.setAlign(a,l),h.setAttribute("data-se-origin",t),r)this.#Kc&&g&&this.figure.isVertical||this.figure.setTransform(a,n,o,0),d||this.$.history.push(!1);else{if(this.$.component.insert(c,{skipHistory:!0,scrollTo:!1,insertBehavior:this.pluginOptions.insertBehavior}),d)try{this.$.history.pause(),d.onload=()=>{Ie.utils.removeItem(d),d=null},h.appendChild(d);const t=new MutationObserver((e=>{for(const s of e)if("childList"===s.type&&!a.parentElement){this.$.history.resume(),this.$.history.push(!1),t.disconnect();break}}));t.observe(this.$.frameContext.get("wysiwyg"),{subtree:!0,childList:!0})}catch(t){this.$.history.resume(),console.warn("[SUNEDITOR] Embed tag script load error.",t)}if(!this.$.options.get("componentInsertBehavior")){const t=this.$.format.addLine(c,null);t&&this.$.selection.setRange(t,0,t,0)}}}#yu(t){if(!t)return;this.#Bu(t);const e=t;t=t.cloneNode(!0);const s=Pi.CreateContainer(t,"se-embed-container").container;this.figure.open(t,{nonResizing:this.#iu,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0});const i=(t.getAttribute("data-se-size")||",").split(","),n=i[0]||e.width||"",o=i[1]||e.height||"";this.#Gu(n,o);const l=this.$.format.getLine(e);return l&&(this.#lu=l.style.textAlign||l.style.float),this.figure.setAlign(t,this.#lu),this.figure.retainFigureFormat(s,this.#wc,null,null),t}#Gu(t,e){t||=this.inputX?.value||this.pluginOptions.defaultWidth,e||=this.inputY?.value||this.pluginOptions.defaultHeight,this.#qu&&(t?/%$/.test(t+"")||(t+="%"):t="100%"),this.figure.setSize(t,e)}#wu(){return{inputWidth:this.inputX?.value||"",inputHeight:this.inputY?.value||"",align:this.#lu,isUpdate:this.modal.isUpdate,element:this.#wc}}#Bu(t){t.frameBorder="0",t.allowFullscreen=!0;const e=this.pluginOptions.iframeTagAttributes;if(e)for(const s in e)t.setAttribute(s,e[s])}#pu(t){const e=Ie.query.getEventTarget(t).value.trim();/^<iframe.*\/iframe>$/.test(e)?(this.#ou=e,this.previewSrc.textContent='<IFrame :src=".."></IFrame>'):this.#ou=this.previewSrc.textContent=e?this.$.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.$.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#Yd(){this.#qu?this.inputX.value=Number(this.#Dd)>100?"100":this.#Dd:(this.inputX.value=this.#Dd,this.inputY.value=this.#qd)}#Kd(t,e){if(Oe.isSpace(e.code))return void e.preventDefault();const s=Ie.query.getEventTarget(e);if("x"===t&&this.#qu&&Number(s.value)>100)s.value="100";else if(this.proportion.checked){const e=Pi.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this.#Wd);"x"===t?this.inputY.value=String(e.h):this.inputX.value=String(e.w)}}}const Ah=Nh,{_w:Bh,_d:Ih}=Ne;class Vh extends Lr{static key="math";static className="";static component(t){return Ie.utils.hasClass(t,"se-math|katex")&&Ie.check.isComponentContainer(t)?t:null}#wc=null;constructor(t,e){super(t),this.title=this.$.lang.math,this.icon="math",this.katex=null,this.mathjax=null,(this.katex=this.#ju())||(this.mathjax=this.#Ku())||console.warn('[SUNEDITOR.plugins.math.warn] The math plugin must need either "KaTeX" or "MathJax" library. Please add the katex or mathjax option. See: https://github.com/ARA-developer/suneditor/blob/develop/guide/external-libraries.md'),this.pluginOptions={formSize:{width:"460px",height:"14em",maxWidth:"",maxHeight:"",minWidth:"400px",minHeight:"40px",...e.formSize},canResize:e.canResize??!0,autoHeight:!!e.autoHeight,fontSizeList:e.fontSizeList||[{text:"1",value:"1em"},{text:"1.5",value:"1.5em"},{text:"2",value:"2em"},{text:"2.5",value:"2.5em"}],onPaste:"function"==typeof e.onPaste?e.onPaste:null},this.pluginOptions.autoHeight&&(this.pluginOptions.formSize.height=this.pluginOptions.formSize.minHeight),this.defaultFontSize=null;const s=function(t){const{$:e,pluginOptions:s,katex:i}=t,{lang:n,icons:o}=e,{formSize:l,fontSizeList:r,canResize:a,autoHeight:h}=s,{width:c,height:d,maxWidth:u,maxHeight:p,minWidth:g,minHeight:m}=l,f=a?h?"horizontal":"auto":"none";let v=r[0].value,b=`\n <form>\n <div class="se-modal-header">\n <button type="button" data-command="close" class="se-btn se-close-btn" title="${n.close}" aria-label="${n.close}">\n ${o.cancel}\n </button>\n <span class="se-modal-title">${n.math_modal_title}</span>\n </div>\n <div class="se-modal-body">\n <div class="se-modal-form">\n <label>${n.math_modal_inputLabel} ${i?`(<a href="${Ne.KATEX_WEBSITE}" target="_blank">KaTeX</a>)`:`(<a href="${Ne.MATHJAX_WEBSITE}" target="_blank">MathJax</a>)`}</label>\n <textarea class="se-input-form se-math-exp se-modal-resize-form" type="text" data-focus style="width: ${c}; height: ${d}; min-width: ${g}; min-height: ${m}; resize: ${f};"></textarea>\n </div>\n <div class="se-modal-form">\n <label>${n.math_modal_fontSizeLabel}</label>\n <select class="se-input-select se-math-size">`;for(let t,e=0,s=r.length;e<s;e++)t=r[e],t.default&&(v=t.value),b+=`<option value="${t.value}"${t.default?" selected":""}>${t.text}</option>`;return b+=`</select>\n </div>\n <div class="se-modal-form">\n <label>${n.math_modal_previewLabel}</label>\n <p class="se-math-preview"></p>\n </div>\n </div>\n <div class="se-modal-footer">\n <button type="submit" class="se-btn-primary" title="${n.submitButton}" aria-label="${n.submitButton}">\n <span>${n.submitButton}</span>\n </button>\n </div>\n </form>`,t.defaultFontSize=v,Ie.utils.createElement("DIV",{class:"se-modal-content se-modal-responsive",style:`max-width: ${u}; max-height: ${p};`},b)}(this),i=function({lang:t,icons:e}){const s=`\n <div class="se-arrow se-arrow-up"></div>\n <div class="link-content">\n <div class="se-btn-group">\n <button type="button" data-command="update" tabindex="-1" class="se-btn se-tooltip">\n ${e.edit}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.edit}</span>\n </span>\n </button>\n <button type="button" data-command="copy" tabindex="-1" class="se-btn se-tooltip">\n ${e.copy}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.copy}</span>\n </span>\n </button>\n <button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n ${e.delete}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.remove}</span>\n </span>\n </button>\n </div>\n </div>`;return Ie.utils.createElement("DIV",{class:"se-controller se-controller-link"},s)}(this.$);this.modal=new vr(this,this.$,s),this.controller=new ki(this,this.$,i,{position:"bottom",disabled:!0}),this.textArea=s.querySelector(".se-math-exp"),this.previewElement=s.querySelector(".se-math-preview"),this.fontSizeElement=s.querySelector(".se-math-size"),this.isUpdateState=!1,this.previewElement.style.fontSize=this.defaultFontSize,this.$.eventManager.addEvent(this.textArea,"input",this.#Yu.bind(this)),this.$.eventManager.addEvent(this.fontSizeElement,"change",function(t){this.fontSize=t.target.value}.bind(this.previewElement.style)),this.pluginOptions.onPaste&&this.$.eventManager.addEvent(this.textArea,"paste",this.pluginOptions.onPaste.bind(this))}open(){this.modal.open()}retainFormat(){return{query:".se-math, .katex, .MathJax",method:t=>{if(!this.katex&&!this.mathjax)return;const e=Oh(t);if(!e)return;const s=Ih.createRange().createContextualFragment(this.#Xu(Be.entityToHTML(this.#Ju(e,!0))));t.innerHTML=s.querySelector(".se-math, .katex").innerHTML,t.setAttribute("contenteditable","false"),Ie.utils.addClass(t,"se-component|se-inline-component|se-disable-pointer|se-math"),this.katex?Ie.utils.addClass(t,"katex"):Ie.utils.removeClass(t,"katex"),this.mathjax&&this.#Qu(this.mathjax)}}}modalOn(t){if(this.isUpdateState=t,t){if(this.controller.currentTarget){const t=this.controller.currentTarget,e=Be.entityToHTML(this.#Ju(Oh(t),!0)),s=function(t){const e=t.getAttribute("data-se-type");if(e)return e;const s=t.getAttribute("data-font-size");return s?(t.removeAttribute("data-font-size"),t.setAttribute("data-se-type",s),s):null}(t)||"1em";this.textArea.value=e,this.fontSizeElement.value=s,this.previewElement.innerHTML=this.#Xu(e),this.previewElement.style.fontSize=s}}else this.modalInit()}async modalAction(){if(0===this.textArea.value.trim().length||Ie.utils.hasClass(this.textArea,"se-error"))return this.textArea.focus(),!1;const t=this.textArea.value,e=this.previewElement.querySelector(".se-math, .katex");if(!e)return!1;if(Ie.utils.addClass(e,"se-component|se-inline-component|se-disable-pointer|se-math"),e.setAttribute("contenteditable","false"),e.setAttribute("data-se-value",Be.htmlToEntity(this.#Ju(t,!1))),e.setAttribute("data-se-type",this.fontSizeElement.value),e.style.fontSize=this.fontSizeElement.value,this.katex?(Ie.utils.addClass(e,"katex"),Ie.utils.removeClass(e,"MathJax")):Ie.utils.removeClass(e,"katex"),this.isUpdateState){Ie.query.getParentElement(this.controller.currentTarget,".se-component").replaceWith(e);const t=this.$.component.get(e);return this.$.component.select(t.target,t.pluginName),!0}{const t=this.$.format.getLines();if(t.length>1){const s=Ie.utils.createElement(t[0].nodeName,null,e);this.$.component.insert(s,{insertBehavior:"none",scrollTo:!1})}else this.$.component.insert(e,{insertBehavior:"none",scrollTo:!1})}this.mathjax&&this.#Qu(this.mathjax);const s=this.$.selection.getNearRange(e);return s?this.$.selection.setRange(s.container,s.offset,s.container,s.offset):this.$.component.select(e,Vh.key),!0}modalInit(){this.textArea.value="",this.previewElement.innerHTML="",Ie.utils.removeClass(this.textArea,"se-error")}controllerAction(t){switch(t.getAttribute("data-command")){case"update":this.modal.open();break;case"copy":this.#tp(this.#wc);break;case"delete":this.componentDestroy(this.controller.currentTarget)}}controllerClose(){this.#wc=null}componentSelect(t){if(Ie.utils.hasClass(t,"se-math|katex")&&Oh(t))return this.#wc=t,void this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null})}async componentDestroy(t){Ie.utils.removeItem(t),this.controller.close(),this.$.focusManager.focus(),this.$.history.push(!1)}#Xu(t){let e="";try{if(Ie.utils.removeClass(this.textArea,"se-error"),this.katex)e=this.katex.src.renderToString(t,{throwOnError:!0,displayMode:!0});else{if(!this.mathjax){const t=new Error('404 Not found. "KaTeX" or "MathJax" library');throw t.code="MATH_LIB_NOT_FOUND",t}e=this.mathjax.convert(t).outerHTML,/<mjx-merror/.test(e)?(Ie.utils.addClass(this.textArea,"se-error"),e=`<span class="se-math-error">${e}</span>`):e=`<span class="se-math">${e}</span>`}}catch(t){Ie.utils.addClass(this.textArea,"se-error"),e="MATH_LIB_NOT_FOUND"===t.code?`<span class="se-math-error">${t.message}</span>`:`<span class="se-math-error">Math syntax error. (Refer ${this.katex?`<a href="${Ne.KATEX_WEBSITE}" target="_blank">KaTeX</a>`:`<a href="${Ne.MATHJAX_WEBSITE}" target="_blank">MathJax</a>`})</span>`,console.warn("[SUNEDITOR.math.error] ",t.message)}return e}#Ju(t,e){return t.replace(/\\{2}/g,e?"\\":"\\\\")}async#tp(t){if(navigator.clipboard&&t)try{const e=Oh(t);await this.$.html.copy(e),Ie.utils.addClass(t,"se-copy"),Bh.setTimeout((()=>{Ie.utils.removeClass(t,"se-copy")}),120)}catch(t){console.error("[SUNEDITOR.math.copy.fail]",t)}}#Yu(t){const e=Ie.query.getEventTarget(t);this.pluginOptions.autoHeight&&(e.style.height="5px",e.style.height=e.scrollHeight+5+"px"),this.previewElement.innerHTML=this.#Xu(e.value),this.mathjax&&this.#Qu(this.mathjax)}#Qu(t){t.clear(),t.updateDocument()}#ju(){const t=this.$.options.get("externalLibs").katex;if(!t)return null;if(!t.src)return console.warn("[SUNEDITOR.math.katex.fail] The katex option is set incorrectly."),null;const e=[{throwOnError:!1},t.options||{}].reduce(((t,e)=>{for(const s in e)t[s]=e[s];return t}),{});return t.options=e,t}#Ku(){const t=this.$.options.get("externalLibs").mathjax;if(!t)return null;this.$.frameOptions.get("iframe")&&console.warn("[SUNEDITOR.math.mathjax.fail] The MathJax option is not supported in the iframe.");try{const e=t.browserAdaptor();t.RegisterHTMLHandler(e);const s=new t.TeX,i=new t.CHTML;return t.src.document(document,{InputJax:s,OutputJax:i})}catch(t){return console.warn("[SUNEDITOR.math.mathjax.fail] The MathJax option is set incorrectly.",t),null}}}function Oh(t){const e=t.getAttribute("data-se-value");if(e)return e;const s=t.getAttribute("data-exp");return s?(t.removeAttribute("data-exp"),t.setAttribute("data-se-value",s),s):null}const Rh=Vh,{_w:Ph}=Ne;const zh=class extends Lr{static key="drawing";static className="";#st;#ep;constructor(t,e){super(t),this.title=this.$.lang.drawing,this.icon="drawing",this.pluginOptions={outputFormat:e.outputFormat||"dataurl",useFormatType:e.useFormatType??!1,defaultFormatType:["block","inline"].includes(e.defaultFormatType)?e.defaultFormatType:"block",keepFormatType:e.keepFormatType??!1,lineWidth:e.lineWidth||5,lineReconnect:!!e.lineReconnect,lineCap:["butt","round","square"].includes(e.lineCap)?e.lineCap:"round",lineColor:e.lineColor||"",formSize:{width:"750px",height:"50vh",maxWidth:"",maxHeight:"",minWidth:"150px",minHeight:"100px",...e.formSize},canResize:e.canResize??!0,maintainRatio:e.maintainRatio??!0},this.$.plugins.image?"svg"!==this.pluginOptions.outputFormat||this.$.plugins.image.pluginOptions.uploadUrl||console.warn('[SUNEDITOR.plugins.drawing.warn] The drawing plugin must need the "image" plugin with the "uploadUrl" option. Please add the "image" plugin with the "uploadUrl" option.'):console.warn('[SUNEDITOR.plugins.drawing.warn] The drawing plugin must need either "image" plugin. Please add the "image" plugin.');const s=function({lang:t,icons:e},s){const{width:i,height:n,maxWidth:o,maxHeight:l,minWidth:r,minHeight:a}=s.formSize,h=`\n <form>\n <div class="se-modal-header">\n <button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n ${e.cancel}\n </button>\n <span class="se-modal-title">${t.drawing_modal_title}</span>\n </div>\n <div class="se-modal-body" style="width: ${i}; height: ${n}; min-width: ${r}; min-height: ${a};">\n <canvas class="se-drawing-canvas" style="width: 100%; height: 100%;"></canvas>\n\t\t\t${s.canResize?'<div class="se-modal-resize-handle-w"></div><div class="se-modal-resize-handle-h"></div><div class="se-modal-resize-handle-c"></div>':""}\n\t\t</div>\n\t\t<div class="se-modal-body-bottom">\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<div class="se-modal-flex-form">\n\t\t\t\t\t${s.useFormatType?`\n\t\t\t\t\t\t\t<div class="se-modal-flex-group">\n\t\t\t\t\t\t\t\t<button type="button" class="se-btn se-tooltip" data-command="asBlock" aria-label="${t.blockStyle}">\n\t\t\t\t\t\t\t\t\t${e.as_block}\n\t\t\t\t\t\t\t\t\t${Ie.utils.createTooltipInner(t.blockStyle)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<button type="button" class="se-btn se-tooltip" data-command="asInline" aria-label="${t.inlineStyle}">\n\t\t\t\t\t\t\t\t\t${e.as_inline}\n\t\t\t\t\t\t\t\t\t${Ie.utils.createTooltipInner(t.inlineStyle)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</div>`:""}\n\t\t\t\t\t<div class="se-modal-flex-group">\n\t\t\t\t\t\t<button type="button" class="se-btn se-tooltip" data-command="remove" aria-label="${t.remove}">\n\t\t\t\t\t\t\t${e.eraser}\n\t\t\t\t\t\t\t${Ie.utils.createTooltipInner(t.remove)}\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n <div class="se-modal-footer">\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}">\n\t\t\t\t<span>${t.submitButton}</span>\n\t\t\t</button>\n </div>\n </form>`;return Ie.utils.createElement("DIV",{class:"se-modal-content se-modal-responsive",style:`max-width: ${o}; max-height: ${l};`},h)}(this.$,this.pluginOptions);this.modal=new vr(this,this.$,s),this.as=this.pluginOptions.defaultFormatType,this.pluginOptions.useFormatType&&(this.asBlock=s.querySelector('[data-command="asBlock"]'),this.asInline=s.querySelector('[data-command="asInline"]'),this.$.eventManager.addEvent([this.asBlock,this.asInline],"click",this.#fu.bind(this))),this.canvas=null,this.ctx=null,this.isDrawing=!1,this.points=[],this.paths=[],this.resizeObserver=null,this.#st={touchstart:this.#sp.bind(this),touchmove:this.#ip.bind(this),mousedown:this.#np.bind(this),mousemove:this.#op.bind(this),mouseup:this.#lp.bind(this),mouseleave:this.#rp.bind(this),mouseenter:this.#ap.bind(this)},this.#ep={touchstart:null,touchmove:null,mousedown:null,mousemove:null,mouseup:null,mouseleave:null,mouseenter:null},this.$.eventManager.addEvent(s.querySelector('[data-command="remove"]'),"click",this.#hp.bind(this))}open(){this.pluginOptions.useFormatType&&this.#Cu("inline"===(this.pluginOptions.keepFormatType?this.as:this.pluginOptions.defaultFormatType)),this.modal.open(),this.#cp()}modalOff(){this.#dp()}async modalAction(){if("svg"===this.pluginOptions.outputFormat){const t=this.#up();this.$.plugins.image.modalInit(),this.$.plugins.image.submitFile(t)}else{const t=this.canvas.toDataURL(),e={name:"drawing",size:0};this.$.plugins.image.modalInit(),"inline"!==this.as?this.$.plugins.image.create(t,null,"auto","","none",e,""):this.$.plugins.image.createInline(t,null,"auto","","none",e,"")}return!0}#cp(){const t=this.canvas=this.modal.form.querySelector(".se-drawing-canvas");this.ctx=t.getContext("2d"),t.width=t.offsetWidth,t.height=t.offsetHeight,this.points=[],this.paths=[],this.#pp(),this.#ep.touchstart=this.$.eventManager.addEvent(t,"touchstart",this.#st.touchstart,{passive:!1,capture:!0}),this.#ep.touchmove=this.$.eventManager.addEvent(t,"touchmove",this.#st.touchmove,!0),this.#ep.mousedown=this.$.eventManager.addEvent(t,"mousedown",this.#st.mousedown,{passive:!1,capture:!0}),this.#ep.mousemove=this.$.eventManager.addEvent(t,"mousemove",this.#st.mousemove,!0),this.#ep.mouseup=this.$.eventManager.addEvent(t,"mouseup",this.#st.mouseup,!0),this.#ep.mouseleave=this.$.eventManager.addEvent(t,"mouseleave",this.#st.mouseleave),this.#ep.mouseenter=this.$.eventManager.addEvent(t,"mouseenter",this.#st.mouseenter),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),Ne.isResizeObserverSupported&&(this.resizeObserver=new ResizeObserver((()=>{const e=t.width,s=t.height,i=t.offsetWidth,n=t.offsetHeight;t.width=i,t.height=n,e===t.width&&s===t.height||(this.pluginOptions.maintainRatio&&this.#gp(e,s,i,n),this.#mp())})),this.resizeObserver.observe(t))}#dp(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.canvas&&(this.$.eventManager.removeEvent(this.#ep.mousedown),this.$.eventManager.removeEvent(this.#ep.mousemove),this.$.eventManager.removeEvent(this.#ep.mouseup),this.$.eventManager.removeEvent(this.#ep.mouseleave),this.$.eventManager.removeEvent(this.#ep.mouseenter)),this.canvas=null,this.ctx=null,this.points=[],this.paths=[],this.isDrawing=!1}#pp(){this.ctx.lineWidth=this.pluginOptions.lineWidth,this.ctx.lineCap=this.pluginOptions.lineCap,this.ctx.strokeStyle=this.pluginOptions.lineColor||Ph.getComputedStyle(this.$.contextProvider.carrierWrapper).color}#fp(){this.#pp(),this.ctx.beginPath(),this.points.forEach((([t,e],s)=>{0===s?this.ctx.moveTo(t,e):this.ctx.lineTo(t,e)})),this.ctx.stroke()}#mp(){this.#pp(),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.paths.forEach((t=>{this.points=t,this.#fp()})),this.points=[]}#gp(t,e,s,i){const n=s/t,o=i/e;this.paths=this.paths.map((t=>t.map((([t,e])=>[t*n,e*o]))))}#vp(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.points=[],this.paths=[]}#bp(){const t="http://www.w3.org/2000/svg",e=document.createElementNS(t,"svg");return e.setAttribute("width",this.canvas.width+""),e.setAttribute("height",this.canvas.height+""),e.setAttribute("viewBox",`0 0 ${this.canvas.width} ${this.canvas.height}`),e.setAttribute("xmlns",t),this.paths.forEach((s=>{const i=s.reduce(((t,[e,s],i)=>t+(0===i?`M ${e} ${s}`:` L ${e} ${s}`)),""),n=document.createElementNS(t,"path");n.setAttribute("d",i),n.setAttribute("fill","none"),n.setAttribute("stroke",String(this.ctx.strokeStyle)),n.setAttribute("stroke-width",this.ctx.lineWidth+""),e.appendChild(n)})),e}#up(){const t=this.#bp(),e=(new XMLSerializer).serializeToString(t),s=new Blob([e],{type:"image/svg+xml"}),i=new File([s],"drawing.svg",{type:"image/svg+xml"}),n=new DataTransfer;return n.items.add(i),n.files}#yp(t){const{touches:e}=t,s=this.canvas.getBoundingClientRect();return{x:e[0].clientX-s.left,y:e[0].clientY-s.top}}#Cu(t){t?(Ie.utils.addClass(this.asInline,"on"),Ie.utils.removeClass(this.asBlock,"on"),this.as="inline"):(Ie.utils.addClass(this.asBlock,"on"),Ie.utils.removeClass(this.asInline,"on"),this.as="block")}#np(t){t.preventDefault(),this.isDrawing=!0,this.points.push([t.offsetX,t.offsetY]),this.#fp()}#op(t){t.preventDefault(),this.isDrawing&&(this.points.push([t.offsetX,t.offsetY]),this.#fp())}#sp(t){t.preventDefault();const{x:e,y:s}=this.#yp(t);this.isDrawing=!0,this.points.push([e,s]),this.#fp()}#ip(t){t.preventDefault();const{x:e,y:s}=this.#yp(t);this.isDrawing&&(this.points.push([e,s]),this.#fp())}#lp(){this.isDrawing=!1,this.points.length>0&&(this.paths.push([...this.points]),this.points=[])}#rp(){this.isDrawing&&(this.paths.push([...this.points]),this.pluginOptions.lineReconnect||(this.points=[],this.isDrawing=!1))}#ap(t){if(1===t.buttons){if(this.isDrawing=!0,this.pluginOptions.lineReconnect){const e=this.paths.at(-1).at(-1);this.points.push([e[0],e[1]]),this.points.push([t.offsetX,t.offsetY])}else this.points.push([t.offsetX,t.offsetY]);this.#fp()}}#hp(){this.#vp()}#fu(t){this.#Cu("asInline"===Ie.query.getEventTarget(t).getAttribute("data-command"))}};const Fh=class extends kr{static key="imageGallery";static className="";constructor(t,e){super(t),this.title=this.$.lang.imageGallery,this.icon="image_gallery",this.onSelectfunction=null,this.browser=new El(this,this.$,{title:this.$.lang.imageGallery,data:e.data,url:e.url,headers:e.headers,searchUrl:e.searchUrl,searchHeaders:e.searchHeaders,selectorHandler:this.#Cp.bind(this),columnSize:4,className:"se-image-gallery"}),this.width="auto"===this.$.plugins.image.pluginOptions.defaultWidth?"":this.$.plugins.image.pluginOptions.defaultWidth,this.height="auto"===this.$.plugins.image.pluginOptions.defaultHeight?"":this.$.plugins.image.pluginOptions.defaultHeight}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Cp(t){if(this.onSelectfunction)this.onSelectfunction(t);else{const e={name:t.getAttribute("data-name"),size:0};this.$.plugins.image.modalInit(),this.$.plugins.image.create(t.getAttribute("data-command"),null,this.width,this.height,"none",e,t.alt,!0)}}};const Dh=class extends kr{static key="videoGallery";static className="";constructor(t,e){super(t),this.title=this.$.lang.videoGallery,this.icon="video_gallery",this.onSelectfunction=null;const s="string"==typeof e.thumbnail?e.thumbnail:this.$.icons.video_thumbnail;this.browser=new El(this,this.$,{title:this.$.lang.videoGallery,data:e.data,url:e.url,headers:e.headers,searchUrl:e.searchUrl,searchHeaders:e.searchHeaders,selectorHandler:this.#Cp.bind(this),columnSize:4,className:"se-video-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>s,props:["frame"]}),this.width="auto"===this.$.plugins.video.pluginOptions.defaultWidth?"":this.$.plugins.video.pluginOptions.defaultWidth,this.height="auto"===this.$.plugins.video.pluginOptions.defaultHeight?"":this.$.plugins.video.pluginOptions.defaultHeight}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Cp(t){if(this.onSelectfunction)this.onSelectfunction(t);else{let e=t.getAttribute("data-command");const s=this.$.plugins.video.findProcessUrl(e);s&&(e=s.url);const i={name:t.getAttribute("data-name"),size:0};this.$.plugins.video.modalInit(),this.$.plugins.video.create(this.$.plugins.video["iframe"===t.getAttribute("data-frame")?"createIframeTag":"createVideoTag"]({poster:t.getAttribute("data-thumbnail")}),e,null,this.width,this.height,!1,i,!0)}}};const qh=class extends kr{static key="audioGallery";static className="";constructor(t,e){super(t),this.title=this.$.lang.audioGallery,this.icon="audio_gallery",this.onSelectfunction=null;const s="string"==typeof e.thumbnail?e.thumbnail:this.$.icons.audio_thumbnail;this.browser=new El(this,this.$,{title:this.$.lang.audioGallery,data:e.data,url:e.url,headers:e.headers,searchUrl:e.searchUrl,searchHeaders:e.searchHeaders,selectorHandler:this.#Cp.bind(this),columnSize:4,className:"se-audio-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>s})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Cp(t){this.onSelectfunction?this.onSelectfunction(t):(this.$.plugins.audio.modalInit(),this.$.plugins.audio.submitURL(t.getAttribute("data-command")))}};const Wh=class extends kr{static key="fileGallery";static className="";constructor(t,e){super(t),this.title=this.$.lang.fileGallery,this.icon="file_gallery",this.onSelectfunction=null;const s="string"==typeof e.thumbnail?e.thumbnail:this.$.icons.file_thumbnail;this.browser=new El(this,this.$,{title:this.$.lang.fileGallery,data:e.data,url:e.url,headers:e.headers,searchUrl:e.searchUrl,searchHeaders:e.searchHeaders,selectorHandler:this.#Cp.bind(this),columnSize:4,className:"se-file-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>s})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Cp(t){if(this.onSelectfunction)this.onSelectfunction(t);else{const e={name:t.getAttribute("data-name"),size:0};this.$.plugins.fileUpload.create(t.getAttribute("data-command"),e,!0)}}};const Uh=class extends kr{static key="fileBrowser";static className="";constructor(t,e){super(t),this.title=this.$.lang.fileBrowser,this.icon="file_browser",this.onSelectfunction=null;const s={video:this.$.icons.video_thumbnail,audio:this.$.icons.audio_thumbnail,file:this.$.icons.file_thumbnail},i=this.$.icons.file_thumbnail;this.browser=new El(this,this.$,{title:this.$.lang.fileBrowser,data:e.data,url:e.url,headers:e.headers,searchUrl:e.searchUrl,searchHeaders:e.searchHeaders,selectorHandler:this.#Cp.bind(this),columnSize:4,className:"se-file-browser",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:t=>s[t.type]||i,props:[...new Set((e.props??[]).concat(["frame"]))],expand:e.expand})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Cp(t){if(this.onSelectfunction)this.onSelectfunction(t);else{switch(t.getAttribute("data-type")){case"image":this.$.plugins.imageGallery.browser.selectorHandler(t);break;case"video":this.$.plugins.videoGallery.browser.selectorHandler(t);break;case"audio":this.$.plugins.audioGallery.browser.selectorHandler(t);break;case"file":this.$.plugins.fileGallery.browser.selectorHandler(t)}}}},Zh={text:{default:"16px",list:[{title:"XX-Small",size:"8px"},{title:"X-Small",size:"10px"},{title:"Small",size:"13px"},{title:"Medium",size:"16px"},{title:"Large",size:"18px"},{title:"X-Large",size:"24px"},{title:"XX-Large",size:"32px"}]},px:{default:13,inc:1,min:8,max:72,list:[8,10,13,15,18,20,22,26,28,36,48,72]},pt:{default:10,inc:1,min:6,max:72,list:[6,8,10,12,14,18,22,26,32]},em:{default:1,inc:.1,min:.5,max:5,list:[.5,.75,1,1.25,1.5,1.75,2,2.5,3]},rem:{default:1,inc:.1,min:.5,max:5,list:[.5,.75,1,1.25,1.5,1.75,2,2.5,3]},vw:{inc:.1,min:.5,max:10,list:[2,3.5,4,4.5,6,8]},vh:{default:1.5,inc:.1,min:.5,max:10,list:[1,1.5,2,2.5,3,3.5,4]},"%":{default:100,inc:1,min:50,max:200,list:[50,70,90,100,120,140,160,180,200]}};class Gh extends Hr{static key="fontSize";static className="se-btn-select se-btn-input se-btn-tool-font-size";#wp;constructor(t,e){super(t),this.unitMap={...Zh,...e.unitMap||{}},this.sizeUnit=/text/.test(e.sizeUnit)?"":e.sizeUnit||this.$.options.get("fontSizeUnits")[0];const s=this.unitMap[this.sizeUnit||"text"],i=function({lang:t},e,s,i){const n=e.list,o=e.default,l=i?t.default:"";let r='\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">';for(let t,e,i,a,h,c=0,d=n.length;c<d;c++)t=n[c],"object"==typeof t?(e=t.title,i=t.size):e=i=t+s,a=o===i?" default_value":"",h=a&&l||e,r+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list${a}" data-command="${i}" data-value="${e}" title="${h}" aria-label="${h}" style="font-size:${i};">${h}</button>\n\t\t\t</li>`;return r+="\n\t\t</ul>\n\t</div>",Ie.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-font-size"},r)}(this.$,s,this.sizeUnit,e.showDefaultSizeLabel),n=!!this.sizeUnit&&(e.showIncDecControls??!1),o=!this.sizeUnit||(e.disableInput??!1);this.title=this.$.lang.fontSize,this.inner=!(o&&!n)&&(o?`<span class="se-txt se-not-arrow-text __se__font_size">${this.$.lang.fontSize}</span>`:`<input type="text" class="__se__font_size se-not-arrow-text" placeholder="${this.$.lang.fontSize}" />`),n?(this.beforeItem=Ie.utils.createElement("button",{class:"se-btn se-tooltip se-sub-btn",type:"button","data-command":Gh.key,"data-type":"command","data-value":"dec"},`${this.$.icons.minus}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.decrease}</span></span>`),this.afterItem=Ie.utils.createElement("button",{class:"se-btn se-tooltip se-sub-btn",type:"button","data-command":Gh.key,"data-type":"command","data-value":"inc"},`${this.$.icons.plus}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.increase}</span></span>`)):o?o&&!n&&(this.replaceButton=Ie.utils.createElement("button",{class:"se-btn se-tooltip se-btn-select se-btn-tool-font-size",type:"button","data-command":Gh.key,"data-type":"dropdown"},`<span class="se-txt __se__font_size">${this.$.lang.fontSize}</span>${this.$.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.fontSize}</span></span>`),this.$.menu.initDropdownTarget({key:Gh.key,type:"dropdown"},i)):(this.afterItem=Ie.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn",type:"button","data-command":Gh.key,"data-type":"dropdown"},`${this.$.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.fontSize}</span></span>`),this.$.menu.initDropdownTarget({key:Gh.key,type:"dropdown"},i)),this.currentSize="",this.sizeList=i.querySelectorAll("li button"),this.hasInputFocus=!1,this.isInputActive=!1,this.#wp=o,this.$.menu.initDropdownTarget(Gh,i)}active(t,e){if(!Ie.utils.hasClass(e,"__se__font_size"))return!1;let s="";if(t){if(this.$.format.isLine(t))return;if(s=Ie.utils.getStyle(t,"fontSize"))return this.#_p(e,s),!0}else this.#_p(e,this.#xp());return!1}toolbarInputKeyDown({target:t,event:e}){const s=e.code;if(this.#wp||Oe.isSpace(s))return void e.preventDefault();if(!/^(ArrowUp|ArrowDown|Enter)$/.test(s))return;const{value:i,unit:n}=this.#$p(t);if(!i)return;const o=Ve.get(i),l=this.unitMap[n];let r=o;switch(s){case"ArrowUp":r+=l.inc,r>l.max&&(r=o);break;case"ArrowDown":r-=l.inc,r<l.min&&(r=o)}e.preventDefault();try{this.isInputActive=!0;const e=this.#_p(t,r+n);if(this.#wp)return;const i=Ie.utils.createElement("SPAN",{style:"font-size: "+e+";"});this.$.inline.apply(i,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null}),Oe.isEnter(s)||t.focus()}finally{this.isInputActive=!1}}toolbarInputChange({target:t,value:e,event:s}){if(!this.#wp)try{this.isInputActive=!0;let{value:s,unit:i}=this.#$p(e);const{max:n,min:o}=this.unitMap[i];s=s>n?n:s<o?o:s;const l=Ie.utils.createElement("SPAN",{style:"font-size: "+this.#_p(t,s+i)+";"});this.$.inline.apply(l,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}finally{this.isInputActive=!1,s.preventDefault(),this.$.focusManager.focus()}}on(t){const{value:e,unit:s}=this.#$p(t),i=e+s;if(i===this.currentSize)return;const n=this.sizeList;for(let t=0,e=n.length;t<e;t++)i===n[t].getAttribute("data-value")?Ie.utils.addClass(n[t],"active"):Ie.utils.removeClass(n[t],"active");this.currentSize=i}action(t){const e=t.getAttribute("data-command");if(e===Gh.key){const{value:e,unit:s}=this.#$p(t);let i=Ve.get(e)+("inc"===t.getAttribute("data-value")?1:-1);const{min:n,max:o}=this.unitMap[s];i=i<n?n:i>o?o:i;const l=Ie.utils.createElement("SPAN",{style:"font-size: "+i+s+";"});this.$.inline.apply(l,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}else if(e){const t=Ie.utils.createElement("SPAN",{style:"font-size: "+e+";"});this.$.inline.apply(t,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}else this.$.inline.apply(null,{stylesToModify:["font-size"],nodesToRemove:["span"],strictRemove:!0});this.$.menu.dropdownOff()}#xp(){return this.$.frameContext.get("wwComputedStyle").fontSize}#$p(t){if(!(t="string"==typeof t?t:t.parentElement.querySelector(".__se__font_size")))return{unit:this.sizeUnit,value:this.sizeUnit?0:""};const e="string"==typeof t?t:Ie.check.isInputElement(t)?t.value:t.textContent,s=this.sizeUnit?e.split(/(\d+)/):[e,""];let i=(s.pop()||"").trim().toLowerCase();i=this.$.options.get("fontSizeUnits").includes(i)?i:this.sizeUnit;const n=s.pop();return{unit:i,value:i?Number(n):n}}#_p(t,e){return(t=t.parentElement.querySelector(".__se__font_size"))?Ie.check.isInputElement(t)?t.value=String(e):t.textContent=String(this.sizeUnit?e:this.unitMap.text.list.find((t=>t.size===e))?.title||e):0}}const jh=Gh;const Kh=class extends Hr{static key="pageNavigator";static className="se-btn-input se-btn-tool-pageNavigator";constructor(t){super(t),this.title=this.$.lang.pageNumber,this.inner=Ie.utils.createElement("input",{type:"number",class:"se-not-arrow-text",placeholder:"1",value:"1",min:"1"},null),this.afterItem=Ie.utils.createElement("span",{class:"se-btn se-sub-btn"},""),this.pageNum=1,this.totalPages=1,this.$.eventManager.addEvent(this.inner,"change",this.#kp.bind(this))}display(t,e){this.pageNum=t,this.totalPages=e,this.inner.value=String(t),this.afterItem.textContent=this.inner.max=String(e)}#kp(t){if(!this.$.frameContext.has("documentType_use_page"))return;const e=Ie.query.getEventTarget(t),s=Number(e.value)||1;this.$.frameContext.get("documentType").pageGo(s)}},{_w:Yh}=Ne;class Xh extends Nr{static key="anchor";static className="";static component(t){return Ie.check.isAnchor(t)&&t.hasAttribute("id")&&t.hasAttribute("data-se-anchor")?t:null}#wc=null;#Sp=null;constructor(t){super(t),this.title=this.$.lang.anchor,this.icon="bookmark_anchor";const e=(new DOMParser).parseFromString(this.$.icons.bookmark_anchor,"image/svg+xml");this.bookmarkIcon=e.documentElement;const s=function({lang:t,icons:e}){const s=`\n\t<div class="se-arrow se-arrow-up"></div>\n\t<div class="link-content">\n\t\t<div class="se-controller-display"></div>\n\t\t<div class="se-btn-group">\n\t\t\t<button type="button" data-command="edit" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.edit}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.edit}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t<button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.delete}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.remove}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t</div>\n\t</div>`;return Ie.utils.createElement("DIV",{class:"se-controller se-controller-link"},s)}(this.$);this.displayId=s.querySelector(".se-controller-display"),this.controllerSelect=new ki(this,this.$,s,{position:"bottom",disabled:!0},Xh.key);const i=function({lang:t,icons:e}){const s=`\n\t\t<div class="se-arrow se-arrow-up"></div>\n\t\t<form>\n\t\t\t<div class="se-controller-display">${t.id}</div>\n\t\t\t<div class="se-btn-group se-form-group">\n\t\t\t\t<input type="text" required />\n\t\t\t\t<button type="submit" data-command="submit" class="se-btn se-tooltip se-btn-success">\n\t\t\t\t\t${e.checked}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.save}</span></span>\n\t\t\t\t</button>\n\t\t\t\t<button type="button" data-command="cancel" class="se-btn se-tooltip se-btn-danger">\n\t\t\t\t\t${e.cancel}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.cancel}</span></span>\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</form>\n\t\t`;return Ie.utils.createElement("DIV",{class:"se-controller se-controller-simple-input"},s)}(this.$);this.inputEl=i.querySelector("input"),this.controller=new ki(this,this.$,i,{position:"bottom",disabled:!0,parents:[this.controllerSelect.form],parentsHide:!0},Xh.key)}show(){this.controller.open(this.#Sp=this.$.selection.getRange()),Yh.setTimeout((()=>{this.inputEl.focus()}),0)}componentSelect(t){this.#wc=t,this.displayId.textContent=t.getAttribute("id"),this.controllerSelect.open(t)}componentDeselect(){this.#$s()}controllerAction(t){const e=t.getAttribute("data-command");if(!e)return;const s=this.#wc;switch(e){case"submit":if(this.controller.close(),s)s.id=this.inputEl.value,this.$.component.select(s,Xh.key);else{const t=this.inputEl.value.trim();if(!t)return void this.inputEl.focus();const e=Ie.utils.createElement("A",{id:t,"data-se-anchor":this.inputEl.value,"data-se-non-link":"true",contenteditable:"false",class:"se-component se-inline-component"});this.$.component.insert(e,{insertBehavior:"none",scrollTo:!1});const s=this.$.selection.getNearRange(e);s?this.$.selection.setRange(s.container,s.offset,s.container,s.offset):this.$.component.select(e,Xh.key),this.#$s()}break;case"cancel":this.controller.close(!s),this.#Sp&&this.$.selection.setRange(this.#Sp),this.#$s(),s&&this.componentSelect(s);break;case"edit":this.inputEl.value=this.displayId.textContent,this.controllerSelect.hide(),this.controller.open(s),this.inputEl.focus();break;case"delete":{const t=this.$.selection.getNearRange(s);Ie.utils.removeItem(s),this.controllerSelect.close(!0),t&&this.$.selection.setRange(t.container,t.offset,t.container,t.offset),this.#$s();break}}}#$s(){this.#wc=null,this.#Sp=null,this.inputEl.value="",this.displayId.textContent=""}}const Jh={blockquote:Ar,codeBlock:Vr,exportPDF:Pr,fileUpload:Dr,list_bulleted:Wr,list_numbered:Gr,autocomplete:Xr,slashCommand:Qr,align:ea,font:ia,fontColor:oa,backgroundColor:ra,list:da,table:Ya,blockStyle:Ja,hr:ha,layout:th,lineHeight:sh,template:nh,paragraphStyle:lh,textStyle:ah,link:hh,image:bh,video:kh,audio:Mh,embed:Ah,math:Rh,drawing:zh,imageGallery:Fh,videoGallery:Dh,audioGallery:qh,fileGallery:Wh,fileBrowser:Uh,fontSize:jh,pageNavigator:Kh,anchor:Xh};class Qh{async modalAction(){return!0}modalOn(t){}modalInit(){}modalOff(t){}modalResize(){}}class tc{controllerAction(t){}controllerOn(t,e){}controllerClose(){}}class ec{browserInit(){}}class sc{colorPickerAction(t){}colorPickerHueSliderOpen(){}colorPickerHueSliderClose(){}}class ic{hueSliderAction(){}hueSliderCancelAction(){}}class nc{componentSelect(t){}componentDeselect(t){}componentEdit(t){}async componentDestroy(t){}componentCopy(t){}}const oc={contract:t,manager:e,ui:i};Object.defineProperty(window,"SUNEDITOR",{enumerable:!0,writable:!1,configurable:!1,value:{...xr,plugins:Jh,modules:oc,helper:Fe,interfaces:n}})})()})();
1
+ (()=>{var t={cfbI(t){var e,s;e="undefined"!=typeof window?window:this,s=function(t,e){const s={code:"en",align:"Align",alignBottom:"Align bottom",alignCenter:"Align center",alignJustify:"Align justify",alignLeft:"Align left",alignMiddle:"Align middle",alignRight:"Align right",alignTop:"Align top",anchor:"Anchor",asBlock:"As a block",asInline:"As a inline",asLink:"As a link",audio:"Audio",audioGallery:"Audio gallery",audio_modal_file:"Select from files",audio_modal_title:"Insert Audio",audio_modal_url:"Audio URL",autoSize:"Auto size",backgroundColor:"Background color",basic:"Basic",blockStyle:"Block style",bold:"Bold",border:"Border",border_all:"Border all",border_inside:"Border inside",border_horizontal:"Border horizontal",border_vertical:"Border vertical",border_outside:"Border outside",border_left:"Border left",border_top:"Border top",border_right:"Border right",border_bottom:"Border bottom",border_none:"Border none",bulletedList:"Bulleted list",cancel:"Cancel",caption:"Insert description",cellProperties:"Cell properties",center:"Center",close:"Close",codeView:"Code view",color:"Color",colorPicker:"Color picker",column:"Column",comment:"Comments",commentAdd:"Add comment",commentShow:"Show comments",copy:"Copy",copyFormat:"Paint Formatting",cut:"Cut",default:"Default",deleteColumn:"Delete column",deleteRow:"Delete row",dir_ltr:"Left to right",dir_rtl:"Right to left",download:"Download",drag:"Drag",drawing:"Drawing",drawing_modal_title:"Drawing",edit:"Edit",embed:"Embed",embed_modal_title:"Embed",embed_modal_source:"Embed Source / URL",exportPDF:"Export to PDF",exportWord:"Export to Word",find:"Find",decrease:"Decrease",increase:"Increase",fileBrowser:"File browser",fileGallery:"File gallery",fileUpload:"File upload",fixedColumnWidth:"Fixed column width",font:"Font",fontColor:"Font color",fontSize:"Size",formats:"Formats",fullScreen:"Full screen",height:"Height",horizontalLine:"Horizontal line",horizontalSplit:"Horizontal split",hr_dashed:"Dashed",hr_dotted:"Dotted",hr_solid:"Solid",id:"ID",image:"Image",imageGallery:"Image gallery",image_modal_altText:"Alternative text",image_modal_file:"Select from files",image_modal_title:"Insert image",image_modal_url:"Image URL",importWord:"Import from Word",indent:"Indent",inlineStyle:"Inline style",insertColumnAfter:"Insert column after",insertColumnBefore:"Insert column before",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",insertLine:"Insert line",italic:"Italic",layout:"Layout",left:"Left",lineHeight:"Line height",link:"Link",link_modal_bookmark:"Bookmark",link_modal_downloadLinkCheck:"Download link",link_modal_newWindowCheck:"Open in new window",link_modal_text:"Text to display",link_modal_title:"Insert Link",link_modal_url:"URL to link",link_modal_relAttribute:"Rel attribute",list:"List",markdownView:"Markdown view",math:"Math",math_modal_fontSizeLabel:"Font Size",math_modal_inputLabel:"Mathematical Notation",math_modal_previewLabel:"Preview",math_modal_title:"Math",maxSize:"Max size",mediaGallery:"Media gallery",menu_bordered:"Bordered",menu_code:"Code",menu_neon:"Neon",menu_shadow:"Shadow",menu_spaced:"Spaced",menu_translucent:"Translucent",mergeCells:"Merge cells",minSize:"Min size",mirrorHorizontal:"Mirror, Horizontal",mirrorVertical:"Mirror, Vertical",newDocument:"New document",numberedList:"Numbered list",outdent:"Outdent",pageBreak:"Page break",pageDown:"Page down",pageNumber:"Page number",pageUp:"Page up",paragraphStyle:"Paragraph style",preview:"Preview",print:"print",proportion:"Constrain proportions",ratio:"Ratio",redo:"Redo",remove:"Remove",removeFormat:"Remove Format",replace:"Replace",replaceAll:"Replace all",resize100:"Zoom 100%",resize25:"Zoom 25%",resize50:"Zoom 50%",resize75:"Zoom 75%",resize:"Resize",revert:"Revert",revisionHistory:"Revision History",right:"Right",rotateLeft:"Rotate left",rotateRight:"Rotate right",row:"Row",save:"Save",search:"Search",selectAll:"Select All",showBlocks:"Show blocks",size:"Size",splitCells:"Split cells",strike:"Strike",submitButton:"Submit",subscript:"Subscript",superscript:"Superscript",table:"Table",tableHeader:"Table header",tableProperties:"Table properties",tags:"Tags",tag_blockquote:"Quote",codeBlock:"Code Block",tag_div:"Normal (DIV)",tag_h:"Header",tag_p:"Paragraph",tag_pre:"Code",template:"Template",textStyle:"Text style",title:"Title",underline:"Underline",undo:"Undo",unmergeCells:"Unmerge cells",unlink:"Unlink",verticalSplit:"Vertical split",video:"Video",videoGallery:"Video gallery",video_modal_file:"Select from files",video_modal_title:"Insert Video",video_modal_url:"Media embed URL, YouTube/Vimeo",width:"Width",codeLanguage:"Language",codeLanguage_none:"None",finder_matchCase:"Match Case",finder_wholeWord:"Whole Word",finder_regex:"Regular Expression",finder_prev:"Previous Match",finder_next:"Next Match",message_copy_success:"Copied to clipboard",message_copy_fail:"Copy failed. Please copy manually."};return void 0===e&&(t.SUNEDITOR_LANG||Object.defineProperty(t,"SUNEDITOR_LANG",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(t.SUNEDITOR_LANG,"en",{enumerable:!0,writable:!0,configurable:!0,value:s})),s},"object"==typeof t.exports?t.exports=e.document?s(e,!0):function(t){if(!t.document)throw new Error("SUNEDITOR_LANG a window with a document");return s(t)}:s(e)}},e={};function s(i){var n=e[i];if(void 0!==n)return n.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,s),o.exports}s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";var t={};s.r(t),s.d(t,{Browser:()=>Il,ColorPicker:()=>_r,Controller:()=>Ti,Figure:()=>Fi,HueSlider:()=>yr,Modal:()=>kr});var e={};s.r(e),s.d(e,{ApiManager:()=>Al,FileManager:()=>Er});var i={};s.r(i),s.d(i,{CommandMenu:()=>hn,ModalAnchorEditor:()=>Hr,SelectMenu:()=>Hi,_DragHandle:()=>yi});var n={};s.r(n),s.d(n,{EditorComponent:()=>uc,ModuleBrowser:()=>hc,ModuleColorPicker:()=>cc,ModuleController:()=>ac,ModuleHueSlider:()=>dc,ModuleModal:()=>rc,PluginBrowser:()=>Ar,PluginCommand:()=>Br,PluginDropdown:()=>Ir,PluginDropdownFree:()=>Vr,PluginField:()=>Or,PluginInput:()=>Rr,PluginModal:()=>Pr,PluginPopup:()=>zr});const o=window,l=document,r=Symbol("noEventHandler"),a=Symbol("onOverComponent"),h=navigator.userAgent.toLowerCase();const c="function"==typeof ResizeObserver,d="function"==typeof navigator.clipboard?.write,u=/Edg/.test(navigator.userAgent),p=/(Mac|iPhone|iPod|iPad)/.test(navigator.userAgent),g=h.includes("chrome/")&&!h.includes("edge/"),m=!!h.match(/gecko\/\d+/),f=!!o.chrome,v=h.includes("applewebkit/")&&!h.includes("chrome"),b=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(h),y=navigator.maxTouchPoints>0&&"ontouchstart"in o,C=h.includes("android"),w=p?"⌘":"CTRL",_=p?"⇧":"+SHIFT",x=o.devicePixelRatio;let $=null;const k={_w:o,_d:l,NO_EVENT:r,ON_OVER_COMPONENT:a,getXMLHttpRequest:function(){return new XMLHttpRequest},getPageStyle:function(t){let e="";const s=(t||l).styleSheets;for(let t,i=0,n=s.length;i<n;i++){try{t=s[i].cssRules}catch{continue}if(t)for(let s=0,i=t.length;s<i;s++)e+=t[s].cssText}return e},getIncludePath:function(t,e){let s="";const i=[],n="js"===e?"script":"link",o="js"===e?"src":"href";let r="(?:";for(let e=0,s=t.length;e<s;e++)r+=t[e]+(e<s-1?"|":")");const a=new RegExp(`(^|.*[\\/])${r}(\\.[^\\/]+)?.${e}(?:\\?.*|;.*)?$`,"i"),h=new RegExp(`.+\\.${e}(?:\\?.*|;.*)?$`,"i");for(let t=l.getElementsByTagName(n),e=0;e<t.length;e++)h.test(t[e][o])&&i.push(t[e]);for(let t=0;t<i.length;t++){const e=i[t][o].match(a);if(e){s=e[0];break}}if(!s)throw new Error("[SUNEDITOR.helper.env.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (path: +"+s+", extension: "+e+")");return""===s&&(s=i.length>0?i[0][o]:""),s.includes(":/")||"//"===s.slice(0,2)||(s=!1===s.includes("/")?location.href.match(/^.*?:\/\/[^/]*/)[0]+s:location.href.match(/^[^?]*\/(?:)/)[0]+s),s},isResizeObserverSupported:c,isClipboardSupported:d,isEdge:u,isBlink:g,isGecko:m,isChromium:f,isSafari:v,isOSX_IOS:p,isAndroid:C,isMobile:b,isTouchDevice:y,canUseBeforeInput:function(){if(null!==$)return $;if(!l.body||"function"!=typeof l.execCommand)return!0;let t=!1;try{const e=l.createElement("div");e.setAttribute("contenteditable","true"),e.setAttribute("aria-hidden","true"),e.style.cssText="position: fixed; top: 0; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none;";const s=l.activeElement;l.body.appendChild(e);const i=()=>{t=!0};e.addEventListener("beforeinput",i,!0),e.addEventListener("input",i,!0),e.focus({preventScroll:!0}),l.execCommand("insertText",!1,"​"),e.removeEventListener("beforeinput",i,!0),e.removeEventListener("input",i,!0),e.remove(),s&&s!==l.body&&"function"==typeof s.focus&&s.focus({preventScroll:!0})}catch{t=!0}return $=t},cmdIcon:w,shiftIcon:_,DPI:x,KATEX_WEBSITE:"https://katex.org/docs/supported.html",MATHJAX_WEBSITE:"https://www.mathjax.org/"},S=8203,E=String.fromCharCode(S),T=new RegExp(String.fromCharCode(S),"g"),M=new RegExp("^"+String.fromCharCode(S)+"+$");const H={zeroWidthSpace:E,zeroWidthRegExp:T,onlyZeroWidthRegExp:M,escapeStringRegexp:function(t){if("string"!=typeof t)throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}};function L(t,e=0){if(!t)return 0;const s=(t+"").match(/-?\d+(\.\d+)?/);if(!s||!s[0])return 0;const i=Number(s[0]);return e<0?i:0===e?Math.round(i):Number(i.toFixed(e))}const N={is:function(t){return/^-?\d+(\.\d+)?$/.test(t+"")},get:L,getOverlapRangeAtIndex:function(t,e,s,i){if(t<=i?e<s:e>s)return 0;const n=(t>s?t:s)-(e<i?e:i);return(n<0?-1*n:n)+1},isEven:function(t){return!(1&t)},isOdd:function(t){return!(1&~t)}},A=/&|\u00A0|'|"|<|>/g,B=/&amp;|&nbsp;|&apos;|&quot;|&lt;|&gt;/g,I={"&":"&amp;"," ":"&nbsp;","'":"&apos;",'"':"&quot;","<":"&lt;",">":"&gt;"},V={"&amp;":"&","&nbsp;":" ","&apos;":"'","&quot;":'"',"&lt;":"<","&gt;":">"},O=/[A-Z]/g,R=/-[a-zA-Z]/g,P={"xx-small":.5625,"x-small":.625,small:.8333,medium:1,large:1.125,"x-large":1.5,"xx-large":2,"xxx-large":2.5};function z(t){if(3===t.nodeType){const e=t.nodeValue.trim();return e?{type:"text",content:e}:null}if(1===t.nodeType){const e={type:"element",tag:t.tagName.toLowerCase(),attributes:{},children:[]};for(const s of t.attributes)e.attributes[s.name]=s.value;for(const s of t.childNodes){const t=z(s);t&&e.children.push(t)}return e}return null}function D(t){return t.replace(A,(t=>I[t]||t))}function F(t){return/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(t)}const q={htmlToJson:function(t){return z((new DOMParser).parseFromString(t,"text/html").body)},jsonToHtml:function t(e){if(!e)return"";if("text"===e.type)return D(e.content||"");if("element"===e.type){const{tag:s,attributes:i={},children:n=[]}=e,o=Object.entries(i).map((([t,e])=>`${t}="${D(e)}"`)).join(" "),l=`</${s}>`;return`${o?`<${s} ${o}>`:`<${s}>`}${n.map(t).join("")}${l}`}return""},htmlToEntity:D,entityToHTML:function(t){return t.replace(B,(t=>V[t]||t))},debounce:function(t,e){let s;function i(...i){o.clearTimeout(s),s=o.setTimeout((()=>{s=null,t(...i)}),e)}return i.cancel=()=>{o.clearTimeout(s),s=null},i},syncMaps:function(t,e){e.forEach(((e,s)=>{t.set(s,e)})),t.forEach(((s,i)=>{e.has(i)||t.delete(i)}))},mergeMaps:function(...t){const e=t.filter((t=>t instanceof Map)).flatMap((t=>[...t]));return new Map(e)},getValues:function(t){return t?Object.keys(t).map((function(e){return t[e]})):[]},camelToKebabCase:function t(e){return"string"==typeof e?e.replace(O,(t=>"-"+t.toLowerCase())):e.map((function(e){return t(e)}))},kebabToCamelCase:function t(e){return"string"==typeof e?e.replace(R,(t=>t.replace("-","").toUpperCase())):e.map((function(e){return t(e)}))},toFontUnit:function(t,e){const s=e.match(/(\d+(?:\.\d+)?)(.+)/),i=s?Number(s[1]):P[e],n=s?s[2]:"rem";let o=i;switch(/em/.test(n)?o=Math.round(i/.0625):"pt"===n?o=Math.round(1.333*i):"%"===n&&(o=i/100),t){case"em":case"rem":return(.0625*o).toFixed(2)+t;case"%":return 100*Number((.0625*o).toFixed(2))+t;case"pt":return Math.round(o/1.333)+t;default:return o+t}},nodeListToArray:function(t){return t?Array.prototype.slice.call(t):[]},swapKeyValue:function(t){const e={},s=Object.prototype.hasOwnProperty;for(const i in t)s.call(t,i)&&(e[t[i]]=i);return e},createElementWhitelist:function(t){return new RegExp(`<\\/?\\b(?!\\b${(t||"").replace(/\|/g,"\\b|\\b")}\\b)[^>]*>`,"gi")},createElementBlacklist:function(t){return new RegExp(`<\\/?\\b(?:\\b${(t||"^").replace(/\|/g,"\\b|\\b")}\\b)[^>]*>`,"gi")},isHexColor:F,rgb2hex:function(t){if(F(t)||!t)return t;const e=t.match(/^rgba?[\s+]?\(([\d]+)[\s+]?,[\s+]?([\d]+)[\s+]?,[\s+]?([\d]+)[\s+]?/i);if(e&&e.length>=4){const s=("0"+parseInt(e[1],10).toString(16)).slice(-2),i=("0"+parseInt(e[2],10).toString(16)).slice(-2),n=("0"+parseInt(e[3],10).toString(16)).slice(-2);let o="";if(t.includes("rgba")){const e=t.match(/,\s*([\d]+\.?[\d]*)\s*\)/);e&&(o=("0"+Math.round(255*parseFloat(e[1])).toString(16)).slice(-2))}return`#${s}${i}${n}${o}`}return t},getWidthInPercentage:function(t,e){const s=e||t.parentElement,i=o.getComputedStyle(s),n=L(i.paddingLeft,-1),l=L(i.paddingRight,-1),r=s.offsetWidth-s.clientWidth,a=s.offsetWidth-n-l-r;return t.offsetWidth/a*100},textToAnchor:function(t){const e=/https?:\/\/[^\s]+/g;if(3===t.nodeType&&e.test(t.textContent)&&!/^A$/i.test(t.parentNode?.nodeName)){const s=t.textContent,i=l.createDocumentFragment();let n=0;return s.replace(e,((t,e)=>{e>n&&i.appendChild(l.createTextNode(s.slice(n,e)));const o=l.createElement("a");return o.href=t,o.target="_blank",o.textContent=t,i.appendChild(o),n=e+t.length,t})),n<s.length&&i.appendChild(l.createTextNode(s.slice(n))),t.parentNode.replaceChild(i,t),!0}return!1},spanToStyleNode:function(t,e){if(1===e.nodeType&&/^SPAN$/i.test(e.nodeName)&&e.hasAttribute("style")){const s=e.getAttribute("style"),i=[];if(Object.keys(t).forEach((e=>{if(t[e].regex.test(s)){const s=l.createElement(t[e].tag);i.push(s)}})),i.length>0){const t=l.createElement("span");let s=e.firstChild;i.forEach(((e,s)=>{0===s?t.appendChild(e):i[s-1].appendChild(e)}));const n=i[i.length-1];for(;s;){const t=s.nextSibling;n.appendChild(s),s=t}e.appendChild(t)}}},addUrlQuery:function(t,e){if(e.length>0)if(/\?/.test(t)){const s=t.split("?");t=s[0]+"?"+e+"&"+s[1]}else t+="?"+e;return t},_setDefaultOptionStyle:function(t,e){let s="";t.get("height")&&(s+="height:"+t.get("height")+";"),t.get("minHeight")&&(s+="min-height:"+t.get("minHeight")+";"),t.get("maxHeight")&&(s+="max-height:"+t.get("maxHeight")+";"),t.get("width")&&(s+="width:"+t.get("width")+";"),t.get("minWidth")&&(s+="min-width:"+t.get("minWidth")+";"),t.get("maxWidth")&&(s+="max-width:"+t.get("maxWidth")+";");let i="",n="",o="";const l=(e=s+e).split(";");for(let e,s=0,r=l.length;s<r;s++)e=l[s].trim(),e&&(/^(min-|max-)?width\s*:/.test(e)||/^(z-index|position|display)\s*:/.test(e)?i+=e+";":/^(min-|max-)?height\s*:/.test(e)?(/^height/.test(e)&&"auto"===e.split(":")[1].trim()&&t.set("height","auto"),n+=e+";"):o+=e+";");return{top:i,frame:n,editor:o}},_setIframeStyleLinks:function(t){let e="";if(t){const s=l.getElementsByTagName("link");for(let i,n=0,o=t.length;n<o;n++){i=[];const o=t[n];if("*"===o)for(let t=0,e=s.length;t<e;t++)"stylesheet"===s[t].rel&&s[t].href&&i.push(s[t].href);else if(/(^https?:\/\/)|(^data:text\/css,)/.test(o))i.push(o);else{const t=new RegExp(`(^|.*[\\/])${o}(\\..+)?.css((\\??.+?)|\\b)$`,"i");for(let e,n=0,o=s.length;n<o;n++)e=s[n].href.match(t),e&&i.push(e[0])}if(!i||0===i.length)throw new Error('[SUNEDITOR.constructor.iframe.fail] The suneditor CSS files installation path could not be automatically detected. Please set the option property "iframe_cssFileName" before creating editor instances.');for(let t=0,s=i.length;t<s;t++)e+='<link href="'+i[t]+'" rel="stylesheet">'}}return e},_setAutoHeightStyle:function(t){return"auto"===t?"<style>\n/** Iframe height auto */\nbody{height: min-content; overflow: hidden;}\n</style>":""}},W=q,U=/(\s|^)(katex|MathJax|se-exclude-format)(\s|$)/;function Z(t){if(null==t)return!1;if("string"!=typeof t){if(G(t)){const e=t.children;for(let t=0,s=e.length;t<s;t++){if(!J(e[t]))return!1}}t=t.textContent}return""===t||M.test(t)}function G(t){return 1===t?.nodeType}function j(t){return/^(OL|UL)$/i.test("string"==typeof t?t:t?.nodeName)}function K(t){return/^TABLE$/i.test("string"==typeof t?t:t?.nodeName)}function Y(t){return/^(TD|TH)$/i.test("string"==typeof t?t:t?.nodeName)}function X(t){return/^BR$/i.test("string"==typeof t?t:t?.nodeName)}function J(t){return/^(BR|COLGROUP|COL|THEAD|TBODY|TFOOT|TR|AREA|BASE|EMBED|HR|IMG|INPUT|KEYGEN|LINK|META|PARAM|SOURCE|TRACK|WBR)$/i.test("string"==typeof t?t:t?.nodeName)}function Q(t){if(1!==t?.nodeType)return!1;const e=t.classList;return!!e&&(e.contains("se-component")||e.contains("se-flex-component"))}function tt(t){if(1!==t?.nodeType)return!1;const e=t.classList;return!!e&&("BODY"===t.nodeName.toUpperCase()||e.contains("se-wrapper-wysiwyg")||e.contains("sun-editor-carrier-wrapper")||e.contains("se-wrapper"))}function et(t){return t?.hasAttribute("data-important-disabled")}const st={isZeroWidth:Z,isEdgePoint:function(t,e,s){return"end"!==s&&0===e||(!s||"front"!==s)&&!t.nodeValue&&e<=1||(!s||"end"===s)&&t.nodeValue&&e>=t.nodeValue.length},isText:function(t){return 3===t?.nodeType},isElement:G,isInputElement:function(t){return G(t)&&/^(INPUT|TEXTAREA|SELECT|OPTION)$/i.test(t.nodeName)},isButtonElement:function(t){return G(t)&&/^(BUTTON)$/i.test(t.nodeName)},isList:j,isListCell:function(t){return/^LI$/i.test("string"==typeof t?t:t?.nodeName)},isTable:K,isTableElements:function(t){return/^(TABLE|THEAD|TBODY|TR|TH|TD|COL)$/i.test("string"==typeof t?t:t?.nodeName)},isTableCell:Y,isTableRow:function(t){return/^TR$/i.test("string"==typeof t?t:t?.nodeName)},isBreak:X,isAnchor:function(t){return/^A$/i.test("string"==typeof t?t:t?.nodeName)},isMedia:function(t){return/^(IMG|IFRAME|AUDIO|VIDEO|CANVAS)$/i.test("string"==typeof t?t:t?.nodeName)},isIFrame:function(t){return/^IFRAME$/i.test("string"==typeof t?t:t?.nodeName)},isFigure:function(t){return/^FIGURE$/i.test("string"==typeof t?t:t?.nodeName)},isContentLess:J,isEmptyLine:function(t){if(!t?.parentNode)return!0;const e=t;return!e.querySelector("IMG, IFRAME, AUDIO, VIDEO, CANVAS, TABLE")&&(e.children.length<=1||X(e.firstElementChild))&&Z(e.textContent)},isComponentContainer:Q,isWysiwygFrame:tt,isNonEditable:function(t){return 1===t?.nodeType&&"false"===t.getAttribute("contenteditable")},isSpanWithoutAttr:function(t){if(1!==t?.nodeType)return!1;const e=t;return/^SPAN$/i.test(e.nodeName)&&!e.className&&0===e.style.length},isSameAttributes:function(t,e){if(3===t.nodeType&&3===e.nodeType)return!0;if(3===t.nodeType||3===e.nodeType)return!1;const s=t,i=e,n=s.style,o=i.style;let l=0;for(let t=0,e=n.length;t<e;t++)n[n[t]]===o[n[t]]&&l++;const r=s.classList,a=i.classList;let h=0;for(let t=0,e=r.length;t<e;t++)a.contains(r[t])&&h++;return l===o.length&&l===n.length&&h===a.length&&h===r.length},isExcludeFormat:function(t){return U.test(t?.className)},isUneditable:function(t){return t?.classList.contains("__se__uneditable")},isImportantDisabled:et},it=st;function nt(t){const e=Object.prototype.toString.call(t);return"[object HTMLCollection]"===e||"[object NodeList]"===e||"[object Array]"===e}function ot(t,e,s){const i=l.createElement(t);if(e)for(const t in e)void 0!==e[t]&&null!==e[t]&&i.setAttribute(t,e[t]);return s&&("string"==typeof s?i.innerHTML=s:"object"==typeof s&&i.appendChild(s)),i}function lt(t){return l.createTextNode(t||"")}function rt(t,e){let s=-1;for(let i=0,n=t.length;i<n;i++)if(t[i]===e){s=i;break}return s}const at=/(\s|^)(se-block-hover|se-block-dragging)(?=\s|$)/g;function ht(t,e,s){const i=t,n=e;if(n.style.length>0){const t=n.style;for(let e=0,s=t.length;e<s;e++)i.style[t[e]]=t[t[e]]}const o=n.attributes;for(let t,e=0,n=o.length;e<n;e++)if(t=o[e].name.toLowerCase(),s?.includes(t)||!o[e].value)i.removeAttribute(t);else if("style"!==t)if("class"===t){const t=o[e].value.replace(at," ").replace(/\s+/g," ").trim();t?i.setAttribute("class",t):i.removeAttribute("class")}else i.setAttribute(o[e].name,o[e].value)}function ct(t,e){if(t&&1===t.nodeType)return e.split("|").some((e=>t.classList.contains(e)))}function dt(t,e){if(!t)return;const s=nt(t)?t:[t],i=e.split("|");for(let t=0,e=s.length;t<e;t++){const e=s[t];if(e&&1===e.nodeType)for(const t of i)t&&e.classList.add(t)}}function ut(t,e){if(!t)return;const s=nt(t)?t:[t],i=e.split("|");for(let t=0,e=s.length;t<e;t++){const e=s[t];if(e&&1===e.nodeType)for(const t of i)t&&e.classList.remove(t)}}function pt(t=l){return{w:t.documentElement.clientWidth,h:t.documentElement.clientHeight}}const gt={clone:function(t,e=!1){return t.cloneNode(e)},createElement:ot,createTextNode:lt,getAttributesToString:function(t,e){const s=t.attributes;if(!s)return"";let i="";for(let t=0,n=s.length;t<n;t++)e?.includes(s[t].name)||(i+=s[t].name+'="'+D(s[t].value)+'" ');return i},arrayFilter:function(t,e){if(!t||0===t.length)return null;e||=()=>!0;const s=[];for(let i,n=0,o=t.length;n<o;n++)i=t[n],e(i)&&s.push(i);return s},arrayFind:function(t,e){if(!t||0===t.length)return null;e||=()=>!0;for(let s,i=0,n=t.length;i<n;i++)if(s=t[i],e(s))return s;return null},arrayIncludes:function(t,e){for(let s=0;s<t.length;s++)if(t[s]===e)return!0;return!1},getArrayIndex:rt,nextIndex:function(t,e){const s=rt(t,e);return-1===s?-1:s+1},prevIndex:function(t,e){const s=rt(t,e);return-1===s?-1:s-1},copyTagAttributes:ht,copyFormatAttributes:function(t,e){const s=e.cloneNode(!1);s.className=s.className.replace(/(\s|^)__se__format__[^\s]+/g,""),ht(t,s)},removeItem:function(t){t&&("remove"in t&&"function"==typeof t.remove?t.remove():t.parentNode&&t.parentNode.removeChild(t))},changeElement:function(t,e){if(t)if("string"==typeof e)if("outerHTML"in t)t.outerHTML=e;else{const s=ot("DIV");s.innerHTML=e,t.parentNode.replaceChild(s.firstChild,t)}else 1===e?.nodeType&&t.parentNode.replaceChild(e,t)},changeTxt:function(t,e){t&&e&&(t.textContent=e)},setStyle:function(t,e,s){for(let i,n=0,o=(t=Array.isArray(t)?t:[t]).length;n<o;n++)i=t[n],i.style[e]=s,0===i.style.length&&i.removeAttribute("style")},getStyle:function(t,e){if(1===t?.nodeType)return t.style[e]},setDisabled:function(t,e,s){for(let i=0,n=t.length;i<n;i++){const n=t[i];!s&&et(n)||(n.disabled=e),s&&(e?n.setAttribute("data-important-disabled",""):n.removeAttribute("data-important-disabled"))}},hasClass:ct,addClass:dt,removeClass:ut,toggleClass:function(t,e,s){if(!t||1!==t.nodeType)return;const i=t;i.classList.toggle(e,s),i.className.trim()||i.removeAttribute("class")},flashClass:function(t,e,s=120){dt(t,e),o.setTimeout((()=>{ut(t,e)}),s)},getClientSize:pt,getViewportSize:function(){return"visualViewport"in o?{top:o.visualViewport.pageTop,left:o.visualViewport.pageLeft,scale:o.visualViewport.scale}:{top:0,left:0,scale:1}},applyInlineStylesAll:function(t,e,s){if(!t)return console.warn('"parentTarget" is not exist'),null;let i=t;const n=l.createElement("DIV");if(n.style.display="none",/body/i.test(i.nodeName)){const t=l.createElement("DIV"),e=i.attributes;for(let s=0,i=e.length;s<i;s++)t.setAttribute(e[s].name,e[s].value);t.innerHTML=i.innerHTML,i=t}else i=i.cloneNode(!0);n.appendChild(i),l.body.appendChild(n);const r=Array.from(i.querySelectorAll("*")),a=e?[i].concat(r):r;for(let t,e=0;t=a[e];e++){if(1!==t.nodeType)continue;const e=o.getComputedStyle(t),i=t.style;for(const t of s)i.setProperty(t,e.getPropertyValue(t)||"")}return l.body.removeChild(n),i},waitForMediaLoad:function(t,e=5e3){const s=t||l;return new Promise((t=>{const i=["img","video","audio","iframe"].flatMap((t=>Array.from(s.querySelectorAll(t))));if(0===i.length)return void t();const n=i.map((t=>{if(function(t){return"[object HTMLImageElement]"===Object.prototype.toString.call(t)}(t)){if(t.complete)return Promise.resolve()}else if(function(t){const e=Object.prototype.toString.call(t);return"[object HTMLVideoElement]"===e||"[object HTMLAudioElement]"===e}(t)){if(t.readyState>=2)return Promise.resolve()}else if(function(t){return"[object HTMLIFrameElement]"===Object.prototype.toString.call(t)}(t))try{if("complete"===t.contentDocument?.readyState)return Promise.resolve()}catch(t){console.warn(["[SUNEDITOR] Iframe load error",t])}return new Promise((e=>{t.addEventListener("load",e,{once:!0}),t.addEventListener("error",e,{once:!0})}))}));Promise.race([Promise.all(n),new Promise((t=>o.setTimeout(t,e)))]).then((()=>{t()}))}))},getRootCssVar:function(t){return l.documentElement.style.getPropertyValue(t)},setRootCssVar:function(t,e){l.documentElement.style.setProperty(t,e)},createTooltipInner:function(t){return`<span class="se-tooltip-inner"><span class="se-tooltip-text">${t}</span></span>`}};function mt(t){let e=0;for(;t=t.previousSibling;)e+=1;return e}function ft(t,e,s){const i=[];let n=!0;return Ct(t,(t=>{if(t===e&&(n=!1),n&&!it.isWysiwygFrame(t)){if(s&&3===t.nodeType){let e=null,i=null;s.s=s.e=0;let n=t.previousSibling;for(;3===n?.nodeType;)i=n.textContent.replace(T,""),s.s+=i.length,t.textContent=i+t.textContent,e=n,n=n.previousSibling,gt.removeItem(e);let o=t.nextSibling;for(;3===o?.nodeType;)i=o.textContent.replace(T,""),s.e+=i.length,t.textContent+=i,e=o,o=o.nextSibling,gt.removeItem(e)}i.push(t)}return!1})),i.map(mt).reverse()}function vt(t,e){let s,i=e;for(let e=0,n=t.length;e<n&&(s=i.childNodes,0!==s.length);e++)i=s.length<=t[e]?s[s.length-1]:s[t[e]];return i}function bt(t,e,s){const i=[];return s??=1/0,!t||s<=0||0===t.childNodes.length||(e||=()=>!0,function t(n,o){if(o>s)return;if(o>0&&e(n)&&i.push(n),o===s)return;const l=n.childNodes;for(let e=0,s=l.length;e<s;e++)t(l[e],o+1)}(t,0)),i}function yt(t){if(!t||it.isWysiwygFrame(t))return-1;let e=0;for(t=t.parentNode;t&&!it.isWysiwygFrame(t);)e+=1,t=t.parentNode;return e}function Ct(t,e,s){let i;if("function"==typeof e)i=e;else if("object"==typeof e)i=t=>t===e;else{let t;/^\./.test(e)?(t="className",e="(\\s|^)"+e.split(".")[1]+"(\\s|$)"):/^#/.test(e)?(t="id",e="^"+e.split("#")[1]+"$"):/^:/.test(e)?(t="name",e="^"+e.split(":")[1]+"$"):(t="nodeName",e="^"+e+"$");const s=new RegExp(e,"i");i=e=>s.test(e[t])}s||=1/0;let n=0;for(;t&&!i(t);){if(n>=s||it.isWysiwygFrame(t))return null;t=t.parentElement,n++}return t}const wt={getPositionIndex:mt,getNodePath:ft,getNodeFromPath:vt,getChildNode:function(t,e){let s=null;if(!t)return s;const i=t;return i.children&&0!==i.children.length?(e||=()=>!0,function t(n){if(i!==n&&e(n))return s=n,!0;if(n.children)for(let e=0,s=n.children.length;e<s;e++)t(n.children[e])}(i),s):s},getListChildren:function(t,e,s){const i=[];if(s??=1/0,!t||s<=0)return i;const n=t;return n.children&&0!==n.children.length?(e||=()=>!0,function t(o,l){if(!(l>s)&&(l>0&&n!==o&&e(o)&&i.push(o),l!==s&&o.children))for(let e=0,s=o.children.length;e<s;e++)t(o.children[e],l+1)}(n,0),i):i},getListChildNodes:bt,getNodeDepth:yt,sortNodeByDepth:function(t,e){const s=e?1:-1,i=-1*s;t.sort((function(t,e){if(!it.isListCell(t)||!it.isListCell(e))return 0;const n=yt(t),o=yt(e);return n>o?s:n<o?i:0}))},compareElements:function(t,e){let s=t,i=e;const n=yt(t),o=yt(e);if(n>o){let t=n-o;for(;t>0&&s;)s=s.parentElement,t--}else if(o>n){let t=o-n;for(;t>0&&i;)i=i.parentElement,t--}for(;s&&i&&s.parentElement!==i.parentElement;)s=s.parentElement,i=i.parentElement;if(!s?.parentNode||!i?.parentNode)return{ancestor:null,a:t,b:e,result:0};const l=s.parentNode.childNodes,r=gt.getArrayIndex(l,s),a=gt.getArrayIndex(l,i);return{ancestor:s.parentElement,a:s,b:i,result:r>a?1:r<a?-1:0}},getParentElement:Ct,getParentElements:function(t,e,s){let i;if("function"==typeof e)i=e;else if("object"==typeof e)i=t=>t===e;else{let t;/^\./.test(e)?(t="className",e="(\\s|^)"+e.split(".")[1]+"(\\s|$)"):/^#/.test(e)?(t="id",e="^"+e.split("#")[1]+"$"):/^:/.test(e)?(t="name",e="^"+e.split(":")[1]+"$"):(t="nodeName",e="^"+e+"$");const s=new RegExp(e,"i");i=e=>s.test(e[t])}const n=[];s||=1/0;let o=0;for(;o<=s&&t&&!it.isWysiwygFrame(t);)i(t)&&n.push(t),t=t.parentElement,o++;return n},getCommandTarget:function(t){let e=t;for(;e&&!/^(UL)$/i.test(e.nodeName)&&!gt.hasClass(e,"sun-editor");){if(e.hasAttribute("data-command"))return e;e=e.parentElement}return null},getEventTarget:function(t){return t.target},getEdgeChild:function(t,e,s){let i;if("function"==typeof e)i=e;else if("object"==typeof e)i=function(t){return t===e};else{let t;/^\./.test(e)?(t="className",e="(\\s|^)"+e.split(".")[1]+"(\\s|$)"):/^#/.test(e)?(t="id",e="^"+e.split("#")[1]+"$"):/^:/.test(e)?(t="name",e="^"+e.split(":")[1]+"$"):(t="nodeName",e="^"+("text"===e?"#"+e:e)+"$");const s=new RegExp(e,"i");i=function(e){return s.test(e[t])}}const n=bt(t,(t=>i(t)),null);return n[s?n.length-1:0]},getEdgeChildNodes:function(t,e){if(t){for(e||=t;t&&1===t.nodeType&&t.childNodes.length>0&&!it.isBreak(t);)t=t.firstChild;for(;e&&1===e.nodeType&&e.childNodes.length>0&&!it.isBreak(e);)e=e.lastChild;return{sc:t,ec:e||t}}},getPreviousDeepestNode:function(t,e){let s=t.previousSibling;if(!s){for(let i=t.parentNode;i;i=i.parentNode){if(i===e)return null;if(i.previousSibling){s=i.previousSibling;break}}if(!s)return null}if(it.isNonEditable(s))return s;for(;s.lastChild;)s=s.lastChild;return s},getNextDeepestNode:function(t,e){let s=t.nextSibling;if(!s){for(let i=t.parentNode;i;i=i.parentNode){if(i===e)return null;if(i.nextSibling){s=i.nextSibling;break}}if(!s)return null}if(it.isNonEditable(s))return s;for(;s.firstChild;)s=s.firstChild;return s},findTextIndexOnLine:function(t,e,s,i){if(!t)return 0;i||=()=>!0;let n=0,o=!1;return function t(l){if(!o&&8!==l.nodeType&&!i(l))if(3===l.nodeType){if(l===e)return n+=s,void(o=!0);n+=l.textContent.length}else if(1===l.nodeType){const e=l.childNodes;for(let s=0,i=e.length;s<i;s++)if(t(e[s]),o)return}}(t),n},findTabEndIndex:function(t,e,s){if(!t)return 0;const i=t.textContent,n=new RegExp(`((\\u00A0|\\s){${s},})`,"g");let o;for(n.lastIndex=e;null!==(o=n.exec(i));)if(o.index>=e){const t=o.index+o[0].length-1;return t+(i.slice(0,t+1).match(/[^\u00A0\s]/g)||[]).length+s}return 0},findVisualLastCell:function(t){if(!t||0===t.length)return null;const e={};let s=null,i=-1,n=-1;for(const o of t){const t=o.parentElement.rowIndex,l=o.rowSpan||1,r=o.colSpan||1;e[t]||=[];let a=0;const h=e[t];for(;h[a];)a++;for(let t=0;t<r;t++)h[a+t]=!0;for(let s=1;s<l;s++){const i=t+s;e[i]||=[];for(let t=0;t<r;t++)e[i][a+t]=!0}const c=t+l-1,d=a+r-1;(c>i||c===i&&d>n)&&(i=c,n=d,s=o)}return s},getScrollParents:function(t){const e=[];let s=t?.parentElement;for(;s&&!/^(body|html)$/i.test(s.nodeName);){const t=o.getComputedStyle(s),{overflow:i,overflowX:n,overflowY:l}=t;[i,n,l].some((t=>["auto","scroll","overlay"].includes(t)))&&e.push(s),s=s.parentElement}return e},getIframeDocument:function(t){return t.contentWindow?.document||t.contentDocument}};const _t={query:wt,check:it,utils:gt},xt="ArrowLeft|ArrowUp|ArrowRight|ArrowDown",$t="F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12",kt=xt.split("|"),St="Backspace|Delete".split("|"),Et=`Backspace|Tab|Enter|ShiftLeft|ShiftRight|ControlLeft|ControlRight|AltLeft|AltRight|Pause|CapsLock|Escape|PageUp|PageDown|End|Home|${xt}|Insert|Delete|${$t}|NumLock|ScrollLock`.split("|"),Tt="Backspace|Enter|Delete".split("|"),Mt="Backspace|Enter|Delete".split("|"),Ht=`ControlLeft|ControlRight|AltLeft|AltRight|Pause|CapsLock|Escape|Insert|${$t}|NumLock|ScrollLock`.split("|");const Lt={write:async function(t){if(!d)return console.error("Clipboard is not supported in this browser."),!1;let e="",s="";"string"==typeof t?(e=t,s=t):G(t)?(t.querySelectorAll("iframe").forEach((t=>{const e=document.createElement("div"),s={};for(const e of Array.from(t.attributes))s[e.name]=e.value;e.setAttribute("data-se-iframe-holder","1"),e.setAttribute("data-se-iframe-holder-attrs",JSON.stringify(s)),e.innerText=`[iframe: ${t.src}]`,t.replaceWith(e)})),e=t.outerHTML,s=t.textContent):(e=t.textContent,s=t.textContent);try{await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([e],{type:"text/html"}),"text/plain":new Blob([s],{type:"text/plain"})})])}catch{console.warn("[SUNEDITOR.copy.warn] This browser is not supported Clipboard API");try{await navigator.clipboard.writeText(s||function(t){const e=document.createElement("div");return e.innerHTML=t,e.textContent||e.innerText||""}(e))}catch(t){console.error("[SUNEDITOR.copy.fail] "+t)}}}},Nt=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/i,At=/^[\u200B\uFEFF]+$/;function Bt(t){const e=t.trim();return""===e||At.test(e)}const It={strong:"**",b:"**",em:"*",i:"*",del:"~~",s:"~~",mark:"=="};function Vt(t){if(!t||0===t.length)return"";const e=[];for(let s=0;s<t.length;s++){const i=Ft(t[s],"",!1);if(i){if(e.length>0){const t=e[e.length-1];!t||t.endsWith(" ")||t.endsWith("\n")||i.startsWith(" ")||i.startsWith("\n")||e.push(" ")}e.push(i)}}return e.join("")}function Ot(t){return t?"text"===t.type?t.content||"":t.children?t.children.map(Ot).join(""):"":""}function Rt(t){if(!t)return"";if("text"===t.type)return t.content||"";const{tag:e,attributes:s={},children:i=[]}=t,n=Object.entries(s).map((([t,e])=>`${t}="${e}"`)).join(" "),o=n?`<${e} ${n}>`:`<${e}>`;if(Nt.test(e))return o;return`${o}${i.map(Rt).join("")}</${e}>`}function Pt(t,e){return t?t.split("\n").map((t=>t?e+t:"")).join("\n")+"\n":""}function zt(t,e,s){const i=t.children||[];let n="",o=1;for(const t of i){if("element"!==t.type||"li"!==t.tag)continue;const i=s?`${o}. `:"- ",l=t.children||[];let r="",a="";const h=e+" ".repeat(i.length);let c="";const d=l[0];d&&"element"===d.type&&"input"===d.tag&&"checkbox"===d.attributes?.type&&(c=void 0!==d.attributes.checked?"[x] ":"[ ] ");for(let t=0;t<l.length;t++){const e=l[t];if(0===t&&c)continue;if("element"!==e.type){r+=Ft(e,"",!1);continue}const s=e.tag;if("ul"===s||"ol"===s)a+=zt(e,h,"ol"===s);else if("table"===s)a+=Pt(Dt(e),h);else if("figure"===s){const t=(e.children||[]).find((t=>"element"===t.type&&"table"===t.tag));a+=Pt(t?Dt(t):Ft(e,"",!0),h)}else"blockquote"===s||"pre"===s?a+=Pt(Ft(e,"",!0),h):r+=Ft(e,"",!1)}n+=`${e}${i}${c}${r.trim()}\n`,a&&(n+=a),o++}return n}function Dt(t){const e=[];let s=!1;if(function t(i,n){for(const o of i.children||[])if("thead"===o.tag)t(o,!0);else if("tbody"===o.tag||"tfoot"===o.tag)t(o,!1);else if("tr"===o.tag){const t=[];for(const e of o.children||[])if("td"===e.tag||"th"===e.tag){const s=Vt(e.children).trim(),i=parseInt(e.attributes?.colspan,10)||1,n=parseInt(e.attributes?.rowspan,10)||1;t.push({content:s,colspan:i,rowspan:n})}const i=n||!s&&o.children?.some((t=>"th"===t.tag));i&&(s=!0),e.push({cells:t,isHeader:i})}}(t,!1),0===e.length)return"";const i=e.filter((t=>t.isHeader)),n=e.filter((t=>!t.isHeader)),o=[...i,...n];let l=0;for(const t of o){let e=0;for(const s of t.cells)e+=s.colspan;e>l&&(l=e)}const r=Array.from({length:o.length},(()=>new Array(l).fill(null)));for(let t=0;t<o.length;t++){let e=0;for(const s of o[t].cells){for(;e<l&&null!==r[t][e];)e++;if(e>=l)break;for(let i=0;i<s.rowspan&&t+i<o.length;i++)for(let n=0;n<s.colspan&&e+n<l;n++)r[t+i][e+n]=0===i&&0===n?s.content:"";e+=s.colspan}for(let e=0;e<l;e++)null===r[t][e]&&(r[t][e]="")}let a="";if(i.length>0){a+="| "+r[0].join(" | ")+" |\n",a+="| "+r[0].map((()=>"---")).join(" | ")+" |\n";for(let t=1;t<r.length;t++)a+="| "+r[t].join(" | ")+" |\n"}else{a+="| "+new Array(l).fill(" ").join(" | ")+" |\n",a+="| "+new Array(l).fill("---").join(" | ")+" |\n";for(let t=0;t<r.length;t++)a+="| "+r[t].join(" | ")+" |\n"}return a}function Ft(t,e,s){if(!t)return"";if("text"===t.type)return(t.content||"").replace(/[\u200B\uFEFF]/g,"");if("element"!==t.type)return"";const{tag:i,attributes:n={},children:o=[]}=t;if("body"===i)return o.map((t=>Ft(t,"",!0))).join("");const l=/^h([1-6])$/.exec(i);if(l){const t=Vt(o).trim();if(!t)return"\n";const e=parseInt(l[1],10);return`${"#".repeat(e)} ${t}\n\n`}if("p"===i){const t=Vt(o);return t.trim()?`${t.trim()}\n\n`:"\n"}if("br"===i)return"\n";if("hr"===i)return"---\n\n";const r=It[i];if(r){return`${r}${Vt(o)}${r}`}if("code"===i){const t=Ot({children:o});return t.includes("`")?"`` "+t+" ``":"`"+t+"`"}if("kbd"===i){return`<kbd>${Ot({children:o})}</kbd>`}if("sub"===i){return`<sub>${Vt(o)}</sub>`}if("sup"===i){return`<sup>${Vt(o)}</sup>`}if("a"===i){const t=n.href||"",e=Vt(o),s=n.title;return s?`[${e}](${t} "${s}")`:`[${e}](${t})`}if("img"===i){const t=n.src||"";return`![${n.alt||""}](${t})`}if("blockquote"===i){return o.map((t=>Ft(t,"",!0))).join("").replace(/\n$/,"").split("\n").map((t=>`> ${t}`)).join("\n")+"\n\n"}if("pre"===i){let e="",s="";const i=o.find((t=>"element"===t.type&&"code"===t.tag));return i?(e=(i.attributes?.class||"").replace(/^language-/,""),s=Ot(i)):(e=(t.attributes?.class||"").match(/language-(\S+)/)?.[1]||"",s=Ot({children:o})),"```"+e+"\n"+s+"\n```\n\n"}if("details"===i)return Rt(t)+"\n\n";if("summary"===i)return Rt(t);if("ul"===i)return zt(t,e,!1)+"\n";if("ol"===i)return zt(t,e,!0)+"\n";if("table"===i)return Dt(t)+"\n";if("dl"===i){let t="";for(const e of o)"element"===e.type&&("dt"===e.tag?t+=Vt(e.children).trim()+"\n":"dd"===e.tag&&(t+=": "+Vt(e.children).trim()+"\n"));return t+"\n"}if("dt"===i||"dd"===i)return Vt(o).trim();if("div"===i){if(n.class&&/se-component/.test(n.class))return o.map((t=>Ft(t,e,!0))).join("");const t=Vt(o);return s?t+"\n\n":t}if("span"===i)return n.style||n.class?Rt(t):Vt(o);if("figure"===i){const t=o.map((t=>Ft(t,e,!0))).join("");return/\n$/.test(t)?t:t+"\n\n"}if("figcaption"===i){const t=Vt(o).trim();return t?t+"\n\n":""}return"video"===i||"audio"===i||"iframe"===i?Rt(t)+"\n\n":Rt(t)}function qt(t){if(!t)return"";const e=[];function s(t){return e.push(t),""+(e.length-1)+""}return t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace(/\\([\\*_~`[\]()#!|{}<>+-])/g,((t,e)=>s(e)))).replace(/``\s(.+?)\s``/g,((t,e)=>s("<code>"+e+"</code>")))).replace(/`([^`]+)`/g,((t,e)=>s("<code>"+e+"</code>")))).replace(/!\[([^\]]*)\]\(([^)\s]+)(?:\s+"([^"]*)")?\)/g,((t,e,i,n)=>s(n?`<img src="${i}" alt="${e}" title="${n}">`:`<img src="${i}" alt="${e}">`)))).replace(/\[([^\]]+)\]\(([^)\s]+)(?:\s+"([^"]*)")?\)/g,((t,e,i,n)=>s(n?`<a href="${i}" title="${n}">${e}</a>`:`<a href="${i}">${e}</a>`)))).replace(/<(https?:\/\/[^>]+)>/g,((t,e)=>s(`<a href="${e}">${e}</a>`)))).replace(/<([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})>/g,((t,e)=>s(`<a href="mailto:${e}">${e}</a>`)))).replace(/(?<![="'\w/])(https?:\/\/[^\s<>\])"]+)/g,((t,e)=>s(`<a href="${e}">${e}</a>`)))).replace(/~~(.+?)~~/g,"<del>$1</del>")).replace(/\*{3}(.+?)\*{3}/g,"<strong><em>$1</em></strong>")).replace(/_{3}(.+?)_{3}/g,"<strong><em>$1</em></strong>")).replace(/\*{2}(.+?)\*{2}/g,"<strong>$1</strong>")).replace(/_{2}(.+?)_{2}/g,"<strong>$1</strong>")).replace(/\*(.+?)\*/g,"<em>$1</em>")).replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>")).replace(/==(.+?)==/g,"<mark>$1</mark>")).replace(/\^([^\s^]+)\^/g,"<sup>$1</sup>")).replace(/(?<!~)~([^\s~]+)~(?!~)/g,"<sub>$1</sub>")).replace(/\uFFFC(\d+)\uFFFC/g,((t,s)=>e[parseInt(s,10)]))}function Wt(t){if(t.length<2)return"";const e=t=>t.replace(/^\|/,"").replace(/\|$/,"").split("|").map((t=>t.trim())),s=e(t[0]),i=e(t[1]).map((t=>{const e=t.trim();return/^:-+:$/.test(e)?"center":/^-+:$/.test(e)?"right":/^:-+$/.test(e)?"left":""})),n=t.slice(2).map(e),o=s.length,l=s.every((t=>""===t));let r="<table>";const a=t=>{const e=i[t];return e?` style="text-align: ${e};"`:""};if(!l){r+="<thead><tr>";for(let t=0;t<o;t++)r+=`<th${a(t)}>${qt(s[t])}</th>`;r+="</tr></thead>"}if(n.length>0||l){r+="<tbody>";for(const t of n){r+="<tr>";for(let e=0;e<o;e++)r+=`<td${a(e)}>${qt(t[e]||"")}</td>`;r+="</tr>"}r+="</tbody>"}return r+="</table>",r}function Ut(t,e,s){const i=s?"ol":"ul",n=s?/^(\s*)\d+\.\s+(.*)/:/^(\s*)([-*+])\s+(.*)/;let o=`<${i}>`,l=e;const r=(t[l].match(/^(\s*)/)[1]||"").length;for(;l<t.length;){const e=t[l];if(Bt(e)){l++;continue}const i=(e.match(/^(\s*)/)[1]||"").length;if(i<r)break;if(i!==r)break;{if(!n.exec(e))break;const i=s?e.replace(/^\s*\d+\.\s+/,""):e.replace(/^\s*[-*+]\s+/,"");l++;let a=!1,h=!1,c=i;const d=/^\[([ xX])\]\s*(.*)/.exec(i);d&&(a=!0,h=" "!==d[1],c=d[2]);let u="";for(;l<t.length;){const e=t[l];if(Bt(e)){l++;continue}if((e.match(/^(\s*)/)[1]||"").length<=r)break;if(/^\s*[-*+]\s+/.test(e)||/^\s*\d+\.\s+/.test(e)){const s=Ut(t,l,/^\s*\d+\.\s+/.test(e));u+=s.html,l=s.index;continue}const s=e.trimStart();if(!(/^\|.*\|/.test(s)&&l+1<t.length&&/^\s*\|[\s:]*-{3,}/.test(t[l+1])))break;{const e=[];for(;l<t.length;){const s=t[l];if(Bt(s)||(s.match(/^(\s*)/)[1]||"").length<=r)break;if(!/^\s*\|/.test(s))break;e.push(s.trimStart()),l++}u+=Wt(e)}}if(a){o+=`<li class="task-list-item">${h?'<input type="checkbox" checked disabled> ':'<input type="checkbox" disabled> '}${qt(c)}${u}</li>`}else o+=`<li>${qt(i)}${u}</li>`}}return o+=`</${i}>`,{html:o,index:l}}const Zt={jsonToMarkdown:function(t){return t?Ft(t,"",!0).replace(/\n{3,}/g,"\n\n").trim()+"\n":""},markdownToHtml:function t(e,s){if(!e)return"";s||(s="p");const i=e.split("\n"),n=[];let o=0;for(;o<i.length;){const e=i[o];if(Bt(e)){o++;continue}const r=/^(`{3,}|~{3,})(\w*)/.exec(e);if(r){const t=r[1].charAt(0),e=r[1].length,s=r[2],a=[];o++;const h=new RegExp("^"+("`"===t?"`":"~")+"{"+e+",}\\s*$");for(;o<i.length&&!h.test(i[o]);)a.push(i[o]),o++;o++;const c=s?` class="language-${s}"`:"";n.push(`<pre><code${c}>${l=a.join("\n"),l.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}</code></pre>`);continue}const a=/^(#{1,6})\s+(.+)/.exec(e);if(a){const t=a[1].length;n.push(`<h${t}>${qt(a[2].trim())}</h${t}>`),o++;continue}if(/^(\*{3,}|-{3,}|_{3,})\s*$/.test(e)){n.push("<hr>"),o++;continue}if(/^>\s?/.test(e)){const e=[];for(;o<i.length&&/^>\s?/.test(i[o]);)e.push(i[o].replace(/^>\s?/,"")),o++;const l=t(e.join("\n"),s);n.push(`<blockquote>${l}</blockquote>`);continue}if(/^\|.*\|/.test(e)&&o+1<i.length&&/^\|[\s:]*-{3,}[\s:]*/.test(i[o+1])){const t=[];for(;o<i.length&&/^\|.*\|/.test(i[o]);)t.push(i[o]),o++;n.push(Wt(t));continue}if(/^(\s*)([-*+])\s+/.test(e)){const t=Ut(i,o,!1);n.push(t.html),o=t.index;continue}if(/^(\s*)\d+\.\s+/.test(e)){const t=Ut(i,o,!0);n.push(t.html),o=t.index;continue}if(/^\s*<[a-zA-Z]/.test(e)){let t=e;if(o++,Nt.test(e.match(/<(\w+)/)?.[1]||"")){n.push(t);continue}for(;o<i.length&&!Bt(i[o]);)t+="\n"+i[o],o++;n.push(t);continue}const h=[];for(;o<i.length&&!Bt(i[o])&&!/^(#{1,6}\s|`{3,}|~{3,}|>|\||(\s*)([-*+]|\d+\.)\s|(\*{3,}|-{3,}|_{3,})\s*$)/.test(i[o]);)h.push(i[o]),o++;if(h.length>0){const t=qt(h.join("\n"));n.push(`<${s}>${t}</${s}>`)}else n.push(`<${s}>${qt(i[o])}</${s}>`),o++}var l;return n.join("")}},Gt=/<!--\[if[^>]*>[\s\S]*?<!\[endif\]-->/gi,jt=/<\/?(?:\w+:)\w+[^>]*>/gi,Kt=/<xml>[\s\S]*?<\/xml>/gi,Yt=/<style[^>]*>[\s\S]*?<\/style>/gi,Xt=/\s*mso-[^:]+:[^;"]+;?/gi,Jt=/l(\d+)\s+level(\d+)\s+lfo(\d+)/i,Qt=/mso-list:\s*Ignore/i,te=/\bMso\w+/g,ee=/\bxl\d+/g,se=/\s*tab-stops:[^;"]+;?/gi,ie=/^[\s\u00a0]*[\u2022\u00b7\u00a7\u25cf\u25cb\u25aa\u25a0·o§]\s*/,ne=[/^\s*[0-9]+[.)]\s/,/^\s*[a-z][.)]\s/i,/^\s*[ivxlmcd]+[.)]\s/i],oe=/<span\s+style\s*=\s*["']?\s*mso-spacerun:\s*yes\s*;?\s*["']?\s*>([\s\u00a0]*)<\/span>/gi,le=/<span\s+style\s*=\s*["'][^"']*mso-tab-count:\s*\d+[^"']*["']\s*>[^<]*<\/span>/gi,re=/mso-outline-level:\s*(\d+)/i,ae=/mso-highlight:\s*([^;"]+)/i,he=/mso-level-number-format:\s*([^;\s]+)/i,ce=/mso-level-start-at:\s*(\d+)/i,de=/mso-level-text:\s*([^;\s]+)/i,ue={decimal:"decimal","alpha-upper":"upper-alpha","alpha-lower":"lower-alpha","roman-upper":"upper-roman","roman-lower":"lower-roman","arabic-leading-zero":"decimal-leading-zero"},pe=/\s*margin:\s*0[a-z]*\s+0[a-z]*\s+0[a-z]*\s*;?/gi,ge=/\s*text-indent:\s*-?[\d.]+[a-z]*\s*;?/gi,me=/\s*line-height:\s*normal\s*;?/gi,fe=/MsoHeading(\d)/i,ve=/^file:\/\/\//i,be=/^_(Toc|Ref|Hlt|Hlk)\d+$/i,ye=/^#_(Toc|Ref|Hlt|Hlk)\d+$/i,Ce=/page-break-before\s*:\s*always/i,we=/mso-break-type\s*:\s*section-break/i,_e=/mso-column-break-before\s*:\s*always/i,xe=/^(?:Word)?Section\d+$/i;function $e(t){const e=t.replace(/[\s\u00a0]+/g," ").trim();if(ie.test(e))return"ul";for(const t of ne)if(t.test(e))return"ol";return"ul"}function ke(t){const e=document.createTreeWalker(t,NodeFilter.SHOW_COMMENT,null),s=[];for(;e.nextNode();)s.push(e.currentNode);for(const t of s)t?.remove();const i=t.querySelectorAll("span");for(const t of i){const e=t.getAttribute("style")||"";Qt.test(e)&&t.remove()}t.firstChild&&3===t.firstChild.nodeType&&(t.firstChild.nodeValue=t.firstChild.nodeValue.replace(/^[\s\u00a0]+/,""))}function Se(t){const e=t.getAttribute("style");if(!e)return;let s=e;const i=ae.exec(s);!i||/background-color/i.test(s)||/background\s*:/i.test(s)||(s+=";background-color:"+i[1].trim()),s=s.replace(Xt,"").replace(se,"").replace(pe,"").replace(ge,"").replace(me,"").trim(),s=s.replace(/^;+|;+$/g,"").replace(/;{2,}/g,";").trim(),s?t.setAttribute("style",s):t.removeAttribute("style")}function Ee(t){const e=t.getAttribute("class");if(!e)return;const s=e.replace(te,"").replace(ee,"").trim();s?t.setAttribute("class",s):t.removeAttribute("class")}function Te(t){let e=t.previousSibling;for(;e;){if(1===e.nodeType)return e;if(3===e.nodeType&&e.nodeValue.trim())return null;e=e.previousSibling}return null}function Me(t,e){for(const s of t){const t=`l${s.listId}:level${s.level}`,i=e.get(t);if(i)s.type=i.type,s.listStyleType=i.listStyleType,s.startAt=i.startAt;else{const t=Le(s.el);s.type=$e(t),s.listStyleType="",s.startAt=1}}const s=t[0].el.parentNode,i=t[t.length-1].el.nextSibling,n=[];let o=null;for(const e of t){const{el:t,level:s,type:i,listStyleType:l,startAt:r}=e;ke(t),Se(t),Ee(t);const a=t.ownerDocument.createElement("li");for(;t.firstChild;)a.appendChild(t.firstChild);if(t.getAttribute("style")&&a.setAttribute("style",t.getAttribute("style")),0===n.length)o=He(t.ownerDocument,i,l,r),o.appendChild(a),n.push({listEl:o,level:s});else{const e=n[n.length-1].level;if(s>e){const e=n[n.length-1].listEl.lastElementChild,o=He(t.ownerDocument,i,l,r);o.appendChild(a),e?e.appendChild(o):n[n.length-1].listEl.appendChild(o),n.push({listEl:o,level:s})}else if(s<e){for(;n.length>1&&n[n.length-1].level>s;)n.pop();n[n.length-1].listEl.appendChild(a)}else n[n.length-1].listEl.appendChild(a)}t.remove()}o&&s.insertBefore(o,i)}function He(t,e,s,i){const n=t.createElement(e);return s&&(n.style.listStyleType=s),"ol"===e&&i>1&&n.setAttribute("start",String(i)),n}function Le(t){const e=t.querySelectorAll("span");for(const t of e){const e=t.getAttribute("style")||"";if(Qt.test(e))return t.textContent||""}return t.textContent?.substring(0,10)||""}const Ne={cleanHTML:function(t){if(!t)return"";const e=function(t){const e=new Map,s=t.match(/<style[^>]*>([\s\S]*?)<\/style>/i);if(!s)return e;const i=s[1],n=/@list\s+l(\d+):level(\d+)\s*\{([^}]*)\}/gi;let o;for(;null!==(o=n.exec(i));){const t=o[1],s=o[2],i=o[3],n=`l${t}:level${s}`,l=he.exec(i),r=ce.exec(i),a=de.exec(i);let h="ol",c="";if(l){const t=l[1].toLowerCase();if("bullet"===t||"image"===t){if(h="ul",a){const t=a[1].replace(/["%\\]/g,"");"·"===t||"·"===t?c="disc":"o"===t?c="circle":"§"!==t&&"§"!==t||(c="square")}}else c=ue[t]||""}e.set(n,{type:h,listStyleType:c,startAt:r?parseInt(r[1],10):1})}return e}(t);let s=t;s=s.replace(Yt,""),s=s.replace(Kt,""),s=s.replace(Gt,""),s=s.replace(jt,""),s=s.replace(/<!--(?:Start|End)Fragment-->/gi,""),s=s.replace(/<(?:meta|link)[^>]*>/gi,""),s=s.replace(oe," "),s=s.replace(le," "),s=s.replace(/(&nbsp;){2,}/g," "),s=s.replace(/\u00AD/g,"");const i=(new DOMParser).parseFromString(s,"text/html");!function(t){const e=t.body.querySelectorAll("del, .msoDel");for(const t of e)t.remove();const s=t.body.querySelectorAll("ins, .msoIns");for(let t=s.length-1;t>=0;t--){const e=s[t],i=e.parentNode;if(i){for(;e.firstChild;)i.insertBefore(e.firstChild,e);e.remove()}}const i=t.body.querySelectorAll('.MsoCommentReference, [style*="mso-comment-reference"]');for(const t of i)t.remove();const n=t.body.querySelectorAll(".MsoCommentText");for(const t of n)t.remove();const o=t.body.querySelectorAll('div[style*="mso-element:comment"]');for(const t of o)t.remove();const l=t.body.querySelectorAll('a[name^="_msocom"], a[name^="_msoanchor"]');for(const t of l)t.remove()}(i),function(t,e){const s=[],i=t.body.querySelectorAll("p, h1, h2, h3, h4, h5, h6");for(const t of i){const e=t.getAttribute("style")||"",i=t.getAttribute("class")||"",n=Jt.exec(e);(n||/MsoListParagraph/i.test(i))&&s.push({el:t,listId:n?n[1]:"0",level:n?parseInt(n[2],10):1,lfo:n?n[3]:"1"})}if(0===s.length)return;const n=[];let o=null;for(const t of s){const e=Te(t.el);o&&o.length>0&&e===o[o.length-1].el?o.push(t):(o=[t],n.push(o))}for(const t of n)Me(t,e)}(i,e),function(t){const e=t.body.querySelectorAll("p");for(const s of e){const e=s.getAttribute("style")||"",i=s.getAttribute("class")||"";let n=0;const o=re.exec(e);if(o&&(n=parseInt(o[1],10)),!n){const t=fe.exec(i);t&&(n=parseInt(t[1],10))}if(n>=1&&n<=6){const i=t.createElement("h"+n);for(;s.firstChild;)i.appendChild(s.firstChild);e&&i.setAttribute("style",e),s.replaceWith(i)}}}(i),function(t){const e=t.body.querySelectorAll("table");for(const t of e){Ee(t),t.removeAttribute("cellspacing"),t.removeAttribute("cellpadding");const e=t.querySelectorAll("col");for(const t of e)t.remove();const s=t.querySelectorAll("colgroup");for(const t of s)t.children.length||t.remove()}const s=t.body.querySelectorAll("tr");for(const t of s)t.removeAttribute("height");const i=t.body.querySelectorAll("td, th");for(const t of i){const e=t.getAttribute("valign");if(e){t.removeAttribute("valign");const s=t.getAttribute("style")||"";/vertical-align/i.test(s)||t.setAttribute("style",(s?s+";":"")+"vertical-align:"+e)}const s=t.children;if(1===s.length&&"P"===s[0].tagName){const e=s[0],i=e.getAttribute("class")||"";if(/MsoNormal/i.test(i)||!i){for(;e.firstChild;)t.insertBefore(e.firstChild,e);e.remove()}}}}(i),function(t){const e=t.body.querySelectorAll("a");for(let t=e.length-1;t>=0;t--){const s=e[t],i=s.getAttribute("href")||"",n=s.getAttribute("name")||"";if(ve.test(i)){const t=s.parentNode;if(t){for(;s.firstChild;)t.insertBefore(s.firstChild,s);s.remove()}}else if(be.test(n)){const t=s.parentNode;if(t){if(s.childNodes.length)for(;s.firstChild;)t.insertBefore(s.firstChild,s);s.remove()}}else if(ye.test(i)){const t=s.parentNode;if(t){for(;s.firstChild;)t.insertBefore(s.firstChild,s);s.remove()}}else s.removeAttribute("v:shapes")}}(i),function(t){const e=t.body.querySelectorAll("img");for(let t=e.length-1;t>=0;t--){const s=e[t],i=s.getAttribute("src")||"";ve.test(i)?s.remove():s.removeAttribute("v:shapes")}}(i),function(t){const e=t.body.querySelectorAll("br");for(let t=e.length-1;t>=0;t--){const s=e[t],i=s.getAttribute("style")||"";Ce.test(i)||we.test(i)||_e.test(i)?s.remove():(s.removeAttribute("style"),s.removeAttribute("clear"))}const s=t.body.querySelectorAll('div[class*="Section"]');for(let t=s.length-1;t>=0;t--){const e=s[t],i=e.getAttribute("class")||"";if(xe.test(i.trim())){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);e.remove()}}}}(i);const n=i.body.querySelectorAll("*");for(const t of n){Se(t),Ee(t),t.getAttribute("lang")&&t.removeAttribute("lang"),t.removeAttribute("v:shapes");const e=t.tagName.toLowerCase();"img"!==e&&"video"!==e&&"iframe"!==e&&"table"!==e&&"td"!==e&&"th"!==e&&(t.removeAttribute("width"),t.removeAttribute("height"))}!function(t){const e=t.querySelectorAll("span");for(let t=e.length-1;t>=0;t--){const s=e[t];if(!s.attributes.length||!s.getAttribute("style")&&!s.getAttribute("class")){const t=s.parentNode;if(t){for(;s.firstChild;)t.insertBefore(s.firstChild,s);t.removeChild(s)}}}}(i.body);const o=i.body.querySelectorAll("p");for(const t of o)t.textContent.trim()||t.querySelector("img, video, iframe, br, table")||t.remove();return i.body.innerHTML}},Ae=k,Be=H,Ie=W,Ve=_t,Oe=N,Re={isShift:function(t){return t.shiftKey||16===t.keyCode},isCtrl:function(t){const e=t.code;return t.ctrlKey||t.metaKey||"MetaLeft"===e||"MetaRight"===e},isAlt:function(t){return t.altKey},isComposing:function(t){return t.isComposing||"Process"===t.key||229===t.keyCode},isBackspace:function(t){return"Backspace"===t},isTab:function(t){return"Tab"===t},isEnter:function(t){return"Enter"===t},isEsc:function(t){return"Escape"===t},isSpace:function(t){return"Space"===t},isDirectionKey:function(t){return kt.includes(t)},isRemoveKey:function(t){return St.includes(t)},isNonTextKey:function(t){return Et.includes(t)},isHistoryRelevantKey:function(t){return Tt.includes(t)},isDocumentTypeObserverKey:function(t){return Mt.includes(t)},isNonResponseKey:function(t){return Ht.includes(t)}},Pe=Lt,ze=Zt,De=Ne,Fe={env:Ae,unicode:Be,converter:Ie,dom:Ve,numbers:Oe,keyCodeMap:Re,clipboard:Pe,markdown:ze,msOffice:De},qe={redo:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.4,10.6C16.55,9 14.15,8 11.5,8C6.85,8 2.92,11.03 1.54,15.22L3.9,16C4.95,12.81 7.95,10.5 11.5,10.5C13.45,10.5 15.23,11.22 16.62,12.38L13,16H22V7L18.4,10.6Z" /></svg>',undo:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.5,8C9.85,8 7.45,9 5.6,10.6L2,7V16H11L7.38,12.38C8.77,11.22 10.54,10.5 12.5,10.5C16.04,10.5 19.05,12.81 20.1,16L22.47,15.22C21.08,11.03 17.15,8 12.5,8Z" /></svg>',bold:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M304.793 243.891c33.639-18.537 53.657-54.16 53.657-95.693 0-48.236-26.25-87.626-68.626-104.179C265.138 34.01 240.849 32 209.661 32H24c-8.837 0-16 7.163-16 16v33.049c0 8.837 7.163 16 16 16h33.113v318.53H24c-8.837 0-16 7.163-16 16V464c0 8.837 7.163 16 16 16h195.69c24.203 0 44.834-1.289 66.866-7.584C337.52 457.193 376 410.647 376 350.014c0-52.168-26.573-91.684-71.207-106.123zM142.217 100.809h67.444c16.294 0 27.536 2.019 37.525 6.717 15.828 8.479 24.906 26.502 24.906 49.446 0 35.029-20.32 56.79-53.029 56.79h-76.846V100.809zm112.642 305.475c-10.14 4.056-22.677 4.907-31.409 4.907h-81.233V281.943h84.367c39.645 0 63.057 25.38 63.057 63.057.001 28.425-13.66 52.483-34.782 61.284z"/></svg>',underline:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 9.78 15.74"><g><path d="M14.64,3.76h2.52v7.72a4.51,4.51,0,0,1-.59,2.31,3.76,3.76,0,0,1-1.71,1.53,6.12,6.12,0,0,1-2.64.53,5,5,0,0,1-3.57-1.18,4.17,4.17,0,0,1-1.27-3.24V3.76H9.9v7.3a3,3,0,0,0,.55,2,2.3,2.3,0,0,0,1.83.65,2.26,2.26,0,0,0,1.8-.65,3.09,3.09,0,0,0,.55-2V3.76Zm2.52,13.31V19.5H7.39V17.08h9.77Z" transform="translate(-7.38 -3.76)"/></g></svg>',italic:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,4V7H12.21L8.79,15H6V18H14V15H11.79L15.21,7H18V4H10Z" /></svg>',strike:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7.2 9.8C6 7.5 7.7 4.8 10.1 4.3C13.2 3.3 17.7 4.7 17.6 8.5H14.6C14.6 8.2 14.5 7.9 14.5 7.7C14.3 7.1 13.9 6.8 13.3 6.6C12.5 6.3 11.2 6.4 10.5 6.9C9 8.2 10.4 9.5 12 10H7.4C7.3 9.9 7.3 9.8 7.2 9.8M21 13V11H3V13H12.6C12.8 13.1 13 13.1 13.2 13.2C13.8 13.5 14.3 13.7 14.5 14.3C14.6 14.7 14.7 15.2 14.5 15.6C14.3 16.1 13.9 16.3 13.4 16.5C11.6 17 9.4 16.3 9.5 14.1H6.5C6.4 16.7 8.6 18.5 11 18.8C14.8 19.6 19.3 17.2 17.3 12.9L21 13Z" /></svg>',subscript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,7.41L11.41,12L16,16.59L14.59,18L10,13.41L5.41,18L4,16.59L8.59,12L4,7.41L5.41,6L10,10.59L14.59,6L16,7.41M21.85,21.03H16.97V20.03L17.86,19.23C18.62,18.58 19.18,18.04 19.56,17.6C19.93,17.16 20.12,16.75 20.13,16.36C20.14,16.08 20.05,15.85 19.86,15.66C19.68,15.5 19.39,15.38 19,15.38C18.69,15.38 18.42,15.44 18.16,15.56L17.5,15.94L17.05,14.77C17.32,14.56 17.64,14.38 18.03,14.24C18.42,14.1 18.85,14 19.32,14C20.1,14.04 20.7,14.25 21.1,14.66C21.5,15.07 21.72,15.59 21.72,16.23C21.71,16.79 21.53,17.31 21.18,17.78C20.84,18.25 20.42,18.7 19.91,19.14L19.27,19.66V19.68H21.85V21.03Z" /></svg>',superscript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,7.41L11.41,12L16,16.59L14.59,18L10,13.41L5.41,18L4,16.59L8.59,12L4,7.41L5.41,6L10,10.59L14.59,6L16,7.41M21.85,9H16.97V8L17.86,7.18C18.62,6.54 19.18,6 19.56,5.55C19.93,5.11 20.12,4.7 20.13,4.32C20.14,4.04 20.05,3.8 19.86,3.62C19.68,3.43 19.39,3.34 19,3.33C18.69,3.34 18.42,3.4 18.16,3.5L17.5,3.89L17.05,2.72C17.32,2.5 17.64,2.33 18.03,2.19C18.42,2.05 18.85,2 19.32,2C20.1,2 20.7,2.2 21.1,2.61C21.5,3 21.72,3.54 21.72,4.18C21.71,4.74 21.53,5.26 21.18,5.73C20.84,6.21 20.42,6.66 19.91,7.09L19.27,7.61V7.63H21.85V9Z" /></svg>',remove_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22.11 21.46L2.39 1.73L1.11 3L7.65 9.54C6.74 11.03 6 12.65 6 14.23C6 17.54 8.69 20.23 12 20.23C13.74 20.23 15.3 19.5 16.4 18.29L20.84 22.73L22.11 21.46M12 18.23C9.78 18.23 8 16.45 8 14.23C8 13.5 8.5 12.27 9.14 11.03L15 16.88C14.26 17.71 13.2 18.23 12 18.23M11.14 7.94L9.71 6.5C10.57 5.38 11.25 4.61 11.25 4.61L12 3.77L12.75 4.61C12.75 4.61 14.03 6.06 15.32 7.94S18 12.07 18 14.23C18 14.41 18 14.59 17.97 14.77L15.46 12.26C15 11.23 14.37 10.07 13.68 9.07C12.84 7.85 12.44 7.42 12 6.9C11.73 7.21 11.5 7.5 11.14 7.94Z" /></svg>',remove_format:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6,5V5.18L8.82,8H11.22L10.5,9.68L12.6,11.78L14.21,8H20V5H6M3.27,5L2,6.27L8.97,13.24L6.5,19H9.5L11.07,15.34L16.73,21L18,19.73L3.55,5.27L3.27,5Z" /></svg>',indent:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,13H21V11H11M11,9H21V7H11M3,3V5H21V3M11,17H21V15H11M3,8V16L7,12M3,21H21V19H3V21Z" /></svg>',outdent:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,13H21V11H11M11,9H21V7H11M3,3V5H21V3M3,21H21V19H3M3,12L7,16V8M11,17H21V15H11V17Z" /></svg>',expansion:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,21V19H6.41L10.91,14.5L9.5,13.09L5,17.59V14H3V21H10M14.5,10.91L19,6.41V10H21V3H14V5H17.59L13.09,9.5L14.5,10.91Z" /></svg>',reduction:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19.5,3.09L15,7.59V4H13V11H20V9H16.41L20.91,4.5L19.5,3.09M4,13V15H7.59L3.09,19.5L4.5,20.91L9,16.41V20H11V13H4Z" /></svg>',code_block:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5.59 3.41L7 4.82L3.82 8L7 11.18L5.59 12.6L1 8L5.59 3.41M11.41 3.41L16 8L11.41 12.6L10 11.18L13.18 8L10 4.82L11.41 3.41M22 6V18C22 19.11 21.11 20 20 20H4C2.9 20 2 19.11 2 18V14H4V18H20V6H17.03V4H20C21.11 4 22 4.89 22 6Z" /></svg>',code_view:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.89,3L14.85,3.4L11.11,21L9.15,20.6L12.89,3M19.59,12L16,8.41V5.58L22.42,12L16,18.41V15.58L19.59,12M1.58,12L8,5.58V8.41L4.41,12L8,15.58V18.41L1.58,12Z" /></svg>',markdown_view:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2,16V8H4.73L7,11.19L9.27,8H12V16H10V10.6L7,14.05L4,10.6V16H2M16,8L20,12H17V16H15V12H12L16,8Z" /></svg>',preview:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9M12,4.5C17,4.5 21.27,7.61 23,12C21.27,16.39 17,19.5 12,19.5C7,19.5 2.73,16.39 1,12C2.73,7.61 7,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C15.76,17.5 19.17,15.36 20.82,12C19.17,8.64 15.76,6.5 12,6.5C8.24,6.5 4.83,8.64 3.18,12Z" /></svg>',print:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18,3H6V7H18M19,12A1,1 0 0,1 18,11A1,1 0 0,1 19,10A1,1 0 0,1 20,11A1,1 0 0,1 19,12M16,19H8V14H16M19,8H5A3,3 0 0,0 2,11V17H6V21H18V17H22V11A3,3 0 0,0 19,8Z" /></svg>',template:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,7.5H18V9.5H13V7.5M13,14.5H18V16.5H13V14.5M19,3A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3H19M19,19V5H5V19H19M11,6V11H6V6H11M10,10V7H7V10H10M11,13V18H6V13H11M10,17V14H7V17H10Z" /></svg>',layout:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 13H3A1 1 0 0 0 2 14V20A1 1 0 0 0 3 21H21A1 1 0 0 0 22 20V14A1 1 0 0 0 21 13M20 19H4V15H20M21 3H3A1 1 0 0 0 2 4V10A1 1 0 0 0 3 11H21A1 1 0 0 0 22 10V4A1 1 0 0 0 21 3M20 9H4V5H20Z" /></svg>',new_document:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z" /></svg>',select_all:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,9H15V15H9M7,17H17V7H7M15,5H17V3H15M15,21H17V19H15M19,17H21V15H19M19,9H21V7H19M19,21A2,2 0 0,0 21,19H19M19,13H21V11H19M11,21H13V19H11M9,3H7V5H9M3,17H5V15H3M5,21V19H3A2,2 0 0,0 5,21M19,3V5H21A2,2 0 0,0 19,3M13,3H11V5H13M3,9H5V7H3M7,21H9V19H7M3,13H5V11H3M3,5H5V3A2,2 0 0,0 3,5Z" /></svg>',line_height:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 22H3V20H21V22M21 4H3V2H21V4M10 13.7H14L12 8.3L10 13.7M11.2 6H12.9L17.6 18H15.6L14.7 15.4H9.4L8.5 18H6.5L11.2 6Z" /></svg>',paragraph_style:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M360-160v-240q-83 0-141.5-58.5T160-600q0-83 58.5-141.5T360-800h360v80h-80v560h-80v-560H440v560h-80Z"/></svg>',text_style:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,3H16V6H11V18H8V6H3V3M12,7H14V9H12V7M15,7H17V9H15V7M18,7H20V9H18V7M12,10H14V12H12V10M12,13H14V15H12V13M12,16H14V18H12V16M12,19H14V21H12V19Z" /></svg>',save:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,9H5V5H15M12,19A3,3 0 0,1 9,16A3,3 0 0,1 12,13A3,3 0 0,1 15,16A3,3 0 0,1 12,19M17,3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V7L17,3Z" /></svg>',blockquote:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11 18V10H9.12L11.12 6H5.38L3 10.76V18M9 16H5V11.24L6.62 8H7.88L5.88 12H9M21 18V10H19.12L21.12 6H15.38L13 10.76V18M19 16H15V11.24L16.62 8H17.88L15.88 12H19Z" /></svg>',arrow_down:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 8.67"><g><path d="M18.79,7.52a.8.8,0,0,1,.56-.23.82.82,0,0,1,.79.79.8.8,0,0,1-.23.56l-7.07,7.07a.79.79,0,0,1-.57.25.77.77,0,0,1-.57-.25h0L4.64,8.65a.8.8,0,0,1-.23-.57.82.82,0,0,1,.79-.79.8.8,0,0,1,.56.23L12.28,14l3.26-3.26,3.25-3.26Z" transform="translate(-4.41 -7.29)"/></g></svg>',align_justify:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm0,5.9H20.15v-2H4.41v2Zm0,3.94H20.15v-2H4.41v2Zm0,3.93h7.87v-2H4.41v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_left:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm11.8,3.94H4.41v2H16.22v-2Zm-11.8,5.9H18.18v-2H4.41v2Zm0,3.93h9.84v-2H4.41v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_right:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm3.93,5.9H20.15v-2H8.34v2Zm-2,3.94H20.14v-2H6.37v2Zm3.94,3.93h9.84v-2H10.31v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_center:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm2,3.94v2H18.18v-2H6.37Zm-1,5.9H19.16v-2H5.39v2Zm2,3.93H17.2v-2H7.36v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_top:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,11H11V21H13V11H16L12,7L8,11M4,3V5H20V3H4Z" /></svg>',align_middle:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,19H11V23H13V19H16L12,15L8,19M16,5H13V1H11V5H8L12,9L16,5M4,11V13H20V11H4Z" /></svg>',align_bottom:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,13H13V3H11V13H8L12,17L16,13M4,19V21H20V19H4Z" /></svg>',format_float_none:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,7H9V13H3V7M3,3H21V5H3V3M21,11V13H11V11H21M3,15H17V17H3V15M3,19H21V21H3V19Z" /></svg>',format_float_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,7H9V13H3V7M3,3H21V5H3V3M21,7V9H11V7H21M21,11V13H11V11H21M3,15H17V17H3V15M3,19H21V21H3V19Z" /></svg>',format_float_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,7H21V13H15V7M3,3H21V5H3V3M13,7V9H3V7H13M9,11V13H3V11H9M3,15H17V17H3V15M3,19H21V21H3V19Z" /></svg>',format_float_center:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,7H15V13H9V7M3,3H21V5H3V3M3,15H21V17H3V15M3,19H17V21H3V19Z" /></svg>',font_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g><path d="M9.62,12L12,5.67L14.37,12M11,3L5.5,17H7.75L8.87,14H15.12L16.25,17H18.5L13,3H11Z" /><path class="se-svg-color-helper" d="M0,24H24V20H0V24Z" /></g></svg>',background_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g><path d="M4,17L6.75,14.25L6.72,14.23C6.14,13.64 6.14,12.69 6.72,12.11L11.46,7.37L15.7,11.61L10.96,16.35C10.39,16.93 9.46,16.93 8.87,16.37L8.24,17H4M15.91,2.91C16.5,2.33 17.45,2.33 18.03,2.91L20.16,5.03C20.74,5.62 20.74,6.57 20.16,7.16L16.86,10.45L12.62,6.21L15.91,2.91Z" /><path class="se-svg-color-helper" d="M0,24H24V20H0V24Z" /></g></svg>',list_bulleted:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 12.37"><g><path d="M7.77,16.12a1.59,1.59,0,0,0-.49-1.18,1.62,1.62,0,0,0-1.19-.49,1.68,1.68,0,1,0,0,3.36,1.67,1.67,0,0,0,1.68-1.69Zm0-4.48A1.67,1.67,0,0,0,6.09,10,1.68,1.68,0,0,0,4.9,12.82a1.62,1.62,0,0,0,1.19.49,1.67,1.67,0,0,0,1.68-1.67Zm12.38,3.64a.27.27,0,0,0-.08-.19.28.28,0,0,0-.2-.09H9.19a.28.28,0,0,0-.2.08.29.29,0,0,0-.08.19V17a.27.27,0,0,0,.28.28H19.87a.27.27,0,0,0,.19-.08.24.24,0,0,0,.08-.2V15.28ZM7.77,7.13a1.63,1.63,0,0,0-.49-1.2,1.61,1.61,0,0,0-1.19-.49,1.61,1.61,0,0,0-1.19.49,1.71,1.71,0,0,0,0,2.4,1.62,1.62,0,0,0,1.19.49,1.61,1.61,0,0,0,1.19-.49,1.63,1.63,0,0,0,.49-1.2Zm12.38,3.66a.28.28,0,0,0-.08-.2.29.29,0,0,0-.19-.08H9.19a.27.27,0,0,0-.28.28v1.69a.27.27,0,0,0,.08.19.24.24,0,0,0,.2.08H19.87a.27.27,0,0,0,.19-.08.25.25,0,0,0,.08-.19V10.79Zm0-4.5a.27.27,0,0,0-.08-.19A.25.25,0,0,0,19.88,6H9.19A.28.28,0,0,0,9,6.1a.26.26,0,0,0-.08.19V8A.27.27,0,0,0,9,8.17a.24.24,0,0,0,.2.08H19.87a.27.27,0,0,0,.19-.08A.25.25,0,0,0,20.14,8V6.29Z" transform="translate(-4.41 -5.44)"/></g></svg>',list_numbered:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.69 15.74"><g><path d="M7.66,18a1.24,1.24,0,0,0-.26-.78,1.17,1.17,0,0,0-.72-.42l.85-1V15H4.58v1.34h.94v-.46l.85,0h0c-.11.11-.22.23-.32.35s-.23.27-.37.47L5.39,17l.23.51c.61-.05.92.11.92.49a.42.42,0,0,1-.18.37.79.79,0,0,1-.45.12A1.41,1.41,0,0,1,5,18.15l-.51.77A2.06,2.06,0,0,0,6,19.5a1.8,1.8,0,0,0,1.2-.41A1.38,1.38,0,0,0,7.66,18Zm0-5.54H6.75V13H5.63A.72.72,0,0,1,6,12.51a5.45,5.45,0,0,1,.66-.45,2.71,2.71,0,0,0,.67-.57,1.19,1.19,0,0,0,.31-.81,1.29,1.29,0,0,0-.45-1,1.86,1.86,0,0,0-2-.11,1.51,1.51,0,0,0-.62.7l.74.52A.87.87,0,0,1,6,10.28a.51.51,0,0,1,.35.12.42.42,0,0,1,.13.33.55.55,0,0,1-.21.4,3,3,0,0,1-.5.38c-.19.13-.39.27-.58.42a2,2,0,0,0-.5.6,1.63,1.63,0,0,0-.21.81,3.89,3.89,0,0,0,.05.48h3.2V12.44Zm12.45,2.82a.27.27,0,0,0-.08-.19.28.28,0,0,0-.21-.08H9.1a.32.32,0,0,0-.21.08.24.24,0,0,0-.08.2V17a.27.27,0,0,0,.08.19.3.3,0,0,0,.21.08H19.83a.32.32,0,0,0,.21-.08.25.25,0,0,0,.08-.19V15.26ZM7.69,7.32h-1V3.76H5.8L4.6,4.88l.63.68a1.85,1.85,0,0,0,.43-.48h0l0,2.24H4.74V8.2h3V7.32Zm12.43,3.42a.27.27,0,0,0-.08-.19.28.28,0,0,0-.21-.08H9.1a.32.32,0,0,0-.21.08.24.24,0,0,0-.08.2v1.71a.27.27,0,0,0,.08.19.3.3,0,0,0,.21.08H19.83a.32.32,0,0,0,.21-.08.25.25,0,0,0,.08-.19V10.74Zm0-4.52A.27.27,0,0,0,20,6,.28.28,0,0,0,19.83,6H9.1A.32.32,0,0,0,8.89,6a.24.24,0,0,0-.08.19V7.93a.27.27,0,0,0,.08.19.32.32,0,0,0,.21.08H19.83A.32.32,0,0,0,20,8.12a.26.26,0,0,0,.08-.2V6.22Z" transform="translate(-4.43 -3.76)"/></g></svg>',list_checked:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21,19V17H8V19H21M21,13V11H8V13H21M8,7H21V5H8V7M4,5V7H6V5H4M3,5A1,1 0 0,1 4,4H6A1,1 0 0,1 7,5V7A1,1 0 0,1 6,8H4A1,1 0 0,1 3,7V5M4,11V13H6V11H4M3,11A1,1 0 0,1 4,10H6A1,1 0 0,1 7,11V13A1,1 0 0,1 6,14H4A1,1 0 0,1 3,13V11M4,17V19H6V17H4M3,17A1,1 0 0,1 4,16H6A1,1 0 0,1 7,17V19A1,1 0 0,1 6,20H4A1,1 0 0,1 3,19V17Z" /></svg>',table:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M4.41,8.05V3.76H8.7V8.05H4.41Zm5.71,0V3.76h4.3V8.05h-4.3Zm5.74-4.29h4.29V8.05H15.86V3.76Zm-11.45,10V9.48H8.7v4.3H4.41Zm5.71,0V9.48h4.3v4.3h-4.3Zm5.74,0V9.48h4.29v4.3H15.86ZM4.41,19.5V15.21H8.7V19.5H4.41Zm5.71,0V15.21h4.3V19.5h-4.3Zm5.74,0V15.21h4.29V19.5H15.86Z" transform="translate(-4.41 -3.76)"/></g></svg>',table_header:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 15.74"><g><path d="M17,19.5v-.78H15.5v.78H17Zm-3,0v-.78H12.5v.78H14Zm-3,0v-.78H9.53v.78H11Zm-3,0v-.78H6.53v.78H8Zm10.55,0a1.73,1.73,0,0,0,.85-.35,1.67,1.67,0,0,0,.56-.76l-.71-.31a1.21,1.21,0,0,1-.35.4,1.34,1.34,0,0,1-.53.23l.08.38c.06.24.09.38.1.41Zm-13.7-.63.55-.55A.77.77,0,0,1,5.25,18a1.31,1.31,0,0,1-.06-.38v-.38H4.41v.38a2,2,0,0,0,.12.68,1.6,1.6,0,0,0,.35.57Zm15.27-2.12V15.26h-.78v1.49h.78Zm-15-1V14.23H4.41v1.49h.78Zm15-2V12.26h-.78v1.49h.78Zm-15-1V11.22H4.41v1.51h.78Zm15-2V9.26h-.78v1.51h.78Zm-15-1V8.17H4.41V9.74h.78Zm15-2V6.28h-.78V7.77h.78Zm-15-1.11V5.33L4.48,5.1a.77.77,0,0,0-.07.27,2.72,2.72,0,0,0,0,.28v1h.79ZM19.21,5l.63-.4A1.62,1.62,0,0,0,19.16,4a1.94,1.94,0,0,0-.91-.22v.78a1.31,1.31,0,0,1,.56.12.88.88,0,0,1,.4.36ZM6,4.54H7.78V3.76H6a.82.82,0,0,0-.28.06l.12.35c.07.21.1.33.11.36Zm10.8,0V3.76H15.28v.78h1.49Zm-3,0V3.76H12.28v.78h1.49Zm-3,0V3.76H9.28v.78h1.51ZM6,10.84h12.6V6.91H6Z" transform="translate(-4.4 -3.76)"/></g></svg>',table_properties:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.88 12L2.2 16.06L6.26 17.74L7.94 21.8L11 20.53V18.36L9 19.19L7.79 16.21L4.81 15L6.05 12L4.81 9L7.79 7.79L9 4.81L12 6.05L15 4.81L16.21 7.79L19.19 9L17.95 12L18 12.13L19.38 10.75C19.82 10.3 20.38 10.06 20.94 10L21.8 7.94L17.74 6.26L16.06 2.2L12 3.88L7.94 2.2L6.26 6.26L2.2 7.94L3.88 12M22.85 13.47L21.53 12.15C21.33 11.95 21 11.95 20.81 12.15L19.83 13.13L21.87 15.17L22.85 14.19C23.05 14 23.05 13.67 22.85 13.47M13 19.96V22H15.04L21.17 15.88L19.13 13.83L13 19.96Z" /></svg>',cell_properties:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.58,17L12,14.84L8.42,17L9.37,12.93L6.21,10.2L10.38,9.84L12,6L13.62,9.83L17.79,10.19L14.63,12.92L15.58,17M19,3A2,2 0 0,1 21,5V19C21,20.11 20.1,21 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3H19M5,5V19H19V5H5Z" /></svg>',table_column:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,2H16A2,2 0 0,1 18,4V20A2,2 0 0,1 16,22H8A2,2 0 0,1 6,20V4A2,2 0 0,1 8,2M8,10V14H16V10H8M8,16V20H16V16H8M8,4V8H16V4H8Z" /></svg>',table_row:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,14A2,2 0 0,1 20,16H4A2,2 0 0,1 2,14V10A2,2 0 0,1 4,8H20A2,2 0 0,1 22,10V14M4,14H8V10H4V14M10,14H14V10H10V14M16,14H20V10H16V14Z" /></svg>',color_checked:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z" /></svg>',color_palette:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z" /></svg>',border_all:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,11H13V5H19M19,19H13V13H19M11,11H5V5H11M11,19H5V13H11M3,21H21V3H3V21Z" /></svg>',border_inside:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,17H21V15H19M19,21H21V19H19M13,3H11V11H3V13H11V21H13V13H21V11H13M15,21H17V19H15M19,5H21V3H19M19,9H21V7H19M17,3H15V5H17M5,3H3V5H5M9,3H7V5H9M3,17H5V15H3M5,7H3V9H5M7,21H9V19H7M3,21H5V19H3V21Z" /></svg>',border_horizontal:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,21H21V19H19M15,21H17V19H15M11,17H13V15H11M19,9H21V7H19M19,5H21V3H19M3,13H21V11H3M11,21H13V19H11M19,17H21V15H19M13,3H11V5H13M13,7H11V9H13M17,3H15V5H17M9,3H7V5H9M5,3H3V5H5M7,21H9V19H7M3,17H5V15H3M5,7H3V9H5M3,21H5V19H3V21Z" /></svg>',border_vertical:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,13H17V11H15M15,21H17V19H15M15,5H17V3H15M19,9H21V7H19M19,5H21V3H19M19,13H21V11H19M19,21H21V19H19M11,21H13V3H11M19,17H21V15H19M7,5H9V3H7M3,17H5V15H3M3,21H5V19H3M3,13H5V11H3M7,13H9V11H7M7,21H9V19H7M3,5H5V3H3M3,9H5V7H3V9Z" /></svg>',border_outside:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,11H7V13H9M13,15H11V17H13M19,19H5V5H19M3,21H21V3H3M17,11H15V13H17M13,11H11V13H13M13,7H11V9H13V7Z" /></svg>',border_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,5H17V3H15M15,13H17V11H15M19,21H21V19H19M19,13H21V11H19M19,5H21V3H19M19,17H21V15H19M15,21H17V19H15M19,9H21V7H19M3,21H5V3H3M7,13H9V11H7M7,5H9V3H7M7,21H9V19H7M11,13H13V11H11M11,9H13V7H11M11,5H13V3H11M11,17H13V15H11M11,21H13V19H11V21Z" /></svg>',border_top:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,13H17V11H15M19,21H21V19H19M11,9H13V7H11M15,21H17V19H15M19,17H21V15H19M3,5H21V3H3M19,13H21V11H19M19,9H21V7H19M11,17H13V15H11M3,9H5V7H3M3,13H5V11H3M3,21H5V19H3M3,17H5V15H3M11,21H13V19H11M11,13H13V11H11M7,13H9V11H7M7,21H9V19H7V21Z" /></svg>',border_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,5H13V3H11M15,5H17V3H15M15,21H17V19H15M19,21H21V3H19M3,9H5V7H3M3,17H5V15H3M3,13H5V11H3M11,21H13V19H11M3,21H5V19H3M7,5H9V3H7M3,5H5V3H3M7,21H9V19H7V21Z" /></svg>',border_bottom:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,15H3V17H5M3,21H21V19H3M5,11H3V13H5M19,9H21V7H19M19,5H21V3H19M5,7H3V9H5M19,17H21V15H19M19,13H21V11H19M17,3H15V5H17M13,3H11V5H13M5,3H3V5H5M9,3H7V5H9" /></svg>',border_none:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,5H17V3H15M15,13H17V11H15M15,21H17V19H15M11,5H13V3H11M19,5H21V3H19M11,9H13V7H11M19,9H21V7H19M19,21H21V19H19M19,13H21V11H19M19,17H21V15H19M11,13H13V11H11M3,5H5V3H3M3,9H5V7H3M3,13H5V11H3M3,17H5V15H3M3,21H5V19H3M11,21H13V19H11M11,17H13V15H11M7,21H9V19H7M7,13H9V11H7M7,5H9V3H7V5Z" /></svg>',horizontal_line:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 2.24"><g><path d="M20.15,12.75V10.51H4.41v2.24H20.15Z" transform="translate(-4.41 -10.51)"/></g></svg>',show_blocks:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M40-40v-240h80v-400H40v-240h240v80h400v-80h240v240h-80v400h80v240H680v-80H280v80H40Zm240-160h400v-80h80v-400h-80v-80H280v80h-80v400h80v80Zm32-120 136-360h64l136 360h-62l-32-92H408l-32 92h-64Zm114-144h108l-52-150h-4l-52 150ZM120-760h80v-80h-80v80Zm640 0h80v-80h-80v80Zm0 640h80v-80h-80v80Zm-640 0h80v-80h-80v80Zm80-640Zm560 0Zm0 560Zm-560 0Z"/></svg>',cancel:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" /></svg>',selection_remove:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 20V17H22V20C22 21.11 21.1 22 20 22H17V20H20M2 20V17H4V20H7V22H4C2.9 22 2 21.1 2 20M10 20H14V22H10V20M14.59 8L12 10.59L9.41 8L8 9.41L10.59 12L8 14.59L9.41 16L12 13.41L14.59 16L16 14.59L13.41 12L16 9.41L14.59 8M20 10H22V14H20V10M2 10H4V14H2V10M2 4C2 2.89 2.9 2 4 2H7V4H4V7H2V4M22 4V7H20V4H17V2H20C21.1 2 22 2.9 22 4M10 2H14V4H10V2Z" /></svg>',image:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,19H5V5H19M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M13.96,12.29L11.21,15.83L9.25,13.47L6.5,17H17.5L13.96,12.29Z" /></svg>',image_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2L20,8V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2H14M18,20V9H13V4H6V20H18M17,13V19H7L12,14L14,16M10,10.5A1.5,1.5 0 0,1 8.5,12A1.5,1.5 0 0,1 7,10.5A1.5,1.5 0 0,1 8.5,9A1.5,1.5 0 0,1 10,10.5Z" /></svg>',video:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,19H5V5H19M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M10,8V16L15,12L10,8Z" /></svg>',video_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2L20,8V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2H14M18,20V9H13V4H6V20H18M16,18L13.5,16.3V18H8V13H13.5V14.7L16,13V18Z" /></svg>',link:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z" /></svg>',link_rel:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 1C1.89 1 1 1.89 1 3V14C1 15.11 1.89 16 3 16H14C15.11 16 16 15.11 16 14V11H14V14H3V3H14V5H16V3C16 1.89 15.11 1 14 1M9 7C7.89 7 7 7.89 7 9V12H9V9H20V20H9V18H7V20C7 21.11 7.89 22 9 22H20C21.11 22 22 21.11 22 20V9C22 7.89 21.11 7 20 7H9" /></svg>',math:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11.81 15.73"><g><path d="M17.19,5.73a1,1,0,0,0,.71-.29,1,1,0,0,0,.28-.7,1,1,0,0,0-1-1H7.35a1,1,0,0,0-1,1,.77.77,0,0,0,.13.47h0l4.58,6.43L6.68,17.81a1.25,1.25,0,0,0-.29.71.94.94,0,0,0,.28.7.92.92,0,0,0,.69.28H17.2a1,1,0,0,0,.71-.28,1,1,0,0,0,0-1.39.92.92,0,0,0-.71-.29H9.26l3.87-5.43a.86.86,0,0,0,0-.95L9.26,5.73h7.93Z" transform="translate(-6.38 -3.77)"/></g></svg>',unlink:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.43 19.12,14.63 17.79,15L19.25,16.44C20.88,15.61 22,13.95 22,12A5,5 0 0,0 17,7M16,11H13.81L15.81,13H16V11M2,4.27L5.11,7.38C3.29,8.12 2,9.91 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12C3.9,10.41 5.11,9.1 6.66,8.93L8.73,11H8V13H10.73L13,15.27V17H14.73L18.74,21L20,19.74L3.27,3L2,4.27Z" /></svg>',merge_cell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,10H3V4H11V6H5V10M19,18H13V20H21V14H19V18M5,18V14H3V20H11V18H5M21,4H13V6H19V10H21V4M8,13V15L11,12L8,9V11H3V13H8M16,11V9L13,12L16,15V13H21V11H16Z" /></svg>',split_cell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 14H21V20H3V14H5V18H19V14M3 4V10H5V6H19V10H21V4H3M11 11V13H8V15L5 12L8 9V11H11M16 11V9L19 12L16 15V13H13V11H16Z" /></svg>',unmerge_cell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,10H3V4H11V6H5V10M19,18H13V20H21V14H19V18M5,18V14H3V20H11V18H5M21,4H13V6H19V10H21V4"/><line x1="7.5" y1="12" x2="16.5" y2="12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>',caption:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.79"><g><path d="M4.41,18.52H20.15v-2H4.41ZM20,4.73H18.07V6h.65v.65H20V4.73ZM17,6V4.73H14.55V6H17ZM13.49,6V4.73H11V6h2.47ZM10,6V4.73H7.5V6H10ZM5.79,6h.65V4.73H4.5V6.67H5.8V6ZM4.5,11.34H5.79V8.48H4.5ZM6.44,13.8H5.79v-.65H4.5v1.94H6.44ZM17,15.09V13.8H14.55v1.29H17Zm-3.52,0V13.8H11v1.29h2.47Zm-3.53,0V13.8H7.5v1.29H10ZM20,13.16H18.72v.65h-.65V15.1H20Zm-1.29-1.82H20V8.48h-1.3v2.86Z" transform="translate(-4.41 -4.73)"/></g></svg>',edit:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.73"><g><path d="M7.51,5.68h6l1.52-1.57H6.94a2.4,2.4,0,0,0-1.79.82A2.8,2.8,0,0,0,4.41,6.8V17a2.55,2.55,0,0,0,.75,1.8A2.48,2.48,0,0,0,7,19.5H17.22a2.57,2.57,0,0,0,1.83-.74,2.52,2.52,0,0,0,.77-1.8V8.83l-1.58,1.54v6a1.54,1.54,0,0,1-1.53,1.53H7.51A1.54,1.54,0,0,1,6,16.41V7.21A1.52,1.52,0,0,1,7.51,5.68Zm5.63,7.47h0L10.7,10.74l-1,3.38,1.71-.48,1.7-.49Zm.34-.34h0l5.36-5.32L16.4,5.08,11,10.4l1.23,1.21,1.21,1.2ZM19.93,6.4a.82.82,0,0,0,.22-.48A.54.54,0,0,0,20,5.47L18.45,4A.67.67,0,0,0,18,3.77a.7.7,0,0,0-.48.21l-.74.72,2.44,2.43.37-.37.35-.36Z" transform="translate(-4.41 -3.77)"/></g></svg>',delete:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 15.74"><g><path d="M19.16,6.71a.94.94,0,0,0,.69-.28.91.91,0,0,0,.29-.68A1,1,0,0,0,19.85,5a.93.93,0,0,0-.69-.3H14.24A.94.94,0,0,0,14,4.06a.92.92,0,0,0-.7-.3h-2a1,1,0,0,0-.7.3.93.93,0,0,0-.28.68H5.39A.92.92,0,0,0,4.7,5a1,1,0,0,0-.29.71.91.91,0,0,0,.29.68,1,1,0,0,0,.69.28H19.16Zm-12.79,1a1,1,0,0,0-.7.3.94.94,0,0,0-.28.69v8.85A1.88,1.88,0,0,0,6,18.93a1.9,1.9,0,0,0,1.39.57H17.2a1.87,1.87,0,0,0,1.39-.58,1.91,1.91,0,0,0,.58-1.39V8.68A1,1,0,0,0,18.88,8a.89.89,0,0,0-.7-.29,1,1,0,0,0-.69.29.92.92,0,0,0-.29.68v7.87a1,1,0,0,1-1,1H8.34a.94.94,0,0,1-.69-.28,1,1,0,0,1-.29-.71V8.68a1,1,0,0,0-1-1Z" transform="translate(-4.41 -3.76)"/></g></svg>',revert:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.76 14.69"><g><path d="M18.26,15V12.3l1.89-2V15a2.58,2.58,0,0,1-.24,1c-.2.58-.75.92-1.65,1H7.56v2L4.41,15.63,7.56,13v2h10.7ZM6.3,8.28V11L4.41,13V8.28a2.58,2.58,0,0,1,.24-1c.2-.58.75-.92,1.65-1H17v-2l3.15,3.34L17,10.3v-2H6.3Z" transform="translate(-4.4 -4.28)"/></g></svg>',auto_size:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M6.71,17.19,6.89,16l1.21-.15A6,6,0,0,1,6.81,13.9a5.78,5.78,0,0,1-.45-2.27A6,6,0,0,1,8.1,7.45a5.83,5.83,0,0,1,4.17-1.73l1-1-1-1A7.89,7.89,0,0,0,5,14.64a7.73,7.73,0,0,0,1.71,2.55Zm5.57,2.31h0A7.86,7.86,0,0,0,17.85,6.07L17.67,7.3l-1.21.15a5.9,5.9,0,0,1,1.29,1.92,5.81,5.81,0,0,1,.45,2.26,5.91,5.91,0,0,1-5.9,5.9l-1,1,.49.49.47.5Z" transform="translate(-4.41 -3.76)"/></g></svg>',resize:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M23,15H21V17H23V15M23,11H21V13H23V11M23,19H21V21C22,21 23,20 23,19M15,3H13V5H15V3M23,7H21V9H23V7M21,3V5H23C23,4 22,3 21,3M3,21H11V15H1V19A2,2 0 0,0 3,21M3,7H1V9H3V7M15,19H13V21H15V19M19,3H17V5H19V3M19,19H17V21H19V19M3,3C2,3 1,4 1,5H3V3M3,11H1V13H3V11M11,3H9V5H11V3M7,3H5V5H7V3Z" /></svg>',insert_row_below:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,10A2,2 0 0,1 20,12H4A2,2 0 0,1 2,10V3H4V5H8V3H10V5H14V3H16V5H20V3H22V10M4,10H8V7H4V10M10,10H14V7H10V10M20,10V7H16V10H20M11,14H13V17H16V19H13V22H11V19H8V17H11V14Z" /></svg>',insert_row_above:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,14A2,2 0 0,0 20,12H4A2,2 0 0,0 2,14V21H4V19H8V21H10V19H14V21H16V19H20V21H22V14M4,14H8V17H4V14M10,14H14V17H10V14M20,14V17H16V14H20M11,10H13V7H16V5H13V2H11V5H8V7H11V10Z" /></svg>',insert_column_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,2A2,2 0 0,0 11,4V20A2,2 0 0,0 13,22H22V2H13M20,10V14H13V10H20M20,16V20H13V16H20M20,4V8H13V4H20M9,11H6V8H4V11H1V13H4V16H6V13H9V11Z" /></svg>',insert_column_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,2A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H2V2H11M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M15,11H18V8H20V11H23V13H20V16H18V13H15V11Z" /></svg>',delete_row:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.41,13L12,15.59L14.59,13L16,14.41L13.41,17L16,19.59L14.59,21L12,18.41L9.41,21L8,19.59L10.59,17L8,14.41L9.41,13M22,9A2,2 0 0,1 20,11H4A2,2 0 0,1 2,9V6A2,2 0 0,1 4,4H20A2,2 0 0,1 22,6V9M4,9H8V6H4V9M10,9H14V6H10V9M16,9H20V6H16V9Z" /></svg>',delete_column:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4,2H11A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H4A2,2 0 0,1 2,20V4A2,2 0 0,1 4,2M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M17.59,12L15,9.41L16.41,8L19,10.59L21.59,8L23,9.41L20.41,12L23,14.59L21.59,16L19,13.41L16.41,16L15,14.59L17.59,12Z" /></svg>',fixed_column_width:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,8H19A2,2 0 0,1 21,10V20A2,2 0 0,1 19,22H5A2,2 0 0,1 3,20V10A2,2 0 0,1 5,8M5,12V15H11V12H5M13,12V15H19V12H13M5,17V20H11V17H5M13,17V20H19V17H13M11,2H21V6H19V4H13V6H11V2Z" /></svg>',rotate_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,4.07V1L8.45,5.55L13,10V6.09C15.84,6.57 18,9.03 18,12C18,14.97 15.84,17.43 13,17.91V19.93C16.95,19.44 20,16.08 20,12C20,7.92 16.95,4.56 13,4.07M7.1,18.32C8.26,19.22 9.61,19.76 11,19.93V17.9C10.13,17.75 9.29,17.41 8.54,16.87L7.1,18.32M6.09,13H4.07C4.24,14.39 4.79,15.73 5.69,16.89L7.1,15.47C6.58,14.72 6.23,13.88 6.09,13M7.11,8.53L5.7,7.11C4.8,8.27 4.24,9.61 4.07,11H6.09C6.23,10.13 6.58,9.28 7.11,8.53Z" /></svg>',rotate_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16.89,15.5L18.31,16.89C19.21,15.73 19.76,14.39 19.93,13H17.91C17.77,13.87 17.43,14.72 16.89,15.5M13,17.9V19.92C14.39,19.75 15.74,19.21 16.9,18.31L15.46,16.87C14.71,17.41 13.87,17.76 13,17.9M19.93,11C19.76,9.61 19.21,8.27 18.31,7.11L16.89,8.53C17.43,9.28 17.77,10.13 17.91,11M15.55,5.55L11,1V4.07C7.06,4.56 4,7.92 4,12C4,16.08 7.05,19.44 11,19.93V17.91C8.16,17.43 6,14.97 6,12C6,9.03 8.16,6.57 11,6.09V10L15.55,5.55Z" /></svg>',mirror_horizontal:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.75 15.74"><g><path d="M13.75,3.76l5.9,15.74h-5.9V3.76ZM4.9,19.5,10.8,3.76V19.5H4.9Z" transform="translate(-4.9 -3.76)"/></g></svg>',mirror_vertical:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 14.75"><g><path d="M20.15,13.1,4.41,19V13.1H20.15ZM4.41,4.25l15.74,5.9H4.41V4.25Z" transform="translate(-4.41 -4.25)"/></g></svg>',checked:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 12.1"><g><path d="M4.59,12.23l.12.18L9.43,17.5a.58.58,0,0,0,.84,0L20,7.45h0a.58.58,0,0,0,0-.84l-.85-.85a.58.58,0,0,0-.84,0H18.2l-8.12,8.41a.29.29,0,0,1-.42,0l-3.4-3.63a.58.58,0,0,0-.84,0l-.85.85a.6.6,0,0,0-.14.21.51.51,0,0,0,0,.44c.05.06.1.13.16.19Z" transform="translate(-4.38 -5.58)"/></g></svg>',line_break:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,6a1,1,0,0,0-1,1v4a1,1,0,0,1-1,1H7.41l1.3-1.29A1,1,0,0,0,7.29,9.29l-3,3a1,1,0,0,0-.21.33,1,1,0,0,0,0,.76,1,1,0,0,0,.21.33l3,3a1,1,0,0,0,1.42,0,1,1,0,0,0,0-1.42L7.41,14H17a3,3,0,0,0,3-3V7A1,1,0,0,0,19,6Z"/></svg>',audio:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,9H13V14.5A2.5,2.5 0 0,1 10.5,17A2.5,2.5 0 0,1 8,14.5A2.5,2.5 0 0,1 10.5,12C11.07,12 11.58,12.19 12,12.5V7H16V9M19,3A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3H19M5,5V19H19V5H5Z" /></svg>',audio_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20,4H4A2,2 0 0,0 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V6A2,2 0 0,0 20,4M7.76,16.24L6.35,17.65C4.78,16.1 4,14.05 4,12C4,9.95 4.78,7.9 6.34,6.34L7.75,7.75C6.59,8.93 6,10.46 6,12C6,13.54 6.59,15.07 7.76,16.24M12,16A4,4 0 0,1 8,12A4,4 0 0,1 12,8A4,4 0 0,1 16,12A4,4 0 0,1 12,16M17.66,17.66L16.25,16.25C17.41,15.07 18,13.54 18,12C18,10.46 17.41,8.93 16.24,7.76L17.65,6.35C19.22,7.9 20,9.95 20,12C20,14.05 19.22,16.1 17.66,17.66M12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12A2,2 0 0,0 12,10Z" /></svg>',image_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21,17H7V3H21M21,1H7A2,2 0 0,0 5,3V17A2,2 0 0,0 7,19H21A2,2 0 0,0 23,17V3A2,2 0 0,0 21,1M3,5H1V21A2,2 0 0,0 3,23H19V21H3M15.96,10.29L13.21,13.83L11.25,11.47L8.5,15H19.5L15.96,10.29Z" /></svg>',audio_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20,2H8A2,2 0 0,0 6,4V16A2,2 0 0,0 8,18H20A2,2 0 0,0 22,16V4A2,2 0 0,0 20,2M20,16H8V4H20M12.5,15A2.5,2.5 0 0,0 15,12.5V7H18V5H14V10.5C13.58,10.19 13.07,10 12.5,10A2.5,2.5 0 0,0 10,12.5A2.5,2.5 0 0,0 12.5,15M4,6H2V20A2,2 0 0,0 4,22H18V20H4" /></svg>',video_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 6H2V20C2 21.1 2.9 22 4 22H18V20H4V6M20 4V16H8V4H20M20 2H8C6.9 2 6 2.9 6 4V16C6 17.1 6.9 18 8 18H20C21.1 18 22 17.1 22 16V4C22 2.9 21.1 2 20 2M12 14.5V5.5L18 10L12 14.5Z" /></svg>',file_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,15H9V13H16V15M19,11H9V9H19V11M19,7H9V5H19V7M3,5V21H19V23H3A2,2 0 0,1 1,21V5H3M21,1A2,2 0 0,1 23,3V17C23,18.11 22.11,19 21,19H7A2,2 0 0,1 5,17V3C5,1.89 5.89,1 7,1H21M7,3V17H21V3H7Z" /></svg>',file_browser:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 6V20H20V22H2C.895 22 0 21.11 0 20V6H2M12.78 10.05L15.81 9.79L17 7L18.19 9.79L21.22 10.05L18.92 12.04L19.61 15L17 13.47L14.39 15L15.08 12.04L12.78 10.05M24 6V16C24 17.11 23.11 18 22 18H6C4.9 18 4 17.11 4 16V4C4 2.89 4.9 2 6 2H12L14 4H22C23.11 4 24 4.9 24 6M22 6H6V16H22V6Z" /></svg>',bookmark:'<svg viewBox="0 0 24 24"><path d="M17,3H7A2,2 0 0,0 5,5V21L12,18L19,21V5C19,3.89 18.1,3 17,3Z" /></svg>',bookmark_anchor:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17,18L12,15.82L7,18V5H17M17,3H7A2,2 0 0,0 5,5V21L12,18L19,21V5C19,3.89 18.1,3 17,3Z" /></svg>',download:'<svg viewBox="0 0 24 24"><path d="M2 12H4V17H20V12H22V17C22 18.11 21.11 19 20 19H4C2.9 19 2 18.11 2 17V12M12 15L17.55 9.54L16.13 8.13L13 11.25V2H11V11.25L7.88 8.13L6.46 9.55L12 15Z" /></svg>',dir_ltr:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M9 4v4c-1.1 0-2-.9-2-2s.9-2 2-2m8-2H9C6.79 2 5 3.79 5 6s1.79 4 4 4v5h2V4h2v11h2V4h2V2zm0 12v3H5v2h12v3l4-4-4-4z"/></svg>',dir_rtl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M10 4v4c-1.1 0-2-.9-2-2s.9-2 2-2m8-2h-8C7.79 2 6 3.79 6 6s1.79 4 4 4v5h2V4h2v11h2V4h2V2zM8 14l-4 4 4 4v-3h12v-2H8v-3z"/></svg>',dragHandle:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M360-160q-33 0-56.5-23.5T280-240q0-33 23.5-56.5T360-320q33 0 56.5 23.5T440-240q0 33-23.5 56.5T360-160Zm240 0q-33 0-56.5-23.5T520-240q0-33 23.5-56.5T600-320q33 0 56.5 23.5T680-240q0 33-23.5 56.5T600-160ZM360-400q-33 0-56.5-23.5T280-480q0-33 23.5-56.5T360-560q33 0 56.5 23.5T440-480q0 33-23.5 56.5T360-400Zm240 0q-33 0-56.5-23.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 33-23.5 56.5T600-400ZM360-640q-33 0-56.5-23.5T280-720q0-33 23.5-56.5T360-800q33 0 56.5 23.5T440-720q0 33-23.5 56.5T360-640Zm240 0q-33 0-56.5-23.5T520-720q0-33 23.5-56.5T600-800q33 0 56.5 23.5T680-720q0 33-23.5 56.5T600-640Z"/></svg>',file_upload:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2L20,8V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2H14M18,20V9H13V4H6V20H18M12,12L16,16H13.5V19H10.5V16H8L12,12Z" /></svg>',file_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z" /></svg>',file_plus:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13.81 22H6C4.89 22 4 21.11 4 20V4C4 2.9 4.89 2 6 2H14L20 8V13.09C19.67 13.04 19.34 13 19 13S18.33 13.04 18 13.09V9H13V4H6V20H13.09C13.21 20.72 13.46 21.39 13.81 22M23 18H20V15H18V18H15V20H18V23H20V20H23V18Z" /></svg>',upload_tray:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 12H4V17H20V12H22V17C22 18.11 21.11 19 20 19H4C2.9 19 2 18.11 2 17V12M12 2L6.46 7.46L7.88 8.88L11 5.75V15H13V5.75L16.13 8.88L17.55 7.45L12 2Z" /></svg>',folder:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20,18H4V8H20M20,6H12L10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6Z" /></svg>',plus:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z" /></svg>',minus:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,13H5V11H19V13Z" /></svg>',selection:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2,4C2,2.89 2.9,2 4,2H7V4H4V7H2V4M22,4V7H20V4H17V2H20A2,2 0 0,1 22,4M20,20V17H22V20C22,21.11 21.1,22 20,22H17V20H20M2,20V17H4V20H7V22H4A2,2 0 0,1 2,20M10,2H14V4H10V2M10,20H14V22H10V20M20,10H22V14H20V10M2,10H4V14H2V10Z" /></svg>',copy:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z" /></svg>',cut:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,3L13,9L15,11L22,4V3M12,12.5A0.5,0.5 0 0,1 11.5,12A0.5,0.5 0 0,1 12,11.5A0.5,0.5 0 0,1 12.5,12A0.5,0.5 0 0,1 12,12.5M6,20A2,2 0 0,1 4,18C4,16.89 4.9,16 6,16A2,2 0 0,1 8,18C8,19.11 7.1,20 6,20M6,8A2,2 0 0,1 4,6C4,4.89 4.9,4 6,4A2,2 0 0,1 8,6C8,7.11 7.1,8 6,8M9.64,7.64C9.87,7.14 10,6.59 10,6A4,4 0 0,0 6,2A4,4 0 0,0 2,6A4,4 0 0,0 6,10C6.59,10 7.14,9.87 7.64,9.64L10,12L7.64,14.36C7.14,14.13 6.59,14 6,14A4,4 0 0,0 2,18A4,4 0 0,0 6,22A4,4 0 0,0 10,18C10,17.41 9.87,16.86 9.64,16.36L12,14L19,21H22V20L9.64,7.64Z" /></svg>',PDF:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3M9.5 11.5C9.5 12.3 8.8 13 8 13H7V15H5.5V9H8C8.8 9 9.5 9.7 9.5 10.5V11.5M14.5 13.5C14.5 14.3 13.8 15 13 15H10.5V9H13C13.8 9 14.5 9.7 14.5 10.5V13.5M18.5 10.5H17V11.5H18.5V13H17V15H15.5V9H18.5V10.5M12 10.5H13V13.5H12V10.5M7 10.5H8V11.5H7V10.5Z" /></svg>',format_paint:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18,4V3A1,1 0 0,0 17,2H5A1,1 0 0,0 4,3V7A1,1 0 0,0 5,8H17A1,1 0 0,0 18,7V6H19V10H9V21A1,1 0 0,0 10,22H12A1,1 0 0,0 13,21V12H21V4H18Z" /></svg>',drawing:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.75 20.85C11.53 20.15 11.14 18.22 10.24 17C9.35 15.75 8.12 14.89 6.88 14.06C6 13.5 5.19 12.8 4.54 12C4.26 11.67 3.69 11.06 4.27 10.94C4.86 10.82 5.88 11.4 6.4 11.62C7.31 12 8.21 12.44 9.05 12.96L10.06 11.26C8.5 10.23 6.5 9.32 4.64 9.05C3.58 8.89 2.46 9.11 2.1 10.26C1.78 11.25 2.29 12.25 2.87 13.03C4.24 14.86 6.37 15.74 7.96 17.32C8.3 17.65 8.71 18.04 8.91 18.5C9.12 18.94 9.07 18.97 8.6 18.97C7.36 18.97 5.81 18 4.8 17.36L3.79 19.06C5.32 20 7.88 21.47 9.75 20.85M20.84 5.25C21.06 5.03 21.06 4.67 20.84 4.46L19.54 3.16C19.33 2.95 18.97 2.95 18.76 3.16L17.74 4.18L19.82 6.26M11 10.92V13H13.08L19.23 6.85L17.15 4.77L11 10.92Z" /></svg>',eraser:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.14,3C14.63,3 14.12,3.2 13.73,3.59L2.59,14.73C1.81,15.5 1.81,16.77 2.59,17.56L5.03,20H12.69L21.41,11.27C22.2,10.5 22.2,9.23 21.41,8.44L16.56,3.59C16.17,3.2 15.65,3 15.14,3M17,18L15,20H22V18" /></svg>',search:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z" /></svg>',selection_search:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19.27 18.9C19.7 18.21 19.95 17.38 19.95 16.5C19.95 14 17.95 12 15.46 12S10.96 14 10.96 16.5 12.96 21 15.46 21C16.33 21 17.15 20.75 17.84 20.32L20.96 23.39L22.35 22L19.27 18.9M15.46 19C14.07 19 12.96 17.88 12.96 16.5S14.07 14 15.46 14 17.95 15.12 17.95 16.5 16.84 19 15.46 19M22 14H21.45C21.12 13.19 20.62 12.47 20 11.86V10H22V14M20 4H17V2H20C21.11 2 22 2.9 22 4V7H20V4M14 4H10V2H14V4M4 2H7V4H4V7H2V4C2 2.89 2.9 2 4 2M12 22H10V20C10.5 20.82 11.2 21.5 12 22M4 20H7V22H4C2.9 22 2 21.11 2 20V17H4V20M4 14H2V10H4V14Z" /></svg>',embed:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 19H15V21H19C20.1 21 21 20.1 21 19V15H19M19 3H15V5H19V9H21V5C21 3.9 20.1 3 19 3M5 5H9V3H5C3.9 3 3 3.9 3 5V9H5M5 15H3V19C3 20.1 3.9 21 5 21H9V19H5V15M7 11H9V13H7V11M11 11H13V13H11V11M15 11H17V13H15V11Z" /></svg>',finder:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"/></svg>',regex:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M197-199q-56-57-86.5-130T80-482q0-80 30-153t87-130l57 57q-46 45-70 103.5T160-482q0 64 24.5 122.5T254-256l-57 57Zm140.5-58.5Q320-275 320-300t17.5-42.5Q355-360 380-360t42.5 17.5Q440-325 440-300t-17.5 42.5Q405-240 380-240t-42.5-17.5ZM519-440v-71l-61 36-40-70 61-35-61-35 40-70 61 36v-71h80v71l61-36 40 70-61 35 61 35-40 70-61-36v71h-80Zm244 241-57-57q46-45 70-103.5T800-482q0-64-24.5-122.5T706-708l57-57q56 57 86.5 130T880-482q0 80-30 153t-87 130Z"/></svg>',match_case:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="m131-252 165-440h79l165 440h-76l-39-112H247l-40 112h-76Zm139-176h131l-64-182h-4l-63 182Zm395 186q-51 0-81-27.5T554-342q0-44 34.5-72.5T677-443q23 0 45 4t38 11v-12q0-29-20.5-47T685-505q-23 0-42 9.5T610-468l-47-35q24-29 54.5-43t68.5-14q69 0 103 32.5t34 97.5v178h-63v-37h-4q-14 23-38 35t-53 12Zm12-54q35 0 59.5-24t24.5-56q-14-8-33.5-12.5T689-393q-32 0-50 14t-18 37q0 20 16 33t40 13Z"/></svg>',whole_word:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M40-199v-200h80v120h720v-120h80v200H40Zm342-161v-34h-3q-13 20-35 31.5T294-351q-49 0-77-25.5T189-446q0-42 32.5-68.5T305-541q23 0 42.5 3.5T381-526v-14q0-27-18.5-43T312-599q-21 0-39.5 9T241-564l-43-32q19-27 48-41t67-14q62 0 95 29.5t33 85.5v176h-59Zm-66-134q-32 0-49 12.5T250-446q0 20 15 32.5t39 12.5q32 0 54.5-22.5T381-478q-14-8-32-12t-33-4Zm185 134v-401h62v113l-3 40h3q3-5 24-25.5t66-20.5q64 0 101 46t37 106q0 60-36.5 105.5T653-351q-41 0-62.5-18T563-397h-3v37h-59Zm143-238q-40 0-62 29.5T560-503q0 37 22 66t62 29q40 0 62.5-29t22.5-66q0-37-22.5-66T644-598Z"/></svg>',swap_vert:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M320-440v-287L217-624l-57-56 200-200 200 200-57 56-103-103v287h-80ZM600-80 400-280l57-56 103 103v-287h80v287l103-103 57 56L600-80Z"/></svg>',arrow_down_small:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"/></svg>',arrow_up_small:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z"/></svg>',replaceText:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" ><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g><path fill-rule="evenodd" clip-rule="evenodd" d="M3.221 3.739l2.261 2.269L7.7 3.784l-.7-.7-1.012 1.007-.008-1.6a.523.523 0 0 1 .5-.526H8V1H6.48A1.482 1.482 0 0 0 5 2.489V4.1L3.927 3.033l-.706.706zm6.67 1.794h.01c.183.311.451.467.806.467.393 0 .706-.168.94-.503.236-.335.353-.78.353-1.333 0-.511-.1-.913-.301-1.207-.201-.295-.488-.442-.86-.442-.405 0-.718.194-.938.581h-.01V1H9v4.919h.89v-.386zm-.015-1.061v-.34c0-.248.058-.448.175-.601a.54.54 0 0 1 .445-.23.49.49 0 0 1 .436.233c.104.154.155.368.155.643 0 .33-.056.587-.169.768a.524.524 0 0 1-.47.27.495.495 0 0 1-.411-.211.853.853 0 0 1-.16-.532zM9 12.769c-.256.154-.625.231-1.108.231-.563 0-1.02-.178-1.369-.533-.349-.355-.523-.813-.523-1.374 0-.648.186-1.158.56-1.53.374-.376.875-.563 1.5-.563.433 0 .746.06.94.179v.998a1.26 1.26 0 0 0-.792-.276c-.325 0-.583.1-.774.298-.19.196-.283.468-.283.816 0 .338.09.603.272.797.182.191.431.287.749.287.282 0 .558-.092.828-.276v.946zM4 7L3 8v6l1 1h7l1-1V8l-1-1H4zm0 1h7v6H4V8z"></path></g></svg>',relaceTextAll:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g><path fill-rule="evenodd" clip-rule="evenodd" d="M11.6 2.677c.147-.31.356-.465.626-.465.248 0 .44.118.573.353.134.236.201.557.201.966 0 .443-.078.798-.235 1.067-.156.268-.365.402-.627.402-.237 0-.416-.125-.537-.374h-.008v.31H11V1h.593v1.677h.008zm-.016 1.1a.78.78 0 0 0 .107.426c.071.113.163.169.274.169.136 0 .24-.072.314-.216.075-.145.113-.35.113-.615 0-.22-.035-.39-.104-.514-.067-.124-.164-.187-.29-.187-.12 0-.219.062-.297.185a.886.886 0 0 0-.117.48v.272zM4.12 7.695L2 5.568l.662-.662 1.006 1v-1.51A1.39 1.39 0 0 1 5.055 3H7.4v.905H5.055a.49.49 0 0 0-.468.493l.007 1.5.949-.944.656.656-2.08 2.085zM9.356 4.93H10V3.22C10 2.408 9.685 2 9.056 2c-.135 0-.285.024-.45.073a1.444 1.444 0 0 0-.388.167v.665c.237-.203.487-.304.75-.304.261 0 .392.156.392.469l-.6.103c-.506.086-.76.406-.76.961 0 .263.061.473.183.631A.61.61 0 0 0 8.69 5c.29 0 .509-.16.657-.48h.009v.41zm.004-1.355v.193a.75.75 0 0 1-.12.436.368.368 0 0 1-.313.17.276.276 0 0 1-.22-.095.38.38 0 0 1-.08-.248c0-.222.11-.351.332-.389l.4-.067zM7 12.93h-.644v-.41h-.009c-.148.32-.367.48-.657.48a.61.61 0 0 1-.507-.235c-.122-.158-.183-.368-.183-.63 0-.556.254-.876.76-.962l.6-.103c0-.313-.13-.47-.392-.47-.263 0-.513.102-.75.305v-.665c.095-.063.224-.119.388-.167.165-.049.315-.073.45-.073.63 0 .944.407.944 1.22v1.71zm-.64-1.162v-.193l-.4.068c-.222.037-.333.166-.333.388 0 .1.027.183.08.248a.276.276 0 0 0 .22.095.368.368 0 0 0 .312-.17c.08-.116.12-.26.12-.436zM9.262 13c.321 0 .568-.058.738-.173v-.71a.9.9 0 0 1-.552.207.619.619 0 0 1-.5-.215c-.12-.145-.181-.345-.181-.598 0-.26.063-.464.189-.612a.644.644 0 0 1 .516-.223c.194 0 .37.069.528.207v-.749c-.129-.09-.338-.134-.626-.134-.417 0-.751.14-1.001.422-.249.28-.373.662-.373 1.148 0 .42.116.764.349 1.03.232.267.537.4.913.4zM2 9l1-1h9l1 1v5l-1 1H3l-1-1V9zm1 0v5h9V9H3zm3-2l1-1h7l1 1v5l-1 1V7H6z"></path></g></svg>',menu_arrow_down:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7,10L12,15L17,10H7Z" /></svg>',menu_arrow_up:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7,15L12,10L17,15H7Z" /></svg>',menu_arrow_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,17L15,12L10,7V17Z" /></svg>',menu_arrow_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,7L9,12L14,17V7Z" /></svg>',side_menu_hamburger:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z" /></svg>',side_menu_folder:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,4A2,2 0 0,1 24,6V16A2,2 0 0,1 22,18H6A2,2 0 0,1 4,16V4A2,2 0 0,1 6,2H12L14,4H22M2,6V20H20V22H2A2,2 0 0,1 0,20V11H0V6H2M6,6V16H22V6H6Z" /></svg>',side_menu_folder_item:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,4H14L12,2H6A2,2 0 0,0 4,4V16A2,2 0 0,0 6,18H22A2,2 0 0,0 24,16V6A2,2 0 0,0 22,4M2,6H0V11H0V20A2,2 0 0,0 2,22H20V20H2V6Z" /></svg>',side_menu_item:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6H12L10,4Z" /></svg>',side_menu_folder_plus:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 19C13 19.34 13.04 19.67 13.09 20H4C2.9 20 2 19.11 2 18V6C2 4.89 2.89 4 4 4H10L12 6H20C21.1 6 22 6.89 22 8V13.81C21.12 13.3 20.1 13 19 13C15.69 13 13 15.69 13 19M20 18V15H18V18H15V20H18V23H20V20H23V18H20Z" /></svg>',alert_outline:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,15H13V17H11V15M11,7H13V13H11V7M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20Z" /></svg>',more_media:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9 13V5C9 3.9 9.9 3 11 3H20C21.1 3 22 3.9 22 5V11H18.57L17.29 9.26C17.23 9.17 17.11 9.17 17.05 9.26L15.06 12C15 12.06 14.88 12.07 14.82 12L13.39 10.25C13.33 10.18 13.22 10.18 13.16 10.25L11.05 12.91C10.97 13 11.04 13.15 11.16 13.15H17.5V15H11C9.89 15 9 14.11 9 13M6 22V21H4V22H2V2H4V3H6V2H8.39C7.54 2.74 7 3.8 7 5V13C7 15.21 8.79 17 11 17H15.7C14.67 17.83 14 19.08 14 20.5C14 21.03 14.11 21.53 14.28 22H6M4 7H6V5H4V7M4 11H6V9H4V11M4 15H6V13H4V15M6 19V17H4V19H6M23 13V15H21V20.5C21 21.88 19.88 23 18.5 23S16 21.88 16 20.5 17.12 18 18.5 18C18.86 18 19.19 18.07 19.5 18.21V13H23Z" /></svg>',more_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 6V20H18V22H3C2.4 22 2 21.6 2 21V6H4M8 2H20C21.11 2 22 2.9 22 4V16C22 17.11 21.11 18 20 18H8C6.9 18 6 17.11 6 16V4C6 2.9 6.9 2 8 2M16.3 13.3L15.9 10.7L17.8 8.8L15.2 8.4L14 6L12.8 8.4L10.2 8.8L12.1 10.6L11.6 13.2L14 12L16.3 13.3Z" /></svg>',more_folder:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 20V6H0V20C0 21.1 .9 22 2 22H20V20H2M22 4H14L12 2H6C5.6 2 5.2 2.1 4.9 2.3L4.3 2.9C4.1 3.2 4 3.6 4 4V16C4 16.4 4.1 16.8 4.3 17.1C4.4 17.2 4.5 17.3 4.5 17.4C5 17.8 5.5 18 6 18H22C23.1 18 24 17.1 24 16V6C24 4.9 23.1 4 22 4M22 12H19V15H17V12H14V10H17V7H19V10H22V12Z" /></svg>',more_list:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17 14V17H14V19H17V22H19V19H22V17H19V14M20 11V12.3C19.4 12.1 18.7 12 18 12C16.8 12 15.6 12.4 14.7 13H7V11H20M12.1 17H7V15H12.8C12.5 15.6 12.2 16.3 12.1 17M7 7H20V9H7V7M5 19H7V21H3V3H7V5H5V19Z" /></svg>',more_file:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 2H6C4.9 2 4 2.9 4 4V20C4 21.1 4.9 22 6 22H18C19.1 22 20 21.1 20 20V8L14 2M18 20H6V4H13V9H18V20M9.5 18L10.2 15.2L8 13.3L10.9 13.1L12 10.4L13.1 13L16 13.2L13.8 15.1L14.5 17.9L12 16.5L9.5 18Z" /></svg>',more_view:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 21H11V13H3M5 15H9V19H5M3 11H11V3H3M5 5H9V9H5M13 3V11H21V3M19 9H15V5H19M18 16H21V18H18V21H16V18H13V16H16V13H18Z" /></svg>',more_page:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,3H5A2,2 0 0,0 3,5V9H5V5H22V19H5V15H3V19A2,2 0 0,0 5,21H22A2,2 0 0,0 24,19V5A2,2 0 0,0 22,3M7,15V13H0V11H7V9L11,12L7,15M20,13H13V11H20V13M20,9H13V7H20V9M17,17H13V15H17V17Z" /></svg>',more_text:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="10 10 180 180"><g><path d="M49.711,142.188h49.027c2.328,0.002,4.394,1.492,5.129,3.699l9.742,29.252c0.363,1.092,1.385,1.828,2.537,1.83l15.883,0.01c0.859,0,1.667-0.412,2.17-1.109s0.641-1.594,0.37-2.41l-16.625-50.045L86.503,28.953c-0.36-1.097-1.383-1.839-2.537-1.842H64.532c-1.153-0.001-2.178,0.736-2.542,1.831L13.847,173.457c-0.271,0.816-0.135,1.713,0.369,2.412c0.503,0.697,1.311,1.109,2.171,1.109h15.872c1.151,0,2.173-0.736,2.537-1.828l9.793-29.287C45.325,143.66,47.39,142.18,49.711,142.188L49.711,142.188z M53.493,119.098l15.607-46.9c0.744-2.196,2.806-3.674,5.125-3.674s4.381,1.478,5.125,3.674l15.607,46.904c0.537,1.621,0.263,3.402-0.736,4.789c-1.018,1.408-2.649,2.24-4.386,2.24H58.615c-1.736,0-3.368-0.832-4.386-2.24C53.23,122.504,52.956,120.721,53.493,119.098L53.493,119.098z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.633,190.465,66.178,190.465,63.32L190.465,63.32z M190.465,101.994c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.887,1.026,5.352,3.056,7.395c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.994L190.465,101.994z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_paragraph:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="10 10 180 180"><g><path d="M128.39,28.499H63.493c-25.558,0-46.354,20.796-46.354,46.354c0,25.559,20.796,46.353,46.354,46.353h9.271v55.625h18.542V47.04h9.271V176.83h18.543V47.04h9.271V28.499z M72.764,102.664h-9.271c-15.337,0-27.813-12.475-27.813-27.812c0-15.336,12.476-27.813,27.813-27.813h9.271V102.664z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.633,190.465,66.178,190.465,63.32L190.465,63.32z M190.465,101.994c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.887,1.026,5.352,3.056,7.395c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.994L190.465,101.994z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_plus:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="35 30 140 140"><g><path d="M137.215,102.045c0,3.498-2.835,6.332-6.333,6.332H24.549c-3.498,0-6.334-2.834-6.334-6.332l0,0c0-3.498,2.836-6.333,6.334-6.333h106.333C134.38,95.711,137.215,98.547,137.215,102.045L137.215,102.045z M77.715,161.545c-3.498,0-6.333-2.836-6.333-6.334V48.878c0-3.498,2.836-6.333,6.333-6.333l0,0c3.498,0,6.334,2.835,6.334,6.333v106.333C84.049,158.709,81.213,161.545,77.715,161.545L77.715,161.545z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.632,190.465,66.177,190.465,63.32L190.465,63.32z M190.465,101.993c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.888,1.026,5.353,3.056,7.396c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.993L190.465,101.993z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_horizontal:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,12A2,2 0 0,1 18,10A2,2 0 0,1 20,12A2,2 0 0,1 18,14A2,2 0 0,1 16,12M10,12A2,2 0 0,1 12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12M4,12A2,2 0 0,1 6,10A2,2 0 0,1 8,12A2,2 0 0,1 6,14A2,2 0 0,1 4,12Z" /></svg>',more_vertical:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z" /></svg>',more_flag:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M360-160q-19 0-36-8.5T296-192L80-480l216-288q11-15 28-23.5t36-8.5h440q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H360ZM180-480l180 240h440v-480H360L180-480Zm248.5 28.5Q440-463 440-480t-11.5-28.5Q417-520 400-520t-28.5 11.5Q360-497 360-480t11.5 28.5Q383-440 400-440t28.5-11.5Zm140 0Q580-463 580-480t-11.5-28.5Q557-520 540-520t-28.5 11.5Q500-497 500-480t11.5 28.5Q523-440 540-440t28.5-11.5Zm140 0Q720-463 720-480t-11.5-28.5Q697-520 680-520t-28.5 11.5Q640-497 640-480t11.5 28.5Q663-440 680-440t28.5-11.5ZM580-480Z"/></svg>',as_inline:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,7L13,17H3L8,7M3,3H21V5H3V3M21,15V17H14V15H21M3,19H21V21H3V19Z" /></svg>',as_block:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,7L17,17H7L12,7M3,3H21V5H3V3M3,19H21V21H3V19Z" /></svg>',page_break:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18,20H6V18H4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V18H18V20M14,2H6A2,2 0 0,0 4,4V12H6V4H14V8H18V12H20V8L14,2M11,16H8V14H11V16M16,16H13V14H16V16M3,14H6V16H3V14M21,16H18V14H21V16Z" /></svg>',page_down:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,6H13V14L16.5,10.5L17.92,11.92L12,17.84L6.08,11.92L7.5,10.5L11,14V6M12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20Z" /></svg>',page_up:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,18H11V10L7.5,13.5L6.08,12.08L12,6.16L17.92,12.08L16.5,13.5L13,10V18M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z" /></svg>',collapse_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.92,19.92L4,12L11.92,4.08L13.33,5.5L7.83,11H22V13H7.83L13.34,18.5L11.92,19.92M4,12V2H2V22H4V12Z" /></svg>',collapse_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.08,4.08L20,12L12.08,19.92L10.67,18.5L16.17,13H2V11H16.17L10.67,5.5L12.08,4.08M20,12V22H22V2H20V12Z" /></svg>',map:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11.7 15.62"><g><path d="M12.05,12.42a2.93,2.93,0,1,1,2.07-5A2.88,2.88,0,0,1,15,9.49a3,3,0,0,1-.86,2.07,2.89,2.89,0,0,1-2.07.86Zm0-5.36a2.43,2.43,0,0,0-1.72,4.16,2.48,2.48,0,0,0,1.72.72,2.44,2.44,0,0,0,0-4.88Zm0-3.3A5.84,5.84,0,0,1,17.9,9.62a9.94,9.94,0,0,1-1.73,5A33.59,33.59,0,0,1,12.84,19a1.52,1.52,0,0,1-.23.2,1,1,0,0,1-.55.2h0a1,1,0,0,1-.55-.2,1.52,1.52,0,0,1-.23-.2,33.59,33.59,0,0,1-3.33-4.32,9.93,9.93,0,0,1-1.72-5,5.84,5.84,0,0,1,5.85-5.86ZM12,18.34l.08.05.06-.06a35.58,35.58,0,0,0,3.06-3.93,9.35,9.35,0,0,0,1.74-4.77,4.88,4.88,0,0,0-4.88-4.88A4.79,4.79,0,0,0,8.6,6.17,4.84,4.84,0,0,0,7.17,9.62,9.29,9.29,0,0,0,8.91,14.4,36,36,0,0,0,12,18.34Z" transform="translate(-6.2 -3.76)"/></g></svg>',magic_stick:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 15.75"><g><path d="M19.86,19.21a1,1,0,0,0,.28-.68,1,1,0,0,0-.28-.7L13,10.93a1,1,0,0,0-.7-.28,1,1,0,0,0-.68,1.65l6.9,6.9a1,1,0,0,0,.69.29.93.93,0,0,0,.69-.28ZM9.19,8.55a3,3,0,0,0,1.68,0,14.12,14.12,0,0,0,1.41-.32A11.26,11.26,0,0,0,10.8,7.06c-.56-.36-.86-.56-.91-.58S10,5.91,10,5.11s0-1.26-.15-1.37a4.35,4.35,0,0,0-1.19.71c-.53.4-.81.62-.87.68a9,9,0,0,0-2-.6,6.84,6.84,0,0,0-.76-.09s0,.27.08.77a8.6,8.6,0,0,0,.61,2q-.09.09-.69.87a3.59,3.59,0,0,0-.68,1.17c.12.17.57.23,1.36.15S7,9.26,7.15,9.23s.21.36.57.91a10.49,10.49,0,0,0,1.14,1.48c0-.1.14-.57.31-1.4a3,3,0,0,0,0-1.67Z" transform="translate(-4.41 -3.74)"/></g></svg>',open_in_new:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z" /></svg>'};var We=s("cfbI"),Ue=s.n(We);function Ze(t,e,s,i,n){const o=new Map([["menuTray",s],["toolbar_main",t],["toolbar_buttonTray",t.querySelector(".se-btn-tray")],["toolbar_arrow",t.querySelector(".se-arrow")]]);return i&&(o.set("toolbar_sub_main",i),o.set("toolbar_sub_buttonTray",i.querySelector(".se-btn-tray")),o.set("toolbar_sub_arrow",i.querySelector(".se-arrow")),o.set("toolbar_sub_wrapper",i.parentElement.parentElement)),e&&(o.set("toolbar_wrapper",e.querySelector(".sun-editor")),o.set("_stickyDummy",e.querySelector(".se-toolbar-sticky-dummy"))),n&&o.set("statusbar_wrapper",n.querySelector(".sun-editor")),o}function Ge(t,e,s,i,n,o,l,r,a,h,c){const d=new Map([["key",c],["options",t.options],["originElement",t.target],["topArea",e],["container",e.querySelector(".se-container")],["wrapper",e.querySelector(".se-wrapper")],["wysiwygFrame",s],["wysiwyg",s],["codeWrapper",i],["code",n],["codeNumbers",i?.querySelector(".se-code-view-line")],["markdownWrapper",o],["markdown",l],["markdownNumbers",o?.querySelector(".se-markdown-view-line")],["lineBreaker_t",e.querySelector(".se-line-breaker-component-t")],["lineBreaker_b",e.querySelector(".se-line-breaker-component-b")],["blockHandleArea",h],["blockHandle",h?.querySelector(".se-block-handle")||null],["blockHandlePlus",h?.querySelector(".se-block-handle-plus")||null],["blockHandleDrag",h?.querySelector(".se-block-handle-drag")||null],["_stickyDummy",e.querySelector(".se-toolbar-sticky-dummy")],["_toolbarShadow",e.querySelector(".se-toolbar-shadow")],["_minHeight",L(s.style.minHeight||"65",0)],["isCodeView",!1],["isMarkdownView",!1],["isFullScreen",!1],["isReadOnly",!1],["isDisabled",!1],["isChanged",!1],["historyIndex",-1],["savedIndex",-1],["documentTypeInner",a.inner],["documentTypePage",a.page],["documentTypePageMirror",a.pageMirror]]);r&&je(r,d);const u=e.querySelector(".se-placeholder");u&&d.set("placeholder",u);const p=t.options.get("placeholder_line");return p&&d.set("placeholder_line",p),d}function je(t,e){t?e.set("statusbar",t):e.delete("statusbar");const s=t?t.querySelector(".se-navigation"):null,i=t?t.querySelector(".se-char-counter-wrapper"):null,n=t?t.querySelector(".se-char-counter-wrapper .se-char-counter"):null;s?e.set("navigation",s):e.delete("navigation"),i?e.set("charWrapper",i):e.delete("charWrapper"),n?e.set("charCounter",n):e.delete("charCounter");const o=t?t.querySelector(".se-word-counter-wrapper"):null,l=t?t.querySelector(".se-word-counter-wrapper .se-word-counter"):null;o?e.set("wordWrapper",o):e.delete("wordWrapper"),l?e.set("wordCounter",l):e.delete("wordCounter")}const Ke={BUTTON_LIST:[["undo","redo"],"|",["bold","underline","italic","strike","|","subscript","superscript"],"|",["removeFormat"],"|",["outdent","indent"],"|",["fullScreen","showBlocks","codeView"],"|",["preview","print"]],REQUIRED_FORMAT_LINE:"div",REQUIRED_ELEMENT_WHITELIST:"br|div",ELEMENT_WHITELIST:"p|pre|blockquote|h1|h2|h3|h4|h5|h6|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|colgroup|col|thead|tbody|tr|th|td|caption|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code|svg|path|details|summary",TEXT_STYLE_TAGS:"strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary",SCOPE_SELECTION_TAGS:["td","table","li","ol","ul","pre","figcaption","blockquote","dl","dt","dd"],ATTRIBUTE_WHITELIST:"contenteditable|target|href|title|download|rel|src|alt|class|type|colspan|rowspan|width|height|controls|autoplay|loop|muted|poster|preload|playsinline|volume|crossorigin|disableRemotePlayback|controlsList|allowfullscreen|sandbox|loading|allow|referrerpolicy|frameborder|scrolling",FORMAT_LINE:"P|H[1-6]|LI|TH|TD|DETAILS",FORMAT_BR_LINE:"PRE",FORMAT_CLOSURE_BR_LINE:"",FORMAT_BLOCK:"BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|CAPTION|DETAILS",FORMAT_CLOSURE_BLOCK:"TH|TD",ALLOWED_EMPTY_NODE_LIST:".se-component, pre, blockquote, hr, li, table, img, iframe, video, audio, canvas, details",SIZE_UNITS:["px","pt","em","rem"],CLASS_NAME:"^__se__|^se-|^katex|^MathJax|^language-",CLASS_MJX:"mjx-container|mjx-math|mjx-mrow|mjx-mi|mjx-mo|mjx-mn|mjx-msup|mjx-mfrac|mjx-munderover",EXTRA_TAG_MAP:{script:!1,style:!1,meta:!1,link:!1,"[a-z]+:[a-z]+":!1},CONTENT_STYLES:"background|background-clip|background-color|border|border-bottom|border-collapse|border-color|border-image|border-left-width|border-radius|border-right-width|border-spacing|border-style|border-top|border-width|box-shadow|box-sizing|caption-side|color|content|direction|display|position|float|font|font-family|font-size|font-style|font-weight|height|min-height|max-height|width|min-width|max-width|left|letter-spacing|line-height|list-style-position|list-style-type|margin|margin-block-end|margin-block-start|margin-bottom|margin-inline-end|margin-inline-start|margin-left|margin-right|margin-top|padding|padding-bottom|padding-inline-start|padding-left|padding-right|padding-top|outline|overflow|page-break-before|page-break-after|page-break-inside|rotate|rotateX|rotateY|table-layout|text-align|text-decoration|text-shadow|text-transform|top|text-indent|text-rendering|vertical-align|visibility|white-space|word-break|word-wrap",TAG_STYLES:{"@text":"font-family|font-size|color|background-color|width|height","@line":"text-align|margin|margin-left|margin-right|line-height","@component":"width|height|min-width","table|th|td":"border|border-[a-z]+|color|background-color|text-align|float|font-weight|text-decoration|font-style|vertical-align","table|td":"width",tr:"height",col:"width",caption:"text-align|caption-side","ol|ul":"list-style-type",figure:"display|width|height|padding|padding-bottom",figcaption:"margin|margin-top|margin-bottom|text-align","img|video|iframe":"transform|transform-origin|width|min-width|max-width|height|min-height|max-height|float|margin|margin-top",hr:""},RETAIN_STYLE_MODE:["repeat","always","none"]},Ye={value:"fixed",placeholder:!0,placeholder_line:!0,editableFrameAttributes:!0,width:!0,minWidth:!0,maxWidth:!0,innerWidth:"fixed",height:!0,minHeight:!0,maxHeight:!0,editorStyle:!0,iframe:"fixed",iframe_fullPage:"fixed",iframe_attributes:!0,iframe_cssFileName:!0,statusbar:!0,statusbar_showPathLabel:!0,statusbar_resizeEnable:"fixed",charCounter:!0,charCounter_max:!0,charCounter_label:!0,charCounter_type:!0,wordCounter:!0,wordCounter_label:!0},Xe={plugins:"fixed",excludedPlugins:"fixed",buttonList:"fixed",v2Migration:"fixed",strictMode:"fixed",mode:"fixed",blockHandle:"fixed",type:"fixed",theme:!0,lang:"fixed",fontSizeUnits:"fixed",allowedClassName:"fixed",closeModalOutsideClick:"fixed",copyFormatKeepOn:!0,syncTabIndent:!0,tabDisable:!0,autoLinkify:!0,autoStyleify:!0,retainStyleMode:!0,allowedExtraTags:"fixed",events:!0,__textStyleTags:"fixed",textStyleTags:"fixed",convertTextTags:"fixed",__tagStyles:"fixed",tagStyles:"fixed",textDirection:!0,reverseButtons:"fixed",historyStackDelayTime:!0,historyStackSize:"fixed",lineAttrReset:!0,printClass:!0,defaultLine:"fixed",defaultLineBreakFormat:!0,scopeSelectionTags:!0,__defaultElementWhitelist:"fixed",elementWhitelist:"fixed",elementBlacklist:"fixed",__defaultAttributeWhitelist:"fixed",attributeWhitelist:"fixed",attributeBlacklist:"fixed",__defaultFormatLine:"fixed",formatLine:"fixed",__defaultFormatBrLine:"fixed",formatBrLine:"fixed",__defaultFormatClosureBrLine:"fixed",formatClosureBrLine:"fixed",__defaultFormatBlock:"fixed",formatBlock:"fixed",__defaultFormatClosureBlock:"fixed",formatClosureBlock:"fixed",allowedEmptyTags:!0,toolbar_width:!0,toolbar_innerWidth:"fixed",toolbar_container:"fixed",toolbar_sticky:!0,toolbar_hide:!0,subToolbar:"fixed",statusbar_container:"fixed",shortcutsHint:!0,shortcutsDisable:"fixed",shortcuts:"fixed",fullScreenOffset:!0,previewTemplate:!0,printTemplate:!0,componentInsertBehavior:!0,defaultUrlProtocol:!0,allUsedStyles:"fixed",toastMessageTime:!0,icons:"fixed",freeCodeViewMode:!0,finder_panel:"fixed",finder_liveSearch:!0,__lineFormatFilter:!0,__pluginRetainFilter:!0,__listCommonStyle:"fixed",externalLibs:"fixed"},Je=Ae._d;let Qe=0;function ts(t,e,s,i,n,o){if(!s||s.length<2)return;const l=e?.querySelector(".se-tooltip-text");for(let r,a,h,c,d,u,p,g,m,f,v,b,y,C,w=0;w<s.length;w+=2+C){if(C=0,r=s[w].split("+"),m=null,f=r.at(-1).trim?.(),f.startsWith("~"))m=t,f=r.pop().trim().substring(1);else if(f.startsWith("$~")){const t=r.pop().trim().substring(2).split(".");m=t[0],f=t[1]}else f.startsWith("$")?(C=1,f=s[w+2]):f="";h=c=d=u=p=g=a=null;for(const t of r)switch(t.trim()){case"c":h=!0;break;case"!":d=!0;break;case"s":c=!0;break;case"_":u=!0;break;case"=":g=!0;break;case"/":p=!0;break;default:a=t}a=a.split("|");for(let s=0,l=a.length;s<l;s++)b=h?a[s]+(c?"1000":""):a[s],i.has(b)||(y=n.indexOf(t),y=-1===y?"":Oe.isOdd(y)?n[y+1]:n[y-1],y&&o.add(b),i.set(b,{c:h,s:c,edge:d,space:u,enter:p,textTrigger:g,plugin:m,command:t,method:f,r:y,type:e?.getAttribute("data-type"),button:e,key:b}));(v=s[w+1])&&(l&&es(l,c,v))}}function es(t,e,s){const i=Ve.utils.createElement("SPAN",{class:"se-shortcut"},Ae.cmdIcon+(e?Ae.shiftIcon:"")+'+<span class="se-shortcut-key">'+s+"</span>"),n=t.querySelector(".se-shortcut");n?t.replaceChild(i,n):t.appendChild(i)}function ss(t,e){return[t,e].reduce(((t,e)=>{for(const s in e)t[s]=(e[s]||"").toLowerCase();return t}),{})}function is(t,e,s){const i=t.buttonList||Ke.BUTTON_LIST,n=new Map;if(e.length>1&&!t.toolbar_container&&!/inline|balloon/i.test(t.mode))throw Error('[SUNEDITOR.create.fail] In multi root, The "mode" option cannot be "classic" without using the "toolbar_container" option.');n.set("v2Migration",!!t.v2Migration),n.set("buttons",new Set(i.toString().split(","))),n.set("strictMode",{tagFilter:!0,formatFilter:!0,classFilter:!0,textStyleTagFilter:!0,attrFilter:!0,styleFilter:!0,..."boolean"==typeof t.strictMode?{}:t.strictMode}),n.set("freeCodeViewMode",!!t.freeCodeViewMode),n.set("finder_panel",!1!==t.finder_panel),n.set("finder_liveSearch",!1!==t.finder_liveSearch),n.set("__lineFormatFilter",t.__lineFormatFilter??!0),n.set("__pluginRetainFilter",t.__pluginRetainFilter??!0);const[o,l]=(t.mode||"classic").split(":");n.set("mode",o),n.set("_toolbar_bottom","bottom"===l&&/^(classic|inline)$/i.test(o)),n.set("blockHandle",t.blockHandle?"object"==typeof t.blockHandle?t.blockHandle:{}:null),n.set("type",t.type?.split(":")[0]||""),n.set("theme",t.theme||""),n.set("_themeClass",t.theme?` se-theme-${t.theme}`:""),n.set("_type_options",t.type?.split(":")[1]||""),n.set("externalLibs",t.externalLibs||{}),n.set("fontSizeUnits",Array.isArray(t.fontSizeUnits)&&t.fontSizeUnits.length>0?t.fontSizeUnits.map((t=>t.toLowerCase())):Ke.SIZE_UNITS),n.set("allowedClassName",new RegExp(`${t.allowedClassName&&"string"==typeof t.allowedClassName?t.allowedClassName+"|":""}${Ke.CLASS_NAME}`)),n.set("closeModalOutsideClick",!!t.closeModalOutsideClick),n.set("copyFormatKeepOn",!!t.copyFormatKeepOn),n.set("syncTabIndent",t.syncTabIndent??!0),n.set("autoLinkify",t.autoLinkify??!!s.link),n.set("autoStyleify",Array.isArray(t.autoStyleify)?t.autoStyleify:["bold","underline","italic","strike"]);let r=t.retainStyleMode||"repeat";"string"!=typeof r||Ke.RETAIN_STYLE_MODE.includes(r)||(console.error(`Invalid retainStyleMode: ${r}. Valid options are ${Ke.RETAIN_STYLE_MODE.join(", ")}. Using default 'repeat'.`),r="repeat"),n.set("retainStyleMode",r);const a={...Ke.EXTRA_TAG_MAP,...t.allowedExtraTags,"-":!0},h=Object.keys(a),c=h.filter((t=>a[t])).join("|"),d=h.filter((t=>!a[t])).join("|");n.set("_allowedExtraTag",c),n.set("_disallowedExtraTag",d),n.set("events",t.events||{}),n.set("textStyleTags",("string"==typeof t.__textStyleTags?t.__textStyleTags:Ke.TEXT_STYLE_TAGS)+(t.textStyleTags?"|"+t.textStyleTags:""));const u=ss({bold:"strong",underline:"u",italic:"em",strike:"del",subscript:"sub",superscript:"sup"},t.convertTextTags||{});n.set("convertTextTags",u),n.set("_textStyleTags",Object.values(u).concat(["span","li"])),n.set("tagStyles",[{...Ke.TAG_STYLES,...t.__tagStyles||{}},t.tagStyles||{}].reduce(((t,e)=>{for(const s in e)t[s]=e[s];return t}),{})),n.set("_defaultStyleTagMap",{strong:u.bold,b:u.bold,u:u.underline,ins:u.underline,em:u.italic,i:u.italic,del:u.strike,strike:u.strike,s:u.strike,sub:u.subscript,sup:u.superscript}),n.set("_styleCommandMap",ss(Ie.swapKeyValue(u),{strong:"bold",b:"bold",u:"underline",ins:"underline",em:"italic",i:"italic",del:"strike",strike:"strike",s:"strike",sub:"subscript",sup:"superscript"})),n.set("_defaultTagCommand",{bold:u.bold,underline:u.underline,italic:u.italic,strike:u.strike,subscript:u.sub,superscript:u.sup}),n.set("textDirection",t.textDirection??"ltr"),n.set("_rtl","rtl"===n.get("textDirection")),n.set("reverseCommands",["indent-outdent"].concat(t.reverseButtons||[])),n.set("_reverseCommandArray",("-"+n.get("reverseCommands").join("-")).split("-")),Oe.isEven(n.get("_reverseCommandArray").length)&&console.warn('[SUNEDITOR.create.warning] The "reverseCommands" option is invalid, Shortcuts key may not work properly.'),n.set("historyStackDelayTime","number"==typeof t.historyStackDelayTime?t.historyStackDelayTime:400),n.set("historyStackSize","number"==typeof t.historyStackSize&&t.historyStackSize>0?t.historyStackSize:100),n.set("_editableClass","sun-editor-editable"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")+("document"===n.get("type")?" se-type-document-editable-a4":"")),n.set("lineAttrReset",["id"].concat(t.lineAttrReset&&"string"==typeof t.lineAttrReset?t.lineAttrReset.toLowerCase().split("|"):[])),n.set("printClass","string"==typeof t.printClass?t.printClass+" "+n.get("_editableClass"):null),n.set("defaultLine","string"==typeof t.defaultLine&&t.defaultLine.length>0?t.defaultLine:"p"),n.set("defaultLineBreakFormat",t.defaultLineBreakFormat||"line"),n.set("scopeSelectionTags",t.scopeSelectionTags||Ke.SCOPE_SELECTION_TAGS);const p=("string"==typeof t.elementWhitelist?t.elementWhitelist:"").toLowerCase(),g=n.get("externalLibs").mathjax?Ke.CLASS_MJX+"|":"";n.set("elementWhitelist",p+(p?"|":"")+g+n.get("_allowedExtraTag"));const m=(f=("string"==typeof t.elementBlacklist?t.elementBlacklist:"").toLowerCase(),v=(v=n.get("defaultLine")).toLowerCase(),f.split("|").filter((function(t){return t!==v||(console.warn(`[SUNEDITOR.constructor.createBlacklist.warn] defaultLine("<${v}>") cannot be included in the blacklist and will be removed.`),!1)})).join("|"));var f,v;if(n.set("elementBlacklist",m+(m?"|":"")+n.get("_disallowedExtraTag")),n.set("attributeWhitelist",t.attributeWhitelist&&"object"==typeof t.attributeWhitelist?t.attributeWhitelist:null),n.set("attributeBlacklist",t.attributeBlacklist&&"object"==typeof t.attributeBlacklist?t.attributeBlacklist:null),n.set("formatClosureBrLine",as(t.formatClosureBrLine,(t.__defaultFormatClosureBrLine="string"==typeof t.__defaultFormatClosureBrLine?t.__defaultFormatClosureBrLine:Ke.FORMAT_CLOSURE_BR_LINE).toLowerCase(),n.get("elementBlacklist"))),n.set("formatBrLine",as((t.formatBrLine||"")+"|"+n.get("formatClosureBrLine").str,(t.__defaultFormatBrLine="string"==typeof t.__defaultFormatBrLine?t.__defaultFormatBrLine:Ke.FORMAT_BR_LINE).toLowerCase(),n.get("elementBlacklist"))),n.set("formatLine",as(Ke.REQUIRED_FORMAT_LINE+"|"+(t.formatLine||"")+"|"+n.get("formatBrLine").str,(t.__defaultFormatLine="string"==typeof t.__defaultFormatLine?t.__defaultFormatLine:Ke.FORMAT_LINE).toLowerCase(),n.get("elementBlacklist"))),!n.get("formatLine").reg.test(n.get("defaultLine")))throw Error(`[SUNEDITOR.create.fail] The "defaultLine(${n.get("defaultLine")})" option must be included in the "formatLine(${n.get("formatLine").str})" option.`);n.set("formatClosureBlock",as(t.formatClosureBlock,(t.__defaultFormatClosureBlock="string"==typeof t.__defaultFormatClosureBlock?t.__defaultFormatClosureBlock:Ke.FORMAT_CLOSURE_BLOCK).toLowerCase(),n.get("elementBlacklist"))),n.set("formatBlock",as((t.formatBlock||"")+"|"+n.get("formatClosureBlock").str,(t.__defaultFormatBlock="string"==typeof t.__defaultFormatBlock?t.__defaultFormatBlock:Ke.FORMAT_BLOCK).toLowerCase(),n.get("elementBlacklist"))),n.set("allowedEmptyTags",Ke.ALLOWED_EMPTY_NODE_LIST+(t.allowedEmptyTags?", "+t.allowedEmptyTags:"")),n.set("__defaultElementWhitelist",Ke.REQUIRED_ELEMENT_WHITELIST+"|"+("string"==typeof t.__defaultElementWhitelist?t.__defaultElementWhitelist:Ke.ELEMENT_WHITELIST).toLowerCase()),n.set("__defaultAttributeWhitelist",("string"==typeof t.__defaultAttributeWhitelist?t.__defaultAttributeWhitelist:Ke.ATTRIBUTE_WHITELIST).toLowerCase()),n.set("_editorElementWhitelist","*"===n.get("elementWhitelist")?"*":function(t){const e=t.get("elementBlacklist").split("|"),s=(t.get("__defaultElementWhitelist")+"|"+t.get("elementWhitelist")+"|"+t.get("formatLine").str+"|"+t.get("formatBrLine").str+"|"+t.get("formatClosureBlock").str+"|"+t.get("formatClosureBrLine").str).replace(/(^\||\|$)/g,"").split("|").filter(((t,s,i)=>t&&i.indexOf(t)===s&&!e.includes(t)));return s.join("|")}(n)),n.set("toolbar_width",t.toolbar_width?Oe.is(t.toolbar_width)?t.toolbar_width+"px":t.toolbar_width:"auto"),n.set("toolbar_innerWidth",t.toolbar_innerWidth?Oe.is(t.toolbar_innerWidth)?t.toolbar_innerWidth+"px":t.toolbar_innerWidth:""),n.set("toolbar_container",t.toolbar_container&&!/inline/i.test(n.get("mode"))?"string"==typeof t.toolbar_container?Je.querySelector(t.toolbar_container):t.toolbar_container:null);const b=t.toolbar_sticky;/balloon/i.test(n.get("mode"))?(n.set("_toolbar_sticky",-1),n.set("_toolbar_sticky_offset",0)):null!==b&&"object"==typeof b?(n.set("_toolbar_sticky",Oe.get(b.top,0)),n.set("_toolbar_sticky_offset",Oe.get(b.offset,0))):(n.set("_toolbar_sticky",void 0===b?0:Oe.is(b)?b:-1),n.set("_toolbar_sticky_offset",0)),n.set("toolbar_hide",!!t.toolbar_hide);let y=null;const C=t.subToolbar;C?.buttonList?.length>0&&(/balloon/.test(n.get("mode"))?console.warn('[SUNEDITOR.create.subToolbar.fail] When the "mode" option is "balloon-*", the "subToolbar" option is omitted.'):(n.set("_subMode",C.mode||"balloon"),n.set("toolbar_sub_width",C.width?Oe.is(C.width)?C.width+"px":C.width:"auto"),y=n.get("_rtl")?C.buttonList.reverse():C.buttonList,n.set("buttons_sub",new Set(y.toString().split(",")))));const w=new Map;for(let s=0,i=e.length;s<i;s++)w.set(e[s].key,os(e[s].options||{},t));n.set("tabDisable",!!t.tabDisable),n.set("shortcutsHint",void 0===t.shortcutsHint||!!t.shortcutsHint);const _=void 0!==t.shortcutsDisable&&t.shortcutsDisable?{}:[{selectAll:["c+KeyA","A"],bold:["c+KeyB","B"],strike:["c+s+KeyS","S"],underline:["c+KeyU","U"],italic:["c+KeyI","I"],redo:["c+KeyY","Y","c+s+KeyZ","Z"],undo:["c+KeyZ","Z"],indent:["c+BracketRight","]"],outdent:["c+BracketLeft","["],save:["c+KeyS","S"],...n.get("finder_panel")?{finder:["c+KeyF","F"]}:{},link:["c+KeyK","K"],hr:["!+---+=+~shortcut",""],list_numbered:["!+1.+_+~shortcut",""],list_bulleted:["!+*.+_+~shortcut",""],_h1:["c+s+Digit1|Numpad1+$~blockStyle.applyHeaderByShortcut",""],_h2:["c+s+Digit2|Numpad2+$~blockStyle.applyHeaderByShortcut",""],_h3:["c+s+Digit3|Numpad3+$~blockStyle.applyHeaderByShortcut",""]},t.shortcuts||{}].reduce(((t,e)=>{for(const s in e)t[s]=e[s];return t}),{});n.set("shortcuts",_),n.set("fullScreenOffset",void 0===t.fullScreenOffset?0:Oe.is(t.fullScreenOffset)?Oe.get(t.fullScreenOffset,0):0),n.set("previewTemplate","string"==typeof t.previewTemplate?t.previewTemplate:null),n.set("printTemplate","string"==typeof t.printTemplate?t.printTemplate:null),n.set("componentInsertBehavior",["auto","select","line","none"].includes(t.componentInsertBehavior)?t.componentInsertBehavior:"auto"),n.set("defaultUrlProtocol","string"==typeof t.defaultUrlProtocol?t.defaultUrlProtocol:null);const x=n.get("externalLibs").codeMirror;x&&(n.set("codeMirror",x),x.src?n.set("codeMirrorEditor",!0):(console.warn("[SUNEDITOR.options.externalLibs.codeMirror.fail] The codeMirror option is set incorrectly. See: https://github.com/ARA-developer/suneditor/blob/develop/guide/external-libraries.md"),n.set("codeMirror",null))),n.set("__listCommonStyle",t.__listCommonStyle||["fontSize","color","fontFamily","fontWeight","fontStyle"]);const $=t.icons&&"object"==typeof t.icons?[qe,t.icons].reduce(((t,e)=>{for(const s in e)t[s]=e[s];return t}),{}):qe;n.set("icons",$);const k=new Set(Ke.CONTENT_STYLES.split("|")),S=n.get("__listCommonStyle");for(const t of Object.values(n.get("tagStyles"))){const e=t.split("|");for(let t=0,s=e.length;t<s;t++)k.add(e[t])}for(let t=0,e=S.length;t<e;t++)k.add(S[t]);const E=("string"==typeof t.allUsedStyles?t.allUsedStyles.split("|"):t.allUsedStyles)||[];for(let t=0,e=E.length;t<e;t++)k.add(E[t]);return n.set("allUsedStyles",k),n.set("toastMessageTime",{copy:1500,...t.toastMessageTime}),{o:n,i:$,l:t.lang||Ue(),v:t.value="string"==typeof t.value?t.value:null,buttons:n.get("_rtl")?i.reverse():i,subButtons:y,statusbarContainer:"string"==typeof t.statusbar_container?Je.querySelector(t.statusbar_container):t.statusbar_container,frameMap:w}}function ns(t,e){let s=null,i=null,n=null,o=null,l=null;if(t.get("statusbar")){if(e||=Ve.utils.createElement("DIV",{class:"se-status-bar sun-editor-common"}),s=e.querySelector(".se-navigation")||Ve.utils.createElement("DIV",{class:"se-navigation sun-editor-common"}),e.appendChild(s),t.get("wordCounter")){if(o=e.querySelector(".se-word-counter-wrapper")||Ve.utils.createElement("DIV",{class:"se-word-counter-wrapper"}),t.get("wordCounter_label")){const e=o.querySelector(".se-word-label")||Ve.utils.createElement("SPAN",{class:"se-word-label"});e.textContent=t.get("wordCounter_label"),o.appendChild(e)}l=o.querySelector(".se-word-counter")||Ve.utils.createElement("SPAN",{class:"se-word-counter"}),l.textContent="0",o.appendChild(l),e.appendChild(o)}if(t.get("charCounter")){if(i=e.querySelector(".se-char-counter-wrapper")||Ve.utils.createElement("DIV",{class:"se-char-counter-wrapper"}),t.get("wordCounter")&&-1===i.className.indexOf("se-with-word-counter")&&(i.className+=" se-with-word-counter"),t.get("charCounter_label")){const e=i.querySelector(".se-char-label")||Ve.utils.createElement("SPAN",{class:"se-char-label"});e.textContent=t.get("charCounter_label"),i.appendChild(e)}if(n=i.querySelector(".se-char-counter")||Ve.utils.createElement("SPAN",{class:"se-char-counter"}),n.textContent="0",i.appendChild(n),t.get("charCounter_max")>0){const e=i.querySelector(".se-char-max")||Ve.utils.createElement("SPAN",{class:"se-char-max"});e.textContent=" / "+t.get("charCounter_max"),i.appendChild(e)}e.appendChild(i)}}return{statusbar:e,navigation:s,charWrapper:i,charCounter:n,wordWrapper:o,wordCounter:l}}function os(t,e){const s=new Map;s.set("_origin",t);const i=e.statusbar_container,n=void 0===t.value?e.value:t.value,o=void 0===t.placeholder?e.placeholder:t.placeholder,l=void 0===t.placeholder_line?e.placeholder_line:t.placeholder_line,r=void 0===t.editableFrameAttributes?e.editableFrameAttributes:t.editableFrameAttributes,a=void 0===t.width?e.width:t.width,h=void 0===t.minWidth?e.minWidth:t.minWidth,c=void 0===t.maxWidth?e.maxWidth:t.maxWidth,d=void 0===t.innerWidth?e.innerWidth:t.innerWidth,u=void 0===t.height?e.height:t.height,p=void 0===t.minHeight?e.minHeight:t.minHeight,g=void 0===t.maxHeight?e.maxHeight:t.maxHeight,m=void 0===t.editorStyle?e.editorStyle:t.editorStyle,f=void 0===t.iframe?e.iframe:t.iframe,v=void 0===t.iframe_fullPage?e.iframe_fullPage:t.iframe_fullPage,b=void 0===t.iframe_attributes?e.iframe_attributes:t.iframe_attributes,y=void 0===t.iframe_cssFileName?e.iframe_cssFileName:t.iframe_cssFileName,C=i||void 0===t.statusbar?e.statusbar:t.statusbar,w=i||void 0===t.statusbar_showPathLabel?e.statusbar_showPathLabel:t.statusbar_showPathLabel,_=!i&&(void 0===t.statusbar_resizeEnable?e.statusbar_resizeEnable:t.statusbar_resizeEnable),x=i||void 0===t.charCounter?e.charCounter:t.charCounter,$=i||void 0===t.charCounter_max?e.charCounter_max:t.charCounter_max,k=i||void 0===t.charCounter_label?e.charCounter_label:t.charCounter_label,S=i||void 0===t.charCounter_type?e.charCounter_type:t.charCounter_type,E=i||void 0===t.wordCounter?e.wordCounter:t.wordCounter,T=i||void 0===t.wordCounter_label?e.wordCounter_label:t.wordCounter_label;s.set("value",n),s.set("placeholder",o),s.set("placeholder_line",l),s.set("editableFrameAttributes",{spellcheck:"false",...r}),s.set("width",a?String(Oe.is(a)?a+"px":a):"100%"),s.set("minWidth",h?String(Oe.is(h)?h+"px":h):""),s.set("maxWidth",c?String(Oe.is(c)?c+"px":c):""),s.set("innerWidth",d?String(Oe.is(d)?d+"px":d):""),s.set("height",u?String(Oe.is(u)?u+"px":u):"auto"),s.set("minHeight",p?String(Oe.is(p)?p+"px":p):""),s.set("maxHeight",g?String(Oe.is(g)?g+"px":g):""),s.set("editorStyle",m),s.set("_defaultStyles",Ie._setDefaultOptionStyle(s,"string"==typeof m?m:"")),s.set("iframe",!(!v&&!f)),s.set("iframe_fullPage",!!v),s.set("iframe_attributes",b||{}),s.set("iframe_cssFileName",f?("string"==typeof y?[y]:y)||["suneditor"]:null);const M=void 0===C||!!C;return s.set("statusbar",M),s.set("statusbar_showPathLabel",!!M&&("boolean"!=typeof w||w)),s.set("statusbar_resizeEnable",!!M&&(void 0===_||!!_)),s.set("charCounter",$>0||"boolean"==typeof x&&x),s.set("charCounter_max",Oe.is($)&&$>-1?1*$:null),s.set("charCounter_label","string"==typeof k?k.trim():null),s.set("charCounter_type","string"==typeof S?S:"char"),s.set("wordCounter","boolean"==typeof E&&E),s.set("wordCounter_label","string"==typeof T?T.trim():null),s}function ls(t,e,s,i,n){const o=i.get("_defaultStyles");s.style.cssText=o.top;const l=Ve.utils.createElement(i.get("iframe")?"IFRAME":"DIV",{class:"se-wrapper-inner se-wrapper-wysiwyg"+("document"===e.get("type")?" se-type-document-iframe-a4":""),"data-root-key":t});if(i.get("iframe")){const t=l,e=i.get("iframe_attributes");let s=e.sandbox;if(s){const t=["allow-same-origin","allow-scripts"],e=s.split(/\s+/),i=t.filter((t=>!e.includes(t)));i.length>0&&(s=e.concat(i).join(" "))}else s="allow-same-origin allow-scripts";t.setAttribute("sandbox",s),t.setAttribute("frameBorder","0");for(const s in e)"sandbox"!==s&&t.setAttribute(s,e[s]);t.allowFullscreen=!0,t.setAttribute("scrolling","auto"===i.get("height")?"no":"auto"),t.style.cssText=o.frame}else l.setAttribute("contenteditable","true"),e.get("_rtl")&&(l.dir="rtl"),l.className+=" "+e.get("_editableClass"),l.style.cssText=o.frame+o.editor;const r=Ve.utils.createElement("TEXTAREA",{id:n+"-code-viewer-"+(t||"default"),class:"se-wrapper-inner se-code-viewer",style:o.frame,autocomplete:"off"}),a=Ve.utils.createElement("TEXTAREA",{id:n+"-markdown-viewer-"+(t||"default"),class:"se-wrapper-inner se-markdown-viewer",style:o.frame,autocomplete:"off"}),h=Ve.utils.createElement("SPAN",{class:"se-placeholder"});return i.get("placeholder")&&(h.textContent=i.get("placeholder")),{bottomBar:ns(i,null),wysiwygFrame:l,codeView:r,markdownView:a,placeholder:h}}function rs(t,e,s){let i=null,n=!1;if(t.get("codeMirrorEditor")){const o=t.get("codeMirror"),l=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!1},o.options||{}].reduce(((t,e)=>{for(const s in e)t[s]=e[s];return t}),{});"auto"===e.get("height")&&(l.viewportMargin=1/0,l.height="auto");const r=s.style.cssText,a=o.src.fromTextArea(s,l);e.set("codeMirrorEditor",a),i=a.display.wrapper,i.style.cssText=r,n=!0}return t.set("hasCodeMirror",n),i?(Ve.utils.removeItem(s),i.className+=" se-code-viewer-mirror",i):s}function as(t,e,s){const i=s.split("|"),n=(e+"|"+("string"==typeof t?t.toLowerCase():"")).replace(/^\||\|$/g,"").split("|").filter((t=>t&&!i.includes(t))).join("|");return{reg:new RegExp(`^(${n})$`,"i"),str:n}}function hs(t,e,s,i,n){const o=e?.[t];if(o){const e="function"==typeof o?o:o.constructor;return{className:o.className||e.className||"",title:n[o.title]||o.title||n[e.title]||e.title||t,command:t,type:o.type||e.type||"",icon:i[o.icon]||o.icon||i[e.icon]||e.icon||""}}const l=cs(s.get("_rtl"),i,n)[t];return l?{className:l[0],title:l[1],command:l[2],type:l[3],icon:l[4]}:null}function cs(t,e,s){return{bold:["",s.bold,"bold","",e.bold],underline:["",s.underline,"underline","",e.underline],italic:["",s.italic,"italic","",e.italic],strike:["",s.strike,"strike","",e.strike],subscript:["",s.subscript,"subscript","",e.subscript],superscript:["",s.superscript,"superscript","",e.superscript],removeFormat:["",s.removeFormat,"removeFormat","",e.remove_format],copyFormat:["",s.copyFormat,"copyFormat","",e.format_paint],indent:["se-icon-flip-rtl",s.indent,"indent","",t?e.outdent:e.indent],outdent:["se-icon-flip-rtl",s.outdent,"outdent","",t?e.indent:e.outdent],fullScreen:["se-code-view-enabled se-component-enabled",s.fullScreen,"fullScreen","",e.expansion],showBlocks:["",s.showBlocks,"showBlocks","",e.show_blocks],codeView:["se-code-view-enabled se-component-enabled",s.codeView,"codeView","",e.code_view],markdownView:["se-code-view-enabled se-component-enabled",s.markdownView,"markdownView","",e.markdown_view],undo:["se-component-enabled",s.undo,"undo","",e.undo],redo:["se-component-enabled",s.redo,"redo","",e.redo],preview:["se-component-enabled",s.preview,"preview","",e.preview],print:["se-component-enabled",s.print,"print","",e.print],copy:["",s.copy,"copy","",e.copy],dir:["",s[t?"dir_ltr":"dir_rtl"],"dir","",e[t?"dir_ltr":"dir_rtl"]],dir_ltr:["",s.dir_ltr,"dir_ltr","",e.dir_ltr],dir_rtl:["",s.dir_rtl,"dir_rtl","",e.dir_rtl],finder:["se-component-enabled",s.find,"finder","",e.finder],save:["se-component-enabled",s.save,"save","",e.save],newDocument:["se-component-enabled",s.newDocument,"newDocument","",e.new_document],selectAll:["se-component-enabled",s.selectAll,"selectAll_full","",e.select_all],pageBreak:["se-component-enabled",s.pageBreak,"pageBreak","",e.page_break],pageUp:["se-component-enabled",s.pageUp,"pageUp","",e.page_up],pageDown:["se-component-enabled",s.pageDown,"pageDown","",e.page_down],pageNavigator:["se-component-enabled","","pageNavigator","input",""]}}function ds(){const t=Ve.utils.createElement("UL",{class:"se-menu-list"});return{div:Ve.utils.createElement("DIV",{class:"se-btn-module se-btn-module-border"},t),ul:t}}function us(t,e,s,i,n,o,l){n||="";const r=Ve.utils.createElement("LI"),a=e||"",h=/^INPUT|FIELD$/i.test(i),c="se-toolbar-separator-vertical"===t?Ve.utils.createElement("DIV",{class:t,tabindex:"-1"},null):Ve.utils.createElement(h?"DIV":"BUTTON",{class:"se-toolbar-btn se-btn se-tooltip"+(t?" "+t:""),"data-command":s,"data-type":i,"aria-label":a.replace(/<span .+<\/span>/,""),tabindex:"-1"});return h||c.setAttribute("type","button"),/^default\./i.test(n)&&(n=l[n.replace(/^default\./i,"")]),/^text\./i.test(n)&&(n=n.replace(/^text\./i,""),c.className+=" se-btn-more-text"),o&&(c.disabled=!0),/^FIELD$/i.test(i)&&Ve.utils.addClass(r,"se-toolbar-hidden-btn"),a&&(n+=Ve.utils.createTooltipInner(a)),n&&(c.innerHTML=n),r.appendChild(c),{li:r,button:c}}function ps(t,e,s,i){if(!t)return;const n=!1===e.inner;if(1===e.inner?.nodeType?t.appendChild(e.inner):t.innerHTML=n?"":(e.inner||s[e.icon]||e.icon||'<span class="se-icon-text">!</span>')+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+(i[e.title]||e.title)+"</span></span>",t.setAttribute("aria-label",e.title),e.type&&t.setAttribute("data-type",e.type),e.className&&(t.className+=" "+e.className),e.afterItem&&(Ve.utils.addClass(e.afterItem,"se-toolbar-btn"),t.parentElement.appendChild(e.afterItem),Ve.utils.addClass(t,"se-side-btn-a"),Ve.utils.addClass(e.afterItem,"se-side-btn-after")),e.beforeItem&&(Ve.utils.addClass(e.beforeItem,"se-toolbar-btn"),t.parentElement.insertBefore(e.beforeItem,t),e.afterItem?(Ve.utils.addClass(t,"se-side-btn"),Ve.utils.removeClass(t,"se-side-btn-a")):Ve.utils.addClass(t,"se-side-btn-b"),Ve.utils.addClass(e.beforeItem,"se-side-btn-before")),e.replaceButton&&(t.parentElement.appendChild(e.replaceButton),t.style.display="none"),!e.replaceButton&&/^INPUT$/i.test(t.getAttribute("data-type"))){const e=t.querySelector("input");e&&(Ve.utils.addClass(e,"se-toolbar-btn"),e.setAttribute("data-command",t.getAttribute("data-command")),e.setAttribute("data-type",t.getAttribute("data-type")),t.hasAttribute("disabled")&&(e.disabled=!0))}}function gs(t,e,s,i,n,o){t=JSON.parse(JSON.stringify(t));const l=cs(s.get("_rtl"),i,n),r={},a=[],h=[];let c=null,d=null,u=null,p=null,g=null;const m=Ve.utils.createElement("DIV",{class:"se-toolbar-more-layer"}),f=Ve.utils.createElement("DIV",{class:"se-btn-tray"}),v=Ve.utils.createElement("DIV",{class:"se-toolbar-separator-vertical"});t:for(let s,b,y,C,w,_=0;_<t.length;_++)if(s=!1,w="",C=t[_],p=ds(),"object"==typeof C){for(let f,v=0;v<C.length;v++){if(d=C[v],f=!1,u=e[d],/^%\d+/.test(d)&&0===v){C[0]=d.replace(/[^\d]/g,""),a.push(C),t.splice(_--,1);continue t}if("function"==typeof u)c=[u.className,u.title,d,u.type,u.innerHTML,u._disabled];else if("object"==typeof u){const t=u.constructor;c=[u.className||t.className,u.title||t.title,d,u.type||t.type,u.innerHTML||t.innerHTML,u._disabled||t._disabled]}else{if(/^-/.test(d)){w=d.substring(1),p.div.className+=" module-float-"+w;continue}if(/^#/.test(d)){"fix"===d.substring(1)&&(p.ul.className+=" se-menu-dir-fix");continue}if(/^:/.test(d)){f=!0;const t=d.match(/^:([^-]+)-([^-]+)/);y="__se__more_"+_;const e=t[1].trim(),s=t[2].trim();c=["se-btn-more",/^lang\./i.test(e)?n[e.replace(/^lang\./i,"")]:e,y,"MORE",s]}else"|"===d?c=["se-toolbar-separator-vertical","","","separator",""]:("copy"!==d||Ae.isClipboardSupported||console.warn("[SUNEDITOR.constructor.warn] Clipboard is not supported in this browser. : [copy] button is not rendered."),c=l[d]);if(!c){if(!u)throw Error(`[SUNEDITOR.create.toolbar.fail] The button name of a plugin that does not exist. [${d}]`);u="object"==typeof u?u.constructor:u,c=[u.className,u.title,u.key,u.type,u.innerHTML,u._disabled]}}g=us(c[0],c[1],c[2],c[3],c[4],c[5],i),(s?b:p.ul).appendChild(g.li),u&&(r[d]?r[d].push(g.button):r[d]=[g.button],o&&h.push({button:g.button,plugin:u,key:d})),f&&(s=!0,b=Ve.utils.createElement("DIV"),b.className="se-more-layer "+y,b.setAttribute("data-ref",y),b.innerHTML='<div class="se-more-form"><ul class="se-menu-list"'+(w?' style="float: '+w+';"':"")+"></ul></div>",m.appendChild(b),b=b.firstElementChild.firstElementChild)}f.appendChild(p.div)}else{if("|"===C){const t=v.cloneNode(!1);f.appendChild(t);continue}if(/^\/$/.test(C)){const t=Ve.utils.createElement("DIV",{class:"se-btn-module-enter"});f.appendChild(t)}}switch(f.children.length){case 0:f.style.display="none";break;case 1:Ve.utils.removeClass(f.firstElementChild,"se-btn-module-border")}var b,y;m.children.length>0&&f.appendChild(m),a.length>0&&a.unshift(t),b=f,y=s.get("toolbar_innerWidth"),b&&y&&("auto"!==y&&(b.style.maxWidth=y),b.style.width="max-content",b.style.marginLeft="auto",b.style.marginRight="auto");const C=Ve.utils.createElement("DIV",{class:"se-toolbar sun-editor-common"+(s.get("shortcutsHint")?"":" se-shortcut-hide")},f);return s.get("toolbar_hide")&&(C.style.display="none"),{element:C,pluginCallButtons:r,responsiveButtons:a,buttonTray:f,updateButtons:h}}const ms=function(t,e){"object"!=typeof e&&(e={});const s={};if(e.plugins){const t=e.excludedPlugins||[],i=e.plugins,n=(Array.isArray(i)?i:Object.keys(i)).filter((e=>!t.includes(e))).map((t=>i[t]));for(let t,e=0,i=n.length;e<i;e++)t=n[e].default||n[e],s[t.key]=t}const i=is(e,t,s),n=i.o,o=i.i,l=i.l,r=Ve.utils.createElement("DIV",{class:"se-loading-box sun-editor-common"},'<div class="se-loading-effect"></div>'),a="suneditor-"+ ++Qe,h=Ve.utils.createElement("DIV",{class:"sun-editor sun-editor-carrier-wrapper sun-editor-common"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),c=Ve.utils.createElement("DIV",{class:"se-menu-tray",popover:"manual"});h.appendChild(c);const d=Ve.utils.createElement("INPUT",{type:"text",id:a+"-focus-temp",class:"__se__focus__temp__",autocomplete:"off","aria-hidden":"true",style:"position: fixed !important; top: -10000px !important; left: -10000px !important; display: block !important; width: 0 !important; height: 0 !important; margin: 0 !important; padding: 0 !important;"});d.tabIndex=0,h.appendChild(d);const u=Ve.utils.createElement("DIV",{class:"se-modal se-modal-area sun-editor-common",popover:"manual"}),p=Ve.utils.createElement("DIV",{class:"se-modal-back"}),g=Ve.utils.createElement("DIV",{class:"se-modal-inner"});u.appendChild(p),u.appendChild(g),h.appendChild(u);const m=Ve.utils.createElement("DIV",{class:"se-alert se-modal-area sun-editor-common",style:"display: none;",popover:"manual"}),f=Ve.utils.createElement("DIV",{class:"se-modal-back"}),v=Ve.utils.createElement("DIV",{class:"se-modal-inner"});m.appendChild(f),m.appendChild(v),h.appendChild(m),h.appendChild(Ve.utils.createElement("DIV",{class:"se-back-wrapper",popover:"manual"}));const b=r.cloneNode(!0);b.setAttribute("popover","manual"),h.appendChild(b);const y=Ve.utils.createElement("DIV",{class:"se-drag-cursor",popover:"manual"});h.appendChild(y),Je.body.appendChild(h);let C=null,w=null;const _=gs(i.buttons,s,n,o,l,!1),x=_.element;x.style.visibility="hidden",/inline/i.test(n.get("mode"))?(x.className+=" se-toolbar-inline",x.style.width=n.get("toolbar_width")):/balloon/i.test(n.get("mode"))&&(x.className+=" se-toolbar-balloon",x.style.width=n.get("toolbar_width"),x.appendChild(Ve.utils.createElement("DIV",{class:"se-arrow"}))),n.get("_toolbar_bottom")&&(x.className+=" se-toolbar-bottom"),i.subButtons&&(w=gs(i.subButtons,s,n,o,l,!1),C=w.element,C.style.visibility="hidden",C.className+=" se-toolbar-balloon se-toolbar-sub",C.style.width=n.get("toolbar_sub_width"),C.appendChild(Ve.utils.createElement("DIV",{class:"se-arrow"})));const $=t[0].key||null,k=[],S=new Map,E=i.statusbarContainer;let T=null;for(let e=0,s=t.length;e<s;e++){const s=t[e],h=i.frameMap.get(s.key),c=Ve.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),d=Ve.utils.createElement("DIV",{class:"se-container"}),u=!!n.get("blockHandle"),p=Ve.utils.createElement("DIV",{class:"se-wrapper"+(u?" se-mode-block":"")+("document"===n.get("type")?" se-type-document":"")+(n.get("_type_options").includes("header")?" se-type-document-header":"")}),g=h.get("innerWidth");g&&"auto"!==g&&p.style.setProperty("--se-editor-inner-width",g),d.appendChild(Ve.utils.createElement("DIV",{class:"se-toolbar-shadow"}));const m=ls(s.key,n,c,h,a),f=m.bottomBar.statusbar,v=m.wysiwygFrame,b=m.placeholder;let y=m.codeView;const C=Ve.utils.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-t",title:l.insertLine},o.line_break),w=Ve.utils.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-b",title:l.insertLine},o.line_break);p.appendChild(C),p.appendChild(w),b&&p.appendChild(b),d.appendChild(Ve.utils.createElement("DIV",{class:"se-toolbar-sticky-dummy"})),d.appendChild(p),f&&(E?T||(E.appendChild(Ve.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")},f)),T=f):d.appendChild(f)),d.appendChild(r.cloneNode(!0));const _=s.key||null;let x=null;if(n.get("buttons").has("codeView")){x=Ve.utils.createElement("DIV",{class:"se-code-wrapper"},y),x.style.setProperty("display","none","important"),p.appendChild(x);const t=rs(n,h,y);if(y===t){const t=Ve.utils.createElement("TEXTAREA",{id:a+"-code-view-line-"+(_||"default"),class:"se-code-view-line",readonly:"true",autocomplete:"off","aria-hidden":"true",tabindex:"-1"},null);x.insertBefore(t,y)}else y=t}let $=null,M=null;if(n.get("buttons").has("markdownView")){M=m.markdownView;const t=Ve.utils.createElement("TEXTAREA",{id:a+"-markdown-view-line-"+(_||"default"),class:"se-markdown-view-line",readonly:"true",autocomplete:"off","aria-hidden":"true",tabindex:"-1"},null);$=Ve.utils.createElement("DIV",{class:"se-markdown-wrapper"}),$.appendChild(t),$.appendChild(M),$.style.setProperty("display","none","important"),p.appendChild($)}const H={inner:null,page:null,pageMirror:null};n.get("_type_options").includes("header")&&(H.inner=Ve.utils.createElement("DIV",{class:"se-document-lines",style:`height: ${h.get("height")};`},'<div class="se-document-lines-inner"></div>')),n.get("_type_options").includes("page")&&(H.page=Ve.utils.createElement("DIV",{class:"se-document-page"},null),H.pageMirror=Ve.utils.createElement("DIV",{class:"sun-editor-editable se-document-page-mirror-a4",style:"position: absolute; width: 21cm; columns: 21cm; border: 0; overflow: hidden; height: auto; top: -10000px; left: -10000px;"},null));let L=null;if(u){L=Ve.utils.createElement("DIV",{class:"se-block-handle-area"});const t=Ve.utils.createElement("DIV",{class:"se-block-handle",popover:"manual"}),e=Ve.utils.createElement("DIV",{class:"se-block-handle-btn se-block-handle-plus"},o.plus),s=Ve.utils.createElement("DIV",{class:"se-block-handle-btn se-block-handle-drag"},o.dragHandle);t.appendChild(e),t.appendChild(s),L.appendChild(t)}c.appendChild(d),k.push(_),S.set(_,Ge({target:s.target,key:s.key,options:h},c,v,x,y,$,M,T||f,H,L,_))}const M=n.get("toolbar_container");if(M){const t=Ve.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),e=Ve.utils.createElement("DIV",{class:"se-container"});e.appendChild(x),C&&e.appendChild(C),t.appendChild(e),M.appendChild(t),M.appendChild(Ve.utils.createElement("DIV",{class:"se-toolbar-sticky-dummy"}))}else{const t=S.get($).get("container");if(n.get("_toolbar_bottom")){const e=t.querySelector(".se-statusbar");t.insertBefore(x,e),C&&t.insertBefore(C,x)}else t.insertBefore(x,t.firstElementChild),C&&t.insertBefore(C,t.firstElementChild)}return{context:Ze(x,M,c,C,E),carrierWrapper:h,options:n,plugins:s,icons:o,lang:l,value:i.v,rootId:$,rootKeys:k,frameRoots:S,pluginCallButtons:_.pluginCallButtons,responsiveButtons:_.responsiveButtons,pluginCallButtons_sub:w?w.pluginCallButtons:[],responsiveButtons_sub:w?w.responsiveButtons:[]}},{_w:fs}=Ae,vs=Math.floor(96/72*841.89105);const bs=class{#t;#e;#s;#i;#n;#o;#l;#r;#a;#h;#c;#d;#u;#p;#g;#m;#f=-1;#v=-1;#b=null;#y=null;#C=0;#w=0;#_=-1;#x=0;#$=[];#k=null;#S=0;#E=0;#T=new Map;#M=null;constructor(t,e){const s=t.$;if(this.#t=s.store,this.#e=s.context,this.#s=this.#t.get("isScrollable"),this.#i=s.offset,this.#n=s.selection,this.#o=s.toolbar,this.useHeader=s.options.get("_type_options").includes("header"),this.usePage=s.options.get("_type_options").includes("page"),this.#l=e,this.#r=e.get("wysiwyg"),this.#a=e.get("wysiwygFrame"),this.#h=e.get("documentTypeInner"),this.#p=e.get("documentTypePageMirror"),this.#p){const t=fs.getComputedStyle(this.#p);this.#g=Oe.get(t.paddingTop),this.#m=Oe.get(t.paddingBottom)}if(this.useHeader){const t=this._getHeaders(),e=this.#c=this.#h.querySelector(".se-document-lines-inner");let i="";for(let e,s=0,n=t.length;s<n;s++)e=t[s],i+=`<div class="se-doc-item se-doc-h${Oe.get(e.nodeName)}" title="${e.textContent}">${e.textContent}</div>`;e.innerHTML=i,this.#b=e.querySelectorAll("div"),s.eventManager.addEvent(e,"click",this.#H.bind(this,this.#r))}this.usePage&&(this.#d=e.get("documentTypePage"),this.#u=s.plugins.pageNavigator)}reHeader(){if(!this.useHeader)return;const t=this._getHeaders(),e=this.#c,s=this.#b;for(let i,n,o,l=0,r=t.length;l<r;l++)if(i=t[l],n=`se-doc-h${Oe.get(i.nodeName)}`,o=s[l],l<s.length)o.classList.contains(n)&&o.textContent===i.textContent||(o.textContent=o.title=i.textContent,o.className=`se-doc-item ${n}`);else{const t=document.createElement("div");t.className=`se-doc-item ${n}`,t.textContent=t.title=i.textContent,e.appendChild(t)}if(s.length>t.length)for(let i=t.length;i<s.length;i++)e.removeChild(s[i]);this.#b=e.querySelectorAll("div")}async rePage(t){this.#d&&(this.#M&&fs.clearTimeout(this.#M),this.#M=fs.setTimeout((async()=>{await Ve.utils.waitForMediaLoad(this.#p,1500);const e=this.#r.scrollHeight>this.#p.scrollHeight?this.#r.scrollHeight-this.#p.scrollHeight:0,s=this.#p.scrollHeight+e,i=this.#r.querySelectorAll(".se-page-break");if(!t&&this.#_===s&&this.#x===i.length)return;this.#_=s,this.#x=i.length;let n=0;const o=[];if(i.length>0){n=i[0].offsetHeight;for(let t=0;t<i.length;t++)o.push({top:i[t].offsetTop,end:i[t].offsetTop+n/2})}const l=this.#s(this.#l)?this._getWWScrollTop():0,r=[{number:0,top:0}];for(let t=0;t<o.length;t++)r.push({number:0,top:o[t].top+n/2,isBreak:!0});this.#E=0;const a=this.#r.children,h=this.#p.children;this._initializeCache(h);const c=[0,...o.map((t=>t.end))],d=[...o.map((t=>t.top)),s];for(let t=0;t<c.length;t++){const e=d[t];let s=c[t],i=0===t;for(;s+=vs+(i?this.#g+this.#m:this.#g),i=!1,!(s>=e);)if(!r.some((t=>Math.abs(t.top-s)<3))){const t=this._calcPageBreakTop(s,a,h,r);if(null===t)break;r.push({number:0,top:t})}}if(0===r.length)return this.#k=null,this.#C=1,void this._displayCurrentPage();r.sort(((t,e)=>t.top-e.top)),this.#d.innerHTML="",this.#$=[];const u=this.#a.offsetWidth+1;for(let t,e=0;e<r.length&&(t=r[e].top,!(s<t));e++){const s=Ve.utils.createElement("DIV",{style:`top:${t-l}px`,innerHTML:String(e+1)},`<div class="se-document-page-line" style="width: ${u}px;"></div>${e+1}`);this.#d.appendChild(s),this.#$.push(s)}this.#k=this.#d.querySelectorAll(".se-document-page-line"),this.#C=this.#$.length,this.#L(),this._displayCurrentPage()}),400))}_getDisplayPage(){return this.#s(this.#l)?this.#l.get("wysiwyg"):fs}_calcPageBreakTop(t,e,s,i){const{ci:n}=this._getElementAtPosition(t,s,i),o=s[n],l=e[n];if(!o||!l)return null;const r=t+(l.offsetTop-o.offsetTop)+(l.offsetHeight-o.offsetHeight)/2;return Math.round(r)}_initializeCache(t){this.#T.clear();for(let e=0,s=t.length;e<s;e++){const s=t[e],i=s.offsetTop,n=s.offsetHeight,o=i+n;this.#T.set(e,{top:i,height:n,bottom:o})}}_getElementAtPosition(t,e,s){let i=this.#E,n=e.length-1;if(i>0){const e=this.#T.get(i);e&&t<e.top&&(i=0)}for(;i<=n;){const o=Math.floor((i+n)/2),{top:l,height:r,bottom:a}=this.#T.get(o);if(t>=l&&t<=a){let i=o;if(s&&Ve.utils.hasClass(e[i],"se-page-break")){i=i+1<e.length?i+1:Math.max(0,i-1);const s=this.#T.get(i);return this.#E=i,{ci:i,cm:t-s.bottom,ch:s.height}}return this.#E=i,{ci:i,cm:t-a,ch:r}}t<l?n=o-1:i=o+1}let o=e[i]?i:n;s&&Ve.utils.hasClass(e[o],"se-page-break")&&(o=o+1<e.length?o+1:Math.max(0,o-1)),this.#E=o;const l=this.#T.get(o);return{ci:o,cm:t-l.bottom,ch:l.height}}resizePage(){const t=this.#a.offsetWidth+1,e=this.#a.offsetHeight+1;let s=!1;if(t===this.#f&&(s=e===this.#v))return;t>800?Ve.utils.removeClass(this.#h,"se-document-responsible"):Ve.utils.addClass(this.#h,"se-document-responsible"),this.#f=t,this.#v=e;const i=this.#k;for(let e=0,s=i?.length;e<s;e++)i[e].style.width=`${t}px`;s||this.rePage(!0),this._displayCurrentPage()}scrollPage(){const t=this.#S,e=this._getWWScrollTop();if(t===e)return;const s=this.#$,i=e-t;for(let t=0,e=s.length;t<e;t++)s[t].style.top=Oe.get(s[t].style.top)-i+"px";this.#L(),this.#S=e,this._displayCurrentPage()}#L(){const t=this.#$;if(!t?.length)return;const e=this.#a.offsetHeight;for(let s=0,i=t.length;s<i;s++){const i=Oe.get(t[s].style.top);t[s].style.display=i<0||i>e?"none":""}}scrollWindow(){this.#s(this.#l)||this._displayCurrentPage()}getCurrentPageNumber(){if(this.#C<=1)return 1;let t=0;if(this.#s(this.#l))t=this.#v/2;else{const e=this._getGlobalTop();if(t=fs.scrollY-e+vs/2,t<=0)return 1}const e=this.#$;for(let s=0,i=e.length;s<i;s++)if(e[s].offsetTop>=t)return this.#w=s;return this.#w=this.#C}pageUp(){const t=this.#w-1<=1?1:this.#w-1;this._movePage(t,!1)}pageDown(){const t=this.#w+1>this.#$.length?this.#$.length:this.#w+1;this._movePage(t,!1)}pageGo(t){t<1?t=1:t>this.#$.length&&(t=this.#$.length),this._movePage(t,!0)}on(t){if(!this.useHeader)return;if(this._is(t)||(t=this._findLinesHeader(t)),!t)return;const e=this._findItem(t);e&&(Ve.utils.removeClass(this.#b,"active"),Ve.utils.addClass(e,"active"))}onChangeText(t){if(!this.useHeader)return;if(!this._is(t))return;const e=this._findItem(t);e&&(e.textContent=t.textContent)}_displayCurrentPage(){const t=this.getCurrentPageNumber();this.#u?.display(t,this.#C)}_getWWScrollTop(){const t=this._getDisplayPage();return t.scrollTop||t.scrollY||0}_movePage(t,e){const s=this._getGlobalTop(),i=this.#s(this.#l),n=Ie.nodeListToArray(this.#r.children),o=this.#d.offsetTop+Oe.get(this.#$[t-1].style.top)+(i?this._getWWScrollTop():0);for(let l,r=0,a=n.length;r<a;r++)if(l=n[r],l.offsetTop>=o){e||this.#n.setRange(l,0,l,0);const n=0===r&&i?0:l.offsetTop-this.#d.offsetTop-l.offsetHeight+s;this._applyPageScroll(n,(()=>{this.#o.isSticky&&!this.#t.mode.isBottom&&this._getDisplayPage().scrollTo({top:n-this.#e.get("toolbar_main").offsetHeight,behavior:"smooth"})})),this.#w=t;break}}_applyPageScroll(t,e){const s=this._getDisplayPage();s.scrollTo({top:t,behavior:"smooth"});const i=()=>{Math.abs((s.scrollY??s.scrollTop)-t)<1?e():fs.requestAnimationFrame(i)};fs.requestAnimationFrame(i)}_getGlobalTop(){return this.#s(this.#l)?0:this.#i.getGlobal(this.#a).top}_findItem(t){const e=this.#y,s=Array.prototype.indexOf.call(e,t);return-1!==s&&this.#b[s]?this.#b[s]:null}_findLinesHeader(t){for(;t&&t!==this.#r;){if(this._is(t))return t;t=t.previousElementSibling||t.parentElement}return null}_is(t){return/^h[1-6]$/i.test(t?.nodeName)}_getHeaders(){return this.#y=this.#r.querySelectorAll("h1, h2, h3, h4, h5, h6")}#H(t,e){e.preventDefault();try{this.#t.set("_preventBlur",!0);const t=Ve.query.getEventTarget(e);if(Ve.utils.hasClass(t,"se-doc-item")){const e=Array.prototype.indexOf.call(this.#b,t);if(-1===e)return;const s=this.#y[e];s&&this.#n.scrollTo(s)}}finally{this.#t.set("_preventBlur",!1)}}_destroy(){this.#M&&(fs.clearTimeout(this.#M),this.#M=null),this.#T&&(this.#T.clear(),this.#T=null),this.#l=null,this.#r=null,this.#a=null,this.#h=null,this.#c=null,this.#d=null,this.#$=null,this.#k=null,this.#b=null,this.#y=null,this.#u=null,this.#p=null}};const ys=class{#N;#A=new Map;constructor(t){const e=t.options,s=e.get("mode"),i=e.get("_subMode");this._editorInitFinished=!1,this.mode={isClassic:/classic/i.test(s),isInline:/inline/i.test(s),isBalloon:/balloon/i.test(s),isBalloonAlways:/balloon-always/i.test(s),isSubBalloon:/balloon/i.test(i),isSubBalloonAlways:/balloon-always/i.test(i),isBottom:!!e.get("_toolbar_bottom")},this.#N={rootKey:t.rootId,hasFocus:!1,tabSize:4,indentSize:25,codeIndentSize:2,currentNodes:[],currentNodesMap:[],initViewportHeight:0,currentViewportHeight:0,controlActive:!1,_lastSelectionNode:null,isScrollable:t=>{const e=t.get("options"),s=e.get("height"),i=e.get("maxHeight");return"auto"!==s||!!i&&t.get("wysiwyg").offsetHeight>=Oe.get(i)},_range:null,_mousedown:!1,_preventBlur:!1,_preventFocus:!1,_canUseBeforeInput:!0}}get(t){return this.#N[t]}set(t,e){const s=this.#N[t];this.#N[t]=e,this.#B(t,e,s)}subscribe(t,e){return this.#A.has(t)||this.#A.set(t,new Set),this.#A.get(t).add(e),()=>this.#A.get(t).delete(e)}#B(t,e,s){const i=this.#A.get(t);if(i)for(const n of i)try{n(e,s)}catch(e){console.error(`[Store] Subscriber error for "${t}":`,e)}}_reset(){}_destroy(){this.#A.clear(),this.#N=null}},{_w:Cs,_d:ws}=Ae;class _s{#I;#V;#O;constructor(t){this.#I=t.frameRoots,this.#V=this.#R(t.context),this.#O=this.#P({value:new Map}),this.rootKeys=t.rootKeys,this.carrierWrapper=t.carrierWrapper,this.icons=t.icons,this.lang=t.lang,this.shadowRoot=null}get frameRoots(){return this.#I}get context(){return this.#V}get frameContext(){return this.#O}init(){this.applyToRoots((t=>{this.#z(t)}))}reset(t){this.#O.reset(t)}applyToRoots(t){this.#I.forEach(t)}#z(t){const e=t.get("options");if(t.set("wwComputedStyle",Cs.getComputedStyle(t.get("wysiwyg"))),!e.get("iframe")&&"function"==typeof ShadowRoot){let e=t.get("wysiwygFrame");for(;e;){if(e.shadowRoot){this.shadowRoot=e.shadowRoot;break}if(e instanceof ShadowRoot){this.shadowRoot=e;break}e=e.parentNode}}e.get("iframe")?(t.set("_ww",t.get("wysiwygFrame").contentWindow),t.set("_wd",t.get("wysiwygFrame").contentDocument),t.set("wysiwyg",t.get("_wd").body),e.get("_defaultStyles").editor&&(t.get("wysiwyg").style.cssText=e.get("_defaultStyles").editor),"auto"===e.get("height")&&t.set("_iframeAuto",t.get("_wd").body)):(t.set("_ww",Cs),t.set("_wd",ws));const s=e.get("editableFrameAttributes");for(const e in s)t.get("wysiwyg").setAttribute(e,s[e])}#R(t){const e=t;return{get:t=>e.get(t),set:(t,s)=>e.set(t,s),has:t=>e.has(t),delete:t=>e.delete(t),getAll:()=>Object.fromEntries(e.entries()),get size(){return e.size},clear(){e.clear()}}}#P(t){let e=t.value;return{get:t=>e.get(t),set:(t,s)=>e.set(t,s),has:t=>e.has(t),delete:t=>e.delete(t),getAll:()=>Object.fromEntries(e.entries()),reset(s){e=t.value=s},get size(){return e.size},clear(){e.clear()}}}_destroy(){this.applyToRoots((t=>{const e=t.get("documentType");e&&e._destroy(),Ve.utils.removeItem(t.get("topArea")),t.get("options").clear(),t.clear()})),this.#V.clear(),this.#O.clear(),this.#I.clear(),Ve.utils.removeItem(this.carrierWrapper),this.rootKeys=null,this.carrierWrapper=null,this.icons=null,this.lang=null,this.shadowRoot=null}}class xs{#D;#F;#q;#W;constructor(t,e,s){this.#D=t,this.#F=s,this.#q=this.#U({value:e.options}),this.#W=this.#Z({value:new Map})}get options(){return this.#q}get frameOptions(){return this.#W}reset(t){const{$:e}=this.#D,s=e.frameRoots,i=e.context,n=e.eventManager,o=e.format,l=e.html,r=e.char,a=e.viewer,h=e.plugins,c=e.history,d=e.ui,u=this.#D._eventOrchestrator;a.codeView(!1),a.showBlocks(!1);const p=new Map,g=[],m=new Map,f={};for(const e in t)void 0!==Ye[e]&&(f[e]=t[e],delete t[e]);for(const e of s.keys())t[e||""]={...f,...t[e||""]};const v=Object.keys(t);if(this.#G(v,h,""),0===v.length)return;1===s.size&&v.unshift(null);const b=[this.#F,t].reduce(((t,e)=>{for(const i in e)s.has(i||null)?this.#j(i,e,s,p,m,g):t[i]=e[i];return t}),{}),y=this.#q,C=is(b,g,h),w=C.o,_=C.frameMap;for(let t,e=0,i=v.length;e<i;e++)if(t=v[e]||null,m.has(t)){const e=p.get(t),i=s.get(t),o=i.get("options"),l=_.get(t);for(const[t,e]of l.entries())o.set(t,e);if(e.has("statusbar-changed")){if(Ve.utils.removeItem(i.get("statusbar")),l.get("statusbar")){const t=ns(l,null).statusbar;i.get("container").appendChild(t),je(t,i),u.__addStatusbarEvent(i,l)}else n.removeEvent(o.get("__statusbarEvent")),l.set("__statusbarEvent",null),je(null,i);i.get("statusbar")&&r.display(i)}if(e.has("iframe_attributes")){const t=i.get("wysiwygFrame"),e=o.get("iframe_attributes"),s=l.get("iframe_attributes");for(const s in e)t.removeAttribute(s);for(const e in s)t.setAttribute(e,s[e])}if(e.has("iframe_cssFileName")){const t=i.get("_wd").head,e=t.getElementsByTagName("link");for(;e[0];)t.removeChild(e[0]);const s=(new DOMParser).parseFromString(Ie._setIframeStyleLinks(l.get("iframe_cssFileName")),"text/html").head.children,n=t.querySelector("style");for(;s[0];)t.insertBefore(s[0],n)}if(e.has("placeholder")&&(i.get("placeholder").textContent=l.get("placeholder")),e.has("placeholder_line")){const t=l.get("placeholder_line");i.set("placeholder_line",t);const e=i.get("wysiwyg").querySelector(".se-placeholder-line");e&&(t?e.setAttribute("data-se-placeholder-line",t):(e.classList.remove("se-placeholder-line"),e.removeAttribute("data-se-placeholder-line"),e.getAttribute("class")||e.removeAttribute("class")))}d.setEditorStyle(l.get("editorStyle"),i);const a=i.get("wysiwyg"),h=o.get("editableFrameAttributes"),c=l.get("editableFrameAttributes");for(const t in h)a.removeAttribute(t);for(const t in c)a.setAttribute(t,c[t])}else switch(t){case"theme":d.setTheme(w.get("theme"));break;case"events":{const t=w.get("events");for(const e in t)n.events[e]=t[e];break}case"autoStyleify":l.__resetAutoStyleify(w.get("autoStyleify"));break;case"textDirection":d.setDir("rtl"===w.get("textDirection")?"rtl":"ltr");break;case"historyStackDelayTime":c.resetDelayTime(w.get("historyStackDelayTime"));break;case"defaultLineBreakFormat":o.__resetBrLineBreak(w.get("defaultLineBreakFormat"))}y.setMany(w),this.#F=b;const x=i.get("toolbar_main");/inline|balloon/i.test(y.get("mode"))&&v.includes("toolbar_width")&&(x.style.width=y.get("toolbar_width")),y.get("toolbar_hide")?x.style.display="none":x.style.display="",y.get("shortcutsHint")?Ve.utils.removeClass(x,"se-shortcut-hide"):Ve.utils.addClass(x,"se-shortcut-hide")}resetFrame(t){this.#W.reset(t)}#j(t,e,s,i,n,o){const l=e[t],r=Object.keys(l);if(this.#G(r,null,t+"."),0===r.length)return!1;const a=t||null;i.set(a,new Map);const h=s.get(a).get("options").get("_origin"),c={},d=Object.prototype.hasOwnProperty;for(const t in l){if(!d.call(Ye,t))continue;const e=l[t];r.includes(t)&&h[t]!==e&&(i.get(a).set(this.#K(t),!0),c[t]=e)}const u={...h,...c};n.set(a,new Map(Object.entries(u))),o.push({key:a,options:u})}#K(t){return/^statusbar|^charCounter|^wordCounter/.test(t)?"statusbar-changed":t}#G(t,e,s){for(let i,n=0,o=t.length;n<o;n++)i=t[n],("fixed"===Xe[i]||"fixed"===Ye[i]||e&&e[i])&&(console.warn(`[SUNEDITOR.warn.resetOptions] The "[${s+i}]" option cannot be changed after the editor is created.`),t.splice(n--,1),o--)}#U(t){let e=t.value;return{get:t=>e.get(t),set:(t,s)=>e.set(t,s),has:t=>e.has(t),getAll:()=>Object.fromEntries(e.entries()),setMany(t){t.forEach(((t,s)=>e.set(s,t)))},reset(s){e=t.value=s},size:()=>e.size,clear(){e.clear()},entries:()=>e.entries(),keys:()=>e.keys(),values:()=>e.values(),forEach(t){e.forEach(t)}}}#Z(t){let e=t.value;return{get:t=>e.get(t),set:(t,s)=>e.set(t,s),has:t=>e.has(t),getAll:()=>Object.fromEntries(e.entries()),setMany(t){t.forEach(((t,s)=>e.set(s,t)))},reset(s){e=t.value=s},size:()=>e.size,clear(){e.clear()},entries:()=>e.entries(),keys:()=>e.keys(),values:()=>e.values(),forEach(t){e.forEach(t)}}}_destroy(){this.#F=null,this.#q.clear(),this.#W.clear()}}const $s=class{#Y;constructor(t){this.#Y=t}isNode(t){return t&&"number"==typeof t.nodeType||t instanceof this.#X().Node}isElement(t){return t&&1===t.nodeType||t instanceof this.#X().Element}isRange(t){return t&&"Range"===t.constructor?.name||t instanceof this.#X().Range}isSelection(t){return t&&"Selection"===t.constructor?.name||t instanceof this.#X().Selection}#X(){return this.#Y.get("_ww")}},{_w:ks,_d:Ss,NO_EVENT:Es}=Ae;const Ts=class{#J;#Y;#Q;#tt=null;#et=null;#st=[];constructor(t,e,s){this.#J=s,this.#Y=t.frameContext,this.#Q=e.frameOptions,this.events=e.options.get("events")||{},this.triggerEvent=async(t,e)=>{if(Ve.check.isNonEditable(e?.frameContext?.get("wysiwyg")))return!1;const s=this.events[t];if("function"==typeof s)try{return await s({$:this.#J,...e})}catch(e){return console.error(`[SUNEDITOR.triggerEvent.${t}]`,e),!1}return Es}}_bindOrchestrator(t){this.#tt=t}applyTagEffect(t){return this.#tt?.applyTagEffect(t)}addEvent(t,e,s,i){if(!t)return null;if((t===ks||t===Ss||"number"!=typeof t.length||t.nodeType||!Array.isArray(t)&&t.length<1)&&(t=[t]),0===t.length)return null;const n=t.length;for(let o=0;o<n;o++)t[o].addEventListener(e,s,i),this.#st.push({target:t[o],type:e,listener:s,useCapture:i});return{target:t,type:e,listener:s,useCapture:i}}removeEvent(t){if(!t)return;let e=t.target;const s=t.type,i=t.listener,n=t.useCapture;if(e&&((e===ks||e===Ss||"number"!=typeof e.length||e.nodeType||!Array.isArray(e)&&e.length<1)&&(e=[e]),0!==e.length)){for(let t=0,o=e.length;t<o;t++)e[t].removeEventListener(s,i,n);return null}}addGlobalEvent(t,e,s){return this.#Q.get("iframe")&&this.#Y.get("_ww").addEventListener(t,e,s),ks.addEventListener(t,e,s),{type:t,listener:e,useCapture:s}}removeGlobalEvent(t,e,s){if(t)return"object"==typeof t&&(e=t.listener,s=t.useCapture,t=t.type),this.#Q.get("iframe")&&this.#Y.get("_ww").removeEventListener(t,e,s),ks.removeEventListener(t,e,s),null}_injectActiveEvent(t){Ve.utils.addClass(t,"__se__active"),this.#et=this.addGlobalEvent("mouseup",(()=>{Ve.utils.removeClass(t,"__se__active"),this.#et=this.removeGlobalEvent(this.#et)}))}_init(){for(let t,e=0,s=this.#st.length;e<s;e++)t=this.#st[e],t.target.removeEventListener(t.type,t.listener,t.useCapture);this.#st=null,this.#et&&=this.removeGlobalEvent(this.#et)}};const Ms=class{#J;#t;#it;#nt;#e;#Y;#ot;#Q;constructor(t){this.#J=t.$,this.#t=t.store,this.#it=this.#J.contextProvider.shadowRoot,this.#nt=this.#J.contextProvider.carrierWrapper,this.#e=this.#J.context,this.#Y=this.#J.frameContext,this.#ot=this.#J.options,this.#Q=this.#J.frameOptions}get(t){const e=this.#Y.get("wysiwygFrame"),s=/iframe/i.test(e?.nodeName),i=this.getLocal(t);return{left:i.left+(s?e.parentElement.offsetLeft:0),top:i.top+(s?e.parentElement.offsetTop:0)}}getLocal(t){const e=t;let s=0,i=0,n=0,o=0,l=0,r=3===e.nodeType?e.parentElement:e;const a=e.offsetWidth,h=Ct(e,tt.bind(this)),c=r;for(;r&&!ct(r,"se-wrapper")&&r!==h;)s+=r.offsetLeft-(c!==r?r.scrollLeft:0),i+=r.offsetTop+(c!==r?r.scrollTop:0),r=r.offsetParent;const d=this.#Y.get("wysiwygFrame");this.#Y.get("wysiwyg").contains(e)&&(n=d.offsetLeft,o=d.offsetTop,l=d.parentElement.offsetWidth-(d.offsetLeft+d.offsetWidth));const u=this.#Y.get("eventWysiwyg");return s+=n-(h?h.scrollLeft:0),i+=o-(h?h.scrollTop:0),{left:s,top:i,right:r?.offsetWidth?r.offsetWidth-(s-n+a)+l:0,scrollX:u.scrollLeft||u.scrollX||0,scrollY:u.scrollTop||u.scrollY||0,scrollH:this.#Y.get("wysiwyg").scrollHeight||0}}getGlobal(t){const e=this.#Y.get("topArea"),s=this.#Y.get("wysiwygFrame");if(t||=e,!G(t))return{top:0,left:0,fixedTop:0,fixedLeft:0,width:0,height:0};const i=t,n=i.getBoundingClientRect();let l=n.top,r=n.left;if(/^iframe$/i.test(s.nodeName)&&s.contentDocument.contains(i)){const t=s.getBoundingClientRect();l+=t.top,r+=t.left}return{top:l+o.scrollY,left:r+o.scrollX,fixedTop:l,fixedLeft:r,width:i.offsetWidth,height:i.offsetHeight}}getGlobalScroll(t){const e=this.#Y.get("topArea");let s=!1,i=!1;t||=e,t===e&&(s=!0),!s&&G(t)&&(i="absolute"===o.getComputedStyle(t).position);let n=0,l=0,r=0,a=0,h=0,c=0,d=0,u=0,p=null,g=null,m=null,f=null,v=t;for(;v;)n+=v.scrollTop,l+=v.scrollLeft,r+=v.scrollHeight,a+=v.scrollWidth,v.scrollTop>0&&(c+=v.offsetTop),v.scrollHeight>=v.clientHeight&&(d=/^html$/i.test(v.nodeName)?d||v.clientHeight:v.clientHeight+(m?-m.clientTop:0),p=m||p||v,m=v),v.scrollLeft>0&&(h+=v.offsetLeft),v.scrollWidth>=v.clientWidth&&(u=/^html$/i.test(v.nodeName)?u||v.clientWidth:v.clientWidth+(f?-f.clientLeft:0),g=f||g||v,f=v),v=v.parentElement;if(!i&&!s&&/^iframe$/i.test(this.#Y.get("wysiwygFrame").nodeName))for(v=this.#Y.get("wrapper"),p=g=e;v;)n+=v.scrollTop,l+=v.scrollLeft,r+=v.scrollHeight,a+=v.scrollWidth,v.scrollTop>0&&(c+=v.offsetTop),v.scrollHeight>=v.clientHeight&&(d=/^html$/i.test(v.nodeName)?d||v.clientHeight:v.clientHeight+(m?-m.clientTop:0),m=v),v.scrollLeft>0&&(h+=v.offsetLeft),v.scrollWidth>=v.clientWidth&&(u=/^html$/i.test(v.nodeName)?u||v.clientWidth:v.clientWidth+(f?-f.clientLeft:0),f=v),v=v.parentElement;for(v=this.#it?.host,v&&(p=g=e);v;)n+=v.scrollTop,l+=v.scrollLeft,r+=v.scrollHeight,a+=v.scrollWidth,v.scrollTop>0&&(c+=v.offsetTop),v.scrollHeight>=v.clientHeight&&(d=/^html$/i.test(v.nodeName)?d||v.clientHeight:v.clientHeight+(m?-m.clientTop:0),m=v),v.scrollLeft>0&&(h+=v.offsetLeft),v.scrollWidth>=v.clientWidth&&(u=/^html$/i.test(v.nodeName)?u||v.clientWidth:v.clientWidth+(f?-f.clientLeft:0),f=v),v=v.parentElement;const b=e.contains(p),y=e.contains(g);p=b?e:p,g=y?e:g;const C=p?p.getBoundingClientRect().top+(!p.parentElement||/^html$/i.test(p.parentElement.nodeName)?o.scrollY:0):0,w=g?g.getBoundingClientRect().left+(!g.parentElement||/^html$/i.test(g.parentElement.nodeName)?o.scrollX:0):0;d=b?e.clientHeight:d,u=y?e.clientWidth:u;const _=pt(this.#Y.get("_wd"));return{top:n,left:l,ts:C,ls:w,width:a,height:r,x:h,y:c,ohOffsetEl:i?window:p,owOffsetEl:i?window:g,oh:i?_.h:d,ow:i?_.w:u,heightEditorRefer:b,widthEditorRefer:y}}getWWScroll(){const t=this.#Y.get("eventWysiwyg"),e=t.scrollTop||t.scrollY||0,s=t.scrollHeight||t.document?.documentElement.scrollHeight||0;return{top:e,left:t.scrollLeft||t.scrollX||0,width:t.scrollWidth||t.document?.documentElement.scrollWidth||0,height:s,bottom:e+s}}setRelPosition(t,e,s,i,{preferUp:n}={}){const r=/^fixed$/i.test(o.getComputedStyle(i).position),a=this.getGlobal(s);if(r)t.style.position="fixed",t.style.top=n?a.fixedTop-t.offsetHeight+"px":`${a.fixedTop+a.height}px`;else{t.style.position="";const r=i.contains(t)?this.getGlobal(e).top:0,h=t.offsetHeight,c=o.scrollY,d=a.top;if(n){const e=r-c+d;if(e<h){const i=pt(l).h-(r-c+d+s.offsetHeight);i>=h?t.style.top=`${d+s.offsetHeight}px`:i>e?(t.style.height=`${i}px`,t.style.top=`${d+s.offsetHeight}px`):(t.style.height=`${e}px`,t.style.top=-1*(e-d+3)+"px")}else t.style.top=d-h+"px"}else{const e=pt(l).h-(r-c+d+s.offsetHeight);if(e<h){let i=-1*(h-d+3);const n=r-c+i,o=h+(n<0?n:0);o>e?(t.style.height=`${o}px`,i=-1*(o-d+3)):(t.style.height=`${e}px`,i=d+s.offsetHeight),t.style.top=`${i}px`}else t.style.top=`${d+s.offsetHeight}px`}}const h=t.offsetWidth,c=a.left,d=this.getGlobal(i).left;if(this.#ot.get("_rtl")){const e=s.getBoundingClientRect(),n=o.innerWidth;let l=n-e.right;if(h>0){const t=i.getBoundingClientRect();n-l-h<t.left&&(l=n-t.left-h)}t.style.left="auto",t.style.right=`${Math.max(0,l)}px`}else{const e=i.offsetWidth+d,s=e<=h?0:e-(c+h);t.style.right="",t.style.left=s<0?`${c+s}px`:`${c}px`}}setAbsPosition(t,e,s){const i={left:0,right:0,top:0,...s.addOffset},n=s.position||"bottom",r=s.inst,a=!this.#ot.get("_rtl");a||(i.left*=-1);const h=this.#Q.get("iframe"),c=this.#Y.get("wrapper").contains(e)||s.isWWTarget||!!h&&this.#Y.get("wysiwyg").contains(e),d=Boolean(Ct(e,".se-toolbar")),u=1===e.nodeType,p=c&&!u,g=u&&/inline/.test(o.getComputedStyle(e).display),m=pt(l),f=p?this.getWWScroll():this.#lt(),v=!c||!h&&u?e.getBoundingClientRect():this.#J.selection.getRects(e,"start").rects,b=this.getGlobal(e),y=ct(t.firstElementChild,"se-arrow")?t.firstElementChild:null,C=s.sibling?.offsetHeight||0,w=y?y.offsetHeight:0,_=t.offsetHeight,x=e.offsetHeight,$=v.top,k=m.h-v.bottom,S=this.getGlobal(this.#Y.get("topArea")).top,E=o.scrollY,T=this.#e.get("toolbar_main").offsetHeight,M=this.#ot.get("toolbar_container"),H=this.#t.mode.isBalloon||this.#t.mode.isInline||M,L=M&&S-E-T>0||!this.#J.toolbar.isSticky&&H?0:T+(this.#J.toolbar.isSticky?this.#ot.get("_toolbar_sticky"):0),N=this.#Y.get("statusbar")?.offsetHeight||0,{rmt:A,rmb:B,bMargin:I,rt:V}=this.#rt($,k,L,m,v,p,d);if(c&&(B-N+x<=0||A+V+x-(this.#J.toolbar.isSticky&&g?L:0)<=0)||A+x<0)return;const O=this.#Y.get("topArea").getBoundingClientRect(),R=this.#t.mode.isBottom?O.bottom>=o.innerHeight-T:O.top<=T,P=this.#J.toolbar.isSticky&&"none"!==this.#e.get("toolbar_main").style.display&&(!H||R);let z=i.top,D=0,F="";"bottom"===n?(F="up",z+=v.bottom+w+E,D=B-(_+w),D-C<0&&(F="down",z-=x+_+2*w,D=A-(_+w),D-C<0&&(F="",z-=D-C-Math.max(1,D+_+w)))):(F="down",z+=v.top-_-w+E,D=(P&&!this.#t.mode.isBottom?v.top-L:A)-_-w,D-C<0&&(F="up",z+=x+_+2*w,D=(B>0?I:B)-(_+w)-N,D-C<0&&(F="",z+=D-2))),this.#at(y,F),t.style.top=`${z}px`;const q=(1===t.nodeType?Oe.get(o.getComputedStyle(t).borderRadius):0)||0,W=b.width,U=t.offsetWidth,Z=y?y.offsetWidth:0,G=v.left,j=m.w-v.right;if(c&&(G+W<=0||j+W<=0))return;y&&(y.style.left="",y.style.right="");let K=i.left||(i.right?a?i.right-t.offsetWidth:t.offsetWidth-i.right:0),Y=0,X=0,J=0;return a?(K+=v.left+o.scrollX-(G<0?G:0),Y=W+G,Y<Z&&(J=Z/2-1+(q<=2?0:q-2),X=J),Y=W+j-U,Y<0&&(K+=Y,J=U-1-(Z/2+(q<=2?0:q-2)),X=-(Y-Z/2),X=X>J?J:X),y&&X>0&&(y.style.left=X+"px")):(K+=v.right-U+o.scrollX+(j<0?j:0),Y=W+j,Y<Z&&(J=Z/2-1+(q<=2?0:q-2),X=J),Y=W+G-U,Y<0&&(K-=Y,J=Z/2-1+(q<=2?0:q-2),X=-(Y-Z/2),X=X<J?J:X>U-J?U-J:X),y&&X>0&&(y.style.right=X+"px")),t.style.left=`${K}px`,r.__offset={left:t.offsetLeft+f.left,top:t.offsetTop+f.top,addOffset:i},{position:"up"===F?"bottom":"top"}}setRangePosition(t,e,{position:s,addTop:i}={}){t.style.top="-10000px",t.style.visibility="hidden",t.style.display="block";let n="top"===s;e||=this.#J.selection.getRange();const r=this.#J.selection.getRects(e,n?"start":"end");if(n="start"===r.position,r.rects.noText){let t=e.startContainer;1===t.nodeType&&(t=t.childNodes[e.startOffset]||t);const s=t.parentNode;if(s){const e=lt(E);s.insertBefore(e,t);const i=l.createRange();i.setStart(e,1),i.setEnd(e,1);const n=i.getClientRects()[0];n&&(r.rects=n,r.scrollLeft=o.scrollX,r.scrollTop=o.scrollY),s.removeChild(e)}}const a=this.#Y.get("isFullScreen"),h=this.#Y.get("topArea"),c=this.#nt.contains(t),d=r.rects,u=a?0:r.scrollLeft,p=a?0:r.scrollTop,g=c?pt(l).w:h.offsetWidth,m=this.getGlobal(h),f=c?0:m.left,v=t.offsetWidth,b=t.offsetHeight;this.#ht(n,d,t,f,g,u,p,i),this.getGlobal(t).top-m.top<0&&(n=!n,this.#ht(n,d,t,f,g,u,p,i)),v===t.offsetWidth&&b===t.offsetHeight||this.#ht(n,d,t,f,g,u,p,i);const y=!this.#nt.contains(t),C=pt(l),w=d.height,_=d.top,x=C.h-d.bottom,$=this.#J.toolbar.isSticky||!this.#t.mode.isBalloon&&!this.#t.mode.isInline?this.#e.get("toolbar_main").offsetHeight:0,{rmt:k,rmb:S,rt:T}=this.#rt(_,x,$,C,d,y,!1);if(!(S+w<=0||k+T+w<=0))return t.style.visibility="",!0}#ht(t,e,s,i,n,o,r,a=0){const h=s.querySelector(".se-arrow "),c=Math.round(h.offsetWidth/2),d=s.offsetWidth,u=e.noText&&!t?0:s.offsetHeight,p=(t?e.left:e.right)-i-d/2+o,g=p+d-n;let m=(t?e.top-u-c:e.bottom+c)-(e.noText?0:a)+r;const f=p<0?1:g<0?p:p-g-1-1;let v=!1;const b=m+(t?this.getGlobal(this.#Y.get("topArea")).top:s.offsetHeight-this.#Y.get("wysiwyg").offsetHeight);!t&&b>0&&this.#ct()<b?(t=!0,v=!0):t&&l.documentElement.offsetTop>b&&(t=!1,v=!0),v&&(m=(t?e.top-u-c:e.bottom+c)-(e.noText?0:a)+r),s.style.left=Math.floor(f)+"px",s.style.top=Math.floor(m)+"px",t?(ut(h,"se-arrow-up"),dt(h,"se-arrow-down")):(ut(h,"se-arrow-down"),dt(h,"se-arrow-up"));const y=Math.floor(d/2+(p-f));h.style.left=(y+c>s.offsetWidth?s.offsetWidth-c:y<c?c:y)+"px"}#ct(){const t=this.#Y.get("topArea");return l.documentElement.scrollHeight-(this.getGlobal(t).top+t.offsetHeight)}#rt(t,e,s,i,n,l,r){const a=this.#J.selection.getRects(this.#Y.get("wysiwyg"),"start").rects;let h=0,c=0,d=0,u=0,p=0;const g=this.#Q.get("iframe");u=n.top,p=i.h-n.bottom;const m=this.getGlobal(),f=this.#t.mode.isBottom;if(l){d=r||this.#J.toolbar.isSticky||this.#ot.get("toolbar_container")?0:s;const t=g?0:m.top-o.scrollY+d,e=g?0:this.#t.get("currentViewportHeight")-(m.top+m.height-o.scrollY);let i=t,l=e;f?(s>e?l=this.#J.toolbar.isSticky?s:e+s:this.#ot.get("toolbar_container")&&!this.#J.toolbar.isSticky?s=0:l=e+s,h=n.top-(a.top-t),c=a.bottom-(n.bottom-l)+s,c=c>0?c:c-s):(s>t?i=this.#J.toolbar.isSticky?s:t+s:this.#ot.get("toolbar_container")&&!this.#J.toolbar.isSticky?s=0:i=t+s,h=n.top-(a.top-i)+s,c=a.bottom-(n.bottom-e),h=h>0?h:h-s)}else{const t=m.fixedTop>0?m.fixedTop:0,e=o.innerHeight-(m.fixedTop+m.height);d=r||!this.#J.toolbar.isSticky&&this.#J.toolbar.isBalloonMode?0:s,f?(h=u-(r?0:t),c=p-(e>0?e:0)-d):(h=u-(r?0:t)-d,c=p-(e>0?e:0))}return{rmt:h,rmb:c,rt:d,tMargin:u,bMargin:p}}#at(t,e){"up"===e?(t&&(t.style.visibility=""),dt(t,"se-arrow-up"),ut(t,"se-arrow-down")):"down"===e?(t&&(t.style.visibility=""),dt(t,"se-arrow-down"),ut(t,"se-arrow-up")):t&&(t.style.visibility="hidden")}#lt(){const t=pt(l);return{top:o.scrollY,left:o.scrollX,width:t.w,height:t.h,bottom:o.scrollY+t.h,rects:{left:0,top:0,right:o.innerWidth,bottom:this.#t.get("currentViewportHeight")||o.innerHeight,noText:!0}}}},{_w:Hs}=Ae;const Ls=class{#D;#J;#t;#it;#dt;#e;#Y;#ot;#Q;#ut=0;#pt=!1;constructor(t){this.#D=t,this.#J=t.$,this.#t=t.store,this.#it=this.#J.contextProvider.shadowRoot,this.#dt=this.#J.instanceCheck,this.#e=this.#J.context,this.#Y=this.#J.frameContext,this.#ot=this.#J.options,this.#Q=this.#J.frameOptions,this.range=null,this.selectionNode=null,this.__iframeFocus=!1}get(){let t=null;return t="function"==typeof this.#it?.getSelection?this.#it.getSelection():this.#Y.get("_ww").getSelection(),t?(this.#t.get("_range")||this.#Y.get("wysiwyg").contains(t.focusNode)||(t.removeAllRanges(),t.addRange(this.#gt())),t):null}isRange(t){return this.#dt.isRange(t)}getRange(){const t=this.#t.get("_range")||this.#gt(),e=this.get();if(t.collapsed===e.isCollapsed||!this.#Y.get("wysiwyg").contains(e.focusNode)){if(this.#J.component.is(t.startContainer)){const e=this.#J.component.get(t.startContainer),s=e?.container;return s?this.setRange(s,0,s,1):t}return t}if(e.rangeCount>0){const t=e.getRangeAt(0);return this.#t.set("_range",t),t}{const t=e.anchorNode,s=e.focusNode,i=e.anchorOffset,n=e.focusOffset,o=Ve.query.compareElements(t,s),l=o.ancestor&&(0===o.result?i<=n:o.result>1);return this.setRange(l?t:s,l?i:n,l?s:t,l?n:i)}}setRange(t,e,s,i){let n,o,l,r;if(this.isRange(t)){const e=t;n=e.startContainer,o=e.startOffset,l=e.endContainer,r=e.endOffset}else n=t,o=e,l=s,r=i;if(!n||!l)return;(Ve.check.isBreak(n)||3===n.nodeType)&&o>n.textContent.length&&(o=n.textContent.length),(Ve.check.isBreak(l)||3===l.nodeType)&&r>l.textContent.length&&(r=l.textContent.length),this.#J.format.isLine(n)&&(n=n.childNodes[o>0?n.childNodes.length-1:0]||n,o=o>0?1!==n.nodeType||Ve.check.isBreak(n)?n.textContent?n.textContent.length:0:1:0),this.#J.format.isLine(l)&&(l=l.childNodes[r>0?l.childNodes.length-1:0]||l,r=r>0?1!==l.nodeType||Ve.check.isBreak(l)?l.textContent?l.textContent.length:0:1:0);const a=this.#Y.get("_wd").createRange();try{o=Math.min(o,n.textContent?.length||0),r=r>0&&0===(l.textContent?.length||0)&&1===l.nodeType?1:Math.min(Math.max(r,0),l.textContent?.length||0),a.setStart(n,o),a.setEnd(l,r),this.#t.set("hasFocus",!0)}catch(t){return console.warn("[SUNEDITOR.selection.focus.warn]",t.message),void this.#J.focusManager.nativeFocus()}const h=this.get();return h.removeAllRanges&&h.removeAllRanges(),h.addRange(a),this.#t.set("_range",a),this.#mt(a,this.get()),this.#Q.get("iframe")&&this.__focus(),a}removeRange(){this.#t.set("_range",null),this.#t.set("_lastSelectionNode",null),this.selectionNode=null,this.#t.get("hasFocus")&&this.get().removeAllRanges(),this.#D._eventOrchestrator.selectionState.reset()}getNearRange(t){const e=t.nextSibling,s=t.previousSibling;return e?{container:e,offset:0}:s?{container:s,offset:1}:null}getRangeAndAddLine(t,e){if(this.#ft(t)){const s=e?.parentElement||this.#Y.get("wysiwyg"),i=Ve.utils.createElement(this.#ot.get("defaultLine"),null,"<br>");s.insertBefore(i,e&&e!==s?e.previousElementSibling?e.nextElementSibling:e:s.firstElementChild),this.setRange(i.firstElementChild,0,i.firstElementChild,1),t=this.#t.get("_range")}return t}getNode(){if(this.#Y.get("wysiwyg").contains(this.selectionNode)||this.init(),!this.selectionNode){const t=Ve.query.getEdgeChild(this.#Y.get("wysiwyg").firstChild,(t=>0===t.childNodes.length||3===t.nodeType),!1);if(t)return this.selectionNode=t,t;this.init()}return this.selectionNode}getRects(t,e){const s=!!Ve.check.isElement(t)&&"absolute"===Hs.getComputedStyle(t).position;t=!t||Ve.check.isText(t)?this.getRange():t;let i="start"===e,n=Hs.scrollX,o=Hs.scrollY,l=t.getClientRects();if(l=l[i?0:l.length-1],!l){const t=this.getNode();if(this.#J.format.isLine(t)){const t=Ve.utils.createTextNode(Be.zeroWidthSpace);this.#J.html.insertNode(t,{afterNode:null,skipCharCount:!0}),this.setRange(t,1,t,1),this.init(),l=this.getRange().getClientRects(),l=l[i?0:l.length-1]}if(!l){const e=this.#J.offset.get(t);l={left:e.left,top:e.top,right:e.left+t.offsetWidth,bottom:e.top+t.offsetHeight,noText:!0},n=0,o=0}i=!0}const r=/^iframe$/i.test(this.#Y.get("wysiwygFrame").nodeName)?this.#Y.get("wysiwygFrame").getClientRects()[0]:null;return!s&&r&&(l={left:l.left+r.left,top:l.top+r.top,right:l.right+r.right-r.width,bottom:l.bottom+r.bottom-r.height}),{rects:l,position:i?"start":"end",scrollLeft:n,scrollTop:o}}getDragEventLocationRange(t){const e=this.#Y.get("_wd");let s,i,n,o,l;return e.caretPositionFromPoint?(s=e.caretPositionFromPoint(t.clientX,t.clientY),i=s.offsetNode,n=s.offset,o=s.offsetNode,l=s.offset):e.caretRangeFromPoint&&(s=e.caretRangeFromPoint(t.clientX,t.clientY),i=s.startContainer,n=s.startOffset,o=s.endContainer,l=s.endOffset),{sc:i,so:n,ec:o,eo:l}}scrollTo(t,e){const s=e?.noFocus;if(this.#dt.isSelection(t))t=t.getRangeAt(0);else if(this.#dt.isNode(t))if(s){const e=this.#Y.get("_wd").createRange();e.selectNodeContents(t),t=e}else t=this.setRange(t,1,t,1);else void 0===t?.startContainer&&console.warn('[SUNEDITOR.html.scrollTo.warn] "selectionRange" must be Selection or Range or Node object.',t);const i=Ve.query.getParentElement(t?.startContainer,(t=>1===t.nodeType));if(!i)return;delete(e={behavior:"smooth",block:"nearest",inline:"nearest",...e}).noFocus;const n=this.#Y.get("_ww"),o=this.#Y.get("wysiwygFrame"),l=this.#Q.get("iframe"),r=!this.#t.get("isScrollable")(this.#Y),a=this.#t.get("currentViewportHeight"),h=r?Hs.scrollY:l?n.scrollY:o.scrollTop,c=this.#t.mode.isBottom,d=this.#e.get("toolbar_main").offsetHeight,u=this.#J.toolbar.isSticky?d:0,p=this.#J.toolbar.isSticky?u+this.#ot.get("_toolbar_sticky"):u,g=this.#Y.get("statusbar")?.offsetHeight||0;if(this.#pt){const s=this.#J.format.isBrLine(i)?t?.getBoundingClientRect?.():null;return s?.height>0?this.#vt(s,e.behavior):i?.scrollIntoView(e),void("auto"===e?.behavior&&h!==Hs.scrollY&&(p?c?h<Hs.scrollY&&Hs.scrollBy(0,p):h>Hs.scrollY&&Hs.scrollBy(0,-p):r&&Hs.scrollBy(0,g)))}const m=this.#ut,f=r?a-(c?p:0):o.offsetHeight,v=t?.getBoundingClientRect?.(),b=(v?.height>0?v.height:i.offsetHeight)||0,y=e?.behavior,C=c?0:p;if(r)if(l){const e=this.getRects(t,"end").rects,s=e.top+b-C,i=f-m-(e.top+b);if(s>=0&&i>=0)return;const n=h-(s<0?-(s-m):i);Hs.scrollTo({top:n<h?n-C:n,behavior:y})}else{const t=f+h-(v?.height>0?v.top+h:this.#J.offset.getGlobal(i).top)-b;if(t-m>0&&f>t+m+C)return;const e=t<=m?h-t+m+g:h-t+(f-b-m);Hs.scrollTo({top:e<h?e-C:e,behavior:y})}else{const t=v?.height>0?v.top:i.getBoundingClientRect().top,e=l?t:t-o.getBoundingClientRect().top,s=e>=(c?0:u)&&e+m<=f;let r=h+(c?e-m>0?e+m-f+u:e-b:e-m>0?e+m-f:e-(u+b));const p=Hs.scrollY,C=this.#J.offset.getGlobal(),w=c?0:d,_=c?d:0,x=p-C.top+w,$=C.top+C.height-(p+a)+_;if(x>0){const t=(s?e:e+h-r)-b-m-x;t<0&&(r+=w,Hs.scrollTo({top:p+t,behavior:"smooth"}))}if($>0){const t=(s?e:e+h-r)+b+m-(C.height-$);t>0&&(r+=c?_:g,Hs.scrollTo({top:p+t,behavior:"smooth"}))}s||(l?n:o).scrollTo({top:r,behavior:y})}}#vt(t,e){let{top:s,bottom:i}=t;const n=[...this.#D._eventOrchestrator.scrollparents||[],Hs];for(const t of n){const n=t===Hs,o=n?0:t.getBoundingClientRect().top,l=n?this.#t.get("currentViewportHeight"):t.getBoundingClientRect().bottom;let r=0;s<o?r=s-o:i>l&&(r=i-l),0!==r&&(t.scrollBy({top:r,behavior:e}),s-=r,i-=r)}}resetRangeToTextNode(){let t=this.getRange();if(this.#ft(t)){if(!Ve.check.isWysiwygFrame(t.startContainer)||!Ve.check.isWysiwygFrame(t.endContainer))return!1;const e=t.commonAncestorContainer,s=e.children[t.startOffset],i=e.children[t.endOffset];if(!(t=this.setRange(s,0,i,s===i?0:1)))return!1}const e=t,s=e.collapsed;let i,n,o,l=e.startContainer,r=e.startOffset,a=e.endContainer,h=e.endOffset;if(this.#J.format.isLine(l))for(l.childNodes[r]?(l=l.childNodes[r]||l,r=0):(l=l.lastChild||l,r=l.textContent.length);1===l?.nodeType&&l.firstChild;)l=l.firstChild||l,r=0;if(this.#J.format.isLine(a)){for(a=a.childNodes[h]||a.lastChild||a;1===a?.nodeType&&a.lastChild;)a=a.lastChild;s?h=0:h>0&&(h=a.textContent.length)}if(i=Ve.check.isWysiwygFrame(l)?this.#Y.get("wysiwyg").firstChild:l,n=r,Ve.check.isBreak(i)||1===i.nodeType&&i.childNodes.length>0){const t=Ve.check.isBreak(i);if(!t){const t=i;for(;i&&!Ve.check.isBreak(i)&&1===i.nodeType&&(o=i.childNodes,0!==o.length);)i=o[n>0?n-1:n]||!/FIGURE/i.test(o[0].nodeName)?o[0]:i.previousElementSibling||i.previousSibling||l,n=n>0?i.textContent.length:n;let e=this.#J.format.getLine(i,null);e===this.#J.format.getBlock(e,null)&&(i||=t,e=Ve.utils.createElement(Ve.query.getParentElement(i,Ve.check.isTableCell)?"DIV":this.#ot.get("defaultLine")),i.parentNode.insertBefore(e,i),i!==t&&e.appendChild(i))}if(Ve.check.isBreak(i)||this.#J.component.is(i)){const e=Ve.utils.createTextNode(Be.zeroWidthSpace);i.parentNode.insertBefore(e,i),i=e,t&&l===a&&(a=i,h=1)}}if(l=i,r=n,i=Ve.check.isWysiwygFrame(a)?this.#Y.get("wysiwyg").lastChild:a,n=h,Ve.check.isBreak(i)||1===i.nodeType&&i.childNodes.length>0){const t=Ve.check.isBreak(i);if(!t){for(;i&&!Ve.check.isBreak(i)&&1===i.nodeType&&(o=i.childNodes,0!==o.length);)i=o[n>0?n-1:n]||!/FIGURE/i.test(o[0].nodeName)?o[0]:i.previousElementSibling||i.previousSibling||l,n=n>0?i.textContent.length:n;let t=this.#J.format.getLine(i,null);t===this.#J.format.getBlock(t,null)&&(t=Ve.utils.createElement(Ve.check.isTableCell(t)?"DIV":this.#ot.get("defaultLine")),i.parentNode.insertBefore(t,i),t.appendChild(i))}if(Ve.check.isBreak(i)){const e=Ve.utils.createTextNode(Be.zeroWidthSpace);i.parentNode.insertBefore(e,i),i=e,n=1,t&&!i.previousSibling&&Ve.utils.removeItem(a)}}return a=i,h=n,this.setRange(l,r,a,h),!0}init(){const t=this.#Y.get("_wd").activeElement;if(Ve.check.isInputElement(t))return this.selectionNode=t,t;const e=this.get();if(!e)return null;let s=null;s=e.rangeCount>0?e.getRangeAt(0):this.#gt(),this.#mt(s,e)}#mt(t,e){let s=null;this.#t.set("_range",t),s=t.collapsed?Ve.check.isWysiwygFrame(t.commonAncestorContainer)&&t.commonAncestorContainer.children[t.startOffset]||t.commonAncestorContainer:e.anchorNode,this.selectionNode=s}#ft(t){const e=t.commonAncestorContainer;return Ve.check.isWysiwygFrame(t.startContainer)&&Ve.check.isWysiwygFrame(t.endContainer)||/FIGURE/i.test(e.nodeName)||this.#J.pluginManager.fileInfo.regExp.test(e.nodeName)&&(!this.#J.pluginManager.fileInfo.tagAttrs[e.nodeName]||this.#J.pluginManager.fileInfo.tagAttrs[e.nodeName]?.every((t=>e.hasAttribute(t))))||this.#J.component.is(e)}#gt(){const t=this.#Y.get("wysiwyg"),e=this.#Y.get("_wd").createRange();let s=t.firstElementChild,i=null;return s?(i=s.firstChild,i||(i=Ve.utils.createElement("BR"),s.appendChild(i))):(i=Ve.utils.createElement("BR"),s=Ve.utils.createElement(this.#ot.get("defaultLine"),null,i),t.appendChild(s)),e.setStart(i,0),e.setEnd(i,0),e}__focus(){try{this.__iframeFocus=!0;const t=Ve.query.getParentElement(this.getNode(),"figcaption");t?t.focus():this.#Y.get("wysiwyg").focus()}finally{Hs.setTimeout((()=>this.__iframeFocus=!1),0)}}__init(){this.#pt=this.#D._eventOrchestrator.scrollparents?.length>0,this.#ut=this.#Y?.get("wysiwyg")?(Oe.get(Hs.getComputedStyle(this.#Y.get("wysiwyg")).scrollMargin,0)||40)+Oe.get(Hs.getComputedStyle(this.#Y.get("wrapper")).paddingBottom,0):40}};function Ns(t,e,s){const i=[];for(let n,o,l=0,r=t.length;l<r;l++)n=t[l],Ve.check.isListCell(n)?(e<0||n.previousElementSibling)&&i.push(n):(o=/\d+/.test(n.style[s])?Oe.get(n.style[s],0):0,o+=e,Ve.utils.setStyle(n,s,o<=0?"":o+"px"));return i}const As=class{#J;#t;#ot;#Y;#bt;#yt;#Ct;#wt;#_t;#xt;#$t=null;constructor(t){this.#J=t.$,this.#t=t.store,this.#ot=this.#J.options,this.#Y=this.#J.frameContext,this.#bt=this.#ot.get("formatLine").reg,this.#yt=this.#ot.get("formatBrLine").reg,this.#Ct=this.#ot.get("formatBlock").reg,this.#wt=this.#ot.get("formatClosureBlock").reg,this.#_t=this.#ot.get("formatClosureBrLine").reg,this.#xt=new RegExp("^("+this.#ot.get("textStyleTags")+")$","i"),this.__resetBrLineBreak(this.#ot.get("defaultLineBreakFormat"))}setLine(t){if(!this.isLine(t))throw new Error('[SUNEDITOR.format.setLine.fail] The "element" must satisfy "format.isLine()".');const e=this.#kt(),s=e.lines,i=t.className,n=t.nodeName;let o=e.firstNode,l=e.lastNode;for(let e,r,a=0,h=s.length;a<h;a++)e=s[a],e.nodeName===n&&(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim()===i||this.#J.component.is(e)||(r=t.cloneNode(!1),Ve.utils.copyFormatAttributes(r,e),r.innerHTML=e.innerHTML,e.parentNode.replaceChild(r,e)),0===a&&(o=r||e),a===h-1&&(l=r||e),r=null;this.#J.selection.setRange(Ve.query.getNodeFromPath(e.firstPath,o),e.startOffset,Ve.query.getNodeFromPath(e.lastPath,l),e.endOffset),this.#J.history.push(!1),this.#Y.has("documentType_use_header")&&this.#Y.get("documentType").reHeader()}getLine(t,e){if(!t)return null;for(e||=()=>!0;t;){if(Ve.check.isWysiwygFrame(t))return null;if(this.isBlock(t)){if(this.isLine(t.firstElementChild))return t.firstElementChild;if(this.isLine(t))return t}if(this.isLine(t)&&e(t))return t;t=t.parentNode}return null}setBrLine(t){if(!this.isBrLine(t))throw new Error('[SUNEDITOR.format.setBrLine.fail] The "element" must satisfy "format.isBrLine()".');const e=this.#kt().lines,s=e.length-1;let i=e[s].parentNode,n=t.cloneNode(!1);const o=n;for(let o,l,r,a,h,c,d=s,u=!0;d>=0;d--)if(o=e[d],o!==(e[d+1]?e[d+1].parentNode:null)){if(c=this.#J.component.is(o),l=c?"":o.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),r=Ve.query.getParentElement(o,(t=>t.parentNode===i)),(i!==o.parentNode||c)&&(this.isLine(i)?(i.parentNode.insertBefore(n,i.nextSibling),i=i.parentNode):(i.insertBefore(n,r?r.nextSibling:null),i=o.parentNode),a=n.nextSibling,a&&n.nodeName===a.nodeName&&Ve.check.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,Ve.utils.removeItem(a)),n=t.cloneNode(!1),u=!0),h=n.innerHTML,n.innerHTML=(u||!l||!h||/<br>$/i.test(l)?l:l+"<BR>")+h,0===d){i.insertBefore(n,o),a=o.nextSibling,a&&n.nodeName===a.nodeName&&Ve.check.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,Ve.utils.removeItem(a));const t=n.previousSibling;t&&n.nodeName===t.nodeName&&Ve.check.isSameAttributes(n,t)&&(t.innerHTML+="<BR>"+n.innerHTML,Ve.utils.removeItem(n))}c||Ve.utils.removeItem(o),l&&(u=!1)}this.#J.selection.setRange(o,0,o,0),this.#J.history.push(!1)}getBrLine(t,e){if(!t)return null;for(e||=()=>!0;t;){if(Ve.check.isWysiwygFrame(t))return null;if(this.isBrLine(t)&&e(t))return t;t=t.parentNode}return null}addLine(t,e){if(!t||!t.parentNode)return null;const s=this.getLine(this.#J.selection.getNode(),null);let i=null;if(this.isBrLine(t)||!this.isBrLine(s||t.parentNode)||this.#J.component.is(t)){const t=e?"string"==typeof e?e:e.nodeName:this.isNormalLine(s)?s.nodeName:this.#ot.get("defaultLine");i=Ve.utils.createElement(t,null,"<br>"),(e&&"string"!=typeof e||!e&&this.isLine(s))&&Ve.utils.copyTagAttributes(i,e||s,["id"])}else i=Ve.utils.createElement("BR");return Ve.check.isTableCell(t)?t.insertBefore(i,t.nextElementSibling):t.parentNode.insertBefore(i,t.nextElementSibling),i}addLineAfter(t){if(!t||!t.parentNode)return null;const e=t.nodeName,s=this.#ot.get("lineAttrReset");let i;return/^H[1-6]$|^HR$/i.test(e)||this.isBrLine(t)?i=Ve.utils.createElement(this.#ot.get("defaultLine"),null,"<br>"):(i=Ve.utils.createElement(e,null,"<br>"),Ve.utils.copyTagAttributes(i,t,s)),Ve.check.isTableCell(t)?t.insertBefore(i,t.nextElementSibling):t.parentNode.insertBefore(i,t.nextElementSibling),i}getBlock(t,e){if(!t)return null;for(e||=()=>!0;t;){if(Ve.check.isWysiwygFrame(t))return null;if(this.isBlock(t)&&!/^(THEAD|TBODY|TR)$/i.test(t.nodeName)&&e(t))return t;t=t.parentNode}return null}applyBlock(t){this.#J.selection.getRangeAndAddLine(this.#J.selection.getRange(),null);const e=this.getLinesAndComponents(!1);if(!e||0===e.length)return;t:for(let t,s,i,n,o,l,r=0,a=e.length;r<a;r++)if(t=e[r],Ve.check.isListCell(t))if(s=t.lastElementChild,s&&Ve.check.isListCell(t.nextElementSibling)&&e.includes(t.nextElementSibling)&&(n=s.lastElementChild,e.includes(n))){let t=null;for(;t=n.lastElementChild;)if(Ve.check.isList(t)){if(!e.includes(t.lastElementChild))continue t;n=t.lastElementChild}i=s.firstElementChild,o=e.indexOf(i),l=e.indexOf(n),e.splice(o,l-o+1),a=e.length}else;const s=e.at(-1);let i,n,o;i=this.isBlock(s)||this.isLine(s)?s:this.getBlock(s,null)||this.getLine(s,null),Ve.check.isTableCell(i)?(n=null,o=i):(n=i.nextSibling,o=i.parentNode);const l=t.cloneNode(!1);let r=Ve.query.getNodeDepth(i),a=null;const h=[],c=(t,e,s)=>{let i=null;if(t!==e&&!Ve.check.isTableElements(e)){if(e&&Ve.query.getNodeDepth(t)===Ve.query.getNodeDepth(e))return s;i=this.#J.nodeTransform.removeAllParents(e,null,t)}return i?i.ec:s};for(let t,s,i,d,u,p,g,m=0,f=e.length;m<f;m++)if(t=e[m],s=t.parentNode,s&&!l.contains(s))if(i=Ve.query.getNodeDepth(t),Ve.check.isList(s)){if(null===a&&(p?(a=p,g=!0,p=null):a=s.cloneNode(!1)),h.push(t),u=e[m+1],m===f-1||u?.parentNode!==s){t.contains(u?.parentNode)&&(p=u.parentNode.cloneNode(!1));let e,m=s.parentNode;for(;Ve.check.isList(m);)e=Ve.utils.createElement(m.nodeName),e.appendChild(a),a=e,m=m.parentNode;const f=this.removeBlock(s,{selectedFormats:h,newBlockElement:null,shouldDelete:!0,skipHistory:!0});r>=i?(r=i,o=f.cc,n=c(o,s,f.ec),n&&(o=n.parentNode)):o===f.cc&&(n=f.ec),o!==f.cc&&(d=c(o,f.cc,d),n=void 0!==d?d:f.cc);for(let t=0,e=f.removeArray.length;t<e;t++)a.appendChild(f.removeArray[t]);g||l.appendChild(a),p&&f.removeArray.at(-1).appendChild(p),a=null,g=!1}}else r>=i&&(r=i,o=s,n=t.nextSibling),l.appendChild(t),o!==s&&(d=c(o,s),void 0!==d&&(n=d));if(this.#t.set("_lastSelectionNode",null),this.#J.nodeTransform.mergeSameTags(l,null,!1),this.#J.nodeTransform.mergeNestedTags(l,(t=>Ve.check.isList(t))),n&&Ve.query.getNodeDepth(n)>0&&(Ve.check.isList(n.parentNode)||Ve.check.isList(n.parentNode.parentNode))){const t=Ve.query.getParentElement(n,(t=>this.isBlock(t)&&!Ve.check.isList(t))),e=this.#J.nodeTransform.split(n,null,t?Ve.query.getNodeDepth(t)+1:0);e.parentNode.insertBefore(l,e)}else o.insertBefore(l,n),c(l,n);const d=Ve.query.getEdgeChildNodes(l.firstElementChild,l.lastElementChild);e.length>1?this.#J.selection.setRange(d.sc,0,d.ec,d.ec.textContent.length):this.#J.selection.setRange(d.ec,d.ec.textContent.length,d.ec,d.ec.textContent.length),this.#J.history.push(!1)}removeBlock(t,{selectedFormats:e,newBlockElement:s,shouldDelete:i,skipHistory:n}={}){const o=this.#J.selection.getRange();let l=o.startOffset,r=o.endOffset,a=Ve.query.getListChildNodes(t,null,1),h=t.parentNode,c=null,d=null,u=t.cloneNode(!1);const p=[],g=Ve.check.isList(s);let m=!1,f=!1,v=!1;const b=(e,s,i,n)=>{if(1===s.childNodes.length&&Ve.check.isZeroWidth(s)&&(s.innerHTML=Be.zeroWidthSpace,l=r=1),3===s.nodeType)return e.insertBefore(s,i),s;const o=(v?s:n).childNodes;let a=s.cloneNode(!1),h=null,c=null;for(;o[0];)c=o[0],!this._isNotTextNode(c)||Ve.check.isBreak(c)||Ve.check.isListCell(a)?a.appendChild(c):(a.childNodes.length>0&&(h||=a,e.insertBefore(a,i),a=s.cloneNode(!1)),e.insertBefore(c,i),h||=c);if(a.childNodes.length>0){if(Ve.check.isListCell(e)&&Ve.check.isListCell(a)&&Ve.check.isList(i))if(g){for(h=i;i;)a.appendChild(i),i=i.nextSibling;e.parentNode.insertBefore(a,e.nextElementSibling)}else{const e=n.nextElementSibling,s=this.#J.listFormat.removeNested(n,!1);if(t!==s||e!==n.nextElementSibling){const e=a.childNodes;for(;e[0];)n.appendChild(e[0]);t=s,f=!0}}else e.insertBefore(a,i);h||=a}return h};for(let n,o,l,r=0,y=a.length;r<y;r++)if(n=a[r],3!==n.nodeType||!Ve.check.isList(u))if(v=!1,i&&0===r&&(c=e&&e.length!==y&&e[0]!==n?u:t.previousSibling),e&&(o=e.indexOf(n)),e&&-1===o)u||=t.cloneNode(!1),u.appendChild(n);else{if(e&&(l=e[o+1]),u&&u.children.length>0&&(h.insertBefore(u,t),u=null),!g&&Ve.check.isListCell(n))if(l&&Ve.query.getNodeDepth(n)!==Ve.query.getNodeDepth(l)&&(Ve.check.isListCell(h)||Ve.utils.arrayFind(n.children,Ve.check.isList))){const e=n.nextElementSibling,s=this.#J.listFormat.removeNested(n,!1);t===s&&e===n.nextElementSibling||(t=s,f=!0)}else{const e=n;n=Ve.utils.createElement(i?e.nodeName:Ve.check.isList(t.parentNode)||Ve.check.isListCell(t.parentNode)?"LI":Ve.check.isTableCell(t.parentNode)?"DIV":this.#ot.get("defaultLine"));const s=Ve.check.isListCell(n),o=e.childNodes;for(;o[0]&&(!Ve.check.isList(o[0])||s);)n.appendChild(o[0]);Ve.utils.copyFormatAttributes(n,e),v=!0}else n=n.cloneNode(!1);if(!f&&(i?(p.push(n),Ve.utils.removeItem(a[r])):(s?(m||(h.insertBefore(s,t),m=!0),n=b(s,n,null,a[r])):n=b(h,n,t,a[r]),f||(e?(d=n,c||=n):c||(c=d=n))),f)){f=v=!1,a=Ve.query.getListChildNodes(t,null,1),u=t.cloneNode(!1),h=t.parentNode,r=-1,y=a.length;continue}}const y=t.parentNode;let C=t.nextSibling;u?.children.length>0&&y.insertBefore(u,C),s?c=s.previousSibling:c||=t.previousSibling,C=t.nextSibling!==u?t.nextSibling:u?u.nextSibling:null,0===t.children.length||0===t.textContent.length?Ve.utils.removeItem(t):this.#J.nodeTransform.removeEmptyNode(t,null,!1);let w=null;if(this.#t.set("_lastSelectionNode",null),i)w={cc:y,sc:c,so:l,ec:C,eo:r,removeArray:p};else{c||=d,d||=c;const t=Ve.query.getEdgeChildNodes(c,d?.parentNode?c:d);t?w={cc:(t.sc||t.ec).parentNode,sc:t.sc,so:l,ec:t.ec,eo:r,removeArray:null}:this.#J.focusManager.focus()}if(n)return w;!i&&w&&(e?this.#J.selection.setRange(w.sc,l,w.ec,r):this.#J.selection.setRange(w.sc,0,w.sc,0)),this.#J.history.push(!1)}indent(){const t=this.#J.selection.getRange(),e=t.startContainer,s=t.endContainer,i=t.startOffset,n=t.endOffset,o=Ns(this.getLines(null),this.#t.get("indentSize"),this.#ot.get("_rtl")?"marginRight":"marginLeft");o.length>0&&this.#J.listFormat.applyNested(o,!1),this.#t.set("_lastSelectionNode",null),this.#J.selection.setRange(e,i,s,n),this.#J.history.push(!1)}outdent(){const t=this.#J.selection.getRange(),e=t.startContainer,s=t.endContainer,i=t.startOffset,n=t.endOffset,o=Ns(this.getLines(null),-1*this.#t.get("indentSize"),this.#ot.get("_rtl")?"marginRight":"marginLeft");o.length>0&&this.#J.listFormat.applyNested(o,!0),this.#t.set("_lastSelectionNode",null),this.#J.selection.setRange(e,i,s,n),this.#J.history.push(!1)}isEdgeLine(t,e,s){if("front"===s){if(e>0)return!1}else if(t?.textContent?.length>e)return!1;let i=!1;const n="front"===s?"previousSibling":"nextSibling";for(;t&&!this.isLine(t)&&!Ve.check.isWysiwygFrame(t);){if(t[n]&&(!Ve.check.isBreak(t[n])||t[n][n]))return!1;i=!0,t=t.parentNode}return i}isTextStyleNode(t){return"string"==typeof t?this.#xt.test(t):1===t?.nodeType&&this.#xt.test(t.nodeName)}isLine(t){return"string"==typeof t?this.#bt.test(t):1===t?.nodeType&&(this.#bt.test(t.nodeName)||Ve.utils.hasClass(t,"__se__format__line_.+|__se__format__br_line_.+"))&&!this.#St(t)}isNormalLine(t){return this.isLine(t)&&(this.#$t||!this.isBrLine(t))&&!this.isBlock(t)}isBrLine(t){return this.#$t&&this.isLine(t)||("string"==typeof t?this.#yt.test(t):1===t?.nodeType&&(this.#yt.test(t.nodeName)||Ve.utils.hasClass(t,"__se__format__br_line_.+"))&&!this.#St(t))}isBlock(t){return"string"==typeof t?this.#Ct.test(t):1===t?.nodeType&&(this.#Ct.test(t.nodeName)||Ve.utils.hasClass(t,"__se__format__block_.+"))&&!this.#St(t)}isClosureBlock(t){return"string"==typeof t?this.#wt.test(t):1===t?.nodeType&&(this.#wt.test(t.nodeName)||Ve.utils.hasClass(t,"__se__format__block_closure_.+"))&&!this.#St(t)}isClosureBrLine(t){return"string"==typeof t?this.#_t.test(t):1===t?.nodeType&&(this.#_t.test(t.nodeName)||Ve.utils.hasClass(t,"__se__format__br_line__closure_.+"))&&!this.#St(t)}getLines(t){if(!this.#J.selection.resetRangeToTextNode())return[];let e=this.#J.selection.getRange();if(Ve.check.isWysiwygFrame(e.startContainer)){const t=this.#Y.get("wysiwyg").children,s=t.length;if(0===s)return[];this.#J.selection.setRange(t[0],0,t[s-1],t[s-1].textContent.trim().length),e=this.#J.selection.getRange()}const s=e.startContainer,i=e.endContainer,n=e.commonAncestorContainer;t||=this.isLine.bind(this);const o=Ve.query.getListChildren(n,(e=>t(e)),null);if(3!==n.nodeType&&(Ve.check.isWysiwygFrame(n)||this.isBlock(n))||o.unshift(this.getLine(n,null)),s===i||1===o.length)return o;const l=this.getLine(s,null),r=this.getLine(i,null);let a=null,h=null;const c=function(t){return!Ve.check.isTableElements(t)||/^TABLE$/i.test(t.nodeName)};let d=this.getBlock(l,c),u=this.getBlock(r,c);Ve.check.isTableElements(d)&&Ve.check.isListCell(d.parentNode)&&(d=d.parentNode),Ve.check.isTableElements(u)&&Ve.check.isListCell(u.parentNode)&&(u=u.parentNode);const p=d===u;for(let t,e=0,s=o.length;e<s;e++)if(t=o[e],l===t||!p&&t===d)a=e;else if(r===t||!p&&t===u){h=e;break}return null===a&&(a=0),null===h&&(h=o.length-1),o.slice(a,h+1)}getLinesAndComponents(t){const e=this.#J.selection.getRange().commonAncestorContainer,s=Ve.query.getParentElement(e,this.#J.component.is.bind(this.#J.component)),i=Ve.check.isTableElements(e)?this.getLines(null):this.getLines((t=>{const e=Ve.query.getParentElement(t,this.#J.component.is.bind(this.#J.component));return this.isLine(t)&&(!e||e===s)||Ve.check.isComponentContainer(t)&&!this.getLine(t)}));if(t)for(let t=0,e=i.length;t<e;t++)for(let s=t-1;s>=0;s--)if(i[s].contains(i[t])){i.splice(t,1),t--,e--;break}return i}_isNotTextNode(t){if(!t)return!1;const e=/^(br|input|select|canvas|img|iframe|audio|video)$/i;return"string"==typeof t?e.test(t):1===t.nodeType&&(this.#J.component.is(t)||e.test(t.nodeName))}_isExcludeSelectionElement(t){return!/FIGCAPTION/i.test(t.nodeName)&&(this.#J.component.is(t)||/FIGURE/i.test(t.nodeName))}#St(t){return Ve.check.isExcludeFormat(t)||this.#J.component.is(t)||Ve.check.isWysiwygFrame(t)}#kt(){let t=this.#J.selection.getRange(),e=this.getLinesAndComponents(!1);if(0===e.length&&(t=this.#J.selection.getRangeAndAddLine(t,null),e=this.getLinesAndComponents(!1),0===e.length))return;const s=t.startOffset,i=t.endOffset;let n=e[0],o=e.at(-1);const l=Ve.query.getNodePath(t.startContainer,n,null),r=Ve.query.getNodePath(t.endContainer,o,null),a=this.#J.listFormat.remove(e,!1);return a.sc&&(n=a.sc),a.ec&&(o=a.ec),this.#J.selection.setRange(Ve.query.getNodeFromPath(l,n),s,Ve.query.getNodeFromPath(r,o),i),{lines:this.getLinesAndComponents(!1),firstNode:n,lastNode:o,firstPath:l,lastPath:r,startOffset:s,endOffset:i}}__resetBrLineBreak(t){return this.#$t="br"===t}};function Bs(t){const e=t.parentNode;if(!t||3===t.nodeType||!e)return;const s=t.childNodes;for(;s[0];)e.insertBefore(s[0],t);e.removeChild(t)}const Is=class{#J;#ot;#Et;#Tt;constructor(t){this.#J=t.$,this.#ot=this.#J.options,this.#Et=this.#ot.get("__listCommonStyle"),this.#Tt=Ie.camelToKebabCase(this.#ot.get("__listCommonStyle"))}apply(t,{stylesToModify:e,nodesToRemove:s,strictRemove:i}={}){if(Ve.query.getParentElement(this.#J.selection.getNode(),Ve.check.isNonEditable))return;this.#J.selection.resetRangeToTextNode();let n=this.#J.selection.getRangeAndAddLine(this.#J.selection.getRange(),null);e=e?.length>0?e:null,s=s?.length>0?s:null;const o=!t,l=o&&!s&&!e;let r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset;if(l&&n.collapsed&&this.#J.format.isLine(r.parentNode)&&this.#J.format.isLine(h.parentNode)||r===h&&1===r.nodeType&&Ve.check.isNonEditable(r)){const t=r.parentNode;if(!Ve.check.isListCell(t)||!Ie.getValues(t.style).some((t=>this.#Tt.includes(t))))return}if(n.collapsed&&!l&&1===r.nodeType&&!Ve.check.isBreak(r)&&!this.#J.component.is(r)){let t=null;const e=r.childNodes[a];e&&(t=e.nextSibling?Ve.check.isBreak(e)?e:e.nextSibling:null);const s=Ve.utils.createTextNode(Be.zeroWidthSpace);r.insertBefore(s,t),this.#J.selection.setRange(s,1,s,1),n=this.#J.selection.getRange(),r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset}this.#J.format.isLine(r)&&(r=r.childNodes[a]||r.firstChild,a=0),this.#J.format.isLine(h)&&(h=h.childNodes[c]||h.lastChild,c=h.textContent.length),o&&(t=Ve.utils.createElement("DIV"));const d=RegExp,u=t.nodeName;if(!l&&r===h&&!s&&t){let e=r,s=0;const i=[],n=t.style;for(let t=0,e=n.length;t<e;t++)i.push(n[t]);const l=t.className,a=t.classList;for(let t=0,e=a.length;t<e;t++)i.push("."+a[t]);if(i.length>0){for(;!this.#J.format.isLine(e)&&!Ve.check.isWysiwygFrame(e);){for(let t=0;t<i.length;t++)if(1===e.nodeType){const r=i[t],a=!!/^\./.test(r)&&new d("\\s*"+r.replace(/^\./,"")+"(\\s+|$)","ig"),h=e.style,c=e.className,u=o?!!h[r]:!!h[r]&&!!n[r]&&h[r]===n[r],p=!1!==a&&(o?!!c.match(a):!!c.match(a)&&!!l.match(a));(u||p)&&s++}e=e.parentNode}if(s>=i.length)return}}let p,g,m={},f={},v="",b="";if(e){for(let t,s=0,i=e.length;s<i;s++)t=e[s],/^\./.test(t)?b+=(b?"|":"\\s*(?:")+t.replace(/^\./,""):v+=(v?"|":"(?:;|^|\\s)(?:")+t;v&&(v+=")\\s*:[^;]*\\s*(?:;|$)",v=new d(v,"ig")),b&&(b+=")(?=\\s+|$)",b=new d(b,"ig"))}if(s){g="^(?:"+s[0];for(let t=1;t<s.length;t++)g+="|"+s[t];g+=")$",g=new d(g,"i")}const y={v:!1},C=function(t){const e=t.cloneNode(!1);if(3===e.nodeType||Ve.check.isBreak(e))return e;if(l)return null;const s=!g&&o||g?.test(e.nodeName);if(s&&!i)return y.v=!0,null;const n=e.style.cssText;let r="";v&&n.length>0&&(r=n.replace(v,"").trim(),r!==n&&(y.v=!0));const a=e.className;let h="";return b&&a.length>0&&(h=a.replace(b,"").trim(),h!==a&&(y.v=!0)),(!o||!b&&a||!v&&n||r||h||!s)&&(r||h||e.nodeName!==u||Boolean(v)!==Boolean(n)||Boolean(b)!==Boolean(a))?(v&&n.length>0&&(e.style.cssText=r),e.style.cssText||e.removeAttribute("style"),b&&a.length>0&&(e.className=h.trim()),e.className.trim()||e.removeAttribute("class"),e.style.cssText||e.className||e.nodeName!==u&&!s?e:(y.v=!0,null)):(y.v=!0,null)},w=this.#J.format.getLines(null);if(0===w.length)return void console.warn("[SUNEDITOR.inline.apply.warn] There is no line to apply.");n=this.#J.selection.getRange(),r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset,this.#J.format.getLine(r,null)||(r=Ve.query.getEdgeChild(w[0],(function(t){return 3===t.nodeType}),!1),a=0),this.#J.format.getLine(h,null)||(h=Ve.query.getEdgeChild(w.at(-1),(function(t){return 3===t.nodeType}),!1),c=h.textContent.length);const _=this.#J.format.getLine(r,null)===this.#J.format.getLine(h,null),x=w.length-(_?0:1);p=t.cloneNode(!1);const $=l||o&&(t=>{for(let e=0,s=t?.length;e<s;e++)if(this._isNonSplitNode(t[e]))return!0;return!1})(s),k=o||this.#Mt(p),S=this.#Ht.bind(this,$,k),E=this.#Lt.bind(this,$,k);if(_){this.#Nt(w[0],e)&&(n=this.#J.selection.setRange(r,a,h,c));const t=this.#At(w[0],p,C,r,a,h,c,l,o,n.collapsed,y,S,E);m.container=t.startContainer,m.offset=t.startOffset,f.container=t.endContainer,f.offset=t.endOffset,m.container===f.container&&Ve.check.isZeroWidth(m.container)&&(m.offset=f.offset=1),this.#Bt(t.ancestor,null)}else{let s=!1;x>0&&this.#Nt(w[x],e)&&(s=!0),this.#Nt(w[0],e)&&(s=!0),s&&this.#J.selection.setRange(r,a,h,c),x>0&&(p=t.cloneNode(!1),f=this.#It(w[x],p,C,h,c,l,o,y,S,E));for(let s,i=x-1;i>0;i--)this.#Nt(w[i],e),p=t.cloneNode(!1),s=this.#Vt(w[i],p,C,l,o,y,f.container),s.endContainer&&s.ancestor.contains(s.endContainer)&&(f.ancestor=null,f.container=s.endContainer),this.#Bt(s.ancestor,null);p=t.cloneNode(!1),m=this.#Ot(w[0],p,C,r,a,l,o,y,S,E,f.container),m.endContainer&&(f.ancestor=null,f.container=m.endContainer),x<=0?f=m:f.container||(f.ancestor=null,f.container=m.container,f.offset=m.container.textContent.length),this.#Bt(m.ancestor,null),this.#Bt(f.ancestor||this.#J.format.getLine(f.container),null)}return this.#J.ui.offCurrentController(),this.#J.selection.setRange(m.container,m.offset,f.container,f.offset),this.#J.history.push(!1),p}remove(){this.apply(null,{stylesToModify:null,nodesToRemove:null,strictRemove:null})}_isNonSplitNode(t){if(!t)return!1;const e=/^(a|label|code|summary)$/i;return"string"==typeof t?e.test(t):1===t.nodeType&&e.test(t.nodeName)}_isIgnoreNodeChange(t){return t&&1===t.nodeType&&(Ve.check.isNonEditable(t)||!this.#J.format.isTextStyleNode(t)||this.#J.component.is(t))}#At(t,e,s,i,n,o,l,r,a,h,c,d,u){let p=i.parentNode;for(;!(p.nextSibling||p.previousSibling||this.#J.format.isLine(p.parentNode)||Ve.check.isWysiwygFrame(p.parentNode))&&p.nodeName!==e.nodeName;)p=p.parentNode;if(!a&&!r&&p===o.parentNode&&p.nodeName===e.nodeName&&Ve.check.isZeroWidth(i.textContent.slice(0,n))&&Ve.check.isZeroWidth(o.textContent.slice(l))){const s=p.childNodes;let r=!0;for(let t,e,n,l,a=0,h=s.length;a<h;a++)if(t=s[a],l=!Ve.check.isZeroWidth(t),t!==i&&t!==o){if(!e&&l||e&&n&&l){r=!1;break}}else t===i&&(e=!0),t===o&&(n=!0);if(r)return Ve.utils.copyTagAttributes(p,e),{ancestor:t,startContainer:i,startOffset:n,endContainer:o,endOffset:l}}c.v=!1;const g=this,m=t,f=[e],v=t.cloneNode(!1),b=i===o;let y,C,w,_,x,$=i,k=n,S=o,E=l,T=!1,M=!1;const H=RegExp;function L(t){const e=new H("(?:;|^|\\s)(?:"+_+"null)\\s*:[^;]*\\s*(?:;|$)","ig");let s=!1;return e&&t.style.cssText.length>0&&(s=e.test(t.style.cssText)),!s}if(function t(i,n){const o=i.childNodes;for(let i,l=0,a=o.length;l<a;l++){const a=o[l];if(!a)continue;let c,p=n;if(!T&&a===$){let t=v;x=d(a);let o="",l="";if(3===$.nodeType){const t=$;o=t.substringData(0,k),l=t.substringData(k,b&&E>=k?E-k:t.data.length-k)}const r=Ve.utils.createTextNode(o),h=Ve.utils.createTextNode(l);if(x){const e=d(n);if(e.parentNode!==t){let s=e,i=null;for(;s.parentNode!==t;){for(n=i=s.parentNode.cloneNode(!1);s.childNodes[0];)i.appendChild(s.childNodes[0]);s.appendChild(i),s=s.parentNode}s.parentNode.appendChild(e)}x=x.cloneNode(!1)}Ve.check.isZeroWidth(r)||n.appendChild(r);const c=d(n);for(c&&(x=c),x&&(t=x),C=a,y=[],_="";C!==t&&C!==m&&null!==C;)i=u(C)?null:s(C),i&&1===C.nodeType&&L(C)&&(y.push(i),_+=C.style.cssText.substring(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentElement;const p=y.pop()||h;for(w=C=p;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(e.appendChild(p),t.appendChild(e),x&&!d(S)&&(e=e.cloneNode(!1),v.appendChild(e),f.push(e)),$=h,k=0,T=!0,C!==h&&C.appendChild($),!b)continue}if(M||a!==S){if(T){if(1===a.nodeType&&!Ve.check.isBreak(a)){g._isIgnoreNodeChange(a)?(v.appendChild(a.cloneNode(!0)),h||(e=e.cloneNode(!1),v.appendChild(e),f.push(e))):t(a,a);continue}C=a,y=[],_="";const o=[];for(;null!==C.parentNode&&C!==m&&C!==e;)i=M?C.cloneNode(!1):s(C),1===C.nodeType&&!Ve.check.isBreak(a)&&i&&L(C)&&(u(C)?x||o.push(i):y.push(i),_+=C.style.cssText.substring(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentElement;y=y.concat(o);const l=y.pop()||a;for(w=C=l;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(!u(e.parentNode)||u(l)||Ve.check.isZeroWidth(e)||(e=e.cloneNode(!1),v.appendChild(e),f.push(e)),M||x||!u(l))l===a?n=M?v:e:M?(v.appendChild(l),n=C):(e.appendChild(l),n=C);else{e=e.cloneNode(!1);const t=l.childNodes;for(let s=0,i=t.length;s<i;s++)e.appendChild(t[s]);l.appendChild(e),v.appendChild(l),f.push(e),n=e.children.length>0?C:e}if(x&&3===a.nodeType)if(d(a)){const t=Ve.query.getParentElement(n,(t=>g._isNonSplitNode(t.parentNode)||t.parentNode===v));x.appendChild(t),e=t.cloneNode(!1),f.push(e),v.appendChild(e)}else x=null}c=a.cloneNode(!1),n.appendChild(c),1!==a.nodeType||Ve.check.isBreak(a)||(p=c),t(a,p)}else{x=d(a);let t="",n="";if(3===S.nodeType){const e=S;t=e.substringData(E,e.length-E),n=b?"":e.substringData(0,E)}const o=Ve.utils.createTextNode(t),l=Ve.utils.createTextNode(n);if(x?x=x.cloneNode(!1):u(e.parentNode)&&!x&&(e=e.cloneNode(!1),v.appendChild(e),f.push(e)),!Ve.check.isZeroWidth(o)){C=a,_="",y=[];const t=[];for(;C!==v&&C!==m&&null!==C;)1===C.nodeType&&L(C)&&(u(C)?t.push(C.cloneNode(!1)):y.push(C.cloneNode(!1)),_+=C.style.cssText.substring(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentElement;for(y=y.concat(t),c=w=C=y.pop()||o;y.length>0;)C=y.pop(),w.appendChild(C),w=C;v.appendChild(c),C.textContent=o.data}if(x&&c){const t=d(c);t&&(x=t)}for(C=a,y=[],_="";C!==v&&C!==m&&null!==C;)i=u(C)?null:s(C),i&&1===C.nodeType&&L(C)&&(y.push(i),_+=C.style.cssText.substring(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentElement;const p=y.pop()||l;for(w=C=p;y.length>0;)C=y.pop(),w.appendChild(C),w=C;x?((e=e.cloneNode(!1)).appendChild(p),x.insertBefore(e,x.firstChild),v.appendChild(x),f.push(e),x=null):e.appendChild(p),S=l,E=l.data.length,M=!0,!r&&h&&(e=l,l.textContent=Be.zeroWidthSpace),C!==l&&C.appendChild(S)}}}(t,v),a&&!r&&!c.v)return{ancestor:t,startContainer:i,startOffset:n,endContainer:o,endOffset:l};if(r&&=a,r)for(let t=0;t<f.length;t++){const e=f[t];let s,i,n;if(h)s=Ve.utils.createTextNode(Be.zeroWidthSpace),v.replaceChild(s,e);else{const t=e.childNodes;for(i=t[0];t[0];)n=t[0],v.insertBefore(n,e);Ve.utils.removeItem(e)}0===t&&(h?$=S=s:($=i,S=n))}else{if(a)for(let t=0;t<f.length;t++)Bs(f[t]);h&&($=S=e)}this.#J.nodeTransform.removeEmptyNode(v,e,!1),h&&(k=$.textContent.length,E=S.textContent.length);const N=r||0===S.textContent.length;Ve.check.isBreak(S)||0!==S.textContent.length||(Ve.utils.removeItem(S),S=$),E=N?S.textContent.length:E;const A={s:0,e:0},B=Ve.query.getNodePath($,v,A),I=!S.parentNode;I&&(S=$);const V={s:0,e:0},O=Ve.query.getNodePath(S,v,I||N?null:V);k+=A.s,E=h?k:I?$.textContent.length:N?E+A.s:E+V.s;const R=this.#J.nodeTransform.mergeSameTags(v,[B,O],!0);return t.parentNode.replaceChild(v,t),$=Ve.query.getNodeFromPath(B,v),S=Ve.query.getNodeFromPath(O,v),{ancestor:v,startContainer:$,startOffset:k+R[0],endContainer:S,endOffset:E+R[1]}}#Ot(t,e,s,i,n,o,l,r,a,h,c){let d=i.parentNode;for(;!(d.nextSibling||d.previousSibling||this.#J.format.isLine(d.parentNode)||Ve.check.isWysiwygFrame(d.parentNode))&&d.nodeName!==e.nodeName;)d=d.parentNode;if(!l&&!o&&d.nodeName===e.nodeName&&!this.#J.format.isLine(d)&&!d.nextSibling&&Ve.check.isZeroWidth(i.textContent.slice(0,n))){let s=!0,o=i.previousSibling;for(;o;){if(!Ve.check.isZeroWidth(o)){s=!1;break}o=o.previousSibling}if(s)return Ve.utils.copyTagAttributes(d,e),{ancestor:t,container:i,offset:n}}r.v=!1;const u=this,p=t,g=[e],m=t.cloneNode(!1);let f,v,b,y,C=i,w=n,_=!1;if(function t(i,n){const o=i.childNodes;for(let i,l,r=0,d=o.length;r<d;r++){const d=o[r];if(!d)continue;let x=n;if(_&&!Ve.check.isBreak(d)){if(1===d.nodeType){if(u._isIgnoreNodeChange(d)){if(e=e.cloneNode(!1),l=d.cloneNode(!0),m.appendChild(l),m.appendChild(e),g.push(e),c&&d.contains(c)){const t=Ve.query.getNodePath(c,d);c=Ve.query.getNodeFromPath(t,l)}}else t(d,d);continue}v=d,f=[];const o=[];for(;null!==v.parentNode&&v!==p&&v!==e;)i=s(v),1===v.nodeType&&i&&(h(v)?y||o.push(i):f.push(i)),v=v.parentNode;f=f.concat(o);const r=f.length>0,C=f.pop()||d;for(b=v=C;f.length>0;)v=f.pop(),b.appendChild(v),b=v;if(h(e.parentNode)&&!h(C)&&(e=e.cloneNode(!1),m.appendChild(e),g.push(e)),!y&&h(C)){e=e.cloneNode(!1);const t=C.childNodes;for(let s=0,i=t.length;s<i;s++)e.appendChild(t[s]);C.appendChild(e),m.appendChild(C),n=h(v)?e:v,g.push(e)}else r?(e.appendChild(C),n=v):n=e;if(y&&3===d.nodeType)if(a(d)){const t=Ve.query.getParentElement(n,(t=>u._isNonSplitNode(t.parentNode)||t.parentNode===m));y.appendChild(t),e=t.cloneNode(!1),g.push(e),m.appendChild(e)}else y=null}if(_||d!==C)i=_?s(d):d.cloneNode(!1),i&&(n.appendChild(i),1!==d.nodeType||Ve.check.isBreak(d)||(x=i)),t(d,x);else{let t=m;y=a(d);let o="",l="";if(3===C.nodeType){const t=C;o=t.substringData(0,w),l=t.substringData(w,t.length-w)}const r=Ve.utils.createTextNode(o),h=Ve.utils.createTextNode(l);if(y){const e=a(n);if(e&&e.parentNode!==t){let s=e,i=null;for(;s.parentNode!==t;){for(n=i=s.parentNode.cloneNode(!1);s.childNodes[0];)i.appendChild(s.childNodes[0]);s.appendChild(i),s=s.parentNode}s.parentNode.appendChild(e)}y=y.cloneNode(!1)}Ve.check.isZeroWidth(r)||n.appendChild(r);const c=a(n);for(c&&(y=c),y&&(t=y),v=n,f=[];v!==t&&null!==v;)i=s(v),1===v.nodeType&&i&&f.push(i),v=v.parentNode;const u=f.pop()||n;for(b=v=u;f.length>0;)v=f.pop(),b.appendChild(v),b=v;u!==n?(e.appendChild(u),n=v):n=e,Ve.check.isBreak(d)&&e.appendChild(d.cloneNode(!1)),t.appendChild(e),C=h,w=0,_=!0,n.appendChild(C)}}}(t,m),l&&!o&&!r.v)return{ancestor:t,container:i,offset:n,endContainer:c};if(o&&=l,o)for(let t=0;t<g.length;t++){const e=g[t],s=e.childNodes,i=s[0];for(;s[0];)m.insertBefore(s[0],e);Ve.utils.removeItem(e),0===t&&(C=i)}else if(l){e=e.firstChild;for(let t=0;t<g.length;t++)Bs(g[t])}if(o||0!==m.childNodes.length){this.#J.nodeTransform.removeEmptyNode(m,e,!1),Ve.check.isZeroWidth(m.textContent)&&(C=m.firstChild,w=0);const s={s:0,e:0},i=Ve.query.getNodePath(C,m,s);w+=s.s;const n=this.#J.nodeTransform.mergeSameTags(m,[i],!0);t.parentNode.replaceChild(m,t),C=Ve.query.getNodeFromPath(i,m),w+=n[0]}else t.childNodes?C=t.childNodes[0]:(C=Ve.utils.createTextNode(Be.zeroWidthSpace),t.appendChild(C));return{ancestor:m,container:C,offset:w,endContainer:c}}#Vt(t,e,s,i,n,o,l){if(!n){let s=null;l&&t.contains(l)&&(s=Ve.query.getNodePath(l,t));const i=t.cloneNode(!0),n=e.nodeName,o=e.style.cssText,r=e.className;let a=i.childNodes,h=0,c=a.length;for(let t;h<c&&(t=a[h],3!==t.nodeType);h++){if(t.nodeName!==n){if(!Ve.check.isBreak(t)&&this._isIgnoreNodeChange(t))continue;if(1===c){a=t.childNodes,c=a.length,h=-1;continue}break}t.style.cssText+=o,Ve.utils.addClass(t,r)}if(c>0&&h===c)return t.innerHTML=i.innerHTML,{ancestor:t,endContainer:s?Ve.query.getNodeFromPath(s,t):null}}o.v=!1;const r=this,a=t.cloneNode(!1),h=[e];let c=!0;if(function t(i,n){const o=i.childNodes;for(let i,d,u=0,p=o.length;u<p;u++){const p=o[u];if(!p)continue;let g=n;if(Ve.check.isBreak(p)||!r._isIgnoreNodeChange(p))i=s(p),i&&(c=!1,n.appendChild(i),1===p.nodeType&&(g=i)),Ve.check.isBreak(p)||t(p,g);else if(e.childNodes.length>0&&(a.appendChild(e),e=e.cloneNode(!1)),d=p.cloneNode(!0),a.appendChild(d),a.appendChild(e),h.push(e),n=e,l&&p.contains(l)){const t=Ve.query.getNodePath(l,p);l=Ve.query.getNodeFromPath(t,d)}}}(t,e),c||n&&!i&&!o.v)return{ancestor:t,endContainer:l};if(a.appendChild(e),i&&n)for(let t=0;t<h.length;t++){const e=h[t],s=e.childNodes;for(;s[0];)a.insertBefore(s[0],e);Ve.utils.removeItem(e)}else if(n){e=e.firstChild;for(let t=0;t<h.length;t++)Bs(h[t])}return this.#J.nodeTransform.removeEmptyNode(a,e,!1),this.#J.nodeTransform.mergeSameTags(a,null,!0),t.parentNode.replaceChild(a,t),{ancestor:a,endContainer:l}}#It(t,e,s,i,n,o,l,r,a,h){let c=i.parentNode;for(;!(c.nextSibling||c.previousSibling||this.#J.format.isLine(c.parentNode)||Ve.check.isWysiwygFrame(c.parentNode))&&c.nodeName!==e.nodeName;)c=c.parentNode;if(!l&&!o&&c.nodeName===e.nodeName&&!this.#J.format.isLine(c)&&!c.previousSibling&&Ve.check.isZeroWidth(i.textContent.slice(n))){let s=!0,o=i.nextSibling;for(;o;){if(!Ve.check.isZeroWidth(o)){s=!1;break}o=o.nextSibling}if(s)return Ve.utils.copyTagAttributes(c,e),{ancestor:t,container:i,offset:n}}r.v=!1;const d=this,u=t,p=[e],g=t.cloneNode(!1);let m,f,v,b,y=i,C=n,w=!1;if(function t(i,n){const o=i.childNodes;for(let i,l=o.length-1;0<=l;l--){const r=o[l];if(!r)continue;let c=n;if(w&&!Ve.check.isBreak(r)){if(1===r.nodeType){if(d._isIgnoreNodeChange(r)){e=e.cloneNode(!1);const t=r.cloneNode(!0);g.insertBefore(t,n),g.insertBefore(e,t),p.push(e)}else t(r,r);continue}f=r,m=[];const o=[];for(;null!==f.parentNode&&f!==u&&f!==e;)i=s(f),i&&1===f.nodeType&&(h(f)?b||o.push(i):m.push(i)),f=f.parentNode;m=m.concat(o);const l=m.length>0,c=m.pop()||r;for(v=f=c;m.length>0;)f=m.pop(),v.appendChild(f),v=f;if(h(e.parentNode)&&!h(c)&&(e=e.cloneNode(!1),g.insertBefore(e,g.firstChild),p.push(e)),!b&&h(c)){e=e.cloneNode(!1);const t=c.childNodes;for(let s=0,i=t.length;s<i;s++)e.appendChild(t[s]);c.appendChild(e),g.insertBefore(c,g.firstChild),p.push(e),n=e.children.length>0?f:e}else l?(e.insertBefore(c,e.firstChild),n=f):n=e;if(b&&3===r.nodeType)if(a(r)){const t=Ve.query.getParentElement(n,(t=>d._isNonSplitNode(t.parentNode)||t.parentNode===g));b.appendChild(t),e=t.cloneNode(!1),p.push(e),g.insertBefore(e,g.firstChild)}else b=null}if(w||r!==y)i=w?s(r):r.cloneNode(!1),i&&(n.insertBefore(i,n.firstChild),1!==r.nodeType||Ve.check.isBreak(r)||(c=i)),t(r,c);else{b=a(r);let t="",o="";if(3===y.nodeType){const e=y;t=e.substringData(C,e.length-C),o=e.substringData(0,C)}const l=Ve.utils.createTextNode(t),c=Ve.utils.createTextNode(o);if(b){b=b.cloneNode(!1);const t=a(n);if(t.parentNode!==g){let e=t,s=null;for(;e.parentNode!==g;){for(n=s=e.parentNode.cloneNode(!1);e.childNodes[0];)s.appendChild(e.childNodes[0]);e.appendChild(s),e=e.parentNode}e.parentNode.insertBefore(t,e.parentNode.firstChild)}b=b.cloneNode(!1)}else h(e.parentNode)&&!b&&(e=e.cloneNode(!1),g.appendChild(e),p.push(e));for(Ve.check.isZeroWidth(l)||n.insertBefore(l,n.firstChild),f=n,m=[];f!==g&&null!==f;)i=h(f)?null:s(f),i&&1===f.nodeType&&m.push(i),f=f.parentNode;const d=m.pop()||n;for(v=f=d;m.length>0;)f=m.pop(),v.appendChild(f),v=f;d!==n?(e.insertBefore(d,e.firstChild),n=f):n=e,Ve.check.isBreak(r)&&e.appendChild(r.cloneNode(!1)),b?(b.insertBefore(e,b.firstChild),g.insertBefore(b,g.firstChild),b=null):g.insertBefore(e,g.firstChild),y=c,C=c.data.length,w=!0,n.insertBefore(y,n.firstChild)}}}(t,g),l&&!o&&!r.v)return{ancestor:t,container:i,offset:n};if(o&&=l,o)for(let t=0;t<p.length;t++){const e=p[t],s=e.childNodes;let i=null;for(;s[0];)i=s[0],g.insertBefore(i,e);Ve.utils.removeItem(e),t===p.length-1&&(y=i,C=i.textContent.length)}else if(l){e=e.firstChild;for(let t=0;t<p.length;t++)Bs(p[t])}if(o||0!==g.childNodes.length){if(!l&&0===e.textContent.length)return this.#J.nodeTransform.removeEmptyNode(g,null,!1),{ancestor:null,container:null,offset:0};this.#J.nodeTransform.removeEmptyNode(g,e,!1),Ve.check.isZeroWidth(g.textContent)?(y=g.firstChild,C=y.textContent.length):Ve.check.isZeroWidth(y)&&(y=e,C=1);const s={s:0,e:0},i=Ve.query.getNodePath(y,g,s);C+=s.s;const n=this.#J.nodeTransform.mergeSameTags(g,[i],!0);t.parentNode.replaceChild(g,t),y=Ve.query.getNodeFromPath(i,g),C+=n[0]}else t.childNodes?y=t.childNodes[0]:(y=Ve.utils.createTextNode(Be.zeroWidthSpace),t.appendChild(y));return{ancestor:g,container:y,offset:1===y.nodeType&&1===C?y.childNodes.length:C}}#Mt(t){return t&&"string"!=typeof t&&3!==t.nodeType&&this.#J.format.isTextStyleNode(t)&&!!t.style.fontSize}#Ht(t,e,s){return!s||t?null:Ve.query.getParentElement(s,this._isNonSplitNode.bind(this))||(e?null:Ve.query.getParentElement(s,this.#Mt.bind(this)))}#Lt(t,e,s){if(!s||t||1!==s.nodeType)return!1;const i=this._isNonSplitNode(s);return Ve.query.getParentElement(s,this._isNonSplitNode.bind(this))?i:i||!e&&this.#Mt(s)}#Bt(t,e){if(!Ve.check.isListCell(t))return;const s=Ve.utils.arrayFilter((e||t).childNodes,(t=>!Ve.check.isBreak(t)));if(e=s[0],!Ve.check.isElement(e)||s.length>1)return;const i=e.style,n=t.style,o=e.nodeName.toLowerCase();let l=!1;this.#ot.get("_defaultStyleTagMap")[o]===this.#ot.get("_defaultTagCommand").bold.toLowerCase()&&(n.fontWeight="bold"),this.#ot.get("_defaultStyleTagMap")[o]===this.#ot.get("_defaultTagCommand").italic.toLowerCase()&&(n.fontStyle="italic");const r=Ie.getValues(i);if(r.length>0)for(let t=0,e=this.#Et.length;t<e;t++)r.includes(this.#Tt[t])&&(n[this.#Et[t]]=i[this.#Et[t]],i.removeProperty(this.#Tt[t]),l=!0);if(this.#Bt(t,e),l&&0===i.length){const t=e.childNodes,s=e.parentNode,i=e.nextSibling;for(;t.length>0;)s.insertBefore(t[0],i);Ve.utils.removeItem(e)}}#Nt(t,e){if(!Ve.check.isListCell(t))return;e||=this.#Tt;const s=Ve.utils.arrayFilter(t.childNodes,(t=>!Ve.check.isBreak(t))),i=t.style,n=[],o=[],l=Ie.getValues(i);for(let t=0,s=this.#Tt.length;t<s;t++)l.includes(this.#Tt[t])&&e.includes(this.#Tt[t])&&(n.push(this.#Et[t]),o.push(this.#Tt[t]));if(0===n.length)return;const r=Ve.utils.createElement("SPAN");for(let t=0,e=n.length;t<e;t++)r.style[n[t]]=i[o[t]],i.removeProperty(o[t]);let a=r.cloneNode(!1),h=null,c=!1;for(let e,i,o=0,l=s.length;o<l;o++)e=s[o],this.#ot.get("_defaultStyleTagMap")[e.nodeName.toLowerCase()]||(i=Ie.getValues(e.style),0===i.length||n.some((function(t){return!i.includes(t)}))&&i.some((function(t){return n.includes(t)}))?(h=e.nextSibling,a.appendChild(e)):a.childNodes.length>0&&(t.insertBefore(a,h),a=r.cloneNode(!1),h=null,c=!0));return a.childNodes.length>0&&(t.insertBefore(a,h),c=!0),0===i.length&&t.removeAttribute("style"),c}};function Vs(t){const e=t.parentNode;let s,i,n,o,l,r=e.parentNode,a=e;for(;Ve.check.isListCell(r);){for(o=Ve.query.getPositionIndex(t),s=r.nextElementSibling,i=r.parentNode,n=a;n;){if(a=a.nextSibling,Ve.check.isList(n)){for(l=n.childNodes;l[o];)i.insertBefore(l[o],s);0===l.length&&Ve.utils.removeItem(n)}else i.appendChild(n);n=a}r=i.parentNode}return 0===e.children.length&&Ve.utils.removeItem(e),i}const Os=class{#J;#t;constructor(t){this.#J=t.$,this.#t=t.store}apply(t,e,s){const i=(t.split(":")[0]||"ol").toUpperCase(),n=t.split(":")[1]||"";let o=this.#J.selection.getRange(),l=e||this.#J.format.getLinesAndComponents(!1);if(0===l.length){if(e)return;if(o=this.#J.selection.getRangeAndAddLine(o,null),l=this.#J.format.getLinesAndComponents(!1),0===l.length)return}Ve.query.sortNodeByDepth(l,!0);const r=l[0],a=l.at(-1);let h=!Ve.check.isListCell(r)&&!this.#J.component.is(r)||r.previousElementSibling?r.previousElementSibling:r.parentElement.previousElementSibling,c=!Ve.check.isListCell(a)&&!this.#J.component.is(a)||a.nextElementSibling?a.nextElementSibling:a.parentElement.nextElementSibling;const d=o.collapsed,u={sc:o.startContainer,so:o.startContainer===o.endContainer&&Ve.check.isZeroWidth(o.startContainer)&&0===o.startOffset&&1===o.endOffset?o.endOffset:o.startOffset,ec:o.endContainer,eo:o.endOffset};let p=null,g=!0;for(let t=0,e=l.length;t<e;t++)if(!Ve.check.isList(this.#J.format.getBlock(l[t],(e=>this.#J.format.getBlock(e)&&e!==l[t])))){g=!1;break}if(!g||h&&r.tagName===h.tagName&&i===h.tagName.toUpperCase()||c&&a.tagName===c.tagName&&i===c.tagName.toUpperCase()){const t=h?h.parentNode:h,e=c?c.parentNode:c;h=t&&!Ve.check.isWysiwygFrame(t)&&t.nodeName===i?t:h,c=e&&!Ve.check.isWysiwygFrame(e)&&e.nodeName===i?e:c;const s=h?.tagName===i,o=c?.tagName===i;let r=s?h:Ve.utils.createElement(i,{style:"list-style-type: "+n}),a=null,d=null;const u=t=>!Ve.check.isComponentContainer(t)&&!Ve.check.isList(t);for(let t,e,o,h,c,p,g,m,f,v=0,b=l.length;v<b;v++)if(e=l[v],0!==e.childNodes.length||this.#J.inline._isIgnoreNodeChange(e)){if(h=l[v+1],c=e.parentNode,p=h?h.parentNode:null,o=Ve.check.isListCell(e),f=this.#J.format.isBlock(c)?c:null,g=o&&!Ve.check.isWysiwygFrame(c)?c.parentNode:c,m=o&&!Ve.check.isWysiwygFrame(c)?!h||Ve.check.isListCell(g)?c:c.nextSibling:e.nextSibling,t=Ve.utils.createElement("LI"),this.#J.component.is(e)){const s=/^HR$/i.test(e.nodeName);s||(t.innerHTML="<br>"),t.innerHTML+=e.outerHTML,s&&(t.innerHTML+="<br>")}else{Ve.utils.copyFormatAttributes(t,e);const s=e.childNodes;for(;s[0];)t.appendChild(s[0])}r.appendChild(t),h&&g===p&&!this.#J.format.isBlock(m)||(a||=r,s&&h&&g===p||h&&Ve.check.isList(p)&&p===c||r.parentNode!==g&&g.insertBefore(r,m)),Ve.utils.removeItem(e),s&&null===d&&(d=r.children.length-1),h&&(this.#J.format.getBlock(p,u)!==this.#J.format.getBlock(c,u)||Ve.check.isList(p)&&Ve.check.isList(c)&&Ve.query.getNodeDepth(p)!==Ve.query.getNodeDepth(c))&&(r=Ve.utils.createElement(i,{style:"list-style-type: "+n})),0===f?.children.length&&Ve.utils.removeItem(f)}else Ve.utils.removeItem(e);d&&(a=a.children[d]),o&&(r.innerHTML+=c.innerHTML,Ve.utils.removeItem(c))}else{if(s)for(let t=0,e=l.length;t<e;t++)for(let s=t-1;s>=0;s--)if(l[s].contains(l[t])){l.splice(t,1),t--,e--;break}const t=this.#J.format.getBlock(r),e=t?.tagName===i;let o,a;const h=t=>!Ve.check.isComponentContainer(t);e||(a=Ve.utils.createElement(i,{style:"list-style-type: "+n}));for(let t,r,c=0,d=l.length;c<d;c++)r=this.#J.format.getBlock(l[c],h),r&&Ve.check.isList(r)&&(t?t!==r?(s&&Ve.check.isListCell(r.parentNode)?this.#Rt(o.f):p=this.#J.format.removeBlock(o.f[0].parentElement,{selectedFormats:o.f,newBlockElement:a,shouldDelete:!1,skipHistory:!0}),r=l[c].parentNode,e||(a=Ve.utils.createElement(i,{style:"list-style-type: "+n})),t=r,o={r:t,f:[Ve.query.getParentElement(l[c],"LI")]}):o.f.push(Ve.query.getParentElement(l[c],"LI")):(t=r,o={r:t,f:[Ve.query.getParentElement(l[c],"LI")]}),c===d-1&&(s&&Ve.check.isListCell(r.parentNode)?this.#Rt(o.f):p=this.#J.format.removeBlock(o.f[0].parentElement,{selectedFormats:o.f,newBlockElement:a,shouldDelete:!1,skipHistory:!0})))}return this.#t.set("_lastSelectionNode",null),g&&d&&p||u}remove(t,e){let s={},i=!1,n=!1,o=null,l=null;const r=t=>!Ve.check.isComponentContainer(t);for(let a,h,c,d,u=0,p=t.length;u<p;u++){if(c=u===p-1,h=this.#J.format.getBlock(t[u],r),d=Ve.check.isList(h),!a&&d)a=h,s={r:a,f:[Ve.query.getParentElement(t[u],"LI")]},0===u&&(i=!0);else if(a&&d)if(a!==h){const r=this.#J.format.removeBlock(s.f[0].parentNode,{selectedFormats:s.f,newBlockElement:null,shouldDelete:e,skipHistory:!0});h=t[u].parentNode,i&&(o=r.sc,i=!1),c&&(l=r.ec),d?(a=h,s={r:a,f:[Ve.query.getParentElement(t[u],"LI")]},c&&(n=!0)):a=null}else s.f.push(Ve.query.getParentElement(t[u],"LI")),c&&(n=!0);if(c&&Ve.check.isList(a)){const t=this.#J.format.removeBlock(s.f[0].parentNode,{selectedFormats:s.f,newBlockElement:null,shouldDelete:e,skipHistory:!0});(n||1===p)&&(l=t.ec),i&&(o=t.sc||l)}}return{sc:o,ec:l}}applyNested(t,e){const s=(t=t||this.#J.format.getLines().filter((function(t){return Ve.check.isListCell(t)}))).length;if(0===s||!e&&!Ve.check.isListCell(t[0].previousElementSibling)&&!Ve.check.isListCell(t.at(-1).nextElementSibling))return{sc:t[0],so:0,ec:t.at(-1),eo:1};let i=t[0].parentElement,n=t.at(-1),o=null;if(e){if(i!==n.parentElement&&Ve.check.isList(n.parentElement?.parentElement)&&n.nextElementSibling)for(n=n.nextElementSibling;n;)t.push(n),n=n.nextElementSibling;o=this.apply(i.nodeName+":"+i.style.listStyleType,t,!0)}else{let e=Ve.utils.createElement(i.nodeName),l=t[0].previousElementSibling,r=n.nextElementSibling;const a={s:null,e:null,sl:i,el:i},{startContainer:h,startOffset:c,endContainer:d,endOffset:u}=this.#J.selection.getRange();for(let n,o=0,h=s;o<h;o++)n=t[o],n.parentElement!==i&&(this.#Pt(i,e,l,r,a),i=n.parentElement,e=Ve.utils.createElement(i.nodeName)),l=n.previousElementSibling,r=n.nextElementSibling,e.appendChild(n);if(this.#Pt(i,e,l,r,a),s>1){const t=Ve.query.getNodeFromPath(a.s,a.sl),e=Ve.query.getNodeFromPath(a.e,a.el);o={sc:t,so:0,ec:e,eo:e.textContent.length}}else o={sc:h,so:c,ec:d,eo:u}}return o}removeNested(t,e){const s=Vs(t);let i,n,o;if(s){i=s.cloneNode(!1),n=s.childNodes;const e=Ve.query.getPositionIndex(t);for(;n[e];)i.appendChild(n[e])}else i=t;if(e)o=Ve.query.getListChildren(i,(t=>Ve.check.isListCell(t)&&!t.previousElementSibling),null);else{const e=Ve.query.getNodeDepth(t)+2;o=Ve.query.getListChildren(t,(t=>Ve.check.isListCell(t)&&!t.previousElementSibling&&Ve.query.getNodeDepth(t)===e),null)}for(let t=0,e=o.length;t<e;t++)Vs(o[t]);return s&&(s.parentNode.insertBefore(i,s.nextSibling),0===n?.length&&Ve.utils.removeItem(s)),i===t?i.parentNode:i}#Pt(t,e,s,i,n){let o=!1;if(e.tagName===s?.tagName){const t=e.children;for(;t[0];)s.appendChild(t[0]);e=s,o=!0}if(e.tagName===i?.tagName){const t=i.children;for(;t[0];)e.appendChild(t[0]);const s=i.nextElementSibling;i.parentNode.removeChild(i),i=s}if(!o){Ve.check.isListCell(s)&&(t=s,i=null),t.insertBefore(e,i),n.s||(n.s=Ve.query.getNodePath(e.firstElementChild.firstChild,t,null),n.sl=t);const o=t.contains(n.sl)?Ve.query.getNodePath(n.sl,t):null;n.e=Ve.query.getNodePath(e.lastElementChild.firstChild,t,null),n.el=t,this.#J.nodeTransform.mergeSameTags(t,[n.s,n.e,o],!1),this.#J.nodeTransform.mergeNestedTags(t),o&&(n.sl=Ve.query.getNodeFromPath(o,t))}return e}#Rt(t){const e=t[0],s=t.at(-1),i=s.nextElementSibling,n=e.parentElement,o=n.parentElement.nextElementSibling,l=n.parentElement.parentElement;for(let e=0,s=t.length;e<s;e++)l.insertBefore(t[e],o);if(i&&n.children.length>0){const t=n.cloneNode(!1),e=n.childNodes,o=Ve.query.getPositionIndex(i);for(;e[o];)t.appendChild(e[o]);s.appendChild(t)}0===n.children.length&&Ve.utils.removeItem(n),this.#J.nodeTransform.mergeSameTags(l);const r=Ve.query.getEdgeChildNodes(e,s);return{cc:e.parentNode,sc:r.sc,ec:r.ec}}},{_d:Rs}=Ae,Ps=new RegExp(Be.zeroWidthSpace+"+","g");const zs=/^<[a-z0-9]+:[a-z0-9]+/i,Ds=/(?!<)[a-zA-Z0-9-]+/,Fs=/\s(?:on[a-z]+)\s*=\s*(?:(["'])[^"']*\1|\S+)/gi,qs=/style=/i,Ws=/style\s*=\s*(?:"|')[^"']*(?:"|')/,Us=/class\s*=\s*("|')(?:[^"']*\s)?se-component(?=[\s"'])/i,Zs=/^\s/,Gs=/<[^\s]+\s(.+)/,js=/^[ \t\n\r\f\v]+$/,Ks=/\ssize="([^"]+)"/i,Ys=/\sface="([^"]+)"/i,Xs=/\scolor="([^"]+)"/i,Js=/&quot;/g,Qs=/([a-zA-Z0-9-]+)(:)([^"']+)/,ti=/inherit|initial|revert|unset/i,ei=/"/g,si=/:\s*([^;]+)/,ii=/rgba\(([0-9]+\s*,\s*){3}0\)|windowtext/i,ni=/[^;]+;/g,oi=/^span$/i,li=/^(?:https?|ftps?|mailto|tel|blob|sms|geo|webcal|callto):|^[#/]|^data:image\//i,ri=/^(?:href|src)\s*=/i,ai=/=\s*(?:"([^"]*)"|'([^']*)'|(\S+))/,hi=/:/i;function ci(t){const e=function(t){let e,s=5;do{e=t,t=t.replace(/&(#x([0-9a-f]+)|#([0-9]+)|([a-z]+));/gi,((t,e,s,i)=>s?String.fromCharCode(parseInt(s,16)):i?String.fromCharCode(parseInt(i,10)):""))}while(t!==e&&--s);try{t=decodeURIComponent(t)}catch{}return t.replace(/[\u0000-\u0020]+/g,"")}(t);return li.test(e)||!hi.test(e)}function di(t){if(!ri.test(t))return!0;const e=t.match(ai);if(!e)return!0;return ci(e[1]??e[2]??e[3]??"")}function ui(t,e){return t?"*"===t?"[a-z-]+":e?t+"|"+e:t:"^"}const pi=class{#J;#t;#Y;#Q;#ot;#dt;#zt;#Dt;#Ft;#qt;#Wt;#Ut;#Zt;#Gt;#jt;#Kt;#Yt;#Xt;#Jt;#Qt;#te;#ee;#se;#ie;#ne;constructor(t){this.#J=t.$,this.#t=t.store;const e=this.#ot=this.#J.options;this.#Q=this.#J.frameOptions,this.#Y=this.#J.frameContext,this.#dt=this.#J.instanceCheck,this.#Dt=function(t){return this.test(t)?t:""}.bind(e.get("allowedClassName")),this.#Jt=e.get("_textStyleTags");const s=e.get("tagStyles"),i={};for(const t in s){const e=t.split("|");for(let n,o=0,l=e.length;o<l;o++)n=e[o],i[n]?i[n]+="|":i[n]="",i[n]+=s[t]}for(const t in i)i[t]=new RegExp(`\\s*[^-a-zA-Z](${i[t]})\\s*:[^;]+(?!;)*`,"gi");const n=new Map;for(const t in i)n.set(new RegExp(`^(${t})$`),i[t]);this.#Yt=new RegExp(`^(${Object.keys(i).join("|")})$`,"i"),this.#Xt=n,this.#zt=new RegExp("\\d+("+e.get("fontSizeUnits").join("|")+")$","i");const o=e.get("_allowedExtraTag"),l=e.get("_disallowedExtraTag");this.#Qt=new RegExp(`<(${l})[^>]*>([\\s\\S]*?)<\\/\\1>|<(${l})[^>]*\\/?>`,"gi"),this.#te=new RegExp(`^(${l})$`,"i"),this.#ee=new RegExp(`^(${o})$`,"i");const r=Object.keys(e.get("_defaultStyleTagMap")),a=e.get("elementWhitelist")?e.get("elementWhitelist").split("|").filter((t=>/b|i|ins|s|strike/i.test(t))):[];for(let t=0;t<a.length;t++)r.splice(r.indexOf(a[t].toLowerCase()),1);this.#qt=0===r.length?null:new RegExp("(<\\/?)("+r.join("|")+")\\b\\s*([^>^<]+)?\\s*(?=>)","gi");const h=e.get("__defaultAttributeWhitelist");this.#Ft=e.get("_editorElementWhitelist").includes("//")||"*"===e.get("_editorElementWhitelist"),this.#Wt=new RegExp("^("+ui(e.get("_editorElementWhitelist").replace("|//",""),"")+")$","i"),this.#Ut=new RegExp("^("+(e.get("elementBlacklist")||"^")+")$","i"),this.#Zt=Ie.createElementWhitelist(ui(e.get("_editorElementWhitelist").replace("|//","|\x3c!--|--\x3e"),"")),this.#Gt=Ie.createElementBlacklist(e.get("elementBlacklist").replace("|//","|\x3c!--|--\x3e"));const c='\\s*=\\s*(")[^"]*\\1',d=e.get("attributeWhitelist");let u={},p="";if(d)for(const t in d)/^on[a-z]+$/i.test(d[t])||("*"===t?p=ui(d[t],h):u[t]=new RegExp("\\s(?:"+ui(d[t],h)+")"+c,"ig"));this.#jt=new RegExp("\\s(?:"+(p||h)+"|data-se-[^\\s]+"+(e.get("v2Migration")?"|data-index|data-file-size|data-file-name|data-exp|data-font-size":"")+")"+c,"ig"),this.#se=u;const g=e.get("attributeBlacklist");if(u={},p="",g)for(const t in g)"*"===t?p=ui(g[t],""):u[t]=new RegExp("\\s(?:"+ui(g[t],"")+")"+c,"ig");this.#Kt=new RegExp("\\s(?:"+(p||"^")+")"+c,"ig"),this.#ie=u,this.__resetAutoStyleify(e.get("autoStyleify"))}filter(t,{tagWhitelist:e,tagBlacklist:s,validate:i,validateAll:n}){if(e&&(t=t.replace(Ie.createElementWhitelist(e),"")),s&&(t=t.replace(Ie.createElementBlacklist(s),"")),i){const e=(new DOMParser).parseFromString(t,"text/html");e.body.querySelectorAll("*").forEach((t=>{if(n||!t.closest(".se-component")&&!t.closest(".se-flex-component")){const e=i(t);null===e?t.remove():this.#dt.isNode(e)?t.replaceWith(e):"string"==typeof e&&(t.outerHTML=e)}})),t=e.body.innerHTML}return t}clean(t,{forceFormat:e,whitelist:s,blacklist:i,_freeCodeViewMode:n}={}){const{tagFilter:o,formatFilter:l,classFilter:r,textStyleTagFilter:a,attrFilter:h,styleFilter:c}=this.#ot.get("strictMode");let d="";if(t=this.compress(t),o&&(t=t.replace(this.#Qt,""),t=this.#oe(t,this.#Zt,this.#Gt).replace(/<br\/?>$/i,"")),this.#ne){const e=(new DOMParser).parseFromString(t,"text/html");Ve.query.getListChildNodes(e.body,Ie.spanToStyleNode.bind(null,this.#ne),null),t=e.body.innerHTML}(h||c)&&(t=t.replace(/(<[a-zA-Z0-9-]+)[^>]*(?=>)/g,this.#le.bind(this,h,c)));const u=Rs.createRange().createContextualFragment(t);if(o)try{this.#re(u,this.#Wt,this.#Ut,o,l,r,n)}catch(t){console.warn("[SUNEDITOR.html.clean.fail]",t.message)}const p=u.querySelectorAll("[data-se-iframe-holder]");for(let t=0,e=p.length;t<e;t++){const e=Ve.utils.createElement("iframe"),s=JSON.parse(p[t].getAttribute("data-se-iframe-holder-attrs"));for(const[t,i]of Object.entries(s))/^on/i.test(t)||("src"!==t||ci(String(i)))&&e.setAttribute(t,i);p[t].replaceWith(e)}if(this.#J.pluginManager.applyRetainFormat(u),l){let t=u.childNodes;e||=this.#ae(t),e&&(t=this.#he(u).childNodes);for(let s,i=0,n=t.length;i<n;i++)s=t[i],this.#ee.test(s.nodeName)?d+=s.outerHTML:d+=this.#ce(s,e)}return d||=t,o&&(s&&(d=d.replace("string"==typeof s?Ie.createElementWhitelist(s):s,"")),i&&(d=d.replace("string"==typeof i?Ie.createElementBlacklist(i):i,""))),a&&(d=this.#de(d)),!n&&d.includes(Be.zeroWidthSpace)&&(d=d.replace(Ps,((t,e,s)=>{const i=0===e||">"===s[e-1],n=e+t.length===s.length||"<"===s[e+t.length];return i&&n?t:""}))),d}insert(t,{selectInserted:e,skipCharCount:s,skipCleaning:i}={}){this.#Y.get("wysiwyg").contains(this.#J.selection.get().focusNode)||this.#J.focusManager.focus(),this.remove(),this.#J.focusManager.focus();let n=null;if("string"==typeof t){i||(t=this.clean(t,{forceFormat:!1,whitelist:null,blacklist:null}));try{if(Ve.check.isListCell(this.#J.format.getLine(this.#J.selection.getNode(),null))){const e=Rs.createRange().createContextualFragment(t).childNodes;this.#ae(e)&&(t=this.#ue(e))}const i=Rs.createRange().createContextualFragment(t).childNodes;if(!s){const t="byte-html"===this.#Q.get("charCounter_type")?"outerHTML":"textContent";let e="";for(let s=0,n=i.length;s<n;s++)e+=i[s][t];if(!this.#J.char.check(e))return}let o,l,r,a,h;for(;o=i[0];)3===a?.nodeType&&1===l?.nodeType&&Ve.check.isBreak(o)?(a=o,Ve.utils.removeItem(o)):(r=this.insertNode(o,{afterNode:l,skipCharCount:!0}),l=r.container||r,h||=r,a=o);3===a?.nodeType&&1===l?.nodeType&&(l=a);const c=3===l.nodeType?r.endOffset||l.textContent.length:l.childNodes.length;n=l,e?this.#J.selection.setRange(h.container||h,h.startOffset||0,l,c):this.#J.component.is(l)||this.#J.selection.setRange(l,c,l,c)}catch(t){if(this.#Y.get("isReadOnly")||this.#Y.get("isDisabled"))return;throw Error(`[SUNEDITOR.html.insert.error] ${t.message}`)}}else if(this.#J.component.is(t))this.#J.component.insert(t,{skipCharCount:s,insertBehavior:"none"});else{let e=null;(this.#J.format.isLine(t)||Ve.check.isMedia(t))&&(e=this.#J.format.getLine(this.#J.selection.getNode(),null)),this.insertNode(t,{afterNode:e,skipCharCount:s})}if(this.#t.set("_lastSelectionNode",null),n){const t=Ve.query.getListChildNodes(n,null,null);if(t.length>0){n=t.at(-1);const e=3===n?.nodeType?n.textContent.length:1;this.#J.selection.setRange(n,e,n,e)}else this.#J.focusManager.focus()}else this.#J.focusManager.focus();this.#J.history.push(!1)}insertNode(t,{afterNode:e,skipCharCount:s}={}){let i=null;if(this.#Y.get("isReadOnly")||!s&&!this.#J.char.check(t))return i;let n=null,o=null;if(e){const t=this.#J.format.isLine(e)||this.#J.format.isBlock(e)||this.#J.component.is(e)?this.#J.format.addLine(e,null):e;o=this.#J.selection.setRange(t,1,t,1)}else o=this.#J.selection.getRange();let l,r,a,h=Ve.check.isListCell(o.commonAncestorContainer)?o.commonAncestorContainer:this.#J.format.getLine(this.#J.selection.getNode(),null),c=Ve.check.isListCell(h)&&(Ve.check.isListCell(t)||Ve.check.isList(t)),d=null;const u=this.#J.format.isBrLine(h),p=this.#J.format.isLine(t)||this.#J.format.isBlock(t)||this.#J.component.isBasic(t);if(c&&(a=e||Ve.check.isList(t)?h.lastChild:h.nextElementSibling,d=Ve.check.isList(t)?h:(a||h).parentNode),!e&&(p||this.#J.component.isBasic(t)||Ve.check.isMedia(t))){const t=Ve.check.isEdgePoint(o.endContainer,o.endOffset,"end"),s=this.remove(),i=s.container,n=i===s.prevContainer&&o.collapsed?null:s.prevContainer;if(c&&n)if(d=3===n.nodeType?n.parentNode:n,d.contains(i)){let t=!0;for(a=i;a.parentNode&&a.parentNode!==d;)a=a.parentNode,t=!1;t&&i===n&&(a=a.nextSibling)}else a=null;else if(c&&Ve.check.isListCell(i)&&!h.parentElement)h=Ve.utils.createElement("LI"),d.appendChild(h),i.appendChild(d),a=null;else if(3===i.nodeType||Ve.check.isBreak(i)||c){const n=Ve.query.getParentElement(i,(t=>this.#J.format.isBlock(t)||Ve.check.isListCell(t)));if(e=this.#J.nodeTransform.split(i,s.offset,n?Ve.query.getNodeDepth(n)+1:0))if(c){if(h.contains(i)){const s=Ve.check.isList(h.lastElementChild);let i=null;t||(i=h.cloneNode(!1),i.appendChild(e.textContent.trim()?e:Ve.utils.createTextNode(Be.zeroWidthSpace))),s&&(i||(i=h.cloneNode(!1),i.appendChild(Ve.utils.createTextNode(Be.zeroWidthSpace))),i.appendChild(h.lastElementChild)),i&&(h.parentNode.insertBefore(i,h.nextElementSibling),a=e=i)}}else e=e.previousSibling;else Ve.check.isListCell(h)||(a=e=h)}}o=e||p?this.#J.selection.getRange():this.#J.selection.getRangeAndAddLine(this.#J.selection.getRange(),null);const g=o.commonAncestorContainer,m=o.startOffset,f=o.endOffset,v=o.startContainer===g&&this.#J.format.isLine(g),b=v&&(g.childNodes[m]||g.childNodes[0])||o.startContainer,y=v&&(g.childNodes[f]||g.childNodes[g.childNodes.length-1])||o.endContainer;if(!c)if(e)l=e.parentNode,e=e.nextSibling,r=!0;else if(l=b,3===b.nodeType&&(l=b.parentNode),o.collapsed)if(3===g.nodeType)e=g.textContent.length>f?g.splitText(f):g.nextSibling;else if(Ve.check.isBreak(l))e=l,l=l.parentNode;else{const s=l.childNodes[m],i=3===s?.nodeType&&Ve.check.isZeroWidth(s)&&Ve.check.isBreak(s.nextSibling)?s.nextSibling:s;i?!i.nextSibling&&Ve.check.isBreak(i)?(l.removeChild(i),e=null):e=Ve.check.isBreak(i)&&!Ve.check.isBreak(t)?i:i.nextSibling:e=null}else{if(b===y){e=Ve.check.isEdgePoint(y,f)?y.nextSibling:y.splitText(f);let t=b;Ve.check.isEdgePoint(b,m)||(t=b.splitText(m)),l.removeChild(t),0===l.childNodes.length&&p&&(l.innerHTML="<br>")}else{const s=this.remove(),i=s.container,n=s.prevContainer;if(0===i?.childNodes.length&&p&&(this.#J.format.isLine(i)?i.innerHTML="<br>":this.#J.format.isBlock(i)&&(i.innerHTML="<"+this.#ot.get("defaultLine")+"><br></"+this.#ot.get("defaultLine")+">")),Ve.check.isListCell(i)&&3===t.nodeType)l=i,e=null;else if(!p&&n)if(l=3===n.nodeType?n.parentNode:n,l.contains(i)){let t=!0;for(e=i;e.parentNode&&e.parentNode!==l;)e=e.parentNode,t=!1;t&&i===n&&(e=e.nextSibling)}else e=null;else Ve.check.isWysiwygFrame(i)&&!this.#J.format.isLine(t)?(l=i.appendChild(Ve.utils.createElement(this.#ot.get("defaultLine"))),e=null):l=(e=p?y:i===n?i.nextSibling:i)&&e.parentNode?e.parentNode:g;for(;e&&!this.#J.format.isLine(e)&&e.parentNode!==g;)e=e.parentNode}}try{const s=this.#Y.get("wysiwyg");if(!c){if((Ve.check.isWysiwygFrame(e)||l===s.parentNode)&&(l=s,e=null),this.#J.format.isLine(t)||this.#J.format.isBlock(t)||!Ve.check.isListCell(l)&&this.#J.component.isBasic(t)){const t=l;if(Ve.check.isListCell(e))l=e.previousElementSibling||e;else if(!r&&!e){const t=this.remove(),s=3===t.container.nodeType?Ve.check.isListCell(this.#J.format.getLine(t.container,null))?t.container:this.#J.format.getLine(t.container,null)||t.container.parentNode:t.container,i=Ve.check.isWysiwygFrame(s)||this.#J.format.isBlock(s);l=i?s:s.parentNode,e=i?null:s.nextSibling}0===t.childNodes.length&&l!==t&&Ve.utils.removeItem(t)}if(!p||u||this.#J.format.isBlock(l)||Ve.check.isListCell(l)||Ve.check.isWysiwygFrame(l)||(e=l.nextElementSibling,l=l.parentNode),Ve.check.isWysiwygFrame(l)&&(3===t.nodeType||Ve.check.isBreak(t))){const e=Ve.utils.createElement(this.#ot.get("defaultLine"),null,t);n=t,t=e}}if(c?d.parentNode?(l=d,e=a):(l=s,e=null):e=l===e?l.lastChild:e,Ve.check.isListCell(t)&&!Ve.check.isList(l)){if(Ve.check.isListCell(l))e=l.nextElementSibling,l=l.parentNode;else{const t=Ve.utils.createElement("ol");l.insertBefore(t,e),l=t,e=null}c=!0}if(this.#pe(t,l),l.insertBefore(t,e),c)if(Ve.check.isZeroWidth(h.textContent.trim()))Ve.utils.removeItem(h),t=t.lastChild;else{const e=Ve.utils.arrayFind(h.children,Ve.check.isList);e&&(t!==e?(t.appendChild(e),t=e.previousSibling):(l.appendChild(t),t=l),Ve.check.isZeroWidth(h.textContent.trim())&&Ve.utils.removeItem(h))}}catch(e){l.appendChild(t),console.warn("[SUNEDITOR.html.insertNode.warn]",e)}finally{n&&(t=n);const e=l.querySelectorAll("[data-duple]");if(e.length>0)for(let s,i,n,o,l=0,r=e.length;l<r;l++){for(s=e[l],n=s.childNodes,o=s.parentNode;n[0];)i=n[0],o.insertBefore(i,s);s===t&&(t=i),Ve.utils.removeItem(s)}if((this.#J.format.isLine(t)||this.#J.component.isBasic(t))&&b===y){const t=this.#J.format.getLine(g,null);1===t?.nodeType&&Ve.check.isEmptyLine(t)&&Ve.utils.removeItem(t)}if(u&&!Ve.check.isList(t)&&(this.#J.format.isLine(t)||this.#J.format.isBlock(t))&&(t=this.#ge(t)),!this.#J.component.isBasic(t)){let e=1;if(3===t.nodeType)e=t.textContent.length,this.#J.selection.setRange(t,e,t,e);else if(!Ve.check.isBreak(t)&&!Ve.check.isListCell(t)&&this.#J.format.isLine(l)){let s=null;t.previousSibling&&!Ve.check.isBreak(t.previousSibling)||(s=Ve.utils.createTextNode(Be.zeroWidthSpace),t.parentNode.insertBefore(s,t)),t.nextSibling&&!Ve.check.isBreak(t.nextSibling)||(s=Ve.utils.createTextNode(Be.zeroWidthSpace),t.parentNode.insertBefore(s,t.nextSibling)),this.#J.inline._isIgnoreNodeChange(t)&&(t=t.nextSibling,e=0),this.#J.selection.setRange(t,e,t,e)}}i=t}return i}remove(){this.#J.selection.resetRangeToTextNode();const t=this.#J.selection.getRange(),e=0===t.startOffset,s=Ve.check.isEdgePoint(t.endContainer,t.endOffset,"end");let i=null,n=null,o=null;e&&(n=this.#J.format.getLine(t.startContainer),i=n?n.previousElementSibling:null,n=n?i:n),s&&(o=this.#J.format.getLine(t.endContainer),o=o?o.nextElementSibling:o);let l,r=0,a=t.startContainer,h=t.endContainer,c=t.startOffset,d=t.endOffset;const u=3===t.commonAncestorContainer.nodeType&&t.commonAncestorContainer.parentNode===a.parentNode?a.parentNode:t.commonAncestorContainer;if(Ve.check.isWysiwygFrame(a)&&Ve.check.isWysiwygFrame(h)){this.set("");return{container:this.#J.selection.getNode(),offset:0,commonCon:u}}if(u===a&&u===h){if(this.#J.component.isBasic(u)){const t=this.#J.component.get(u).container,e=t.parentElement,s=t.nextSibling||t.previousSibling,i=s===t.previousSibling?s?.textContent?.length||1:0,n=e.nextElementSibling||e.previousElementSibling,o=n===e.previousElementSibling?n?.textContent?.length||1:0;return Ve.utils.removeItem(t),this.#J.format.isLine(e)?0===e.childNodes.length?(Ve.utils.removeItem(e),{container:n,offset:o,commonCon:u}):{container:s,offset:i,commonCon:u}:{container:n,offset:o,commonCon:u}}if(1===u.nodeType&&0===c&&1===d||3===u.nodeType&&0===c&&d===u.textContent.length){const t=Ve.query.getNextDeepestNode(u,this.#Y.get("wysiwyg")),e=Ve.query.getPreviousDeepestNode(u,this.#Y.get("wysiwyg")),s=this.#J.format.getLine(u);Ve.utils.removeItem(u);let i=t||e,n=t?0:3===i?.nodeType?i.textContent.length:1;const o=this.#J.format.getLine(i)||this.#J.component.get(i);return s!==o&&(i=o,n=0===n?0:1),Ve.check.isZeroWidth(s)&&!s.contains(i)&&Ve.utils.removeItem(s),{container:i,offset:n,commonCon:u}}a=u.children[c],h=u.children[d],c=d=0}if(!a||!h)return{container:u,offset:0,commonCon:u};if(a===h&&t.collapsed&&Ve.check.isZeroWidth(a.textContent?.substring(c)))return{container:a,offset:c,prevContainer:a&&a.parentNode?a:null,commonCon:u};let p=null,g=null;const m=Ve.query.getListChildNodes(u,null,null);let f=Ve.utils.getArrayIndex(m,a),v=Ve.utils.getArrayIndex(m,h);if(m.length>0&&f>-1&&v>-1){for(let t=f+1,e=a;t>=0;t--)m[t]===e.parentNode&&m[t].firstChild===e&&0===c&&(f=t,e=e.parentNode);for(let t=v-1,e=h;t>f;t--)m[t]===e.parentNode&&1===m[t].nodeType&&(m.splice(t,1),e=e.parentNode,--v)}else{if(0===m.length){if(this.#J.format.isLine(u)||this.#J.format.isBlock(u)||Ve.check.isWysiwygFrame(u)||Ve.check.isBreak(u)||Ve.check.isMedia(u))return{container:u,offset:0,commonCon:u};if(Ve.check.isText(u))return{container:u,offset:d,commonCon:u};m.push(u),a=h=u}else if(a=h=m[0],Ve.check.isBreak(a)||Ve.check.isZeroWidth(a))return{container:Ve.check.isMedia(u)?u:a,offset:0,commonCon:u};f=v=0}const b=Ve.check.isText,y=Ve.check.isElement,C=f===v;let w=null;for(let t=f;t<=v;t++){const e=m[t];if(!b(e)||void 0!==e.data&&0!==e.length)if(e!==a)if(e!==h)w=this.#me(e,C);else{if(b(h))g=Ve.utils.createTextNode(h.substringData(d,h.length-d));else{if(this.#J.component.is(h))continue;g=Ve.utils.createTextNode(h.textContent)}g.length>0?h.data=g.data:w=this.#me(h,C)}else{if(y(a)){if(this.#J.component.is(a))continue;p=Ve.utils.createTextNode(a.textContent)}else{const t=a,s=h;e===h?(p=Ve.utils.createTextNode(t.substringData(0,c)+s.substringData(d,s.length-d)),r=c):p=Ve.utils.createTextNode(t.substringData(0,c))}if(p.length>0?a.data=p.data:w=this.#me(a,C),e===h)break}else w=this.#me(e,C)}const _=Ve.query.getParentElement(h,"ul"),x=Ve.query.getParentElement(a,"li");if(_&&x&&x.contains(_)?(l=_.previousSibling,r=l.textContent.length):(l=h&&h.parentNode?h:a&&a.parentNode?a:t.endContainer||t.startContainer,(e||s)&&(s?1===l.nodeType&&0===l.childNodes.length?(l.appendChild(Ve.utils.createElement("BR")),r=1):r=l.textContent.length:r=0)),this.#J.format.getLine(l)||a&&a.parentNode||(o?(l=o,r=0):n&&(l=n,r=1)),!Ve.check.isWysiwygFrame(l)&&0===l.childNodes.length){const t=this.#J.nodeTransform.removeAllParents(l,null,null);t&&(l=t.sc||t.ec||this.#Y.get("wysiwyg"))}return l&&(1!==l.nodeType||this.#J.format.isLine(l)||Ve.check.isBreak(l))||(l=w?.sc||w?.ec,r=3===l?.nodeType?l.textContent.length:1),this.#J.selection.setRange(l,r,l,r),{container:l,offset:r,prevContainer:i,commonCon:u?.parentElement?u:null}}get({withFrame:t,includeFullPage:e,rootKey:s}={}){s?Array.isArray(s)||(s=[s]):s=[this.#t.get("rootKey")];const i=this.#t.get("rootKey"),n={};for(let i,o=0,l=s.length;o<l;o++){this.#J.facade.changeFrameContext(s[o]);const l=Ve.utils.createElement("DIV",null,this._convertToCode(this.#Y.get("wysiwyg"),!0)),r=l.querySelectorAll(".se-placeholder-line");for(let t=0,e=r.length;t<e;t++)r[t].classList.remove("se-placeholder-line"),r[t].removeAttribute("data-se-placeholder-line"),r[t].getAttribute("class")||r[t].removeAttribute("class");const a=Ve.check.isTableCell,h=Ve.check.isEmptyLine,c=[],d=[];Ve.query.getListChildren(l,(t=>{t.hasAttribute("contenteditable")&&c.push(t);const e=t.parentElement;return a(e)&&e.children.length<=1&&h(t)&&d.push(e),!1}),null);for(let t=0,e=c.length;t<e;t++)c[t].removeAttribute("contenteditable");for(let t=0,e=d.length;t<e;t++)d[t].innerHTML="<br>";this.#fe(l);const u=l.innerHTML;if(this.#Q.get("iframe_fullPage"))if(e){const t=Ve.utils.getAttributesToString(this.#Y.get("_wd").body,["contenteditable"]);i=`<!DOCTYPE html><html>${this.#Y.get("_wd").head.outerHTML}<body ${t}>${u}</body></html>`}else i=u;else i=t?`<div class="${this.#ot.get("_editableClass")+""+(this.#ot.get("_rtl")?" se-rtl":"")}">${u}</div>`:l.innerHTML;n[s[o]]=i}return this.#J.facade.changeFrameContext(i),s.length>1?n:n[s[0]]}set(t,{rootKey:e}={}){this.#J.ui.offCurrentController(),this.#J.selection.removeRange();const s=null==t?"":this.clean(t,{forceFormat:!0,whitelist:null,blacklist:null});e?Array.isArray(e)||(e=[e]):e=[this.#t.get("rootKey")];for(let t=0;t<e.length;t++)if(this.#J.facade.changeFrameContext(e[t]),this.#Y.get("isMarkdownView")){const t=Ie.htmlToJson(s);this.#Y.get("markdown").value=ze.jsonToMarkdown(t)}else if(this.#Y.get("isCodeView")){const t=this._convertToCode(s,!1);this.#J.viewer._setCodeView(t)}else this.#Y.get("wysiwyg").innerHTML=s,this.#J.pluginManager.resetFileInfo(),this.#J.history.push(!1,e[t])}add(t,{rootKey:e}={}){this.#J.ui.offCurrentController(),e?Array.isArray(e)||(e=[e]):e=[this.#t.get("rootKey")];for(let s=0;s<e.length;s++){this.#J.facade.changeFrameContext(e[s]);const i=this.clean(t,{forceFormat:!0,whitelist:null,blacklist:null});if(this.#Y.get("isMarkdownView")){const t=Ie.htmlToJson(i);this.#Y.get("markdown").value+="\n"+ze.jsonToMarkdown(t)}else if(this.#Y.get("isCodeView"))this.#J.viewer._setCodeView(this.#J.viewer._getCodeView()+"\n"+this._convertToCode(i,!1));else{const t=Ve.utils.createElement("DIV",null,i),n=Array.from(t.children);for(let t=0,e=n.length;t<e;t++)this.#Y.get("wysiwyg").appendChild(n[t]);this.#J.history.push(!1,e[s]),this.#J.selection.scrollTo(n.at(-1))}}}getJson({withFrame:t,rootKey:e}={}){return Ie.htmlToJson(this.get({withFrame:t,rootKey:e}))}setJson(t,{rootKey:e}={}){this.set(Ie.jsonToHtml(t),{rootKey:e})}async copy(t){try{return!("string"!=typeof t&&!Ve.check.isElement(t)&&!Ve.check.isText(t))&&(!1===await Pe.write(t)?(this.#J.ui.showToast(this.#J.lang.message_copy_fail,this.#ot.get("toastMessageTime").copy,"error"),!1):(this.#J.ui.showToast(this.#J.lang.message_copy_success,this.#ot.get("toastMessageTime").copy),!0))}catch(t){return console.error("[SUNEDITOR.html.copy.fail] :",t),this.#J.ui.showToast(this.#J.lang.message_copy_fail,this.#ot.get("toastMessageTime").copy,"error"),!1}}setFullPage(t,{rootKey:e}={}){if(!this.#Q.get("iframe"))return!1;e?Array.isArray(e)||(e=[e]):e=[this.#t.get("rootKey")];for(let s=0;s<e.length;s++)this.#J.facade.changeFrameContext(e[s]),t.head&&(this.#Y.get("_wd").head.innerHTML=t.head.replace(this.#Qt,"")),t.body&&(this.#Y.get("_wd").body.innerHTML=this.clean(t.body,{forceFormat:!0,whitelist:null,blacklist:null})),this.#J.pluginManager.resetFileInfo()}compress(t){return t.replace(/>\s+</g,"> <").replace(/\n/g,"").trim()}_convertToCode(t,e){let s="";const i=RegExp,n=new i("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),o="string"==typeof t?Rs.createRange().createContextualFragment(t):t,l=t=>this.#J.format.isLine(t)||this.#J.component.is(t),r=e?"":"\n",a=e?0:1*this.#t.get("codeIndentSize"),h=a>0?new Array(a+1).join(" "):"";return function t(e,o){const a=e?.childNodes;if(!a)return;const c=n.test(e.nodeName),d=c?o:"";for(let u,p,g,m,f,v,b=0,y=a.length;b<y;b++)u=a[b],m=n.test(u.nodeName),p=m?r:"",g=!l(u)||c||/^(TH|TD)$/i.test(e.nodeName)?"":r,8!==u.nodeType?3!==u.nodeType?0!==u.childNodes.length?u.outerHTML?(f=u.nodeName.toLowerCase(),v=d||m?o:"",s+=(g||(c?"":p))+v+u.outerHTML.match(i("<"+f+"[^>]*>","i"))[0]+p,t(u,o+h+""),s+=(/\n$/.test(s)?v:"")+"</"+f+">"+(g||p||c||/^(TH|TD)$/i.test(u.nodeName)?r:"")):s+=(new XMLSerializer).serializeToString(u):s+=(/^HR$/i.test(u.nodeName)?r:"")+(/^PRE$/i.test(u.parentElement.nodeName)&&/^BR$/i.test(u.nodeName)?"":d)+u.outerHTML+p:Ve.check.isList(u.parentElement)||(s+=Ie.htmlToEntity(/^\n+$/.test(u.data)?"":u.data)):s+="\n\x3c!-- "+u.textContent.trim()+" --\x3e"+p}(o,""),s.trim()+r}#me(t,e){const s=this.#J.format.getLine(t,null);if(Ve.utils.removeItem(t),!Ve.check.isListCell(s)||e)return;const i=this.#J.nodeTransform.removeAllParents(s,null,null);return Ve.check.isList(s?.firstChild)&&s.insertBefore(Ve.utils.createTextNode(Be.zeroWidthSpace),s.firstChild),i?{sc:i.sc,ec:i.ec}:null}#ge(t){const e=t.parentNode;let s,i;for(;this.#J.format.isLine(t)||this.#J.format.isBlock(t);){for(s=t.childNodes,i=null;s[0];)if(i=s[0],this.#J.format.isLine(i)||this.#J.format.isBlock(i)){if(this.#ge(i),!t.parentNode)break;s=t.childNodes}else e.insertBefore(i,t);0===t.childNodes.length&&Ve.utils.removeItem(t),t=Ve.utils.createElement("BR"),e.insertBefore(t,i.nextSibling)}return t}#ce(t,e){const s=this.#ot.get("defaultLine");if(1===t.nodeType){if(this.#te.test(t.nodeName))return"";if(Ve.check.isExcludeFormat(t))return t.outerHTML;const i=Ve.query.getListChildNodes(t,(t=>Ve.check.isSpanWithoutAttr(t)&&!Ve.query.getParentElement(t,Ve.check.isExcludeFormat)),null)||[];for(let t,e=i.length-1;e>=0;e--)t=i[e],t.outerHTML=t.innerHTML;if(!e||this.#J.format.isLine(t)||this.#J.format.isBlock(t)||this.#J.component.is(t)||Ve.check.isMedia(t)||Ve.check.isFigure(t)||Ve.check.isAnchor(t)&&Ve.check.isMedia(t.firstElementChild)){const e=t;return Ve.check.isSpanWithoutAttr(t)?e.innerHTML:e.outerHTML}{const e=t;return"<"+s+">"+(Ve.check.isSpanWithoutAttr(t)?e.innerHTML:e.outerHTML)+"</"+s+">"}}if(3===t.nodeType){if(!e)return Ie.htmlToEntity(t.textContent);const i=t.textContent.split(/\n/g);let n="";for(let t,e=0,o=i.length;e<o;e++)t=i[e].trim(),t.length>0&&(n+="<"+s+">"+Ie.htmlToEntity(t)+"</"+s+">");return n}return 8===t.nodeType&&this.#Ft?"\x3c!--"+t.textContent.trim()+"--\x3e":""}#ve(t){return!t||11===t.nodeType||Ve.check.isWysiwygFrame(t)||Ve.check.isList(t)||Ve.check.isTableElements(t)||this.#J.format.isBlock(t)}#re(t,e,s,i,n,o,l){const r=[],a=[],h=[],c=[],d=Ve.query.getListChildNodes(t,(d=>{if(1!==d.nodeType)return n&&Ve.check.isList(d.parentElement)&&r.push(d),3===d.nodeType&&(!d.textContent||js.test(d.textContent)&&(this.#ve(d.parentNode)||!d.previousSibling!=!d.nextSibling))&&r.push(d),!1;if(i&&(s.test(d.nodeName)||!e.test(d.nodeName)&&0===d.childNodes.length&&Ve.check.isExcludeFormat(d)))return r.push(d),!1;"PRE"===d.nodeName&&this.#be(d);const u=!Ve.query.getParentElement(d,Ve.check.isExcludeFormat);if(n){if(!Ve.check.isTableElements(d)&&!Ve.check.isListCell(d)&&!Ve.check.isAnchor(d)&&(this.#J.format.isLine(d)||this.#J.format.isBlock(d)||this.#J.format.isTextStyleNode(d))&&0===d.childNodes.length&&u)return a.push(d),!1;if(Ve.check.isList(d.parentNode)&&!Ve.check.isList(d)&&!Ve.check.isListCell(d))return h.push(d),!1;if(Ve.check.isTableCell(d)){const t=d.firstElementChild;if(!this.#J.format.isLine(t)&&!this.#J.format.isBlock(t)&&!this.#J.component.is(t))return c.push(d),!1}}if(o&&u&&d.className){const t=Array.from(d.classList).map(this.#Dt).join(" ").trim();t?d.className=t:d.removeAttribute("class")}if(!n)return!1;return!l&&d.parentNode!==t&&u&&(Ve.check.isListCell(d)&&!Ve.check.isList(d.parentNode)||(this.#J.format.isLine(d)||this.#J.component.is(d))&&!this.#J.format.isBlock(d.parentNode)&&!Ve.query.getParentElement(d,this.#J.component.is.bind(this.#J.component)))}),null);for(let t=0,e=r.length;t<e;t++)Ve.utils.removeItem(r[t]);const u=[];for(let t,e,s=0,i=d.length;s<i;s++)if(t=d[s],e=t.parentNode,e&&e.parentNode)if(Ve.query.getParentElement(t,Ve.check.isListCell)){const s=t.childNodes;for(let i=s.length-1;i>=0;i--)e.insertBefore(s[i],t);u.push(t)}else e.parentNode.insertBefore(t,e),u.push(e);for(let t,e=0,s=u.length;e<s;e++)t=u[e],Ve.check.isZeroWidth(t.textContent.trim())&&Ve.utils.removeItem(t);for(let t=0,e=a.length;t<e;t++)Ve.utils.removeItem(a[t]);for(let t,e,s,i,n=0,o=h.length;n<o;n++)if(t=h[n],i=t.parentNode,i)if(e=Ve.utils.createElement("LI"),this.#J.format.isLine(t)){for(s=t.childNodes;s[0];)e.appendChild(s[0]);i.insertBefore(e,t),Ve.utils.removeItem(t)}else t=t.nextSibling,e.appendChild(h[n]),i.insertBefore(e,t);for(let t,e,s=0,i=c.length;s<i;s++){if(t=c[s],e=Ve.utils.createElement("DIV"),e.innerHTML=t.innerHTML,0===t.textContent.trim().length&&this.#ye(t)){let t=e;for(;t.firstElementChild;)t=t.firstElementChild;t.innerHTML="<br>"}t.innerHTML=e.outerHTML}}#ye(t){const e=t.querySelectorAll("*"),s=this.#J.format;for(let t=0;t<e.length;t++)if(!s.isTextStyleNode(e[t]))return!1;return!0}#de(t){if(!this.#qt)return t;const e=this.#ot.get("_defaultStyleTagMap");return t.replace(this.#qt,((t,s,i,n)=>s+("string"==typeof e[i]?e[i]:i)+(n?" "+n:"")))}#he(t){let e,s="";const i=t.childNodes;for(let t,n=0,o=i.length;n<o;n++)t=i[n],this.#ee.test(t.nodeName)?s+=t.outerHTML:8===t.nodeType?s+="\x3c!-- "+t.textContent+" --\x3e":/meta/i.test(t.nodeName)||this.#J.format.isLine(t)||this.#J.format.isBlock(t)||this.#J.component.is(t)||Ve.check.isExcludeFormat(t)?(e&&(s+=e.outerHTML,e=null),s+=t.outerHTML):(e||=Ve.utils.createElement(this.#ot.get("defaultLine")),this.#J.format.isTextStyleNode(t)&&t.removeAttribute("style"),e.appendChild(t),n--,o--);return e&&(s+=e.outerHTML),Rs.createRange().createContextualFragment(s)}#ue(t){let e="";for(let s,i=0,n=t.length;i<n;i++)s=t[i],1===s.nodeType?Ve.check.isList(s)?e+=s.innerHTML:Ve.check.isListCell(s)?e+=s.outerHTML:this.#J.format.isLine(s)?e+="<li>"+(s.innerHTML.trim()||"<br>")+"</li>":this.#J.format.isBlock(s)&&!Ve.check.isTableElements(s)?e+=this.#ue(s.children):e+="<li>"+s.outerHTML+"</li>":e+="<li>"+(s.textContent||"<br>")+"</li>";return e}#ae(t){let e=!1;for(let s,i=0,n=t.length;i<n;i++)if(s=t[i],1===s.nodeType&&!this.#J.format.isTextStyleNode(s)&&!Ve.check.isBreak(s)&&!this.#te.test(s.nodeName)){e=!0;break}return e}#Ce(t,e,s){let i=(t.match(Ws)||[])[0];if(this.#Jt.includes(s)&&!i&&(t.match(Gs)||[])[1]){const e=(t.match(Ks)||[])[1],s=(t.match(Ys)||[])[1],n=(t.match(Xs)||[])[1];(e||s||n)&&(i='style="'+(e?"font-size:"+Oe.get(Number(e)/3.333,1)+"rem;":"")+(s?"font-family:"+s+";":"")+(n?"color:"+n+";":"")+'"')}if(i){let t;e||=[];for(const[e,i]of this.#Xt)if(e.test(s)){t=i;break}if(!t)return e;const n=i.replace(Js,"").match(t);if(!n)return e;const o=[];for(let t,e=0,s=n.length;e<s;e++)if(t=n[e].match(Qs),t&&!ti.test(t[3])){const e=Ie.kebabToCamelCase(t[1].trim()),s=this.#Y.get("wwComputedStyle")[e]?.replace(ei,""),i=t[3].trim();switch(e){case"fontFamily":if(!this.#J.plugins.font||!this.#J.plugins.font.fontArray.includes(i))continue;break;case"fontSize":if(!this.#J.plugins.fontSize)continue;this.#zt.test(t[0])||(t[0]=t[0].replace((t[0].match(si)||[])[1],Ie.toFontUnit.bind(null,this.#ot.get("fontSizeUnits")[0])));break;case"color":if(!this.#J.plugins.fontColor||ii.test(i))continue;break;case"backgroundColor":if(!this.#J.plugins.backgroundColor||ii.test(i))continue}s!==i&&o.push(t[0])}o.length>0&&e.push('style="'+o.join(";")+'"')}return e}#oe(t,e,s){return e.test("<font>")&&(t=t.replace(/(<\/?)font(\s?)/gi,"$1span$2")),t.replace(e,"").replace(s,"")}#pe(t,e){const s=t=>{this.#we(t,e);const i=t.childNodes;for(let t=0,e=i.length;t<e;t++)s(i[t])};s(t)}#we(t,e){if(!this.#J.format.isTextStyleNode(t))return;const s=(t.style.cssText.match(ni)||[]).map((function(t){return t.trim()})),i=t.nodeName;if(oi.test(i)&&0===s.length)return t;const n=this.#J.format;let o=!1;return function e(l){if(!Ve.check.isWysiwygFrame(l)&&n.isTextStyleNode(l)){if(l.nodeName===i){o=!0;const e=l.style.cssText.match(ni)||[];for(let t,i=0,n=e.length;i<n;i++)(t=s.indexOf(e[i].trim()))>-1&&s.splice(t,1);for(let e=0,s=l.classList.length;e<s;e++)t.classList.remove(l.classList[e])}e(l.parentElement)}}(e),o&&((t.style.cssText=s.join(" "))||(t.setAttribute("style",""),t.removeAttribute("style")),0===t.attributes.length&&t.setAttribute("data-duple","true")),t}#le(t,e,s,i){if(zs.test(s))return s;let n=null;const o=i.match(Ds)[0].toLowerCase();if(t){const t=this.#ie[o];s=s.replace(Fs,""),s=t?s.replace(t,""):s.replace(this.#Kt,"");const e=this.#se[o];n=e?s.match(e):s.match(this.#jt)}if(!e)return s;if("a"===o){const t=s.match(/(?:(?:id|name)\s*=\s*(?:"|')[^"']*(?:"|'))/g);t&&(n||=[],n.push(t[0]))}else n&&qs.test(n.toString())||(Us.test(s)?n=this.#Ce(s,n,"@component"):this.#Yt.test(o)?n=this.#Ce(s,n,o):this.#J.format.isLine(o)?n=this.#Ce(s,n,"@line"):this.#Jt.includes(o)&&(n=this.#Ce(s,n,"@text")));if(Ve.check.isMedia(o)||Ve.check.isFigure(o)){const t=s.match(Ws);n||=[],t&&n.push(t[0])}if(n)for(let t,e=0,s=n.length;e<s;e++)t=di(n[e].trim())?n[e]:"",i+=(Zs.test(t)?"":" ")+t;return i}__resetAutoStyleify(t){if(t.length>0){const e=this.#ot.get("convertTextTags"),s={};t.forEach((t=>{switch(t){case"bold":s.bold={regex:/font-weight\s*:\s*bold/i,tag:e.bold};break;case"italic":s.italic={regex:/font-style\s*:\s*italic/i,tag:e.italic};break;case"underline":s.underline={regex:/text-decoration\s*:\s*underline/i,tag:e.underline};break;case"strike":s.strike={regex:/text-decoration\s*:\s*line-through/i,tag:e.strike}}})),this.#ne=s}else this.#ne=null}_destroy(){this.#Xt&&this.#Xt.clear()}#be(t){if(1!==t.children.length||"CODE"!==t.firstElementChild?.nodeName)return;const e=t.firstElementChild,s=(e.className||"").match(/language-(\S+)/);for(s&&(Ve.utils.addClass(t,"language-"+s[1]),t.setAttribute("data-se-lang",s[1]));e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}#fe(t){const e=t.querySelectorAll('pre[class*="language-"]');for(let t,s,i,n=0,o=e.length;n<o;n++)if(t=e[n],s=(t.className.match(/language-(\S+)/)||[])[1],s){for(i=Ve.utils.createElement("CODE",{class:"language-"+s});t.firstChild;)i.appendChild(t.firstChild);t.appendChild(i),t.className=t.className.replace(/\s*language-\S+/g,"").trim(),t.removeAttribute("data-se-lang")}}};const gi=class{#J;#ot;constructor(t){this.#J=t.$,this.#ot=this.#J.options}split(t,e,s){if(Ve.check.isWysiwygFrame(t)||this.#J.component.is(t)||!t)return t;if(e&&!Oe.is(e)){const s=t.childNodes;let i=Ve.query.getPositionIndex(e);const n=t.cloneNode(!1),o=t.cloneNode(!1);for(let t=0,e=s.length;t<e;t++){if(t<i)n.appendChild(s[t]);else{if(!(t>i))continue;o.appendChild(s[t])}t--,e--,i--}return n.childNodes.length>0&&t.parentNode.insertBefore(n,t),o.childNodes.length>0&&t.parentNode.insertBefore(o,t.nextElementSibling),t}const i=t.parentNode;let n,o,l,r=0,a=1,h=!0;if((!s||s<0)&&(s=0),Ve.check.isText(t)){if(r=Ve.query.getPositionIndex(t),(e=Number(e))>=0&&t.length!==e){t.splitText(e);const s=Ve.query.getNodeFromPath([r+1],i);Ve.check.isZeroWidth(s)&&(s.data=Be.zeroWidthSpace)}}else if(1===t.nodeType){if(0===e){for(;t.firstChild;)t=t.firstChild;if(3===t.nodeType){const e=Ve.utils.createTextNode(Be.zeroWidthSpace);t.parentNode.insertBefore(e,t),t=e}}t.previousSibling?t=t.previousSibling:Ve.query.getNodeDepth(t)===s&&(h=!1)}1===t.nodeType&&(a=0);let c=t;for(;Ve.query.getNodeDepth(c)>s;)for(r=Ve.query.getPositionIndex(c)+a,c=c.parentNode,l=n,n=c.cloneNode(!1),o=c.childNodes,l&&(Ve.check.isListCell(n)&&Ve.check.isList(l)&&l.firstElementChild?(n.innerHTML=l.firstElementChild.innerHTML,Ve.utils.removeItem(l.firstElementChild),l.children.length>0&&n.appendChild(l)):n.appendChild(l));o[r];)n.appendChild(o[r]);1===c.nodeType&&c.childNodes.length<=1&&!c.firstChild?.textContent?.length&&(c.innerHTML="<br>");const d=c.parentNode;return h&&(c=c.nextSibling),n?(this.mergeSameTags(n,null,!1),this.mergeNestedTags(n,Ve.check.isList),n.childNodes.length>0?d.insertBefore(n,c):n=c,Ve.check.isListCell(n)&&n.children&&Ve.check.isList(n.children[0])&&n.insertBefore(Ve.utils.createElement("BR"),n.children[0]),0===i.childNodes.length&&Ve.utils.removeItem(i),n):c}mergeSameTags(t,e,s){const i=e?e.length:0;let n=null;i&&(n=Array.apply(null,new Array(i)).map(Number.prototype.valueOf,0));const o=(t,l,r)=>{const a=t.childNodes;for(let h,c,d=0,u=a.length;d<u&&(h=a[d],c=a[d+1],h);d++)if(!(Ve.check.isBreak(h)||Ve.check.isMedia(h)||Ve.check.isInputElement(h)))if(s&&this.#J.inline._isIgnoreNodeChange(h)||!s&&(Ve.check.isTableElements(h)||Ve.check.isListCell(h)||this.#J.format.isLine(h)&&!this.#J.format.isBrLine(h)))(Ve.check.isTableElements(h)||Ve.check.isListCell(h))&&o(h,l+1,d);else{if(1===u&&t.nodeName===h.nodeName&&t.parentNode){if(i){let s,n,o,r,a;for(let c=0;c<i;c++)if(s=e[c],s&&s[l]===d){for(n=h,o=t,r=l,a=!0;r>=0;){if(Ve.utils.getArrayIndex(o.childNodes,n)!==s[r]){a=!1;break}n=h.parentNode,o=n.parentNode,r--}a&&(s.splice(l,1),s[l]=d)}}Ve.utils.copyTagAttributes(h,t),t.parentNode.insertBefore(h,t),Ve.utils.removeItem(t)}if(!c){1===h.nodeType&&o(h,l+1,d);break}if(h.nodeName===c.nodeName&&Ve.check.isSameAttributes(h,c)&&h.getAttribute?.("href")===c.getAttribute?.("href")){const t=h.childNodes;let s=0;for(let e=0,i=t.length;e<i;e++)t[e].textContent.length>0&&s++;const o=h.lastChild,a=c.firstChild;let u=0;if(o&&a){const t=3===o.nodeType&&3===a.nodeType;u=o.textContent.length;let h=o.previousSibling;for(;h&&3===h.nodeType;)u+=h.textContent.length,h=h.previousSibling;if(s>0&&3===o.nodeType&&3===a.nodeType&&(o.textContent.length>0||a.textContent.length>0)&&s--,i){let h=null;for(let c=0;c<i;c++)if(h=e[c],h&&h[l]>d){if(l>0&&h[l-1]!==r)continue;h[l]-=1,h[l+1]>=0&&h[l]===d&&(h[l+1]+=s,t&&o&&3===o.nodeType&&a&&3===a.nodeType&&(n[c]+=u))}}}if(3===h.nodeType){if(u=h.textContent.length,h.textContent+=c.textContent,i){let t=null;for(let o=0;o<i;o++)if(t=e[o],t&&t[l]>d){if(l>0&&t[l-1]!==r)continue;t[l]-=1,t[l+1]>=0&&t[l]===d&&(t[l+1]+=s,n[o]+=u)}}}else h.innerHTML+=c.innerHTML;Ve.utils.removeItem(c),d--}else 1===h.nodeType&&o(h,l+1,d)}};return o(t,0,0),n}mergeNestedTags(t,e){if("string"==typeof e){const t=new RegExp(`^(${e||".+"})$`,"i");e=e=>t.test(e.nodeName)}else"function"!=typeof e&&(e=()=>!0);!function t(s){let i=s.children;if(1===i.length&&i[0].nodeName===s.nodeName&&e(s)){const t=i[0];for(i=t.children;i[0];)s.appendChild(i[0]);s.removeChild(t)}for(let e=0,i=s.children.length;e<i;e++)t(s.children[e])}(t)}removeAllParents(t,e,s){if(!t)return null;let i=null;return e||=t=>{if(t===s||this.#J.component.is(t))return!1;const e=t.textContent.trim();return 0===e.length||/^(\n|\u200B)+$/.test(e)},function t(s){if(!Ve.check.isWysiwygFrame(s)){const n=s.parentNode;n&&e(s)&&(i={sc:s.previousElementSibling,ec:s.nextElementSibling},Ve.utils.removeItem(s),t(n))}}(t),i}removeEmptyNode(t,e,s){const i=this.#ot.get("allowedEmptyTags");e&&=Ve.query.getParentElement(e,(e=>t===e.parentElement));const n=s=>{if(this.#J.format._isNotTextNode(s)||s===e||Ve.check.isNonEditable(s))return 0;if(s===t||!Ve.check.isZeroWidth(s.textContent)||s.firstChild&&Ve.check.isBreak(s.firstChild)||s.querySelector(i)){const t=s.children;for(let e=0,s=t.length,i=0;e<s;e++)t[e+i]&&!this.#J.component.is(t[e+i])&&(i+=n(t[e+i]))}else if(s.parentNode)return s.parentNode.removeChild(s),-1;return 0};n(t),0===t.childNodes.length&&(s?Ve.utils.removeItem(t):t.innerHTML="<br>")}createNestedNode(t,e){"function"!=typeof e&&(e=()=>!0);const s=t[0].cloneNode(!1);let i=s;for(let s,n=1,o=t.length;n<o;n++)e(t[n])&&(s=t[n].cloneNode(!1),i.appendChild(s),i=s);return i.innerHTML="",{parent:s,inner:i}}};function mi(t){t&&!ct(t,"se-blink")&&(dt(t,"se-blink"),o.setTimeout((()=>{ut(t,"se-blink")}),600))}const fi=class{#J;#Y;#Q;constructor(t){this.#J=t.$,this.#Y=this.#J.frameContext,this.#Q=this.#J.frameOptions}check(t){const e=this.#Q.get("charCounter_max");if(e){const s=this.getLength("string"==typeof t?t:"byte-html"===this.#Q.get("charCounter_type")&&1===t.nodeType?t.outerHTML:t.textContent);if(s>0&&s+this.getLength()>e)return mi(this.#Y.get("charWrapper")),!1}return!0}getLength(t){return"string"!=typeof t&&(t="byte-html"===this.#Q.get("charCounter_type")?this.#Y.get("wysiwyg").innerHTML:this.#Y.get("wysiwyg").textContent),/byte/.test(this.#Q.get("charCounter_type"))?this.getByteLength(t):t.length}getByteLength(t){if(!t||!t.toString)return 0;let e,s;return t=t.toString(),u?(s=decodeURIComponent(encodeURIComponent(t)).length,e=0,null!==encodeURIComponent(t).match(/(%0A|%0D)/gi)&&(e=encodeURIComponent(t).match(/(%0A|%0D)/gi).length),s+e):(s=(new TextEncoder).encode(t).length,e=0,null!==encodeURIComponent(t).match(/(%0A|%0D)/gi)&&(e=encodeURIComponent(t).match(/(%0A|%0D)/gi).length),s+e)}getWordCount(t){"string"!=typeof t&&(t=this.#Y.get("wysiwyg").innerText);const e=t.trim();return e?e.split(/\s+/).length:0}display(t){const e=t||this.#Y,s=e.get("charCounter"),i=e.get("wordCounter");(s||i)&&o.setTimeout((()=>{s&&(s.textContent=String(this.getLength())),i&&(i.textContent=String(this.getWordCount()))}),0)}test(t,e){let s=0;t&&(s=this.getLength(t)),this.display();const i=this.#Q.get("charCounter_max");if(i>0){let t=!1;const n=this.getLength();if(n>i){if(t=!0,s>0&&e){this.#J.selection.init();const t=this.#J.selection.getRange(),e=t.endOffset-1,s=this.#J.selection.getNode().textContent,i=t.endOffset-1;this.#J.selection.getNode().textContent=s.slice(0,i<0?0:i)+s.slice(t.endOffset,s.length),this.#J.selection.setRange(t.endContainer,e,t.endContainer,e)}}else n+s>i&&(t=!0);if(t&&(mi(this.#Y.get("charWrapper")),s>0))return!1}return!0}};const vi=class{#J;#ot;#_e=!1;constructor(t){this.#J=t.$,this.#ot=this.#J.options,this.keyMap=new Map,this.reverseKeys=new Set}command(t,e,s,i,n,o,l,r){if(this.#_e)return!1;let a=null;return a=e?this.keyMap.get(i+(s?"1000":"")):this.keyMap.get(n)||this.keyMap.get(n+t.key),!(!a||!s&&a.s||a.space&&!Re.isSpace(i)||a.enter&&!Re.isEnter(i)||a.textTrigger&&!t.key.trim()||a.edge&&!o)&&(a.plugin&&"string"==typeof a.method?this.#J.plugins[a.plugin][a.method]?.({range:r,line:l,info:a,event:t,keyCode:i}):"function"==typeof a.method?a.method({range:r,line:l,info:a,event:t,keyCode:i}):this.#J.commandDispatcher.run(a.command,a.type,a.button),!0)}disable(){this.#_e=!0}enable(){this.#_e=!1}_registerShortcuts(){const t=this.#ot.get("shortcuts"),e=this.#ot.get("_reverseCommandArray"),s=this.keyMap=new Map,i=this.reverseKeys;for(const n of Object.keys(t)){if(this.#J.plugins[n])continue;ts(n.startsWith("_")?"":n,null,t[n],s,e,i)}}_destroy(){this.keyMap.clear(),this.reverseKeys.clear()}},bi=new Map([["__figureInst",null],["__dragInst",null],["__dragHandler",null],["__dragContainer",null],["__dragCover",null],["__dragMove",null],["__overInfo",null]]),yi=bi,{_w:Ci,isMobile:wi,ON_OVER_COMPONENT:_i}=Ae,xi="2147483646",$i="2147483645",ki="2147483642",Si="2147483641",Ei={left:0,right:0,top:0};const Ti=class{#J;#xe;#$e;#ke;#Se=Ei;#Ee=!1;#Te=!1;#Me=null;#He=null;#Le=null;#Ne=[];#Ae=new Map;constructor(t,e,s,i,n){this.#J=e,this.kind=n||t.constructor.key||t.constructor.name,this.host=t,this.form=s,this.isOpen=!1,this.currentTarget=null,this.currentPositionTarget=null,this.isWWTarget=i.isWWTarget??!0,this.position=i.position||"bottom",this.disabled=!!i.disabled,this.parents=i.parents||[],this.parentsForm=[],this.parentsHide=!!i.parentsHide,this.sibling=i.sibling||null,this.siblingMain=!!i.siblingMain,this.isInsideForm=!!i.isInsideForm,this.isOutsideForm=!!i.isOutsideForm,this.toTop=!1,this.__offset={},this.#xe="function"==typeof i.initMethod?i.initMethod:null,this.#$e="function"==typeof i.escGuard?i.escGuard:null,this.#ke={keydown:this.#Be.bind(this),mousedown:this.#Ie.bind(this)};for(const t of this.parents)Ve.check.isElement(t)?this.parentsForm.push(t):(t.#Ne.push(this),this.parentsForm.push(t.form));this.form.setAttribute("popover","manual"),this.#J.contextProvider.carrierWrapper.appendChild(s),this.#J.eventManager.addEvent(s,"click",this.#Ve.bind(this)),this.#J.eventManager.addEvent(s,"mouseenter",this.#Oe.bind(this)),this.#J.eventManager.addEvent(s,"mouseleave",this.#Re.bind(this))}open(t,e,{isWWTarget:s,passive:i,initMethod:n,disabled:o,addOffset:l}={}){if(bi.get("__overInfo")===_i&&(i=!0),!t)return void console.warn("[SUNEDITOR.Controller.open.fail] The target element is required.");if(this.form.removeAttribute("data-se-hidden-by-parent"),this.form.removeAttribute("data-se-hidden-by-children"),this.#Ae.clear(),i||(this.#J.store.mode.isBalloon?this.#J.toolbar.hide():this.#J.store.mode.isSubBalloon&&this.#J.subToolbar.hide(),this.#J.store.get("hasFocus")||(o??this.disabled?this.#J.ui.setControllerOnDisabledButtons(!0):this.#J.ui.setControllerOnDisabledButtons(!1))),this.currentPositionTarget=e||t,this.isWWTarget=s??this.isWWTarget,"function"==typeof n&&(this.#xe=n),i||(this.#J.ui.currentControllerName=this.kind),this.#Se={left:0,right:0,top:0,...l},!i){const t=this.isOutsideForm?this.parentsForm:[];this.#J.ui.opendControllers?.forEach((e=>{t.includes(e.form)||(e.form.style.zIndex=Si)})),this.parentsHide&&this.parentsForm.forEach((t=>{t.style.display="none",t.setAttribute("data-se-hidden-by-children","1")}))}this.#Pe(),this.#ze(this.form,this.currentPositionTarget,!1);const r=this.#J.instanceCheck.isRange(t);this.currentTarget=r?null:t,this.#De(this.form,t,r,i),Ci.setTimeout((()=>bi.set("__overInfo",!1)),0)}close(t){(t||this.isOpen&&!this.#Te)&&(this.form.removeAttribute("data-se-hidden-by-parent"),this.form.removeAttribute("data-se-hidden-by-children"),this.#Ae.clear(),this.#Fe("close"),this.toTop=!1,this.isOpen=!1,this.#Te=!1,this.__offset={},this.#Se=Ei,this.#qe(),this.#xe?.(),this.#We(),this.parentsHide&&!t&&this.parentsForm.forEach((t=>{t.style.display="block",t.removeAttribute("data-se-hidden-by-children")})),this.host.controllerClose?.(),this.parentsForm.length>0||this.#J.component.deselect())}hide(){this.#Fe("hide"),this.form.style.display="none"}show(){this.#ze(this.form,this.currentPositionTarget,!1)}bringToTop(t){this.toTop=t,this.form.style.zIndex=t?xi:$i}resetPosition(t){this.#ze(this.form,t||this.currentPositionTarget,!0)}_scrollReposition(){this.form.hasAttribute("data-se-hidden-by-parent")||this.form.hasAttribute("data-se-hidden-by-children")||this.#ze(this.form,this.currentPositionTarget,!1)&&Ci.setTimeout((()=>{this.#Fe("show")}),0)}#Fe(t){for(const e of this.#Ne)if("hide"===t&&"none"!==e.form.style.display){const t=this.#Ue(e);e.#Ae.set(this,!0);const s=this.#Ue(e);!t&&s&&(e.form.setAttribute("data-se-hidden-by-parent","1"),e.hide())}else if("show"===t){if(e.form.hasAttribute("data-se-hidden-by-children")){e.#Fe("show");continue}const t=this.#Ue(e);e.#Ae.set(this,!1);const s=this.#Ue(e);t&&!s&&(e.form.removeAttribute("data-se-hidden-by-parent"),e.show())}else e[t]?.(!0)}#Ue(t){for(const e of t.#Ae.values())if(!0===e)return!0;return!1}async#De(t,e,s,i){const n={position:this.position,inst:this,form:t,target:e,isRangeTarget:s,notInCarrier:!this.#J.contextProvider.carrierWrapper.contains(t)};!1!==await this.#J.eventManager.triggerEvent("onBeforeShowController",{caller:this.kind,frameContext:this.#J.frameContext,info:n})&&(t.style.display="block",this.#J.contextProvider.shadowRoot&&(this.#Me=this.#J.eventManager.addEvent(t,"mousedown",(t=>t.stopPropagation()))),i||(this.#J.ui.onControllerContext(),this.#J.store.set("controlActive",!0),this.#J.store.set("_preventBlur",!0)),this.isOpen||this.#J.ui.opendControllers.push(n),this.isOpen=!0,this.host.controllerOn?.(t,e),this.#J.eventManager.triggerEvent("onShowController",{caller:this.kind,frameContext:this.#J.frameContext,info:n}))}#We(){this.form.hidePopover?.(),this.form.style.display="none",this.#J.ui.opendControllers=this.#J.ui.opendControllers.filter((t=>t.form!==this.form)),this.#J.ui.currentControllerName!==this.kind&&this.#J.ui.opendControllers.length>0||(this.#J.ui.setControllerOnDisabledButtons(!1),this.#J.ui.offControllerContext(),this.#J.frameContext.get("lineBreaker_t").style.display=this.#J.frameContext.get("lineBreaker_b").style.display="none",this.#J.store.set("_lastSelectionNode",null),this.#J.ui.currentControllerName="",this.#J.store.set("_preventBlur",!1),Ci.setTimeout((()=>{this.#J.store.set("controlActive",!1)}),0),this.#Me&&=this.#J.eventManager.removeEvent(this.#Me))}#ze(t,e,s){if(!e)return!1;if(t.style.visibility="hidden",t.style.display="block",this.sibling&&"block"!==this.sibling.style.display&&(this.sibling.style.visibility="hidden",this.sibling.style.display="block"),this.#J.selection.isRange(e)){if(!this.#J.offset.setRangePosition(this.form,e,{position:"bottom"}))return this.hide(),!1}else{const i=this.#J.offset.setAbsPosition(t,e,{addOffset:this.#Se,position:this.position,isWWTarget:this.isWWTarget,inst:this,sibling:this.sibling});if(!i)return this.hide(),!1;if(s||!this.sibling||this.siblingMain)this.#Ee=!1;else{const e=t.offsetTop-this.#Se.top;"bottom"===i.position?(this.#Ee=!0,t.style.top=e+this.sibling.offsetHeight-1+"px"):(this.#Ee=!1,t.style.top=e-this.sibling.offsetHeight+2+"px")}}return t.style.zIndex=this.toTop?$i:this.#Ee?ki:Si,t.style.visibility="",t.showPopover?.(),!0}#Pe(){this.#qe(),this.#He=this.#J.eventManager.addGlobalEvent("keydown",this.#ke.keydown,!0),this.#Le=this.#J.eventManager.addGlobalEvent(wi?"click":"mousedown",this.#ke.mousedown,!0)}#qe(){this.#J.component.__removeGlobalEvent(),this.#He&&=this.#J.eventManager.removeGlobalEvent(this.#He),this.#Le&&=this.#J.eventManager.removeGlobalEvent(this.#Le)}#Ze(){if(this.#J.ui.selectMenuOn)return!0;const t=this.#J.ui.opendControllers;for(let e=0;e<t.length;e++)if(t[e].inst===this&&t[e].fixed)return!0;return!1}#Ge(t){if(Ve.check.isWysiwygFrame(t)||t.contains(this.form))return!1;if(Ve.utils.hasClass(t,"se-drag-handle"))return!0;let e=!1;this.isInsideForm&&this.parentsForm?.length>0&&this.parentsForm.some((s=>{if(s.contains(t))return e=!0,!0}));const s=this.host._element;return!e&&(!!Ve.query.getParentElement(t,".se-controller")||(this.#J.component.isInline(s)?t===s:t?.contains(s)))}#Ve(t){const e=Ve.query.getEventTarget(t),s=Ve.query.getCommandTarget(e);s&&(t.stopPropagation(),t.preventDefault(),"close"!==s.getAttribute("data-command")?this.host.controllerAction(s):this.close())}#Oe(t){if(this.#J.ui.currentControllerName=this.kind,this.parentsForm.length>0&&this.isInsideForm)return;Ve.query.getEventTarget(t).style.zIndex=this.toTop?xi:$i}#Re(t){if(this.parentsForm.length>0&&this.isInsideForm)return;Ve.query.getEventTarget(t).style.zIndex=this.toTop?$i:this.#Ee?ki:Si}#Be(t){if(this.#Ze())return;const e=t.code;if(Re.isCtrl(t)||!Re.isNonResponseKey(e))return;const s=Ve.query.getEventTarget(t);if(Re.isEsc(e)){if(this.#Ne.some((({isOpen:t})=>t)))return;if(this.#$e?.())return}else{if(this.form.contains(s)||this.#Ge(s))return;if(this.#J.pluginManager.fileInfo.pluginRegExp.test(this.kind))return}this.#je(s),this.close()}#Ie(t){const e=Ve.query.getEventTarget(t);this.host?._element?.contains(e)?this.#Te=!0:(this.#Te=!1,e===this.host._element||e===this.currentTarget||this.#Ze()||this.form.contains(e)||this.#Ge(e)||Ve.query.getParentElement(e,".se-line-breaker-component")||(this.#je(e),this.close(!0)))}#je(t){this.#J.frameContext.get("wysiwyg").contains(t)||(this.#J.component.__prevent=!1)}},{_w:Mi}=Ae;const Hi=class{#J;#Ke;#Ye;#Xe;#Je;#ke;#Qe=null;#ts=null;#es=null;#ss=null;#He=null;#is=null;#ns=null;#os=null;#st=null;#ls=null;#rs=null;#as=new Map;#hs=-1;#cs=-1;#ds=!1;#us=null;constructor(t,e){this.#J=t;const s=e.position.split("-");this.form=null,this.items=[],this.menus=null,this.menuLen=0,this.index=-1,this.item=null,this.isOpen=!1,this.checkList=!!e.checkList,this.position=s[0],this.subPosition=s[1],this.splitNum=e.splitNum||0,this.horizontal=!!this.splitNum,this.openMethod=e.openMethod,this.closeMethod=e.closeMethod,this.subEscMethod=e.subEscMethod||null,this.maxHeight=e.maxHeight||"",this.minWidth=e.minWidth||"",this.#es=e.keydownTarget||null,this.#Ke=/^(left|right)$/.test(this.position)?"left"===this.position?"right":"left":this.position,this.#Ye=/^(left|right)$/.test(this.subPosition)?"left"===this.subPosition?"right":"left":this.subPosition,this.#Xe="ltr"!==e.dir&&("rtl"===e.dir||null),this.#Je={mousedown:this.#ps.bind(this),mousemove:this.#gs.bind(this),click:this.#ms.bind(this),keydown:this.#fs.bind(this)},this.#ke={keydown:this.#vs.bind(this),mousedown:this.#Ie.bind(this),click:this.#bs.bind(this),submenuReposition:this.#ys.bind(this)}}create(t,e){this.form.firstElementChild.innerHTML="";for(const[,t]of this.#as)t.element?.remove();this.#as.clear(),e||=t;let s="";for(let i=0,n=e.length;i<n;i++){i>0&&i%this.splitNum==0&&(this.#Cs(s),s="");const n=t[i],o="string"==typeof e[i]?e[i]:e[i].outerHTML,l=n&&"object"==typeof n?n:{};if(l.children?.length>0){let t="";const e=l.childMenus||l.children;for(let s=0;s<e.length;s++)t+=`<li class="se-select-item" data-parent-index="${i}" data-child-index="${s}">${"string"==typeof e[s]?e[s]:e[s].outerHTML}</li>`;s+=`<li class="se-select-item se-has-submenu" data-index="${i}">${o}<span class="se-submenu-arrow">${this.#J.icons.menu_arrow_right}</span></li>`;const n=Ve.utils.createElement("DIV",{class:"se-select-submenu",popover:"manual","data-parent-index":String(i)},`<ul class="se-list-basic se-list-checked">${t}</ul>`);this.#as.set(i,{items:l.children,menus:e,element:n})}else s+=`<li class="se-select-item" data-index="${i}">${o}</li>`}this.#Cs(s);for(const[,t]of this.#as)this.form.appendChild(t.element);this.items=t,this.menus=Array.from(this.form.querySelectorAll("li[data-index]")),this.menuLen=this.menus.length}on(t,e,s={}){this.#Qe=t,this.#ts=this.#es||(Ve.check.isInputElement(t)?t:this.#J.frameContext.get("_ww")),this.#ss=e;let i="";this.maxHeight&&(i+="max-height:"+this.maxHeight+";overflow-y:auto;"),this.minWidth&&(i+="min-width:"+this.minWidth+";"),this.form=Ve.utils.createElement("DIV",{class:"se-select-menu"+(!0===this.#Xe?" se-rtl":"")+(s.class?" "+s.class:""),style:s.style||""},'<div class="se-list-inner"'+(i?' style="'+i+'"':"")+"></div>"),t.parentNode.insertBefore(this.form,t)}open(t,e){this.#J.ui.selectMenuOn=!0,this.openMethod?.(),this.#ws(),this.#Pe();const s=t?t.split("-"):[],i=s[0]||(null!==this.#Xe&&this.#Xe!==this.#J.options.get("_rtl")?this.#Ke:this.position),n=s[1]||(null!==this.#Xe&&this.#Xe!==this.#J.options.get("_rtl")?this.#Ye:this.subPosition);this.#ls=i,this.#rs=n,this.#_s(i,n,e),this.isOpen=!0}reposition(){this.isOpen&&this.#ls&&this.#_s(this.#ls,this.#rs)}setHidden(t){this.isOpen&&(t?(this.#xs(),this.form.style.display="none"):this.reposition())}close(){this.#J.ui.selectMenuOn=!1,Ve.utils.removeClass(this.#Qe,"on"),this.#$s(),this.form?.removeAttribute("style"),this.isOpen=!1,this.closeMethod?.()}getItem(t){return this.items[t]}setItem(t){this.#ks(t)}hasOpenSubmenu(){return this.#hs>-1}#Ss(t){if(this.#hs===t)return;this.#xs();const e=this.menus[t];if(!e||!Ve.utils.hasClass(e,"se-has-submenu"))return;Ve.utils.addClass(e,"se-submenu-open"),this.#hs=t,this.#cs=-1,this.#ds=!1;const s=this.#as.get(t),i=s?.element;if(i){const t="function"==typeof i.showPopover;i.style.visibility="hidden",t?i.matches(":popover-open")||i.showPopover():i.style.display="block",this.#Es(e,i,t),i.style.visibility="",this.#os=this.#J.eventManager.addGlobalEvent("scroll",this.#ke.submenuReposition,!0)}}#Es(t,e,s){const i=s?{top:0,left:0}:this.form.getBoundingClientRect(),n=t.getBoundingClientRect(),o=e.offsetWidth,l=e.offsetHeight,r=Mi.innerWidth,a=Mi.innerHeight,h=n.right,c=n.left-o,d=Math.max(0,h+o-r),u=Math.max(0,-c);let p;p=!0===this.#Xe?0===u?c:0===d?h:u<=d?c+u:h-d:0===d?h:0===u?c:d<=u?h-d:c+u,e.style.left=p-i.left+"px",e.style.right="";const g=n.top,m=n.bottom-l,f=Math.max(0,g+l-a),v=Math.max(0,-m);let b;b=0===f?g:0===v?m:f<=v?g-f:m+v,e.style.top=b-i.top+"px"}#ys(){if(this.#hs<0)return;const t=this.#as.get(this.#hs),e=t?.element,s=this.menus[this.#hs];e&&s&&this.#Es(s,e,"function"==typeof e.showPopover)}#xs(){if(this.#us&&(Mi.clearTimeout(this.#us),this.#us=null),this.#os&&=this.#J.eventManager.removeGlobalEvent(this.#os),this.#hs>-1){const t=this.menus[this.#hs];t&&Ve.utils.removeClass(t,"se-submenu-open");const e=this.#as.get(this.#hs);e?.element&&("function"==typeof e.element.hidePopover?e.element.matches(":popover-open")&&e.element.hidePopover():e.element.style.display="",Ve.utils.removeClass(e.element.querySelectorAll(".se-select-item"),"se-select-cursor"))}this.#hs=-1,this.#cs=-1,this.#ds=!1}#Ts(t,e){const s=this.#as.get(t);if(s){if(this.checkList){const t=s.element?.querySelectorAll(".se-select-item")[e];t&&Ve.utils.toggleClass(t,"se-checked")}this.#ss(s.items[e])}}#Ms(t){const e=this.#as.get(this.#hs);if(!e?.element)return;const s=e.element.querySelectorAll(".se-select-item"),i=s.length;if(!i)return;t=this.#cs+t;const n=this.#cs=t>=i?0:t<0?i-1:t;Ve.utils.removeClass(this.form,"se-select-menu-mouse-move");for(let t=0;t<i;t++)t===n?Ve.utils.addClass(s[t],"se-select-cursor"):Ve.utils.removeClass(s[t],"se-select-cursor")}#Cs(t){this.form.firstElementChild.innerHTML+=`<ul class="se-list-basic se-list-checked${this.horizontal?" se-list-horizontal":""}">${t}</ul>`}#$s(){this.#Hs(),this.#qe(),this.#xs(),this.index=-1,this.item=null,this._onItem&&(Ve.utils.removeClass(this._onItem,"se-select-on"),this._onItem=null)}#Ls(t){t=this.index+t;const e=this.menuLen,s=this.index=t>=e?0:t<0?e-1:t;this.#ks(s)}#ks(t){Ve.utils.removeClass(this.form,"se-select-menu-mouse-move");const e=this.menuLen;for(let s=0;s<e;s++)s===t?Ve.utils.addClass(this.menus[s],"se-select-cursor"):Ve.utils.removeClass(this.menus[s],"se-select-cursor");this.index=t,this.item=this.items[t]}#_s(t,e,s,i){const n=t,o=this.form,l=this.#Qe;o.style.visibility="hidden",o.style.display="block",Ve.utils.removeClass(o,"se-select-menu-scroll"),Ve.utils.addClass(l,"on");const r=o.offsetWidth,a=l.offsetWidth,h=l.offsetLeft;let c=!1,d=0,u=0;"left"===t?(d=h-r-1,t=e,c=!0):"right"===t&&(d=h+a+1,t=e,c=!0);const p=this.#J.offset.get(l),g=l.offsetTop,m=p.top,f=l.offsetHeight,v=Ve.utils.getClientSize().h-(m-Mi.scrollY+f),b=c?f:0;let y=1e4;switch(t){case"middle":{let t=o.offsetHeight;const e=f/2;u=g-t/2+e,m<t/2&&(u+=t/2-m-e+4,o.style.top=u+"px");let s=this.#J.offset.getGlobal(o).top;const i=t-(m-s)-v-f;i>0&&(u-=i+4,o.style.top=u+"px"),s=this.#J.offset.getGlobal(o).top,s<0&&(t+=s-4,u-=s-4),o.style.height=t+"px";break}case"top":if(m<o.offsetHeight-b){if(!i){y=0;break}y=m-4+b,y>=38&&(o.style.height=y+"px")}u=g-o.offsetHeight+b;break;case"bottom":if(v<o.offsetHeight+b){if(!i){y=0;break}y=v-4+b,y>=38&&(o.style.height=y+"px")}u=g+(c?0:f)}if(y<38&&!i&&"middle"!==t)return void this.#_s("top"===t?"bottom":"top",e,s,!0);if(!c)switch(e){case"center":d=h+a/2-r/2;break;case"left":d=h;break;case"right":d=h-(r-a)}o.style.left=d+"px";let C=this.#J.offset.getGlobal(o).fixedLeft,w=0;switch(c+"-"+(c?n:e)){case"true-left":C<0&&(d=h+a+1);break;case"true-right":C+r>Mi.innerWidth&&(d=h-r-1);break;case"false-center":w=Mi.innerWidth-(C+r),w<0&&(d+=w-4),o.style.left=d+"px",C=this.#J.offset.getGlobal(o).fixedLeft,C<0&&(d-=C-4);break;case"false-left":w=Mi.innerWidth-(C+r),w<0&&(d+=w-4);break;case"false-right":C<0&&(d-=C-4)}if(s){const t=o.firstElementChild.querySelector(s);t&&(this._onItem=t,Ve.utils.addClass(t,"se-select-on"))}o.style.left=d+"px",o.style.top=u+"px",o.style.visibility=""}#Ns(t){this.checkList&&Ve.utils.toggleClass(this.menus[t],"se-checked"),this.#ss(this.getItem(t))}#ws(){this.#Hs(),this.#st={mousedown:this.#J.eventManager.addEvent(this.form,"mousedown",this.#Je.mousedown),mousemove:this.#J.eventManager.addEvent(this.form,"mousemove",this.#Je.mousemove),click:this.#J.eventManager.addEvent(this.form,"click",this.#Je.click),keydown:this.#J.eventManager.addEvent(this.#ts,"keydown",this.#Je.keydown)}}#Hs(){this.#st&&(this.#J.eventManager.removeEvent(this.#st.mousedown),this.#J.eventManager.removeEvent(this.#st.mousemove),this.#J.eventManager.removeEvent(this.#st.click),this.#J.eventManager.removeEvent(this.#st.keydown),this.#st=null)}#Pe(){this.#qe(),this.#He=this.#J.eventManager.addGlobalEvent("keydown",this.#ke.keydown,!0),this.#is=this.#J.eventManager.addGlobalEvent("mousedown",this.#ke.mousedown,!0)}#qe(){this.#He&&=this.#J.eventManager.removeGlobalEvent(this.#He),this.#is&&=this.#J.eventManager.removeGlobalEvent(this.#is),this.#ns&&=this.#J.eventManager.removeGlobalEvent(this.#ns)}#fs(t){if(this.#ds)switch(t.code){case"ArrowUp":return t.preventDefault(),t.stopPropagation(),void this.#Ms(-1);case"ArrowDown":return t.preventDefault(),t.stopPropagation(),void this.#Ms(1);case"ArrowLeft":t.preventDefault(),t.stopPropagation(),this.#ds=!1,this.#cs=-1;{const t=this.#as.get(this.#hs);t?.element&&Ve.utils.removeClass(t.element.querySelectorAll(".se-select-item"),"se-select-cursor")}return;case"Enter":case"Space":return void(this.#cs>-1&&(t.preventDefault(),t.stopPropagation(),this.#Ts(this.#hs,this.#cs)))}let e;switch(t.code){case"ArrowUp":if(t.preventDefault(),t.stopPropagation(),this.horizontal&&this.index>-1){const t=this.splitNum;e=this.index-t<0?t:-t}else e=-1;break;case"ArrowDown":if(t.preventDefault(),t.stopPropagation(),this.horizontal&&this.index>-1){const t=this.splitNum;e=this.index+t>this.menuLen?-t:t}else e=1;break;case"ArrowLeft":t.preventDefault(),t.stopPropagation(),e=-1;break;case"ArrowRight":if(t.preventDefault(),t.stopPropagation(),this.index>-1&&this.#as.has(this.index))return this.#Ss(this.index),this.#ds=!0,void this.#Ms(1);e=1;break;case"Enter":case"Space":this.index>-1&&(t.preventDefault(),t.stopPropagation(),this.#as.has(this.index)?(this.#Ss(this.index),this.#ds=!0,this.#Ms(1)):this.#Ns(this.index))}e&&(this.#xs(),this.#Ls(e))}#ps(t){if(Ae.isGecko){const e=Ve.query.getEventTarget(t),s=Ve.query.getParentElement(e,".se-select-item");s&&this.#J.eventManager._injectActiveEvent(s)}}#gs(t){const e=Ve.query.getEventTarget(t);Ve.utils.addClass(this.form,"se-select-menu-mouse-move");const s=e.closest?.("[data-child-index]"),i=s?.getAttribute("data-child-index");if(null!=i){this.#cs=Number(i);const t=this.#as.get(this.#hs);if(t?.element){const e=t.element.querySelectorAll(".se-select-item");Ve.utils.removeClass(e,"se-select-cursor"),Ve.utils.addClass(e[this.#cs],"se-select-cursor")}return}const n=e.closest?.("[data-index]"),o=n?.getAttribute("data-index");if(!o)return;const l=Number(o);if(this.index=l,this.#as.has(l))this.#us&&Mi.clearTimeout(this.#us),this.#Ss(l);else if(this.#hs>-1){const t=this.#as.get(this.#hs);t?.element?.contains(e)||this.#xs()}}#ms(t){let e=Ve.query.getEventTarget(t),s=null,i=null;for(;!(s||i||/UL/i.test(e.tagName)||Ve.utils.hasClass(e,"se-select-menu"));)i=e.getAttribute("data-child-index"),i||(s=e.getAttribute("data-index")),e=e.parentElement;if(null!==i){let t=e,s=null;for(;!s&&t;)s=t.getAttribute("data-parent-index")||t.getAttribute("data-index"),t=t.parentElement;return void(null!==s&&this.#Ts(Number(s),Number(i)))}if(!s)return;const n=Number(s);this.#as.has(n)?this.#hs===n?this.#xs():this.#Ss(n):this.#Ns(n)}#vs(t){if(Re.isEsc(t.code)){if(this.#hs>-1){t.preventDefault(),t.stopPropagation();const e=this.#hs;return this.#xs(),void this.#ks(e)}if(this.subEscMethod?.())return t.preventDefault(),void t.stopPropagation();this.close()}}#Ie(t){const e=Ve.query.getEventTarget(t);this.form.contains(e)||(this.#Qe.contains(e)?Ve.check.isInputElement(e)||(this.#ns=this.#J.eventManager.addGlobalEvent("click",this.#ke.click,!0)):this.close())}#bs(t){this.#ns=this.#J.eventManager.removeGlobalEvent(this.#ns),t.target===this.#Qe&&(t.stopPropagation(),this.close())}},{_w:Li,ON_OVER_COMPONENT:Ni}=Ae,Ai={tl:"nwse-resize",tr:"nesw-resize",bl:"nesw-resize",br:"nwse-resize",lw:"ew-resize",th:"ns-resize",rw:"ew-resize",bh:"ns-resize"};let Bi=!1,Ii=!1,Vi=0,Oi=0;class Ri{#J;#As;#Bs;#Is="";#Vs="";#Os=0;#Rs=0;#Ps=0;#zs=0;#Ds="__se__float-none|__se__float-left|__se__float-center|__se__float-right";#Fs=!1;#qs={w:"",h:""};#Ws=null;constructor(t,e,s,i){this.#J=e,this.kind=t.constructor.key||t.constructor.name,this._alignIcons={none:this.#J.icons.format_float_none,left:this.#J.icons.format_float_left,right:this.#J.icons.format_float_right,center:this.#J.icons.format_float_center},this._action={};const n=function(t,e,s){let i=null;if(s?.length>0){const{lang:n,icons:o}=e;i='<div class="se-arrow se-arrow-up"></div>';for(let e,l=0;l<s.length;l++){e=s[l],i+='<div class="se-btn-group">';for(let s,l=0,r=e.length;l<r;l++){if(s=e[l],"function"==typeof s?.action){const e=s;s={c:`__c__${e.command}`,v:e.value||"",l:e.title,i:e.icon},t._action[s.c]=e.action}else if(s=Di(s),!s)continue;i+=`\n\t\t\t\t\t<button type="button" data-command="${s.c}" data-value="${s.v}" class="se-btn se-tooltip">\n\t\t\t\t\t\t${o[s.i]||s.i}\n\t\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${n[s.l]||s.l}</span></span>\n\t\t\t\t\t</button>`}i+="</div>"}}return i?Ve.utils.createElement("DIV",{class:"se-controller se-controller-resizing"},i):null}(this,e,s||[]);if(this.controller=n?new Ti(this,e,n,{position:"bottom",disabled:!0},this.kind):null,n){this.alignButton=n.querySelector('[data-command="onalign"]');const t=function(t,e,s){if(!s)return null;const i=[t._alignIcons.none,t._alignIcons.left,t._alignIcons.center,t._alignIcons.right],n=[e.lang.basic,e.lang.left,e.lang.center,e.lang.right],o=["none","left","center","right"],l=[],r=[];for(let t=0;t<o.length;t++)l.push(`\n\t\t<button type="button" class="se-btn-list se-tooltip" data-command="${o[t]}" data-type="selectMenu" >\n\t\t\t${i[t]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${n[t]}</span>\n\t\t\t</span>\n\t\t</button>`),r.push(o[t]);return{html:l,items:r}}(this,e,this.alignButton);t&&(this.selectMenu_align=new Hi(e,{checkList:!1,position:"bottom-center"}),this.selectMenu_align.on(this.alignButton,this.#Us.bind(this),{class:"se-figure-select-list"}),this.selectMenu_align.create(t.items,t.html)),this.asButton=n.querySelector('[data-command="onas"]');const s=function(t,e){if(!e)return null;const s=[t.icons.as_block,t.icons.as_inline],i=[t.lang.asBlock,t.lang.asInline],n=["block","inline"],o=[],l=[];for(let t=0;t<n.length;t++)o.push(`\n\t\t<button type="button" class="se-btn-list se-tooltip" data-command="${n[t]}" data-type="selectMenu" >\n\t\t\t${s[t]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${i[t]}</span>\n\t\t\t</span>\n\t\t</button>`),l.push(n[t]);return{html:o,items:l}}(e,this.asButton);s&&(this.selectMenu_as=new Hi(e,{checkList:!1,position:"bottom-center"}),this.selectMenu_as.on(this.asButton,this.#Zs.bind(this),{class:"se-figure-select-list"}),this.selectMenu_as.create(s.items,s.html)),this.resizeButton=n.querySelector('[data-command="onresize"]');const i=function(t,e){if(!e)return null;const s=e.getAttribute("data-value").split(","),i=[];for(let e,n,o,l,r=0;r<s.length;r++)o=s[r],e=Oe.is(o),n=e?"resize_percent"+o:"auto",l=e?o+"%":t.lang.autoSize,i.push('<button type="button" class="se-btn-list" data-command="'+n+'" data-value="'+o+'"><span>'+l+"</span></button>");return{html:i,items:s}}(e,this.resizeButton);i&&(this.selectMenu_resize=new Hi(e,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.selectMenu_resize.on(this.resizeButton,this.#Gs.bind(this)),this.selectMenu_resize.create(i.items,i.html))}this.inst=t,this.sizeUnit=i.sizeUnit||"px",this.autoRatio=i.autoRatio,this.isVertical=!1,this.percentageButtons=n?.querySelectorAll('[data-command="resize_percent"]')||[],this.captionButton=n?.querySelector('[data-command="caption"]'),this.align="none",this.as="block",this.__offset={},this._element=null,this._cover=null,this._inlineCover=null,this._container=null,this._caption=null,this._resizeClientX=0,this._resizeClientY=0,this._resize_direction="",this.__containerResizingOff=this.#js.bind(this),this.__containerResizing=this.#Ks.bind(this),this.__onContainerEvent=null,this.__offContainerEvent=null,this.#As=this.#Ys.bind(this),this.#Bs=this.#Xs.bind(this),this.#J.eventManager.addEvent(this.alignButton,"click",this.#Js.bind(this)),this.#J.eventManager.addEvent(this.asButton,"click",this.#Qs.bind(this)),this.#J.eventManager.addEvent(this.resizeButton,"click",this.#ti.bind(this)),this.#J.contextProvider.applyToRoots((t=>{if(!t.get("wrapper").querySelector(".se-controller.se-resizing-container")){const e=function(){const t='\n\t\t<div class="se-resize-dot">\n\t\t\t<span class="tl"></span>\n\t\t\t<span class="tr"></span>\n\t\t\t<span class="bl"></span>\n\t\t\t<span class="br"></span>\n\t\t\t<span class="lw"></span>\n\t\t\t<span class="th"></span>\n\t\t\t<span class="rw"></span>\n\t\t\t<span class="bh"></span>\n\t\t\t<div class="se-resize-display"></div>\n\t\t</div>';return Ve.utils.createElement("DIV",{class:"se-controller se-resizing-container",style:"display: none;"},t)}(),s=e.querySelectorAll(".se-resize-dot > span");t.set("_figure",{main:e,border:e.querySelector(".se-resize-dot"),display:e.querySelector(".se-resize-display"),handles:s}),t.get("wrapper").appendChild(e),this.#J.eventManager.addEvent(s,"mousedown",this.#ei.bind(this))}}))}static CreateContainer(t,e){return Ve.utils.createElement("DIV",{class:"se-component"+(e?" "+e:"")},Ve.utils.createElement("FIGURE",null,t)),Ri.GetContainer(t)}static CreateInlineContainer(t,e){return Ve.utils.createElement("SPAN",{class:"se-component se-inline-component"+(e?" "+e:"")},t),Ri.GetContainer(t)}static CreateCaption(t,e){const s=Ve.utils.createElement("FIGCAPTION",null,"<div>"+e+"</div>");return t.appendChild(s),s}static GetContainer(t){const e=Ve.query.getParentElement(t,"FIGURE",2),s=Ve.query.getParentElement(t,"SPAN",2),i=e||s;let n=Ve.query.getParentElement(t,(t=>t.parentElement===i),0)||t;if(Ve.check.isAnchor(n)){const t=n.querySelector(":scope > img");t&&(n=t)}return{target:n,container:Ve.query.getParentElement(n,Ri.is,3)||e,cover:e,inlineCover:Ve.utils.hasClass(s,"se-inline-component")?s:null,caption:Ve.query.getEdgeChild(n.parentElement,"FIGCAPTION",!1),isVertical:zi(n)}}static GetRatio(t,e,s){let i=0,n=0;if(/\d+/.test(t+"")&&/\d+/.test(e+"")){if((!Oe.is(t)&&String(t).replace(/\d+|\./g,"")||s||"px")===(!Oe.is(e)&&String(e).replace(/\d+|\./g,"")||s||"px")){const s=Oe.get(t,4),o=Oe.get(e,4);i=s/o,n=o/s}}return{w:Oe.get(i,4),h:Oe.get(n,4)}}static CalcRatio(t,e,s,i){if(i?.w&&i?.h&&/\d+/.test(t+"")&&/\d+/.test(e+"")){const n=!Oe.is(t)&&String(t).replace(/\d+|\./g,"")||s||"px",o=!Oe.is(e)&&String(e).replace(/\d+|\./g,"")||s||"px";if(n===o){const s="%"===n?2:0,l=t,r=e;e=Oe.get(i.h*Oe.get(l,s),s)+o,t=Oe.get(i.w*Oe.get(r,s),s)+n}}return{w:t,h:e}}static is(t){return Ve.check.isComponentContainer(t)||/^(HR)$/.test(t?.nodeName)}close(){this.#J.store.set("_preventBlur",!1),Ve.utils.removeClass(this._cover,"se-figure-selected"),this.#J.component.__removeDragEvent(),this.#si(),this.controller?.close()}open(t,{nonResizing:e,nonSizeInfo:s,nonBorder:i,figureTarget:n,infoOnly:o}){if(!t)return void console.warn('[SUNEDITOR.modules.Figure.open] The "targetNode" is null.');bi.get("__overInfo")===Ni&&(i=!0);const l=Ri.GetContainer(t),r=l.target;let a=!1;if(!l.container){if(this.#J.options.get("strictMode").formatFilter)return{container:null,cover:null,width:r.style.width||r.width||"",height:r.style.height||r.height||"",isVertical:this.isVertical};l.container=r,l.cover=r,a=!0}bi.set("__figureInst",this),this.#ii(l);const h=n&&(this._cover||this._container)||r,c=h.offsetWidth||null,d=h.offsetHeight||null,{top:u,left:p,scrollX:g,scrollY:m}=this.#J.offset.getLocal(h),f=(r.getAttribute("data-se-size")||"").split(",");let v=Oe.get(r.style.width,2)||c,b=Oe.get(r.style.height,2)||d;this.isVertical&&([v,b]=[b,v]);const y=Ri.GetRatio(v,b,this.sizeUnit),C={container:l.container,cover:l.cover,caption:l.caption,align:this.align,ratio:y,isVertical:this.isVertical,w:c||"",h:d||"",t:u,l:p,width:f[0]||"auto",height:f[1]||"auto",originWidth:r.naturalWidth||r.offsetWidth,originHeight:r.naturalHeight||r.offsetHeight};if(this.#Is=C.width,this.#Vs=C.height,o)return C;const w=this.#J.frameContext.get("_figure");this.#J.ui.setFigureContainer(w.main),this.#J.ui.opendControllers=this.#J.ui.opendControllers.filter((t=>t.form!==w.main)),w.main.style.top=u+"px",w.main.style.left=p+"px",w.main.style.width=(this.isVertical?d:c)+"px",w.main.style.height=(this.isVertical?c:d)+"px",w.border.style.top="0px",w.border.style.left="0px",w.border.style.width=(this.isVertical?d:c)+"px",w.border.style.height=(this.isVertical?c:d)+"px",this.__offset={left:p+g,top:u+m},this.#J.ui.opendControllers.push({position:"none",form:w.main,target:h,inst:this,notInCarrier:!0});const _=/%$/.test(r.style.width)&&/%$/.test(l.container.style.width)?Oe.get(l.container.style.width,0)/100+"":"";for(let t=0,e=this.percentageButtons.length;t<e;t++)this.percentageButtons[t].getAttribute("data-value")===_?Ve.utils.addClass(this.percentageButtons[t],"active"):Ve.utils.removeClass(this.percentageButtons[t],"active");if(this.captionButton&&(l.caption?Ve.utils.addClass(this.captionButton,"active"):Ve.utils.removeClass(this.captionButton,"active")),w.display.style.display=s||this._inlineCover?"none":"",w.border.style.display=i?"none":"",w.main.style.display="block",bi.get("__overInfo")!==Ni){const t=e?"none":"flex",s=w.handles;for(let e=0,i=s.length;e<i;e++)s[e].style.display=t;if(this.controller){const t=this.getSize(r);Ve.utils.changeTxt(w.display,this.#J.lang["none"===this.align?"basic":this.align]+" ("+t.dw+", "+t.dh+")"),this.#ni(),this.#oi(),this.#J.ui._visibleControllers(!0,!0);const e=this.controller.form.querySelectorAll('[data-command="rotate"][data-value="90"], [data-command="rotate"][data-value="-90"], [data-command="caption"], [data-command="onalign"], [data-command="onresize"]'),s=this._inlineCover||a?"none":"";e?.forEach((t=>{t.style.display=s}));const i=this.controller.form.querySelector('[data-command="onas"]');i&&(i.style.display=a?"none":"")}Ve.utils.removeClass(this._cover,"se-figure-over-selected"),this.controller?.open(w.main,null,{initMethod:this.#As,isWWTarget:!1,addOffset:null}),Li.setTimeout((()=>bi.set("__overInfo",!1)),0)}else Ve.utils.addClass(this._cover,"se-figure-over-selected");return Ve.utils.addClass(this._cover,"se-figure-selected"),this.#Ps=this.#Os=c,this.#zs=this.#Rs=d,this._inlineCover||bi.get("__overInfo")===Ni&&!Ve.utils.hasClass(l.container,"se-input-component")||this.#li(w.main),C}controllerHide(){this.controller?.hide()}controllerShow(){this.controller?.show()}controllerOpen(t,e){this._element=t,this.controller?.open(t,null,e)}setFigureSize(t,e){/%$/.test(t+"")?this._setPercentSize(t,e):t&&"auto"!==t||e&&"auto"!==e?this._applySize(t,e,""):this.autoRatio?this._setPercentSize(100,this.autoRatio.default||this.autoRatio.current):this._setAutoSize()}setSize(t,e){const s=this.isVertical;s&&([t,e]=[e,t]),this.setFigureSize(t,e),s&&this.setTransform(this._element,t,e,0)}getSize(t){t||=this._element;const e=zi(t);let s="",i="",n="",o="";if(!t)return{w:s,h:i,dw:n,dh:o};const l=Ri.GetContainer(t),r=l.target;return l.container?(s=/%$/.test(r.style.width)?(l.container&&Oe.get(l.container.style.width,2)||100)+"%":r.style.width,i=l.inlineCover?l.inlineCover.style.height||t.style.height||String(t.height||""):Oe.get(l.cover?.style.paddingBottom,0)>0&&!e?l.cover?.style.height:/%$/.test(r.style.height)&&/%$/.test(r.style.width)?(l.container&&Oe.get(l.container.style.height,2)||100)+"%":r.style.height,s||="auto",i||="auto"):this.#J.options.get("strictMode").formatFilter?(s="",i=r.style.height):(s=r.style.width||"auto",i=r.style.height||"auto"),n=e?i:s,o=e?s:i,{w:s,h:i,dw:n,dh:o}}setAlign(t,e){t||=this._element,this.align=e||="none";const s=Ri.GetContainer(t);if(!s.cover)return;const i=s.target,n=s.container,o=s.cover;if(/%$/.test(i.style.width)&&"center"===e&&!this.#J.component.isInline(n)?(n.style.minWidth="100%",o.style.width=n.style.width):(n.style.minWidth="",o.style.width=this.isVertical?i.style.height||i.offsetHeight+"px":i.style.width&&"auto"!==i.style.width?i.style.width||"100%":""),Ve.utils.hasClass(n,"__se__float-"+e)||(Ve.utils.removeClass(n,this.#Ds),Ve.utils.addClass(n,"__se__float-"+e)),this.autoRatio){const{w:t,h:e}=this.getSize(this._element);this.__setCoverPaddingBottom(t,e)}this.#ni()}convertAsFormat(t,e){t||=this._element,this.as=e||"block";const{container:s,inlineCover:i,target:n}=Ri.GetContainer(t),{w:o,h:l}=this.getSize(n),r=Ve.check.isAnchor(n.parentNode)?n.parentNode:null,a=n.cloneNode(!1);a.style.width="",a.style.height="",a.removeAttribute("width"),a.removeAttribute("height");let h=a;if(r){const t=r.cloneNode(!1);t.appendChild(a),h=t}switch(e){case"inline":{if(i)break;this.#J.component.deselect();const t=s.nextElementSibling,e=s.parentElement,n=Ri.CreateInlineContainer(h);Ve.utils.addClass(n.container,s.className.split(" ").filter((t=>"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this.#ri(n,o,l);const r=Ve.utils.createElement(this.#J.options.get("defaultLine"),null,n.container);e.insertBefore(r,t),Ve.utils.removeItem(s);break}case"block":{if(!i)break;this.#J.component.deselect(),this.#J.selection.setRange(s,0,s,1);const t=this.#J.html.remove(),e=this.#J.nodeTransform.split(t.container,t.offset,0);e?.previousElementSibling&&Ve.check.isZeroWidth(e.previousElementSibling)&&Ve.utils.removeItem(e.previousElementSibling);const n=Ri.CreateContainer(h);Ve.utils.addClass(n.container,s.className.split(" ").filter((t=>"se-inline-component"!==t&&"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this.#ri(n,o,l),(e||t.container).parentElement.insertBefore(n.container,e);break}}return a}controllerAction(t){const e=t.getAttribute("data-command"),s=t.getAttribute("data-value"),i=t.getAttribute("data-type"),n=this._element;if(!/^on.+/.test(e)&&"selectMenu"!==i){switch(e){case"mirror":{const t=Pi(n);let e=t.x,i=t.y;"h"===s&&!this.isVertical||"v"===s&&this.isVertical?i=i?"":"180":e=e?"":"180",this._setRotate(n,t.r,e,i);break}case"rotate":this.setTransform(n,null,null,Number(s));break;case"caption":if(this._caption)Ve.utils.removeItem(this._caption),Li.setTimeout(this.#J.component.select.bind(this.#J.component,n,this.kind),0),this._caption=null;else{const t=Ri.CreateCaption(this._cover,this.#J.lang.caption),e=Ve.query.getEdgeChild(t,(t=>3===t.nodeType),!1);e?this.#J.selection.setRange(e,0,e,e.textContent.length):t.focus(),this._caption=t,this.controller.close()}(/\d+/.test(n.style.height)||this.isVertical&&this._caption)&&(/%$/.test(n.style.width)||/auto/.test(n.style.height)?this.deleteTransform():this.setTransform(n,n.style.width,n.style.height,0));break;case"revert":this._setRevert();break;case"edit":this.inst.componentEdit(n);break;case"copy":this.#J.component.copy(this._container);break;case"remove":this.inst.componentDestroy(n),this.controller.close()}/^__c__/.test(e)?this._action[e](n,s,t):"edit"!==e&&(this.#J.history.push(!1),/^remove|caption$/.test(e)||this.#J.component.select(n,this.kind))}}retainFigureFormat(t,e,s,i){const n=this.#J.component.isInline(t),o=e.parentNode;let l=this.#J.format.isBlock(o)||Ve.check.isWysiwygFrame(o)||o.nodeType>=9?e:Ri.GetContainer(e)?.container||o||e;if(Ve.query.getParentElement(e,Ve.check.isExcludeFormat))l=s&&s!==e?s:e,l.parentNode.replaceChild(t,l);else if(n&&this.#J.format.isLine(l)){const s=n&&/^SPAN$/i.test(e.parentElement.nodeName)?e.parentElement:e;s.parentElement.replaceChild(t,s)}else if(Ve.check.isListCell(l)){const s=Ve.query.getParentElement(e,(t=>t.parentNode===l));l.insertBefore(t,s),Ve.utils.removeItem(e),this.#J.nodeTransform.removeEmptyNode(s,null,!0)}else if(this.#J.format.isLine(l)){const s=Ve.query.getParentElement(e,(t=>t.parentNode===l));l=this.#J.nodeTransform.split(l,s),l.parentNode.insertBefore(t,l),Ve.utils.removeItem(e),this.#J.nodeTransform.removeEmptyNode(l,null,!0)}else if(this.#J.format.isLine(l.parentNode)){const e=l.parentNode;e.parentNode.insertBefore(t,l.previousSibling?e.nextElementSibling:e),(0===i?.__updateTags.map((t=>l.contains(t))).length||Ve.check.isZeroWidth(l))&&Ve.utils.removeItem(l)}else l=Ve.check.isFigure(l.parentNode)?Ve.query.getParentElement(l.parentNode,Ri.is):l,l.parentNode.replaceChild(t,l)}deleteTransform(t){t||=this._element;const e=t,s=(e.getAttribute("data-se-size")||"").split(",");this.isVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",this.#ai(e),this._applySize(s[0]||"auto",s[1]||"","")}setTransform(t,e,s,i){try{this.#Fs=!0;const n=Pi(t),o=n.r+1*(i||0);i=Math.abs(o)>=360?0:o;const l=this.isVertical=zi(i);e=Oe.get(e,0),s=Oe.get(s,0);const r=t,a=(r.getAttribute("data-se-size")||"auto,auto").split(",");l&&this._setRotate(r,i,n.x,n.y);let h="";if(/auto|%$/.test(a[0])&&!l)"auto"===a[0]&&"auto"===a[1]?this._setAutoSize():this._setPercentSize(a[0],a[1]);else{const t=Ri.GetContainer(r),n=t.cover||t.inlineCover,o=e||r.offsetWidth,a=s||r.offsetHeight,c=(l?a:o)+"px",d=(l?o:a)+"px";if(this.#hi(),this._applySize(o+"px",a+"px",""),n&&(n.style.width=c,n.style.height=t.caption||t.inlineCover?"":d),l){h=90===i||-270===i?a/2+"px "+a/2+"px 0":o/2+"px "+o/2+"px 0"}}r.style.transformOrigin=h,l||this._setRotate(r,i,n.x,n.y),r.style.maxWidth=l?"none":"",this.#ci(r)}finally{this.#Fs=!1}}_displayResizeHandles(t){const e=t?"flex":"none";this.controller&&(this.controller.form.style.display=e);const s=this.#J.frameContext.get("_figure"),i=s.handles;for(let t=0,s=i.length;t<s;t++)i[t].style.display=e;"none"===e?(Ve.utils.addClass(s.main,"se-resize-ing"),this.#Ws=this.#J.eventManager.addGlobalEvent("keydown",this.#Bs)):Ve.utils.removeClass(s.main,"se-resize-ing")}#ri(t,e,s){const i=this.kind;t.target.onload=()=>this.#J.component.select(t.target,i),this.#ii(t),t.inlineCover&&(this.setAlign(t.target,"none"),this.deleteTransform()),this.setFigureSize(e,s)}#ii(t){this._inlineCover=t.inlineCover,this._cover=t.cover||this._inlineCover,this._container=t.container,this._caption=t.caption,this._element=t.target,this.align=(this._container.className.match(/(?:^|\s)__se__float-(none|left|center|right)(?:$|\s)/)||[])[1]||t.target.style.float||"none",this.as=this._inlineCover?"inline":"block",this.isVertical=zi(t.target)}_setRotate(t,e,s,i){let n=(t.offsetWidth-t.offsetHeight)*(/^-/.test(e+"")?1:-1),o="";if(/[1-9]/.test(e+"")&&(s||i))switch(o=s?"Y":"X",e+""){case"90":o=s&&i?"X":i?o:"";break;case"270":n*=-1,o=s&&i?"Y":s?o:"";break;case"-90":o=s&&i?"Y":s?o:"";break;case"-270":n*=-1,o=s&&i?"X":i?o:"";break;default:o=""}e%180==0&&(t.style.maxWidth=""),t.style.transform="rotate("+e+"deg)"+(s?" rotateX("+s+"deg)":"")+(i?" rotateY("+i+"deg)":"")+(o?" translate"+o+"("+n+"px)":"")}_applySize(t,e,s){const i=/^(rw|lw)$/.test(s)&&/\d+/.test(this._element.style.height),n=/^(th|bh)$/.test(s)&&/\d+/.test(this._element.style.width);e=e||(this.autoRatio?this.autoRatio.current||this.autoRatio.default:e),t=Oe.is(t)?t+this.sizeUnit:t,/%$/.test(t)||/%$/.test(e)||i||n||this.#hi();const o=this._cover||this._element;this.autoRatio&&this._cover&&(this._cover.style.width=t),n||(o.style.width=this._element.style.width=t),i||(e=Oe.is(e)?e+this.sizeUnit:e,o.style.height=this._element.style.height=this.autoRatio&&!this.isVertical?"100%":e,this.autoRatio&&this._cover&&(this._cover.style.height=e,this.__setCoverPaddingBottom(t,e))),"center"===this.align&&this.setAlign(this._element,this.align),this.#di()}__setCoverPaddingBottom(t,e){this._inlineCover!==this._cover&&(this.isVertical&&([t,e]=[e,t]),this._cover.style.height=e,/%$/.test(t)&&"center"===this.align?this._cover.style.paddingBottom=/%$/.test(e)?Oe.get(Oe.get(e,2)/100*Oe.get(t,2),2)+"%":e:this._cover.style.paddingBottom=e)}_setAutoSize(){this._caption&&(this._caption.style.marginTop=""),this.deleteTransform(),this.#hi(),this.autoRatio?this._setPercentSize("100%",this.autoRatio.current||this.autoRatio.default):(this._element.style.maxWidth="",this._element.style.width="",this._element.style.height="",this._cover&&(this._cover.style.width="",this._cover.style.height="")),this.setAlign(this._element,this.align),this.#di()}_setPercentSize(t,e){e||=this.autoRatio?/%$/.test(this.autoRatio.current)?this.autoRatio.current:this.autoRatio.default:e,e=!e||/%$/.test(e+"")||Oe.get(e,0)?Oe.is(e)?e+this.sizeUnit:e||(this.autoRatio?this.autoRatio.default:""):Oe.is(e)?e+"%":e;const s=/%$/.test(e+"");this._container.style.width=String(Oe.is(t)?t+"%":t),this._container.style.height="",this._element!==this._cover||this.#J.options.get("strictMode").formatFilter?(this._inlineCover!==this._cover&&this._cover&&(this._cover.style.width="100%",this._cover.style.height=String(e)),this._element.style.width="100%",this._element.style.maxWidth="",this._element.style.height=String(this.autoRatio?"100%":s?"":e),"center"===this.align&&this.setAlign(this._element,this.align),this.autoRatio&&this.__setCoverPaddingBottom(String(t),String(e)),this.#ci(this._element),this.#di()):this.#di()}#hi(){this._cover&&(this._cover.style.width="",this._cover.style.height=""),this._container.style.width="",this._container.style.height="",Ve.utils.removeClass(this._container,this.#Ds),Ve.utils.addClass(this._container,"__se__float-"+this.align),"center"===this.align&&this.setAlign(this._element,this.align)}_setRevert(){this.setFigureSize(this.#qs.w,this.#qs.h)}#ni(){this.alignButton&&Ve.utils.changeElement(this.alignButton.firstElementChild,this._alignIcons[this.align])}#oi(){this.asButton&&Ve.utils.changeElement(this.asButton.firstElementChild,this.#J.icons[`as_${this.as}`])}#di(){if(this.#Fs)return;const t=(this._element.getAttribute("data-se-size")||",").split(",");this.#qs.w=t[0],this.#qs.h=t[1];const e=this.getSize(this._element);this._element.setAttribute("width",e.w.replace("px","")),this._element.setAttribute("height",e.h.replace("px","")),this._element.setAttribute("data-se-size",e.w+","+e.h),this.autoRatio&&(this.autoRatio.current=/%$/.test(e.h)?e.h:"")}#ci(t){const e=Ve.query.getEdgeChild(Ve.query.getParentElement(t,"FIGURE"),"FIGCAPTION",!1);e&&(e.style.marginTop=(this.isVertical&&!this.autoRatio?t.offsetWidth-t.offsetHeight:0)+"px",this.isVertical&&this.autoRatio?t.style.marginTop=e.offsetHeight+"px":t.style.marginTop="")}#ai(t){const e=Ve.query.getEdgeChild(Ve.query.getParentElement(t,"FIGURE"),"FIGCAPTION",!1);e&&(e.style.marginTop="")}#ui(){this.#J.component.__removeDragEvent(),this.#si(),this._displayResizeHandles(!0),this.#J.ui.offCurrentController(),this.#J.ui.disableBackWrapper()}#si(){this.#J.eventManager.removeGlobalEvent(this.__onContainerEvent),this.#J.eventManager.removeGlobalEvent(this.__offContainerEvent),this.#J.eventManager.removeGlobalEvent(this.#Ws)}#li(t){const e=this.#J.frameContext.get("wrapper").querySelector(".se-drag-handle");Ve.utils.removeClass(e,"se-drag-handle-full"),e.style.opacity="",e.style.width="",e.style.height="",bi.set("__dragHandler",e),bi.set("__dragContainer",this._container),bi.set("__dragCover",this._cover),bi.set("__dragMove",this.#pi.bind(this,e,t)),bi.get("__dragMove")(),e.style.display="block"}#pi(t,e){t.style.display="block",t.style.left=e.offsetLeft+(this.#J.options.get("_rtl")?t.offsetWidth:e.offsetWidth-1.5*t.offsetWidth)+"px",t.style.top=e.offsetTop-t.offsetHeight+.5+"px"}#ei(t){t.stopPropagation(),t.preventDefault();const e=bi.get("__figureInst");if(!e)return;const s=Ve.query.getEventTarget(t),i=e._resize_direction=s.classList[0];e._resizeClientX=t.clientX,e._resizeClientY=t.clientY,this.#J.frameContext.get("_figure").main.style.float=/l/.test(i)?"right":/r/.test(i)?"left":"none",this.#J.ui.enableBackWrapper(Ai[i]);const{w:n,h:o,dw:l,dh:r}=this.getSize(e._element);if(Bi=Ii=!1,Vi=Oi=0,!this.isVertical){const t=!n||/auto|%$/.test(n),s=!o||/auto|%$/.test(o);if("tl|bl|tr|br".includes(i)&&t&&s?Bi=!0:"lw|rw".includes(i)&&t&&(Ii=!0),Bi||Ii){const t=e._cover||e._element;Oi=t.offsetWidth,Vi=Ie.getWidthInPercentage(t,this.#J.frameContext.get("wysiwygFrame"))/100}}e.__onContainerEvent=this.#J.eventManager.addGlobalEvent("mousemove",e.__containerResizing),e.__offContainerEvent=this.#J.eventManager.addGlobalEvent("mouseup",e.__containerResizingOff),e._displayResizeHandles(!1);const a=this.#J.frameContext.get("_figure").display;a.style.display="block",Ve.utils.changeTxt(a,l+" * "+r)}#Ks(t){const e=this._resize_direction,s=t.clientX,i=t.clientY,n=this.isVertical;let o=n?this.#zs:this.#Ps,l=n?this.#Ps:this.#zs;const r=o+(/r/.test(e)?s-this._resizeClientX:this._resizeClientX-s),a=l+(/b/.test(e)?i-this._resizeClientY:this._resizeClientY-i),h=l/o*r,c=this.#J.frameContext.get("_figure").border;/t/.test(e)&&(c.style.top=l-(/h/.test(e)?a:h)+"px"),/l/.test(e)&&(c.style.left=o-r+"px"),/r|l/.test(e)&&(c.style.width=r+"px",o=r),/^(t|b)[^h]$/.test(e)?(c.style.height=h+"px",l=h):/^(t|b)h$/.test(e)&&(c.style.height=a+"px",l=a);const d=!n&&/h$/.test(e)?this.#Is:Math.round(o),u=!n&&/w$/.test(e)?this.#Vs:Math.round(l),p=Vi?d/Oi*Vi*100:d;Ve.utils.changeTxt(this.#J.frameContext.get("_figure").display,Vi?Oe.get(p>100?100:p,2).toFixed(2)+"%":p+" * "+u),this.#Os=d,this.#Rs=u}#js(){this.#ui();let t=this.isVertical?this.#Rs:this.#Os,e=this.isVertical?this.#Os:this.#Rs;if(t=Math.round(t)||t,e=Math.round(e)||e,!this.isVertical&&!/%$/.test(t+"")){const s=this.#J.frameContext.get("wysiwygFrame").clientWidth-Oe.get(this.#J.frameContext.get("wwComputedStyle").getPropertyValue("padding-left"))+Oe.get(this.#J.frameContext.get("wwComputedStyle").getPropertyValue("padding-right"))-2;Oe.get(t,0)>s&&(e=Math.round(e/t*s),t=s)}if(Bi||Ii){t=t/(this._cover||this._element).offsetWidth*Vi*100;const e=Oe.get(t>100?100:t,2)+"%";this._setPercentSize(e,Ii?this.getSize(this._element).h:"")}else this._applySize(t,e,this._resize_direction),this.isVertical&&this.setTransform(this._element,t,e,0);this.#J.history.push(!1),this.#J.component.select(this._element,this.kind)}#Xs(t){Re.isEsc(t.code)&&(this.#ui(),this.#J.component.select(this._element,this.kind))}#Us(t){this.setAlign(this._element,t),this.selectMenu_align.close(),this.#J.component.select(this._element,this.kind),this.#J.history.push(!1)}#Zs(t){this.convertAsFormat(this._element,t),this.selectMenu_as.close(),this.#J.history.push(!1)}#Gs(t){if("auto"===t)this.deleteTransform(),this._setAutoSize();else{let e=this.getSize(this._element).h;if(this.isVertical){const t=(this._element.getAttribute("data-se-size")||",").split(",");t[1]&&(e=t[1])}this.deleteTransform(),this._setPercentSize(1*t,null!==Oe.get(e,0)&&/%$/.test(e)?e:"")}this.selectMenu_resize.close(),this.#J.component.select(this._element,this.kind),this.#J.history.push(!1)}#Ys(){const t=this.#J.frameContext.get("_figure");t.main.style.display="none",this.#J.ui.setFigureContainer(null),this.#J.ui.opendControllers=this.#J.ui.opendControllers.filter((e=>e.form!==t.main))}#Js(){this.selectMenu_align.open("",'[data-command="'+this.align+'"]')}#Qs(){this.selectMenu_as.open("",'[data-command="'+this.as+'"]')}#ti(){const t=this.getSize(this._element),e=t.w,s=t.h;let i="";if(this.autoRatio){if(s===this.autoRatio.default&&/%$/.test(e)){const t=Oe.get(e);i=100===t?"auto":"resize_percent"+t}}else"auto"===s&&("auto"===e?i="auto":/%$/.test(e)&&(i="resize_percent"+Oe.get(e)));this.selectMenu_resize.open("",'[data-command="'+i+'"]')}}function Pi(t){const e=t.style.transform;return e?{r:Number((e.match(/rotate\(([-0-9]+)deg\)/)||[])[1]||0),x:(e.match(/rotateX\(([-0-9]+)deg\)/)||[])[1]||"",y:(e.match(/rotateY\(([-0-9]+)deg\)/)||[])[1]||""}:{r:0,x:"",y:""}}function zi(t){return/^(90|270)$/.test(Math.abs(Oe.is(t)?t:Pi(t).r).toString())}function Di(t){const e=t.split("_"),s=e[0],i=e[1];let n,o,l,r;switch(s){case"resize":n="onresize",o=i,l="resize",r="resize";break;case"auto":n="auto",l="autoSize",r="auto_size";break;case"rotate":n="rotate",o="l"===i?-90:"r"===i?90:Oe.get(i),l=o<0?"rotateLeft":"rotateRight",r=o<0?"rotate_left":"rotate_right";break;case"mirror":n="mirror",o=i,l="h"===i?"mirrorHorizontal":"mirrorVertical",r="h"===i?"mirror_horizontal":"mirror_vertical";break;case"align":n="onalign",l="align",r="align_justify";break;case"caption":n="caption",l="caption",r="caption";break;case"revert":n="revert",l="revert",r="revert";break;case"edit":n="edit",l="edit",r="edit";break;case"as":n="onas",l="blockStyle",r="as_block";break;case"copy":n="copy",l="copy",r="copy";break;case"remove":n="remove",l="remove",r="delete"}return n?{c:n,v:o,l,t:undefined,i:r}:null}const Fi=Ri,{_w:qi,ON_OVER_COMPONENT:Wi,isMobile:Ui}=Ae,Zi=/^Arrow(Left|Up|Right|Down)$/,Gi=/^Arrow(Left|Up)$/;function ji(t,e,s){t.preventDefault(),t.stopPropagation(),Ki(e),s.setData("text/html",e.outerHTML)}function Ki(t){Ve.utils.removeClass(t,"se-component-selected"),Ve.utils.removeClass(t.querySelectorAll(".se-figure-selected"),"se-figure-selected"),Ve.utils.removeClass(t.querySelectorAll(".se-selected-table-cell"),"se-selected-table-cell"),Ve.utils.removeClass(t.querySelector(".se-selected-cell-focus"),"se-selected-cell-focus")}const Yi=class{#D;#J;#t;#gi;#nt;#ot;#Y;#mi;#fi;#vi=null;#bi=null;#yi=null;#is=null;constructor(t){this.#D=t,this.#J=t.$,this.#t=t.store,this.#gi=this.#J.contextProvider,this.#nt=this.#gi.carrierWrapper,this.#ot=this.#J.options,this.#Y=this.#J.frameContext,this.#mi=this.#J.eventManager,this.info=null,this.isSelected=!1,this.currentTarget=null,this.currentPlugin=null,this.currentPluginName="",this.currentInfo=null,this.#fi={copy:this.#Ci.bind(this),cut:this.#wi.bind(this),keydown:this.#_i.bind(this),mousedown:this.#Ie.bind(this)},this.__selectionSelected=!1,this.__prevent=!1}_init(){this.#gi.applyToRoots((t=>{const e=Ve.utils.createElement("DIV",{class:"se-drag-handle",draggable:"true"},this.#gi.icons.selection);t.get("wrapper").appendChild(e),this.#mi.addEvent(e,"mouseenter",this.#xi.bind(this)),this.#mi.addEvent(e,"mouseleave",this.#$i.bind(this)),this.#mi.addEvent(e,"dragstart",this.#ki.bind(this)),this.#mi.addEvent(e,"dragend",this.#Si.bind(this)),this.#mi.addEvent(e,"click",this.#Ei.bind(this))}))}insert(t,{skipCharCount:e=!1,skipHistory:s=!1,scrollTo:i=!0,insertBehavior:n}={}){if(this.#Y.get("isReadOnly")||!e&&!this.#J.char.check(t))return null;void 0===n&&(n=this.#ot.get("componentInsertBehavior"));const o=this.#J.html.remove(),l=this.isInline(t);this.#J.selection.getRangeAndAddLine(this.#J.selection.getRange(),o.container);const r=this.#J.selection.getNode();let a=null,h=this.#J.format.getLine(r,null);try{if(Ve.check.isListCell(h))this.#J.html.insertNode(t,{afterNode:l?null:Ve.check.isZeroWidth(r)?(r||o.container||{}).nextSibling:null,skipCharCount:!0}),l||t.nextSibling||t.parentNode.appendChild(Ve.utils.createElement("BR"));else{if(!l&&this.#J.selection.getRange().collapsed&&(3===o.container?.nodeType||Ve.check.isBreak(o.container))){const t=Ve.query.getParentElement(o.container,this.#J.format.isBlock.bind(this.#J.format));a=this.#J.nodeTransform.split(o.container,o.offset,t?Ve.query.getNodeDepth(t)+1:0),a&&(h=a.previousSibling)}this.#J.html.insertNode(t,{afterNode:l||this.#J.format.isBlock(h)?null:h,skipCharCount:!0}),!l&&h&&Ve.check.isZeroWidth(h)&&Ve.utils.removeItem(h)}if(l){const e=Ve.utils.createTextNode(Be.zeroWidthSpace);t.parentNode.insertBefore(e,t.nextSibling)}}catch(t){console.error("Component insert error:",t)}s||this.#J.history.push(!1),this.#Y.has("documentType_use_header")&&this.#Y.get("documentType").reHeader();const c=a||t;return i&&this.#J.selection.scrollTo(c,{behavior:"auto"}),null!==n&&this.applyInsertBehavior(t,a,n),c}applyInsertBehavior(t,e,s){const i=this.get(t);if(this.isInline(t)){const e=this.#J.selection.getNearRange(t);e?this.#J.selection.setRange(e.container,e.offset,e.container,e.offset):this.select(i.target,i.pluginName)}else switch(s){case"auto":this.#Ti(t)||this.select(i.target,i.pluginName);break;case"select":this.#J.selection.setRange(t,0,t,0),i?this.select(i.target,i.pluginName):e&&(e=Ve.query.getEdgeChildNodes(e,null).sc||e,this.#J.selection.setRange(e,0,e,0));break;case"line":if(!this.#Ti(t)){const e=this.#J.format.addLine(t,null);e&&this.#J.selection.setRange(e,0,e,0)}}}get(t){if(!t)return null;let e,s="",i={},n=!1,o=null;if(this.is(t)){if(Ve.check.isComponentContainer(t)&&!Ve.utils.hasClass(t,"se-inline-component")&&(t=t.firstElementChild||t),/^FIGURE$/i.test(t.nodeName)&&(t=t.firstElementChild),!t)return null;const n=this.#J.pluginManager.findComponentInfo(t);if(!n)return null;e=n.target,s=n.pluginName,i=n.options,o=n.launcher}if(!e&&t.nodeName){this.#Mi(t)&&(n=!0);const l=this.#J.pluginManager.findComponentInfo(t);if(!l)return null;e=l.target,s=l.pluginName,i=l.options,o=l.launcher}if(!e)return null;const l=Fi.GetContainer(e),r=l.container||l.cover||e;return this.info={target:l.target,pluginName:s,options:i,container:r,cover:l.cover,inlineCover:l.inlineCover,caption:l.caption,isFile:n,launcher:o,isInputType:Ve.utils.hasClass(r,"se-input-component")}}select(t,e,{isInput:s=!1}={}){const i=this.get(t);if(!i||Ve.check.isUneditable(Ve.query.getParentElement(t,this.is.bind(this)))||Ve.check.isUneditable(t))return!1;const n=i.launcher||this.#J.plugins[e];if(!n)return;const o=yi.get("__overInfo")!==Wi;if(!s&&o){if(this.#t.get("_mousedown"))return;this.#t.set("_preventBlur",!0),this.__selectionSelected=!0,this.isInline(i.container)&&this.#J.selection.setRange(i.container,0,i.container,0),this.#J.focusManager.blur(),qi.setTimeout((()=>{this.__selectionSelected=!1}))}let l;this.isSelected=!0,this.__prevent=!0,"function"==typeof n.componentSelect&&(l=n.componentSelect(t));const r=Ve.utils.hasClass(i.target,"se-component-line-break");(r||!l&&!Ve.utils.hasClass(i.container,"se-inline-component"))&&this._setComponentLineBreaker(i.container||i.cover||t),this.currentTarget=t,this.currentPlugin=n,this.currentPluginName=e,this.currentInfo=i,yi.set("__dragInst",this);const a=yi.get("__overInfo");if(qi.setTimeout((()=>{yi.set("__overInfo",a===Wi&&void 0),a!==Wi&&this.#Pe(),i.isFile||this.#Hi(),Ve.utils.addClass(i.container,"se-component-selected")}),0),!o||this.#t.get("hasFocus")||this.#t.get("_preventFocus")||(this.#D._eventOrchestrator.__postFocusEvent(this.#Y,null),this.#t.set("_preventFocus",!0)),r||a===Wi){if(r||!Ve.utils.hasClass(i.container,"se-input-component")){const t=this.#Y.get("wrapper").querySelector(".se-drag-handle");Ve.utils.addClass(t,"se-drag-handle-full"),this.#J.ui._visibleControllers(!1,!1);const e=i.caption?i.target:i.cover||i.container||i.target,s=e.offsetWidth,n=e.offsetHeight,{top:o,left:l}=this.#J.offset.getLocal(e);t.style.opacity="0",t.style.width=s+"px",t.style.height=n+"px",t.style.top=o+"px",t.style.left=l+"px",yi.set("__dragHandler",t),yi.set("__dragContainer",i.container),yi.set("__dragCover",i.cover),t.style.display="block"}}else{if(!this.isInline(i.container))return;const t=i.container;let e=null;t.previousSibling&&!Ve.check.isBreak(t.previousSibling)||(e=Ve.utils.createTextNode(Be.zeroWidthSpace),t.parentNode.insertBefore(e,t)),t.nextSibling&&!Ve.check.isBreak(t.nextSibling)||(e=Ve.utils.createTextNode(Be.zeroWidthSpace),t.parentNode.insertBefore(e,t.nextSibling)),this.#t.set("controlActive",!0)}}deselect(){qi.setTimeout((()=>{this.#t.set("controlActive",!1)}),0),this.__deselect(),this.#J.ui.setControllerOnDisabledButtons(!1),!this.#t.get("_preventFocus")||this.#t.get("hasFocus")||this.__prevent||(this.#D._eventOrchestrator.__postBlurEvent(this.#Y,null),this.#t.set("_preventFocus",!1))}is(t){return!!t&&(!(!/^FIGURE$/i.test(t.nodeName)&&!Ve.check.isComponentContainer(t))||!!this.#J.pluginManager.findComponentInfo(t))}isInline(t){if(!t)return!1;if(/^FIGURE$/i.test(t.nodeName)&&(t=t.parentElement),Ve.utils.hasClass(t,"se-inline-component"))return!0;return!(!this.#J.pluginManager.findComponentInfo(t)||!Ve.utils.hasClass(t,"se-inline-component")&&!Ve.utils.hasClass(t.parentElement,"se-inline-component"))}isBasic(t){return this.is(t)&&!this.isInline(t)}async copy(t){const e=Ve.utils.clone(t,!0);Ki(e),!1!==await this.#J.html.copy(e)&&Ve.utils.flashClass(t,"se-copy")}hoverSelect(t){const e=Ve.query.getParentElement(t,Ve.check.isFigure);let s=this.get(t);s||e?(s||=this.get(e),s&&!Ve.utils.hasClass(s.container,"se-component-selected")&&(this.#J.ui.offCurrentController(),yi.set("__overInfo",Wi),this.select(s.target,s.pluginName))):null===yi.get("__overInfo")||Ve.utils.hasClass(t,"se-drag-handle")||(this.__deselect(),yi.set("__overInfo",null))}__deselect(){if(this.#t.set("_preventBlur",!1),yi.set("__overInfo",null),this.__removeDragEvent(),this.currentInfo){const t=this.currentInfo.container,e=this.currentInfo.cover;qi.setTimeout((()=>{Ki(t),Ve.utils.removeClass(e,"se-figure-over-selected")}),0)}this.#Y.get("lineBreaker_t")&&(this.#Y.get("lineBreaker_t").style.display=this.#Y.get("lineBreaker_b").style.display="none"),this.currentPlugin&&this.currentPlugin.componentDeselect?.(this.currentTarget),this.isSelected=!1,this.currentPlugin=null,this.currentTarget=null,this.currentPluginName="",this.currentInfo=null,this.__removeGlobalEvent(),this.#J.ui._offControllers()}_setComponentLineBreaker(t){const e=yi.get("__overInfo")===Wi;this.#D._eventOrchestrator._lineBreakComp=null;const s=this.get(t);if(!s)return;const i=this.#Y,n=s.container,o=Ve.utils.hasClass(n,"se-flex-component"),l=i.get("lineBreaker_t"),r=i.get("lineBreaker_b"),a=l.style,h=r.style,c=n.offsetWidth<t.offsetWidth?n:t,d=this.#J.ui.getVisibleFigure()||c,u=Ve.check.isListCell(n.parentNode);let p,g;const m=this.#ot.get("_rtl"),f=m?["right","left"]:["left","right"],{top:v,left:b,right:y,scrollX:C,scrollY:w}=this.#J.offset.getLocal(c),_=m?y:b;if(u?!Ve.check.isBreak(n.previousElementSibling)&&!n.previousSibling?.textContent?.trim()||this.is(n.previousElementSibling):!this.#J.format.isLine(n.previousElementSibling)){const t=qi.getComputedStyle(l),s=Oe.get(t.height,1),i=Oe.get(t.width,1);this.#D._eventOrchestrator._lineBreakComp=n,p=v,g=d.offsetWidth/2/2,a.top=p-s/2+"px",a[f[0]]=(o?_-i/2:_+g)+"px",a[f[1]]="",l.setAttribute("data-offset",w+","+C),e?Ve.utils.removeClass(l,"se-on-selected"):Ve.utils.addClass(l,"se-on-selected"),a.display="block",a.visibility=""}else a.display="none";if(u?!Ve.check.isBreak(n.nextElementSibling)&&!n.nextSibling?.textContent?.trim()||this.is(n.nextElementSibling):!this.#J.format.isLine(n.nextElementSibling)){const t=qi.getComputedStyle(r),s=Oe.get(t.height,1),i=Oe.get(t.width,1);p||(this.#D._eventOrchestrator._lineBreakComp=n,p=v,g=d.offsetWidth/2/2),h.top=p+d.offsetHeight-s/2+"px",h[f[0]]=_+d.offsetWidth-(o?0:g)-(o?i/2:i)+"px",h[f[1]]="",r.setAttribute("data-offset",w+","+f[0]+","+C),e?Ve.utils.removeClass(r,"se-on-selected"):Ve.utils.addClass(r,"se-on-selected"),h.display="block",h.visibility=""}else h.display="none"}__removeGlobalEvent(){this.#Li(),this.#vi&&=this.#mi.removeGlobalEvent(this.#vi),this.#bi&&=this.#mi.removeGlobalEvent(this.#bi),this.#yi&&=this.#mi.removeGlobalEvent(this.#yi)}__removeDragEvent(){this.#nt.querySelector(".se-drag-cursor").style.left="-10000px",yi.get("__dragHandler")&&(yi.get("__dragHandler").style.display="none"),Ve.utils.removeClass([yi.get("__dragHandler"),yi.get("__dragContainer")],"se-dragging"),Ve.utils.removeClass([yi.get("__dragCover"),yi.get("__dragContainer")],"se-drag-over"),yi.set("__figureInst",null),yi.set("__dragInst",null),yi.set("__dragHandler",null),yi.set("__dragContainer",null),yi.set("__dragCover",null),yi.set("__dragMove",null),yi.set("__overInfo",null)}#Pe(){this.__removeGlobalEvent(),this.#vi=this.#mi.addGlobalEvent("copy",this.#fi.copy),this.#bi=this.#mi.addGlobalEvent("cut",this.#fi.cut),this.#yi=this.#mi.addGlobalEvent("keydown",this.#fi.keydown)}#Hi(){this.#Li(),this.#is=this.#mi.addGlobalEvent(Ui?"click":"mousedown",this.#fi.mousedown,!0)}#Li(){this.#is&&=this.#mi.removeGlobalEvent(this.#is)}#Ti(t){const e=t.nextElementSibling;if(!e){const e=this.#J.format.addLine(t,null);return e&&this.#J.selection.setRange(e,0,e,0),!0}return!!this.#J.format.isLine(e)&&(this.#J.selection.setRange(e,0,e,0),!0)}#Mi(t){const e=t.nodeName.toLowerCase();return this.#J.pluginManager.fileInfo.regExp.test(e)&&(!this.#J.pluginManager.fileInfo.tagAttrs[e]||this.#J.pluginManager.fileInfo.tagAttrs[e]?.every((e=>t.hasAttribute(e))))}#xi(){this.#t.set("_preventBlur",!0),this.#J.ui._visibleControllers(!1,Ve.utils.hasClass(yi.get("__dragHandler"),"se-drag-handle-full")),Ve.utils.addClass(yi.get("__dragCover")||yi.get("__dragContainer"),"se-drag-over")}#$i(){this.#t.set("_preventBlur",!1),Ve.utils.hasClass(yi.get("__dragHandler"),"se-drag-handle-full")||this.#J.ui._visibleControllers(!0,!0),Ve.utils.removeClass([yi.get("__dragCover"),yi.get("__dragContainer")],"se-drag-over")}#ki(t){const e=yi.get("__dragCover")||yi.get("__dragContainer");e?(this.#t.set("_preventBlur",!1),Ve.utils.addClass(yi.get("__dragHandler"),"se-dragging"),Ve.utils.addClass(yi.get("__dragContainer"),"se-dragging"),t.dataTransfer.setDragImage(e,this.#ot.get("_rtl")?e.offsetWidth:-5,-5)):t.preventDefault()}#Si(){this.#t.set("_preventBlur",!1),Ve.utils.removeClass([yi.get("__dragHandler"),yi.get("__dragContainer")],"se-dragging"),this.__removeDragEvent()}#Ei(t){const e=Ve.query.getEventTarget(t);if(!Ve.utils.hasClass(e,"se-drag-handle-full"))return;const s=yi.get("__dragInst");s&&(this.__removeDragEvent(),this.select(s.currentTarget,s.currentPluginName))}#Ie(t){const e=Ve.query.getEventTarget(t);this.currentTarget?.contains(e)||Ve.query.getParentElement(e,".se-controller")||Ve.utils.hasClass(e,"se-drag-handle")||this.currentPluginName===this.#J.ui.currentControllerName&&this.#J.ui.opendControllers.some((({form:t})=>t.contains(e)))||this.deselect()}#Ci(t){const e=Ve.query.getEventTarget(t);if(Ve.check.isInputElement(e)&&Ve.query.getParentElement(e,".se-modal"))return;const s=this.info;if(!s)return;const i=s.container.cloneNode(!0);"function"==typeof this.#J.plugins[s.pluginName]?.componentCopy&&!1!==this.#J.plugins[s.pluginName].componentCopy({event:t,cloneContainer:i,info:s})||ji(t,i,t.clipboardData),Ve.utils.flashClass(s.container,"se-copy")}#wi(t){const e=this.info;if(!e)return;const s=e.container.cloneNode(!0);Ve.utils.removeClass(s,"se-component-selected"),ji(t,s,t.clipboardData),this.deselect(),Ve.utils.removeItem(e.container)}async#_i(t){if(this.#J.ui.selectMenuOn)return;const e=t.code;if(Re.isCtrl(t)){if("ControlRight"!==e&&"ControlLeft"!==e){const s=this.#J.shortcuts.keyMap.get(e+(t.shiftKey?"1000":""));/^(redo|undo)$/.test(s?.command)&&(t.preventDefault(),t.stopPropagation(),this.#J.commandDispatcher.run(s.command,s.type,s.button))}}else if(!Re.isRemoveKey(e)||(t.preventDefault(),t.stopPropagation(),"function"!=typeof this.currentPlugin?.componentDestroy||this.info.isInputType&&this.#t.get("hasFocus"))){if(Re.isEnter(e)){t.preventDefault();const e=this.currentInfo||this.get(this.currentTarget),s=e.container||e.target,i=s.previousElementSibling||s.nextElementSibling;let n=null;n=Ve.check.isListCell(s.parentNode)?Ve.utils.createElement("BR"):Ve.utils.createElement(this.#J.format.isLine(i)?i.nodeName:this.#ot.get("defaultLine"),null,"<br>");const o=this.currentPluginName;return this.deselect(),s.parentNode.insertBefore(n,s),!1===this.select(e.target,o)&&this.#J.focusManager.blur(),void this.#J.history.push(!1)}if(Zi.lastIndex=0,Zi.test(e)){const{container:s}=this.get(this.currentTarget);let i=null,n=1;if(this.isInline(s||this.currentTarget))switch(e){case"ArrowLeft":i=s.previousSibling,n=3===i?.nodeType?i.textContent.length:1;break;case"ArrowRight":i=s.nextSibling,n=0;break;case"ArrowUp":{const t=this.#J.format.getLine(s,null);i=t?.previousElementSibling,n=0;break}case"ArrowDown":{const t=this.#J.format.getLine(s,null);i=t?.nextElementSibling;break}}else Gi.lastIndex=0,Gi.test(e)?i=s.previousElementSibling:(i=s.nextElementSibling,n=0);if(!i)return;this.deselect();const o=this.get(i);if(o?.container)t.stopPropagation(),t.preventDefault(),this.select(o.target,o.pluginName);else try{this.#t.set("_preventBlur",!0),t.stopPropagation(),t.preventDefault(),this.#J.selection.setRange(i,n,i,n)}finally{this.#t.set("_preventBlur",!1)}}else Re.isEsc(e)&&this.deselect()}else{const t=this.info.container.previousSibling;if(await this.currentPlugin.componentDestroy(this.currentTarget),this.deselect(),t){const e=3===t.nodeType?t.textContent.length:1;this.#J.selection.setRange(t,e,t,e)}else this.#J.focusManager.focus()}}_destroy(){this.__removeGlobalEvent(),this.__removeDragEvent()}};const Xi=class{#D;#J;#Ni;#gi;#ot;#Ai;#Bi;#Ii=[];#Vi=[];#Oi={tags:null,regExp:null,pluginRegExp:null,pluginMap:null};#Ri=[];#Pi=new Map;#zi=new Map([["onMouseMove",[]],["onMouseLeave",[]],["onMouseDown",[]],["onMouseUp",[]],["onScroll",[]],["onClick",[]],["onBeforeInput",[]],["onInput",[]],["onKeyDown",[]],["onKeyUp",[]],["onFocus",[]],["onBlur",[]],["onPaste",[]],["onFilePasteAndDrop",[]]]);constructor(t,e){this.#D=t,this.#J=t.$,this.#Ni=e.plugins||{},this.#gi=this.#J.contextProvider,this.#ot=this.#J.options,this.#Ai=e.pluginCallButtons,this.#Bi=e.pluginCallButtons_sub}get plugins(){return this.#Ni}get fileInfo(){return this.#Oi}findComponentInfo(t){for(const e of this.#Ri){const s=e(t);if(s)return s}return null}applyRetainFormat(t){let e;(e=this.#ot.get("__pluginRetainFilter"))&&this.#Pi.forEach(((s,i)=>{const n=t.querySelectorAll(i);for(let t=0,i=n.length;t<i;t++)!0!==e&&!1===e[s.key]||s.method(n[t])}))}emitEvent(t,e){const s=this.#zi.get(t);for(let t,i=0;i<s.length;i++)if(t=s[i](e),"boolean"==typeof t)return t}async emitEventAsync(t,e){const s=this.#zi.get(t);for(let t,i=0;i<s.length;i++)if(t=await s[i](e),"boolean"==typeof t)return t}checkFileInfo(t){for(let e=0,s=this.#Ii.length;e<s;e++)this.#Ii[e](t)}resetFileInfo(){for(let t=0,e=this.#Vi.length;t<e;t++)this.#Vi[t]()}register(t,e,s){let i=this.#Ni[t];if(!i)throw Error(`[SUNEDITOR.registerPlugin.fail] The called plugin does not exist or is in an invalid format. (pluginName: "${t}")`);if("function"==typeof this.#Ni[t]&&(i=this.#Ni[t]=new this.#Ni[t](this.#D,s||{})),e){const{icons:s,lang:n}=this.#gi;for(let t=0,o=e.length;t<o;t++)ps(e[t],i,s,n);this.#J.commandDispatcher.activeCommands.includes(t)||"function"!=typeof this.#Ni[t].active||this.#J.commandDispatcher.activeCommands.push(t)}}init(t){this.#Oi.tags=[],this.#Oi.pluginMap={},this.#Oi.tagAttrs={};const e=this.#Ni,s=[];let i;for(const n in e){if(this.register(n,this.#Ai[n],t[n]),this.register(n,this.#Bi[n],t[n]),i=this.#Ni[n],"object"==typeof i.__fileManagement){const t=i.__fileManagement;if(this.#Ii.push(t._checkInfo.bind(t)),this.#Vi.push(t._resetInfo.bind(t)),Array.isArray(t.tagNames)){const e=t.tagNames;this.#Oi.tags=this.#Oi.tags.concat(e),s.push(n);for(let s,i=0,o=e.length;i<o;i++)s=e[i].toLowerCase(),this.#Oi.pluginMap[s]=n,t.tagAttrs&&(this.#Oi.tagAttrs[s]=t.tagAttrs)}}"function"==typeof i.constructor.component&&this.#Ri.push(function(t,e){return e&&(e=t.component?.(e))?{target:e,pluginName:t.key,options:t.options}:null}.bind(null,i.constructor));const e=i.constructor.options||{};if(this.#zi.forEach(((t,s)=>{if("function"==typeof i[s]){const n=i[s].bind(i);n.index=e[`eventIndex_${s}`]||e.eventIndex||0,t.push(n)}})),i.retainFormat){const t=i.retainFormat();this.#Pi.set(t.query,{key:i.constructor.key,method:t.method})}}for(const t of this.#zi.values())t.sort(((t,e)=>t.index-e.index));(this.#ot.get("buttons").has("pageBreak")||this.#ot.get("buttons_sub")?.has("pageBreak"))&&this.#Ri.push(function(t,e,s){if(!s||!Ve.utils.hasClass(s,"se-page-break"))return null;return{target:s,launcher:{componentDestroy:s=>{const i=s.previousElementSibling||s.nextElementSibling;Ve.utils.removeItem(s),t.focusEdge(i),e.push(!1)}}}}.bind(null,this.#J.focusManager,this.#J.history)),this.#Oi.regExp=new RegExp(`^(${this.#Oi.tags.join("|")||"\\^"})$`,"i"),this.#Oi.pluginRegExp=new RegExp(`^(${0===s.length?"\\^":s.join("|")})$`,"i"),this.#Ai=null,this.#Bi=null}get(t){return this.#Ni[t]}_destroy(){for(const t in this.#Ni){const e=this.#Ni[t];e._destroy?.(),e.editor=null}this.#Ni=null,this.#Oi=null,this.#Ri=null,this.#zi?.clear(),this.#Pi?.clear()}};class Ji{#D;#J;#t;#ot;#Y;#Q;constructor(t){this.#D=t,this.#J=t.$,this.#t=t.store,this.#ot=this.#J.options,this.#Y=this.#J.frameContext,this.#Q=this.#J.frameOptions}focus(t){if(t&&this.#J.facade.changeFrameContext(t),"none"!==this.#Y.get("wysiwygFrame").style.display){if(this.#t.set("_preventBlur",!1),this.#Q.get("iframe")||!this.#Y.get("wysiwyg").contains(this.#J.selection.getNode()))this.nativeFocus();else try{const t=this.#J.selection.getRange();if(t.startContainer===t.endContainer&&Ve.check.isWysiwygFrame(t.startContainer)){const e=t.commonAncestorContainer.children[t.startOffset];if(!this.#J.format.isLine(e)&&!this.#J.component.is(e)){const t=Ve.utils.createElement("BR"),s=Ve.utils.createElement(this.#ot.get("defaultLine"),null,t);return this.#Y.get("wysiwyg").insertBefore(s,e),void this.#J.selection.setRange(t,0,t,0)}}this.#J.selection.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}catch(t){console.warn("[SUNEDITOR.focus.warn] ",t),this.nativeFocus()}this.#t.mode.isBalloon&&this.#D._eventOrchestrator._toggleToolbarBalloon()}}focusEdge(t){this.#t.set("_preventBlur",!1),t||=this.#Y.get("wysiwyg").lastElementChild;const e=this.#J.component.get(t);e?this.#J.component.select(e.target,e.pluginName):t?(3!==t.nodeType&&(t=Ve.query.getEdgeChild(t,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!0)),t?this.#J.selection.setRange(t,t.textContent.length,t,t.textContent.length):this.nativeFocus()):this.focus()}nativeFocus(){this.#J.selection.__focus(),this.#J.selection.init()}blur(){this.#Q.get("iframe")?this.#Y.get("wysiwygFrame").blur():this.#Y.get("wysiwyg").blur()}}const Qi=/^H[1-6]$/,tn=/^(UL|OL)$/,en=/^LI$/,sn=/^(THEAD|TBODY|TR|TD|TH)$/;function nn(t){let e=t;for(;e&&!tt(e);){if("TABLE"===e.nodeName)return e;e=e.parentNode}return null}function on(t){let e=t;for(;e&&!tt(e);){if(1===e.nodeType&&Q(e))return!0;e=e.parentNode}return!1}function ln(t,e){const s=t.querySelector(":scope > ul, :scope > ol");if(!s)return null;if(e<s.getBoundingClientRect().top)return null;const i=s.children;let n=null,o=1/0;for(let t=0;t<i.length;t++){const s=i[t];if(!en.test(s.nodeName))continue;const l=s.getBoundingClientRect();if(e>=l.top&&e<=l.bottom)return ln(s,e)||s;const r=Math.min(Math.abs(e-l.top),Math.abs(e-l.bottom));r<o&&(o=r,n=s)}return n}function rn(t,e,s,i){if(!t||!s)return null;if(3===t.nodeType&&!(t=t.parentNode))return null;if(tt(t))return null;if(on(t))return null;let n=null;if(sn.test(t.nodeName))n=nn(t);else if(tn.test(t.nodeName))n=t;else if(en.test(t.nodeName))n=t;else if(Y(t.parentNode))n=nn(t);else{const s=e.getLine(t,null);if(s&&(n=s),!n){const s=e.getBlock(t,null);s&&(n=sn.test(s.nodeName)?nn(s):s)}}if(!n){let e=t;for(;e&&!tt(e);){if(1===e.nodeType&&e.parentNode&&tt(e.parentNode)){n=e;break}e=e.parentNode}}if(!n)return null;if(on(n))return null;if(void 0!==i)if(tn.test(n.nodeName)){const t=function(t,e){const s=t.children;let i=null,n=1/0;for(let t=0;t<s.length;t++){const o=s[t];if(!en.test(o.nodeName))continue;const l=o.getBoundingClientRect();if(e>=l.top&&e<=l.bottom)return ln(o,e)||o;const r=Math.min(Math.abs(e-l.top),Math.abs(e-l.bottom));r<n&&(n=r,i=o)}return i}(n,i);t&&(n=t)}else if(en.test(n.nodeName)){const t=ln(n,i);t&&(n=t)}const{depth:o,parent:l}=function(t,e){let s=0,i=null,n=t.parentNode;for(;n&&!tt(n);)1===n.nodeType&&(e.isBlock(n)||e.isLine(n))&&(i||(i=n),s++),n=n.parentNode;return{depth:s,parent:i}}(n,e),r={prev:(a=n).previousElementSibling,next:a.nextElementSibling};var a;return{element:n,type:function(t){const e=t.nodeName;return"P"===e||"DIV"===e?"p":Qi.test(e)?"heading":"LI"===e?"list-item":tn.test(e)?"list":"BLOCKQUOTE"===e?"blockquote":"PRE"===e?"pre":"FIGURE"===e?"figure":"TABLE"===e?"table":"p"}(n),depth:o,parent:l,siblings:r,rect:n.getBoundingClientRect()}}const{_w:an}=Ae;const hn=class{#J;#Di;#Fi;#qi=null;#Wi;#Ui=new Map;#Zi=null;#Gi=[];#ji=[];selectMenu;constructor(t,e,s){this.#J=e,this.#Di=s.resolveButton,this.#Fi=Array.isArray(s.items)?s.items:[],this.#Wi="function"==typeof s.renderCustomItem?s.renderCustomItem:null;const i=s.selectMenuParams?.closeMethod;this.selectMenu=new Hi(e,{...s.selectMenuParams,closeMethod:()=>{this.#Ki(),this.#Yi(),i?.()},subEscMethod:()=>{if(!this.#Zi)return!1;const t=this.#Zi.anchorLi;this.#Ki();const e=t?Number(t.getAttribute("data-index")):NaN;return Number.isNaN(e)||this.selectMenu.setItem(e),!0}})}attach(t,e,s={}){this.selectMenu.on(t,e,s),this.#J.eventManager.addEvent(this.selectMenu.form,"mousedown",(t=>{Ae.isMobile?this.#J.store.set("_preventBlur",!0):t.preventDefault()})),this.#J.eventManager.addEvent(this.selectMenu.form,"mousemove",this.#Xi.bind(this))}setItems(t){this.#Fi=Array.isArray(t)?t:[],this.#qi=null}getItems(){if(this.#qi)return this.#qi;const t=[];for(const i of this.#Fi)if("string"==typeof i){const e=this.#Di(i,this.#J.plugins,this.#J.options,this.#J.icons,this.#J.lang);if(!e)continue;const s=e.type||"";if(/dropdown-free/.test(s)){t.push({kind:"dropdownFree",title:e.title,iconHTML:e.icon||"",search:(e.title+" "+i).toLowerCase(),name:i,type:s});continue}if(/dropdown/.test(s)){const s=this.#J.menu?.itemsMap?.[i]||[];if(s.length>0){t.push({kind:"submenu",title:e.title,iconHTML:e.icon||"",search:(e.title+" "+i).toLowerCase(),name:i,children:s.map((t=>({pluginName:i,element:t._element}))),childMenus:s.map((t=>{const e=t._element?.querySelector(".se-list-icon")||t._element?.querySelector("svg"),s=e?e.outerHTML:"";return`<span class="se-block-submenu-item">${s?`${s}<span>${t.title}</span>`:t.title}</span>`}))});continue}}t.push({kind:"plugin",title:e.title,iconHTML:e.icon||"",search:(e.title+" "+i).toLowerCase(),name:i,type:s,command:e.command})}else if(i&&"object"==typeof i&&"function"==typeof i.action){const n=i.title||i.key||"",o=Array.isArray(i.keywords)?i.keywords.join(" "):"";t.push({kind:"custom",title:n,iconHTML:(e=i.icon,s=this.#J.icons,e&&"string"==typeof e?"<"===e.charAt(0)?e:s[e]||"":""),search:(n+" "+o).toLowerCase(),raw:i})}var e,s;return this.#qi=t,t}filter(t,e=1/0){const s=this.getItems(),i=(t||"").toLowerCase().trim(),n=[];for(const t of s)if(i&&-1===t.search.indexOf(i)||n.push(t),n.length>=e)break;return n}renderRows(t){const e={icons:this.#J.icons},s=`<span class="se-submenu-arrow">${this.#J.icons.menu_arrow_right}</span>`;return t.map((t=>{if("custom"===t.kind&&this.#Wi)return this.#Wi(t.raw,e);const i=(n=t.title,`<button type="button" class="se-cmd-row">${(o=t.iconHTML)?`<span class="se-block-menu-icon">${o}</span><span class="se-block-menu-label">${n}</span>`:`<span class="se-block-menu-label se-block-menu-label-full">${n}</span>`}</button>`);var n,o;return"dropdownFree"===t.kind?i+s:i}))}createRows(t){this.#Yi();const e=t.map((t=>"submenu"===t.kind?{children:t.children,childMenus:t.childMenus}:t));this.selectMenu.create(e,this.renderRows(t)),this.#Ui.clear(),this.#Gi.length=0,t.forEach(((t,e)=>{"dropdownFree"===t.kind&&this.#Ui.set(e,{name:t.name,plugin:this.#J.plugins[t.name],li:this.selectMenu.menus[e]}),"plugin"!==t.kind&&"dropdownFree"!==t.kind||this.#Gi.push({name:t.name,idx:e})})),this.selectMenu.isOpen&&this.#Ji()}open(t){this.selectMenu.open(t),0===this.#ji.length&&this.#Ji()}close(){this.#Yi(),this.selectMenu.close()}hasOpenSubPanel(){return this.selectMenu.hasOpenSubmenu()||!!this.#Zi}#Ji(){const t=this.#J.commandDispatcher;for(const{name:e,idx:s}of this.#Gi){const i=this.#Qi(s);i&&(t.registerTargets(e,i),this.#ji.push({name:e,target:i}))}this.#J.store.set("_lastSelectionNode",null),this.#J.eventManager.applyTagEffect()}#Yi(){if(0===this.#ji.length)return;const t=this.#J.commandDispatcher;for(const{name:e,target:s}of this.#ji)t.unregisterTargets(e,s);this.#ji.length=0}#Qi(t){const e=this.selectMenu.menus[t];return e?e.querySelector("button.se-cmd-row")||e:null}setItem(t){this.selectMenu.setItem(t)}setHidden(t){this.selectMenu.setHidden(t)}get isOpen(){return this.selectMenu.isOpen}dispatch(t,e){if(!t)return!1;const s=t;if(s.pluginName&&s.element){const t=this.#J.plugins[s.pluginName];return t?.action?.(s.element),this.#J.history.push(!1),!0}const i=t;if("custom"===i.kind){try{i.raw.action(this.#J,e)}catch(t){console.error("[SUNEDITOR.commandMenu.customAction]",t)}return!1}if("dropdownFree"===i.kind){const t=this.#J.plugins[i.name];if(!t)return!1;if(this.#Zi?.plugin===t)return this.#Ki(),!1;const e=this.selectMenu.items.indexOf(i),s=e>=0?this.selectMenu.menus[e]:null;return s&&this.#tn(i.name,t,s),!1}const n=i.name?this.#J.plugins[i.name]:null;if(n){const t=i.type||"";return/modal/.test(t)?n.open?.():/browser/.test(t)?n.open?.(null):/popup/.test(t)?n.show?.():n.action?.(Ve.utils.createElement("BUTTON",{type:"button","data-command":i.name})),this.#J.history.push(!1),!0}return i.command&&this.#J.commandDispatcher.run(i.command,null,null),!1}#Xi(t){if(0===this.#Ui.size)return;const e=t.target;if(this.#Zi?.dropdown?.contains(e))return;const s=e.closest?.("li[data-index]");if(!s)return;const i=Number(s.getAttribute("data-index")),n=this.#Ui.get(i);n?this.#Zi?.plugin!==n.plugin&&this.#tn(n.name,n.plugin,n.li):this.#Zi&&this.#Ki()}#tn(t,e,s){this.#Zi&&this.#Ki();const i=this.#J.menu?.targetMap?.[t];if(!i||!this.selectMenu.form)return;const n=i.parentNode;this.selectMenu.form.appendChild(i),this.#en(i,s,this.selectMenu.form),Ve.utils.addClass(s,"se-submenu-open"),e.on?.(s);const o=this.#J.eventManager.addEvent(i,"click",(()=>an.setTimeout((()=>{this.#Ki(),this.selectMenu.close()}),0)));this.#Zi={dropdown:i,plugin:e,originalParent:n,anchorLi:s,evClick:o}}#Ki(){const t=this.#Zi;t&&(this.#Zi=null,this.#J?.eventManager.removeEvent(t.evClick),t.dropdown.style.cssText="",t.dropdown.style.display="none",t.anchorLi&&Ve.utils.removeClass(t.anchorLi,"se-submenu-open"),t.originalParent&&t.originalParent!==t.dropdown.parentNode&&t.originalParent.appendChild(t.dropdown),t.plugin?.off?.())}#en(t,e,s){const i=e.getBoundingClientRect(),n=s.getBoundingClientRect(),o=!!this.#J.options.get("_rtl");t.style.position="absolute",t.style.right="",t.style.visibility="hidden",t.style.display="block";const l=t.offsetWidth,r=t.offsetHeight,a=an.innerWidth,h=an.innerHeight,c=i.right+4,d=i.left-l-4,u=Math.max(0,c+l-a),p=Math.max(0,-d);let g;g="right"===(o?"left":"right")?0===u?c:0===p?d:u<=p?c-u:d+p:0===p?d:0===u?c:p<=u?d+p:c-u,t.style.left=g-n.left+"px";const m=i.top,f=i.bottom-r,v=Math.max(0,m+r-h),b=Math.max(0,-f);let y;y=0===v?m:0===b?f:v<=b?m-v:f+b,t.style.top=y-n.top+"px",t.style.visibility=""}},{_w:cn,_d:dn}=Ae;const un=class{#J;#sn;#in;#nn;#on;#ln;#rn=null;#an=null;#hn=null;#cn=null;#dn=void 0;#un=null;#pn=[];#gn=!1;#mn=null;#fn=null;#vn=null;#bn=null;#yn=null;constructor(t,e,s,i,n,o){this.#J=t,this.#sn=e,this.#in=s,this.#nn=i,this.#on=n,this.#ln=o||null,this.#J.contextProvider.carrierWrapper.appendChild(this.#in);const l=this.#J.eventManager;l.addEvent(this.#in,"mousedown",this.#Cn.bind(this)),this.#mn=Ve.utils.createElement("DIV",{class:"se-block-drag-indicator"}),this.#mn.style.display="none",this.#sn.parentElement?.appendChild(this.#mn),l.addEvent(this.#nn,"click",this.#wn.bind(this)),this.#on.draggable=!0,l.addEvent(this.#on,"dragstart",this.#_n.bind(this)),l.addEvent(this.#on,"dragend",this.#xn.bind(this)),l.addEvent(this.#on,"click",this.#$n.bind(this)),l.addEvent(this.#sn,"mousemove",this.#kn.bind(this)),l.addEvent(this.#sn,"mouseleave",this.#Sn.bind(this));const r=this.#sn.parentElement;r&&(l.addEvent(r,"mouseleave",this.#En.bind(this)),l.addEvent(r,"dragover",this.#Tn.bind(this)),l.addEvent(r,"drop",this.#Mn.bind(this))),l.addEvent(this.#J.frameContext.get("eventWysiwyg"),"keydown",this.#Hn.bind(this),!0)}#Ln(){this.#in.style.display="flex";try{this.#in.showPopover?.()}catch{}}#Nn(){try{this.#in.hidePopover?.()}catch{}this.#in.style.display="none"}positionForTarget(t,e){this.#An(),this.#rn?.isOpen||this.#gn||(this.#cn=t,this.#dn=e,this.#hn||(this.#hn=cn.requestAnimationFrame((()=>{this.#hn=null,this.#cn&&this.#Bn(this.#cn,this.#dn)}))))}hide(t){if(this.#rn?.isOpen)return;const e=t?.relatedTarget;e&&(this.#sn.contains(e)||this.#in?.contains(e))||this.#In()}hideNow(){this.#An(),this.#Nn(),this.#rn?.close(),this.#Vn(null)}syncScroll(){this.#an&&(Ve.utils.addClass(this.#in,"se-no-transition"),this.#On(this.#an),this.#in.offsetHeight,Ve.utils.removeClass(this.#in,"se-no-transition"),this.#rn?.isOpen&&this.#rn.setHidden("none"===this.#in.style.display))}destroy(){this.#hn&&(cn.cancelAnimationFrame(this.#hn),this.#hn=null),this.#gn=!1,this.#An(),this.#on&&(this.#on.draggable=!1),this.#mn?.remove(),this.#in?.remove(),this.#rn?.close(),this.#rn=null,this.#Vn(null),this.#cn=null,this.#dn=void 0,this.#J=null,this.#sn=null,this.#in=null,this.#nn=null,this.#on=null}#Vn(t){if(this.#Rn(),this.#an=t,!t)return;const e=this.#Pn(t);if(e){this.#pn=e;for(let t=0;t<e.length;t++)Ve.utils.addClass(e[t],"se-block-hover")}else Ve.utils.addClass(t,"se-block-hover")}#Pn(t){try{const e=this.#J.selection.getRange();if(!e||e.collapsed)return null;const s=this.#J.format.getLine(e.startContainer,null),i=this.#J.format.getLine(e.endContainer,null);if(!s||!i||s===i)return null;const n=Ve.query.getListChildren(e.commonAncestorContainer,(t=>this.#J.format.isLine(t)),null),o=n.indexOf(s),l=n.indexOf(i);if(-1===o||-1===l)return null;const r=n.slice(Math.min(o,l),Math.max(o,l)+1);return-1===r.indexOf(t)?null:r}catch{}return null}#zn(t){this.#Rn(),this.#pn=t||[];for(let t=0;t<this.#pn.length;t++)Ve.utils.addClass(this.#pn[t],"se-block-hover")}#Rn(){this.#an&&Ve.utils.removeClass(this.#an,"se-block-hover");for(let t=0;t<this.#pn.length;t++)Ve.utils.removeClass(this.#pn[t],"se-block-hover");this.#pn=[]}#In(){this.#un||(this.#un=cn.setTimeout((()=>{this.#un=null,this.#Nn(),this.#rn?.close(),this.#Vn(null)}),200))}#An(){this.#un&&(cn.clearTimeout(this.#un),this.#un=null)}#kn(t){if(!this.#J)return;if(this.#gn)return;if(this.#An(),this.#rn?.isOpen)return;const e=this.#J.frameContext.get("wysiwyg");if(!e)return;const s=this.#J.frameContext.get("wysiwygFrame");let i;if(s&&"IFRAME"===s.nodeName){const e=s.getBoundingClientRect(),n=s.contentDocument;n&&(i=n.elementFromPoint(e.width/2,t.clientY-e.top))}else{const s=e.getBoundingClientRect();i=document.elementFromPoint(s.left+s.width/2,t.clientY)}i&&e.contains(i)&&this.#Bn(i,t.clientY)}#Sn(t){this.#rn?.isOpen||this.#Dn(t?.relatedTarget)||this.hideNow()}#En(t){this.#rn?.isOpen||this.#Dn(t?.relatedTarget)||this.hideNow()}#Dn(t){if(!t)return!1;const e=this.#sn?.parentElement;return!(!this.#in?.contains(t)&&!e?.contains(t))}#Bn(t,e){if(!this.#J)return;const s=this.#J.format,i=this.#J.frameContext.get("wysiwyg");if(!i)return;let n=t;if(n===i&&void 0!==e){const t=i.getBoundingClientRect(),s=document.elementFromPoint(t.left+t.width/2,e);s&&i.contains(s)&&s!==i&&(n=s)}const o=rn(n,{getLine:(t,e)=>s.getLine(t,e),getBlock:(t,e)=>s.getBlock(t,e),isLine:t=>s.isLine(t),isBlock:t=>s.isBlock(t)},i,e);if(o){if(o.element!==this.#an||"flex"!==this.#in.style.display){if(this.#an?.isConnected&&"flex"===this.#in.style.display&&void 0!==e&&!this.#an.contains(o.element)){const t=this.#an.getBoundingClientRect();if(e>=t.top&&e<=t.bottom)return}this.#Vn(o.element),this.#On(o.element)}}else this.#In()}#On(t){if(!t.isConnected)return void this.hideNow();const e=t.getBoundingClientRect(),s=this.#sn.getBoundingClientRect(),i=this.#J.frameContext.get("wysiwygFrame"),n=/^iframe$/i.test(i.nodeName),o=n?i.getBoundingClientRect():null;if(n){const t=i.clientHeight||0;if(e.bottom<=0||e.top>=t)return void this.#Nn()}else{const t=i.getBoundingClientRect();if(e.bottom<=t.top||e.top>=t.bottom)return void this.#Nn()}const l=cn.scrollX,r=cn.scrollY,a="flex"!==this.#in.style.display;a&&(Ve.utils.addClass(this.#in,"se-no-transition"),this.#in.style.display="flex");const h=this.#in.offsetHeight||0,c=this.#Fn(t,e),d=(n?c+o.top:c)+r-h/2,u=!!this.#J.options.get("_rtl"),p=this.#qn(t,u);let g=0;if(this.#J.frameOptions.get("innerWidth")){const t=this.#J.frameContext.get("wysiwyg");if(t){const e=cn.getComputedStyle(t),s=Oe.get(u?e.paddingRight:e.paddingLeft,-1)||0,i=function(t,e){const s=(t||"").trim(),i=Oe.get(s,-1);return i?/rem$/.test(s)?i*(Oe.get(cn.getComputedStyle(dn.documentElement).fontSize,-1)||16):/em$/.test(s)?i*(Oe.get(e.fontSize,-1)||16):i:0}(e.getPropertyValue("--se-edit-inner-padding"),e);g=Math.max(0,s-i)}}const m=p+g;this.#in.style.top=d+"px",u?(this.#in.style.left="",this.#in.style.right=cn.innerWidth-s.right-l+m+"px"):(this.#in.style.right="",this.#in.style.left=s.left+l+m+"px"),this.#Ln(),a&&(this.#in.offsetHeight,Ve.utils.removeClass(this.#in,"se-no-transition"))}#Fn(t,e){try{const e=t.ownerDocument,s=e.createTreeWalker(t,NodeFilter.SHOW_TEXT,null);let i=null;for(;(i=s.nextNode())&&!i.textContent?.trim(););if(i){const t=e.createRange();t.setStart(i,0),t.setEnd(i,Math.min(1,i.length));const s=t.getClientRects();if(s.length)return(s[0].top+s[0].bottom)/2}}catch{}const s=Oe.get(cn.getComputedStyle(t).lineHeight,-1)||e.height;return e.top+Math.min(s,e.height)/2}#qn(t,e){const s=this.#J.frameContext.get("wysiwyg");if(!s)return 0;const i=this.#J.format,n=e?"marginRight":"marginLeft",o=e?"paddingRight":"paddingLeft";let l=0;l+=Oe.get(cn.getComputedStyle(t)[n],-1)||0;let r=t.parentElement;for(;r&&r!==s;){if(i.isBlock(r)){const t=cn.getComputedStyle(r);l+=(Oe.get(t[o],-1)||0)+(Oe.get(t[n],-1)||0)}r=r.parentElement}return l}#Wn(){if(!this.#an)return;const t=this.#an,e=this.#Pn(t),s=e?e[0]:t,i=e?e[e.length-1]:t;this.#J.selection.setRange(s,0,i,i.childNodes.length)}#wn(t){if(t.preventDefault(),t.stopPropagation(),!this.#an)return;const e=this.#J.format.addLineAfter(this.#an);e&&(this.#J.selection.setRange(e,1,e,1),this.#J.history.push(!1))}#Cn(t){const e=this.#on&&(t.target===this.#on||this.#on.contains(t.target));Ae.isMobile?this.#J.store.set("_preventBlur",!0):e||t.preventDefault()}#Hn(){this.#Rn()}#_n(t){if(!this.#an)return void t.preventDefault();this.#fn=this.#an,this.#gn=!0,this.#rn?.close(),Ve.utils.addClass(this.#fn,"se-block-dragging");const e=this.#J.frameContext.get("wysiwyg");this.#bn=e||null,this.#yn=e?Array.from(e.children):null;const s=!!this.#J.options.get("_rtl"),i=this.#fn;t.dataTransfer.setDragImage(i,s?i.offsetWidth:-5,-5),t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("application/x-suneditor-block-drag","1")}#Tn(t){this.#gn&&(t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect="move",this.#Un(t.clientY))}#Mn(t){this.#gn&&(t.preventDefault(),t.stopPropagation(),this.#Zn())}#xn(){if(this.#fn&&Ve.utils.removeClass(this.#fn,"se-block-dragging"),this.#mn.style.display="none",this.#gn=!1,this.#fn=null,this.#vn=null,this.#bn=null,this.#yn=null,this.#on?.parentNode){const t=this.#on.parentNode,e=this.#on.nextSibling;t.removeChild(this.#on),t.insertBefore(this.#on,e)}}#Un(t){if(!this.#J||!this.#fn)return;const e=this.#bn,s=this.#yn;if(!e||!s)return;const i=e.getBoundingClientRect(),n=this.#sn.parentElement.getBoundingClientRect();let o=null,l="after",r=0,a=1/0;for(let e=0;e<s.length;e++){const i=s[e],n=i.getBoundingClientRect(),h=Math.abs(t-n.top);h<a&&(a=h,o=i,l="before",r=n.top);const c=Math.abs(t-n.bottom);c<a&&(a=c,o=i,l="after",r=n.bottom)}if(o&&o!==this.#fn){this.#vn={element:o,position:l};const t=this.#mn;t.style.display="block",t.style.top=r-n.top+"px",t.style.left=i.left-n.left+"px",t.style.width=i.width+"px"}else this.#vn=null,this.#mn.style.display="none"}#Zn(){const t=this.#fn,e=this.#vn;if(!t||!e||e.element===t)return;t.parentNode&&("before"===e.position?e.element.parentNode.insertBefore(t,e.element):e.element.parentNode.insertBefore(t,e.element.nextSibling),this.#Vn(t),this.#On(t),this.#J.history.push(!1))}#$n(t){if(t.preventDefault(),t.stopPropagation(),!this.#gn&&this.#ln)if(this.#rn||(this.#rn=this.#Gn()),this.#rn.isOpen)this.#rn.close();else{this.#Wn();const t=this.#J.format.getLines(null);t.length>0&&this.#zn(t);const e=this.#J.offset.getGlobal(this.#on),s=Ve.utils.getClientSize().h-(e.top-cn.scrollY+e.height),i=e.top-cn.scrollY,n=`${this.#J.options.get("_rtl")?"left":"right"}-${s>=i?"bottom":"top"}`;this.#rn.open(n)}}#Gn(){const t=new hn(this,this.#J,{items:this.#ln,resolveButton:hs,selectMenuParams:{position:"right-top",dir:this.#J.options.get("_rtl")?"rtl":"ltr",minWidth:"200px",keydownTarget:cn,closeMethod:()=>{Ve.utils.removeClass(this.#on,"on"),this.#Rn()},openMethod:()=>{Ve.utils.addClass(this.#on,"on")}}});return t.attach(this.#on,this.#jn.bind(this),{class:"se-block-action-menu"}),t.createRows(t.getItems()),t}#jn(t){this.#an&&this.#J&&t&&(this.#rn?.dispatch(t,{block:this.#an}),"dropdownFree"!==t.kind&&this.#rn?.close())}},{NO_EVENT:pn}=Ae,gn={bold:["font-weight"],underline:["text-decoration"],italic:["font-style"],strike:["text-decoration"]};class mn{#D;#J;#t;#Y;#ot;#mi;#Kn=null;#Yn=null;#Xn=null;#Jn=null;constructor(t){this.#D=t,this.#J=t.$,this.#t=t.store,this.#Y=this.#J.frameContext,this.#ot=this.#J.options,this.#mi=this.#J.eventManager}async execute(t,e){if(!this.#Y.get("isReadOnly")||/copy|cut|selectAll|selectAll_full|codeView|markdownView|fullScreen|print|preview|showBlocks|finder/.test(t))switch(t){case"selectAll":this.#Qn();break;case"selectAll_full":this.#to();break;case"copy":{const t=this.#J.selection.getRange();if(t.collapsed)break;const e=Ve.utils.createElement("div",null,t.cloneContents());await this.#J.html.copy(e.innerHTML);break}case"newDocument":this.#J.html.set(`<${this.#ot.get("defaultLine")}><br></${this.#ot.get("defaultLine")}>`),this.#J.focusManager.focus(),this.#J.history.push(!1),this.#Y.has("documentType_use_header")&&this.#Y.get("documentType").reHeader();break;case"finder":this.#J.finder.open(!0);break;case"codeView":this.#J.viewer.codeView(!this.#Y.get("isCodeView"));break;case"markdownView":this.#J.viewer.markdownView(!this.#Y.get("isMarkdownView"));break;case"fullScreen":this.#J.viewer.fullScreen(!this.#Y.get("isFullScreen"));break;case"indent":this.#J.format.indent();break;case"outdent":this.#J.format.outdent();break;case"undo":this.#J.history.undo();break;case"redo":this.#J.history.redo();break;case"removeFormat":this.#J.inline.remove(),this.#J.focusManager.focus();break;case"print":this.#J.viewer.print();break;case"preview":this.#J.viewer.preview();break;case"showBlocks":this.#J.viewer.showBlocks(!this.#Y.get("isShowBlocks"));break;case"dir":this.#J.ui.setDir(this.#ot.get("_rtl")?"ltr":"rtl");break;case"dir_ltr":this.#J.ui.setDir("ltr");break;case"dir_rtl":this.#J.ui.setDir("rtl");break;case"save":await this.#eo();break;case"copyFormat":this.#so(e);break;case"pageBreak":this.#io();break;case"pageUp":this.#Y.get("documentType").pageUp();break;case"pageDown":this.#Y.get("documentType").pageDown();break;default:this.#no(t)}}copyFormat(){if(this.#Xn?.length)try{const t=[...this.#Xn],e=t.pop();if(this.#J.inline.remove(),e){const s=this.#J.inline.apply(e,{stylesToModify:null,nodesToRemove:[e.nodeName],strictRemove:!1}),{parent:i,inner:n}=this.#J.nodeTransform.createNestedNode(t);s.parentNode.insertBefore(i,s),n.appendChild(s),this.#J.selection.setRange(s,Ve.check.isZeroWidth(s)?1:0,s,1)}if(this.#ot.get("copyFormatKeepOn"))return;this.#Jn()}catch(t){console.warn("[SUNEDITOR.copyFormat.error] ",t),this.#Jn?.()||(this.#Xn=null,this.#Jn=null)}}#Qn(){this.#J.ui.offCurrentController(),this.#J.menu.containerOff();const t=this.#Y.get("wysiwyg");let e=null,s="";const i=this.#ot.get("scopeSelectionTags"),n=this.#J.selection.getRange();if(!n.collapsed){let o=e=n.commonAncestorContainer,l=s=o.nodeName?.toLowerCase();if(0===n.startOffset&&n.endOffset===n.endContainer.textContent?.length){const t=o.parentElement;(Ve.check.isList(t)||Ve.check.isListCell(t))&&t.firstChild.contains?.(n.startContainer)&&t.lastChild?.contains(n.endContainer)&&(e=o=t.parentElement,s=o.nodeName?.toLowerCase())}for(l=o.nodeName?.toLowerCase();o&&(!o.nextSibling&&!o.previousSibling&&!i.includes(l)||Ve.check.isContentLess(l))&&o!==t;)o=o.parentElement,l=o.nodeName?.toLowerCase();i.includes(l)&&(e=o,s=l)}const o=i.filter((t=>t!==s));let l=Ve.query.getParentElement(e||this.#J.selection.getNode(),(t=>o.includes(t.nodeName?.toLowerCase())))||t,{first:r,last:a}=fn(l);if(!r||!a)return;const h=Ve.check.isZeroWidth;for(;h(r)&&h(a)&&l!==t;)l=l.parentElement,({first:r,last:a}=fn(Ve.query.getParentElement(l,(t=>o.includes(t.nodeName?.toLowerCase())))||t));if(!r||!a)return;let c=null;if(Ve.check.isMedia(r)||(c=this.#J.component.get(r))||Ve.check.isTableElements(r)){c||=this.#J.component.get(r);const t=Ve.utils.createElement("BR"),e=Ve.utils.createElement(this.#ot.get("defaultLine"),null,t);r=c?c.container||c.cover:r,r.parentElement.insertBefore(e,r),r=t}if(Ve.check.isMedia(a)||(c=this.#J.component.get(a))||Ve.check.isTableElements(a)){c||=this.#J.component.get(a);const t=Ve.utils.createElement("BR"),e=Ve.utils.createElement(this.#ot.get("defaultLine"),null,t);a=c?c.container||c.cover:a,a.parentElement.appendChild(e),a=t}this.#J.toolbar._showBalloon(this.#J.selection.setRange(r,0,a,a.textContent.length))}#to(){this.#J.ui.offCurrentController(),this.#J.menu.containerOff();const t=this.#Y.get("wysiwyg");let{first:e,last:s}=fn(t);if(!e||!s)return;let i=null;if(Ve.check.isMedia(e)||(i=this.#J.component.get(e))||Ve.check.isTableElements(e)){i||=this.#J.component.get(e);const t=Ve.utils.createElement("BR"),s=Ve.utils.createElement(this.#ot.get("defaultLine"),null,t);e=i?i.container||i.cover:e,e.parentElement.insertBefore(s,e),e=t}if(Ve.check.isMedia(s)||(i=this.#J.component.get(s))||Ve.check.isTableElements(s)){i||=this.#J.component.get(s);const t=Ve.utils.createElement("BR"),e=Ve.utils.createElement(this.#ot.get("defaultLine"),null,t);s=i?i.container||i.cover:s,s.parentElement.appendChild(e),s=t}this.#J.toolbar._showBalloon(this.#J.selection.setRange(e,0,s,s.textContent.length))}async#eo(){const t=this.#Y;if(!t.get("isChanged"))return;const e=this.#J.html.get(),s=await this.#mi.triggerEvent("onSave",{frameContext:t,data:e});if(s===pn){const s=t.get("originElement");/^TEXTAREA$/i.test(s.nodeName)?s.value=e:s.innerHTML=e}else if(!1===s)return;t.set("isChanged",!1),t.set("savedIndex",this.#J.history.getRootStack()[this.#t.get("rootKey")].index),this.#J.commandDispatcher.applyTargets("save",(t=>{t.disabled=!0}))}#so(t){if("function"==typeof this.#Jn)return void this.#Jn();const e=this.#Y.get("wysiwyg");this.#Xn=[...this.#D._eventOrchestrator.__cacheStyleNodes],this.#Jn=this.#oo.bind(this,this.#mi,e,t),Ve.utils.addClass(e,"se-copy-format-cursor"),Ve.utils.addClass(t,"on"),this.#Kn=this.#mi.addGlobalEvent("keydown",(t=>{Re.isEsc(t.code)&&this.#Jn?.()})),this.#Yn=this.#mi.addGlobalEvent("mousedown",(s=>{e.contains(s.target)||s.target===t||this.#Jn?.()}))}#oo(t,e,s){return this.#Kn=t.removeGlobalEvent(this.#Kn),this.#Yn=t.removeGlobalEvent(this.#Yn),this.#Xn=null,this.#Jn=null,Ve.utils.removeClass(e,"se-copy-format-cursor"),Ve.utils.removeClass(s,"on"),!0}#no(t){t=this.#ot.get("_defaultTagCommand")[t.toLowerCase()]||t;let e=this.#ot.get("convertTextTags")[t]||t;const s=this.#t.get("currentNodesMap"),i=s.includes(this.#ot.get("_styleCommandMap")[e])?null:Ve.utils.createElement(e);/^sub$/i.test(e)&&s.includes("superscript")?e="sup":/^sup$/i.test(e)&&s.includes("subscript")&&(e="sub"),this.#J.inline.apply(i,{stylesToModify:gn[t]||null,nodesToRemove:[e],strictRemove:!1}),this.#J.focusManager.focus()}#io(){const t=Ve.utils.createElement("DIV",{class:"se-component se-component-line-break se-page-break"});this.#J.component.insert(t,{skipCharCount:!0,insertBehavior:"line"});const e=t.nextElementSibling||this.#J.format.addLine(t);this.#J.selection.setRange(e,1,e,1),this.#J.history.push(!1)}}const fn=function(t){const e=Ve.check.isContentLess;return{first:Ve.query.getEdgeChild(Ve.query.getEdgeChild(t,(t=>!e(t)),!1),(t=>0===t.childNodes.length||3===t.nodeType||K(t)||j(t)),!1)||t.firstChild,last:Ve.query.getEdgeChild(t.lastChild,(t=>0===t.childNodes.length||3===t.nodeType||K(t)||j(t)),!0)||t.lastChild}},vn=".se-menu-list .se-toolbar-btn[data-command]",bn=["bold","underline","italic","strike","subscript","superscript","indent","outdent"],yn=bn.concat(["undo","redo","save","fullScreen","showBlocks","codeView","markdownView","finder","dir","dir_ltr","dir_rtl"]);class Cn{#J;#e;#ot;#lo;#ro=new Map;#ao=bn;constructor(t){this.#J=t.$,this.#e=this.#J.context,this.#ot=this.#J.options,this.#lo=new mn(t),this.allCommandButtons=new Map,this.subAllCommandButtons=new Map}get targets(){return this.#ro}get activeCommands(){return this.#ao}run(t,e,s){if(e){if(/more/i.test(e)){const e=Ve.query.getParentElement(s,".se-toolbar"),i=Ve.utils.hasClass(e,"se-toolbar-sub")?this.#J.subToolbar:this.#J.toolbar;if(s!==i.currentMoreLayerActiveButton){const n=e.querySelector("."+t);n&&(i._moreLayerOn(s,n),i._showBalloon(),i._showInline()),Ve.utils.addClass(s,"on")}else i.currentMoreLayerActiveButton&&(i._moreLayerOff(),i._showBalloon(),i._showInline());return void this.#J.viewer._resetFullScreenHeight()}if(/container/.test(e)&&(null===this.#J.menu.targetMap[t]||s!==this.#J.menu.currentContainerActiveButton))return void this.#J.menu.containerOn(s);if(this.#J.ui.isButtonDisabled(s))return;if(/dropdown/.test(e)&&(null===this.#J.menu.targetMap[t]||s!==this.#J.menu.currentDropdownActiveButton))return void this.#J.menu.dropdownOn(s);if(/modal/.test(e))return void this.#J.plugins[t].open(s);/command/.test(e)?this.#J.plugins[t].action(s):/browser/.test(e)?this.#J.plugins[t].open(null):/popup/.test(e)&&this.#J.plugins[t].show()}else t&&this.#lo.execute(t,s);/dropdown/.test(e)?this.#J.menu.dropdownOff():/command/.test(e)||(this.#J.menu.dropdownOff(),this.#J.menu.containerOff())}runFromTarget(t){if(Ve.check.isInputElement(t))return;const e=Ve.query.getCommandTarget(t);if(!e)return;const s=e.getAttribute("data-command"),i=e.getAttribute("data-type");(s||i)&&(e.disabled||this.run(s,i,t))}applyTargets(t,e){this.#ro.has(t)&&this.#ro.get(t).forEach(e)}registerTargets(t,e){if(!t||!e)return;(yn.includes(t)||this.#J.plugins[t])&&(this.#ro.get(t)?this.#ro.get(t).includes(e)||this.#ro.get(t).push(e):this.#ro.set(t,[e]))}unregisterTargets(t,e){const s=this.#ro.get(t);if(!s)return;const i=s.indexOf(e);-1!==i&&s.splice(i,1),0===s.length&&this.#ro.delete(t)}resetTargets(){this.#ro=new Map,this._initCommandButtons()}_initCommandButtons(){const t=this.#e;this.#ho(this.allCommandButtons,t.get("toolbar_buttonTray")),this.#ho(this.subAllCommandButtons,t.get("toolbar_sub_buttonTray"))}_copyFormat(){this.#lo.copyFormat()}#ho(t,e){if(!e)return;const s=e.querySelectorAll(vn),i=this.#ot.get("shortcuts"),n=this.#ot.get("_reverseCommandArray"),o=this.#J.shortcuts.keyMap,l=this.#J.shortcuts.reverseKeys;for(let e,r,a=0,h=s.length;a<h;a++)e=s[a],r=e.getAttribute("data-command"),t.set(r,e),this.registerTargets(r,e),ts(r,e,i[r],o,n,l)}_destroy(){this.#ro.clear(),this.allCommandButtons.clear(),this.subAllCommandButtons.clear(),this.#ao=null}}const wn=`${vn}:not([class~="se-code-view-enabled"]):not([data-type="MORE"])`,_n=`${vn}:not([class~="se-component-enabled"]):not([data-type="MORE"])`,{_w:xn}=Ae;const $n=class{#D;#J;#t;#gi;#nt;#ot;#e;#I;#Y;#mi;#co;#do;#uo;#po;#go=null;#mo;#fo=!1;#vo=null;#bo=null;#yo=[];#Co=[];#wo=!1;#_o=null;#xo=null;#$o=null;constructor(t){this.#D=t,this.#J=t.$,this.#t=t.store,this.#gi=this.#J.contextProvider,this.#nt=this.#gi.carrierWrapper,this.#ot=this.#J.options,this.#e=this.#J.context,this.#I=this.#J.frameRoots,this.#Y=this.#J.frameContext,this.#mi=this.#J.eventManager;const e=function({lang:t,icons:e}){const s='<div><button type="button" class="close" data-command="close" title="'+t.close+'">'+e.cancel+"</button></div><div><span></span></div>";return Ve.utils.createElement("DIV",{class:"se-alert-content"},s)}(this.#gi);this.alertModal=e,this.alertMessage=e.querySelector("span");const s=function(){const t='<div class="se-toast-container"><span></span></div>';return Ve.utils.createElement("DIV",{class:"se-toast"},t)}();s.setAttribute("popover","manual"),this.toastPopup=s,this.toastContainer=s.querySelector(".se-toast-container"),this.toastMessage=s.querySelector("span"),this.#nt.appendChild(s),this.#co=this.#nt.querySelector(".se-alert"),this.#do=this.#nt.querySelector(".se-alert .se-modal-inner"),this.#do.appendChild(e),this.#uo=[this.#ko.bind(this),this.#So.bind(this)],this.#po=!1,this.#mo=this.#nt.querySelector(".se-back-wrapper"),this.selectMenuOn=!1,this.opendControllers=[],this.controllerTargetContext=null,this._figureContainer=null}setEditorStyle(t,e){e||=this.#Y;const s=e.get("options");s.set("editorStyle",t);const i=Ie._setDefaultOptionStyle(s,t);s.set("_defaultStyles",i),e.get("topArea").style.cssText=i.top;const n=e.get("code");if(this.#ot.get("hasCodeMirror")){const t=s.get("_defaultStyles").frame.split(";");for(let e,s=0,i=t.length;s<i;s++){if(e=t[s].trim(),!e)continue;const[i,o]=e.split(":");n.style.setProperty(i.trim(),o.trim())}}else n.style.cssText=s.get("_defaultStyles").frame;s.get("iframe")?(e.get("wysiwygFrame").style.cssText=i.frame,e.get("wysiwyg").style.cssText=i.editor):e.get("wysiwygFrame").style.cssText=i.frame+i.editor}setTheme(t){if("string"!=typeof t)return;const e=this.#ot,s=e.get("_themeClass").trim();e.set("theme",t||""),e.set("_themeClass",t?` se-theme-${t}`:""),t=e.get("_themeClass").trim();const i=e=>{e&&(s&&Ve.utils.removeClass(e,s),t&&Ve.utils.addClass(e,t))};i(this.#nt),this.#gi.applyToRoots((t=>{i(t.get("topArea")),i(t.get("wysiwyg"))})),i(this.#e.get("statusbar_wrapper")),i(this.#e.get("toolbar_wrapper"))}setDir(t){const e="rtl"===t;if(this.#ot.get("_rtl")===e)return;const s=this.#ot.get("textDirection"),i=this.#ot.get("_editableClass"),n=this.#ot.get("printClass");try{this.#ot.set("_rtl",e),this.#ot.set("textDirection",t);const s=e?this.#ot.get("_editableClass").replace(/\s*se-rtl/,"")+" se-rtl":this.#ot.get("_editableClass").replace(/\s*se-rtl/,"");this.#ot.set("_editableClass",s),this.#ot.get("printClass")&&this.#ot.set("printClass",e?this.#ot.get("printClass").replace(/\s*se-rtl/,"")+" se-rtl":this.#ot.get("printClass").replace(/\s*se-rtl/,"")),this.offCurrentController();const i=this.#Y,n=this.#J.pluginManager.plugins;for(const e in n)n[e].setDir?.(t);const o=this.#e.get("toolbar_wrapper"),l=this.#e.get("statusbar_wrapper");e?(this.#gi.applyToRoots((t=>{Ve.utils.addClass([t.get("topArea"),t.get("wysiwyg"),t.get("documentTypePageMirror")],"se-rtl"),t.get("wysiwyg").dir="rtl"})),Ve.utils.addClass([this.#nt,o,l],"se-rtl")):(this.#gi.applyToRoots((t=>{Ve.utils.removeClass([t.get("topArea"),t.get("wysiwyg"),t.get("documentTypePageMirror")],"se-rtl"),t.get("wysiwyg").removeAttribute("dir")})),Ve.utils.removeClass([this.#nt,o,l],"se-rtl"));const r=Ve.query.getListChildren(i.get("wysiwyg"),(t=>this.#J.format.isLine(t)&&!!(t.style.marginRight||t.style.marginLeft||t.style.textAlign)),null);for(let t,e,s,i=0;t=r[i];i++)t=r[i],s=t.style.marginRight,e=t.style.marginLeft,(s||e)&&(t.style.marginRight=e,t.style.marginLeft=s),s=t.style.textAlign,"left"===s?t.style.textAlign="right":"right"===s&&(t.style.textAlign="left");this.#Eo(e),this.#To(this.#e.get("toolbar_buttonTray")),this.#e.has("toolbar_sub_buttonTray")&&this.#To(this.#e.get("toolbar_sub_buttonTray")),this.#t.mode.isBalloon?this.#J.toolbar._showBalloon():this.#t.mode.isSubBalloon&&this.#J.subToolbar._showBalloon()}catch(t){this.#ot.set("_rtl",!e),this.#ot.set("textDirection",s),this.#ot.set("_editableClass",i),null!==n&&this.#ot.set("printClass",n),console.warn(`[SUNEDITOR.ui.setDir.fail] ${t.toString()}`)}this.#t.set("_lastSelectionNode",null),this.#D._eventOrchestrator.applyTagEffect()}readOnly(t,e){const s=e?this.#I.get(e):this.#Y;s.set("isReadOnly",!!t),this._toggleControllerButtons(!!t),t?(this.offCurrentController(),this.offCurrentModal(),this.#J.toolbar?.currentMoreLayerActiveButton?.disabled&&this.#J.toolbar._moreLayerOff(),this.#J.subToolbar?.currentMoreLayerActiveButton?.disabled&&this.#J.subToolbar._moreLayerOff(),this.#J.menu?.currentDropdownActiveButton?.disabled&&this.#J.menu.dropdownOff(),this.#J.menu?.currentContainerActiveButton?.disabled&&this.#J.menu.containerOff(),s.get("code").setAttribute("readOnly","true"),Ve.utils.addClass(s.get("wysiwyg"),"se-read-only")):(s.get("code").removeAttribute("readOnly"),Ve.utils.removeClass(s.get("wysiwyg"),"se-read-only")),this.#ot.get("hasCodeMirror")&&this.#J.viewer._codeMirrorEditor("readonly",!!t,e)}disable(t){const e=t?this.#I.get(t):this.#Y;this.#J.toolbar.disable(),this.offCurrentController(),this.offCurrentModal(),e.get("wysiwyg").setAttribute("contenteditable","false"),e.set("isDisabled",!0),this.#ot.get("hasCodeMirror")?this.#J.viewer._codeMirrorEditor("readonly",!0,t):e.get("code").disabled=!0}enable(t){const e=t?this.#I.get(t):this.#Y;this.#J.toolbar.enable(),e.get("wysiwyg").setAttribute("contenteditable","true"),e.set("isDisabled",!1),this.#ot.get("hasCodeMirror")?this.#J.viewer._codeMirrorEditor("readonly",!1,t):e.get("code").disabled=!1}show(t){const e=(t?this.#I.get(t):this.#Y).get("topArea").style;"none"===e.display&&(e.display="block")}hide(t){(t?this.#I.get(t):this.#Y).get("topArea").style.display="none"}showLoading(t){const e=(t?this.#I.get(t).get("container"):this.#nt).querySelector(".se-loading-box");e.style.display="block",e.showPopover?.()}hideLoading(t){const e=(t?this.#I.get(t).get("container"):this.#nt).querySelector(".se-loading-box");e.hidePopover?.(),e.style.display="none"}alertOpen(t,e){this.alertMessage.textContent=t,Ve.utils.removeClass(this.alertModal,"se-alert-error|se-alert-success"),e&&Ve.utils.addClass(this.alertModal,`se-alert-${e}`),this.#po&&(this.#go=this.#mi.addEvent(this.#do,"click",this.#uo[1])),this.#vo&&=this.#mi.removeGlobalEvent(this.#vo),this.#vo=this.#mi.addGlobalEvent("keydown",this.#uo[0]),this.#co.style.display="block",this.#co.showPopover?.(),Ve.utils.addClass(this.alertModal,"se-modal-show")}alertClose(){Ve.utils.removeClass(this.alertModal,"se-modal-show"),Ve.utils.removeClass(this.alertModal,"se-alert-*"),this.#co.hidePopover?.(),this.#co.style.display="none",this.#go&&=this.#mi.removeEvent(this.#go),this.#vo&&=this.#mi.removeGlobalEvent(this.#vo)}showToast(t,e=1e3,s){Ve.utils.hasClass(this.toastContainer,"se-toast-show")&&this.closeToast(),Ve.utils.removeClass(this.toastPopup,"se-toast-error|se-toast-success"),s&&Ve.utils.addClass(this.toastPopup,`se-toast-${s}`),this.toastPopup.style.display="block",this.toastPopup.showPopover?.(),this.toastMessage.textContent=t,Ve.utils.addClass(this.toastContainer,"se-toast-show"),this.#bo=xn.setTimeout((()=>{this.closeToast()}),e)}closeToast(){this.#bo&&xn.clearTimeout(this.#bo),this.#bo=null,Ve.utils.removeClass(this.toastContainer,"se-toast-show"),this.toastPopup.hidePopover?.(),this.toastPopup.style.display="none"}setControllerOnDisabledButtons(t){return t&&!this.#fo?(this._toggleControllerButtons(!0),this.#fo=!0):!t&&this.#fo&&(this._toggleControllerButtons(!1),this.#fo=!1),this.#fo}onControllerContext(){this.controllerTargetContext=this.#Y.get("topArea")}offControllerContext(){this.controllerTargetContext=null}enableBackWrapper(t){this.#mo.style.cursor=t,this.#mo.style.display="block",this.#mo.showPopover?.()}disableBackWrapper(){this.#mo.hidePopover?.(),this.#mo.style.display="none",this.#mo.style.cursor="default"}offCurrentController(){this.#J.component.__deselect()}offCurrentModal(){this.opendModal?.close()}getVisibleFigure(){return"block"===this._figureContainer?.style.display?this._figureContainer:null}setFigureContainer(t){this._figureContainer=t}preventToolbarHide(t){this.#wo=t}get isPreventToolbarHide(){return this.#wo}get blockHandle(){return this.#$o}reset(t){t.set("_editorHeight",t.get("wysiwygFrame").offsetHeight),this.#_o=t.get("lineBreaker_t"),this.#xo=t.get("lineBreaker_b");const e=this.#ot.get("blockHandle");e&&t.get("blockHandleArea")&&!this.#$o&&(this.#$o=new un(this.#J,t.get("blockHandleArea"),t.get("blockHandle"),t.get("blockHandlePlus"),t.get("blockHandleDrag"),e.menu))}_offControllers(){const t=this.opendControllers,e=[];for(let s,i=0;i<t.length;i++)s=t[i],s.fixed?e.push(s):(s.inst.controllerClose?.(),s.form&&(s.form.style.display="none"));this.opendControllers=e,this.currentControllerName="",this.#t.set("_preventBlur",!1)}_syncScrollPosition(t){const e=t.scrollTop||t.scrollY||0,s=t.scrollLeft||t.scrollX||0;this.#t.mode.isBalloon&&"block"===this.#e.get("toolbar_main").style.display?(this.#e.get("toolbar_main").style.top=this.#J.toolbar.balloonOffset.top-e+"px",this.#e.get("toolbar_main").style.left=this.#J.toolbar.balloonOffset.left-s+"px"):this.#t.mode.isSubBalloon&&"block"===this.#e.get("toolbar_sub_main").style.display&&(this.#e.get("toolbar_sub_main").style.top=this.#J.subToolbar.balloonOffset.top-e+"px",this.#e.get("toolbar_sub_main").style.left=this.#J.subToolbar.balloonOffset.left-s+"px"),this.#$o?.syncScroll(),this.controllerTargetContext!==this.#Y.get("topArea")&&this.offCurrentController(),this.#Mo(s,e)}_repositionControllers(){const t=this.opendControllers;if(0!==t.length){yi.get("__dragMove")&&yi.get("__dragMove")();for(let e=0;e<t.length;e++)t[e].notInCarrier||t[e].inst?._scrollReposition()}}#Mo(t,e){if(this.#_o){const s=this.#_o.style;if("none"!==s.display){const i=(this.#_o.getAttribute("data-offset")||",").split(",");s.top=Oe.get(s.top,0)-(e-Oe.get(i[0],0))+"px",s.left=Oe.get(s.left,0)-(t-Oe.get(i[1],0))+"px",this.#_o.setAttribute("data-offset",e+","+t)}}if(this.#xo){const s=this.#xo.style;if("none"!==s.display){const i=(this.#xo.getAttribute("data-offset")||",").split(",");s.top=Oe.get(s.top,0)-(e-Oe.get(i[0],0))+"px",s[i[1]]=Oe.get(s[i[1]],0)-(t-Oe.get(i[2],0))+"px",this.#xo.setAttribute("data-offset",e+","+i[1]+","+t)}}const s=this.opendControllers;for(let i=0;i<s.length;i++)s[i].notInCarrier&&(s[i].form.style.top=s[i].inst.__offset.top-e+"px",s[i].form.style.left=s[i].inst.__offset.left-t+"px")}_visibleControllers(t,e){const s=t?"":"hidden",i=e??s?"":"hidden",n=this.opendControllers;for(let t,e=0;e<n.length;e++)t=n[e],t.form&&(t.form.style.visibility=s);this.#_o.style.visibility=i,this.#xo.style.visibility=i}setCurrentControllerContext;#Eo(t){const e=this.#gi.icons,s=this.#J.commandDispatcher?.targets;if(!s)return;const i=this.#J.shortcuts?.keyMap;this.#J.shortcuts?.reverseKeys?.forEach((t=>{const e=i?.get(t);e&&([e.command,e.r]=[e.r,e.command])})),this.#J.commandDispatcher.applyTargets("dir",(s=>{Ve.utils.changeTxt(s.querySelector(".se-tooltip-text"),this.#gi.lang[t?"dir_ltr":"dir_rtl"]),Ve.utils.changeElement(s.firstElementChild,e[t?"dir_ltr":"dir_rtl"])})),t?(Ve.utils.addClass(s.get("dir_rtl"),"active"),Ve.utils.removeClass(s.get("dir_ltr"),"active")):(Ve.utils.addClass(s.get("dir_ltr"),"active"),Ve.utils.removeClass(s.get("dir_rtl"),"active"))}#To(t){if(!t)return;const e=t.querySelector(".se-toolbar-more-layer"),s=Array.from(t.children).filter((t=>t!==e));for(let e=s.length-1;e>=0;e--)t.appendChild(s[e]);e&&t.appendChild(e)}_initToggleButtons(){const t=this.#e;this.#Co=Ie.nodeListToArray(t.get("toolbar_buttonTray").querySelectorAll(wn)),this.#yo=Ie.nodeListToArray(t.get("toolbar_buttonTray").querySelectorAll(_n)),this.#ot.has("_subMode")&&(this.#Co=this.#Co.concat(Ie.nodeListToArray(t.get("toolbar_sub_buttonTray").querySelectorAll(wn))),this.#yo=this.#yo.concat(Ie.nodeListToArray(t.get("toolbar_sub_buttonTray").querySelectorAll(_n))))}_toggleCodeViewButtons(t){Ve.utils.setDisabled(this.#Co,t)}_toggleControllerButtons(t){Ve.utils.setDisabled(this.#yo,t)}isButtonDisabled(t){return!(!this.#Y.get("isReadOnly")||!Ve.utils.arrayIncludes(this.#yo,t))}_updatePlaceholder(t){t||=this.#Y;const e=t.get("isMarkdownView")||t.get("isCodeView"),s=!e&&this.#Ho(t),i=t.get("placeholder");i&&(i.style.display=e||s||!this.#J.facade.isEmpty(t)?"none":"block")}#Ho(t){const e=t.get("placeholder_line");if(!e)return!1;const s=t.get("wysiwyg"),i=this.#t.get("hasFocus")?this.#J.format.getLine(this.#J.selection.selectionNode):null,n=!!i&&!!Ve.query.getParentElement(i,Ve.check.isTableCell),o=!Ve.check.isEmptyLine(i)||Ve.check.isListCell(i)||n?null:i,l=s.querySelectorAll(".se-placeholder-line");for(let t=0;t<l.length;t++){const e=l[t];e!==o&&(e.classList.remove("se-placeholder-line"),e.removeAttribute("data-se-placeholder-line"),e.getAttribute("class")||e.removeAttribute("class"))}return!!o&&(o.classList.add("se-placeholder-line"),o.setAttribute("data-se-placeholder-line",e),!0)}_syncFrameState(t){t&&(this._iframeAutoHeight(t),this._updatePlaceholder(t),t.has("documentType_use_page")&&(t.get("documentTypePageMirror").innerHTML=t.get("wysiwyg").innerHTML,t.get("documentType").rePage(!0)))}_iframeAutoHeight(t){if(!t)return;const e=t.get("_iframeAuto");if(e)xn.setTimeout((()=>{const s=e.offsetHeight,i=t.get("wysiwygFrame");if(!i)return;i.style.height=s+"px";const n=t.get("options");if(n?.get("iframe")){const t=n.get("maxHeight");t&&i.setAttribute("scrolling",s>Oe.get(t)?"auto":"no")}Ae.isResizeObserverSupported||this._emitResizeEvent(t,s,null)}),0);else if(!Ae.isResizeObserverSupported){const e=t.get("wysiwygFrame");e&&this._emitResizeEvent(t,e.offsetHeight,null)}}_emitResizeEvent(t,e,s){e=-1===e?s?.borderBoxSize&&s.borderBoxSize[0]?s.borderBoxSize[0].blockSize:s.contentRect.height+Oe.get(t.get("wwComputedStyle").getPropertyValue("padding-left"))+Oe.get(t.get("wwComputedStyle").getPropertyValue("padding-right")):e,t.get("_editorHeight")!==e&&(this.#mi.triggerEvent("onResizeEditor",{height:e,prevHeight:t.get("_editorHeight"),frameContext:t,observerEntry:s}),t.set("_editorHeight",e)),t.has("documentType_use_page")&&t.get("documentType").resizePage()}init(){this.#po=!this.#mi.addEvent(this.alertModal.querySelector('[data-command="close"]'),"click",this.alertClose.bind(this)),this._initToggleButtons()}#So(t){const e=Ve.query.getEventTarget(t);(/close/.test(e.getAttribute("data-command"))||e===this.#do)&&this.alertClose()}#ko(t){Re.isEsc(t.code)&&this.alertClose()}_destroy(){this.#bo&&xn.clearTimeout(this.#bo),this.#vo&&=this.#mi.removeGlobalEvent(this.#vo),this.#go&&=this.#mi.removeEvent(this.#go),this.opendModal=null,this.opendBrowser=null,this.#_o=null,this.#xo=null,this.#$o?.destroy(),this.#$o=null,this.#yo=null,this.#Co=null}};function kn(t){const e=t.$,s=t.store,i=e.contextProvider,n=e.eventManager,l=i.frameRoots,r=i.context,a=i.frameContext;let h=e.options.get("historyStackDelayTime");const c=e.options.get("historyStackSize");let d,u,p,g,m=null,f=!1,v=null;function b(i,o,l){l&&s.get("hasFocus")&&t._eventOrchestrator.applyTagEffect(),e.history.resetButtons(i.get("key"),o),n.triggerEvent("onChange",{frameContext:i,data:i.get("wysiwyg").innerHTML}),"block"===r.get("toolbar_main").style.display?e.toolbar._showBalloon():s.mode.isSubBalloon&&"block"===r.get("toolbar_sub_main").style.display&&e.subToolbar._showBalloon()}function y(t){const s=u[d],i=p[s];d+=t;const n=t<0&&s!==u[d]&&i.index>0?s:u[d],o=p[n];o.index+=t;const r=o.value[o.index];if(!r)return console.warn("[SunEditor.history.setContent.fail] History state desynchronized. Aborting undo/redo operation."),o.index-=t,void(d-=t);l.get(n).get("wysiwyg").innerHTML=r.content,s!==n&&t<0&&1===d?d=0:s!==n&&t>0&&1===o.index?d++:(t<0&&o.index<1||t>0&&o.index>o.value.length)&&(d+=t);let h=n,c=r;if(t<0&&d>0&&0===o.index){const e=u[d+t];if(e!==n){const t=p[e];h=e,c=t.value[t.index]}}e.facade.changeFrameContext(h),e.selection.setRange(vt(c.s.path,c.frame),c.s.offset,vt(c.e.path,c.frame),c.e.offset),e.focusManager.focus(),d<0?d=0:d>=u.length&&(d=u.length-1),e.ui.offCurrentController(),e.pluginManager.checkFileInfo(!1),e.char.display(),e.ui._syncFrameState(a),a.has("documentType_use_header")&&a.get("documentType").reHeader(),b(a,o.index,!0)}function C(t,e,s,i){let n,o;e?(n={path:ft(e.startContainer,null,null),offset:e.startOffset},o={path:ft(e.endContainer,null,null),offset:e.endOffset}):(n={path:[0,0],offset:[0,0]},o={path:0,offset:0}),d+=i,u[d]=s;const r=p[s];r.index+=i,r.value[r.index]={content:t,s:n,e:o,frame:l.get(s).get("wysiwyg")}}function w(t){p[t]={value:[],index:-1},g[t]=l.get(t).get("wysiwyg").innerHTML}function _(t,s){e.pluginManager.checkFileInfo(!1);const i=l.get(t),n=i.get("wysiwyg").innerHTML,o=p[t];if(n&&(!o.value[o.index]||n!==o.value[o.index].content)){if(u.length>d+1&&function(t){const s=[];for(let t=d+1,e=u.length;t<e;t++)s.includes(u[t])||s.push(u[t]);u=u.slice(0,d+1),t.value.splice(t.index+1),e.commandDispatcher.applyTargets("redo",(t=>{t.disabled=!0}));for(let t=0,e=s.length;t<e;t++)u.includes(s[t])||w(s[t])}(o),0===o.value.length&&function(t){d++,u[d]=t;const e=p[t];e.index=0,e.value[0]={content:g[t],s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0},frame:l.get(t).get("wysiwyg")}}(t),C(n,s,t,1),o.value.length>c){const e=o.value.length-c;o.value.splice(0,e),o.index-=e;let s=0;for(let i=u.length-1;i>=0&&s<e;i--)if(u[i]===t)for(let e=0;e<u.length;e++)if(u[e]===t){u.splice(e,1),s++;break}d-=e}1===d&&e.commandDispatcher.applyTargets("undo",(t=>{t.disabled=!1})),e.char.display(),b(i,o.index,!1)}}return{push(t,i){if(f)return;i=i||null===i?i:s.get("rootKey");const n=s.get("_range");o.setTimeout(e.ui._syncFrameState.bind(e.ui,l.get(i)),0);const r="number"==typeof t?t>0?t:0:t?h:0;r&&!m||(o.clearTimeout(m),r)?m=o.setTimeout((()=>{o.clearTimeout(m),m=null,_(i,n)}),r):_(i,n)},check(t,e){m&&(o.clearTimeout(m),m=null,_(t,e))},undo(){d>0&&y(-1)},redo(){u.length-1>d&&y(1)},overwrite(t){C(l.get(t||s.get("rootKey")).get("wysiwyg").innerHTML,null,s.get("rootKey"),0)},pause(){f=!0,v&&(o.clearTimeout(v),v=null),v=o.setTimeout((()=>{f=!1}),5e3)},resume(){v&&(o.clearTimeout(v),v=null),f=!1},reset(){e.commandDispatcher.applyTargets("undo",(t=>t.disabled=!0)),e.commandDispatcher.applyTargets("redo",(t=>t.disabled=!0)),e.commandDispatcher.applyTargets("save",(t=>t.disabled=!0)),i.applyToRoots((t=>t.set("historyIndex",-1))),i.applyToRoots((t=>t.set("isChanged",!1))),d=-1,u=[],p={},g={},f=!1;const t=i.rootKeys;for(let e=0,s=t.length;e<s;e++)w(t[e])},resetButtons(t,s){const i=!Oe.is(s),o=p[void 0===t?u[d]:t];s=i?o.index:s;const r=l.get(t),a=o.value.length-1;e.commandDispatcher.applyTargets("undo",(t=>{t.disabled=!(s>0&&s<=a)})),e.commandDispatcher.applyTargets("redo",(t=>{t.disabled=!(s>-1&&s<a)}));const h=r.get("savedIndex"),c=r.get("historyIndex"),g=h>-1?h!==s:i?o.index>0:s>0&&c!==s;r.set("historyIndex",s),r.set("isChanged",g),e.commandDispatcher.applyTargets("save",(t=>{t.disabled=!g})),n.triggerEvent("onResetButtons",{rootKey:t})},getRootStack:()=>p,resetDelayTime(t){h=t},_destroy(){m&&o.clearTimeout(m),v&&o.clearTimeout(v),d=u=p=g=null}}}const{_w:Sn}=Ae;const En=class{#D;#J;#t;#Lo;#No;#e;#Y;#ot;#mi;#Ao;#Bo;#Io;#Vo="default";#Oo=null;#Ro=null;#Po=!1;#zo=!1;#Do=!1;constructor(t,{keyName:e,balloon:s,inline:i,balloonAlways:n,res:o}){this.#D=t,this.#J=t.$,this.#t=t.store,this.#Lo=this.#J.icons,this.#No=this.#J.lang,this.#e=this.#J.context,this.#Y=this.#J.frameContext,this.#ot=this.#J.options,this.#mi=this.#J.eventManager,this.isSub="toolbar_sub"===e,this.keyName={main:this.isSub?"toolbar_sub_main":"toolbar_main",buttonTray:this.isSub?"toolbar_sub_buttonTray":"toolbar_buttonTray",width:this.isSub?"toolbar_sub_width":"toolbar_width"},this.currentMoreLayerActiveButton=null,this.isBalloonMode=s,this.isInlineMode=i,this.isBalloonAlwaysMode=n,this.inlineToolbarAttr={top:"",width:"",isShow:!1},this.balloonOffset={top:0,left:0},this.#Ao=o,this.#Bo=o,this.#Io="visualViewport"in Sn;const l=!this.isSub&&!s&&!i,r=this.#ot.get("_toolbar_sticky");if(this.#Po=l&&r>=0&&!this.#ot.get("toolbar_container")&&"undefined"!=typeof CSS&&CSS.supports("position","sticky"),this.isBottomMode=this.#t.mode.isBottom,this.#Po){const t=this.#e.get(this.keyName.main);this.isBottomMode?(t.style.bottom=r+"px",t.style.top="auto"):r>0&&(t.style.top=r+"px")}else l&&Ve.utils.addClass(this.#e.get(this.keyName.main),"se-toolbar-relative");this._setResponsive()}get isSticky(){if(this.isSub)return!1;const t=this.#ot.get("_toolbar_sticky");if(t<0)return!1;if(this.#Po){const e=this.#e.get(this.keyName.main);if(!e||0===e.offsetWidth||"none"===e.style.display)return!1;if(this.isBottomMode){const s=this.#Io?Sn.visualViewport.height:Sn.innerHeight;return e.getBoundingClientRect().bottom>=s-t-1}return e.getBoundingClientRect().top<=t+1}return this.#zo}get isCSSSticky(){return this.#Po}disable(){this._moreLayerOff(),this.#J.menu.dropdownOff(),this.#J.menu.containerOff(),Ve.utils.setDisabled(this.#e.get(this.keyName.buttonTray).querySelectorAll(".se-menu-list .se-toolbar-btn[data-type]"),!0)}enable(){Ve.utils.setDisabled(this.#e.get(this.keyName.buttonTray).querySelectorAll(".se-menu-list .se-toolbar-btn[data-type]"),!1)}show(){this.isInlineMode?this._showInline():this.isBalloonMode?this._showBalloon():(this.#e.get(this.keyName.main).style.display="",this.isSub||(this.#Y.get("_stickyDummy").style.display="")),this.isSub||this.resetResponsiveToolbar()}hide(){this.isInlineMode?(this.#e.get(this.keyName.main).style.display="none",this.#e.get(this.keyName.main).style.top="0px",this.inlineToolbarAttr.isShow=!1):(this.#e.get(this.keyName.main).style.display="none",this.isSub||(this.#Y.get("_stickyDummy").style.display="none"),this.isBalloonMode&&(this.balloonOffset={top:0,left:0}))}resetResponsiveToolbar(){this.#J.menu.containerOff();const t=this.#Ro;if(t){let e=0;e=(this.isBalloonMode||this.isInlineMode)&&"auto"===this.#ot.get("toolbar_width")||this.#t.mode.isSubBalloon&&"auto"===this.#ot.get("toolbar_sub_width")?this.#Y.get("topArea").offsetWidth:this.#e.get(this.keyName.main).offsetWidth;let s="default";for(let i=1,n=t.length;i<n;i++)if(e<t[i]){s=t[i]+"";break}this.#Vo!==s&&(this.#Vo=s,this.setButtons(this.#Oo[s]))}}setButtons(t){this._moreLayerOff(),this.#J.menu.dropdownOff(),this.#J.menu.containerOff();const e=gs(t,this.#J.plugins,this.#ot,this.#Lo,this.#No,!0);e.updateButtons.forEach((t=>ps(t.button,t.plugin,this.#Lo,this.#No))),this.#e.get(this.keyName.main).replaceChild(e.buttonTray,this.#e.get(this.keyName.buttonTray)),this.#e.set(this.keyName.buttonTray,e.buttonTray),this.#Fo(),this.#mi.triggerEvent("onSetToolbarButtons",{buttonTray:e.buttonTray,frameContext:this.#Y})}_resetSticky(){if(this.#Po)return void this.#qo();const t=this.#Y.get("wrapper");if(!t)return;const e=this.#e.get(this.keyName.main),s=this.#ot.get("_toolbar_sticky");if(this.#Y.get("isFullScreen")||0===e.offsetWidth||s<0)return;const i=this.#Io?Sn.visualViewport.pageTop:Sn.scrollY,n=this.#Y.get("_minHeight"),o=t.offsetHeight,l=this.#J.offset.getGlobal(this.#Y.get("topArea"));if(this.isBottomMode){const t=i+Sn.innerHeight,r=l.top+o,a=t-s-(this.isInlineMode?e.offsetHeight:0),h=this.#ot.get("toolbar_container")?t-s-l.top-n-e.offsetHeight:a-l.top-n;a>r?this.#Wo():h<0?(this.isSticky||this.#Uo(1),e.style.bottom=1+h+this.#Zo()+"px",e.style.top="auto"):this.#Uo(1)}else{const t=i+s,r=(this.isBalloonMode||this.isInlineMode?l.top:this.#J.offset.getGlobal(this.#ot.get("toolbar_container")).top)-(this.isInlineMode?e.offsetHeight:0),a=this.#ot.get("toolbar_container")?l.top-i+o-n-s-e.offsetHeight:o+r+s-t-n;t<r?this.#Wo():a<0?(this.isSticky||this.#Uo(1),e.style.top=1+a+this.#Zo()+"px"):this.#Uo(1)}}#Fo(){this.#J.shortcuts._registerShortcuts(),this.#J.commandDispatcher.resetTargets(),this.#J.ui._initToggleButtons(),this.#J.history.resetButtons(this.#Y.get("key"),null),this._resetSticky(),this.#t.set("_lastSelectionNode",null),this.#J.viewer._setButtonsActive(),this.#t.get("hasFocus")&&this.#D._eventOrchestrator.applyTagEffect(),this.#Y.get("isReadOnly")&&this.#J.ui.setControllerOnDisabledButtons(!0)}_setResponsive(){if(0===this.#Bo?.length)return void(this.#Bo=null);this.#Vo="default";const t=this.#Ro=[],e=this.#Ao,s=this.#Oo={default:e[0]};for(let i,n,o=1,l=e.length;o<l;o++)n=e[o],i=1*n[0],t.push(i),s[i]=n[1];t.sort(((t,e)=>t-e)).unshift("default")}_showBalloon(t){if(!this.isBalloonMode)return;this.isSub&&this.resetResponsiveToolbar();const e=t||this.#J.selection.getRange(),s=this.#e.get(this.keyName.main),i=this.#J.selection.get();let n;if(this.isBalloonAlwaysMode&&e.collapsed)n=!0;else if(i.focusNode===i.anchorNode)n=i.focusOffset<i.anchorOffset;else{const t=Ve.query.getListChildNodes(e.commonAncestorContainer,null,null);n=Ve.utils.getArrayIndex(t,i.focusNode)<Ve.utils.getArrayIndex(t,i.anchorNode)}this._setBalloonOffset(n,e),this.#mi.triggerEvent("onShowToolbar",{toolbar:s,mode:"balloon",frameContext:this.#Y})}_setBalloonOffset(t,e){const s=this.#e.get(this.keyName.main),i=this.#Y.get("topArea"),n=this.#J.offset.getGlobal(i).top;if(!this.#J.offset.setRangePosition(s,e,{position:t?"top":"bottom",addTop:n}))return void this.hide();if(this.#ot.get("toolbar_container")){const t=i.parentElement;let e=this.#ot.get("toolbar_container"),n=e.offsetLeft,o=e.offsetTop;for(;!e.parentElement.contains(t)&&!/^(BODY|HTML)$/i.test(e.parentElement.nodeName);)e=e.offsetParent,n+=e.offsetLeft,o+=e.offsetTop;s.style.left=s.offsetLeft-n+i.offsetLeft+"px",s.style.top=s.offsetTop-o+i.offsetTop+"px"}const o=this.#J.offset.getWWScroll();this.balloonOffset={top:s.offsetTop+o.top,left:s.offsetLeft+o.left,position:t?"top":"bottom"}}_showInline(){if(!this.isInlineMode)return;const t=this.#e.get(this.keyName.main);if(t.style.visibility="hidden",t.style.display="block",this.#Wo(),t.style.top="0px",this.inlineToolbarAttr.width=t.style.width=this.#ot.get(this.keyName.width),this.isBottomMode){const e=this.#Y.get("topArea");this.inlineToolbarAttr.top=t.style.top=this.#J.offset.getGlobal(e).top+e.offsetHeight-this.#J.offset.getGlobal(t).top+"px"}else this.inlineToolbarAttr.top=t.style.top=this.#J.offset.getGlobal(this.#Y.get("topArea")).top-this.#J.offset.getGlobal(t).top-t.offsetHeight-1+"px";this._resetSticky(),this.inlineToolbarAttr.isShow=!0,this.#mi.triggerEvent("onShowToolbar",{toolbar:t,mode:"inline",frameContext:this.#Y}),t.style.visibility=""}_moreLayerOn(t,e){this._moreLayerOff(),this.currentMoreLayerActiveButton=t,e.style.display="block"}_moreLayerOff(){if(this.currentMoreLayerActiveButton){this.#e.get(this.keyName.main).querySelector("."+this.currentMoreLayerActiveButton.getAttribute("data-command")).style.display="none",Ve.utils.removeClass(this.currentMoreLayerActiveButton,"on"),this.currentMoreLayerActiveButton=null}}#Uo(t){const e=this.#e.get(this.keyName.main);if(!this.isInlineMode){const t=this.#ot.get("toolbar_container")?this.#e.get("_stickyDummy"):this.#Y.get("_stickyDummy");t.style.height=e.offsetHeight+"px",t.style.display="block"}if(this.isBottomMode){const t=this.#ot.get("_toolbar_sticky")+this.#Zo();e.style.bottom=`${t}px`,e.style.top="auto"}else{const s=this.#ot.get("_toolbar_sticky")+t+this.#Zo();e.style.top=`${s}px`}e.style.width=this.isInlineMode?this.inlineToolbarAttr.width:e.offsetWidth+"px",Ve.utils.addClass(e,"se-toolbar-sticky"),this.#zo=!0}#Zo(){return this.#Io?Sn.visualViewport.offsetTop:0}#qo(){if(!this.#Io)return;if(this.#D._eventOrchestrator.scrollparents.length>0)return;const t=Math.round(Sn.visualViewport.offsetTop);if(0===t&&!this.#Do)return;const e=this.#e.get(this.keyName.main),s=this.#ot.get("_toolbar_sticky_offset");if(t>0)if(this.#Do=!0,this.isBottomMode){const i=Math.round(Sn.innerHeight-Sn.visualViewport.height-t);e.style.bottom=s+i+"px",e.style.top="auto"}else e.style.top=s+t+"px";else{this.#Do=!1;const t=this.#ot.get("_toolbar_sticky");this.isBottomMode?(e.style.bottom=t+"px",e.style.top="auto"):e.style.top=t>0?t+"px":""}}#Wo(){(this.#ot.get("toolbar_container")?this.#e.get("_stickyDummy"):this.#Y.get("_stickyDummy")).style.display="none";const t=this.#e.get(this.keyName.main);this.isBottomMode?(t.style.bottom=this.isInlineMode?-t.offsetHeight+"px":"",t.style.top="auto",this.#Y.get("wrapper").style.marginBottom=""):(t.style.top=this.isInlineMode?this.inlineToolbarAttr.top:"",this.#Y.get("wrapper").style.marginTop=""),t.style.width=this.isInlineMode?this.inlineToolbarAttr.width:"",Ve.utils.removeClass(t,"se-toolbar-sticky"),this.#zo=!1}_destroy(){this._moreLayerOff()}},{isMobile:Tn,_w:Mn}=Ae;function Hn(t){return/free$/.test(t)}const Ln=class{#J;#t;#gi;#e;#mi;#Go;#jo=[];#Ko=null;#Yo=null;#Xo=null;#Jo=null;#Qo=null;#tl=null;#el=null;#sl=null;#il=null;#nl=null;constructor(t){this.#J=t.$,this.#t=t.store,this.#gi=this.#J.contextProvider,this.#e=this.#J.context,this.#mi=this.#J.eventManager,this.targetMap={},this.itemsMap={},this.index=-1,this.menus=[],this.currentButton=null,this.currentDropdown=null,this.currentDropdownActiveButton=null,this.currentDropdownName="",this.currentDropdownType="",this.currentContainer=null,this.currentContainerActiveButton=null,this.currentContainerName="",this.currentDropdownPlugin=null,this.#Go={mousedown:this.#ol.bind(this),containerDown:this.containerOff.bind(this),keydown:this.#ll.bind(this),mousemove:this.#rl.bind(this),mouseout:this.#al.bind(this)},this.#Ko=null,this.#Yo=null,this.#Xo=null,this.#tl=null,this.#el=null,this.#nl=Mn.visualViewport||null}initDropdownTarget({key:t,type:e},s,i){if(!t)throw Error("[SUNEDITOR.init.fail] The plugin's key is not added.");let n;if(Array.isArray(s)){n=function(t,e={}){let s="";for(let e=0,i=t.length;e<i;e++){const i=t[e];let n="";if(i.attrs){const t=Object.keys(i.attrs);for(let e=0;e<t.length;e++)n+=` ${t[e]}="${i.attrs[t[e]]}"`}s+=`\n\t\t<li>\n\t\t\t<button type="button" class="se-btn se-btn-list${i.className?" "+i.className:""}" data-command="${i.command}"${void 0!==i.value?` data-value="${i.value}"`:""} title="${i.title}" aria-label="${i.title}"${n}>${i.innerHTML}</button>\n\t\t</li>`}return Ve.utils.createElement("DIV",{class:"se-dropdown se-list-layer"+(e.className?" "+e.className:"")},`<div class="se-list-inner"><ul class="se-list-basic">${e.prependHTML||""}${s}</ul></div>`)}(s,i);const e=n.querySelectorAll(".se-list-inner li > button"),o=e.length-s.length;for(let t=0;t<s.length;t++)s[t]._element=e[o+t]||null;this.itemsMap[t]=s}else n=s;return Hn(e)||(n.setAttribute("data-key",t),this.#jo.push(t)),this.#e.get("menuTray").appendChild(n),this.targetMap[t]=n,n}dropdownOn(t){this.#qe();const e=this.#hl(t);if(e){const s=Ve.query.getParentElement(e,".se-btn-tray").querySelector('[data-command="'+e.getAttribute("data-ref")+'"]');if(s)return this.#J.commandDispatcher.runFromTarget(s),void this.dropdownOn(t)}const s=this.currentButton=t,i=this.currentDropdownName=s.getAttribute("data-command");this.currentDropdownType=s.getAttribute("data-type");const n=this.currentDropdown=this.targetMap[i];this.currentDropdownActiveButton=s,Tn?this.#cl(s,n):this.#dl(s,n),this.#e.get("menuTray").showPopover?.(),this.#Ko=this.#mi.addGlobalEvent("mousedown",this.#Go.mousedown,!1),this.#jo.includes(i)&&(this.menus=Ie.nodeListToArray(n.querySelectorAll("[data-command]")),this.menus.length>0&&(this.#Yo=this.#mi.addGlobalEvent("keydown",this.#Go.keydown,!1),this.#Jo=this.#mi.addEvent(n,"mousemove",this.#Go.mousemove,!1),this.#Qo=this.#mi.addEvent(n,"mouseout",this.#Go.mouseout,!1))),this.currentDropdownPlugin=this.#J.plugins[i],this.currentDropdownPlugin?.on(s),this.#t.set("_preventBlur",!0)}dropdownOff(){this.#ul(),this.#qe(),Hn(this.currentDropdownType)&&this.currentDropdownPlugin?.off?.(),this.index=-1,this.menus=[],this.#tl=null,this.#el=null,this.currentButton=null,this.currentDropdown&&(this.currentDropdownName="",this.currentDropdownType="",this.currentDropdown.style.display="none",this.currentDropdown=null,this.currentDropdownActiveButton&&Ve.utils.removeClass(this.currentDropdownActiveButton.parentElement.children,"on"),this.currentDropdownActiveButton=null,this.#J.ui.preventToolbarHide(!1),this.#e.get("menuTray").hidePopover?.()),this.#t.set("_preventBlur",!1),this.currentDropdownPlugin=null}dropdownShow(){this.currentButton&&this.dropdownOn(this.currentButton)}dropdownHide(){this.currentDropdown&&(this.currentDropdown.style.display="none")}containerOn(t){this.#qe(),this.currentContainerActiveButton=t;const e=this.currentContainerName=this.currentContainerActiveButton.getAttribute("data-command");this.currentContainer=this.targetMap[e],Tn?this.#cl(t,this.currentContainer):this.#dl(t,this.currentContainer),this.#e.get("menuTray").showPopover?.(),this.#Xo=this.#mi.addGlobalEvent("mousedown",this.#Go.containerDown,!1),this.#J.plugins[e].on&&this.#J.plugins[e].on(t),this.#t.set("_preventBlur",!0)}containerOff(){this.#ul(),this.#qe(),this.currentContainer&&(this.currentContainerName="",this.currentContainer.style.display="none",this.currentContainer=null,Ve.utils.removeClass(this.currentContainerActiveButton,"on"),this.currentContainerActiveButton=null,this.#J.ui.preventToolbarHide(!1),this.#e.get("menuTray").hidePopover?.()),this.#t.set("_preventBlur",!1)}__resetMenuPosition(t,e){this.#J.offset.setRelPosition(e,this.#gi.carrierWrapper,t.parentElement,Ve.query.getParentElement(t,".se-toolbar"),{preferUp:this.#t.mode.isBottom})}__restoreMenuPosition(){this.#tl&&this.#el&&(this.#il||this.#sl||this.#dl(this.#tl,this.#el))}#dl(t,e){e.style.visibility="hidden",e.style.display="block",e.style.height="",Ve.utils.addClass(t.parentElement.children,"on"),this.#J.offset.setRelPosition(e,this.#gi.carrierWrapper,t.parentElement,Ve.query.getParentElement(t,".se-toolbar"),{preferUp:this.#t.mode.isBottom}),e.style.visibility="",this.#tl=t,this.#el=e}#cl(t,e){this.#ul(),e.style.display="none",Ve.utils.addClass(t.parentElement.children,"on"),this.#tl=t,this.#el=e;let s=!1;const i=i=>{s||(s=!0,this.#ul(),this.#sl=Mn.setTimeout((()=>{this.#sl=null,this.#tl===t&&this.#dl(t,e)}),i))};this.#nl&&(this.#il=()=>i(10),this.#nl.addEventListener("resize",this.#il,{once:!0})),this.#sl=Mn.setTimeout((()=>i(0)),50)}#ul(){this.#sl&&(Mn.clearTimeout(this.#sl),this.#sl=null),this.#il&&(this.#nl?.removeEventListener("resize",this.#il),this.#il=null)}#hl(t){const e=Ve.query.getParentElement(t,".se-more-layer");return e&&"block"!==e.style.display&&e.getAttribute("data-ref")?e:null}#Ls(t){Ve.utils.removeClass(this.currentDropdown,"se-select-menu-mouse-move"),Ve.utils.addClass(this.currentDropdown,"se-select-menu-key-action"),t=this.index+t;const e=this.menus.length,s=this.index=t>=e?0:t<0?e-1:t;for(let t=0;t<e;t++)t===s?Ve.utils.addClass(this.menus[t],"on"):Ve.utils.removeClass(this.menus[t],"on")}#qe(){this.#Ko&&=this.#mi.removeGlobalEvent(this.#Ko),this.#Xo&&=this.#mi.removeGlobalEvent(this.#Xo),this.#Yo&&(this.#Yo=this.#mi.removeGlobalEvent(this.#Yo),this.#Jo&&=this.#mi.removeEvent(this.#Jo),this.#Qo&&=this.#mi.removeEvent(this.#Qo),Ve.utils.removeClass(this.menus,"on"),Ve.utils.removeClass(this.currentDropdown,"se-select-menu-key-action|se-select-menu-mouse-move"))}#ol(t){const e=Ve.query.getEventTarget(t);Ve.query.getParentElement(e,".se-dropdown")||this.dropdownOff()}#al(){this.index=-1}#ll(t){switch(t.code){case"ArrowUp":case"ArrowLeft":t.preventDefault(),t.stopPropagation(),this.#Ls(-1);break;case"ArrowDown":case"ArrowRight":t.preventDefault(),t.stopPropagation(),this.#Ls(1);break;case"Enter":case"Space":{if(this.index<0)break;const e=this.menus[this.index];if(!e||"function"!=typeof this.#J.plugins[this.currentDropdownName].action)return;t.preventDefault(),t.stopPropagation(),this.#J.plugins[this.currentDropdownName].action(e),this.dropdownOff();break}}}#rl(t){Ve.utils.addClass(this.currentDropdown,"se-select-menu-mouse-move"),Ve.utils.removeClass(this.currentDropdown,"se-select-menu-key-action");const e=this.menus.indexOf(t.target);-1!==e&&(this.index=1*e)}_destroy(){this.#qe()}},{_w:Nn,_d:An}=Ae;function Bn(t,e){const s="markdown"===e?"markdownNumbers":"codeNumbers",i="markdown"===e?"markdown":"code",n=t.get(s);if(!n)return;const o=t.get(i),l=(o.value.match(/\n/g)||[]).length+1;let r="";for(let t=1;t<=l;t++)r+=`${t}\n`;const a=Nn.getComputedStyle(o);n.style.lineHeight=a.lineHeight,n.style.fontSize=a.fontSize,n.style.fontFamily=a.fontFamily,n.style.paddingTop=a.paddingTop,n.style.paddingBottom=a.paddingBottom,n.value=r}const In=class{#D;#J;#t;#Lo;#No;#I;#e;#Y;#ot;#Q;#mi;#te;#pl="";#gl="";#ml="";#fl="";#vl="";#bl="";#yl="";#Cl="";#wl="";#_l="";#xl="";#$l=0;#kl=!1;#Sl=!1;#El=!1;#Tl=null;#Ml="";constructor(t){this.#D=t,this.#J=t.$,this.#t=t.store,this.#Lo=this.#J.icons,this.#No=this.#J.lang,this.#I=this.#J.frameRoots,this.#e=this.#J.context,this.#Y=this.#J.frameContext,this.#ot=this.#J.options,this.#Q=this.#J.frameOptions,this.#mi=this.#J.eventManager,this.#te=new RegExp(`^(${this.#ot.get("_disallowedExtraTag")})$`,"i")}codeView(t){const e=this.#Y;if(!e.get("codeWrapper"))return;if(void 0===t&&(t=!e.get("isCodeView")),t===e.get("isCodeView"))return;t&&e.get("isMarkdownView")&&this.markdownView(!1),e.set("isCodeView",t),this.#J.ui.offCurrentController(),this.#J.ui.offCurrentModal();const s=e.get("codeWrapper"),i=e.get("code"),n=e.get("wysiwygFrame"),o=e.get("wrapper");t?(this.#J.finder.close(),this.#Hl(),s.style.setProperty("display","flex","important"),n.style.display="none",e.get("isFullScreen")?i.style.height="100%":"auto"!==this.#Q.get("height")||this.#ot.get("hasCodeMirror")||(i.style.height=i.scrollHeight>0?i.scrollHeight+"px":"auto"),this.#ot.get("hasCodeMirror")&&this._codeMirrorEditor("refresh",null,null),e.get("isFullScreen")||(this.#J.ui.preventToolbarHide(!0),this.#t.mode.isBalloon&&(this.#e.get("toolbar_arrow").style.display="none",this.#e.get("toolbar_main").style.left="",this.#t.mode.isInline=this.#J.toolbar.isInlineMode=!0,this.#t.mode.isBalloon=this.#J.toolbar.isBalloonMode=!1,this.#J.toolbar._showInline())),this.#t.mode.isBalloon&&this.#J.subToolbar.hide(),Bn(e),this.#t.set("_range",null),i.focus(),Ve.utils.addClass(this.#J.commandDispatcher.targets.get("codeView"),"active"),Ve.utils.addClass(o,"se-source-view-status")):(Ve.check.isNonEditable(n)||this.#Ll(),n.scrollTop=0,s.style.setProperty("display","none","important"),n.style.display="block","auto"!==this.#Q.get("height")||this.#ot.get("hasCodeMirror")||(e.get("code").style.height="0px"),e.get("isFullScreen")||(this.#J.ui.preventToolbarHide(!1),/balloon/.test(this.#ot.get("mode"))&&(this.#e.get("toolbar_arrow").style.display="",this.#t.mode.isInline=this.#J.toolbar.isInlineMode=!1,this.#t.mode.isBalloon=this.#J.toolbar.isBalloonMode=!0,this.#D._eventOrchestrator._hideToolbar())),this.#J.focusManager.nativeFocus(),Ve.utils.removeClass(this.#J.commandDispatcher.targets.get("codeView"),"active"),Ve.check.isNonEditable(n)||(this.#J.history.push(!1),this.#J.history.resetButtons(e.get("key"),null)),Ve.utils.removeClass(o,"se-source-view-status")),this.#J.ui._updatePlaceholder(e),this.#J.ui._toggleCodeViewButtons(t),e.has("documentType_use_header")&&(t?e.get("documentTypeInner").style.display="none":(e.get("documentTypeInner").style.display="",e.get("documentType").reHeader())),this.#mi.triggerEvent("onToggleCodeView",{frameContext:e,is:e.get("isCodeView")})}markdownView(t){const e=this.#Y;if(!e.get("markdownWrapper"))return;if(void 0===t&&(t=!e.get("isMarkdownView")),t===e.get("isMarkdownView"))return;t&&e.get("isCodeView")&&this.codeView(!1),e.set("isMarkdownView",t),this.#J.ui.offCurrentController(),this.#J.ui.offCurrentModal();const s=e.get("markdownWrapper"),i=e.get("markdown"),n=e.get("wysiwygFrame"),o=e.get("wrapper");t?(this.#J.finder.close(),this.#Nl(),s.style.setProperty("display","flex","important"),n.style.display="none",e.get("isFullScreen")?i.style.height="100%":"auto"===this.#Q.get("height")&&(i.style.height=i.scrollHeight>0?i.scrollHeight+"px":"auto"),e.get("isFullScreen")||(this.#J.ui.preventToolbarHide(!0),this.#t.mode.isBalloon&&(this.#e.get("toolbar_arrow").style.display="none",this.#e.get("toolbar_main").style.left="",this.#t.mode.isInline=this.#J.toolbar.isInlineMode=!0,this.#t.mode.isBalloon=this.#J.toolbar.isBalloonMode=!1,this.#J.toolbar._showInline())),this.#t.mode.isBalloon&&this.#J.subToolbar.hide(),Bn(e,"markdown"),this.#t.set("_range",null),i.focus(),Ve.utils.addClass(this.#J.commandDispatcher.targets.get("markdownView"),"active"),Ve.utils.addClass(o,"se-source-view-status")):(Ve.check.isNonEditable(n)||this.#Al(),n.scrollTop=0,s.style.setProperty("display","none","important"),n.style.display="block","auto"===this.#Q.get("height")&&(i.style.height="0px"),e.get("isFullScreen")||(this.#J.ui.preventToolbarHide(!1),/balloon/.test(this.#ot.get("mode"))&&(this.#e.get("toolbar_arrow").style.display="",this.#t.mode.isInline=this.#J.toolbar.isInlineMode=!1,this.#t.mode.isBalloon=this.#J.toolbar.isBalloonMode=!0,this.#D._eventOrchestrator._hideToolbar())),this.#J.focusManager.nativeFocus(),Ve.utils.removeClass(this.#J.commandDispatcher.targets.get("markdownView"),"active"),Ve.check.isNonEditable(n)||(this.#J.history.push(!1),this.#J.history.resetButtons(e.get("key"),null)),Ve.utils.removeClass(o,"se-source-view-status")),this.#J.ui._updatePlaceholder(e),this.#J.ui._toggleCodeViewButtons(t),e.has("documentType_use_header")&&(t?e.get("documentTypeInner").style.display="none":(e.get("documentTypeInner").style.display="",e.get("documentType").reHeader())),this.#mi.triggerEvent("onToggleMarkdownView",{frameContext:e,is:e.get("isMarkdownView")})}fullScreen(t){const e=this.#Y;if(void 0===t&&(t=!e.get("isFullScreen")),t===e.get("isFullScreen"))return;e.set("isFullScreen",t);const s=e.get("topArea"),i=this.#e.get("toolbar_main"),n=e.get("wrapper"),o=e.get("wysiwygFrame"),l=e.get("codeWrapper"),r=e.get("code"),a=e.get("codeNumbers"),h=e.get("markdownWrapper"),c=e.get("markdown"),d=e.get("markdownNumbers"),u=this.#Y.get("isCodeView"),p=this.#Y.get("isMarkdownView"),g=this.#e.get("toolbar_arrow");this.#J.ui.offCurrentController();const m="none"===i.style.display||this.#t.mode.isInline&&!this.#J.toolbar.inlineToolbarAttr.isShow;if(t){this.#Ml=s.style.cssText,this.#gl=n.style.cssText,this.#ml=o.style.cssText,this.#fl=l?.style.cssText,this.#vl=r.style.cssText,this.#bl=a?.style.cssText,this.#yl=h?.style.cssText,this.#Cl=c?.style.cssText,this.#wl=d?.style.cssText,this.#_l=i.style.cssText,g&&(this.#xl=g.style.cssText),(this.#t.mode.isBalloon||this.#t.mode.isInline)&&(g&&(g.style.display="none"),this.#El=this.#t.mode.isInline,this.#Sl=this.#t.mode.isBalloon,this.#t.mode.isInline=this.#J.toolbar.isInlineMode=!1,this.#t.mode.isBalloon=this.#J.toolbar.isBalloonMode=!1),this.#ot.get("toolbar_container")&&(this.#Tl=i.parentElement,e.get("container").insertBefore(i,n)),s.style.position="fixed",s.style.top="0",s.style.left="0",s.style.width="100%",s.style.maxWidth="100%",s.style.height="100%",s.style.zIndex="2147483639","none"!==e.get("_stickyDummy").style.display&&""!==e.get("_stickyDummy").style.display&&(this.#kl=!0,e.get("_stickyDummy").style.display="none",Ve.utils.removeClass(i,"se-toolbar-sticky")),this.#pl=An.body.style.overflow,An.body.style.overflow="hidden",n.style.cssText=i.style.cssText="",o.style.cssText=(o.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+this.#Q.get("_defaultStyles").editor+(u||p?"display: none;":""),l&&(l.style.cssText=(l.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+`display: ${u?"flex":"none"} !important;`,l.style.overflow="auto",l.style.height="100%"),h&&(h.style.cssText=(h.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+`display: ${p?"flex":"none"} !important;`,h.style.overflow="auto",h.style.height="100%"),r.style.height="",c&&(c.style.height=""),i.style.width=o.style.height="100%",i.style.position="relative",i.style.display="block",this.#$l=Nn.innerHeight-i.offsetHeight,n.style.height=this.#$l-(e.has("statusbar")?e.get("statusbar").offsetHeight:0)-this.#ot.get("fullScreenOffset")+"px",this.#Q.get("iframe")&&"auto"===this.#Q.get("height")&&(n.style.overflow="auto",this.#J.ui._iframeAutoHeight(e)),e.get("topArea").style.marginTop=this.#ot.get("fullScreenOffset")+"px";const t=this.#Lo.reduction;this.#J.commandDispatcher.applyTargets("fullScreen",(e=>{Ve.utils.changeElement(e.firstElementChild,t),Ve.utils.addClass(e,"active")}))}else{o.style.cssText=this.#ml.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+(u||p?"display: none;":""),l&&(l.style.cssText=this.#fl.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+`display: ${u?"flex":"none"} !important;`),r.style.cssText=this.#vl,a&&(a.style.cssText=this.#bl),h&&(h.style.cssText=this.#yl.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+`display: ${p?"flex":"none"} !important;`),c&&(c.style.cssText=this.#Cl),d&&(d.style.cssText=this.#wl),i.style.cssText=this.#_l,n.style.cssText=this.#gl,s.style.cssText=this.#Ml,g&&(g.style.cssText=this.#xl),An.body.style.overflow=this.#pl,"auto"!==this.#Q.get("height")||this.#ot.get("hasCodeMirror")||this._codeViewAutoHeight(e.get("code"),e.get("codeNumbers"),!0),this.#Tl&&(this.#Tl.appendChild(i),this.#Tl=null),this.#ot.get("_toolbar_sticky")>-1&&Ve.utils.removeClass(i,"se-toolbar-sticky"),this.#kl&&!this.#ot.get("toolbar_container")&&(this.#kl=!1,e.get("_stickyDummy").style.display="block",Ve.utils.addClass(i,"se-toolbar-sticky")),this.#t.mode.isInline=this.#J.toolbar.isInlineMode=this.#El,this.#t.mode.isBalloon=this.#J.toolbar.isBalloonMode=this.#Sl,e.get("isCodeView")||(this.#t.mode.isInline?this.#J.toolbar._showInline():this.#t.mode.isBalloon&&this.#J.toolbar._showBalloon()),this.#J.toolbar._resetSticky(),e.get("topArea").style.marginTop="";const t=this.#Lo.expansion;this.#J.commandDispatcher.applyTargets("fullScreen",(e=>{Ve.utils.changeElement(e.firstElementChild,t),Ve.utils.removeClass(e,"active")}))}!m||e.get("isCodeView")||e.get("isMarkdownView")||this.#J.toolbar.hide(),this.#mi.triggerEvent("onToggleFullScreen",{frameContext:e,is:e.get("isFullScreen")})}showBlocks(t){const e=this.#Y;void 0===t&&(t=!e.get("isShowBlocks")),e.set("isShowBlocks",!!t),t?(Ve.utils.addClass(e.get("wysiwyg"),"se-show-block"),Ve.utils.addClass(this.#J.commandDispatcher.targets.get("showBlocks"),"active")):(Ve.utils.removeClass(e.get("wysiwyg"),"se-show-block"),Ve.utils.removeClass(this.#J.commandDispatcher.targets.get("showBlocks"),"active")),this.#J.ui._syncFrameState(e)}_setButtonsActive(){const t=this.#Y;if(t.get("isCodeView")?Ve.utils.addClass(this.#J.commandDispatcher.targets.get("codeView"),"active"):Ve.utils.removeClass(this.#J.commandDispatcher.targets.get("codeView"),"active"),t.get("isFullScreen")){const t=this.#Lo.reduction;this.#J.commandDispatcher.applyTargets("fullScreen",(e=>{Ve.utils.changeElement(e.firstElementChild,t),Ve.utils.addClass(e,"active")}))}else{const t=this.#Lo.expansion;this.#J.commandDispatcher.applyTargets("fullScreen",(e=>{Ve.utils.changeElement(e.firstElementChild,t),Ve.utils.removeClass(e,"active")}))}t.get("isMarkdownView")?Ve.utils.addClass(this.#J.commandDispatcher.targets.get("markdownView"),"active"):Ve.utils.removeClass(this.#J.commandDispatcher.targets.get("markdownView"),"active"),t.get("isShowBlocks")?Ve.utils.addClass(this.#J.commandDispatcher.targets.get("showBlocks"),"active"):Ve.utils.removeClass(this.#J.commandDispatcher.targets.get("showBlocks"),"active")}print(){const t=Ve.utils.createElement("IFRAME",{style:"display: none;"});An.body.appendChild(t);const e=Nn.getComputedStyle(this.#Y.get("wysiwyg")).padding,s=this.#ot.get("printTemplate")?this.#ot.get("printTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.#J.html.get()):this.#J.html.get(),i=Ve.query.getIframeDocument(t),n=this.#Y.get("_wd"),o=this.#ot.get("_rtl")?" se-rtl":"",l=(this.#ot.get("_themeClass")||"").trim(),r=t=>l?t.replace(l,"").trim():t,a=`\n\t\t\t<style>\n\t\t\t\t@page {\n\t\t\t\t\tsize: A4;\n\t\t\t\t\tmargin: ${e};\n\t\t\t\t}\n\t\t\t</style>`;if(this.#Q.get("iframe")){const t=this.#ot.get("printClass")?'class="'+r(this.#ot.get("printClass"))+o+'"':this.#Q.get("iframe_fullPage")?Ve.utils.getAttributesToString(n.body,["contenteditable"]).replace(l,""):'class="'+r(this.#ot.get("_editableClass"))+o+'"';i.write(`\n\t\t\t\t<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t${n.head.innerHTML}\n\t\t\t\t\t\t${a}\n\t\t\t\t\t</head>\n\t\t\t\t\t<body ${t} style="padding: 0; padding-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 0;">\n\t\t\t\t\t\t${s}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}else{const t=An.head.getElementsByTagName("link"),e=An.head.getElementsByTagName("style");let n="";for(let e=0,s=t.length;e<s;e++)n+=t[e].outerHTML;for(let t=0,s=e.length;t<s;t++)n+=e[t].outerHTML;i.write(`\n\t\t\t\t<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t${n}\n\t\t\t\t\t\t${a}\n\t\t\t\t\t</head>\n\t\t\t\t\t<body class="${r(this.#ot.get("printClass")||this.#ot.get("_editableClass"))+o}" style="padding: 0; padding-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 0;">\n\t\t\t\t\t\t${s}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}this.#J.ui.showLoading(),Nn.setTimeout((()=>{try{if(t.focus(),Ae.isEdge||Ae.isChromium||"StyleMedia"in Ae._w)try{t.contentWindow.document.execCommand("print",!1,null)}catch(e){console.warn("[SUNEDITOR.print.warn]",e),t.contentWindow.print()}else t.contentWindow.print()}catch(t){throw Error(`[SUNEDITOR.print.fail] error: ${t.message}`)}finally{this.#J.ui.hideLoading(),Ve.utils.removeItem(t)}}),1e3)}preview(){this.#J.menu.dropdownOff(),this.#J.menu.containerOff(),this.#J.ui.offCurrentController(),this.#J.ui.offCurrentModal();const t=this.#ot.get("previewTemplate")?this.#ot.get("previewTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.#J.html.get({withFrame:!0})):this.#J.html.get({withFrame:!0}),e=Nn.open("","_blank"),s=this.#Y.get("_wd"),i=this.#ot.get("_rtl")?" se-rtl":"";if(this.#Q.get("iframe")){const n=this.#ot.get("printClass")?'class="'+this.#ot.get("printClass")+i+'"':this.#Q.get("iframe_fullPage")?Ve.utils.getAttributesToString(s.body,["contenteditable"]):'class="'+this.#ot.get("_editableClass")+i+'"';e.document.write(`<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t${s.head.innerHTML}\n\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\tbody {overflow:auto !important; height:auto !important;}\n\t\t\t\t\t\t</style>\n\t\t\t\t\t</head>\n\t\t\t\t\t<body ${n}>\n\t\t\t\t\t\t${t}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}else{const s=An.head.getElementsByTagName("link"),n=An.head.getElementsByTagName("style");let o="";for(let t=0,e=s.length;t<e;t++)o+=s[t].outerHTML;for(let t=0,e=n.length;t<e;t++)o+=n[t].outerHTML;e.document.write(`<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t<meta charset="utf-8" />\n\t\t\t\t\t\t<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">\n\t\t\t\t\t\t<title>${this.#No.preview}</title>\n\t\t\t\t\t\t${o}\n\t\t\t\t\t</head>\n\t\t\t\t\t<body class="${(this.#ot.get("printClass")?this.#ot.get("printClass"):this.#ot.get("_editableClass"))+i}" style="height:auto">\n\t\t\t\t\t\t${t}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}}_resetFullScreenHeight(){if(this.#Y.get("isFullScreen"))return this.#$l+=Nn.innerHeight-this.#e.get("toolbar_main").offsetHeight-(this.#Y.has("statusbar")?this.#Y.get("statusbar").offsetHeight:0)-this.#$l,this.#Y.get("wrapper").style.height=this.#$l+"px",!0}_codeMirrorEditor(t,e,s){const i=s?this.#I.get(s).get("options"):this.#Q;switch(t){case"set":i.get("codeMirrorEditor").getDoc().setValue(e);break;case"get":return i.get("codeMirrorEditor").getDoc().getValue();case"readonly":i.get("codeMirrorEditor").setOption("readOnly",e);break;case"refresh":i.get("codeMirrorEditor").refresh()}}_setCodeView(t){this.#ot.get("hasCodeMirror")?this._codeMirrorEditor("set",t,null):this.#Y.get("code").value=t}_getCodeView(){return this.#ot.get("hasCodeMirror")?this._codeMirrorEditor("get",null,null):this.#Y.get("code").value}_codeViewAutoHeight(t,e,s){s&&(t.style.height=t.scrollHeight+"px"),this.#Bl(e,t)}_scrollLineNumbers(t){t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft}_markdownViewAutoHeight(t,e,s){s&&(t.style.height=t.scrollHeight+"px"),this.#Bl(e,t)}_scrollMarkdownLineNumbers(t){t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft}#Ll(){const t=this._getCodeView();if(this.#Q.get("iframe_fullPage")){const e=this.#Y.get("_wd"),s=(new DOMParser).parseFromString(t,"text/html");if(!this.#te.test("script")){const t=s.head.children;for(let e=0,i=t.length;e<i;e++)/^script$/i.test(t[e].tagName)&&(s.head.removeChild(t[e]),e--,i--)}let i=s.head.innerHTML;s.head.querySelector('link[rel="stylesheet"]')&&("auto"!==this.#Q.get("height")||s.head.querySelector("style"))||(i+=Ie._setIframeStyleLinks(this.#Q.get("iframe_cssFileName"))+Ie._setAutoHeightStyle(this.#Q.get("height"))),e.head.innerHTML=i,e.body.innerHTML=this.#J.html.clean(s.body.innerHTML,{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.#ot.get("freeCodeViewMode")});const n=s.body.attributes;for(let t=0,s=n.length;t<s;t++)"contenteditable"!==n[t].name&&e.body.setAttribute(n[t].name,n[t].value);if(!Ve.utils.hasClass(e.body,"sun-editor-editable")){const t=this.#ot.get("_editableClass").split(" ");for(let s=0;s<t.length;s++)Ve.utils.addClass(e.body,t[s])}}else this.#Y.get("wysiwyg").innerHTML=t.length>0?this.#J.html.clean(t,{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.#ot.get("freeCodeViewMode")}):"<"+this.#ot.get("defaultLine")+"><br></"+this.#ot.get("defaultLine")+">"}#Hl(){const t=this.#J.html._convertToCode(this.#Y.get("wysiwyg"),!1);let e="";if(this.#Q.get("iframe_fullPage")){const s=Ve.utils.getAttributesToString(this.#Y.get("_wd").body,null);e="<!DOCTYPE html>\n<html>\n"+this.#Y.get("_wd").head.outerHTML.replace(/>(?!\n)/g,">\n")+"<body "+s+">\n"+t+"</body>\n</html>"}else e=t;this._setCodeView(e)}#Nl(){const t=Ie.htmlToJson(this.#Y.get("wysiwyg").innerHTML),e=ze.jsonToMarkdown(t);this.#Y.get("markdown").value=e}#Al(){const t=this.#Y.get("markdown").value,e=ze.markdownToHtml(t,this.#ot.get("defaultLine"));this.#Y.get("wysiwyg").innerHTML=e.length>0?this.#J.html.clean(e,{forceFormat:!0,whitelist:null,blacklist:null}):"<"+this.#ot.get("defaultLine")+"><br></"+this.#ot.get("defaultLine")+">"}#Bl(t,e){if(!t)return;const s=(e.value.match(/\n/g)||[]).length+1;if(s!==(t.value.match(/\n/g)||[]).length){let e="";for(let t=1;t<=s;t++)e+=`${t}\n`;t.value=e}}_destroy(){}},{_d:Vn,_w:On}=Ae;class Rn{#J;#t;#Il;#Vl;#Ol;#Rl;#Pl;#zl;#Dl;#Fl;#ql;#Wl;#Ul;#Zl;#Gl=!1;#jl=!0;#Kl=[];#Yl=-1;#Xl="";#Jl={matchCase:!1,wholeWord:!1,regex:!1};#Ql;#tr=[];#er=null;#sr=null;#ir=null;#nr=null;#or=null;#lr=!1;static#rr=!1;static#ar(){if(Rn.#rr)return;Rn.#rr=!0;const t=Vn.createElement("style");t.textContent="::highlight(se-find-match){background-color:var(--se-find-match-color,rgba(255,213,0,.4));color:inherit}::highlight(se-find-current){background-color:var(--se-find-current-color,rgba(255,150,50,.7));color:inherit}",Vn.head.appendChild(t)}constructor(t){if(this.#J=t.$,this.#t=t.store,this.#Ql=!!On.Highlight&&!!CSS?.highlights,this.#J.options.get("finder_panel")){const t=function({lang:t,icons:e}){const s=`\n\t<div class="se-find-replace-row">\n\t\t<div class="se-find-input-wrapper">\n\t\t\t<input class="se-find-replace-input" type="text" placeholder="${t.find||"Find"}" spellcheck="false" autocomplete="off" />\n\t\t\t<div class="se-find-replace-toggle">\n\t\t\t\t<div class="se-find-replace-info">\n\t\t\t\t\t<span class="se-find-replace-count"></span>\n\t\t\t\t</div>\n\t\t\t\t<button class="se-btn se-find-replace-btn se-find-opt-case" type="button" data-command="opt-case" title="${t.finder_matchCase}">\n\t\t\t\t\t${e.match_case}\n\t\t\t\t</button>\n\t\t\t\t<button class="se-btn se-find-replace-btn se-find-opt-word" type="button" data-command="opt-word" title="${t.finder_wholeWord}">\n\t\t\t\t\t${e.whole_word}\n\t\t\t\t</button>\n\t\t\t\t<button class="se-btn se-find-replace-btn se-find-opt-regex" type="button" data-command="opt-regex" title="${t.finder_regex}">\n\t\t\t\t\t${e.regex}\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class="se-find-replace-buttons">\n\t\t\t<button class="se-btn se-find-replace-btn" type="button" data-command="prev" title="${t.finder_prev}\n(${Ae.shiftIcon} + Enter)">\n\t\t\t\t${e.arrow_up_small}\n\t\t\t</button>\n\t\t\t<button class="se-btn se-find-replace-btn" type="button" data-command="next" title="${t.finder_next}\n(Enter)">\n\t\t\t\t${e.arrow_down_small}\n\t\t\t</button>\n\t\t\t<button class="se-btn se-find-replace-btn se-find-toggle-replace" type="button" data-command="toggle-replace" title="${t.replace}">\n\t\t\t\t${e.swap_vert}\n\t\t\t</button>\n\t\t\t<button class="se-btn se-find-replace-btn" type="button" data-command="close" title="${t.close}">\n\t\t\t\t${e.cancel}\n\t\t\t</button>\n\t\t</div>\n\t</div>\n\t<div class="se-find-replace-row se-find-replace-row-replace">\n\t\t<div class="se-find-input-wrapper">\n\t\t\t<input class="se-find-replace-input se-replace-input" type="text" placeholder="${t.replace}" spellcheck="false" autocomplete="off" />\n\t\t</div>\n\t\t<div class="se-find-replace-buttons">\n\t\t\t<button class="se-btn se-find-replace-btn" type="button" data-command="replace" title="${t.replace}\n(Enter)">\n\t\t\t\t${e.replaceText}\n\t\t\t</button>\n\t\t\t<button class="se-btn se-find-replace-btn" type="button" data-command="replace-all" title="${t.replaceAll}">\n\t\t\t\t${e.relaceTextAll}\n\t\t\t</button>\n\t\t</div>\n\t</div>`,i=Ve.utils.createElement("DIV",{class:"se-find-replace"},s);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"]')}}(this.#J);this.#Il=t.panel,this.#Vl=t.findInput,this.#Ol=t.replaceInput,this.#Rl=t.countDisplay,this.#Pl=t.replaceRow,this.#zl=t.btnCase,this.#Dl=t.btnWord,this.#Fl=t.btnRegex,this.#ql=t.btnPrev,this.#Wl=t.btnNext,this.#Ul=t.btnReplace,this.#Zl=t.btnReplaceAll,this.#hr();const e=this.#J.frameRoots.values().next().value.get("container");if(this.#t.mode.isBottom){const t=this.#J.context.get("toolbar_main");e.insertBefore(this.#Il,t)}else{const t=e.querySelector(".se-wrapper");e.insertBefore(this.#Il,t)}Ae.isResizeObserverSupported&&(this.#ir=new ResizeObserver((()=>this.#cr())).observe(this.#J.context.get("toolbar_main")))}}get isOpen(){return this.#Gl}open(t=!0){const e=this.#J.frameContext;if(!e.get("isCodeView")&&!e.get("isMarkdownView")&&(this.#Gl=!0,this.#dr(),this.#Il)){this.#ql.disabled=!0,this.#Wl.disabled=!0,this.#Ul.disabled=!0,this.#Zl.disabled=!0,this.#cr();const e=this.#J.selection.get(),s=e&&!e.isCollapsed?e.toString().trim():"";Ve.utils.addClass(this.#Il,"se-find-replace-open"),this.#t.set("_preventBlur",!0),this.#ur(),t&&this.#pr(t),s&&(this.#Vl.value=s),this.#Vl.focus(),this.#Vl.select(),this.#Vl.value&&this.#gr()}}#cr(){if(!this.#Gl||!this.#Il)return;const t=this.#J.options.get("_toolbar_sticky");this.#t.mode.isBottom?(this.#Il.style.top="auto",this.#Il.style.bottom=t>=0?t+this.#J.context.get("toolbar_main").offsetHeight+"px":"0px"):this.#Il.style.top=t>=0?t+this.#J.context.get("toolbar_main").offsetHeight+"px":"0px"}close(){this.#Gl&&(this.#Gl=!1,this.#mr(),this.#Kl=[],this.#Yl=-1,this.#fr(),this.#vr(),this.#Il&&(Ve.utils.removeClass(this.#Il,"se-find-replace-open"),this.#br(),this.#t.set("_preventBlur",!1),this.#J.focusManager.nativeFocus()))}findNext(){this.#Gl&&0!==this.#Kl.length&&(this.#Yl=(this.#Yl+1)%this.#Kl.length,this.#yr())}findPrev(){this.#Gl&&0!==this.#Kl.length&&(this.#Yl=(this.#Yl-1+this.#Kl.length)%this.#Kl.length,this.#yr())}search(t,{matchCase:e,wholeWord:s,regex:i}={}){return this.#Gl||this.open(),void 0!==e&&(this.#Jl.matchCase=e),void 0!==s&&(this.#Jl.wholeWord=s),void 0!==i&&(this.#Jl.regex=i),this.#Xl=t||"",this.#Vl&&(this.#Vl.value=this.#Xl),this.#gr(),this.#Kl.length}replace(t){this.#Cr(t)}replaceAll(t){this.#wr(t)}get matchInfo(){return{current:this.#Yl+1,total:this.#Kl.length}}refresh(){this.#Gl&&this.#Xl&&!this.#lr&&(this.#lr=!0,this.#_r(),this.#tr=[],this.#lr=!1,clearTimeout(this.#sr),this.#sr=setTimeout((()=>this.#gr()),300))}#ur(){this.#br(),this.#nr=this.#J.eventManager.addGlobalEvent("keydown",(t=>{"Escape"===t.key&&(t.preventDefault(),t.stopPropagation(),this.close())}),!0)}#br(){this.#nr&&=this.#J.eventManager.removeGlobalEvent(this.#nr)}#dr(){this.#vr();const t=this.#J.frameContext.get("wysiwyg");this.#or=new MutationObserver((()=>this.refresh())),this.#or.observe(t,{childList:!0,subtree:!0,characterData:!0})}#vr(){this.#or&&(this.#or.disconnect(),this.#or=null)}#hr(){const t=this.#J.eventManager;t.addEvent(this.#Vl,"input",this.#xr.bind(this)),t.addEvent(this.#Vl,"keydown",this.#$r.bind(this)),t.addEvent(this.#Ol,"keydown",this.#kr.bind(this)),t.addEvent(this.#Il,"click",this.#Sr.bind(this)),Ae.isGecko&&t.addEvent(this.#Il,"mousedown",(t=>{if("BUTTON"===t.target.tagName){t.preventDefault();const e=Ve.query.getCommandTarget(t.target);e&&this.#J.eventManager._injectActiveEvent(e)}this.#t.set("_preventBlur",!0)}))}#xr(){this.#J.options.get("finder_liveSearch")&&(clearTimeout(this.#sr),this.#sr=setTimeout((()=>this.#gr()),120))}#$r(t){"Escape"===t.key?(t.preventDefault(),this.close()):"Enter"===t.key&&(t.preventDefault(),this.#J.options.get("finder_liveSearch")||this.#Vl.value===this.#Xl?t.shiftKey?this.findPrev():this.findNext():this.#gr())}#kr(t){"Escape"===t.key?(t.preventDefault(),this.close()):"Enter"===t.key&&(t.preventDefault(),this.#Cr())}#Sr(t){const e=Ve.query.getEventTarget(t),s=Ve.query.getCommandTarget(e);if(!s)return;t.preventDefault();switch(s.getAttribute("data-command")){case"prev":this.findPrev();break;case"next":this.findNext();break;case"toggle-replace":this.#pr(!this.#jl);break;case"close":this.close();break;case"replace":this.#Cr();break;case"replace-all":this.#wr();break;case"opt-case":this.#Jl.matchCase=!this.#Jl.matchCase,Ve.utils.toggleClass(this.#zl,"on",this.#Jl.matchCase),this.#gr();break;case"opt-word":this.#Jl.wholeWord=!this.#Jl.wholeWord,Ve.utils.toggleClass(this.#Dl,"on",this.#Jl.wholeWord),this.#gr();break;case"opt-regex":this.#Jl.regex=!this.#Jl.regex,Ve.utils.toggleClass(this.#Fl,"on",this.#Jl.regex),this.#gr()}}#pr(t){this.#jl=t,this.#Pl.style.display=t?"":"none",Ve.utils.toggleClass(this.#Il.querySelector(".se-find-toggle-replace"),"on",t),t&&this.#Ol.focus()}#gr(){const t=this.#Vl?this.#Vl.value:this.#Xl;if(this.#lr=!0,this.#mr(),this.#Kl=[],this.#Yl=-1,!t)return this.#Xl="",this.#fr(),void Ve.utils.removeClass(this.#Vl,"se-find-no-match");this.#Xl=t;const e=this.#J.frameContext.get("wysiwyg");this.#er=this.#Er(),this.#Kl=this.#Tr(t,e),this.#Kl.length>0?(this.#Yl=0,this.#Mr(),this.#yr(),Ve.utils.removeClass(this.#Vl,"se-find-no-match")):this.#Vl&&Ve.utils.toggleClass(this.#Vl,"se-find-no-match",t.length>0),this.#fr(),this.#lr=!1}#Tr(t,e){const s=[];if(!t||!e)return s;const i=this.#Jl.matchCase?"g":"gi";let n;if(this.#Jl.regex)try{n=new RegExp(t,i)}catch{return s}else{const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=this.#Jl.wholeWord?new RegExp(`\\b${e}\\b`,i):new RegExp(e,i)}const o=this.#er,l=this.#J.format,r=o.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),a=[];let h,c,d="",u=null;for(;h=r.nextNode();){const t=l.getLine(h,null)||e;u&&t!==u&&(d+="\n"),u=t,a.push({node:h,start:d.length}),d+=h.textContent.replace(/\u00A0/g," ")}if(!d)return s;n.lastIndex=0;let p=0;for(;null!==(c=n.exec(d));){if(0===c[0].length){n.lastIndex++;continue}const t=c.index,e=t+c[0].length,i=o.createRange();let l=!1;for(let s=p;s<a.length;s++){const n=a[s],o=n.start+n.node.textContent.length;if(!l&&t>=n.start&&t<o&&(i.setStart(n.node,t-n.start),l=!0,p=s),l&&e>n.start&&e<=o){i.setEnd(n.node,e-n.start);break}}l&&s.push(i)}return s}#Mr(){if(0===this.#Kl.length)return;const t=this.#J.frameContext.get("options").get("iframe");this.#Ql&&!t?this.#Hr():this.#Lr()}#Hr(){Rn.#ar();const t=new Highlight(...this.#Kl);CSS.highlights.set("se-find-match",t),this.#Nr()}#Nr(){if(this.#Yl>=0&&this.#Yl<this.#Kl.length){const t=new Highlight(this.#Kl[this.#Yl]);CSS.highlights.set("se-find-current",t)}else CSS.highlights.delete("se-find-current")}#Lr(){this.#_r();const t=this.#er;for(let e=this.#Kl.length-1;e>=0;e--){const s=this.#Kl[e],i=this.#Ar(t,s,e);for(let t=0;t<i.length;t++)this.#tr.push(i[t])}this.#tr.reverse(),this.#Br()}#Ar(t,e,s){const i=e.startContainer,n=e.endContainer,o=[];if(i===n)o.push(this.#Ir(t,i,e.startOffset,e.endOffset,s));else{const l=[i];let r=i;for(;r&&r!==n;)r=this.#Vr(r,e.commonAncestorContainer),r&&l.push(r);for(let r=l.length-1;r>=0;r--){const a=l[r],h=a===i?e.startOffset:0,c=a===n?e.endOffset:a.textContent.length;h>=c||o.push(this.#Ir(t,a,h,c,s))}}return o}#Ir(t,e,s,i,n){const o=s>0?e.splitText(s):e;i-s<o.textContent.length&&o.splitText(i-s);const l=t.createElement("mark");return l.className="se-find-mark",l.setAttribute("data-se-find-idx",String(n)),o.parentNode.insertBefore(l,o),l.appendChild(o),l}#Vr(t,e){let s=t;for(;s;){if(s.firstChild)s=s.firstChild;else{for(;s&&!s.nextSibling;)if(s=s.parentNode,s===e)return null;if(!s)return null;s=s.nextSibling}if(3===s.nodeType)return s}return null}#Br(){for(const t of this.#tr)Ve.utils.removeClass(t,"se-find-current");if(this.#Yl>=0)for(const t of this.#tr)t.getAttribute("data-se-find-idx")===String(this.#Yl)&&Ve.utils.addClass(t,"se-find-current")}#mr(){const t=this.#J.frameContext.get("options").get("iframe");this.#Ql&&!t&&(CSS.highlights.delete("se-find-match"),CSS.highlights.delete("se-find-current")),this.#_r()}#_r(){const t=this.#J.frameContext.get("wysiwyg").querySelectorAll("mark.se-find-mark");if(0!==t.length){for(const e of t){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e),t.normalize()}}this.#tr=[]}}#yr(){if(this.#Yl<0||this.#Yl>=this.#Kl.length)return;const t=this.#J.frameContext.get("options").get("iframe");if(this.#Ql&&!t){this.#Nr();const t=this.#Kl[this.#Yl];this.#J.selection.scrollTo(t,{behavior:"auto"})}else{this.#Br();const t=this.#tr.find((t=>t.getAttribute("data-se-find-idx")===String(this.#Yl)));t&&this.#J.selection.scrollTo(t,{behavior:"auto",noFocus:!0})}this.#fr()}#Cr(t){if(this.#Yl<0||0===this.#Kl.length)return;this.#mr();const e=this.#J.frameContext.get("wysiwyg"),s=this.#Tr(this.#Xl,e);this.#Yl>=s.length||(this.#Or(s[this.#Yl],t??(this.#Ol?this.#Ol.value:"")),this.#J.history.push(!1),this.#gr(),this.#Yl>=this.#Kl.length&&this.#Kl.length>0&&(this.#Yl=0,this.#yr()))}#wr(t){if(0===this.#Kl.length)return;this.#mr();const e=this.#J.frameContext.get("wysiwyg"),s=this.#Tr(this.#Xl,e);if(0!==s.length){t=t??(this.#Ol?this.#Ol.value:"");for(let e=s.length-1;e>=0;e--)this.#Or(s[e],t);e.normalize(),this.#J.history.push(!1),this.#gr()}}#Or(t,e){const s=t.startContainer,i=this.#er.createTextNode(e);if(s===t.endContainer)return t.deleteContents(),t.insertNode(i),void s.parentNode?.normalize();t.deleteContents(),3===s.nodeType?s.parentNode&&(s.parentNode.insertBefore(i,s.nextSibling),s.parentNode.normalize()):(t.insertNode(i),i.parentNode?.normalize())}#fr(){if(!this.#Il)return;const t=this.#Kl.length>0;this.#Rl.textContent=t?`${this.#Yl+1}/${this.#Kl.length}`:this.#Xl?"0":"",this.#ql.disabled=!t,this.#Wl.disabled=!t,this.#Ul.disabled=!t,this.#Zl.disabled=!t}#Er(){const t=this.#J.frameContext;return t.get("options").get("iframe")?t.get("_wd"):Vn}_destroy(){this.#br(),this.#vr(),this.#ir&&=this.#ir.disconnect(),clearTimeout(this.#sr)}}const Pn=Rn;const zn=class{$;constructor(t){this.$=t.$}},{isMobile:Dn,_w:Fn}=Ae;function qn(t){const e=Ve.query.getEventTarget(t);let s=e;this.$.store.mode.isBalloon&&!this.$.context.get("toolbar_sub_main")?.contains(s)&&this._hideToolbar_sub();const i=Ve.check.isInputElement(s);if(i?this.$.store.set("_preventBlur",!1):this.$.frameContext.get("wysiwyg").contains(this.$.selection.getNode())||this.$.focusManager.focus(),Ve.query.getParentElement(s,".se-dropdown"))t.stopPropagation(),this.$.ui.preventToolbarHide(!0);else{let n=s.getAttribute("data-command"),o=s.className;for(;s&&!n&&!/(se-menu-list|sun-editor-common|se-menu-tray)/.test(o);)s=s.parentElement,n=s.getAttribute("data-command"),o=s.className;if(i&&/^INPUT$/i.test(s?.getAttribute("data-type"))){if(this.$.store.set("_preventBlur",!0),this._inputFocus=!0,this.$.store.get("hasFocus")||this.applyTagEffect(),!Ve.check.isInputElement(e)||e.disabled)return;const t=this.$.plugins[n];if(!t)return;if(this.__inputBlurEvent&&this.__removeInput(),"function"==typeof t.toolbarInputChange&&(this.__inputPlugin={obj:t,target:e,value:e.value}),this.__inputBlurEvent=this.$.eventManager.addEvent(e,"blur",(s=>{if(!t.isInputActive)try{const i=e.value.trim();"function"==typeof t.toolbarInputChange&&i!==this.__inputPlugin.value&&t.toolbarInputChange({target:e,value:i,event:s})}finally{Fn.setTimeout((()=>this._inputFocus=!1),0),this.__removeInput()}})),!t)return;"function"==typeof t.toolbarInputKeyDown&&(this.__inputKeyEvent=this.$.eventManager.addEvent(e,"keydown",(s=>{t.toolbarInputKeyDown({target:e,event:s})})))}else{if(this.__inputBlurEvent&&this.__inputPlugin){const e=this.__inputPlugin.target.value.trim();return e!==this.__inputPlugin.value&&this.__inputPlugin.obj.toolbarInputChange({target:this.__inputPlugin.target,value:e,event:t}),void this.__removeInput()}this.$.frameContext.get("isCodeView")||(Dn?this.$.store.set("_preventBlur",!0):(t.preventDefault(),Ae.isGecko&&n&&this.$.eventManager._injectActiveEvent(s)))}n!==this.$.menu.currentDropdownName&&n!==this.$.menu.currentContainerName||t.stopPropagation()}}function Wn(t){const e=Ve.query.getEventTarget(t),s=Ve.query.getCommandTarget(e);if(!s)return;let i=s,n="";for(;i&&!/se-menu-tray/.test(i.className)&&!n;)i=i.parentElement,n=i?.getAttribute("data-key");if(!n)return;const o=this.$.plugins[n];o&&"function"==typeof o.action&&(t.stopPropagation(),o.action(s))}function Un(t){const e=Ve.query.getEventTarget(t);this.$.commandDispatcher.runFromTarget(e)}const{_w:Zn}=Ae,Gn=new WeakMap;async function jn(t,e){const s=Ve.query.getEventTarget(e);this.$.store.set("_mousedown",!0),this.__onDownEv&&Kn.call(this),this.__onDownEv=this.$.eventManager.addGlobalEvent("mouseup",Kn.bind(this)),t.get("isReadOnly")||Ve.check.isNonEditable(t.get("wysiwyg"))||(this.$.format._isExcludeSelectionElement(s)?e.preventDefault():(this._setSelectionSync(),Zn.setTimeout(this.$.selection.init.bind(this.$.selection),0),!1!==await this.$.eventManager.triggerEvent("onMouseDown",{frameContext:t,event:e})&&!1!==await this._callPluginEventAsync("onMouseDown",{frameContext:t,event:e})&&(this.$.store.mode.isBalloon?this._hideToolbar():this.$.store.mode.isSubBalloon&&this._hideToolbar_sub(),/FIGURE/i.test(s?.nodeName)&&e.preventDefault())))}function Kn(){this.$.store.set("_mousedown",!1),this.__onDownEv=this.$.eventManager.removeGlobalEvent(this.__onDownEv)}async function Yn(t,e){!1!==await this.$.eventManager.triggerEvent("onMouseUp",{frameContext:t,event:e})&&await this._callPluginEventAsync("onMouseUp",{frameContext:t,event:e})}async function Xn(t,e){const s=Ve.query.getEventTarget(e);if(t.get("isReadOnly"))return e.preventDefault(),Ve.check.isAnchor(s)&&Zn.open(s.href,s.target),!1;if(Ve.check.isNonEditable(t.get("wysiwyg")))return;if(!1===await this.$.eventManager.triggerEvent("onClick",{frameContext:t,event:e}))return;if(!1===await this._callPluginEventAsync("onClick",{frameContext:t,event:e}))return;const i=this.$.component.get(s);if(i)return e.preventDefault(),void this.$.component.select(i.target,i.pluginName);if(this.$.selection.init(),3===e.detail){const t=this.$.selection.getRange();this.$.format.isLine(t.endContainer)&&0===t.endOffset&&this.$.selection.setRange(t.startContainer,t.startOffset,t.startContainer,t.startContainer.textContent.length)}const n=this.$.selection.getNode(),o=this.$.format.getLine(n,null),l=this.$.format.getBlock(n,null);if(!o&&!Ve.check.isNonEditable(s)&&!Ve.check.isList(l)){const t=this.$.selection.getRange();if(this.$.format.getLine(t.startContainer)===this.$.format.getLine(t.endContainer))if(Ve.check.isList(l)){e.preventDefault();const t=n.nextElementSibling,s=Ve.utils.createElement("LI",null,n);l.insertBefore(s,t),this.$.focusManager.focus()}else Ve.check.isWysiwygFrame(n)||this.$.component.is(n)||Ve.check.isTableElements(n)&&!Ve.check.isTableCell(n)||null===this._setDefaultLine(this.$.format.isBlock(l)?"DIV":this.$.options.get("defaultLine"))||(e.preventDefault(),this.$.focusManager.focus())}this.$.commandDispatcher._copyFormat(),(this.$.store.mode.isBalloon||this.$.store.mode.isSubBalloon)&&Zn.setTimeout(this._toggleToolbarBalloon.bind(this),0)}function Jn(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return!1;let s=Gn.get(t);s||(s={rafId:null,event:null},Gn.set(t,s)),s.event=e,null===s.rafId&&(s.rafId=Zn.requestAnimationFrame((()=>{const e=s.event;if(s.rafId=null,s.event=null,!e)return;const i=Ve.query.getEventTarget(e);!1===yi.get("__overInfo")||this.$.ui.selectMenuOn||this.$.component.hoverSelect(i),this.$.ui.blockHandle?.positionForTarget(i,e.clientY),this._callPluginEvent("onMouseMove",{frameContext:t,event:e})})))}async function Qn(t,e){this.$.ui.blockHandle?.hide(e),!1!==await this.$.eventManager.triggerEvent("onMouseLeave",{frameContext:t,event:e})&&await this._callPluginEventAsync("onMouseLeave",{frameContext:t,event:e})}const to={"event.prevent":({ctx:t})=>t.e.preventDefault(),"event.stop":({ctx:t})=>t.e.stopPropagation(),"event.prevent.stop":({ctx:t})=>{t.e.preventDefault(),t.e.stopPropagation()},"cache.styleNode":({ports:t})=>t.styleNodeCache(),"cache.formatAttrsTemp":({ports:t},{attrs:e})=>t.formatAttrsTempCache(e),"focusManager.nativeFocus":({ports:t})=>t.focusManager.nativeFocus(),"history.push":({ports:t},e)=>t.history.push(e),"documentType.refreshHeader":({ctx:t})=>{o.setTimeout((()=>{t.fc.get("documentType").reHeader()}),0)},"component.deselect":({ports:t})=>t.component.deselect(),"selection.setRange":({ports:t},{sc:e,so:s,ec:i,eo:n})=>t.selection.setRange(e,s,i,n),"format.removeBlock":({ports:t},{rangeEl:e,selectedFormats:s,newBlockElement:i,shouldDelete:n,skipHistory:o})=>t.format.removeBlock(e,{selectedFormats:s,newBlockElement:i,shouldDelete:n,skipHistory:o}),"dom.utils.removeItem":(t,{item:e})=>Ve.utils.removeItem(e),"select.component.fallback":({ports:t},{cmponentInfo:e})=>{!1===t.component.select(e.target,e.pluginName)&&t.focusManager.blur()}},eo={"del.format.removeAndMove":({ports:t},{container:e,formatEl:s})=>{const i=t.html.remove();if(i.commonCon!==i.container&&s.parentElement)if(s.contains(e)){const e=function(t){const e=t.lastChild,s=t.nextElementSibling;if(!s)return e;if(Ve.check.isZeroWidth(s))return Ve.utils.removeItem(s),e;const i=s.childNodes;for(;i[0];)t.appendChild(i[0]);return Ve.utils.removeItem(s),e}(s);t.selection.setRange(e,e.textContent.length,e,e.textContent.length)}else{const{focusNode:e,focusOffset:i}=function(t){const e=t.childNodes,s=t.previousElementSibling;let i=e[0],n=0;if(!s)return{focusNode:i,focusOffset:n};if(Ve.check.isZeroWidth(s))return Ve.utils.removeItem(s),{focusNode:i,focusOffset:n};if(e.length>1||e[0]?.textContent.length>0)for(;e[0];)s.appendChild(e[0]);else i=s.lastChild,n=i.textContent.length;return Ve.utils.removeItem(t),{focusNode:i,focusOffset:n}}(s);t.selection.setRange(e,i,e,i)}},"backspace.brline.strip":({ctx:t,ports:e},{formatEl:s})=>{const i=t.options.get("defaultLine"),n=s.parentNode,o=Ve.utils.createElement(i);for(;s.firstChild&&!Ve.check.isBreak(s.firstChild);)o.appendChild(s.firstChild);s.firstChild&&Ve.check.isBreak(s.firstChild)&&s.removeChild(s.firstChild),o.firstChild||(o.innerHTML="<br>"),n.insertBefore(o,s),s.firstChild&&(s.textContent.trim()||s.querySelector("br"))||n.removeChild(s);const l=o.firstChild;e.selection.setRange(l,0,l,0)},"backspace.format.maintain":({ctx:t},{formatEl:e})=>{if(e.nodeName.toUpperCase()===t.options.get("defaultLine").toUpperCase()){e.innerHTML="<br>";const t=e.attributes;for(;t[0];)e.removeAttribute(t[0].name)}else e.parentNode.replaceChild(Ve.utils.createElement(t.options.get("defaultLine"),null,"<br>"),e)},"backspace.component.select":({ports:t},{selectionNode:e,range:s,fileComponentInfo:i})=>{let n=null;Ve.check.isBreak(e)?Ve.utils.removeItem(e):Ve.check.isBreak(n=s.startContainer.childNodes?.[s.startOffset])&&Ve.utils.removeItem(n),!1===t.component.select(i.target,i.pluginName)&&t.focusManager.blur()},"backspace.component.remove":({ports:t},{isList:e,sel:s,formatEl:i,fileComponentInfo:n})=>{e&&Ve.utils.removeItem(s),0===i.textContent.length&&Ve.utils.removeItem(i),!1===t.component.select(n.target,n.pluginName)&&t.focusManager.blur()},"backspace.list.mergePrev":({ports:t},{prev:e,formatEl:s,rangeEl:i})=>{let n=e===i.parentNode?i.previousSibling:e.lastChild;n||(n=Ve.utils.createTextNode(Be.zeroWidthSpace),i.parentNode.insertBefore(n,i.parentNode.firstChild));const o=3===n.nodeType?n.textContent.length:1,l=s.childNodes;let r=n,a=l[0];for(;a=l[0];)e.insertBefore(a,r.nextSibling),r=a;Ve.utils.removeItem(s),0===i.children.length&&Ve.utils.removeItem(i),t.selection.setRange(n,o,n,o)},"backspace.list.removeNested":({ports:t},{range:e})=>{t.html.remove(),3===e.startContainer.nodeType&&t.selection.setRange(e.startContainer,e.startContainer.textContent.length,e.startContainer,e.startContainer.textContent.length)},"backspace.emptyLine.mergePrev":({ports:t},{formatEl:e,prev:s})=>{Ve.utils.removeItem(e),so(t,s,!0)},"backspace.brline.rowMerge":({ports:t},{rowEndBr:e,rowStartBr:s})=>{const i=s.nextSibling;i!==e&&3===i?.nodeType&&Ve.check.isZeroWidth(i)&&Ve.utils.removeItem(i);const n=s.previousSibling;if(Ve.utils.removeItem(s),n&&3===n.nodeType)t.selection.setRange(n,n.textContent.length,n,n.textContent.length);else if(Ve.check.isBreak(n))t.selection.setRange(e,0,e,0);else{const s=e.parentNode;t.selection.setRange(s,0,s,0)}},"backspace.softBreak.merge":({ports:t},{zws:e})=>{const s=e.previousSibling,i=e.parentNode,n=s?.previousSibling;Ve.utils.removeItem(e),s&&Ve.utils.removeItem(s),n?io(t,n):i&&t.selection.setRange(i,0,i,0)},"delete.component.select":({ports:t},{formatEl:e,fileComponentInfo:s})=>{if(Ve.check.isListCell(e)){const t=s.container.previousSibling;Ve.check.isZeroWidth(t)&&Ve.utils.removeItem(t)}else Ve.check.isZeroWidth(e)&&Ve.utils.removeItem(e);!1===t.component.select(s.target,s.pluginName)&&t.focusManager.blur()},"delete.component.selectNext":({ports:t,ctx:e},{formatEl:s,nextEl:i})=>{if(Ve.check.isZeroWidth(s)&&(Ve.utils.removeItem(s),Ve.check.isTable(i))){let e=Ve.query.getEdgeChild(i,Ve.check.isTableCell,!1);return e=e.firstElementChild||e,void t.selection.setRange(e,0,e,0)}const n=t.component.get(i);n?(e.e.stopPropagation(),!1===t.component.select(n.target,n.pluginName)&&t.focusManager.blur()):t.component.is(i)&&(e.e.stopPropagation(),Ve.utils.removeItem(i))},"delete.list.removeNested":({ports:t,ctx:e},{range:s,formatEl:i,rangeEl:n})=>{s.startContainer!==s.endContainer&&t.html.remove();const o=Ve.utils.arrayFind(i.children,Ve.check.isList)||i.nextElementSibling||n.parentElement.nextElementSibling;if(o&&(Ve.check.isList(o)||Ve.utils.arrayFind(o.children,Ve.check.isList))){let s,n;if(e.e.preventDefault(),Ve.check.isList(o)){const t=o.firstElementChild;for(n=t.childNodes,s=n[0];n[0];)i.insertBefore(n[0],o);Ve.utils.removeItem(t)}else{for(s=o.firstChild,n=o.childNodes;n[0];)i.appendChild(n[0]);Ve.utils.removeItem(o)}t.selection.setRange(s,0,s,0),t.history.push(!0)}},"delete.emptyLine.mergeNext":({ports:t},{formatEl:e,next:s})=>{Ve.utils.removeItem(e),so(t,s,!1)},"delete.brline.rowMerge":({ports:t},{rowEndBr:e})=>{let s=e.nextSibling;3===s?.nodeType&&Ve.check.isZeroWidth(s)&&(s=s.nextSibling);const i=e.parentNode;Ve.utils.removeItem(e),s&&(3===s.nodeType||Ve.check.isBreak(s))?t.selection.setRange(s,0,s,0):t.selection.setRange(i,i.childNodes.length,i,i.childNodes.length)},"delete.softBreak.merge":({ports:t},{br:e})=>{const s=e.previousSibling,i=e.parentNode,n=e.nextSibling;n&&3===n.nodeType&&Ve.check.isZeroWidth(n.textContent)&&Ve.utils.removeItem(n),Ve.utils.removeItem(e),s?io(t,s):i&&t.selection.setRange(i,0,i,0)},"tab.format.indent":({ports:t,ctx:e},{range:s,formatEl:i,shift:n})=>{const o=t.format.getLines(null),l=[],r=[],a=Ve.check.isListCell(o[0]),h=Ve.check.isListCell(o.at(-1));let c={sc:s.startContainer,so:s.startOffset,ec:s.endContainer,eo:s.endOffset};for(let t,e=0,s=o.length;e<s;e++)if(t=o[e],Ve.check.isListCell(t)){if(!t.previousElementSibling&&!n)continue;l.push(t)}else r.push(t);if(l.length>0&&(c=t.listFormat.applyNested(l,n)),r.length>0)if(n){const t=r.length-1;for(let e,s=0;s<=t;s++){e=r[s].childNodes;for(let t,s=0,i=e.length;s<i&&(t=e[s],t);s++)if(!Ve.check.isZeroWidth(t)){/^\s{1,4}$/.test(t.textContent)?Ve.utils.removeItem(t):/^\s{1,4}/.test(t.textContent)&&(t.textContent=t.textContent.replace(/^\s{1,4}/,""));break}}const e=Ve.query.getEdgeChild(r[0],"text",!1),s=Ve.query.getEdgeChild(r[t],"text",!0);!a&&e&&(c.sc=e,c.so=0),!h&&s&&(c.ec=s,c.eo=s.textContent.length)}else if(1===r.length){let n=e.store.get("tabSize")+1;if(e.options.get("syncTabIndent")){const e=Ve.query.findTextIndexOnLine(i,s.startContainer,s.startOffset,(e=>t.component.is(e))),o=t.format.isLine(i.previousElementSibling)?Ve.query.findTabEndIndex(i.previousElementSibling,e,2):0;o>e&&(n=o-e)}const o=Ve.utils.createTextNode(new Array(n).join(" "));if(!t.html.insertNode(o,{afterNode:null,skipCharCount:!1}))return!1;a||(c.sc=o,c.so=o.length),h||(c.ec=o,c.eo=o.length)}else{const t=Ve.utils.createTextNode(new Array(e.store.get("tabSize")+1).join(" ")),s=r.length-1;for(let e,i=0;i<=s;i++)e=r[i].firstChild,e&&(Ve.check.isBreak(e)?r[i].insertBefore(t.cloneNode(!1),e):e.textContent=t.textContent+e.textContent);const i=Ve.query.getEdgeChild(r[0],"text",!1),n=Ve.query.getEdgeChild(r[s],"text",!0);!a&&i&&(c.sc=i,c.so=0),!h&&n&&(c.ec=n,c.eo=n.textContent.length)}t.selection.setRange(c.sc,c.so,c.ec,c.eo)},"caret.scrollTo":({ports:t},{range:e})=>{t.caretScrollTo(e)},"enter.line.addDefault":({ports:t},{formatEl:e})=>{const s=t.format.addLineAfter(e).firstChild;t.selection.setRange(s,0,s,0)},"enter.list.addItem":({ports:t},{formatEl:e,selectionNode:s})=>{const i=Ve.utils.createElement("BR"),n=Ve.utils.createElement("LI",null,i);e.parentNode.insertBefore(n,e.nextElementSibling),n.appendChild(s.nextSibling),t.selection.setRange(i,1,i,1)},"enter.format.exitEmpty":({ports:t,ctx:e},{formatEl:s,rangeEl:i})=>{let n=null;if(Ve.check.isListCell(i.parentElement)){const t=s.parentNode.parentElement;i=t.parentElement;const o=Ve.utils.createElement("LI");o.innerHTML="<br>",Ve.utils.copyTagAttributes(o,s,e.options.get("lineAttrReset")),n=o,i.insertBefore(n,t.nextElementSibling)}else{let o;o=Ve.check.isTableCell(i.parentElement)?"DIV":Ve.check.isList(i.parentElement)?"LI":t.format.isLine(i.nextElementSibling)?i.nextElementSibling.nodeName:t.format.isLine(i.previousElementSibling)?i.previousElementSibling.nodeName:e.options.get("defaultLine"),n=Ve.utils.createElement(o);const l=t.format.removeBlock(i,{selectedFormats:[s],newBlockElement:null,shouldDelete:!0,skipHistory:!0});l.cc.insertBefore(n,l.ec)}n.innerHTML="<br>",t.nodeTransform.removeAllParents(s,null,null),t.selection.setRange(n,1,n,1)},"enter.format.cleanBrAndZWS":({ports:t},{selectionNode:e,selectionFormat:s,brBlock:i,children:n,offset:o})=>{s?Ve.utils.removeItem(n[o-1]):Ve.utils.removeItem(e);const l=i.nextElementSibling,r=t.format.addLine(i,t.format.isLine(l)?l:null);Ve.utils.copyFormatAttributes(r,i),t.selection.setRange(r,1,r,1)},"enter.format.insertBrHtml":({ports:t},{brBlock:e,range:s,wSelection:i,offset:n})=>{t.html.insert(s.collapsed&&Ve.check.isBreak(s.startContainer.childNodes[s.startOffset-1])?"<br>":"<br><br>",{selectInserted:!1,skipCharCount:!0,skipCleaning:!0});let o=i.focusNode;const l=i.focusOffset;e===o&&(o=o.childNodes[l-n>1?l-1:l]),t.selection.setRange(o,1,o,1),t.setOnShortcutKey(!0)},"enter.brline.insert":({ports:t},{range:e})=>{t.selection.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset),e.collapsed||t.html.remove();const s=Ve.utils.createElement("BR");t.html.insertNode(s,{afterNode:null,skipCharCount:!0}),s.nextSibling||s.parentNode.appendChild(Ve.utils.createElement("BR"));const i=s.nextSibling;t.selection.setRange(i,0,i,0),t.setOnShortcutKey(!0)},"enter.shift.br":({ports:t,ctx:e},{range:s})=>{const i=e.fc.get("_wd"),n=t.selection.get(),o=n?.rangeCount>0&&e.fc.get("wysiwyg").contains(n.focusNode)?n.getRangeAt(0):s,l=i.createRange();if(l.setStart(o.startContainer,o.startOffset),l.setEnd(o.endContainer,o.endOffset),o.collapsed||(l.deleteContents(),l.collapse(!0)),1===l.startContainer.nodeType&&Ve.check.isBreak(l.startContainer)){const t=l.startContainer;l.setStart(t.parentNode,Ve.utils.getArrayIndex(t.parentNode.childNodes,t)+l.startOffset),l.collapse(!0)}const r=Ve.utils.createElement("BR");l.insertNode(r);const a=r.nextSibling;if(a&&3===a.nodeType&&!Ve.check.isZeroWidth(a.textContent))t.selection.setRange(a,0,a,0);else{const e=Ve.utils.createTextNode(Be.zeroWidthSpace);r.parentNode.insertBefore(e,r.nextSibling),t.selection.setRange(e,1,e,1)}t.history.push(!1)},"enter.brline.exit":({ports:t},{brBlock:e})=>{const s=e.lastChild;s&&(Ve.check.isBreak(s)||Ve.check.isZeroWidth(s.textContent))&&Ve.utils.removeItem(s);const i=e.nextElementSibling,n=t.format.addLine(e,t.format.isLine(i)?i:null);Ve.utils.copyFormatAttributes(n,e),t.selection.setRange(n,1,n,1)},"enter.format.insertBrNode":({ports:t},{wSelection:e})=>{const s=e.focusNode.nextSibling,i=Ve.utils.createElement("BR");t.html.insertNode(i,{afterNode:null,skipCharCount:!0});const n=i.previousSibling,o=i.nextSibling;Ve.check.isBreak(s)||Ve.check.isBreak(n)||o&&!Ve.check.isZeroWidth(o)?t.selection.setRange(o,0,o,0):(i.parentNode.insertBefore(i.cloneNode(!1),i),t.selection.setRange(i,1,i,1)),t.setOnShortcutKey(!0)},"enter.format.breakAtEdge":({ports:t,ctx:e},{formatEl:s,selectionNode:i,formatStartEdge:n,formatEndEdge:o,bidiSwapped:l})=>{const r=Ve.utils.createElement("BR"),a=Ve.utils.createElement(s.nodeName,null,r);Ve.utils.copyTagAttributes(a,s,e.options.get("lineAttrReset"));let h=r,c=i;do{if(!Ve.check.isBreak(c)&&1===c.nodeType){const t=c.cloneNode(!1);t.appendChild(h),h=t}c=c.parentElement}while(s!==c&&s.contains(c));if(a.appendChild(h),s.parentNode.insertBefore(a,n&&!o?s:s.nextElementSibling),o)t.selection.setRange(r,1,r,1);else if(l)t.selection.setRange(s,1,s,1);else{const e=s.firstChild||s;t.selection.setRange(e,0,e,0)}},"enter.format.breakWithSelection":({ports:t,ctx:e},{formatEl:s,range:i,formatStartEdge:n,formatEndEdge:o})=>{const l=t.format.getLine(i.startContainer,null)!==t.format.getLine(i.endContainer,null),r=s.cloneNode(!1);r.innerHTML="<br>";const a=i.commonAncestorContainer,h=a===i.startContainer&&a===i.endContainer&&Ve.check.isZeroWidth(a)?{container:a,offset:i.endOffset,prevContainer:a.previousElementSibling,commonCon:a}:t.html.remove();let c=t.format.getLine(h.container,null),d=0;if(!c)return void(Ve.check.isWysiwygFrame(h.container)&&(t.enterPrevent(e.e),e.fc.get("wysiwyg").appendChild(r),c=r,Ve.utils.copyTagAttributes(c,s,e.options.get("lineAttrReset")),t.selection.setRange(c,d,c,d)));const u=t.format.getBlock(h.container);c=c.contains(u)?Ve.query.getEdgeChild(u,(e=>Boolean(t.format.getLine(e))),!1):c,l?o&&!n?(c.parentNode.insertBefore(r,h.prevContainer&&h.container!==h.prevContainer?c:c.nextElementSibling),c=r,d=0):(d=h.offset,n&&(c.parentNode.insertBefore(r,c),o&&(d=0))):o&&n?(c.parentNode.insertBefore(r,c),d=0):o?(c=c.parentNode.insertBefore(r,c.nextElementSibling),c=r,d=0):c=t.nodeTransform.split(h.container,h.offset,Ve.query.getNodeDepth(s)),t.enterPrevent(e.e),Ve.utils.copyTagAttributes(c,s,e.options.get("lineAttrReset")),t.selection.setRange(c,d,c,d)},"enter.format.breakAtCursor":({ports:t,ctx:e},{formatEl:s,range:i})=>{let n=null;n=Ve.check.isZeroWidth(s)?t.format.addLine(s,s.cloneNode(!1)):t.nodeTransform.split(i.endContainer,i.endOffset,Ve.query.getNodeDepth(s)),t.enterPrevent(e.e),Ve.utils.copyTagAttributes(n,s,e.options.get("lineAttrReset")),t.selection.setRange(n,0,n,0)},"enter.figcaption.exitInList":({ports:t},{formatEl:e})=>{const s=t.format.addLine(e,null);t.selection.setRange(s,0,s,0)},"keydown.input.insertNbsp":({ports:t})=>{const e=t.html.insertNode(Ve.utils.createTextNode(" "),{afterNode:null,skipCharCount:!0});e&&t.selection.setRange(e,e.length,e,e.length)},"keydown.input.insertZWS":({ports:t})=>{const e=Ve.utils.createTextNode(Be.zeroWidthSpace);t.html.insertNode(e,{afterNode:null,skipCharCount:!0}),t.selection.setRange(e,1,e,1)}};function so(t,e,s){const i=s?e.childNodes.length:0;t.selection.setRange(e,i,e,i)}function io(t,e){const s=3===e.nodeType?e.textContent.length:e.childNodes.length;t.selection.setRange(e,s,e,s)}async function no(t,e){const s={...to,...eo};for(const i of t){if("action.stop"===i.t)return!1;const t=s[i.t];if(t){if(!1===await t(e,i.p))return!1}}}function oo(t){const e=t.selection.getRange(),s=e.startContainer,i=e.endContainer,n=t.format.getBlock(s),o=t.format.getBlock(i),l=Ve.check.isTableCell(n),r=Ve.check.isTableCell(o);if((l&&!n.previousElementSibling&&!n.parentElement.previousElementSibling||r&&!o.nextElementSibling&&!o.parentElement.nextElementSibling)&&n!==o){const s=Ve.query.getParentElement(e.commonAncestorContainer,Ve.check.isFigure)?.parentElement||e.commonAncestorContainer;if(l){if(r)return Ve.utils.removeItem(Ve.query.getParentElement(n,(t=>s===t.parentNode))),t.focusManager.nativeFocus(),!0;Ve.utils.removeItem(Ve.query.getParentElement(n,(t=>s===t.parentNode)))}else Ve.utils.removeItem(Ve.query.getParentElement(o,(t=>s===t.parentNode)))}const a=1===s.nodeType?Ve.query.getParentElement(s,".se-component"):null,h=1===i.nodeType?Ve.query.getParentElement(i,".se-component"):null;return a&&Ve.utils.removeItem(a),h&&Ve.utils.removeItem(h),!1}function lo(t,e,s){const i=s?e.startContainer:e.endContainer,n=s?e.startOffset:e.endOffset,o=s?"previousSibling":"nextSibling";let l;return 1===i.nodeType?(l=ro(t,i.childNodes[n],o,i),Ve.check.isComponentContainer(l)||Ve.check.isNonEditable(l)?l:null):(l=ro(t,i,o,i),Ve.check.isEdgePoint(i,n,s?"front":"end")&&(Ve.check.isComponentContainer(l)||Ve.check.isNonEditable(l))?l:null)}function ro(t,e,s,i){if(!e)return null;let n=e[s];if(!n){if(n=t.format.getLine(i),n=n?n[s]:null,!n||t.component.is(n))return null;n="previousSibling"===s?n.firstChild:n.lastChild}return n}function ao(t,e,s,i){if(!t.collapsed||!e)return!1;const n=t.getBoundingClientRect();if(n.height<=0)return!1;const o=i.createRange();o.selectNodeContents(e);const l=o.getBoundingClientRect();return!(l.width<=2)&&("front"===s?n.left<=l.left+2:n.left>=l.right-2)}const ho=()=>({t:"event.prevent"}),co=()=>({t:"event.prevent.stop"}),uo=()=>({t:"cache.styleNode"}),po=t=>({t:"cache.formatAttrsTemp",p:{attrs:t}}),go=()=>({t:"component.deselect"}),mo=()=>({t:"focusManager.nativeFocus"}),fo=t=>({t:"history.push",p:t}),vo=()=>({t:"documentType.refreshHeader"}),bo=(t,e,s,i,n)=>({t:"format.removeBlock",p:{rangeEl:t,selectedFormats:e,newBlockElement:s,shouldDelete:i,skipHistory:n}}),yo=t=>({t:"dom.utils.removeItem",p:{item:t}}),Co=t=>({t:"select.component.fallback",p:{cmponentInfo:t}}),wo=(t,e)=>({t:"del.format.removeAndMove",p:{container:t,formatEl:e}}),_o=t=>({t:"backspace.format.maintain",p:{formatEl:t}}),xo=t=>({t:"backspace.brline.strip",p:{formatEl:t}}),$o=(t,e,s)=>({t:"backspace.component.select",p:{selectionNode:t,range:e,fileComponentInfo:s}}),ko=(t,e,s,i)=>({t:"backspace.component.remove",p:{isList:t,sel:e,formatEl:s,fileComponentInfo:i}}),So=(t,e,s)=>({t:"backspace.list.mergePrev",p:{prev:t,formatEl:e,rangeEl:s}}),Eo=t=>({t:"backspace.list.removeNested",p:{range:t}}),To=(t,e)=>({t:"backspace.emptyLine.mergePrev",p:{formatEl:t,prev:e}}),Mo=(t,e)=>({t:"backspace.brline.rowMerge",p:{rowEndBr:t,rowStartBr:e}}),Ho=t=>({t:"backspace.softBreak.merge",p:{zws:t}}),Lo=(t,e)=>({t:"delete.component.select",p:{formatEl:t,fileComponentInfo:e}}),No=(t,e)=>({t:"delete.component.selectNext",p:{formatEl:t,nextEl:e}}),Ao=(t,e,s)=>({t:"delete.list.removeNested",p:{range:t,formatEl:e,rangeEl:s}}),Bo=(t,e)=>({t:"delete.emptyLine.mergeNext",p:{formatEl:t,next:e}}),Io=t=>({t:"delete.brline.rowMerge",p:{rowEndBr:t}}),Vo=t=>({t:"delete.softBreak.merge",p:{br:t}}),Oo=(t,e,s)=>({t:"tab.format.indent",p:{range:t,formatEl:e,shift:s}}),Ro=t=>({t:"caret.scrollTo",p:{range:t}}),Po=t=>({t:"enter.line.addDefault",p:{formatEl:t}}),zo=(t,e)=>({t:"enter.list.addItem",p:{formatEl:t,selectionNode:e}}),Do=(t,e)=>({t:"enter.format.exitEmpty",p:{formatEl:t,rangeEl:e}}),Fo=(t,e,s,i)=>({t:"enter.format.insertBrHtml",p:{brBlock:t,range:e,wSelection:s,offset:i}}),qo=t=>({t:"enter.format.insertBrNode",p:{wSelection:t}}),Wo=t=>({t:"enter.brline.insert",p:{range:t}}),Uo=t=>({t:"enter.shift.br",p:{range:t}}),Zo=t=>({t:"enter.brline.exit",p:{brBlock:t}}),Go=(t,e,s,i,n)=>({t:"enter.format.breakAtEdge",p:{formatEl:t,selectionNode:e,formatStartEdge:s,formatEndEdge:i,bidiSwapped:n}}),jo=(t,e,s,i)=>({t:"enter.format.breakWithSelection",p:{formatEl:t,range:e,formatStartEdge:s,formatEndEdge:i}}),Ko=(t,e)=>({t:"enter.format.breakAtCursor",p:{formatEl:t,range:e}}),Yo=t=>({t:"enter.figcaption.exitInList",p:{formatEl:t}}),Xo=()=>({t:"keydown.input.insertNbsp"}),Jo=()=>({t:"keydown.input.insertZWS"});function Qo(t,e,s){const{format:i,component:n}=e,{fc:o,options:l,range:r,selectionNode:a}=s;let{formatEl:h}=s;const c=!r.collapsed||r.startContainer!==r.endContainer,d=l.get("_rtl")&&!c&&0===r.startOffset&&ao(r,h,"front",o.get("_wd"));if(t.push(go()),t.push(uo()),c&&oo(e))return t.push(co()),!0;if(!(i.isNormalLine(h)||i.isBrLine(h)||o.get("wysiwyg").firstElementChild||n.is(a)||null===function(t,e){return t.setDefaultLine(e)}(e,l.get("defaultLine"))))return t.push(co()),!1;if(i.isLine(h)&&c&&Ve.check.isEdgePoint(r.startContainer,r.startOffset,"front")&&(!r.startContainer.previousSibling||Ve.check.isZeroWidth(r.startContainer.previousSibling))&&i.getLine(r.startContainer)!==i.getLine(r.endContainer)&&(i.isLine(h.previousElementSibling)||Ve.check.isListCell(h)))return t.push(co()),t.push(wo(r.startContainer,h)),t.push(fo(!0)),!1;if(!c&&!d&&!h.previousElementSibling&&0===r.startOffset&&!a.previousSibling&&!Ve.check.isListCell(h)&&i.isLine(h)&&(!i.isBrLine(h)||i.isClosureBrLine(h)||Ve.check.isWysiwygFrame(h.parentNode)))return i.isClosureBlock(h.parentNode)?(t.push(co()),!1):i.isBrLine(h)&&Ve.check.isWysiwygFrame(h.parentNode)?(t.push(co()),t.push(xo(h)),t.push(fo(!0)),!1):(Ve.check.isWysiwygFrame(h.parentNode)&&h.childNodes.length<=1&&(!h.firstChild||Ve.check.isZeroWidth(h.textContent))&&(t.push(co()),t.push(_o(h))),t.push(mo()),!1);const u=r.startContainer;if(h&&!d&&!h.previousElementSibling&&0===r.startOffset&&3===u.nodeType&&Ve.check.isZeroWidth(u)&&!0===function(t,e,s){let i=e.parentNode.previousSibling;const n=e.parentNode.nextSibling;i||(n?i=n:(i=Ve.utils.createElement("BR"),s.appendChild(i)));let o=e;for(;s.contains(o)&&!o.previousSibling;)o=o.parentNode;if(!s.contains(o))return e.textContent="",t.nodeTransform.removeAllParents(e,null,s),!0}(e,u,h))return!0;if(!c&&h&&(0===r.startOffset||a===h)){const s=a===h?lo(e,r,!0):Ve.check.isElement(a.previousSibling)?a.previousSibling:Ve.check.isEdgePoint(r.startContainer,r.startOffset)?Ve.query.getPreviousDeepestNode(r.startContainer):null;if(n.is(s)){const e=n.get(s);if(e)return t.push(co()),t.push($o(a,r,e)),!0}}if(lo(e,r,!0))return t.push(co()),!0;c||d||!i.isEdgeLine(r.startContainer,r.startOffset,"front")||i.isLine(h.previousElementSibling)&&t.push(po(h.previousElementSibling.attributes)),h=i.getLine(r.startContainer,null);const p=i.getBlock(h,null),g=r.commonAncestorContainer;if(p&&h&&!Ve.check.isTableCell(p)&&!/^FIGCAPTION$/i.test(p.nodeName)){if(Ve.check.isListCell(h)&&Ve.check.isList(p)&&(Ve.check.isListCell(p.parentElement)||h.previousElementSibling)&&(a===h||3===a.nodeType&&(!a.previousSibling||Ve.check.isList(a.previousSibling)))&&(i.getLine(r.startContainer,null)!==i.getLine(r.endContainer,null)?p.contains(r.startContainer):0===r.startOffset&&r.collapsed&&!d)){if(r.startContainer!==r.endContainer)t.push(ho()),t.push(Eo(r)),t.push(fo(!0));else{let e=h.previousElementSibling||p.parentElement;if(Ve.check.isListCell(e)){t.push(ho());let s=e;if(!e.contains(h)&&Ve.check.isListCell(s)&&Ve.check.isList(s.lastElementChild)){for(s=s.lastElementChild.lastElementChild;Ve.check.isListCell(s)&&Ve.check.isList(s.lastElementChild);)s=s.lastElementChild&&s.lastElementChild.lastElementChild;e=s}t.push(So(e,h,p)),t.push(fo(!0))}}return!0}if(!c&&0===r.startOffset&&!d){let e=!0,s=g;for(;s&&s!==p&&!Ve.check.isWysiwygFrame(s);){if(s.previousSibling&&(1===s.previousSibling.nodeType||!Ve.check.isZeroWidth(s.previousSibling.textContent.trim()))){e=!1;break}s=s.parentNode}if(e&&p.parentNode)return t.push(ho()),t.push(bo(p,Ve.check.isListCell(h)?[h]:null,null,!1,!1)),t.push(fo(!0)),!0}}if(!c&&h&&Ve.check.isEmptyLine(h)&&n.is(h.previousElementSibling)){const e=n.get(h.previousElementSibling);if(e)return t.push(co()),t.push(ko(!1,h.firstChild,h,e)),!0}if(!c&&h&&(0===r.startOffset||a===h&&h.childNodes[r.startOffset])){const e=Ve.check.isListCell(h),s=a===h?h.childNodes[r.startOffset]:a,i=(e?s:h).previousSibling,o=e||(3===g.nodeType||Ve.check.isBreak(g))&&!g.previousSibling&&0===r.startOffset;if(s&&(e||!s.previousSibling)&&(g&&n.is(g.previousSibling)||o&&n.is(i))){const o=n.get(i);return o?(t.push(co()),t.push(ko(e,s,h,o))):n.is(i)&&(t.push(co()),t.push(yo(i))),!0}if(s&&Ve.check.isNonEditable(s.previousSibling))return t.push(co()),t.push(yo(s.previousSibling)),!0}if(!c&&i.isBrLine(h)&&Ve.check.isBreak(r.startContainer)&&0===r.startOffset){let e=r.startContainer.previousSibling;if(3===e?.nodeType&&Ve.check.isZeroWidth(e)&&(e=e.previousSibling),Ve.check.isBreak(e))return t.push(co()),t.push(Mo(r.startContainer,e)),t.push(fo(!0)),!1}if(!c&&3===r.startContainer.nodeType&&Ve.check.isZeroWidth(r.startContainer)&&r.startOffset<=1&&Ve.check.isBreak(r.startContainer.previousSibling))return t.push(co()),t.push(Ho(r.startContainer)),t.push(fo(!0)),!1;const m=h?.previousElementSibling;return!c&&h&&i.isNormalLine(h)&&!Ve.check.isListCell(h)&&Ve.check.isEmptyLine(h)&&(i.isNormalLine(m)||i.isBrLine(m))?(t.push(co()),t.push(To(h,m)),t.push(fo(!0)),!1):(t.push(Ro(r)),!0)}function tl(t,e,s){const{format:i,char:n,selection:o}=e,{frameOptions:l,range:r,formatEl:a,selectionNode:h,shift:c,e:d}=s,u=!r.collapsed||r.startContainer!==r.endContainer;t.push(go());const p=i.getBrLine(h,null),g=i.getBlock(a,null);if("byte-html"===l.get("charCounter_type")){let e="";if(e=!c&&p||c?"<br>":"<"+a.nodeName+"><br></"+a.nodeName+">",!n.check(e))return t.push(ho()),!1}if(c)return e.enterPrevent(d),t.push(Uo(r)),t.push(Ro(r)),!0;if(!c){let n=i.isEdgeLine(r.endContainer,r.endOffset,"end"),l=i.isEdgeLine(r.startContainer,r.startOffset,"front"),c=!1;if(s.options.get("_rtl")&&a&&r.collapsed&&l!==n){const t=s.fc.get("_wd");l&&ao(r,a,"front",t)?(l=!1,n=!0,c=!0):n&&ao(r,a,"end",t)&&(n=!1,l=!0,c=!0)}if(n&&(/^H[1-6]$/i.test(a.nodeName)||/^HR$/i.test(a.nodeName)))return e.enterPrevent(d),t.push(Po(a)),t.push(Ro(r)),!0;if(g&&a&&!Ve.check.isTableCell(g)&&!/^FIGCAPTION$/i.test(g.nodeName)){const s=o.getRange();if(Ve.check.isEdgePoint(s.endContainer,s.endOffset)&&Ve.check.isList(h.nextSibling))return e.enterPrevent(d),t.push(zo(a,h)),t.push(Ro(r)),!0;if((3!==s.commonAncestorContainer.nodeType||!s.commonAncestorContainer.nextElementSibling)&&Ve.check.isZeroWidth(a.innerText.trim())&&!Ve.check.isListCell(a.nextElementSibling))return e.enterPrevent(d),t.push(Do(a,g)),!0}if(p||g===a&&i.isClosureBlock(g)&&i.isLine(a)){if(e.enterPrevent(d),p&&!i.isClosureBrLine(p))return!function(t,e){const s=Array.from(t.childNodes),i=[[]];for(const t of s)Ve.check.isBreak(t)?i.push([]):i[i.length-1].push(t);s.length&&Ve.check.isBreak(s[s.length-1])&&i.pop();const n=t=>!t||t.every((t=>Ve.check.isZeroWidth(t.textContent))),o=e.anchorNode;let l=0;if(o===t)for(let t=0;t<e.anchorOffset&&t<s.length;t++)Ve.check.isBreak(s[t])&&l++;else for(const t of s){if(t===o||1===t.nodeType&&t.contains(o))break;Ve.check.isBreak(t)&&l++}const r=Math.max(i.length,1),a=Math.min(l,r-1);return{shouldExit:a===r-1&&n(i[a])&&a>=1&&n(i[a-1])}}(p,o.get()).shouldExit?t.push(Wo(r)):t.push(Zo(p)),t.push(Ro(r)),!0;const s=o.get();return h===p?t.push(Fo(p,r,s,s.focusOffset)):t.push(qo(s)),t.push(Ro(r)),!0}if(r.collapsed&&(l||n))return e.enterPrevent(d),t.push(Go(a,h,l,n,c)),t.push(Ro(r)),!0;if(a){if(t.push(ho()),u){if(s.options.get("_rtl")&&l&&!n){const t=s.fc.get("_wd"),e=t.createRange();e.setStart(r.startContainer,r.startOffset),e.collapse(!0),ao(e,a,"front",t)&&(l=!1,n=!0,c=!0)}t.push(jo(a,r,l,n))}else t.push(Ko(a,r));return t.push(Ro(r)),!0}}return u?(t.push(Ro(r)),!0):(g&&Ve.query.getParentElement(g,"FIGCAPTION")&&Ve.query.getParentElement(g,Ve.check.isList)&&(e.enterPrevent(d),t.push(Yo(a)),t.push(Ro(r))),!0)}const{isOSX_IOS:el}=Ae;function sl(t,e){return t.get("_canUseBeforeInput")&&!e?.repeat}async function il(t,e){const s=[];switch(e.keyCode){case"Backspace":if(!1===Qo(s,t,e))return s;break;case"Delete":if(!1===function(t,e,s){const{format:i,component:n}=e,{fc:o,range:l,selectionNode:r}=s;let{formatEl:a}=s;const h=!l.collapsed||l.startContainer!==l.endContainer,c=s.options.get("_rtl")&&!h&&l.endOffset>=(l.endContainer.textContent?.length||0)&&ao(l,a,"end",o.get("_wd"));if(t.push(go()),t.push(uo()),h&&oo(e))return t.push(co()),!0;if(!h&&!c&&i.isEdgeLine(l.endContainer,l.endOffset,"end")&&!a.nextSibling)return t.push(co()),!1;if(i.isLine(a)&&h&&Ve.check.isEdgePoint(l.endContainer,l.endOffset,"end")&&(!l.endContainer.nextSibling||Ve.check.isZeroWidth(l.endContainer.nextSibling))&&i.getLine(l.startContainer)!==i.getLine(l.endContainer)&&(i.isLine(a.nextElementSibling)||Ve.check.isListCell(a)))return t.push(co()),t.push(wo(l.endContainer,a)),t.push(fo(!0)),!1;if(!h&&a&&(l.endOffset===l.endContainer.textContent.length||r===a)){const s=r===a?lo(e,l,!1):Ve.check.isElement(r.nextSibling)?r.nextSibling:Ve.check.isEdgePoint(l.endContainer,l.endOffset)?Ve.query.getNextDeepestNode(l.endContainer,null):null;if(n.is(s)){const e=n.get(s);if(e)return t.push(co()),t.push(Lo(a,e)),!0}}if(lo(e,l,!1))return t.push(co()),!0;if((i.isLine(r)||null===r.nextSibling||Ve.check.isZeroWidth(r.nextSibling)&&null===r.nextSibling.nextSibling)&&l.startOffset===r.textContent.length){const e=a.nextElementSibling;if(!e)return!0;if(n.is(e))return t.push(ho()),t.push(No(a,e)),!0}if(!h&&(Ve.check.isEdgePoint(l.endContainer,l.endOffset)||r===a&&a.childNodes[l.startOffset])){const e=r===a&&a.childNodes[l.startOffset]||r;if(e&&Ve.check.isNonEditable(e.nextSibling))return t.push(co()),t.push(yo(e.nextSibling)),!0;if(n.is(e))return t.push(co()),t.push(yo(e)),!0}h||c||!i.isEdgeLine(l.endContainer,l.endOffset,"end")||i.isLine(a.nextElementSibling)&&t.push(po(a.attributes)),a=i.getLine(l.startContainer,null);const d=i.getBlock(a,null);if(Ve.check.isListCell(a)&&Ve.check.isList(d)&&(r===a||3===r.nodeType&&(!r.nextSibling||Ve.check.isList(r.nextSibling))&&(i.getLine(l.startContainer,null)!==i.getLine(l.endContainer,null)?d.contains(l.endContainer):l.endOffset===r.textContent.length&&l.collapsed&&!c)))return t.push(Ao(l,a,d)),!0;if(!h&&i.isBrLine(a)&&Ve.check.isBreak(l.startContainer)&&0===l.startOffset){let e=l.startContainer.previousSibling;if(3===e?.nodeType&&Ve.check.isZeroWidth(e)&&(e=e.previousSibling),Ve.check.isBreak(e))return t.push(co()),t.push(Io(l.startContainer)),t.push(fo(!0)),!1}if(!h){const e=l.startContainer;let s=null;if(3===e.nodeType&&l.startOffset>=e.textContent.length&&Ve.check.isBreak(e.nextSibling)){const t=e.nextSibling;3===t.nextSibling?.nodeType&&Ve.check.isZeroWidth(t.nextSibling.textContent)&&(s=t)}else 3===e.nodeType&&Ve.check.isZeroWidth(e)&&0===l.startOffset&&Ve.check.isBreak(e.previousSibling)&&(s=e.previousSibling);if(s)return t.push(co()),t.push(Vo(s)),t.push(fo(!0)),!1}const u=a?.nextElementSibling;return!(!h&&a&&i.isNormalLine(a)&&!Ve.check.isListCell(a)&&Ve.check.isEmptyLine(a)&&(i.isNormalLine(u)||i.isBrLine(u))&&(t.push(co()),t.push(Bo(a,u)),t.push(fo(!0)),1))}(s,t,e))return s;break;case"Tab":if(!1===function(t,e,s){const{options:i,selectionNode:n,range:o,formatEl:l,ctrl:r,alt:a,shift:h}=s;return!!i.get("tabDisable")||(t.push(ho()),r||a||Ve.check.isWysiwygFrame(n)||(t.push(Oo(o,l,h)),t.push(fo(!1))),!0)}(s,0,e))return s;break;case"Enter":if(!sl(e.store,e.e)&&!1===tl(s,t,e))return s}const{fc:i,keyCode:n,shift:o,alt:l,ctrl:r,range:a}=e;if(o&&(el?l:r)&&Re.isSpace(n))return s.push(co()),s.push(Xo()),s;const h=!a.collapsed||a.startContainer!==a.endContainer;return r||l||h||Re.isNonTextKey(n)||!Ve.check.isBreak(a.commonAncestorContainer)?!i.has("documentType_use_header")||!h||r||l||o||Re.isDirectionKey(n)?(function(t,e,s){const{component:i}=e,{formatEl:n,range:o,selectionNode:l,keyCode:r}=s,a=s.options.get("_rtl"),h="ArrowLeft"===r?a?"forward":"back":"ArrowRight"===r?a?"back":"forward":null;let c=null;switch(r){case"ArrowUp":i.is(n.previousElementSibling)&&(c=i.get(n.previousElementSibling));break;case"ArrowLeft":case"ArrowRight":if("forward"===h){if(Ve.check.isEdgePoint(l,o.endOffset,"end")){const t=l.nextElementSibling||Ve.query.getNextDeepestNode(l);t?i.is(t)&&(c=i.get(t)):i.is(n.nextElementSibling)&&(c=i.get(n.nextElementSibling))}}else if("back"===h&&Ve.check.isEdgePoint(l,o.startOffset,"front")){const t=l.previousElementSibling||Ve.query.getPreviousDeepestNode(l);t?i.is(t)&&(c=i.get(t)):i.is(n.previousElementSibling)&&(c=i.get(n.previousElementSibling))}break;case"ArrowDown":i.is(n.nextElementSibling)&&(c=i.get(n.nextElementSibling))}c&&!c.options?.isInputComponent&&(t.push(ho()),t.push(Co(c)))}(s,t,e),s):(s.push(vo()),s):(s.push(Jo()),s)}function nl(t,{_styleNodes:e}){const{frameContext:s,ui:i,focusManager:n,selection:o,format:l,listFormat:r,component:a,html:h,nodeTransform:c,history:d,char:u,menu:p,store:g}=t.$;return{focusManager:{nativeFocus:()=>n.nativeFocus(),blur:()=>n.blur()},selection:{getRange:()=>o.getRange(),getNode:()=>o.getNode(),setRange:(t,e,s,i)=>o.setRange(t,e,s,i),get:()=>o.get()},format:{isLine:t=>l.isLine(t),getLine:(t,e)=>l.getLine(t,e),getLines:t=>l.getLines(t),getBrLine:(t,e)=>l.getBrLine(t,e),getBlock:(t,e)=>l.getBlock(t,e),isNormalLine:t=>l.isNormalLine(t),isBrLine:t=>l.isBrLine(t),isClosureBrLine:t=>l.isClosureBrLine(t),isClosureBlock:t=>l.isClosureBlock(t),isEdgeLine:(t,e,s)=>l.isEdgeLine(t,e,s),removeBlock:(t,e)=>l.removeBlock(t,e),addLine:(t,e)=>l.addLine(t,e),addLineAfter:t=>l.addLineAfter(t)},listFormat:{applyNested:(t,e)=>r.applyNested(t,e)},component:{deselect:()=>a.deselect(),is:t=>a.is(t),get:t=>a.get(t),select:(t,e)=>a.select(t,e)},html:{remove:()=>h.remove(),insert:(t,e)=>h.insert(t,e),insertNode:(t,e)=>h.insertNode(t,e)},history:{push:t=>d.push(!!t)},nodeTransform:{removeAllParents:(t,e,s)=>c.removeAllParents(t,e,s),split:(t,e,s)=>c.split(t,e,s)},char:{check:t=>u.check(t)},menu:{dropdownOff:()=>p.dropdownOff()},setDefaultLine:e=>t._setDefaultLine(e),hideToolbar:()=>t._hideToolbar(),hideToolbar_sub:()=>t._hideToolbar_sub(),styleNodeCache:()=>e.value=t.__cacheStyleNodes,formatAttrsTempCache:e=>t._formatAttrsTemp=e,setOnShortcutKey:e=>t._onShortcutKey=e,caretScrollTo(t){i._iframeAutoHeight(s),o.scrollTo(o.getRange()||t,{behavior:"auto",block:"nearest",inline:"nearest"})},enterPrevent(e){e.preventDefault(),b&&!sl(g)&&(t.__focusTemp.focus({preventScroll:!0}),s.get("wysiwyg").focus({preventScroll:!0}))}}}const ol={value:[]};async function ll(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;if(sl(this.$.store)&&("insertParagraph"===e.inputType||"insertLineBreak"===e.inputType))return void await rl.call(this,t,e);const s=(null===e.data?"":void 0===e.data?" ":e.data)||"";if(Re.isComposing(e))this._handledInBefore=!1;else{if(!this.$.char.test(s,!1))return e.preventDefault(),e.stopPropagation(),!1;this._handledInBefore=!0}!1!==await this.$.eventManager.triggerEvent("onBeforeInput",{frameContext:t,event:e,data:s})&&await this._callPluginEventAsync("onBeforeInput",{frameContext:t,event:e,data:s})}async function rl(t,e){if(e.isComposing||this.isComposing)return;if(this.$.ui.selectMenuOn)return;let s=this.$.selection.getNode();if(Ve.check.isInputElement(s))return;if(this.$.menu.currentDropdownName)return;Ve.check.isWysiwygFrame(s)&&(this._setDefaultLine(this.$.options.get("defaultLine")),s=this.$.selection.getNode());const i=this._enterKeyShift||"insertLineBreak"===e.inputType;if(this._enterKeyShift=!1,!i){const t=this._normalizeEditRange();t&&(s=t)}const n=this.$.selection.getRange(),o=this.$.format.getLine(s,null)||s,l={e,fc:t,store:this.$.store,options:this.$.options,frameOptions:this.$.frameOptions,range:n,selectionNode:s,formatEl:o,keyCode:"Enter",ctrl:!1,alt:!1,shift:i},r=nl(this,{_styleNodes:ol}),a=[];tl(a,r,l),a.some((t=>"event.prevent"===t.t||"event.prevent.stop"===t.t))&&e.preventDefault(),await no(a,{ports:r,ctx:l})}async function al(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;const s=this.$.selection.getRange(),i=this.$.selection.getNode(),n=this.$.format.getLine(i,null);if(!this.$.format.isNormalLine(n)&&!this.$.format.isBrLine(n)&&s.collapsed&&!this.$.component.is(i)&&!Ve.check.isList(i)){const t=this.$.format.getBlock(i,null);this._setDefaultLine(this.$.format.isBlock(t)?"DIV":this.$.options.get("defaultLine"))}this.$.selection.init();const o=(null===e.data?"":void 0===e.data?" ":e.data)||"";if(!this._handledInBefore&&!this.$.char.test(o,!0))return e.preventDefault(),e.stopPropagation(),!1;this._handledInBefore=!1,!1!==await this.$.eventManager.triggerEvent("onInput",{frameContext:t,event:e,data:o})&&(await this._callPluginEventAsync("onInput",{frameContext:t,event:e,data:o}),this.$.history.push(!0))}const{_w:hl}=Ae,cl=new RegExp(Be.zeroWidthSpace+"+",""),dl={ctrl:!1,alt:!1},ul=Object.preventExtensions({value:[]});async function pl(t,e){if(this.isComposing=Re.isComposing(e))return!0;if(this.$.ui.selectMenuOn||!e.isTrusted)return;let s=this.$.selection.getNode();if(Ve.check.isInputElement(s))return;if(this.$.menu.currentDropdownName)return;const i=e.code,n=Re.isShift(e),o=dl.ctrl=Re.isCtrl(e),l=dl.alt=Re.isAlt(e);if(Re.isEnter(i)&&(this._enterKeyShift=n),!o&&t.get("isReadOnly")&&!Re.isDirectionKey(i))return e.preventDefault(),!1;this.$.menu.dropdownOff(),this.$.store.mode.isBalloon?this.$.store.mode.isBalloonAlways||this._hideToolbar():this.$.store.mode.isSubBalloon&&(this.$.store.mode.isSubBalloonAlways||this._hideToolbar_sub());if(Re.isEnter(i)&&!sl(this.$.store,e)||Re.isRemoveKey(i)){const t=this._normalizeEditRange();t&&(s=t)}const r=this.$.selection.getRange(),a=this.$.format.getLine(s,null)||s;if(o&&!Re.isNonTextKey(i)&&this.$.shortcuts.command(e,o,n,i,"",!1,null,null))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1;if(!o&&!Re.isNonTextKey(i)&&this.$.format.isLine(a)&&r.collapsed&&Ve.check.isEdgePoint(r.startContainer,0,"front")){const t=r.startContainer.substringData?.(0,r.startOffset);if(t&&this.$.shortcuts.command(e,!1,n,i,t,!0,a,r))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1}else this._onShortcutKey&&(this._onShortcutKey=!1);const h={e,fc:t,store:this.$.store,options:this.$.options,frameOptions:this.$.frameOptions,range:r,selectionNode:s,formatEl:a,keyCode:i,ctrl:o,alt:l,shift:n},c=nl(this,{_styleNodes:ul}),d=await il(c,h);!1!==await this.$.eventManager.triggerEvent("onKeyDown",{frameContext:t,event:e})&&!1!==await this._callPluginEventAsync("onKeyDown",{frameContext:t,event:e,range:r,line:a})&&await no(d,{ports:c,ctx:h})}async function gl(t,e){if(this._onShortcutKey||this.$.menu.currentDropdownName)return;const s=e.code,i=Re.isCtrl(e),n=Re.isAlt(e);if(i&&(dl.ctrl=!1),n&&(dl.alt=!1),t.get("isReadOnly"))return;const o=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)&&!Re.isEsc(s)||!o.collapsed)){if(!this.$.store.mode.isBalloonAlways&&!this.$.store.mode.isSubBalloonAlways)return void(this.$.store.mode.isSubBalloon?this.$.subToolbar._showBalloon():this.$.toolbar._showBalloon());Re.isEsc(s)||this._showToolbarBalloonDelay()}if(Re.isBackspace(s)&&Ve.check.isWysiwygFrame(l)&&""===l.textContent&&0===l.children.length){e.preventDefault(),e.stopPropagation(),l.innerHTML="";const i=this.$.store.get("currentNodes")[0],n=Ve.utils.createElement(this.$.format.isLine(i)&&!Ve.check.isListCell(i)?i:this.$.options.get("defaultLine"),null,"<br>");return l.appendChild(n),this.$.selection.setRange(n,0,n,0),this.applyTagEffect(),this.$.history.push(!1),void(t.has("documentType_use_header")&&Re.isDocumentTypeObserverKey(s)&&t.get("documentType").reHeader())}const r=this.$.format.getLine(l,null),a=this.$.format.getBlock(l,null),h=this._formatAttrsTemp;if(r&&h){for(let t=0,e=h.length;t<e;t++)Re.isEnter(s)&&/^id$/i.test(h[t].name)?r.removeAttribute("id"):r.setAttribute(h[t].name,h[t].value);this._formatAttrsTemp=null}this.$.format.isNormalLine(r)||this.$.format.isBrLine(r)||!o.collapsed||this.$.component.is(l)||Ve.check.isList(l)||null===this._setDefaultLine(this.$.format.isBlock(a)?"DIV":this.$.options.get("defaultLine"))||(l=this.$.selection.getNode());if(!dl.ctrl&&!dl.alt&&!Re.isNonTextKey(s)&&3===l.nodeType&&Be.zeroWidthRegExp.test(l.textContent)&&!(void 0!==e.isComposing?e.isComposing:this.isComposing)){let t=o.startOffset,e=o.endOffset;const s=(l.textContent.substring(0,e).match(cl)||"").length;t=o.startOffset-s,e=o.endOffset-s,l.textContent=l.textContent.replace(Be.zeroWidthRegExp,""),this.$.selection.setRange(l,t<0?0:t,l,e<0?0:e)}if(Re.isRemoveKey(s)&&Ve.check.isZeroWidth(r?.textContent)&&!r.previousElementSibling&&!Ve.check.isListCell(r)){const t=this.$.options.get("retainStyleMode");"none"!==t&&ul.value?.length>0?"repeat"===t?this.__retainTimer?(this.__retainTimer=hl.clearTimeout(this.__retainTimer),this._clearRetainStyleNodes(r)):(this.__retainTimer=hl.setTimeout((()=>{this.__retainTimer=null}),0),this._retainStyleNodes(r,ul.value)):(this.__retainTimer=null,this._retainStyleNodes(r,ul.value)):this._clearRetainStyleNodes(r)}if(t.has("documentType_use_header"))if(Re.isDocumentTypeObserverKey(s)){t.get("documentType").reHeader();const e=Ve.query.getParentElement(this.$.selection.selectionNode,this.$.format.isLine.bind(this.$.format));t.get("documentType").on(e)}else{const e=Ve.query.getParentElement(l,(t=>1===t.nodeType));t.get("documentType").onChangeText(e)}!1!==await this.$.eventManager.triggerEvent("onKeyUp",{frameContext:t,event:e})&&!1!==await this._callPluginEventAsync("onKeyUp",{frameContext:t,event:e,range:o,line:r})&&Re.isHistoryRelevantKey(s)&&this.$.history.push(!0)}const{_w:ml}=Ae;function fl(t,e){const s=e.clipboardData;return!s||this._dataTransferAction("paste",e,s,t)}async function vl(t,e){const s=e.clipboardData;if(!1===await this.$.eventManager.triggerEvent("onCopy",{frameContext:t,event:e,clipboardData:s}))return e.preventDefault(),e.stopPropagation(),!1;const i=t.get("_ww").getSelection();this.__secopy=i.toString()}async function bl(t,e){const s=e.clipboardData;if(!1===await this.$.eventManager.triggerEvent("onCut",{frameContext:t,event:e,clipboardData:s}))return e.preventDefault(),e.stopPropagation(),!1;const i=t.get("_ww").getSelection();this.__secopy=i.toString(),ml.setTimeout((()=>{this.$.history.push(!1)}),0)}const{_w:yl}=Ae;function Cl(t,e,s,i,n){if(n.dataTransfer&&Array.from(n.dataTransfer.types||[]).includes("application/x-suneditor-block-drag"))return;const{sc:o,so:l,ec:r,eo:a}=this.$.selection.getDragEventLocationRange(n);if(!o)return;n.preventDefault();const h=t.get("_wd").createRange();h.setStart(o,l),h.setEnd(r,a);const c={y:0,x:0};if(s){const t=this.$.offset.getGlobal(s),e=i?this.$.context.get("toolbar_main").offsetHeight:0;c.y=t.top+e-yl.scrollY,c.x=t.left-yl.scrollX}const d=h.getBoundingClientRect();if(d.height>0){const s=t.get("wysiwygFrame");let i=0,n=0;/^iframe$/i.test(s.nodeName)&&(i=s.offsetLeft,n=s.offsetTop),e.style.left=`${d.right+yl.scrollX+c.x+i}px`,e.style.top=`${d.top+yl.scrollY+c.y-5+n}px`,e.style.height=`${d.height+10}px`,e.style.display="block";try{e.showPopover?.()}catch{}}else{try{e.hidePopover?.()}catch{}e.style.display="none"}}function wl(t){try{t.hidePopover?.()}catch{}t.style.display="none"}function _l(t,e,s){try{if(t.get("isReadOnly"))return s.preventDefault(),s.stopPropagation(),!1;const e=s.dataTransfer;if(!e)return!0;if(Array.from(e.types||[]).includes("application/x-suneditor-block-drag"))return;const{sc:i,so:n,ec:o,eo:l}=this.$.selection.getDragEventLocationRange(s);if(!i)return;if(Ve.query.getParentElement(i,".se-disable-pointer"))return void s.preventDefault();if(yi.get("__dragContainer")){if(s.preventDefault(),yi.get("__dragContainer").contains(s.target))return void this.$.component.deselect();const e=yi.get("__dragContainer");return this.$.component.deselect(),this.$.selection.setRange(i,n,o,l),this.$.html.insertNode(e,{afterNode:null,skipCharCount:!0}),void(t.has("documentType_use_page")&&(t.get("documentTypePageMirror").innerHTML=t.get("wysiwyg").innerHTML,t.get("documentType").rePage(!0)))}return this.$.html.remove(),this.$.selection.setRange(i,n,o,l),this._dataTransferAction("drop",s,e,t)}finally{try{e.hidePopover?.()}catch{}e.style.display="none"}}class xl{#J;constructor({$:t}){this.#J=t}execute(t){if(!this.#J.options.get("__lineFormatFilter"))return null;if(this.#J.pluginManager.fileInfo.pluginRegExp.test(this.#J.ui.currentControllerName))return;const e=this.#J.selection.getRange(),s=e.commonAncestorContainer,i=e.startContainer,n=e.endOffset,o=this.#J.format.getBlock(s,null);let l,r,a;if(o)return a=Ve.utils.createElement(t||this.#J.options.get("defaultLine")),a.innerHTML=o.innerHTML,0===a.childNodes.length&&(a.innerHTML=Be.zeroWidthSpace),o.innerHTML=a.outerHTML,a=o.firstChild,l=a.childNodes[n]||Ve.query.getEdgeChildNodes(a,null).sc,l||(l=Ve.utils.createTextNode(Be.zeroWidthSpace),a.insertBefore(l,a.firstChild)),r=l.textContent.length,void this.#J.selection.setRange(l,r,l,r);if(3===s.nodeType&&this.#J.component.is(s.parentElement)){const t=this.#J.component.get(s.parentElement);if(!t)return;const e=t.container;if(s.parentElement===e){const t=s.nextElementSibling?e:e.nextElementSibling,i=Ve.utils.createElement(this.#J.options.get("defaultLine"),null,s);return e.parentElement.insertBefore(i,t),void this.#J.focusManager.focusEdge(i)}return this.#J.component.select(t.target,t.pluginName),null}if(1===s.nodeType&&"true"===s.getAttribute("data-se-embed")){let t=s.nextElementSibling;return this.#J.format.isLine(t)||(t=this.#J.format.addLine(s,this.#J.options.get("defaultLine"))),void this.#J.selection.setRange(t.firstChild,0,t.firstChild,0)}if(!this.#J.format.isBlock(i)&&!Ve.check.isWysiwygFrame(i)||!this.#J.component.is(i.children[e.startOffset])&&!this.#J.component.is(i.children[e.startOffset-1])){if(Ve.query.getParentElement(s,Ve.check.isExcludeFormat))return null;if(this.#J.format.isBlock(s)&&s.childNodes.length<=1){let t=null;return 1===s.childNodes.length&&Ve.check.isBreak(s.firstChild)?t=s.firstChild:(t=Ve.utils.createTextNode(Be.zeroWidthSpace),s.appendChild(t)),void this.#J.selection.setRange(t,1,t,1)}try{if(3===s.nodeType&&(a=Ve.utils.createElement(t||this.#J.options.get("defaultLine")),s.parentNode.insertBefore(a,s),a.appendChild(s)),Ve.check.isBreak(a.nextSibling)&&Ve.utils.removeItem(a.nextSibling),Ve.check.isBreak(a.previousSibling)&&Ve.utils.removeItem(a.previousSibling),Ve.check.isBreak(l)){const t=Ve.utils.createTextNode(Be.zeroWidthSpace);l.parentNode.insertBefore(t,l),l=t}}catch{return this.#J.frameContext.get("_wd").execCommand("formatBlock",!1,`<${t||this.#J.options.get("defaultLine")}>`),this.#J.store.set("_lastSelectionNode",null),void this.#J.selection.init()}if(a&&(Ve.check.isBreak(a.nextSibling)&&Ve.utils.removeItem(a.nextSibling),Ve.check.isBreak(a.previousSibling)&&Ve.utils.removeItem(a.previousSibling),Ve.check.isBreak(l))){const t=Ve.utils.createTextNode(Be.zeroWidthSpace);l.parentNode.insertBefore(t,l),l=t}this.#J.store.set("_lastSelectionNode",null),i?this.#J.selection.setRange(i,1,i,1):this.#J.focusManager.nativeFocus()}}}class $l{#Rr;#J;#Pr;constructor(t){this.#Rr=t,this.#J=t.$,this.#Pr=new RegExp(`^(${Object.keys(this.#J.options.get("_defaultStyleTagMap")).join("|")})$`,"i")}update(t){if(t||=this.#J.selection.getNode(),t===this.#J.store.get("_lastSelectionNode"))return;this.#J.store.set("_lastSelectionNode",t);const e=this.#J.options.get("_rtl")?"marginRight":"marginLeft",s=this.#J.plugins,i=this.#J.commandDispatcher.targets,n=this.#Pr,o=this.#J.options.get("_styleCommandMap"),l=[],r=[],a=this.#J.options.get("_textStyleTags"),h=[],c=[],d=this.#J.commandDispatcher.activeCommands,u=d.length;let p="";if(this.#J.component.is(t)&&!this.#J.component.__selectionSelected){const e=this.#J.component.get(t);if(!e)return;return this.#J.store.set("_lastSelectionNode",null),void this.#J.component.select(e.target,e.pluginName)}for(;t.firstChild;)t=t.firstChild;const g=this.#J.frameContext,m=!g.get("isReadOnly");for(let g=t;!Ve.check.isWysiwygFrame(g)&&g;g=g.parentElement)if(1===g.nodeType&&!Ve.check.isBreak(g)){if(this.#zr(g))return void this.#J.focusManager.blur();if(p=g.nodeName.toLowerCase(),r.push(p),a.includes(p)&&!this.#J.format.isLine(p)&&h.push(g),m)for(let t,e=0;e<u;e++)t=d[e],!l.includes(t)&&!c.includes(t)&&i.get(t)&&i.get(t).filter((e=>{const i=s[t]?.active(g,e);return void 0===i&&c.push(t),i})).length>0&&l.push(t);if(this.#J.format.isLine(g)){if(!l.includes("outdent")&&i.has("outdent")&&(Ve.check.isListCell(g)||g.style[e]&&Oe.get(g.style[e],0)>0)&&i.get("outdent").filter((t=>!Ve.check.isImportantDisabled(t)&&(t.disabled=!1,!0))).length>0&&l.push("outdent"),!l.includes("indent")&&i.has("indent")){const t=Ve.check.isListCell(g)&&!g.previousElementSibling;i.get("indent").filter((e=>!Ve.check.isImportantDisabled(e)&&(e.disabled=t,!0))).length>0&&l.push("indent")}}else n.test(p)&&(p=o[p]||p,l.push(p),Ve.utils.addClass(i.get(p),"active"))}return this.#Dr(l),this.#Rr.__cacheStyleNodes=h.reverse(),this.#J.store.set("currentNodes",r.reverse()),this.#J.store.set("currentNodesMap",l),this.#J.frameOptions.get("statusbar_showPathLabel")&&g.get("navigation")&&(g.get("navigation").textContent=this.#J.options.get("_rtl")?this.#J.store.get("currentNodes").reverse().join(" < "):this.#J.store.get("currentNodes").join(" > ")),t}reset(){this.#Dr([])}#Dr(t){const e=this.#J.commandDispatcher.activeCommands,s=this.#J.commandDispatcher.targets,i=this.#J.plugins;for(let n,o,l,r=0,a=e.length;r<a;r++)if(n=e[r],!t.includes(n)&&(o=s.get(n))){l=i[n];for(let t,e=0,s=o.length;e<s;e++)t=o[e],t&&(l?l.active(null,t):/^outdent$/i.test(n)?Ve.check.isImportantDisabled(t)||(t.disabled=!0):/^indent$/i.test(n)?Ve.check.isImportantDisabled(t)||(t.disabled=!1):Ve.utils.removeClass(t,"active"))}}#zr(t){return Ve.check.isElement(t)&&"true"===t.getAttribute("data-se-non-focus")}}const{_w:kl,isMobile:Sl,isTouchDevice:El}=Ae;function Tl(t){if("Tab"!==t.key)return;t.preventDefault();const e=t.target,s=e.selectionStart,i=e.selectionEnd;e.value=e.value.substring(0,s)+"\t"+e.value.substring(i),e.selectionStart=e.selectionEnd=s+1}const Ml=class extends zn{#t;#gi;#e;#ot;#mi;#o;#Fr;#qr;#Wr=null;#Ur=null;#Zr=null;#Gr=null;constructor(t){super(t),this.#t=this.$.store,this.#gi=this.$.contextProvider,this.#e=this.$.context,this.#ot=this.$.options,this.#mi=this.$.eventManager,this.#o=this.$.toolbar,this.#Fr=this.$.ui,this.#qr=this.$.menu,this.isComposing=!1,this._enterKeyShift=!1,this.scrollparents=[],this.defaultLineManager=new xl(this),this.selectionState=new $l(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=this.#gi.carrierWrapper.querySelector(".__se__focus__temp__")}applyTagEffect(t){return this.selectionState.update(t)}_showToolbarBalloonDelay(){this.#Wr&&kl.clearTimeout(this.#Wr),this.#Wr=kl.setTimeout((()=>{kl.clearTimeout(this.#Wr),this.#Wr=null,this.#t.mode.isSubBalloon?this.$.subToolbar._showBalloon():this.#o._showBalloon()}),250)}#jr(){this.#Wr&&kl.clearTimeout(this.#Wr),this.#Wr=kl.setTimeout((()=>{kl.clearTimeout(this.#Wr),this.#Wr=null,this._toggleToolbarBalloon()}),250)}_toggleToolbarBalloon(){this.$.selection.init();const t=this.$.selection.getRange(),e=this.#ot.has("_subMode");!(e?this.#t.mode.isSubBalloonAlways:this.#t.mode.isBalloonAlways)&&t.collapsed?e?this._hideToolbar_sub():this._hideToolbar():e?this.$.subToolbar._showBalloon(t):this.#o._showBalloon(t)}_hideToolbar(){this.#Fr.isPreventToolbarHide||this.$.frameContext.get("isFullScreen")||this.#o.hide()}_hideToolbar_sub(){this.$.subToolbar&&!this.#Fr.isPreventToolbarHide&&this.$.subToolbar.hide()}_setDefaultLine(t){return this.defaultLineManager.execute(t)}_normalizeEditRange(){if(!this.$.format.isLine(this.$.selection.getRange()?.startContainer))return null;this.$.selection.resetRangeToTextNode();const t=this.$.selection.getRange();if(t.startContainer===t.endContainer&&t.startOffset!==t.endOffset&&3===t.startContainer.nodeType&&Ve.check.isZeroWidth(t.startContainer)){const e=t.startContainer.nextSibling;e&&Ve.check.isBreak(e)?this.$.selection.setRange(e,0,e,0):this.$.selection.setRange(t.endContainer,t.endOffset,t.endContainer,t.endOffset)}return this.$.selection.getNode()}async _dataTransferAction(t,e,s,i){try{return this.#Fr.showLoading(),await this.#Kr(t,e,s,i),e.preventDefault(),e.stopPropagation(),!1}catch(t){console.warn("[SUNEDITOR.paste.error]",t)}finally{this.#Fr.hideLoading()}}async#Kr(t,e,s,i){e.preventDefault(),e.stopPropagation();let n=s.getData("text/plain"),o=s.getData("text/html");const l=!o,r=this.__secopy===n,a=/class=["']*Mso(Normal|List)/i.test(o)||/content=["']*Word.Document/i.test(o)||/content=["']*OneNote.File/i.test(o)||/content=["']*Excel.Sheet/i.test(o),h=r?"SE":a?"MS":"";if(l?o=Ie.htmlToEntity(n).replace(/\n/g,"<br>"):(o=o.replace(/^<html>\r?\n?<body>\r?\n?\x3C!--StartFragment-->|\x3C!--EndFragment-->\r?\n?<\/body>\r?\n?<\/html>$/g,""),a&&(o=o.replace(/\n/g," "),n=n.replace(/\n/g," "),o=De.cleanHTML(o))),!r){if(this.#ot.get("autoLinkify")){const t=(new DOMParser).parseFromString(o,"text/html");Ve.query.getListChildNodes(t.body,Ie.textToAnchor,null),o=t.body.innerHTML}}l||(o=this.$.html.clean(o,{forceFormat:!1,whitelist:null,blacklist:null}));const c=this.$.char.test("byte-html"===this.$.frameOptions.get("charCounter_type")?o:n,!1);if("paste"===t){const t=await this.#mi.triggerEvent("onPaste",{frameContext:i,event:e,data:o,maxCharCount:c,from:h});if(!1===t)return!1;if("string"==typeof t){if(!t)return!1;o=t}}if("drop"===t){const t=await this.#mi.triggerEvent("onDrop",{frameContext:i,event:e,data:o,maxCharCount:c,from:h});if(!1===t)return!1;if("string"==typeof t){if(!t)return!1;o=t}}const d=s.files;if(d.length>0&&!a){for(let t=0,s=d.length;t<s;t++)await this._callPluginEventAsync("onFilePasteAndDrop",{frameContext:i,event:e,file:d[t]});return!1}if(!c)return!1;if(o){const t=(new DOMParser).parseFromString(o,"text/html");return!1!==await this._callPluginEventAsync("onPaste",{frameContext:i,event:e,data:o,doc:t})&&this.$.html.insert(o,{selectInserted:!1,skipCharCount:!0,skipCleaning:!0}),i.has("documentType_use_header")&&i.get("documentType").reHeader(),!1}}_addCommonEvents(){const t=qn.bind(this),e=Un.bind(this);this.#mi.addEvent(this.#e.get("menuTray"),"mousedown",t,!1),this.#mi.addEvent(this.#e.get("menuTray"),"click",Wn.bind(this),!0),this.#mi.addEvent(this.#e.get("toolbar_main"),"mousedown",t,!1),this.#mi.addEvent(this.#e.get("toolbar_main"),"click",e,!1),this.#ot.has("_subMode")&&(this.#mi.addEvent(this.#e.get("toolbar_sub_main"),"mousedown",t,!1),this.#mi.addEvent(this.#e.get("toolbar_sub_main"),"click",e,!1)),this.#o._setResponsive(),Ae.isResizeObserverSupported&&(this._toolbarObserver=new ResizeObserver((()=>{kl.setTimeout((()=>{this.#o.resetResponsiveToolbar()}),0)})),this._wwFrameObserver=new ResizeObserver((t=>{kl.setTimeout((()=>{t.forEach((t=>{this.#Fr._emitResizeEvent(this.$.frameRoots.get(t.target.getAttribute("data-root-key")),-1,t)})),this.#t.mode.isInline&&this.#t.mode.isBottom&&this.#o._resetSticky()}),0)}))),this.#ot.get("closeModalOutsideClick")&&this.#mi.addEvent(this.#gi.carrierWrapper.querySelector(".se-modal .se-modal-inner"),"click",(t=>{t.target===this.#gi.carrierWrapper.querySelector(".se-modal .se-modal-inner")&&this.#Fr.offCurrentModal()}),!1),this.#mi.addEvent(kl,"resize",this.#Yr.bind(this),!1),this.#mi.addEvent(kl.visualViewport,"resize",this.#Xr.bind(this),!1),this.#mi.addEvent(kl,"scroll",this.#Jr.bind(this),!1),El&&this.#mi.addEvent(kl.visualViewport,"scroll",this.#Qr.bind(this),!1)}_addFrameEvents(t){const e=t.get("options").get("iframe"),s=e?t.get("_ww"):t.get("wysiwyg");t.set("eventWysiwyg",s);const i=t.get("code"),n=this.#gi.carrierWrapper.querySelector(".se-drag-cursor"),o=Jn.bind(this,t);this.#mi.addEvent(s,"mousemove",o,!1),this.#mi.addEvent(s,"mouseleave",Qn.bind(this,t),!1),this.#mi.addEvent(s,"mousedown",jn.bind(this,t),!1),this.#mi.addEvent(s,"mouseup",Yn.bind(this,t),!1),this.#mi.addEvent(s,"click",Xn.bind(this,t),!1),this.#mi.addEvent(s,"beforeinput",ll.bind(this,t),!1),this.#mi.addEvent(s,"input",al.bind(this,t),!1),this.#mi.addEvent(s,"keydown",pl.bind(this,t),!1),this.#mi.addEvent(s,"keyup",gl.bind(this,t),!1),this.#mi.addEvent(s,"paste",fl.bind(this,t),!1),this.#mi.addEvent(s,"copy",vl.bind(this,t),!1),this.#mi.addEvent(s,"cut",bl.bind(this,t),!1),this.#mi.addEvent(s,"dragover",Cl.bind(this,t,n,e?this.$.frameContext.get("topArea"):null,!this.#ot.get("toolbar_container")&&!this.#t.mode.isBalloon&&!this.#t.mode.isInline),!1),this.#mi.addEvent(s,"dragend",wl.bind(this,n),!1),this.#mi.addEvent(s,"drop",_l.bind(this,t,n),!1),this.#mi.addEvent(s,"scroll",this.#ta.bind(this,t,s),{passive:!0,capture:!1}),this.#mi.addEvent(s,"focus",this.#ea.bind(this,t),!1),this.#mi.addEvent(s,"blur",this.#sa.bind(this,t),!1),this.#mi.addEvent(i,"mousedown",this.#ia.bind(this,t),!1);const l=t.get("wrapper").querySelector(".se-drag-handle");if(this.#mi.addEvent(l,"wheel",(t=>{t.preventDefault(),this.$.component.deselect()}),!1),this.#mi.addEvent(t.get("lineBreaker_t"),"pointerdown",this.#na.bind(this,"t"),!1),this.#mi.addEvent(t.get("lineBreaker_b"),"pointerdown",this.#na.bind(this,"b"),!1),El&&this.#mi.addEvent(s,"touchstart",o,{passive:!0,capture:!1}),!this.#ot.get("hasCodeMirror")){const e=t.get("codeNumbers"),s=this.$.viewer._codeViewAutoHeight.bind(this.$.viewer,t.get("code"),e,"auto"===this.$.frameOptions.get("height"));this.#mi.addEvent(i,"keydown",s,!1),this.#mi.addEvent(i,"keyup",s,!1),this.#mi.addEvent(i,"paste",s,!1),this.#ot.get("tabDisable")||this.#mi.addEvent(i,"keydown",Tl,!1),e&&this.#mi.addEvent(i,"scroll",this.$.viewer._scrollLineNumbers.bind(i,e),!1)}const r=t.get("markdown");if(r){this.#mi.addEvent(r,"mousedown",this.#oa.bind(this,t),!1);const e=t.get("markdownNumbers"),s=this.$.viewer._markdownViewAutoHeight.bind(this.$.viewer,r,e,"auto"===this.$.frameOptions.get("height"));this.#mi.addEvent(r,"keydown",s,!1),this.#mi.addEvent(r,"keyup",s,!1),this.#mi.addEvent(r,"paste",s,!1),this.#ot.get("tabDisable")||this.#mi.addEvent(r,"keydown",Tl,!1),e&&this.#mi.addEvent(r,"scroll",this.$.viewer._scrollMarkdownLineNumbers.bind(r,e),!1)}t.has("statusbar")&&this.__addStatusbarEvent(t,t.get("options"));const a=this.#la.bind(this),h=Ve.query.getScrollParents(t.get("originElement"));for(const t of h)this.scrollparents.push(t),this.#mi.addEvent(t,"scroll",a,!1);this.#mi.addEvent(this.__focusTemp,"focus",(t=>t.preventDefault()),!1),this.__eventDoc!==t.get("_wd")&&(this.__eventDoc=t.get("_wd"),this.#mi.addEvent(this.__eventDoc,"selectionchange",this.#ra.bind(this,this.__eventDoc),!1))}__addStatusbarEvent(t,e){/\d+/.test(e.get("height"))&&e.get("statusbar_resizeEnable")?e.set("__statusbarEvent",this.#mi.addEvent(t.get("statusbar"),"mousedown",this.#aa.bind(this),!1)):Ve.utils.addClass(t.get("statusbar"),"se-resizing-none")}_removeAllEvents(){this.#mi._init(),this._wwFrameObserver&&(this._wwFrameObserver.disconnect(),this._wwFrameObserver=null),this._toolbarObserver&&(this._toolbarObserver.disconnect(),this._toolbarObserver=null),this.#Wr&&(kl.clearTimeout(this.#Wr),this.#Wr=null),this.__retainTimer&&(kl.clearTimeout(this.__retainTimer),this.__retainTimer=null),this.#Zr&&=this.#mi.removeGlobalEvent(this.#Zr),this.#Gr&&=this.#mi.removeGlobalEvent(this.#Gr),this.#Ur&&=this.#mi.removeGlobalEvent(this.#Ur),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(){this.#mi.removeGlobalEvent(this.#Zr),this.#Zr=this.#mi.addGlobalEvent("mouseup",(()=>{this.$.selection.init(),this.#mi.removeGlobalEvent(this.#Zr)}))}_retainStyleNodes(t,e){let s=e[0].cloneNode(!1);for(let t,i=1,n=e.length;i<n;i++)t=e[i].cloneNode(!1),s.appendChild(t),s=t;const{parent:i,inner:n}=this.$.nodeTransform.createNestedNode(e,null),o=Ve.utils.createTextNode(Be.zeroWidthSpace);n.appendChild(o),t.innerHTML="",t.appendChild(i),this.$.selection.setRange(o,1,o,1)}_clearRetainStyleNodes(t){t.innerHTML="<br>",this.$.selection.setRange(t,0,t,0)}_callPluginEvent(t,e){return this.$.pluginManager.emitEvent(t,e)}async _callPluginEventAsync(t,e){return await this.$.pluginManager.emitEventAsync(t,e)}__removeInput(){this.#t.set("_preventBlur",!1),this._inputFocus=!1,this.__inputBlurEvent=this.#mi.removeEvent(this.__inputBlurEvent),this.__inputKeyEvent=this.#mi.removeEvent(this.__inputKeyEvent),this.__inputPlugin=null}__postFocusEvent(t,e){(this.#t.mode.isInline||this.#t.mode.isBalloonAlways)&&this.#o.show(),this.#t.mode.isSubBalloonAlways&&this.$.subToolbar.show(),this.#o._resetSticky(),this.#Fr._updatePlaceholder(t),this.#mi.triggerEvent("onFocus",{frameContext:t,event:e}),this._callPluginEvent("onFocus",{frameContext:t,event:e})}__postBlurEvent(t,e){this.#t.mode.isInline?kl.setTimeout((()=>{this.#t.get("hasFocus")||this._hideToolbar()}),0):this.#t.mode.isBalloon&&this._hideToolbar(),this.#t.mode.isSubBalloon&&this._hideToolbar_sub(),this.#mi.triggerEvent("onBlur",{frameContext:t,event:e}),this._callPluginEvent("onBlur",{frameContext:t,event:e})}__setViewportSize(){this.#t.set("currentViewportHeight",Oe.get(kl.visualViewport.height,0))}#ha(){this.#qr.currentDropdownActiveButton&&this.#qr.currentDropdown&&this.#qr.__resetMenuPosition(this.#qr.currentDropdownActiveButton,this.#qr.currentDropdown),this.#Fr._repositionControllers()}#ca(){Ae.isResizeObserverSupported||(this.#o.resetResponsiveToolbar(),this.#ot.get("_subMode")&&this.$.subToolbar.resetResponsiveToolbar());const t=this.#e.get("toolbar_main"),e="none"===t.style.display||this.#t.mode.isInline&&!this.#o.inlineToolbarAttr.isShow;if(0===t.offsetWidth&&!e)return;const s=this.#Fr.opendBrowser;if(s&&"block"===s.area.style.display&&(s.body.style.maxHeight=Ve.utils.getClientSize().h-s.header.offsetHeight-50+"px"),this.#qr.currentDropdownActiveButton&&this.#qr.currentDropdown&&this.#qr.__resetMenuPosition(this.#qr.currentDropdownActiveButton,this.#qr.currentDropdown),this.$.viewer._resetFullScreenHeight())return;const i=this.$.frameContext;i.get("isCodeView")&&this.#t.mode.isInline?this.#o._showInline():(this.#Fr._iframeAutoHeight(i),this.#o.isSticky&&(this.#o.isCSSSticky||(this.#e.get("toolbar_main").style.width=i.get("topArea").offsetWidth-2+"px"),this.#o._resetSticky()))}#ta(t,e,s){this.#Fr._syncScrollPosition(e),this.#ha(),this._callPluginEvent("onScroll",{frameContext:t,event:s}),t.has("documentType_use_page")&&t.get("documentType").scrollPage(),this.#mi.triggerEvent("onScroll",{frameContext:t,event:s})}#ea(t,e){if(this.$.selection.__iframeFocus||t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),!1;this.#t.set("hasFocus",!0),this.$.component.__prevent=!1,this.#mi.triggerEvent("onNativeFocus",{frameContext:t,event:e});const s=t.get("key");this._inputFocus?this.#t.mode.isInline&&kl.setTimeout((()=>{this.#o._showInline()}),0):this.#t.get("rootKey")===s&&this.#t.get("_preventBlur")||this.#t.get("_preventFocus")||(this.#t.set("_preventFocus",!0),Ve.utils.removeClass(this.$.commandDispatcher.targets.get("codeView"),"active"),this.#Fr._toggleCodeViewButtons(!1),this.$.facade.changeFrameContext(s),this.$.history.resetButtons(s,null),kl.setTimeout((()=>{this.__postFocusEvent(t,e)}),0))}#sa(t,e){t.get("isCodeView")||t.get("isReadOnly")||t.get("isDisabled")||(this.#t.set("hasFocus",!1),this.#t.set("_lastSelectionNode",null),this.#mi.triggerEvent("onNativeBlur",{frameContext:t,event:e}),this.#Fr._updatePlaceholder(t),this._inputFocus||this.#t.get("_preventBlur")||(this.#t.set("_preventFocus",!1),this.selectionState.reset(),this.#t.set("currentNodes",[]),this.#t.set("currentNodesMap",[]),this.#Fr.offCurrentController(),this.#gi.applyToRoots((t=>{t.get("navigation")&&(t.get("navigation").textContent="")})),this.$.history.check(t.get("key"),this.#t.get("_range")),this.__postBlurEvent(t,e)))}#aa(t){t.stopPropagation(),this._resizeClientY=t.clientY,this.#Fr.enableBackWrapper("ns-resize"),this.#Gr=this.#mi.addGlobalEvent("mousemove",this.#da.bind(this)),this.#Ur=this.#mi.addGlobalEvent("mouseup",this.#ua.bind(this))}#da(t){const e=this.$.frameContext,s=e.get("wrapper").offsetHeight+(t.clientY-this._resizeClientY),i=s<e.get("_minHeight")?e.get("_minHeight"):s;e.get("wysiwygFrame").style.height=e.get("code").style.height=i+"px",this._resizeClientY=t.clientY,Ae.isResizeObserverSupported||this.#Fr._emitResizeEvent(e,i,null)}#ua(){this.#Fr.disableBackWrapper(),this.#Gr&&=this.#mi.removeGlobalEvent(this.#Gr),this.#Ur&&=this.#mi.removeGlobalEvent(this.#Ur)}#na(t,e){e.preventDefault();const s=this._lineBreakComp;if(!s)return;const i=Ve.check.isListCell(s.parentElement),n=Ve.utils.createElement(i?"BR":Ve.check.isTableCell(s.parentElement)?"DIV":this.#ot.get("defaultLine"));if(i||(n.innerHTML="<br>"),"byte-html"!==this.$.frameOptions.get("charCounter_type")||this.$.char.check(n.outerHTML)){s.parentNode.insertBefore(n,"t"===t?s:s.nextSibling),this.$.component.deselect();try{const t=i?n:n.firstChild;this.$.selection.setRange(t,1,t,1),this.$.history.push(!1)}catch(t){console.warn("[SUNEDITOR.lineBreaker.error]",t)}}}#Yr(){this.#t.set("initViewportHeight",kl.visualViewport.height),Sl||this.#Fr.offCurrentController(),this.#t.mode.isBalloon?this.#o.hide():this.#t.mode.isSubBalloon&&this.$.subToolbar.hide(),this.#ca()}#Xr(){Sl&&this.#ot.get("_toolbar_sticky")>-1&&(this.#o._resetSticky(),this.#qr.__restoreMenuPosition()),this.#ha();const t=this.#t.get("currentViewportHeight");this.__setViewportSize(),Sl&&t>0&&t-kl.visualViewport.height>100&&this.#t.get("hasFocus")&&this.$.selection.scrollTo(this.$.selection.getRange(),{behavior:"auto",block:"nearest",inline:"nearest"})}#Jr(){this.#ot.get("_toolbar_sticky")>-1&&this.#o._resetSticky(),this.#t.mode.isBalloon&&"block"===this.#e.get("toolbar_main").style.display?this.#o._setBalloonOffset("top"===this.#o.balloonOffset.position):this.#t.mode.isSubBalloon&&"block"===this.#e.get("toolbar_sub_main").style.display&&this.$.subToolbar._setBalloonOffset("top"===this.$.subToolbar.balloonOffset.position),this.#ha(),this.$.frameContext.has("documentType_use_page")&&this.$.frameContext.get("documentType").scrollWindow()}#Qr(){this.#ot.get("_toolbar_sticky")>-1&&(this.#o._resetSticky(),this.#qr.__restoreMenuPosition())}#ra(t){let e=t.getSelection().anchorNode;this.#gi.applyToRoots((t=>{if(e&&t.get("wysiwyg").contains(e)){if(t.get("isReadOnly")||t.get("isDisabled"))return;if(e=null,this.$.selection.init(),this.applyTagEffect(),this.#Fr._updatePlaceholder(t),El&&(this.#t.mode.isBalloon||this.#t.mode.isSubBalloon)&&this.#jr(),t.has("documentType_use_header")){const e=Ve.query.getParentElement(this.$.selection.selectionNode,this.$.format.isLine.bind(this.$.format));t.get("documentType").on(e)}}}))}#la(){this.#qr.dropdownOff(),this.#ha()}#ia(t){this.$.facade.changeFrameContext(t.get("key")),Ve.utils.addClass(this.$.commandDispatcher.targets.get("codeView"),"active"),this.#Fr._toggleCodeViewButtons(!0)}#oa(t){this.$.facade.changeFrameContext(t.get("key")),Ve.utils.addClass(this.$.commandDispatcher.targets.get("markdownView"),"active"),this.#Fr._toggleCodeViewButtons(!0)}};const Hl=class{#pa=new Map;#ga=new Map;$=null;constructor(t,e){const{product:s,options:i}=e;this.store=new ys(s),this.$={facade:t,store:this.store},this.#ma(s,i),this.#fa(),this.#va(s),this.#ba(),this.#ya(),this._eventOrchestrator=new Ml(this),this.#pa.get("eventManager")._bindOrchestrator(this._eventOrchestrator)}#ma(t,e){const s=new _s(t),i=new xs(this,t,e);this.#pa.set("contextProvider",s),this.#pa.set("optionProvider",i),this.#pa.set("instanceCheck",new $s(s.frameContext)),this.#pa.set("eventManager",new Ts(s,i,this.$))}#fa(){const t=this.#pa.get("contextProvider"),e=this.#pa.get("optionProvider");Object.assign(this.$,{contextProvider:t,optionProvider:e,instanceCheck:this.#pa.get("instanceCheck"),eventManager:this.#pa.get("eventManager"),frameRoots:t.frameRoots,context:t.context,options:e.options,icons:t.icons,lang:t.lang,frameContext:t.frameContext,frameOptions:e.frameOptions})}#va(t){this.#ga.set("offset",new Ms(this)),this.#ga.set("selection",new Ls(this)),this.#ga.set("html",new pi(this)),this.#ga.set("nodeTransform",new gi(this)),this.#ga.set("format",new As(this)),this.#ga.set("inline",new Is(this)),this.#ga.set("listFormat",new Os(this)),this.#ga.set("char",new fi(this)),this.#ga.set("shortcuts",new vi(this)),this.#ga.set("component",new Yi(this)),this.#ga.set("pluginManager",new Xi(this,t)),this.#ga.set("focusManager",new Ji(this)),this.#ga.set("ui",new $n(this)),this.#ga.set("commandDispatcher",new Cn(this)),this.#ga.set("toolbar",new En(this,{keyName:"toolbar",balloon:this.store.mode.isBalloon,balloonAlways:this.store.mode.isBalloonAlways,inline:this.store.mode.isInline,res:t.responsiveButtons})),this.$.options.has("_subMode")&&this.#ga.set("subToolbar",new En(this,{keyName:"toolbar_sub",balloon:this.store.mode.isSubBalloon,balloonAlways:this.store.mode.isSubBalloonAlways,inline:!1,res:t.responsiveButtons_sub})),this.#ga.set("menu",new Ln(this)),this.#ga.set("viewer",new In(this)),this.#ga.set("finder",new Pn(this)),this.#ga.set("history",kn(this))}#ya(){for(const[,t]of this.#ga)"function"==typeof t?._init&&t._init()}#ba(){const t=this.#ga.get("pluginManager");Object.assign(this.$,{offset:this.#ga.get("offset"),selection:this.#ga.get("selection"),format:this.#ga.get("format"),inline:this.#ga.get("inline"),listFormat:this.#ga.get("listFormat"),html:this.#ga.get("html"),nodeTransform:this.#ga.get("nodeTransform"),char:this.#ga.get("char"),component:this.#ga.get("component"),focusManager:this.#ga.get("focusManager"),pluginManager:t,plugins:t.plugins,ui:this.#ga.get("ui"),commandDispatcher:this.#ga.get("commandDispatcher"),history:this.#ga.get("history"),shortcuts:this.#ga.get("shortcuts"),toolbar:this.#ga.get("toolbar"),subToolbar:this.#ga.get("subToolbar"),menu:this.#ga.get("menu"),viewer:this.#ga.get("viewer"),finder:this.#ga.get("finder")})}_destroy(){if(null===this.$)return;const t=[];for(const[e,s]of this.#ga)try{s?._destroy?.()}catch(s){t.push(`[Logic:${e}] ${s.message}`)}this.#ga.clear();try{this._eventOrchestrator?._removeAllEvents()}catch(e){t.push(`[EventOrchestrator] ${e.message}`)}this._eventOrchestrator=null;for(const[e,s]of this.#pa)try{s?._destroy?.()}catch(s){t.push(`[Config:${e}] ${s.message}`)}this.#pa.clear(),t.length>0&&console.warn("[CoreKernel._destroy] Cleanup completed with errors:",t),this.$=null,this.store._destroy(),this.store=null,this.facade=null}};const Ll=class{#D;$;constructor(t,e){const s=ms(t,e),i=new Hl(this,{product:s,options:e});this.#D=i,this.$=i.$,this.#Ca(e).catch((t=>{console.error("[SUNEDITOR:E_CREATE_FAIL] Failed to create editor instance.",t)}))}isEmpty(t){const e=(t||this.$.frameContext).get("wysiwyg");return Ve.check.isZeroWidth(e.textContent)&&!e.querySelector(this.$.options.get("allowedEmptyTags"))&&(e.innerText.match(/\n/g)||"").length<=1}resetOptions(t){this.$.optionProvider.reset(t),this.$.store.set("_lastSelectionNode",null),this.#wa(this.$.frameRoots.get(this.$.store.get("rootKey")));for(const t of Object.values(this.$.plugins))t.init?.()}changeFrameContext(t){t!==this.$.store.get("rootKey")&&(this.$.store.set("rootKey",t),this.#wa(this.$.frameRoots.get(t)),this.$.toolbar._resetSticky())}destroy(){this.$.options.get("hasCodeMirror")&&this.$.contextProvider.applyToRoots((t=>{const e=t.get("options").get("codeMirrorEditor");e&&e.toTextArea()})),Ve.utils.removeItem(this.$.context.get("toolbar_wrapper")),Ve.utils.removeItem(this.$.context.get("toolbar_sub_wrapper")),Ve.utils.removeItem(this.$.context.get("statusbar_wrapper"));for(const t in this.events)this.events[t]=null;return this.events=null,this.#D._destroy(),null}#wa(t){this.$.contextProvider.reset(t),this.$.optionProvider.resetFrame(t.get("options")),this.$.ui.reset(t)}#_a(t){this.$.store.set("initViewportHeight",Ae._w.visualViewport.height),this.#D._eventOrchestrator.__setViewportSize(),this.$.store.set("_canUseBeforeInput",Ae.canUseBeforeInput()),this.$.contextProvider.init(),this.#wa(this.$.frameRoots.get(this.$.store.get("rootKey"))),this.#$s(t),this.$.contextProvider.applyToRoots((t=>{this.#D._eventOrchestrator._addFrameEvents(t),this.#xa(t,t.get("options").get("value")),t.get("options").get("iframe")&&"auto"===t.get("options").get("height")&&this.$.ui._emitResizeEvent(t,t.get("wysiwygFrame").offsetHeight,null)})),this.#D._eventOrchestrator.__eventDoc=null,this.$.store._editorInitFinished=!0,this.$.pluginManager.checkFileInfo(!0),this.$.history.reset(),Ae._w.setTimeout((()=>{if(this.$.context?.size){this.$.context.get("toolbar_main").style.visibility="",this.$.contextProvider.applyToRoots((t=>{this.#D._eventOrchestrator._wwFrameObserver&&this.#D._eventOrchestrator._wwFrameObserver.observe(t.get("wysiwygFrame")),this.#D._eventOrchestrator._toolbarObserver&&this.#D._eventOrchestrator._toolbarObserver.observe(t.get("_toolbarShadow")),this.$.ui._syncFrameState(t)}));for(const t of Object.values(this.$.plugins))t.init?.();this.$.selection.__init(),this.$.eventManager.triggerEvent("onload",{})}else console.warn("[SUNEDITOR:E_INIT_FAIL] Editor instance was destroyed before initialization completed. Check if destroy() was called.")}),0)}#xa(t,e){t.get("wysiwyg").innerHTML=this.$.html.clean("string"==typeof e?e:(/^TEXTAREA$/i.test(t.get("originElement").nodeName)?t.get("originElement").value:t.get("originElement").innerHTML)||"",{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.$.options.get("freeCodeViewMode")})||"<"+this.$.options.get("defaultLine")+"><br></"+this.$.options.get("defaultLine")+">",t.has("charCounter")&&(t.get("charCounter").textContent=String(this.$.char.getLength())),t.has("wordCounter")&&(t.get("wordCounter").textContent=String(this.$.char.getWordCount())),"document"===this.$.options.get("type")&&(t.set("documentType",new bs(this.#D,t)),t.get("documentType").useHeader&&t.set("documentType_use_header",!0),t.get("documentType").usePage&&(t.set("documentType_use_page",!0),t.get("documentTypePageMirror").innerHTML=t.get("wysiwyg").innerHTML))}#$s(t){this.$.pluginManager.init(t),this.$.shortcuts._registerShortcuts(),this.$.commandDispatcher._initCommandButtons(),this.$.ui.init()}#$a(t,e,s){t.contentDocument.documentElement.className="sun-editor",t.contentDocument.head.innerHTML='<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">'+Ie._setIframeStyleLinks(s.get("iframe_cssFileName"))+Ie._setAutoHeightStyle(s.get("height")),t.contentDocument.body.className=e.get("_editableClass"),t.contentDocument.body.setAttribute("contenteditable","true"),e.get("_rtl")&&(t.contentDocument.body.dir="rtl")}async#Ca(t){this.#D._eventOrchestrator._addCommonEvents();const e=[];this.$.contextProvider.applyToRoots((t=>{const s=t.get("originElement"),i=t.get("topArea");if(s.style.display="none",i.style.display="block",s.parentNode.insertBefore(i,s.nextElementSibling),t.get("options").get("iframe")){const s=new Promise((e=>{const s=s=>{this.#$a(s,this.$.optionProvider.options,t.get("options")),e()};if(Ae.isGecko){let e=null;this.$.eventManager.addEvent(t.get("wysiwygFrame"),"load",(({target:t})=>{clearTimeout(e),e=setTimeout((()=>{this.$&&s(t)}),60)}))}else this.$.eventManager.addEvent(t.get("wysiwygFrame"),"load",(({target:t})=>{s(t)}))}));e.push(s)}})),this.$.contextProvider.applyToRoots((t=>{t.get("wrapper").appendChild(t.get("wysiwygFrame")),t.get("documentTypeInner")&&t.get("wrapper").insertBefore(t.get("documentTypeInner"),t.get("wysiwygFrame")),t.get("documentTypePage")&&(t.get("wrapper").appendChild(t.get("documentTypePage")),t.get("wrapper").appendChild(t.get("documentTypePageMirror"))),t.get("blockHandleArea")&&t.get("wrapper").insertBefore(t.get("blockHandleArea"),t.get("wysiwygFrame"))})),e.length>0&&await Promise.all(e),this.#_a(t)}};function Nl(t){let e;try{e=t.responseText}catch{return`status ${t.status}`}if(!e)return`status ${t.status}`;try{return JSON.parse(e)}catch{return e}}const Al=class{#J;#ka;constructor(t,e,s){this.#J=e,this.kind=t.constructor.key||t.constructor.name,this.#ka=Ae.getXMLHttpRequest(),this.method=s?.method,this.url=s?.url,this.headers=s?.headers,this.data=s?.data,this.callBack=s?.callBack,this.errorCallBack=s?.errorCallBack,this.responseType=s?.responseType}call({method:t,url:e,headers:s,data:i,callBack:n,errorCallBack:o,responseType:l}){if(this.cancel(),t||=this.method,e=this.#Sa(e||this.url),s||=this.headers,i||=this.data,n||=this.callBack,o||=this.errorCallBack,l||=this.responseType,"function"!=typeof n)throw new Error(`[SUNEDITOR.ApiManager[${this.kind}].upload.callBack.fail] callBack is not a function`);const r=this.#ka;if(l&&(r.responseType=l),r.onreadystatechange=this.#Ea.bind(this,r,n,o),r.open(t,e,!0),null!==s&&"object"==typeof s&&Object.keys(s).length>0)for(const t in s)r.setRequestHeader(t,s[t]);r.send(i)}asyncCall({method:t,url:e,headers:s,data:i,responseType:n}){this.cancel(),t||=this.method,e=this.#Sa(e||this.url),s||=this.headers,i||=this.data,n||=this.responseType;const o=this.#ka;return n&&(o.responseType=n),new Promise(((n,l)=>{if(o.open(t,e,!0),null!==s&&"object"==typeof s&&Object.keys(s).length>0)for(const t in s)o.setRequestHeader(t,s[t]);o.onload=()=>{if(200===o.status)try{n(o)}finally{this.#J.ui.hideLoading()}else{console.error(`[SUNEDITOR.ApiManager[${this.kind}].upload.serverException]`,o);try{l(Nl(o))}finally{this.#J.ui.hideLoading()}}},o.onerror=()=>{this.#J.ui.hideLoading(),l(new Error("Network error"))},o.send(i)}))}cancel(){this.#ka&&(this.#ka.onreadystatechange=null,this.#ka.onload=null,this.#ka.onerror=null,this.#ka.abort())}#Sa(t){return t?t.replace(/([^:])\/+/g,"$1/").replace(/\/(\?|#|$)/,"$1"):""}async#Ea(t,e,s){if(4===t.readyState)if(200===t.status)try{await e(t)}catch(t){throw Error(`[SUNEDITOR.ApiManager[${this.kind}].upload.callBack.fail] ${t.message}`)}finally{this.#J.ui.hideLoading()}else{console.error(`[SUNEDITOR.ApiManager[${this.kind}].upload.serverException]`,t);try{const e=Nl(t);let i="";"function"==typeof s&&(i=await s(e,t));const n=`[SUNEDITOR.ApiManager[${this.kind}].upload.serverException] status: ${t.status}, response: ${i||e.errorMessage||("string"==typeof e?e:JSON.stringify(e))}`;this.#J.ui.alertOpen(n,"error")}catch(t){throw Error(`[SUNEDITOR.ApiManager[${this.kind}].upload.errorCallBack.fail] ${t.message}`)}finally{this.#J.ui.hideLoading()}}}};function Bl(t){const e=t.src.split("/").pop(),s=t.thumbnail||"",i=s||t.src,n=this.props?.map((e=>`data-${e}="${t[e]}"`)).join(" ")||"",o=`data-type="${t.type}" data-command="${t.src}" data-name="${t.name||e}" data-thumbnail="${s}" data-extension="${t.src.split(".").pop()}" ${n}`,l=`class="${s||"se-browser-empty-image"}" src="${i}" alt="${t.alt||e}" ${o}`;return`\n\t\t<div class="se-file-item-img">\n\t\t\t${this.thumbnail&&!s&&"image"!==t.type?`<div class="se-browser-empty-thumbnail" ${l}>${this.thumbnail(t)}</div>`:`<img class="${s||"se-browser-empty-image"}" ${l}>`}\n\t\t\t<div class="se-file-name-image se-file-name-back"></div>\n\t\t\t<div class="se-file-name-image">${t.name||e}</div>\n\t\t</div>`}const Il=class{#J;#Ta;#Go;#Ma=[];#Ha;#La;#po=!1;#vo=null;constructor(t,e,s){this.#J=e,this.useSearch=s.useSearch??!0;const i=Ve.utils.createElement("DIV",{class:"se-browser sun-editor-common"+(s.className?` ${s.className}`:"")}),n=function(t,e){const s=t.lang,i=t.icons,n=`\n\t\t<div class="se-browser-content">\n\t\t\t<div class="se-browser-header">\n\t\t\t\t<button type="button" data-command="close" class="se-btn se-browser-close" class="close" title="${s.close}" aria-label="${s.close}">\n\t\t\t\t\t${i.cancel}\n\t\t\t\t</button>\n\t\t\t\t<span class="se-browser-title"></span>\n\t\t\t</div>\n\t\t\t<div class="se-browser-wrapper">\n\t\t\t\t<div class="se-browser-side"></div>\n\t\t\t\t<div class="se-browser-main"> \n\t\t\t\t\t<div class="se-browser-bar">\n\t\t\t\t\t\t<div class="se-browser-search">\n\t\t\t\t\t\t\t<button type="button" class="se-btn se-side-open-btn">${i.side_menu_hamburger}</button>\n\t\t\t\t\t\t\t${e?`\n\t\t\t\t\t\t\t\t\t\t<form class="se-browser-search-form">\n\t\t\t\t\t\t\t\t\t\t\t<div class="se-browser-search-input-wrap">\n\t\t\t\t\t\t\t\t\t\t\t\t<input type="text" class="se-input-form" placeholder="${s.search}" aria-label="${s.search}">\n\t\t\t\t\t\t\t\t\t\t\t\t<button type="button" class="se-btn se-btn-plain se-browser-search-clear" title="${s.cancel}" aria-label="${s.cancel}" style="display:none">${i.cancel}</button>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t<button type="submit" class="se-btn" title="${s.search}" aria-label="${s.search}">${i.search}</button>\n\t\t\t\t\t\t\t\t\t\t</form>`:""}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class="se-browser-body">\n\t\t\t\t\t\t<div class="se-browser-tags"></div>\n\t\t\t\t\t\t<div class="se-loading-box sun-editor-common"><div class="se-loading-effect"></div></div>\n\t\t\t\t\t\t<div class="se-browser-menus"></div>\n\t\t\t\t\t\t<div class="se-browser-list"></div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>`,o=Ve.utils.createElement("DIV",{class:"se-browser-inner"},n);return{html:o,header:o.querySelector(".se-browser-header"),titleArea:o.querySelector(".se-browser-title"),tagArea:o.querySelector(".se-browser-tags"),body:o.querySelector(".se-browser-body"),list:o.querySelector(".se-browser-list"),side:o.querySelector(".se-browser-side"),wrapper:o.querySelector(".se-browser-wrapper"),_loading:o.querySelector(".se-loading-box")}}(this.#J,this.useSearch),o=n.html;this.kind=t.constructor.key||t.constructor.name,this.host=t,this.area=i,this.header=n.header,this.titleArea=n.titleArea,this.tagArea=n.tagArea,this.body=n.body,this.list=n.list,this.side=n.side,this.wrapper=n.wrapper,this.#Ta=n._loading,this.title=s.title,this.listClass=s.listClass||"se-preview-list",this.directData=s.data,this.url=s.url,this.headers=s.headers,this.searchUrl=s.searchUrl,this.searchHeaders=s.searchHeaders,this.drawItemHandler=(s.drawItemHandler||Bl).bind({thumbnail:s.thumbnail,props:s.props||[]}),this.selectorHandler=s.selectorHandler,this.columnSize=s.columnSize||4,this.expand=s.expand??1,this.folderDefaultPath="",this.closeArrow=this.#J.icons.menu_arrow_right,this.openArrow=this.#J.icons.menu_arrow_down,this.icon_folder=this.#J.icons.side_menu_folder_item,this.icon_folder_item=this.#J.icons.side_menu_folder,this.icon_item=this.#J.icons.side_menu_item,this.items=[],this.folders={},this.tree={},this.data={},this.selectedTags=[],this.keyword="",this.sideInner=null,this.apiManager=new Al(this,e,{method:"GET"}),this.#Go=t=>{Re.isEsc(t.code)&&this.close()},i.appendChild(Ve.utils.createElement("DIV",{class:"se-browser-back"})),i.appendChild(o),i.setAttribute("popover","manual"),this.#J.contextProvider.carrierWrapper.appendChild(i),this.#J.eventManager.addEvent(this.tagArea,"click",this.#Na.bind(this)),this.#J.eventManager.addEvent(this.list,"click",this.#Aa.bind(this)),this.#J.eventManager.addEvent(this.side,"click",this.#Ba.bind(this)),this.#J.eventManager.addEvent(o,"mousedown",this.#Ia.bind(this)),this.#J.eventManager.addEvent(o,"click",this.#Va.bind(this)),this.#J.eventManager.addEvent(this.sideOpenBtn=i.querySelector(".se-side-open-btn"),"click",this.#Oa.bind(this)),this.#J.eventManager.addEvent([this.header,i.querySelector(".se-browser-main")],"mousedown",this.#Ra.bind(this));const l=i.querySelector("form.se-browser-search-form");this.#Ha=l?.querySelector('input[type="text"]'),this.#La=i.querySelector(".se-browser-search-clear"),this.#J.eventManager.addEvent(l,"submit",this.#Pa.bind(this)),this.#J.eventManager.addEvent(this.#La,"click",this.#za.bind(this))}open(t={}){this.#Pe();const e=t.listClass||this.listClass;Ve.utils.hasClass(this.list,e)||(this.list.className="se-browser-list "+e),this.titleArea.textContent=t.title||this.title,this.area.style.display="block",this.area.showPopover?.(),this.#J.ui.opendBrowser=this,this.closeArrow=this.#J.options.get("_rtl")?this.#J.icons.menu_arrow_left:this.#J.icons.menu_arrow_right,this.directData?this.#Da(this.directData):this.#Fa(t.url||this.url,t.headers||this.headers,!1),this.body.style.maxHeight=Ve.utils.getClientSize().h-(this.#J.offset.getGlobal(this.body).top-o.scrollY)-20+"px"}close(){this.#qe(),this.apiManager.cancel(),this.area.hidePopover?.(),this.area.style.display="none",this.selectedTags=[],this.items=[],this.#Ma=[],this.folders={},this.tree={},this.data={},this.keyword="",this.list.innerHTML=this.tagArea.innerHTML=this.titleArea.textContent="",this.#Ha&&(this.#Ha.value=""),this.#La&&(this.#La.style.display="none"),this.#J.ui.opendBrowser=null,this.sideInner=null,this.host.browserInit?.()}search(t){if(this.searchUrl){this.keyword=t;const e=this.searchUrl.includes("?")?"&":"?";this.#Fa(this.searchUrl+e+"keyword="+o.encodeURIComponent(t),this.searchHeaders,!1)}else this.keyword=t.toLowerCase(),this.#qa(this.#Ma.length>0?this.#Ma:this.items,!1)}#Wa(){const t=[];for(const e in this.data){const s=this.data[e];if(Array.isArray(s))for(let e=0;e<s.length;e++)t.push(s[e])}return t}tagfilter(t){const e=this.selectedTags;return 0===e.length?t:t.filter((t=>!Array.isArray(t.tag)||t.tag.some((t=>e.includes(t)))))}showBrowserLoading(){this.#Ta.style.display="block"}closeBrowserLoading(){this.#Ta.style.display="none"}#Fa(t,e,s){this.apiManager.call({method:"GET",url:t,headers:e,callBack:this.#Ua.bind(this),errorCallBack:this.#Za.bind(this)}),s||(this.sideOpenBtn.style.display="none",this.showBrowserLoading())}#qa(t,e){const s=this.keyword,i=[],n=(t=this.tagfilter(t).filter((t=>t.name.toLowerCase().indexOf(s)>-1))).length,o=this.columnSize,l=o<=1?1:Math.round(n/o)||1,r=this.drawItemHandler;let a="",h='<div class="se-file-item-column">',c=1;for(let s,d,u=0;u<n;u++)if(s=t[u],d=s.tag?"string"==typeof s.tag?s.tag.split(","):s.tag:[],d=s.tag=d.map((t=>t.trim())),h+=r(s),(u+1)%l==0&&c<o&&u+1<n&&(c++,h+='</div><div class="se-file-item-column">'),e&&d.length>0)for(let t,e=0,s=d.length;e<s;e++)t=d[e],t&&!i.includes(t)&&(i.push(t),a+=`<a title="${t}" aria-label="${t}">${t}</a>`);h+="</div>",this.list.innerHTML=h,s&&this.#Ga(s),e&&(this.items=t,this.tagArea.innerHTML=a)}#Pe(){this.#qe(),this.#vo=this.#J.eventManager.addGlobalEvent("keydown",this.#Go,!0)}#qe(){this.#vo&&=this.#J.eventManager.removeGlobalEvent(this.#vo)}#Da(t){if(Array.isArray(t))return t.length>0&&this.#qa(t,!0),!0;if("object"==typeof t){this.sideOpenBtn.style.display="",this.#ja(t),this.#Ma=this.#Wa(),this.side.innerHTML="";const e=this.sideInner=Ve.utils.createElement("div",null);if(this.#Ka(this.tree,e),this.side.appendChild(e),this.folderDefaultPath){const t=e.querySelector(`[data-command="${this.folderDefaultPath}"]`);t.click(),this.folderDefaultPath.includes("/")&&(Ve.utils.removeClass(t.parentElement,"se-menu-hidden"),t.parentElement.previousElementSibling.querySelector("button").innerHTML=this.openArrow)}return!0}return!1}#ja(t,e){let s=this.tree;if(t._data){this.data[e]=t._data,this.folderDefaultPath&&!t.default||(this.folderDefaultPath=e);const i=e.split("/"),n=i.length-1;i.forEach(((t,i)=>{s[t]||={children:{}},i===n?(s[t].key=e,s[t].name=this.folders[e].name):s=s[t].children}))}else e&&(s[e]={name:this.folders[e].name,children:{}});Object.entries(t).forEach((([t,s])=>{if("_data"===t||!s||"object"!=typeof s)return;const i=s,n=e?`${e}/${t}`:t;this.folders[n]={name:i.name||t,meta:i.meta||{}},this.#ja(i,n)}))}#Ka(t,e,s=0){const i=s<this.expand;for(const n in t){const o=t[n];if(o)if(Object.keys(o.children).length>0){const t=Ve.utils.createElement("div",o.key?{"data-command":o.key,"aria-label":o.name}:null,`<span class="se-menu-icon">${o.key?this.icon_folder:this.icon_folder_item}</span><span>${o.name}</span>`),n=Ve.utils.createElement("div",{class:"se-menu-folder"},t);t.insertBefore(Ve.utils.createElement("button",{type:"button"},i?this.openArrow:this.closeArrow),t.firstElementChild);const l=document.createElement("div");Ve.utils.addClass(l,i?"se-menu-child":"se-menu-child|se-menu-hidden"),this.#Ka(o.children,l,s+1),n.appendChild(l),e.appendChild(n)}else{const t=Ve.utils.createElement("div",{"data-command":o.key,"aria-label":o.name,class:"se-menu-folder-item"},`<span class="se-menu-icon">${this.icon_item}</span><span>${o.name}</span>`);if(e===this.sideInner){const s=Ve.utils.createElement("div",{class:"se-menu-folder"},t);e.appendChild(s)}else e.appendChild(t)}}}#Ua(t){try{const e=JSON.parse(t.responseText),s=e.result;if(this.#Da(s))return;e.nullMessage&&(this.list.innerHTML=e.nullMessage)}catch(t){throw Error(`[SUNEDITOR.browser.drawList.fail] cause: "${t.message}"`)}finally{this.closeBrowserLoading()}}#Za(t,e){throw this.closeBrowserLoading(),Error(`[SUNEDITOR.browser.get.serverException] status: ${e.status}, response: ${t.errorMessage||e.responseText}`)}#Na(t){const e=Ve.query.getEventTarget(t);if(!Ve.check.isAnchor(e))return;const s=e.textContent,i=this.tagArea.querySelector('a[title="'+s+'"]'),n=this.selectedTags.indexOf(s);n>-1?(this.selectedTags.splice(n,1),Ve.utils.removeClass(i,"on")):(this.selectedTags.push(s),Ve.utils.addClass(i,"on")),this.#qa(this.items,!1)}#Aa(t){const e=Ve.query.getEventTarget(t);if(t.preventDefault(),t.stopPropagation(),e===this.list)return;const s=Ve.query.getCommandTarget(e);s&&(this.close(),this.selectorHandler(s))}#Ba(t){const e=Ve.query.getEventTarget(t);if(t.stopPropagation(),/^button$/i.test(e.nodeName)){const t=e.parentElement.parentElement.querySelector(".se-menu-child");return void(Ve.utils.hasClass(t,"se-menu-hidden")?(Ve.utils.removeClass(t,"se-menu-hidden"),e.innerHTML=this.openArrow):(Ve.utils.addClass(t,"se-menu-hidden"),e.innerHTML=this.closeArrow))}const s=Ve.query.getCommandTarget(e);if(!s||Ve.utils.hasClass(s,"active"))return;const i=this.data[s.getAttribute("data-command")];Ve.utils.removeClass(this.side.querySelectorAll(".active"),"active"),Ve.utils.addClass([s,Ve.query.getParentElement(s,".se-menu-folder")],"active"),this.tagArea.innerHTML="",this.selectedTags=[],"string"==typeof i?this.#Fa(i,this.headers,!0):this.#qa(i,!0)}#Ia(t){const e=Ve.query.getEventTarget(t);/se-browser-inner/.test(e.className)?this.#po=!0:this.#po=!1}#Va(t){const e=Ve.query.getEventTarget(t);t.stopPropagation(),(/close/.test(e.getAttribute("data-command"))||this.#po)&&this.close()}#Pa(t){t.preventDefault();const e=this.#Ha.value;this.search(e),this.#La&&(this.#La.style.display=e?"":"none")}#za(){this.#Ha&&(this.#Ha.value=""),this.#La&&(this.#La.style.display="none"),this.keyword="",this.#qa(this.items,!1)}#Ga(t){const e=this.list.querySelectorAll(".se-file-name-image:not(.se-file-name-back)");for(let s=0;s<e.length;s++){const i=e[s],n=i.textContent,o=n.toLowerCase().indexOf(t);o>-1&&(i.innerHTML=n.substring(0,o)+"<mark>"+n.substring(o,o+t.length)+"</mark>"+n.substring(o+t.length))}}#Oa(t){const e=Ve.query.getEventTarget(t);Ve.utils.hasClass(e,"active")?(Ve.utils.removeClass(this.side,"se-side-show"),Ve.utils.removeClass(e,"active")):(Ve.utils.addClass(this.side,"se-side-show"),Ve.utils.addClass(e,"active"))}#Ra({target:t}){t!==this.sideOpenBtn&&Ve.utils.hasClass(this.sideOpenBtn,"active")&&(Ve.utils.removeClass(this.side,"se-side-show"),Ve.utils.removeClass(this.sideOpenBtn,"active"))}},{isTouchDevice:Vl}=Ae,Ol=240,Rl=120,Pl={hex:"#FFFFFF",r:255,g:255,b:255,h:0,s:1,l:1};let zl,Dl=0,Fl=!1,ql=!1,Wl=120,Ul=120,Zl=Pl,Gl=!1;const{slider:jl,offscreenCanvas:Kl,offscreenCtx:Yl,wheel:Xl,wheelCtx:Jl,wheelPointer:Ql,gradientBar:tr,gradientPointer:er,fanalColorHex:sr,fanalColorBackground:ir}=function(){const t=document.createElement("canvas");t.width=Ol,t.height=Ol;const e=`\n\t<div class="se-hue-slider-container" style="width: 240px; height: 240px;">\n <canvas class="se-hue-wheel" width="240" height="240"></canvas>\n <div class="se-hue-wheel-pointer"></div>\n </div>\n <div class="se-hue-gradient-container">\n <canvas class="se-hue-gradient" width="240" height="28"></canvas>\n <div class="se-hue-gradient-pointer"></div>\n </div>\n <div class="se-hue-final-hex" style="width:240px; height: 28px;">\n\t\t<div style="flex: 3; line-height: 1.5;">${Pl.hex}</div>\n\t\t<div style="flex: 1; height: 100%; border: 1px solid #fff; outline: 1px solid #000;"></div>\n\t</div>\n\t`,s=Ve.utils.createElement("DIV",{class:"se-hue-slider"},e),i=s.querySelector(".se-hue-wheel"),n=s.querySelector(".se-hue-gradient"),o=s.querySelector(".se-hue-final-hex").children;return{slider:s,offscreenCanvas:t,offscreenCtx:t.getContext("2d"),wheel:i,wheelCtx:i.getContext("2d"),wheelPointer:s.querySelector(".se-hue-wheel-pointer"),gradientBar:n,gradientPointer:s.querySelector(".se-hue-gradient-pointer"),fanalColorHex:o[0],fanalColorBackground:o[1]}}();function nr(t){const{target:e,touches:s}=t,i=s[0].clientX,n=s[0].clientY;e===Xl?(t.preventDefault(),ql=!1,Fl=!0,ar(i,n)):e===tr&&(t.preventDefault(),ql=!0,Fl=!1,hr(i))}function or(t){t.preventDefault();const{touches:e}=t,s=e[0].clientX,i=e[0].clientY;Fl?ar(s,i):ql&&hr(s)}function lr({target:t,clientX:e,clientY:s}){t===Xl?(ql=!1,Fl=!0,ar(e,s)):t===tr&&(ql=!0,Fl=!1,hr(e))}function rr({clientX:t,clientY:e}){Fl?ar(t,e):ql&&hr(t)}function ar(t,e){const s=Xl.getBoundingClientRect();t=t-s.left-Rl,e=e-s.top-Rl;const i=180*Math.atan2(e,t)/Math.PI,n=Math.min(Math.sqrt(t*t+e*e),Rl),o=Rl+n*Math.cos(i*Math.PI/180),l=Rl+n*Math.sin(i*Math.PI/180);Ql.style.left=`${o}px`,Ql.style.top=`${l}px`,function(t,e){Wl=t,Ul=e,cr(dr())}(o,l),ur()}function hr(t){const e=tr.getBoundingClientRect();let s=t-e.left;s=Math.max(14,Math.min(s,e.width-14)),er.style.left=`${s}px`,function(t){const e=tr.getBoundingClientRect();let s=t-e.left;s<0&&(s=0);s>e.width&&(s=e.width);const i=14;s>=tr.width-i?s=tr.width:s<=i&&(s=0);const n=1-s/e.width;Dl=n,mr()}(t),ur()}function cr(t){const e=tr.getContext("2d"),s=e.createLinearGradient(0,0,tr.width,0);s.addColorStop(0,"black"),s.addColorStop(1,t.hex),e.fillStyle=s,e.fillRect(0,0,tr.width,tr.height)}function dr(){return gr(Yl)}function ur(){zl.color=Zl=gr(Jl),pr(Zl.hex)}function pr(t){ir.style.backgroundColor=sr.textContent=t}function gr(t){const e=t.getImageData(Wl,Ul,1,1).data;let[s,i,n]=function([t,e,s]){t/=255,e/=255,s/=255;const i=Math.max(t,e,s),n=Math.min(t,e,s);let o,l;const r=(i+n)/2;if(i===n)o=l=0;else{const a=i-n;switch(l=r>.5?a/(2-i-n):a/(i+n),i){case t:o=(e-s)/a+(e<s?6:0);break;case e:o=(s-t)/a+2;break;case s:o=(t-e)/a+4}o/=6}return[vr(o),vr(l),vr(r)]}(e);const o=Wl-Rl,l=Ul-Rl;Math.sqrt(o*o+l*l)<3&&(n=1-Dl),n>1&&(n=1),n<0&&(n=0);const{r,g:a,b:h}=function([t,e,s]){let i,n,o;if(0===e)i=n=o=s;else{const l=function(t,e,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+6*(e-t)*s:s<.5?e:s<2/3?t+(e-t)*(2/3-s)*6:t},r=s<.5?s*(1+e):s+e-s*e,a=2*s-r;i=l(a,r,t+1/3),n=l(a,r,t),o=l(a,r,t-1/3)}return{r:Math.round(255*i),g:Math.round(255*n),b:Math.round(255*o)}}([s,i,n]),c=`#${function({r:t,g:e,b:s}){let i=Math.floor(t).toString(16);t<16&&(i=`0${i}`);let n=Math.floor(e).toString(16);e<16&&(n=`0${n}`);let o=Math.floor(s).toString(16);s<16&&(o=`0${o}`);return`${i}${n}${o}`.toUpperCase()}({r,g:a,b:h})}`;return{hex:c,r,g:a,b:h,h:s,s:i,l:vr(n)}}function mr(){Jl.clearRect(0,0,Ol,Ol),Jl.drawImage(Kl,0,0),Jl.globalAlpha=Dl,Jl.fillStyle="black",Jl.beginPath(),Jl.arc(Rl,Rl,Rl,0,2*Math.PI),Jl.fill(),Jl.globalAlpha=1}function fr(t){return t*Math.PI/180}function vr(t){const e=Math.pow(10,10);return Math.round(t*e)/e}function br(){!function(t){if(!t)return void console.warn("[HueSlider.fail] Context not found.");for(let e=0;e<=360;e+=.5)for(let s=0;s<=Rl;s+=1){t.beginPath();const i=50+(Rl-s)/Rl*50;t.fillStyle=`hsl(${e}, 100%, ${i}%)`;const n=Rl+Math.cos(fr(e))*s,o=Rl-Math.sin(fr(e))*s;t.arc(n,o,1.5,0,2*Math.PI),t.fill()}Gl=!0}(Yl),Gl&&mr()}br();const yr=class{#J;#Ya;#Xa;#Ja;#Qa;#th;#eh;constructor(t,e,s={},i=""){if(this.#J=e,this.inst=t,this.ctx={wheelX:Wl,wheelY:Ul,lightness:Dl,wheelPointerX:"50%",wheelPointerY:"50%",gradientPointerX:"calc(100% - 14px)",color:Pl},this.isOpen=!1,this.controlle=null,this.#Ya=null,this.#Xa=null,this.#Ja=null,this.#Qa=null,this.#th=null,this.#eh=null,!s.isNewForm){const n=function({lang:t,icons:e},s){const i=Ve.utils.createElement("DIV",{class:`se-controller ${s}`},`\n\t\t<div class="se-hue"></div>\n\t\t<div class="se-form-group se-form-w0 se-form-flex-btn">\n\t\t\t<button type="button" class="se-btn se-btn-success" title="${t.submitButton}" aria-label="${t.submitButton}" data-command="submit">${e.checked}</button>\n\t\t\t<button type="button" class="se-btn se-btn-danger" title="${t.close}" aria-label="${t.close}" data-command="close">${e.cancel}</button>\n\t\t</div>\n\t`);return i}(e,i);this.circle=n.querySelector(".se-hue"),this.controller=new Ti(this,e,n,{position:"bottom",isWWTarget:!1,parents:[t.form],parentsHide:!0,...s.controllerOptions})}}controllerAction(t){const e=t.getAttribute("data-command");"submit"===e?(this.inst.hueSliderAction?.(this.get()),this.close()):"close"===e&&this.close()}controllerClose(){this.init(),this.inst.hueSliderCancelAction?.()}get(){return Zl}open(t){this.attach(),this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null})}close(){this.ctx={gradientPointerX:er.style.left,wheelPointerX:Ql.style.left,wheelPointerY:Ql.style.top,wheelX:Wl,wheelY:Ul,lightness:Dl,color:zl?.color||""},this.controller.close()}attach(t){Gl||br(),this.init(),(t||this.circle).appendChild(jl),zl=this.ctx,zl&&(Wl=zl.wheelX,Ul=zl.wheelY,Dl=zl.lightness,Ql.style.left=zl.wheelPointerX,Ql.style.top=zl.wheelPointerY,er.style.left=zl.gradientPointerX,pr(zl.color.hex),mr(),cr(dr())),Vl&&(this.#th=this.#J.eventManager.addGlobalEvent("touchstart",nr,{passive:!1,capture:!0}),this.#Xa=this.#J.eventManager.addGlobalEvent("touchmove",or,!0),this.#eh=this.#J.eventManager.addGlobalEvent("touchend",(()=>{Fl=!1,ql=!1}),!0)),this.#Ya=this.#J.eventManager.addGlobalEvent("mousedown",lr,{passive:!1,capture:!0}),this.#Qa=this.#J.eventManager.addGlobalEvent("mousemove",rr,!0),this.#Ja=this.#J.eventManager.addGlobalEvent("mouseup",(()=>{Fl=!1,ql=!1}),!0),this.isOpen=!0}init(){this.isOpen=!1,Fl=!1,ql=!1,this.#Ya&&=this.#J.eventManager.removeGlobalEvent(this.#Ya),this.#Qa&&=this.#J.eventManager.removeGlobalEvent(this.#Qa),this.#Ja&&=this.#J.eventManager.removeGlobalEvent(this.#Ja),this.#th&&=this.#J.eventManager.removeGlobalEvent(this.#th),this.#Xa&&=this.#J.eventManager.removeGlobalEvent(this.#Xa),this.#eh&&=this.#J.eventManager.removeGlobalEvent(this.#eh)}},Cr=["#ef4444","#f97316","#eab308","#22c55e","#06b6d4","#3b82f6","#8b5cf6","#ec4899","#000000","#fca5a5","#fdba74","#fcd34d","#6ee7b7","#5eead4","#7dd3fc","#c4b5fd","#f9a8d4","#e5e7eb","#fee2e2","#ffedd5","#fef9c3","#dcfce7","#cffafe","#dbeafe","#ede9fe","#fce7f3","#f3f4f6","#f87171","#fb923c","#facc15","#4ade80","#22d3ee","#60a5fa","#a78bfa","#f472b6","#9ca3af","#b91c1c","#c2410c","#a16207","#15803d","#0e7490","#1d4ed8","#6d28d9","#be185d","#4b5563","#7f1d1d","#7c2d12","#713f12","#14532d","#164e63","#1e3a8a","#4c1d95","#831843","#1f2937"];function wr(t,e){const s=`<ul class="se-color-pallet${e?" se-list-horizontal":""}">`;let i=s;for(let n,o,l,r=0,a=t.length;r<a;r++)n=t[r],"string"==typeof n?(o=n,l=n):"object"==typeof n&&(o=n.value,l=n.name||o),r>0&&r%e==0&&(i+=`</ul>${s}`),i+=`<li><button type="button" data-value="${o}" title="${l}" aria-label="${l}" style="background-color:${o};"></button></li>`;return i+="</ul>",i}const _r=class{#J;constructor(t,e,s,i){this.#J=e,this.kind=t.constructor.key||t.constructor.name,this.host=t,this.form=i.form,this.target=function({lang:t,icons:e},{colorList:s,disableHEXInput:i,disableRemove:n,splitNum:o}){s||=Cr,o=s===Cr?9:o;let l="";for(let t,e=0,i=s.length,n=[];e<i;e++)t=s[e],t&&(("string"==typeof t||t.value)&&(n.push(t),e<i-1)||(n.length>0&&(l+=`<div class="se-selector-color">${wr(n,o)}</div>`,n=[]),"object"==typeof t&&(l+=`<div class="se-selector-color">${wr(t,o)}</div>`)));return l+=`\n\t\t<form class="se-form-group se-form-w0">\n\t\t\t${i?"":`<button type="button" class="se-btn __se_hue" title="${t.colorPicker}" aria-label="${t.colorPicker}">${e.color_palette}</button>`}\n\t\t\t<input type="text" class="se-color-input" ${i?"readonly":""} placeholder="${t.color}" />\n\t\t\t${i?"":`<button type="submit" class="se-btn se-btn-success" title="${t.submitButton}" aria-label="${t.submitButton}">${e.checked}</button>`}\n\t\t\t${n?"":`<button type="button" class="se-btn __se_remove" title="${t.remove}" aria-label="${t.remove}">${e.remove_color}</button>`}\n\t\t</form>`,Ve.utils.createElement("DIV",{class:"se-list-inner"},l)}(this.#J,i),this.targetButton=null,this.inputElement=this.target.querySelector(".se-color-input"),this.styleProperties=s,this.splitNum=i.splitNum||0,this.defaultColor=i.defaultColor||"",this.hueSliderOptions=i.hueSliderOptions,this.currentColor="",this.colorList=this.target.querySelectorAll("li button")||[],this.hueSlider=null;const n=(new DOMParser).parseFromString(this.#J.icons.color_checked,"image/svg+xml");this.checkedIcon=n.documentElement,i.disableHEXInput||(this.hueSlider=new yr(this,e,i.hueSliderOptions,"se-dropdown"),this.#J.eventManager.addEvent(this.target.querySelector(".__se_hue"),"click",this.#sh.bind(this)),this.#J.eventManager.addEvent(this.inputElement,"input",this.#ih.bind(this)),this.#J.eventManager.addEvent(this.target.querySelector("form"),"submit",this.#nh.bind(this))),i.disableRemove||this.#J.eventManager.addEvent(this.target.querySelector(".__se_remove"),"click",this.#oh.bind(this)),this.#J.eventManager.addEvent(this.target,"click",this.#lh.bind(this)),this.form.appendChild(this.target)}init(t,e,s){this.targetButton=e,"function"!=typeof s&&(s=()=>!1);let i=("string"==typeof t?t:this.#rh(t,s))||this.defaultColor;i=Ie.isHexColor(i)?i:Ie.rgb2hex(i)||i||"";const n=this.colorList;for(let t,e=0,s=n.length;e<s;e++)t=n[e],i.toLowerCase()===t.getAttribute("data-value").toLowerCase()?(t.appendChild(this.checkedIcon),Ve.utils.addClass(t,"active")):(Ve.utils.removeClass(t,"active"),t.contains(this.checkedIcon)&&Ve.utils.removeItem(this.checkedIcon));this.#ah(this.#hh(i))}setHexColor(t){this.currentColor=t,this.inputElement.style.borderColor=t}hueSliderClose(){this.hueSlider.close()}hueSliderAction(t){this.#ah(t.hex)}hueSliderCancelAction(){this.form.style.display="block",this.host.colorPickerHueSliderClose?.()}#ah(t){t=!t||/^#/.test(t)?t:"#"+t,this.inputElement.value=t,this.setHexColor.call(this,t)}#rh(t,e){let s="";const i=this.styleProperties;for(;t&&!e(t)&&!Ve.check.isWysiwygFrame(t)&&0===s.length;)G(t)&&t.style[i]&&(s=t.style[i]),t=t.parentNode;return s}#hh(t){if(!t||/^#/.test(t))return t;const e=Ve.utils.createElement("div",{style:"display: none; color: "+t}),s=Ae._w.getComputedStyle(Ae._d.body.appendChild(e)).color.match(/\d+/g).map((function(t){return parseInt(t,10)}));return Ve.utils.removeItem(e),s.length>=3?"#"+((1<<24)+(s[0]<<16)+(s[1]<<8)+s[2]).toString(16).substring(1):""}#sh(){this.hueSlider.open(this.targetButton),this.host.colorPickerHueSliderOpen?.()}#nh(t){t.preventDefault(),this.host.colorPickerAction?.(this.currentColor)}#lh(t){const e=Ve.query.getEventTarget(t).getAttribute("data-value");e&&this.host.colorPickerAction?.(e)}#oh(){this.host.colorPickerAction?.(null)}#ih(t){const e=Ve.query.getEventTarget(t);this.setHexColor(e.value)}},{_w:xr}=Ae,$r={w:"ns-resize",h:"ew-resize",c:"nwse-resize",wRTL:"ns-resize",hRTL:"ew-resize",cRTL:"nesw-resize"};const kr=class{#J;#ch;#dh;#uh;#ph;#uo;#ke;#vo=null;#gh=!1;#mh=null;#fh=null;#vh="";#bh=0;#yh=0;#Ch=null;#wh=null;constructor(t,e,s){this.#J=e,this.inst=t,this.kind=t.constructor.key||t.constructor.name,this.form=s,this.isUpdate=!1,this.focusElement=s.querySelector("[data-focus]"),this.#dh=this.#J.contextProvider.carrierWrapper.querySelector(".se-modal"),this.#uh=this.#J.contextProvider.carrierWrapper.querySelector(".se-modal .se-modal-inner"),this.#uo=[this.#_h.bind(this),this.#xh.bind(this)],this.#uh.appendChild(s),this.#J.eventManager.addEvent(s.querySelector("form"),"submit",this.#Ve.bind(this)),this.#gh=!this.#J.eventManager.addEvent(s.querySelector('[data-command="close"]'),"click",this.close.bind(this)),(s.querySelector(".se-modal-resize-handle-w")||s.querySelector(".se-modal-resize-handle-h")||s.querySelector(".se-modal-resize-handle-c")||s.querySelector(".se-modal-resize-form"))&&!(this.#ph=s.querySelector(".se-modal-resize-form"))&&(this.#ph=s.querySelector(".se-modal-body"))&&(this.#J.eventManager.addEvent(s.querySelector(".se-modal-resize-handle-w"),"mousedown",this.#$h.bind(this,"w")),this.#J.eventManager.addEvent(s.querySelector(".se-modal-resize-handle-h"),"mousedown",this.#$h.bind(this,"h")),this.#J.eventManager.addEvent(s.querySelector(".se-modal-resize-handle-c"),"mousedown",this.#$h.bind(this,"c")),this.#ke={mousemove:this.#kh.bind(this),mouseup:this.#Sh.bind(this)})}static CreateFileInput({icons:t,lang:e},{acceptedFormats:s,allowMultiple:i}){return`\n\t\t<div class="se-modal-form-files">\n\t\t\t<div class="se-flex-input-wrapper">\n\t\t\t\t<div class="se-input-form-abs">\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<div class="se-input-file-w">\n\t\t\t\t\t\t\t<div class="se-input-file-icon-up">${t.upload_tray}</div>\n\t\t\t\t\t\t\t<div class="se-input-file-icon-files">${t.file_plus}</div>\n\t\t\t\t\t\t\t<span class="se-input-file-cnt"></span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<input class="se-input-form __se__file_input" data-focus type="file" accept="${s}"${i?' multiple="multiple"':""}/>\n\t\t\t</div>\n\t\t\t<button type="button" class="se-btn se-modal-files-edge-button se-file-remove se-tooltip" aria-label="${e.remove}">\n\t\t\t\t${t.selection_remove}\n\t\t\t\t${Ve.utils.createTooltipInner(e.remove)}\n\t\t\t</button>\n\t\t</div>`}static OnChangeFile(t,e){if(!t||!e)return;const s=t.querySelector(".se-input-file-cnt"),i=t.querySelector(".se-input-file-icon-up"),n=t.querySelector(".se-input-file-icon-files");e.length>1?(i.style.display="none",n.style.display="inline-block",s.style.display="",s.textContent=` ..${e.length}`):e.length>0?(i.style.display="none",n.style.display="none",s.style.display="block",s.textContent=e[0].name):(i.style.display="inline-block",n.style.display="none",s.style.display="",s.textContent="")}open(){if(this.#J.ui.offCurrentModal(),this.#Eh(!0),this.#gh&&(this.#mh&&this.#J.eventManager.removeEvent(this.#mh),this.#mh=this.#J.eventManager.addEvent(this.#uh,"click",this.#uo[1])),this.#vo&&=this.#J.eventManager.removeGlobalEvent(this.#vo),this.#vo=this.#J.eventManager.addGlobalEvent("keydown",this.#uo[0]),this.isUpdate=this.kind===this.#J.ui.currentControllerName,this.#J.ui.opendModal=this,this.isUpdate||this.inst.modalInit?.(),this.inst.modalOn?.(this.isUpdate),Ve.utils.addClass(this.#dh,"se-backdrop-show"),Ve.utils.addClass(this.form,"se-modal-show"),this.#dh.showPopover?.(),this.#ph){const t=this.#Th(),{maxWidth:e,maxHeight:s}=xr.getComputedStyle(this.form),i=this.form.offsetWidth-t.width+"px",n=`${this.form.offsetTop+(this.form.offsetHeight-this.#ph.offsetHeight)}px`;e&&"string"==typeof this.#vh&&Ve.utils.setStyle(this.#ph,"max-width",`calc(${e} - ${i})`),s&&Ve.utils.setStyle(this.#ph,"max-height",`calc(${s} - ${n})`)}this.focusElement&&this.focusElement.focus(),this.#ch=this.#J.component.currentTarget}close(){this.#qe(),this.#Eh(!1),xr.setTimeout((()=>{this.#J.ui.opendModal=null}),0),this.#gh&&this.#mh&&(this.#J.eventManager.removeEvent(this.#mh),this.#mh=null),this.#vo&&=this.#J.eventManager.removeGlobalEvent(this.#vo),this.#dh.hidePopover?.(),Ve.utils.removeClass(this.#dh,"se-backdrop-show"),Ve.utils.removeClass(this.form,"se-modal-show"),this.inst.modalInit?.(),this.inst.modalOff?.(this.isUpdate),this.isUpdate?this.#ch&&this.inst.componentSelect?.(this.#ch):this.#J.focusManager.focus(),this.#ch=null}#Eh(t){const e=this.#J.ui.opendControllers;for(let s=0;s<e.length;s++)e[s].fixed=t,e[s].form.style.display=t?"none":"block"}#Th(){const t=this.#J.offset.getGlobal(this.#ph);return this.#bh=t.top,this.#yh=t.left,t}#Pe(t){this.#qe(),this.#J.ui.enableBackWrapper($r[t]),this.#Ch=this.#J.eventManager.addGlobalEvent("mousemove",this.#ke.mousemove,!0),this.#wh=this.#J.eventManager.addGlobalEvent("mouseup",this.#ke.mouseup,!0)}#qe(){this.#J.ui.disableBackWrapper(),this.#Ch&&=this.#J.eventManager.removeGlobalEvent(this.#Ch),this.#wh&&=this.#J.eventManager.removeGlobalEvent(this.#wh)}async#Ve(t){t.preventDefault(),t.stopPropagation(),this.#J.ui.showLoading();try{const t=await this.inst.modalAction();!1===t?this.#J.ui.hideLoading():void 0===t?this.close():(this.close(),this.#J.ui.hideLoading())}catch(t){throw this.close(),this.#J.ui.hideLoading(),Error(`[SUNEDITOR.Modal[${this.kind}].warn] ${t.message}`)}}#xh(t){const e=Ve.query.getEventTarget(t);(/close/.test(e.getAttribute("data-command"))||e===this.#uh)&&this.close()}#_h(t){Re.isEsc(t.code)&&this.close()}#$h(t,e){this.#fh=Ve.query.getEventTarget(e),Ve.utils.addClass(this.#fh,"active"),this.#Pe(this.#vh=t+(this.#J.options.get("_rtl")?"RTL":""))}#kh(t){switch(this.#vh){case"w":case"wRTL":{const e=t.clientY-this.#bh-this.#ph.offsetHeight;this.#ph.style.height=this.#ph.offsetHeight+e+"px";break}case"h":{const e=t.clientX-this.#yh-this.#ph.offsetWidth;this.#ph.style.width=this.#ph.offsetWidth+e+"px";break}case"hRTL":{const e=this.#yh-t.clientX;this.#ph.style.width=this.#ph.offsetWidth+e+"px";break}case"c":{const e=t.clientX-this.#yh-this.#ph.offsetWidth,s=t.clientY-this.#bh-this.#ph.offsetHeight;this.#ph.style.width=this.#ph.offsetWidth+e+"px",this.#ph.style.height=this.#ph.offsetHeight+s+"px";break}case"cRTL":{const e=this.#yh-t.clientX,s=t.clientY-this.#bh-this.#ph.offsetHeight;this.#ph.style.width=this.#ph.offsetWidth+e+"px",this.#ph.style.height=this.#ph.offsetHeight+s+"px";break}}this.#Th(),this.inst.modalResize?.()}#Sh(){Ve.utils.removeClass(this.#fh,"active"),this.#fh=null,this.#qe()}};function Sr(t,e){const s=t.getAttribute(`data-se-${e}`);if(s)return s;const i=t.getAttribute(`data-${e}`);return i?(t.removeAttribute(`data-${e}`),t.setAttribute(`data-se-${e}`,i),i):null}const Er=class{#J;constructor(t,e,s){this.#J=e,t.__fileManagement=this,this.kind=t.constructor.key||t.constructor.name,this.inst=t,this.query=s.query,this.loadEventName=s.loadEventName,this.actionEventName=s.actionEventName,this.infoList=[],this.infoIndex=0,this.uploadFileLength=0,this.__updateTags=[],this.apiManager=new Al(this,e),this._resetInfo,this._checkInfo}upload(t,e,s,i,n){this.#J.ui.showLoading();let o=null;if("length"in s){o=new FormData;for(let t=0,e=s.length;t<e;t++)o.append("file-"+t,s[t]);this.uploadFileLength=s.length}else o=s.formData,this.uploadFileLength=s.size;this.apiManager.call({method:"POST",url:t,headers:e,data:o,callBack:i,errorCallBack:n})}async asyncUpload(t,e,s){this.#J.ui.showLoading();let i=null;if("length"in s){i=new FormData;for(let t=0,e=s.length;t<e;t++)i.append("file-"+t,s[t]);this.uploadFileLength=s.length}else i=s.formData,this.uploadFileLength=s.size;return await this.apiManager.asyncCall({method:"POST",url:t,headers:e,data:i})}setFileData(t,{name:e,size:s}){t&&(t.setAttribute("data-se-file-name",e),t.setAttribute("data-se-file-size",s+""))}getSize(){let t=0;for(let e=0,s=this.infoList.length;e<s;e++)t+=1*this.infoList[e].size;return t}_checkInfo(t){const e=[].slice.call(this.#J.frameContext.get("wysiwyg").querySelectorAll(this.query)),s=this.infoList;if(e.length===s.length){let t=!1;for(let i,n=0,o=s.length;n<o;n++)if(i=s[n],0===e.filter((function(t){return i.src===t.src&&i.index.toString()===Sr(t,"index")})).length){t=!0;break}if(!t)return}const i=[],n=[];for(let t=0,e=s.length;t<e;t++)n[t]=s[t].index;for(this.__updateTags=e;e.length>0;){const t=e.shift();Sr(t,"index")&&n.includes(Number(Sr(t,"index")))?i.push(Number(Sr(t,"index"))):(i.push(this.infoIndex),t.removeAttribute("data-se-index"),this.#Mh(t,null))}if(t&&this.loadEventName)this.#J.eventManager.triggerEvent(this.loadEventName,{infoList:s});else for(let t,e=0;e<s.length;e++){if(t=s[e].index,i.includes(t))continue;s.splice(e,1);const n={element:null,index:t,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind};this.actionEventName&&this.#J.eventManager.triggerEvent(this.actionEventName,n),this.#J.eventManager.triggerEvent("onFileManagerAction",{...n,pluginName:this.kind}),e--}}_resetInfo(){const t={element:null,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind};for(let e=0,s=this.infoList.length;e<s;e++)this.actionEventName&&this.#J.eventManager.triggerEvent(this.actionEventName,{...t,index:this.infoList[e].index,pluginName:this.kind}),this.#J.eventManager.triggerEvent("onFileManagerAction",{...t,index:this.infoList[e].index,pluginName:this.kind});this.infoList=[],this.infoIndex=0}#Hh(t){if(t>=0)for(let e=0,s=this.infoList.length;e<s;e++)if(t===this.infoList[e].index)return this.infoList.splice(e,1),void(this.actionEventName&&this.#J.eventManager.triggerEvent(this.actionEventName,{element:null,index:t,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind}))}#Mh(t,e){let s=Number(Sr(t,"index")),i=null,n="";if(e||={name:Sr(t,"file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:Number(Sr(t,"file-size"))||0},s&&this.#J.store._editorInitFinished){n="update",s*=1;for(let t=0,e=this.infoList.length;t<e;t++)if(s===this.infoList[t].index){i=this.infoList[t];break}i||(s=this.infoIndex++,i={index:s},this.infoList.push(i)),i.src=t.src,i.name=Sr(t,"file-name"),i.size=Number(Sr(t,"file-size"))}else n="create",s=this.infoIndex++,t.setAttribute("data-se-index",s+""),t.setAttribute("data-se-file-name",e.name),t.setAttribute("data-se-file-size",e.size+""),i={src:t.src,index:s,name:e.name,size:e.size},this.infoList.push(i);i.element=t,i.delete=function(t,e){this.inst.componentDestroy?.(e),t(Number(Sr(e,"index")))}.bind(this,this.#Hh.bind(this),t),i.select=function(t,e){e.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"});const s=t.get(e);s?t.select(s.target,s.pluginName):this.inst.componentSelect?.(e)}.bind(this,this.#J.component,t);const o={element:t,index:s,state:n,info:i,remainingFilesCount:--this.uploadFileLength<0?0:this.uploadFileLength,pluginName:this.kind};this.actionEventName&&this.#J.eventManager.triggerEvent(this.actionEventName,o),this.#J.eventManager.triggerEvent("onFileManagerAction",{...o,pluginName:this.kind})}},{_w:Tr,NO_EVENT:Mr}=Ae;const Hr=class{#J;#Lh;#Nh;#Ah;#Bh;constructor(t,e,s){this.#J=t,this.openNewWindow=!!s.openNewWindow,this.relList=Array.isArray(s.relList)?s.relList:[],this.defaultRel=s.defaultRel||{},this.noAutoPrefix=!!s.noAutoPrefix,s.enableFileUpload&&(this.uploadUrl="string"==typeof s.uploadUrl?s.uploadUrl:null,this.uploadHeaders=s.uploadHeaders||null,this.uploadSizeLimit=Oe.get(s.uploadSizeLimit,0)||null,this.uploadSingleSizeLimit=Oe.get(s.uploadSingleSizeLimit,0)||null,this.input=Ve.utils.createElement("input",{type:"file",accept:s.acceptedFormats||"*"}),this.#J.eventManager.addEvent(this.input,"change",this.#Ih.bind(this)),this.fileManager=new Er(this,t,{query:"a[download]:not([data-se-file-download])",loadEventName:"onFileLoad",actionEventName:"onFileAction"}));const i=function(t,e,s){const i=t.lang,n=t.icons,o=e.textToDisplay?"":'style="display: none;"',l=e.title?"":'style="display: none;"';let r=`\n\t\t<div class="se-modal-body">\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<label>${i.link_modal_url}</label>\n\t\t\t\t<div class="se-modal-form-files">\n\t\t\t\t\t<input data-focus class="se-input-form se-input-url" type="text" placeholder="${t.options.get("defaultUrlProtocol")||""}" />\n\t\t\t\t\t${e.enableFileUpload?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button _se_upload_button" aria-label="${i.fileUpload}">\n\t\t\t\t\t\t\t\t\t${n.file_upload}\n\t\t\t\t\t\t\t\t\t${Ve.utils.createTooltipInner(i.fileUpload)}\n\t\t\t\t\t\t\t\t</button>`:""}\n\t\t\t\t\t<button type="button" class="se-btn se-tooltip se-modal-files-edge-button _se_bookmark_button" aria-label="${i.link_modal_bookmark}">\n\t\t\t\t\t\t${n.bookmark}\n\t\t\t\t\t\t${Ve.utils.createTooltipInner(i.link_modal_bookmark)}\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t<div class="se-anchor-preview-form">\n\t\t\t\t\t<span class="se-svg se-anchor-preview-icon _se_anchor_bookmark_icon">${n.bookmark}</span>\n\t\t\t\t\t<span class="se-svg se-anchor-preview-icon _se_anchor_download_icon">${n.download}</span>\n\t\t\t\t\t<pre class="se-link-preview"></pre>\n\t\t\t\t</div>\n\t\t\t\t<label ${o}>${i.link_modal_text}</label>\n\t\t\t\t<input class="se-input-form _se_display_text" type="text" ${o} />\n\t\t\t\t<label ${l}>${i.title}</label>\n\t\t\t\t<input class="se-input-form _se_title" type="text" ${l} />\n\t\t\t</div>\n\t\t\t<div class="se-modal-form-footer">\n\t\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_anchor_check" />&nbsp;${i.link_modal_newWindowCheck}</label>\n\t\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_anchor_download" />&nbsp;${i.link_modal_downloadLinkCheck}</label>`;s.length>0&&(r+=`\n\t\t\t<div class="se-anchor-rel">\n\t\t\t\t<button type="button" class="se-btn se-tooltip se-anchor-rel-btn" title="${i.link_modal_relAttribute}" aria-label="${i.link_modal_relAttribute}">\n\t\t\t\t\t${n.link_rel}\n\t\t\t\t\t${Ve.utils.createTooltipInner(i.link_modal_relAttribute)}\n\t\t\t\t</button>\n\t\t\t\t<div class="se-anchor-rel-wrapper"><pre class="se-link-preview se-anchor-rel-preview"></pre></div>\n\t\t\t</div>\n\t\t</div>`);return r+="</div></div>",Ve.utils.createElement("DIV",null,r)}(t,s,this.relList);if(this.host=(Tr.location.origin+Tr.location.pathname).replace(/\/$/,""),this.urlInput=i.querySelector(".se-input-url"),this.displayInput=i.querySelector("._se_display_text"),this.titleInput=i.querySelector("._se_title"),this.newWindowCheck=i.querySelector("._se_anchor_check"),this.downloadCheck=i.querySelector("._se_anchor_download"),this.download=i.querySelector("._se_anchor_download_icon"),this.preview=i.querySelector(".se-link-preview"),this.bookmark=i.querySelector("._se_anchor_bookmark_icon"),this.bookmarkButton=i.querySelector("._se_bookmark_button"),this.currentRel=[],this.currentTarget=null,this.linkValue="",this.#Nh=this.relList.length>0,this.#Nh){this.relButton=i.querySelector(".se-anchor-rel-btn"),this.relPreview=i.querySelector(".se-anchor-rel-preview");const e=this.relList,s=(this.defaultRel.default||"").split(" "),n=[];for(let t,i=0,o=e.length;i<o;i++)t=e[i],n.push(Ve.utils.createElement("BUTTON",{type:"button",class:"se-btn-list"+(s.includes(t)?" se-checked":""),"data-command":t,title:t,"aria-label":t},t+'<span class="se-svg">'+this.#J.icons.checked+"</span>"));this.#Ah=new Hi(t,{checkList:!0,position:"right-middle",dir:"ltr"}),this.#Ah.on(this.relButton,this.#Vh.bind(this)),this.#Ah.create(n),this.#J.eventManager.addEvent(this.relButton,"click",this.#Oh.bind(this))}this.#Lh=e,this.#Lh.querySelector(".se-anchor-editor").appendChild(i),this.#Bh=new Hi(t,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.#Bh.on(this.urlInput,this.#Rh.bind(this)),this.#J.eventManager.addEvent(this.newWindowCheck,"change",this.#Ph.bind(this)),this.#J.eventManager.addEvent(this.downloadCheck,"change",this.#zh.bind(this)),this.#J.eventManager.addEvent(this.urlInput,"input",this.#Dh.bind(this)),this.#J.eventManager.addEvent(this.urlInput,"focus",this.#Fh.bind(this)),this.#J.eventManager.addEvent(this.bookmarkButton,"click",this.#qh.bind(this)),this.#J.eventManager.addEvent(i.querySelector("._se_upload_button"),"click",(()=>this.input.click()))}set(t){this.currentTarget=t}on(t){if(t){if(this.currentTarget){const t=this.currentTarget.href;this.linkValue=this.preview.textContent=this.urlInput.value=this.#Wh(t)?t.substring(t.lastIndexOf("#")):t,this.displayInput.value=this.currentTarget.textContent,this.titleInput.value=this.currentTarget.title,this.newWindowCheck.checked=!!/_blank/i.test(this.currentTarget.target),this.downloadCheck.checked=!!this.currentTarget.download}}else this.init(),this.displayInput.value=this.#J.selection.get().toString().trim(),this.newWindowCheck.checked=this.openNewWindow,this.titleInput.value="";this.#Uh(t&&this.currentTarget?this.currentTarget.rel:this.defaultRel.default||""),this.#Zh(this.linkValue)}create(t,e){const s=this.linkValue||e||"";if(0===s.length)return null;const i=0===this.displayInput.value.length?s:this.displayInput.value,n=this.currentTarget||Ve.utils.createElement("A");return this.#Gh(n,s,i,this.titleInput.value,t),this.linkValue=this.preview.textContent=this.urlInput.value=this.displayInput.value="",n}init(){this.currentTarget=null,this.linkValue=this.preview.textContent=this.urlInput.value="",this.displayInput.value="",this.newWindowCheck.checked=!1,this.downloadCheck.checked=!1,this.#Uh(this.defaultRel.default||"")}#Gh(t,e,s,i,n){!this.#Wh(e)&&this.downloadCheck.checked?t.setAttribute("download",s||e):t.removeAttribute("download"),this.newWindowCheck.checked?t.target="_blank":t.removeAttribute("target");const o=this.currentRel.join(" ");o?t.rel=o:t.removeAttribute("rel"),t.href=e,i?t.title=i:t.removeAttribute("title"),n?0===t.children.length&&(t.textContent=""):t.textContent=s}#Wh(t){const e=Tr.location.href.replace(/\/$/,"");return 0===t.indexOf("#")||0===t.indexOf(e)&&t.indexOf("#")===(e.includes("#")?e.substring(0,e.indexOf("#")).length:e.length)}#Uh(t){if(!this.#Nh)return;const e=this.currentRel=t?t.split(" "):[],s=this.#Ah.form.querySelectorAll("button");for(let t,i=0,n=s.length;i<n;i++)t=s[i].getAttribute("data-command"),e.includes(t)?Ve.utils.addClass(s[i],"se-checked"):Ve.utils.removeClass(s[i],"se-checked");this.relPreview.title=this.relPreview.textContent=e.join(" "),e.length>0?Ve.utils.addClass(this.relButton,"on"):Ve.utils.removeClass(this.relButton,"on")}#jh(t){const e=Ve.query.getListChildren(this.#J.frameContext.get("wysiwyg"),(t=>/h[1-6]/i.test(t.nodeName)||Ve.check.isAnchor(t)&&!!t.id),null);if(0===e.length)return;const s=new RegExp(`^${t.replace(/^#/,"")}`,"i"),i=[],n=[];for(let t,o=0,l=e.length;o<l;o++)t=e[o],s.test(t.textContent)&&(i.push(t),n.push(Ve.check.isAnchor(t)?`<div><span class="se-text-prefix-icon">${this.#J.icons.bookmark_anchor}</span>${t.id}</div>`:`<div style="${t.style.cssText}">${t.textContent}</div>`));0===i.length?this.#Bh.close():(this.#Bh.create(i,n),this.#Bh.open(this.#J.options.get("_rtl")?"bottom-right":""))}#Zh(t){const e=this.preview,s=this.#J.options.get("defaultUrlProtocol"),i=this.noAutoPrefix,n=/^(mailto:|tel:|sms:|https*:\/\/|#)/.test(t)||0===t.indexOf(s),o=!!s&&RegExp("^"+Be.escapeStringRegexp(t.substring(0,s.length))).test(s);t=this.linkValue=e.textContent=t?i?t:!s||n||o?n?t:/^www\./.test(t)?"http://"+t:this.host+(/^\//.test(t)?"":"/")+t:s+t:"",this.#Wh(t)?(this.bookmark.style.display="block",Ve.utils.addClass(this.bookmarkButton,"active")):(this.bookmark.style.display="none",Ve.utils.removeClass(this.bookmarkButton,"active")),!this.#Wh(t)&&this.downloadCheck.checked?this.download.style.display="block":this.download.style.display="none"}#Kh(t){const e=this.currentRel;if(!t)return e.join(" ");if(/^only:/.test(t))return t=t.replace(/^only:/,"").trim(),this.currentRel=t.split(" "),t;const s=t.split(" ");for(let t=0,i=s.length;t<i;t++)e.includes(s[t])||e.push(s[t]);return e.join(" ")}#Yh(t){if(!t)return this.currentRel.join(" ");/^only:/.test(t)&&(t=t.replace(/^only:/,"").trim());const e=this.currentRel.join(" ").replace(RegExp(t+"\\s*"),"");return this.currentRel=e.split(" "),e}#Xh(t){const e=t.result[0];this.linkValue=this.preview.textContent=this.urlInput.value=e.url,this.displayInput.value=e.name,this.downloadCheck.checked=!0,this.download.style.display="block"}async#Jh(t){const e=await this.#J.eventManager.triggerEvent("onFileUploadError",{error:t});if(!1===e)return;const s=e===Mr?t.errorMessage:e||t.errorMessage;this.#J.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.fileUpload.error]",s)}#Qh(t){const e=JSON.parse(t.responseText);e.errorMessage?this.#Jh(e):this.#Xh(e)}async#Ih(t){const e=Ve.query.getEventTarget(t).files;if(!e[0])return;const s={url:this.uploadUrl,uploadHeaders:this.uploadHeaders,files:e},i=async function(t,e,s){e=s||e;t(await this.fileManager.asyncUpload(e.url,e.uploadHeaders,e.files))}.bind(this,this.#Qh.bind(this),s),n=await this.#J.eventManager.triggerEvent("onFileUploadBefore",{info:s,handler:i});return void 0===n||!1!==n&&(null!==n&&"object"==typeof n&&i(n),void(!0!==n&&n!==Mr||i(null)))}#Oh(){this.#Ah.open(this.#J.options.get("_rtl")?"left-middle":"")}#Rh(t){const e=t.id||"h_"+Math.random().toString().replace(/.+\./,"");t.id=e,this.urlInput.value="#"+e,this.#Zh(this.urlInput.value),this.#Bh.close(),this.urlInput.focus()}#Vh(t){const e=t.getAttribute("data-command");if(!e)return;const s=this.currentRel,i=s.indexOf(e);-1===i?s.push(e):s.splice(i,1),this.relPreview.title=this.relPreview.textContent=s.join(", ")}#Dh(t){const e=Ve.query.getEventTarget(t).value.trim();this.#Zh(e),this.#Wh(e)?this.#jh(e):this.#Bh.close()}#Fh(){const t=this.urlInput.value;this.#Wh(t)&&this.#jh(t)}#qh(){let t=this.urlInput.value;this.#Wh(t)?(t=t.substring(1),this.bookmark.style.display="none",Ve.utils.removeClass(this.bookmarkButton,"active")):(t="#"+t,this.bookmark.style.display="block",Ve.utils.addClass(this.bookmarkButton,"active"),this.downloadCheck.checked=!1,this.download.style.display="none",this.#jh(t)),this.urlInput.value=t,this.#Zh(t),this.urlInput.focus()}#Ph(t){if("string"!=typeof this.defaultRel.check_new_window)return;Ve.query.getEventTarget(t).checked?this.#Uh(this.#Kh(this.defaultRel.check_new_window)):this.#Uh(this.#Yh(this.defaultRel.check_new_window))}#zh(t){Ve.query.getEventTarget(t).checked?(this.download.style.display="block",this.bookmark.style.display="none",Ve.utils.removeClass(this.bookmarkButton,"active"),this.linkValue=this.preview.textContent=this.urlInput.value=this.urlInput.value.replace(/^#+/,""),"string"==typeof this.defaultRel.check_bookmark&&this.#Uh(this.#Kh(this.defaultRel.check_bookmark))):(this.download.style.display="none","string"==typeof this.defaultRel.check_bookmark&&this.#Uh(this.#Yh(this.defaultRel.check_bookmark)))}},Lr={init(t){return{create:(e,s)=>this.create(e,s,t)}},create(t,e,s){if("object"!=typeof e&&(e={}),s&&(e=[s,e].reduce(((t,e)=>(Object.entries(e).forEach((([e,s])=>{if("plugins"===e&&s&&t[e]){const i=Array.isArray(t[e])?t[e]:Object.values(t[e]),n=Array.isArray(s)?s:Object.values(s);t[e]=[...n.filter((t=>!i.includes(t))),...i]}else t[e]=s})),t)),{})),!t)throw Error('[SUNEDITOR.create.fail] The first parameter "target" is missing.');const i=[];if("string"==typeof t){const e=document.querySelector(t);if(!e)throw Error(`[SUNEDITOR.create.fail]-[document.querySelector(${t})] Cannot find target element. Make sure "${t}" is a valid selector and exists in the document.`);i.push({key:null,target:e})}else if(1===t.nodeType)i.push({key:null,target:t});else{let e;for(const s in t){if(e=t[s],!e.target||1!==e.target.nodeType)throw Error('[SUNEDITOR.create.fail] suneditor multi root requires textarea\'s element at the "target" property.');e.key=s,i.push(e)}}return new Ll(i,e)}};class Nr extends zn{static type="";static key="";static className="";static options={};constructor(t){super(t),this.title="",this.icon="",this.inner=null,this.beforeItem=null,this.afterItem=null,this.replaceButton=null}}class Ar extends Nr{static type="browser";open(t){throw new Error(`[${this.constructor.name}] Abstract method 'open()' must be implemented`)}close(){throw new Error(`[${this.constructor.name}] Abstract method 'close()' must be implemented`)}}class Br extends Nr{static type="command";action(t){throw new Error(`[${this.constructor.name}] Abstract method 'action()' must be implemented`)}}class Ir extends Nr{static type="dropdown";on(t){}action(t){throw new Error(`[${this.constructor.name}] Abstract method 'action()' must be implemented`)}}class Vr extends Nr{static type="dropdown-free";on(t){}off(){}}class Or extends Nr{static type="field"}class Rr extends Nr{static type="input";toolbarInputKeyDown(t){}toolbarInputChange(t){}}class Pr extends Nr{static type="modal";open(t){throw new Error(`[${this.constructor.name}] Abstract method 'open()' must be implemented`)}}class zr extends Nr{static type="popup";show(){throw new Error(`[${this.constructor.name}] Abstract method 'show()' must be implemented`)}}const Dr=class extends Br{static key="blockquote";static className="";constructor(t){super(t),this.title=this.$.lang.tag_blockquote,this.icon="blockquote",this.quoteTag=Ve.utils.createElement("BLOCKQUOTE")}active(t,e){return/blockquote/i.test(t?.nodeName)?(Ve.utils.addClass(e,"active"),!0):(Ve.utils.removeClass(e,"active"),!1)}action(){const t=Ve.query.getParentElement(this.$.selection.getNode(),"blockquote");t?this.$.format.removeBlock(t,{selectedFormats:null,newBlockElement:null,shouldDelete:!1,skipHistory:!1}):this.$.format.applyBlock(this.quoteTag.cloneNode(!1))}},Fr=["javascript","typescript","html","css","json","python","java","c","cpp","csharp","go","rust","ruby","php","swift","kotlin","sql","bash","markdown","xml","yaml"];class qr extends Br{static key="codeBlock";static className="";#tc;#ec;#sc;#ic;#nc;#oc;#lc;#rc;#ac;constructor(t,e){if(super(t),this.title=this.$.lang.codeBlock||"Code Block",this.icon="code_block",this.#tc=Ve.utils.createElement("PRE"),this.#sc=e?.langs??Fr,!this.#sc.length)return;this.afterItem=Ve.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn",type:"button","data-command":qr.key,"data-type":"dropdown"},`${this.$.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.codeLanguage||"Language"}</span></span>`);const s=function(t,e){const s=t.lang.codeLanguage_none||"None";let i='<div class="se-list-inner"><ul class="se-list-basic">';i+=`<li><button type="button" class="se-btn se-btn-list" data-command="codeBlock" data-value="" title="${s}">${s}</button></li>`;for(const t of e)i+=`<li><button type="button" class="se-btn se-btn-list" data-command="codeBlock" data-value="${t}" title="${t}">${t}</button></li>`;return i+="</ul></div>",Ve.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-code-block"},i)}(this.$,this.#sc);this.#ec=s.querySelectorAll("li button"),this.$.menu.initDropdownTarget({key:qr.key,type:"dropdown"},s);const i=Ve.utils.createElement("DIV",{class:"se-controller se-code-lang"});this.#ic=Ve.utils.createElement("DIV",{class:"se-code-lang-button"}),this.#hc(""),i.appendChild(this.#ic),this.#oc=new Ti(this,this.$,i,{position:"top",isWWTarget:!0}),this.#ac=Ie.debounce((t=>{this.#rc=this.$.eventManager.removeEvent(this.#rc),t&&i.contains(t.relatedTarget)?this.#cc():this.#dc()}),0),this.#nc=new Hi(this.$,{position:"bottom-right",dir:this.$.options.get("_rtl")?"rtl":"ltr",maxHeight:"214px",minWidth:"132px",closeMethod:this.#ac}),this.#nc.on(this.#ic,this.#uc.bind(this)),this.#pc(""),this.$.eventManager.addEvent(this.#ic,"click",(t=>{if(t.preventDefault(),t.stopPropagation(),this.#nc.isOpen)this.#nc.close();else{const t=this.#gc(this.#lc);this.#pc(t);const e=this.#nc.items,s=t?e.indexOf(t):0;this.#nc.open(null,s>=0?`[data-index="${s}"]`:null)}}))}onMouseMove({event:t}){if(!this.#oc)return;const e=Ve.query.getEventTarget(t).closest("pre");e&&!this.#mc()&&0===this.$.ui.opendControllers.length&&this.#fc(e)}active(t,e){return/^PRE$/i.test(t?.nodeName)?(Ve.utils.addClass(e,"active"),!0):(Ve.utils.removeClass(e,"active"),!1)}action(t){const e=t?.getAttribute("data-value")||"",s=this.$.selection.getNode(),i=Ve.query.getParentElement(s,(t=>/^PRE$/i.test(t.nodeName)));if(i&&!e)this.$.format.setLine(Ve.utils.createElement(this.$.options.get("defaultLine")));else if(i||this.$.format.setBrLine(this.#tc.cloneNode(!1)),e){const t=Ve.query.getParentElement(this.$.selection.getNode(),(t=>/^PRE$/i.test(t.nodeName)));t&&this.#vc(t,e)}this.$.menu.dropdownOff(),this.$.focusManager.focus(),this.$.history.push(!1)}on(){if(!this.#ec)return;const t=this.#gc(this.$.selection.getNode());for(let e=0,s=this.#ec.length;e<s;e++){const s=this.#ec[e];Ve.utils.toggleClass(s,"active",s.getAttribute("data-value")===t)}}#fc(t){this.#lc===t&&this.#oc.isOpen||(this.#lc&&this.#lc!==t&&Ve.utils.removeClass(this.#lc,"se-pre-code-focus"),this.#lc=t,Ve.utils.addClass(t,"se-pre-code-focus"),this.#oc.open(t,null,{passive:!0,addOffset:{right:t.offsetWidth}}),this.#hc(this.#gc(t)),this.#bc())}#dc(){this.#nc?.isOpen||this.#yc()}#yc(){this.#nc?.isOpen&&this.#nc.close(),Ve.utils.removeClass(this.#lc,"se-pre-code-focus"),this.#oc.close(!0)}controllerClose(){this.#lc&&(Ve.utils.removeClass(this.#lc,"se-pre-code-focus"),this.#lc=null)}#uc(t){this.#lc&&(this.#vc(this.#lc,t),this.#hc(t),this.#nc.close(),this.#dc(),this.$.focusManager.focus(),this.$.history.push(!1))}#bc(){this.#rc??=this.$.eventManager.addEvent(this.#lc,"mouseleave",this.#ac)}#cc(){this.#rc??=this.$.eventManager.addEvent(this.#oc.form,"mouseleave",this.#ac)}#pc(t){const e=this.$.lang.codeLanguage_none||"None",s=t&&!this.#sc.includes(t),i=s?["",t,...this.#sc]:["",...this.#sc],n=s?[e,t,...this.#sc]:[e,...this.#sc];this.#nc.create(i,n)}#hc(t){this.#ic.innerHTML=`<span class="se-code-lang-icon">&lt;/&gt;</span><span class="se-code-lang-text">${t||this.$.lang.codeLanguage||"Language"}</span>`}#mc(){return this.#nc?.isOpen||this.#oc?.isOpen}#gc(t){const e="PRE"===t?.nodeName?t:Ve.query.getParentElement(t,(t=>/^PRE$/i.test(t.nodeName)));return e&&e.className.match(/language-(\S+)/)?.[1]||""}#vc(t,e){t.className=t.className.replace(/\s*language-\S+/g,"").trim(),e?(Ve.utils.addClass(t,"language-"+e),t.setAttribute("data-se-lang",e)):t.removeAttribute("data-se-lang")}destroy(){this.#lc&&Ve.utils.removeClass(this.#lc,"se-pre-code-focus"),this.#oc?.form?.parentNode?.removeChild(this.#oc.form),this.#lc=null}}const Wr=qr,{_w:Ur,_d:Zr}=Ae;const Gr=class extends Br{static key="exportPDF";static className="se-component-enabled";constructor(t,e){super(t),this.title=this.$.lang.exportPDF,this.icon="PDF",this.apiUrl=e.apiUrl,this.fileName=e.fileName||"suneditor-pdf",this.apiUrl?this.apiManager=new Al(this,this.$,{method:"POST",url:this.apiUrl,headers:{"Content-Type":"application/json"},responseType:"blob"}):console.warn('[SUNEDITOR.plugins.exportPDF.error] Requires exportPDF."apiUrl" options.')}async action(){if(!this.apiUrl)return void console.warn('[SUNEDITOR.plugins.exportPDF.error] Requires exportPDF."apiUrl" options.');this.$.ui.showLoading();let t=null;try{const e=this.$.frameContext.get("documentTypePageMirror")||this.$.frameContext.get("wysiwygFrame"),s=(this.$.options.get("_themeClass")||"").trim(),i=s?e.className.replace(s,"").trim():e.className,n=Ve.utils.createElement("div",{class:i},e.innerHTML);t=Ve.utils.createElement("div",{style:"position: absolute; top: -10000px; left: -10000px; width: 21cm; columns: 21cm; height: auto;"},n);const o=Ur.getComputedStyle(e).padding,l=Ve.utils.applyInlineStylesAll(n,!0,this.$.options.get("allUsedStyles"));if(l.style.padding=l.style.paddingTop=l.style.paddingBottom=l.style.paddingLeft=l.style.paddingRight="0",t.innerHTML=`\n\t\t\t\t<style>\n\t\t\t\t\t@page {\n\t\t\t\t\t\tsize: A4;\n\t\t\t\t\t\tmargin: ${o};\n\t\t\t\t\t}\n\t\t\t\t</style>\n\t\t\t\t${l.outerHTML}`,Zr.body.appendChild(t),!1===await this.$.eventManager.triggerEvent("onExportPDFBefore",{target:t}))return;return void await this.#Cc(t)}catch(t){console.error("[SUNEDITOR.plugins.exportPDF.error]",t.message)}finally{Ve.utils.removeItem(t),this.$.ui.hideLoading()}}async#Cc(t){const e={fileName:this.fileName,htmlContent:t.innerHTML},s=await this.apiManager.asyncCall({data:JSON.stringify(e)});if(200!==s.status){let t;try{t=JSON.parse(s.responseText).errorMessage}catch{}throw Error(`[SUNEDITOR.plugins.exportPDF.error] ${t||s.statusText}`)}const i=new Blob([s.response],{type:"application/pdf"}),n=s.getResponseHeader("Content-Disposition"),o=URL.createObjectURL(i),l=(n.match(/filename="([^"]+)/)||[])[1]||this.fileName+".pdf",r=Ve.utils.createElement("A",{href:o,download:l,style:"display: none;"},null);try{Zr.body.appendChild(r),r.click()}finally{Ur.setTimeout((()=>{Ve.utils.removeItem(r),URL.revokeObjectURL(o)}),100)}}},{NO_EVENT:jr}=Ae;class Kr extends Br{static key="fileUpload";static className="";static options={eventIndex:1e4};static component(t){return Ve.check.isAnchor(t)&&t.hasAttribute("data-se-file-download")?t:null}#wc;#_c=null;constructor(t,e){super(t),this.title=this.$.lang.fileUpload,this.icon="file_upload",e.uploadUrl||console.warn('[SUNEDITOR.fileUpload.warn] "fileUpload" plugin must be have "uploadUrl" option.'),this.uploadUrl=e.uploadUrl,this.uploadHeaders=e.uploadHeaders,this.uploadSizeLimit=Oe.get(e.uploadSizeLimit,0),this.uploadSingleSizeLimit=Oe.get(e.uploadSingleSizeLimit,0),this.allowMultiple=!!e.allowMultiple,this.acceptedFormats="string"!=typeof e.acceptedFormats?"*":e.acceptedFormats.trim()||"*",this.as=e.as||"box",this.insertBehavior=e.insertBehavior,this.input=Ve.utils.createElement("input",{type:"file",accept:this.acceptedFormats}),this.allowMultiple&&this.input.setAttribute("multiple","multiple"),this.#wc=this.acceptedFormats.split(", ");const s={"custom-download":{command:"download",title:this.$.lang.download,icon:"download",action:t=>{const e=t.getAttribute("href");e&&Ve.utils.createElement("A",{href:e},null).click()}},"custom-as":{command:"as",value:"link",title:this.$.lang.asLink,icon:"reduction",action:(t,e)=>{this.convertFormat(t,e)}}},i=(e.controls||[["custom-as","align","edit","custom-download","copy","remove"]]).map((t=>t.map((t=>t.startsWith("custom-")?s[t]:t))));if(this.figure=new Fi(this,this.$,i,{}),this.fileManager=new Er(this,this.$,{query:"a[download][data-se-file-download]",loadEventName:"onFileLoad",actionEventName:"onFileAction"}),/\bedit\b/.test(JSON.stringify(i))){const t=function({lang:t,icons:e}){const s=`\n\t\t<div class="se-arrow se-arrow-up"></div>\n\t\t<form>\n\t\t\t<div class="se-btn-group se-form-group">\n\t\t\t\t<input type="text" />\n\t\t\t\t<button type="submit" data-command="edit" class="se-btn se-tooltip se-btn-success">\n\t\t\t\t\t${e.checked}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.save}</span></span>\n\t\t\t\t</button>\n\t\t\t\t<button type="button" data-command="cancel" class="se-btn se-tooltip se-btn-danger">\n\t\t\t\t\t${e.cancel}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.cancel}</span></span>\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</form>\n\t\t`;return Ve.utils.createElement("DIV",{class:"se-controller se-controller-simple-input"},s)}(this.$);this.controller=new Ti(this,this.$,t,{position:"bottom",disabled:!0},Kr.key),this.editInput=t.querySelector("input")}this.$.eventManager.addEvent(this.input,"change",this.#Ih.bind(this))}action(){this.$.store.set("_preventBlur",!0),this.input.click()}onFilePasteAndDrop({file:t}){const e=t.type;this.#wc.some((t=>!!t.startsWith("*")||(!!t.startsWith(e)||void 0)))&&(this.submitFile([t]),this.$.focusManager.focus())}controllerAction(t){const e=t.getAttribute("data-command");if(e){if("edit"===e){if(0===this.editInput.value.trim().length)return;this.#_c.textContent=this.editInput.value}this.controller.close(),this.$.component.select(this.#_c,Kr.key)}}componentSelect(t){this.#_c=t;const e=this.figure.controller.form.querySelector('[data-command="__c__as"]');if(e)return Ve.check.isFigure(t.parentElement)?(e.innerHTML=this.$.icons.reduction+Ve.utils.createTooltipInner(this.$.lang.asLink),e.setAttribute("data-value","link"),void this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,infoOnly:!1})):(e.innerHTML=this.$.icons.expansion+Ve.utils.createTooltipInner(this.$.lang.asBlock),e.setAttribute("data-value","box"),this.figure.controllerOpen(t,{isWWTarget:!0}),!0)}componentEdit(t){this.editInput.value=t.textContent,this.figure.controllerHide(),this.controller.open(t,null,{isWWTarget:!Ve.check.isFigure(t.parentElement),initMethod:null,addOffset:null}),this.editInput.focus()}async componentDestroy(t){if(!t)return;const e=Fi.GetContainer(t),s=Ve.query.getParentElement(t,".se-component")||t;if(!1===await this.$.eventManager.triggerEvent("onFileDeleteBefore",{element:e.target,container:e,url:e.target.getAttribute("href")}))return;const i=this.$.component.isInline(s)?s.previousSibling||s.nextSibling:s.previousElementSibling||s.nextElementSibling;Ve.utils.removeItem(s),this.$.ui.offCurrentController(),this.$.focusManager.focusEdge(i),this.$.history.push(!1)}async submitFile(t){if(0===t.length)return;let e=0;const s=[],i=this.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++){if(n=t[l],o=n.size,i>0&&o>i){const t="[SUNEDITOR.fileUpload.fail] Size of uploadable single file: "+i/1e3+"KB",e=await this.$.eventManager.triggerEvent("onFileUploadError",{error:t,limitSize:i,uploadSize:o,file:n});return this.$.ui.alertOpen(e===jr?t:e||t,"error"),!1}s.push(n),e+=o}const n=this.uploadSizeLimit,o=this.fileManager.getSize();if(n>0&&e+o>n){const t="[SUNEDITOR.fileUpload.fail] Size of uploadable total files: "+n/1e3+"KB",s=await this.$.eventManager.triggerEvent("onFileUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.$.ui.alertOpen(s===jr?t:s||t,"error"),!1}const l={url:this.uploadUrl,uploadHeaders:this.uploadHeaders,files:s},r=async function(t,e,s){e=s||e;t(await this.fileManager.asyncUpload(e.url,e.uploadHeaders,e.files))}.bind(this,this.#Qh.bind(this),l),a=await this.$.eventManager.triggerEvent("onFileUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==jr||r(null)))}convertFormat(t,e){if("link"===e){this.figure.close();const{container:e}=Fi.GetContainer(t),s=e.nextElementSibling,i=e.parentElement;t.removeAttribute("data-se-non-focus"),t.setAttribute("contenteditable","false"),Ve.utils.addClass(t,"se-component|se-inline-component");const n=Ve.utils.createElement(this.$.options.get("defaultLine"),null,t);i.insertBefore(n,s),Ve.utils.removeItem(e)}else{this.$.selection.setRange(t,0,t,1);const e=this.$.html.remove(),s=this.$.nodeTransform.split(e.container,e.offset,0);s?.previousElementSibling&&Ve.check.isZeroWidth(s.previousElementSibling)&&Ve.utils.removeItem(s.previousElementSibling),t.setAttribute("data-se-non-focus","true"),t.removeAttribute("contenteditable"),Ve.utils.removeClass(t,"se-component|se-component-selected|se-inline-component");const i=Fi.CreateContainer(t,"se-file-figure se-flex-component");(s||e.container).parentElement.insertBefore(i.container,s)}this.$.history.push(!1),this.$.component.select(t,Kr.key)}create(t,e,s){const i=e.name||t,n=Ve.utils.createElement("A",{href:t,title:i,download:i,"data-se-file-download":"",contenteditable:"false","data-se-non-focus":"true","data-se-non-link":"true"},i);if(this.fileManager.setFileData(n,e),"link"===this.as)return n.className="se-component se-inline-component",void this.$.component.insert(n,{scrollTo:!!s,insertBehavior:s?this.insertBehavior:null});const o=Fi.CreateContainer(n);if(Ve.utils.addClass(o.container,"se-file-figure|se-flex-component"),this.$.component.insert(o.container,{scrollTo:!!s,insertBehavior:s?this.insertBehavior:null})){if(s)if(this.$.options.get("componentInsertBehavior"))this.$.component.select(n,Kr.key);else{const t=this.$.format.addLine(o.container,null);t&&this.$.selection.setRange(t,0,t,0)}}else this.$.focusManager.focus()}#Xh(t){t.result.forEach(((t,e,s)=>{this.create(t.url,{name:t.name,size:t.size},e===s.length-1)}))}async#Jh(t){const e=await this.$.eventManager.triggerEvent("onFileUploadError",{error:t});if(!1===e)return;const s=e===jr?t.errorMessage:e||t.errorMessage;this.$.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.fileUpload.error]",s)}#Qh(t){const e=JSON.parse(t.responseText);e.errorMessage?this.#Jh(e):this.#Xh(e)}async#Ih(t){const e=Ve.query.getEventTarget(t);await this.submitFile(e.files)}}const Yr=Kr;class Xr extends Br{static key="list_bulleted";static className="se-icon-flip-rtl";#xc;constructor(t){super(t),this.title=this.$.lang.bulletedList,this.icon="list_bulleted",this.afterItem=Ve.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn",type:"button","data-command":Xr.key,"data-type":"dropdown"},`${this.$.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.bulletedList}</span></span>`);const e=function(){const t=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic se-list-horizontal se-list-carrier">\n\t\t\t${e=["disc","circle","square"],e.map((t=>`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-icon-flip-rtl" data-command="${t}" title="${t}" aria-label="${t}">\n\t\t\t\t\t<ul style="list-style-type: ${t};">\n\t\t\t\t\t\t<li></li><li></li><li></li>\n\t\t\t\t\t</ul>\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t`)).join("")}\n\t\t</ul>\n\t</div>`;var e;return Ve.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.#xc=e.querySelectorAll("li button ul"),this.$.menu.initDropdownTarget({key:Xr.key,type:"dropdown"},e)}active(t,e){return Ve.check.isListCell(t)&&/^UL$/i.test(t.parentElement.nodeName)?(Ve.utils.addClass(e,"active"),!0):(Ve.utils.removeClass(e,"active"),!1)}action(t){const e=this.$.format.getBlock(this.$.selection.getNode()),s=t?.querySelector("ul")?.style.listStyleType;Ve.check.isList(e)&&s?e.style.listStyleType=s:this.submit(s),this.$.menu.dropdownOff()}on(){const t=this.#xc,e=this.$.format.getBlock(this.$.selection.getNode()),s=e?.style?e.style.listStyleType||"disc":"";for(let e,i=0,n=t.length;i<n;i++)e=t[i],s===e.style.listStyleType?Ve.utils.addClass(e.parentElement,"active"):Ve.utils.removeClass(e.parentElement,"active")}shortcut({range:t,info:e}){const{startContainer:s}=t;if(Ve.check.isText(s)){const t=s.substringData(e.key.length,s.textContent.length-1);s.textContent=t}this.submit()}submit(t){const e=this.$.listFormat.apply(`ul:${t||""}`,null,!1);e&&this.$.selection.setRange(e.sc,e.so,e.ec,e.eo),this.$.focusManager.focus(),this.$.history.push(!1)}}const Jr=Xr;class Qr extends Br{static key="list_numbered";static className="se-icon-flip-rtl";#xc;constructor(t){super(t),this.title=this.$.lang.numberedList,this.icon="list_numbered",this.afterItem=Ve.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn",type:"button","data-command":Qr.key,"data-type":"dropdown"},`${this.$.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.numberedList}</span></span>`);const e=function(){const t=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic se-list-horizontal se-list-carrier">\n\t\t\t${ta(["decimal","upper-roman","lower-roman"])}\n\t\t</ul>\n\t\t<ul class="se-list-basic se-list-horizontal se-list-carrier">\n\t\t${ta(["lower-latin","upper-latin","lower-greek"])}\n\t\t</ul>\n\t</div>`;return Ve.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.#xc=e.querySelectorAll("li button ol"),this.$.menu.initDropdownTarget({key:Qr.key,type:"dropdown"},e)}active(t,e){return Ve.check.isListCell(t)&&/^OL$/i.test(t.parentElement.nodeName)?(Ve.utils.addClass(e,"active"),!0):(Ve.utils.removeClass(e,"active"),!1)}action(t){const e=this.$.format.getBlock(this.$.selection.getNode()),s=t?.querySelector("ol")?.style.listStyleType;Ve.check.isList(e)&&s?e.style.listStyleType=s:this.submit(s),this.$.menu.dropdownOff()}on(){const t=this.#xc,e=this.$.format.getBlock(this.$.selection.getNode()),s=e?.style?e.style.listStyleType||"decimal":"";for(let e,i=0,n=t.length;i<n;i++)e=t[i],s===e.style.listStyleType?Ve.utils.addClass(e.parentElement,"active"):Ve.utils.removeClass(e.parentElement,"active")}shortcut({range:t,info:e}){const{startContainer:s}=t;if(Ve.check.isText(s)){const t=s.substringData(e.key.length,s.textContent.length-1);s.textContent=t}this.submit()}submit(t){const e=this.$.listFormat.apply(`ol:${t||""}`,null,!1);e&&this.$.selection.setRange(e.sc,e.so,e.ec,e.eo),this.$.focusManager.focus(),this.$.history.push(!1)}}function ta(t){return t.map((t=>`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-icon-flip-rtl" data-command="${t}" title="${t}" aria-label="${t}">\n\t\t\t\t\t<ol style="list-style-type: ${t};">\n\t\t\t\t\t\t<li></li><li></li><li></li>\n\t\t\t\t\t</ol>\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t`)).join("")}const ea=Qr,{debounce:sa}=Ie;function ia(t){return`<div class="se-autocomplete-item"><span>${t.key}</span>${t.name?`<span>${t.name}</span>`:""}</div>`}function na(t,e){return{tag:"span",attrs:{"data-se-autocomplete":e+t.key},text:e+t.key}}const oa=class extends Or{static key="autocomplete";static className="";#$c=0;#kc=0;#Sc=null;#Ec=null;constructor(t,e){super(t);const s=e.limitSize||5,i=e.searchStartLength||0,n="number"==typeof e.delayTime?e.delayTime:120,o=e.useCachingData??!0,l=e.useCachingFieldData??!0;this.triggerContexts=new Map;const r=e.triggers||{};for(const[t,e]of Object.entries(r)){const n=e.limitSize??s;this.triggerContexts.set(t,{trigger:t,limitSize:n,searchStartLength:e.searchStartLength??i,directData:e.data||null,apiUrl:e.apiUrl?.replace(/\s/g,"").replace(/\{limitSize\}/i,String(n))||"",apiHeaders:e.apiHeaders||null,transformResponse:e.transformResponse||null,renderItem:e.renderItem||ia,onSelect:e.onSelect||na,apiManager:e.apiUrl?new Al(this,this.$,{headers:e.apiHeaders}):null,cachingData:e.useCachingData??o?new Map:null,cachingFieldData:e.useCachingFieldData??l?[]:null})}this.sortedTriggers=[...this.triggerContexts.keys()].sort(((t,e)=>e.length-t.length));const a=Ve.utils.createElement("DIV",{class:"se-controller se-empty-controller"},"<div></div>");this.selectMenu=new Hi(this.$,{position:"right-bottom",dir:"ltr",closeMethod:()=>this.controller.close()}),this.controller=new Ti(this,this.$,a,{position:"bottom",initMethod:()=>{this.#Tc(),this.selectMenu.close()}},null),this.selectMenu.on(a.firstElementChild,this.#Mc.bind(this)),this.onInput=sa(this.onInput.bind(this),n)}#Tc(){this.#Ec?.apiManager&&this.#Ec.apiManager.cancel()}async onInput(){this.#Tc();const t=this.$.selection.get();if(!t.rangeCount)return void this.selectMenu.close();const e=t.anchorNode,s=t.anchorOffset,i=e.textContent.substring(0,s);for(const t of this.sortedTriggers){const n=i.lastIndexOf(t);if(-1===n)continue;const o=i.substring(n+t.length,s),l=i[n-1]?.trim();if(!/\s/.test(o)&&(!l||Ve.check.isZeroWidth(l))){const i=this.triggerContexts.get(t);if(o.length<i.searchStartLength)return;const l=e.parentNode;if(Ve.check.isAnchor(l)&&!l.getAttribute("data-se-autocomplete"))return;try{return this.#Ec=i,await this.#Hc(i,o,e),this.#$c=n,this.#Sc=e,void(this.#kc=s)}catch(t){console.warn("[SUNEDITOR.autocomplete.api] ",t)}}}this.selectMenu.close()}async#Hc(t,e,s){const i=t.limitSize,n=e.toLowerCase();let o=null;if(t.cachingData&&(o=t.cachingData.get(e)),!o)if(t.directData)o=t.directData.filter((t=>t.key.toLowerCase().startsWith(n))).slice(0,i);else{const s=await t.apiManager.asyncCall({method:"GET",url:this.#Lc(t,e)}),i=JSON.parse(s.responseText);o=t.transformResponse?t.transformResponse(i,s):i}if(t.cachingFieldData){const e=new Set;o=t.cachingFieldData.concat(o).filter((({key:t})=>!e.has(t)&&(e.add(t),t.toLowerCase().startsWith(n)))).slice(0,i)}if(!o?.length)return this.selectMenu.close(),!1;const l=[],r=[];for(let e,s=0,i=o.length;s<i;s++)e=o[s],l.push(e),r.push(t.renderItem(e,t.trigger));return this.controller.open(s,null,{isWWTarget:!0,initMethod:null,addOffset:null}),this.selectMenu.create(l,r),this.selectMenu.open(),this.selectMenu.setItem(0),t.cachingData&&t.cachingData.set(e,l),!0}#Lc(t,e){return t.apiUrl.replace(/\{key\}/i,e)}#Mc(t){if(!t)return!1;const e=this.#Ec;if(!e)return!1;const s=e.onSelect(t,e.trigger);let i=null;const n=this.#Sc.parentNode;if("string"==typeof s){if(this.$.selection.setRange(this.#Sc,this.#$c,this.#Sc,this.#kc),i=Ve.utils.createTextNode(s),!this.$.html.insertNode(i,{afterNode:null,skipCharCount:!1}))return!1}else{let t;if(s?.nodeType)t=s;else{if(!s?.tag)return!1;t=Ve.utils.createElement(s.tag.toUpperCase(),s.attrs||{},s.text||"")}if(n.getAttribute?.("data-se-autocomplete")){for(const t of[...n.attributes])n.removeAttribute(t.name);for(const e of[...t.attributes])n.setAttribute(e.name,e.value);n.textContent=t.textContent,i=n}else{if(this.$.selection.setRange(this.#Sc,this.#$c,this.#Sc,this.#kc),!this.$.html.insertNode(t,{afterNode:null,skipCharCount:!1}))return!1;i=t}}this.selectMenu.close();const o=Ve.utils.createTextNode(" ");i.parentNode.insertBefore(o,i.nextSibling),this.$.selection.setRange(o,1,o,1),e.cachingFieldData&&!e.cachingFieldData.some((e=>e.key===t.key))&&e.cachingFieldData.push(t)}},{debounce:la}=Ie;const ra=class extends Or{static key="slashCommand";static className="";#Nc;#Ac;#Bc;#qr;#$c=0;#kc=0;#Sc=null;#Ic=!1;constructor(t,e){super(t),this.#Nc="string"==typeof e.triggerChar&&e.triggerChar.length>0?e.triggerChar:"/",this.#Ac="number"==typeof e.limitSize&&e.limitSize>0?e.limitSize:10,this.#Bc="string"==typeof e.emptyMessage?e.emptyMessage:"";const s="number"==typeof e.delayTime?e.delayTime:120;this.#qr=new hn(this,this.$,{items:Array.isArray(e.items)?e.items:[],resolveButton:hs,renderCustomItem:"function"==typeof e.renderItem?e.renderItem:null,selectMenuParams:{position:"bottom-left",dir:"ltr",minWidth:"200px",maxHeight:"320px",closeMethod:()=>this.#Vc()}});const i=Ve.utils.createElement("DIV",{class:"se-controller se-empty-controller"},"<div></div>");this.controller=new Ti(this,this.$,i,{position:"bottom",escGuard:()=>this.#qr.hasOpenSubPanel()},null),this.#qr.attach(i.firstElementChild,this.#Mc.bind(this),{class:"se-block-action-menu se-slash-command-menu"}),this.onInput=la(this.onInput.bind(this),s)}onKeyDown({event:t}){Re.isEsc(t.code)&&this.onInput.cancel?.()}onInput(){if(0===this.#qr.getItems().length)return;const t=this.$.selection.get();if(!t.rangeCount)return void this.#Oc();const e=t.anchorNode,s=t.anchorOffset;if(!e||"string"!=typeof e.textContent)return void this.#Oc();const i=e.textContent.substring(0,s),n=this.#Nc,o=i.lastIndexOf(n);if(-1===o)return void this.#Oc();const l=i.substring(o+n.length,s);if(/\s/.test(l))return void this.#Oc();const r=i[o-1];if(r&&""!==r.trim()&&!Ve.check.isZeroWidth(r))return void this.#Oc();const a=this.#qr.filter(l,this.#Ac);0!==a.length?(this.controller.open(e,null,{isWWTarget:!0,initMethod:null,addOffset:null}),this.#qr.createRows(a),this.#qr.open(),this.#qr.setItem(0),this.#Rc(e,o,s)):this.#Bc?(this.#Pc(e),this.#Rc(e,o,s)):this.#Oc()}#Oc(){this.#Ic=!0,this.#qr.close(),this.#Ic=!1}#Vc(){this.#Ic||this.#zc(),this.#Sc=null,this.controller.close()}#zc(){const t=this.#Sc;if(!t||!t.parentNode)return;if(t.textContent?.[this.#$c]!==this.#Nc)return;this.$.selection.setRange(t,this.#$c,t,this.#kc);const e=this.$.selection.getRange();e&&!e.collapsed&&this.$.html.remove()}#Rc(t,e,s){this.#Sc=t,this.#$c=e,this.#kc=s}#Pc(t){this.controller.open(t,null,{isWWTarget:!0,initMethod:null,addOffset:null}),this.#qr.selectMenu.create([null],[`<span class="se-slash-empty">${this.#Bc}</span>`]),this.#qr.open()}#Mc(t){if(!t)return!1;const e=this.#Sc;if(!e)return!1;const s=this.#Nc,i=e.textContent.substring(this.#$c+s.length,this.#kc);this.$.selection.setRange(e,this.#$c,e,this.#kc);const n=this.$.selection.getRange();n&&!n.collapsed&&this.$.html.remove(),this.#Oc(),this.#qr.dispatch(t,{triggerChar:s,query:i,item:t.raw})}};class aa extends Ir{static key="align";static className="";constructor(t,e){super(t),this.title=this.$.lang.align,this.icon=this.$.options.get("_rtl")?"align_right":"align_left",this.defaultDir="",this.alignIcons={justify:this.$.icons.align_justify,left:this.$.icons.align_left,right:this.$.icons.align_right,center:this.$.icons.align_center};const s=this.$.menu.initDropdownTarget(aa,function({lang:t,icons:e,options:s},i){return(Array.isArray(i)?i:s.get("_rtl")?["right","center","left","justify"]:["left","center","right","justify"]).map((s=>{const i=t["align"+s.charAt(0).toUpperCase()+s.slice(1)];return{command:s,title:i,innerHTML:`<span class="se-list-icon">${e["align_"+s]}</span>${i}`}}))}(this.$,e.items),{className:"se-list-align"});this._itemMenu=s.querySelector("ul"),this.alignList=s.querySelectorAll("li button")}active(t,e){const s=e.firstElementChild;if(t){if(this.$.format.isLine(t)){const i=t.style.textAlign;return i?(Ve.utils.changeElement(s,this.alignIcons[i]||this.alignIcons[this.defaultDir]),e.setAttribute("data-focus",i),!0):void 0}}else Ve.utils.changeElement(s,this.alignIcons[this.defaultDir]),e.removeAttribute("data-focus");return!1}on(t){const e=t.getAttribute("data-focus")||this.defaultDir;if(!e)return;const s=this.alignList;for(let t=0,i=s.length;t<i;t++)e===s[t].getAttribute("data-command")?Ve.utils.addClass(s[t],"active"):Ve.utils.removeClass(s[t],"active")}action(t){const e=t.getAttribute("data-command");if(!e)return;const s=this.defaultDir,i=this.$.format.getLines();for(let t=0,n=i.length;t<n;t++)Ve.utils.setStyle(i[t],"textAlign",e===s?"":e);this.$.store.set("_lastSelectionNode",null),this.$.menu.dropdownOff(),this.$.focusManager.focus(),this.$.history.push(!1)}setDir(){const t=this.#Dc();if(this.defaultDir===t)return;this.defaultDir=t;const e=this._itemMenu.querySelector('[data-command="left"]'),s=this._itemMenu.querySelector('[data-command="right"]');if(e&&s){const t=e.parentElement,i=s.parentElement;t.appendChild(s),i.appendChild(e)}}init(){this.defaultDir=this.#Dc()}#Dc(){const t=this.$.frameContext.get("wwComputedStyle").getPropertyValue("text-align");return["left","center","right","justify"].includes(t)?t:this.$.options.get("_rtl")?"right":"left"}}const ha=aa;class ca extends Ir{static key="font";static className="se-btn-select se-btn-tool-font";#Fc;constructor(t,e){super(t),this.title=this.$.lang.font,this.inner='<span class="se-txt">'+this.$.lang.font+"</span>"+this.$.icons.arrow_down;const s=e.items||["Arial","Comic Sans MS","Courier New","Impact","Georgia","tahoma","Trebuchet MS","Verdana"],i=`<li><button type="button" class="se-btn se-btn-list default_value" data-command="" title="${this.$.lang.default}" aria-label="${this.$.lang.default}">${this.$.lang.default}</button></li><li class="se-btn-list se-sub-list"><span></span></li>`,n=this.$.menu.initDropdownTarget(ca,function(t){return t.map((t=>{const e=t.split(",")[0];return{command:t,title:e,innerHTML:e,attrs:{"data-txt":e,style:`font-family:${t};`}}}))}(s),{className:"se-list-font-family",prependHTML:i});this.currentFont="",this.fontList=n.querySelectorAll("ul li button"),this.fontArray=s,this.#Fc=n.querySelector(".se-sub-list span")}active(t,e){const s=e.querySelector(".se-txt"),i=e.parentNode.querySelector(".se-tooltip-text");let n="";if(t){if(this.$.format.isLine(t))return;if(n=Ve.utils.getStyle(t,"fontFamily")){const t=n.replace(/["']/g,"");return Ve.utils.changeTxt(s,t),Ve.utils.changeTxt(i,this.$.lang.font+" ("+t+")"),!0}}else{const t=this.$.store.get("hasFocus")?this.$.frameContext.get("wwComputedStyle").fontFamily:this.$.lang.font;Ve.utils.changeTxt(s,t),Ve.utils.changeTxt(i,this.$.store.get("hasFocus")?this.$.lang.font+(t?" ("+t+")":""):t)}return!1}on(t){const e=this.fontList,s=t.querySelector(".se-txt").textContent;if(s!==this.currentFont){let t=!1;for(let i=0,n=e.length;i<n;i++)s===(e[i].getAttribute("data-command")||"").replace(/'|"/g,"")?(Ve.utils.addClass(e[i],"active"),t=!0):Ve.utils.removeClass(e[i],"active");this.currentFont=s,t?this.#Fc.style.display="none":(this.#Fc.textContent=s,this.#Fc.style.display="block")}}async action(t){let e=t.getAttribute("data-command");if(e){if(/[\s\d\W]/.test(e)&&!/^['"].*['"]$/.test(e)&&(e=`"${e}"`),!1===await this.$.eventManager.triggerEvent("onFontActionBefore",{value:e}))return;const t=Ve.utils.createElement("SPAN",{style:"font-family: "+e+";"});this.$.inline.apply(t,{stylesToModify:["font-family"],nodesToRemove:null,strictRemove:null})}else this.$.inline.apply(null,{stylesToModify:["font-family"],nodesToRemove:["span"],strictRemove:!0});this.$.menu.dropdownOff()}}const da=ca;class ua extends Vr{static key="fontColor";static className="";constructor(t,e){super(t),this.title=this.$.lang.fontColor,this.icon="font_color";const s=Ve.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new _r(this,this.$,"color",{form:s,colorList:e.items,splitNum:e.splitNum,disableHEXInput:e.disableHEXInput,hueSliderOptions:{controllerOptions:{isOutsideForm:!0}}}),this.$.menu.initDropdownTarget(ua,s)}active(t,e){const s=e.querySelector(".se-svg-color-helper");if(!s)return;let i="";if(t){if(this.$.format.isLine(t))return;if(i=Ve.utils.getStyle(t,"color"))return s.style.color=i,!0}else s.style.color=i;return!1}on(t){this.colorPicker.init(this.$.selection.getNode(),t,(t=>this.$.format.isLine(t)))}off(){this.colorPicker.hueSliderClose()}colorPickerAction(t){if(t){const e=Ve.utils.createElement("SPAN",{style:"color: "+t+";"});this.$.inline.apply(e,{stylesToModify:["color"],nodesToRemove:null,strictRemove:null})}else this.$.inline.apply(null,{stylesToModify:["color"],nodesToRemove:["span"],strictRemove:!0});this.$.menu.dropdownOff()}}const pa=ua;class ga extends Vr{static key="backgroundColor";static className="";constructor(t,e){super(t),this.title=this.$.lang.backgroundColor,this.icon="background_color";const s=Ve.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new _r(this,this.$,"backgroundColor",{form:s,colorList:e.items,splitNum:e.splitNum,disableHEXInput:e.disableHEXInput,hueSliderOptions:{controllerOptions:{isOutsideForm:!0}}}),this.$.menu.initDropdownTarget(ga,s)}active(t,e){const s=e.querySelector("path.se-svg-color-helper");if(!s)return;let i="";if(t){if(this.$.format.isLine(t))return;if(i=Ve.utils.getStyle(t,"backgroundColor"))return s.style.color=i,!0}else s.style.color=i;return!1}on(t){this.colorPicker.init(this.$.selection.getNode(),t,(t=>this.$.format.isLine(t)))}off(){this.colorPicker.hueSliderClose()}colorPickerAction(t){if(t){const e=Ve.utils.createElement("SPAN",{style:"background-color: "+t+";"});this.$.inline.apply(e,{stylesToModify:["background-color"],nodesToRemove:null,strictRemove:null})}else this.$.inline.apply(null,{stylesToModify:["background-color"],nodesToRemove:["span"],strictRemove:!0});this.$.menu.dropdownOff()}}const ma=ga;class fa extends Ir{static key="hr";static className="";static component(t){return/^hr$/i.test(t?.nodeName)?t:null}constructor(t,e){super(t),this.title=this.$.lang.horizontalLine,this.icon="horizontal_line";const s=this.$.menu.initDropdownTarget(fa,function({lang:t},e){return(e||[{name:t.hr_solid,class:"__se__solid",style:null},{name:t.hr_dashed,class:"__se__dashed",style:null},{name:t.hr_dotted,class:"__se__dotted",style:null}]).map((t=>({command:"hr",title:t.name,innerHTML:`<hr${t.class?` class="${t.class}"`:""}${t.style?` style="${t.style}"`:""}/>`})))}(this.$,e.items),{className:"se-list-line"});this.list=s.querySelectorAll("button")}componentSelect(t){Ve.utils.addClass(t,"on")}componentDeselect(t){Ve.utils.removeClass(t,"on")}componentDestroy(t){if(!t)return;const e=t.previousElementSibling||t.nextElementSibling;Ve.utils.removeItem(t),this.$.focusManager.focusEdge(e),this.$.history.push(!1)}shortcut({line:t,range:e}){const s=this.$.nodeTransform.split(e.endContainer,e.endOffset,0);this.submit("__se__solid"),Ve.utils.removeItem(t),this.$.selection.setRange(s,0,s,0)}action(t){const e=this.submit(t.firstElementChild.className),s=this.$.format.addLine(e);this.$.selection.setRange(s,1,s,1),this.$.menu.dropdownOff()}submit(t){const e=Ve.utils.createElement("hr",{class:t});return this.$.focusManager.focus(),this.$.component.insert(e,{insertBehavior:"line"}),e}}const va=fa;class ba extends Ir{static key="list";static className="se-icon-flip-rtl";#xc;#qc;constructor(t){super(t),this.title=this.$.lang.list,this.icon="list_numbered",this.#qc={bulleted:this.$.icons.list_bulleted,numbered:this.$.icons.list_numbered};const e=this.$.menu.initDropdownTarget(ba,function({lang:t,icons:e}){return[{command:"ol",title:t.numberedList,innerHTML:e.list_numbered,className:"se-tooltip se-icon-flip-rtl"},{command:"ul",title:t.bulletedList,innerHTML:e.list_bulleted,className:"se-tooltip se-icon-flip-rtl"}]}(this.$));this.#xc=e.querySelectorAll("li button")}active(t,e){const s=e.firstElementChild;if(Ve.check.isList(t)){const i=t.nodeName.toLowerCase();return e.setAttribute("data-focus",i),Ve.utils.addClass(e,"active"),/^ul$/.test(i)?Ve.utils.changeElement(s,this.#qc.bulleted):Ve.utils.changeElement(s,this.#qc.numbered),!0}return e.removeAttribute("data-focus"),Ve.utils.changeElement(s,this.#qc.numbered),Ve.utils.removeClass(e,"active"),!1}on(t){const e=t.getAttribute("data-focus")||"",s=this.#xc;for(let t=0,i=s.length;t<i;t++)e===s[t].getAttribute("data-command")?Ve.utils.addClass(s[t],"active"):Ve.utils.removeClass(s[t],"active")}action(t){const e=t.getAttribute("data-command"),s=t.getAttribute("data-value")||"",i=this.$.listFormat.apply(`${e}:${s}`,null,!1);i&&this.$.selection.setRange(i.sc,i.so,i.ec,i.eo),this.$.menu.dropdownOff(),this.$.history.push(!1)}}const ya=ba,Ca=".se-table-resize-line",wa=".se-table-resize-line-prev",_a=".se-table-resize-row",xa=".se-table-resize-row-prev",$a=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],ka={all:"border_all",inside:"border_inside",horizon:"border_horizontal",vertical:"border_vertical",outside:"border_outside",left:"border_left",top:"border_top",right:"border_right",bottom:"border_bottom",none:"border_none"},Sa=["all","inside","horizon","vertical"],Ea="borderLeft",Ta="borderTop",Ma="borderRight",Ha="borderBottom",La=["#bbf7d0","#fde68a","#fecaca","#e9d5ff","#bfdbfe","#22c55e","#eab308","#ef4444","#a855f7","#3b82f6","#15803d","#ca8a04","#b91c1c","#7e22ce","#1d4ed8","#e5e7eb","#9ca3af","#6b7280","#374151","#000000"],Na={physical_cellCnt:0,logical_cellCnt:0,cellCnt:0,rowCnt:0,rowIndex:0,physical_cellIndex:0,logical_cellIndex:0,current_colSpan:0,current_rowSpan:0,isShiftPressed:!1,ref:null,figureElement:null,selectedTable:null,trElement:null,trElements:null,tdElement:null,fixedCell:null,selectedCell:null,selectedCells:null},{_w:Aa}=Ae,Ba=new WeakMap,Ia=new WeakMap;function Va(t){return/^(TD|TH|TR)$/i.test(t?.nodeName)}function Oa(t){return/^CAPTION$/i.test(t.nodeName)}function Ra(t,e){const s=t.clientX,i=Oe.get(Aa.getComputedStyle(e).width,0),n=e.getBoundingClientRect(),o=Math.round(s-n.left),l=o<=6;return{is:l||i-o<=6,isLeft:l,startX:s}}function Pa(t,e){const s=t.clientY,i=Oe.get(Aa.getComputedStyle(e).height,0),n=e.getBoundingClientRect();return{is:Math.ceil(i+n.top-s)<=6,startY:s}}function za(t,e){return`<${t=t.toLowerCase()}><div><br></div></${t}>`.repeat(e)}function Da(t){return t=t.toLowerCase(),Ve.utils.createElement(t,null,"<div><br></div>")}function Fa(t,e,s){let i=Ia.get(t);return i||(i=function(t){const e=[],s=t.rows,i=[];for(let t=0,n=s.length;t<n;t++){const n=s[t].cells;e[t]=[];let o=0;for(let s=0,l=n.length;s<l;s++){for(;i[t]?.[o];)o++;e[t][s]=o;const l=n[s],r=l.colSpan||1,a=l.rowSpan||1;if(a>1)for(let e=1;e<a;e++){i[t+e]||(i[t+e]=[]);for(let s=0;s<r;s++)i[t+e][o+s]=!0}o+=r}}return e}(t),Ia.set(t,i)),i[e]?.[s]??0}function qa(t,e){const s=Ve.utils.clone(t,!0),i=Array.from(t.querySelectorAll("td, th")),n=Array.from(s.querySelectorAll("td, th"));return{clonedTable:s,clonedSelectedCells:e.map((t=>{const e=i.indexOf(t);return e>-1?n[e]:null})).filter((t=>null!==t))}}function Wa(t){t&&(Ba.delete(t),Ia.delete(t))}function Ua(t,e,s){const i=[];let n="";for(const o in ka){if(s.includes(o))continue;const l=ka[o];i.push(o),n+=`\n\t\t\t<button type="button" class="se-btn se-tooltip">\n\t\t\t\t${e[l]}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t[l]}</span>\n\t\t\t\t</span>\n\t\t\t</button>`}return{items:i,menus:Ve.utils.createElement("DIV",null,n).querySelectorAll("button")}}const Za=class{#Wc;#J;#N;constructor(t,{mergeButton:e,unmergeButton:s,splitButton:i,openCellMenuFunc:n,closeCellMenuFunc:o}){this.#Wc=t,this.#J=t.$,this.#N=t.state,this.mergeButton=e,this.unmergeButton=s,this.splitButton=i;const l=(r=this.#J.lang,{items:["vertical","horizontal"],menus:Ve.utils.createElement("DIV",null,`\n\t\t<div title="${r.verticalSplit}" aria-label="${r.verticalSplit}">\n\t\t\t${r.verticalSplit}\n\t\t</div>\n\t\t<div title="${r.horizontalSplit}" aria-label="${r.horizontalSplit}">\n\t\t\t${r.horizontalSplit}\n\t\t</div>`).querySelectorAll("div")});var r;this.selectMenu_split=new Hi(this.#J,{checkList:!1,position:"bottom-center",openMethod:n,closeMethod:o}),this.selectMenu_split.on(this.splitButton,this._OnSplitCells.bind(this)),this.selectMenu_split.create(l.items,l.menus)}get#Uc(){return this.#Wc.selectionService}openSplitMenu(){this.selectMenu_split.open()}mergeCells(t,e=!1){const s=t[0].closest("table");Wa(s);const{clonedTable:i,clonedSelectedCells:n}=e?{clonedTable:s,clonedSelectedCells:t}:qa(s,t);this.#Wc.setTableInfo(i),t=n,this.#Wc.setState("ref",null),this.#Uc.setMultiCells(t[0],Ve.query.findVisualLastCell(t));const o=this.#N.ref,l=t[0];let r=null,a=null;const h=o.ce-o.cs+1;let c=o.re-o.rs+1,d="",u=null;for(let e,s,i=1,n=t.length;i<n;i++){e=t[i],u!==e.parentNode&&(u=e.parentNode),s=e.children;for(let t=0,e=s.length;t<e;t++)this.#J.format.isLine(s[t])&&Ve.check.isZeroWidth(s[t].textContent)&&Ve.utils.removeItem(s[t]);d+=e.innerHTML,Ve.utils.removeItem(e),0===u.cells.length&&(r?a=u:r=u,c-=1)}if(r){const t=this.#N.trElements,e=Ve.utils.getArrayIndex(t,r),s=Ve.utils.getArrayIndex(t,a||r),i=[];for(let n,o=0;o<=s;o++)if(n=t[o].cells,0!==n.length)for(let t,i,l=0,r=n.length;l<r;l++)t=n[l],i=t.rowSpan-1,i>0&&o+i>=e&&(t.rowSpan-=Oe.getOverlapRangeAtIndex(e,s,o,o+i));else i.push(t[o]);for(let t=0,e=i.length;t<e;t++)Ve.utils.removeItem(i[t])}l.innerHTML+=d,l.colSpan=h,l.rowSpan=c,e||(s.replaceWith(i),this.#Wc._closeTableSelectInfo(),this.#Wc._setController(l),this.#Uc.focusCellEdge(l),this.#Uc.initCellSelection(l),this.#Wc.setState("ref",null),this.#Wc.setState("selectedCells",[l]),this.#Wc.setCellInfo(l,!0),this.setUnMergeButton(),this.setMergeSplitButton(),this.#Wc.historyPush())}unmergeCells(t,e=!1){if(!t?.length)return;const s=t[0].closest("table");Wa(s);const{clonedTable:i,clonedSelectedCells:n}=e?{clonedTable:s,clonedSelectedCells:t}:qa(s,t);this.#Wc.setState("ref",null),this.#Wc.setTableInfo(i);let o=(t=n)[0],l=Ve.query.findVisualLastCell(t),r=null;const a=o.closest("table"),h=a.rows;for(const e of t){const t=e.parentElement.rowIndex,s=e.cellIndex,i=e.rowSpan,n=e.colSpan;if(1===i&&1===n)continue;this.#Wc.setCellInfo(e,!0);const a=e.innerHTML;e.remove();for(let c=0;c<i;c++){const i=h[t+c];for(let t=0;t<n;t++){const n=Da("td");0===c&&0===t?(o===e&&(o=n),l===e&&(l=n),n.innerHTML=a,i.insertBefore(n,i.cells[s])):(i.insertBefore(n,i.cells[s+t]),r=n)}}}this.#Wc.setState("selectedCells",null),e||(s.replaceWith(i),this.#Wc._closeTableSelectInfo(),this.#Wc.setTableInfo(i),o!==l?(l=!r||l.closest("tr").rowIndex>r.closest("tr").rowIndex||l.cellIndex>r.cellIndex?l:r,this.#Uc.setMultiCells(o,l),this.#Wc.setState("selectedCells",Array.from(a.querySelectorAll(".se-selected-table-cell")))):this.#Wc.setCellInfo(l,!0),this.#Uc.initCellSelection(o),this.#Wc.setState("selectedCell",l),this.setUnMergeButton(),this.#Wc.controller_cell.resetPosition(l),this.#Wc.historyPush())}findMergedCells(t){const e=[];return t?.forEach((t=>{t&&(t.rowSpan>1||t.colSpan>1)&&e.push(t)})),e}setMergeSplitButton(){this.#N.ref?(this.splitButton.style.display="none",this.mergeButton.style.display="block"):(this.splitButton.style.display="block",this.mergeButton.style.display="none")}setUnMergeButton(){this.findMergedCells(this.#N.selectedCells?.length?this.#N.selectedCells:[this.#N.fixedCell]).length>0?this.unmergeButton.disabled=!1:this.unmergeButton.disabled=!0}_OnSplitCells(t){Wa(this.#Wc._element);const e="vertical"===t,s=this.#N.tdElement,i=this.#N.trElements,n=this.#N.trElement,o=this.#N.logical_cellIndex,l=this.#N.rowIndex,r=Da(s.nodeName);if(e){const t=s.colSpan;if(r.rowSpan=s.rowSpan,t>1)r.colSpan=Math.floor(t/2),s.colSpan=t-r.colSpan,n.insertBefore(r,s.nextElementSibling);else{let e=[],l=[];for(let n,r,a=0,h=this.#N.rowCnt;a<h;a++){n=i[a].cells,r=0;for(let i,h,c,d,u=0,p=n.length;u<p;u++){if(i=n[u],h=i.colSpan-1,c=i.rowSpan-1,d=u+r,l.length>0)for(let t,e=0;e<l.length;e++)t=l[e],t.row>a||(d>=t.index?(r+=t.cs,d+=t.cs,t.rs-=1,t.row=a+1,t.rs<1&&(l.splice(e,1),e--)):u===p-1&&(t.rs-=1,t.row=a+1,t.rs<1&&(l.splice(e,1),e--)));if(d<=o&&c>0&&e.push({index:d,cs:h+1,rs:c,row:-1}),i!==s&&d<=o&&d+h>=o+t-1){i.colSpan+=1;break}if(d>o)break;r+=h}l=l.concat(e).sort((function(t,e){return t.index-e.index})),e=[]}n.insertBefore(r,s.nextElementSibling)}}else{const t=s.rowSpan;if(r.colSpan=s.colSpan,t>1){r.rowSpan=Math.floor(t/2);const e=t-r.rowSpan,l=[],a=Ve.utils.getArrayIndex(i,n)+e;for(let t,e,s=0;s<a;s++){t=i[s].cells,e=0;for(let i,n,r,h=0,c=t.length;h<c&&(r=h+e,!(r>=o));h++)i=t[h],n=i.rowSpan-1,n>0&&n+s>=a&&r<o&&l.push({index:r,cs:i.colSpan}),e+=i.colSpan-1}const h=i[a],c=h.cells;let d=l.shift();for(let t,e,s,i,n=0,a=c.length,u=0;n<a;n++){if(s=n+u,t=c[n],e=t.colSpan-1,i=s+e+1,d&&i>=d.index&&(u+=d.cs,i+=d.cs,d=l.shift()),i>=o||n===a-1){h.insertBefore(r,t.nextElementSibling);break}u+=e}s.rowSpan=e}else{r.rowSpan=s.rowSpan;const t=Ve.utils.createElement("TR");t.appendChild(r);for(let t,e=0;e<l;e++){if(t=i[e].cells,0===t.length)return;for(let s=0,i=t.length;s<i;s++)e+t[s].rowSpan-1>=l&&(t[s].rowSpan+=1)}const e=this.#N.physical_cellIndex,o=n.cells;for(let t=0,s=o.length;t<s;t++)t!==e&&(o[t].rowSpan+=1);n.parentNode.insertBefore(t,n.nextElementSibling)}}this.selectMenu_split.close(),this.#Uc.focusCellEdge(s),this.#Uc.deleteStyleSelectedCells(),this.#J.history.push(!1),this.#Wc._setController(s),this.#Wc.setState("selectedCell",s),this.#Wc.setState("fixedCell",s),this.#N.selectedCells?.length||this.#Wc.setState("selectedCells",[s])}};const Ga=class{#Wc;#N;constructor(t){this.#Wc=t,this.#N=t.state}get#Uc(){return this.#Wc.selectionService}get#Zc(){return this.#Wc.gridService}get#Gc(){return this.#Wc.cellService}copySelectedTableCells(t,e,s){t.preventDefault(),t.stopPropagation();const i=s[0].closest("table"),n=i.cloneNode(!1),o=Ve.utils.createElement("tbody");n.appendChild(o);const l=new Map;s.forEach((t=>{l.set(t,!0)}));const r=i.rows,a=r.length,h=Array.from(r[0].cells).reduce(((t,e)=>t+(e.colSpan||1)),0),c=Array.from({length:a},(()=>Array(h).fill(null)));for(let t=0;t<a;t++){const e=r[t].cells;for(let s=0,n=e.length;s<n;s++){const n=Fa(i,t,s),o=e[s],l=o.rowSpan||1,r=o.colSpan||1;for(let e=0;e<l;e++)for(let s=0;s<r;s++)c[t+e][n+s]=o}}for(let t=0;t<a;t++){let e;for(let s=0;s<h;s++){const i=c[t][s];if(!i||!l.has(i))continue;if(e||(e=Ve.utils.createElement("tr"),o.appendChild(e)),e.lastChild&&c[t][s-1]===i)continue;if(t>0&&c[t-1][s]===i)continue;const n=i.cloneNode(!0);let r=1,d=1;for(;t+r<a&&c[t+r][s]===i;)r++;for(;s+d<h&&c[t][s+d]===i;)d++;r>1&&(n.rowSpan=r),d>1&&(n.colSpan=d),e.appendChild(n)}}const d=Ve.utils.createElement("figure");d.className=e.className,d.appendChild(n);const u=`<html><body>\x3c!--StartFragment--\x3e${d.outerHTML}\x3c!--EndFragment--\x3e</body></html>`;t.clipboardData.setData("text/html",u)}pasteTableCellMatrix(t,e){if(!t||!e)return;Wa(e.closest("table"));const s=t.rows;let i=0;const n=[];for(let t=0;t<s.length;t++){const e=s[t].cells;let o=0;for(let s=0;s<e.length;s++){const l=e[s];for(;n[t]?.[o];)o++;const r=l.rowSpan||1,a=l.colSpan||1;0===o&&(i+=r);for(let e=0;e<r;e++)for(let s=0;s<a;s++)n[t+e]||(n[t+e]=[]),n[t+e][o+s]=!0;o+=a}}let o=0;for(let t=0,e=s[0].cells,i=e.length;t<i;t++){o+=e[t].colSpan||1}const l={rowCnt:i,logicalCellCnt:o};this.#Uc.deleteStyleSelectedCells();const r=e.closest("table"),{clonedTable:a,clonedSelectedCells:h}=qa(r,[e]),c=a;e=h[0];let d=c.rows;this.#Wc.setTableInfo(c),this.#Wc.setCellInfo(e,!0);const u={physicalCellCnt:this.#N.physical_cellCnt,logicalCellCnt:this.#N.logical_cellCnt,rowCnt:this.#N.rowCnt,rowIndex:this.#N.rowIndex,physicalCellIndex:this.#N.physical_cellIndex,logicalCellIndex:this.#N.logical_cellIndex,currentColSpan:this.#N.current_colSpan,currentRowSpan:this.#N.current_rowSpan},p=l.rowCnt-(u.rowCnt-(u.rowIndex+1))-1,g=l.logicalCellCnt-(u.logicalCellCnt-(u.logicalCellIndex+1))-1;if(u.rowCnt+=p,u.logicalCellCnt+=g,u.physicalCellCnt+=g,p>0||g>0){const t=d[d.length-1],e=t.cells[t.cells.length-1];for(let t=0;t<p;t++)this.#Zc.editRow("down",e);for(let t=0;t<g;t++)this.#Zc.editColumn("right",e);this.#Wc.setState("trElements",d=c.rows)}const m=u.rowIndex,f=u.logicalCellIndex,v=f+l.logicalCellCnt-1,b=[],y=[];for(let t=0,e=m+l.rowCnt;t<e;t++){const e=d[t]?.cells;if(!e)continue;let s=0,i=0;for(let n=0;n<e.length;n++){for(;y[t]?.[s];)s++;const n=e[i++];if(!n)break;const o=n.colSpan||1,l=n.rowSpan||1,r=s,a=s+o-1;if(l>1||o>1)for(let e=1;e<l;e++){const i=t+e;y[i]||=[];for(let t=0;t<o;t++)y[i][s+t]=!0}r<=v&&a>=f&&(o>1||l>1)&&b.push(n),s+=o}}b.length>0&&(this.#Gc.unmergeCells(b,!0),this.#Wc.setState("trElements",d=c.rows));const C=[],w=[],_=[];for(let t=0,e=l.rowCnt;t<e;t++){const e=s[t]?.cells;if(!e)break;let i=0;for(let s=0;s<e.length;s++){const n=e[s],o=n.colSpan||1,l=n.rowSpan||1;for(;w[t]?.[i];)i++;for(let e=1;e<l;e++){const s=t+e;w[s]||=[];for(let t=0;t<o;t++)w[s][i+t]=!0}if(o<=1&&l<=1){i+=o;continue}const r=i+u.logicalCellIndex,a=r+o-1,h=[];for(let e=u.rowIndex+t,s=e+l,i=0;e<s;e++,i++){const t=d[e].cells;let s=0,i=0;for(;i<t.length&&s<=a;){for(;_[e]?.[s];)s++;const n=t[i++],o=n.colSpan||1,l=n.rowSpan||1,c=s,d=s+o-1;if(l>1)for(let t=1;t<l;t++){const i=e+t;_[i]||=[];for(let t=0;t<o;t++)_[i][s+t]=!0}d>=r&&c<=a&&h.push(n),s+=o}}h.length>0&&C.push(h),i+=o}}if(C.length>0){for(const t of C)this.#Wc.setState("ref",null),this.#Wc.setState("trElements",c.rows),this.#Gc.mergeCells(t,!0);this.#Wc.setState("trElements",d=c.rows)}const x=[],$=[];for(let t=0;t<l.rowCnt;t++){const e=d[u.rowIndex+t],i=s[t];if(!e||!i)break;const n=e.cells,o=i.cells;let l=0,r=0,a=0;for(;r<n.length&&a<o.length&&l<=v;){for(;$[t]?.[l];)l++;const e=n[r++],s=o[a];if(!e||!s)break;const i=e.colSpan||1,h=e.rowSpan||1;if(h>1)for(let e=1;e<h;e++){const s=t+e;$[s]||=[];for(let t=0;t<i;t++)$[s][l+t]=!0}l>=f&&l+i-1<=v&&(e.innerHTML=s.innerHTML,x.push(e),a++),l+=i}}return r.replaceWith(c),this.#Wc._closeTableSelectInfo(),this.#Wc.setTableInfo(c),this.#Gc.setMergeSplitButton(),this.#Gc.setUnMergeButton(),this.#Uc.focusCellEdge(x[0]),this.#Wc.historyPush(),x}};const ja=class{#Wc;#J;#N;constructor(t,{columnButton:e,rowButton:s,openCellMenuFunc:i,closeCellMenuFunc:n}){this.#Wc=t,this.#J=t.$,this.#N=t.state;const o=(l=this.#J.lang,r=this.#J.icons,{items:["insert-left","insert-right","delete"],menus:Ve.utils.createElement("DIV",null,`\n\t\t<div title="${l.insertColumnBefore}" aria-label="${l.insertColumnBefore}">\n\t\t\t<span class="se-list-icon">${r.insert_column_left}</span><span class="se-txt">${l.insertColumnBefore}</span>\n\t\t</div>\n\t\t<div title="${l.insertColumnAfter}" aria-label="${l.insertColumnAfter}">\n\t\t\t<span class="se-list-icon">${r.insert_column_right}</span><span class="se-txt">${l.insertColumnAfter}</span>\n\t\t</div>\n\t\t<div title="${l.deleteColumn}" aria-label="${l.deleteColumn}">\n\t\t\t<span class="se-list-icon">${r.delete_column}</span><span class="se-txt">${l.deleteColumn}</span>\n\t\t</div>`).querySelectorAll("div")});var l,r;this.selectMenu_column=new Hi(this.#J,{checkList:!1,position:"bottom-center",openMethod:i,closeMethod:n}),this.selectMenu_column.on(e,this.#jc.bind(this)),this.selectMenu_column.create(o.items,o.menus);const a=function(t,e){return{items:["insert-above","insert-below","delete"],menus:Ve.utils.createElement("DIV",null,`\n\t\t<div title="${t.insertRowAbove}" aria-label="${t.insertRowAbove}">\n\t\t\t<span class="se-list-icon">${e.insert_row_above}</span><span class="se-txt">${t.insertRowAbove}</span>\n\t\t</div>\n\t\t<div title="${t.insertRowBelow}" aria-label="${t.insertRowBelow}">\n\t\t\t<span class="se-list-icon">${e.insert_row_below}</span><span class="se-txt">${t.insertRowBelow}</span>\n\t\t</div>\n\t\t<div title="${t.deleteRow}" aria-label="${t.deleteRow}">\n\t\t\t<span class="se-list-icon">${e.delete_row}</span><span class="se-txt">${t.deleteRow}</span>\n\t\t</div>`).querySelectorAll("div")}}(this.#J.lang,this.#J.icons);this.selectMenu_row=new Hi(this.#J,{checkList:!1,position:"bottom-center",openMethod:i,closeMethod:n}),this.selectMenu_row.on(s,this.#Kc.bind(this)),this.selectMenu_row.create(a.items,a.menus)}get#Uc(){return this.#Wc.selectionService}openColumnMenu(){this.selectMenu_column.open()}openRowMenu(){this.selectMenu_row.menus[0].style.display=this.selectMenu_row.menus[1].style.display=/^TH$/i.test(this.#N.tdElement?.nodeName)?"none":"",this.selectMenu_row.open()}editTable(t,e){const s=this.#Wc._element,i="row"===t;if(i){const t=this.#N.trElement.parentElement;if(/^THEAD$/i.test(t.nodeName)){if("up"===e)return;if(!t.nextElementSibling||!/^TBODY$/i.test(t.nextElementSibling.nodeName))return void(e?s.innerHTML+="<tbody><tr>"+za("td",this.#N.logical_cellCnt)+"</tr></tbody>":(Ve.utils.removeItem(this.#N.figureElement),this.#Wc._closeTableSelectInfo()))}}if(this.#N.ref){const t=this.#N.tdElement,s=this.#N.selectedCells;if(i)if(e)this.#Wc.setCellInfo("up"===e?s[0]:s.at(-1),!0),this.editRow(e,null,t);else{let t=s[0].parentNode;const i=[s[0]];for(let e,n=1,o=s.length;n<o;n++)e=s[n],t!==e.parentNode&&(i.push(e),t=e.parentNode);for(let t=0,s=i.length;t<s;t++)this.#Wc.setCellInfo(i[t],!0),this.editRow(e)}else{const i=s[0].parentNode;if(e){let n=null;for(let t=0,e=s.length-1;t<e;t++)if(i!==s[t+1].parentNode){n=s[t];break}this.#Wc.setCellInfo("left"===e?s[0]:n||s[0],!0),this.editColumn(e,null,t)}else{const t=[s[0]];for(let e,n=1,o=s.length;n<o&&(e=s[n],i===e.parentNode);n++)t.push(e);for(let s=0,i=t.length;s<i;s++)this.#Wc.setCellInfo(t[s],!0),this.editColumn(e)}}e||this.#Wc.resetInfo()}else this[i?"editRow":"editColumn"](e);if(!e){const t=s.children;for(let e=0;e<t.length;e++)0===t[e].children.length&&(Ve.utils.removeItem(t[e]),e--);0===s.children.length&&Ve.utils.removeItem(s)}}editColumn(t,e,s){e&&this.#Wc.setCellInfo(e,!0);const i=!t,n="left"===t,o=this.#N.current_colSpan,l=this.#N.logical_cellIndex+(i||n?0:o+1),r=this.#N.trElements;let a,h=[],c=[],d=0;const u=[],p=[];for(let t,e,s,n,g,m=0,f=this.#N.rowCnt;m<f;m++){t=r[m],a=l,n=!1,e=t.cells,g=0;for(let t,s,r,f,v=0,b=e.length;v<b&&(t=e[v],t);v++)if(s=t.rowSpan-1,r=t.colSpan-1,i){if(f=v+g,c.length>0){const t=!e[v+1];for(let e,s=0;s<c.length;s++)e=c[s],e.row>m||(f>=e.index?(g+=e.cs,f=v+g,e.rs-=1,e.row=m+1,e.rs<1&&(c.splice(s,1),s--)):t&&(e.rs-=1,e.row=m+1,e.rs<1&&(c.splice(s,1),s--)))}s>0&&h.push({rs:s,cs:r+1,index:f,row:-1}),f>=a&&f+r<=a+o?u.push(t):f<=a+o&&f+r>=a?t.colSpan-=Oe.getOverlapRangeAtIndex(l,l+o,f,f+r):s>0&&(f<a||f+r>a+o)&&p.push({cell:t,i:m,rs:m+s}),g+=r}else{if(v>=a)break;if(r>0){if(d<1&&r+v>=a){t.colSpan+=1,a=null,d=s+1;break}a-=r}if(!n){for(let t,e=0;e<c.length;e++)t=c[e],a-=t.cs,t.rs-=1,t.rs<1&&(c.splice(e,1),e--);n=!0}}if(c=c.concat(h).sort((function(t,e){return t.index-e.index})),h=[],!i){if(d>0){d-=1;continue}null!==a&&e.length>0&&(s=Da(e[0].nodeName),s=t.insertBefore(s,e[a]))}}const g=this.#Wc._element.querySelector("colgroup");if(g){const t=g.querySelectorAll("col");if(i)Ve.utils.removeItem(t[a]);else{if(!(!Ve.utils.hasClass(this.#Wc._element,"se-table-layout-fixed")&&"fixed"!==this.#Wc._element.style.tableLayout)&&Array.prototype.some.call(t,(t=>Oe.get(t.style.width)>0))){let e=0;for(let s,i=0,n=t.length;i<n;i++)s=Oe.get(t[i].style.width),s-=Math.round(s*n*.1/2),e+=s,t[i].style.width=`${s}%`;const s=Ve.utils.createElement("col",{style:`width:${100-e}%`});g.insertBefore(s,t[a])}else g.insertBefore(Ve.utils.createElement("col"),t[a]||null)}}if(i){let t,e;for(let s,i=0,n=u.length;i<n;i++)s=u[i].parentNode,Ve.utils.removeItem(u[i]),0===s.cells.length&&(t||=Ve.utils.getArrayIndex(r,s),e=Ve.utils.getArrayIndex(r,s),Ve.utils.removeItem(s));for(let s,i=0,n=p.length;i<n;i++)s=p[i],s.cell.rowSpan=Oe.getOverlapRangeAtIndex(t,e,s.i,s.rs);this.#Wc._closeController()}else this.#Wc._setCellControllerPosition(s||this.#N.tdElement,!0);return s||this.#N.tdElement}editRow(t,e,s){this.#Uc.deleteStyleSelectedCells(),e&&this.#Wc.setCellInfo(e,!0);const i=!t,n="up"===t,o=this.#N.rowIndex,l=i||n?o:o+this.#N.current_rowSpan+1,r=i?-1:1,a=this.#N.trElements;let h=this.#N.logical_cellCnt;for(let t,e=0,s=o+(i?-1:0);e<=s;e++){if(t=a[e].cells,0===t.length)return;for(let s,i,n=0,o=t.length;n<o;n++)s=t[n].rowSpan,i=t[n].colSpan,s<2&&i<2||s+e>l&&l>e&&(t[n].rowSpan=s+r,h-=i)}if(i){const t=a[o+1];if(t){const e=[];let s=a[o].cells,i=0;for(let t,n,o=0,l=s.length;o<l;o++)t=s[o],n=o+i,i+=t.colSpan-1,t.rowSpan>1&&(t.rowSpan-=1,e.push({cell:t.cloneNode(!0),index:n}));if(e.length>0){let n=e.shift();s=t.cells,i=0;for(let o,l,r=0,a=s.length;r<a&&(o=s[r],l=r+i,i+=o.colSpan-1,!(l>=n.index)||(r--,i--,i+=n.cell.colSpan-1,t.insertBefore(n.cell,o),n=e.shift(),n));r++);if(n){t.appendChild(n.cell);for(let s=0,i=e.length;s<i;s++)t.appendChild(e[s].cell)}}}this.#Wc._element.deleteRow(l)}else this.insertBodyRow(this.#Wc._element,l,h);i?this.#Wc._closeController():this.#Wc._setCellControllerPosition(s||this.#N.tdElement,!0)}insertBodyRow(t,e,s){const i=t.insertRow(e);return i.innerHTML=za("td",s),i}#jc(t){switch(Wa(this.#Wc._element),t){case"insert-left":this.editTable("cell","left");break;case"insert-right":this.editTable("cell","right");break;case"delete":this.editTable("cell",null)}this.#Wc.historyPush()}#Kc(t){switch(Wa(this.#Wc._element),t){case"insert-above":this.editTable("row","up");break;case"insert-below":this.editTable("row","down");break;case"delete":this.editTable("row",null)}this.#Wc.historyPush()}},{_w:Ka}=Ae;const Ya=class{#Wc;#J;#N;#fi;#Yc=!1;#Xc=null;#Jc=null;constructor(t){this.#Wc=t,this.#J=t.$,this.#N=t.state,this.#fi={resize:null,resizeStop:null,resizeKeyDown:null}}get#Uc(){return this.#Wc.selectionService}isResizing(){return this.#Yc}onResizeGuide(t,e){const s=Ra(t,e);if(s.is)return this.#Wc._element&&(this.#Wc._element.style.cursor=""),this.#si(),"block"===this.#Xc?.style.display&&(this.#Xc.style.display="none"),this.#Xc=this.#J.frameContext.get("wrapper").querySelector(Ca),this.#Qc(Ve.query.getParentElement(e,Ve.check.isTable),e,this.#Xc,s.isLeft),this.#Xc.style.display="block",!1;return Pa(t,e).is?(this.#si(),this.#Wc._element=Ve.query.getParentElement(e,Ve.check.isTable),this.#Wc._element.style.cursor="ns-resize","block"===this.#Xc?.style.display&&(this.#Xc.style.display="none"),this.#Xc=this.#J.frameContext.get("wrapper").querySelector(_a),this.#td(Ve.query.getParentElement(e,Ve.check.isTable),e,this.#Xc),this.#Xc.style.display="block",!1):void 0}offResizeGuide(){this.#ed()}readyResizeFromEdge(t,e){const s=Ra(t,e);if(s.is){try{this.#Uc.deleteStyleSelectedCells(),this.#Wc.setCellInfo(e,!0);const t=this.#N.logical_cellIndex+this.#N.current_colSpan-(s.isLeft?1:0);if(this.#J.ui.enableBackWrapper("ew-resize"),this.#Xc||=this.#J.frameContext.get("wrapper").querySelector(Ca),this.#Jc=this.#J.frameContext.get("wrapper").querySelector(wa),t<0||t===this.#N.logical_cellCnt-1)return this._startFigureResizing(s.startX,t<0),this.#Wc._editorEnable(!1),!1;const i=this.#Wc._element.querySelector("colgroup").querySelectorAll("col")[t<0?0:t];this._startCellResizing(i,s.startX,Oe.get(Ka.getComputedStyle(i).width,0),s.isLeft),this.#Wc._editorEnable(!1)}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.#Wc._editorEnable(!0),this.#si()}finally{this.#Wc.setState("fixedCell",null),this.#Wc.setState("selectedCell",null),this.#Wc.controller_table.hide(),this.#Wc.controller_cell.hide()}return!1}const i=Pa(t,e);if(i.is){try{let t=Ve.query.getParentElement(e,Ve.check.isTableRow),s=e.rowSpan;if(s>1)for(;Ve.check.isTableRow(t)&&s>1;)t=t.nextElementSibling,--s;this.#Uc.deleteStyleSelectedCells(),this.#Wc.setRowInfo(t),this.#J.ui.enableBackWrapper("ns-resize"),this.#Xc||=this.#J.frameContext.get("wrapper").querySelector(_a),this.#Jc=this.#J.frameContext.get("wrapper").querySelector(xa),this._startRowResizing(t,i.startY,Oe.get(Ka.getComputedStyle(t).height,0)),this.#Wc._editorEnable(!1)}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.#Wc._editorEnable(!0),this.#si()}finally{this.#Wc.setState("fixedCell",null),this.#Wc.setState("selectedCell",null),this.#Wc.controller_table.hide(),this.#Wc.controller_cell.hide()}return!1}}#sd(t){const e=t.querySelector("colgroup").querySelectorAll("col"),s=t.offsetWidth;e.forEach((t=>{const e=t.style.width;if(!e.endsWith("%")){const i=(t.offsetWidth||Oe.get(e,0))/s*100;t.style.width=i+"%"}}))}_startCellResizing(t,e,s,i){const n=this.#N.figureElement;Ve.utils.removeClass(n,"se-component-selected"),this.#sd(this.#Wc._element),this.#Qc(n,this.#N.tdElement,this.#Jc,i),this.#Jc.style.display="block";const o=t.style.width,l=t.nextElementSibling,r=l.style.width,a=Ve.utils.hasClass(this.#Wc._element,"se-table-layout-fixed")?r:Ie.getWidthInPercentage(l||t);yi.get("__dragHandler")&&(yi.get("__dragHandler").style.display="none"),this.#id(this.#nd.bind(this,t,l,n,this.#N.tdElement,this.#Xc,i,e,s,Oe.get(o,0),Oe.get(a,0),this.#Wc._element.offsetWidth),(()=>{this.#si(),this.#sd(this.#Wc._element),this.#J.history.push(!0),this.#J.component.hoverSelect(this.#Wc._element),this.#Wc._editorEnable(!0)}),(e=>{this._stopResize(t,o,"width",e),this._stopResize(l,r,"width",e)}))}#nd(t,e,s,i,n,o,l,r,a,h,c,d){const u=(r+(d.clientX-l))/c*100;if(u>0){t.style.width=`${u}%`;const l=a-u;e.style.width=`${h+l}%`,this.#Qc(s,i,n,o)}}_startRowResizing(t,e,s){const i=this.#N.figureElement;Ve.utils.removeClass(i,"se-component-selected"),this.#td(i,t,this.#Jc),this.#Jc.style.display="block";const n=t.style.height;yi.get("__dragHandler")&&(yi.get("__dragHandler").style.display="none"),this.#id(this.#od.bind(this,t,i,this.#Xc,e,s),(()=>{this.#si(),this.#J.history.push(!0),this.#J.component.hoverSelect(this.#Wc._element),this.#Wc._editorEnable(!0)}),this._stopResize.bind(this,t,n,"height"))}#od(t,e,s,i,n,o){const l=n+(o.clientY-i);t.style.height=`${l}px`,this.#td(e,t,s)}_startFigureResizing(t,e){const s=this.#N.figureElement;Ve.utils.removeClass(s,"se-component-selected"),this.#Qc(s,s,this.#Jc,e),this.#Jc.style.display="block";const i=Ie.getWidthInPercentage(s);yi.get("__dragHandler")&&(yi.get("__dragHandler").style.display="none"),this.#id(this.#ld.bind(this,s,this.#Xc,e,t,s.offsetWidth,Oe.get(i,0)),(()=>{this.#si(),Oe.get(s.style.width,0)>100&&(s.style.width="100%"),this.#J.history.push(!0),this.#J.component.hoverSelect(this.#Wc._element),this.#Wc._editorEnable(!0)}),this._stopResize.bind(this,s,s.style.width,"width"))}#ld(t,e,s,i,n,o,l){const r=(n+(s?i-l.clientX:l.clientX-i))/n*o;r>0&&(t.style.width=`${r}%`,this.#Qc(t,t,e,s))}#Qc(t,e,s,i){const n=this.#J.offset.getLocal(e),o=this.#J.offset.getLocal(t);s.style.left=`${n.left+(i?0:e.offsetWidth)}px`,s.style.top=`${o.top}px`,s.style.height=`${t.offsetHeight}px`}#td(t,e,s){const i=this.#J.offset.getLocal(e),n=this.#J.offset.getLocal(t);s.style.top=`${i.top+e.offsetHeight}px`,s.style.left=`${n.left}px`,s.style.width=`${t.offsetWidth}px`}_stopResize(t,e,s,i){Re.isEsc(i.code)&&(this.#si(),this.#J.component.hoverSelect(this.#Wc._element),this.#Wc._editorEnable(!0),t.style[s]=e,"width"===s&&this.#J.component.select(this.#Wc._element,this.#Wc.constructor.key,{isInput:!0}))}#id(t,e,s){this.#fi.resize=this.#J.eventManager.addGlobalEvent("mousemove",t,!1),this.#fi.resizeStop=this.#J.eventManager.addGlobalEvent("mouseup",e,!1),this.#fi.resizeKeyDown=this.#J.eventManager.addGlobalEvent("keydown",s,!1),this.#Yc=!0}#si(){this.#Yc=!1,this.#J.ui.disableBackWrapper(),this.#ed(),this.#Jc&&(this.#Jc.style.display="none",this.#Jc=null);const t=this.#fi;for(const e in t)t[e]&&=this.#J.eventManager.removeGlobalEvent(t[e]);this.#Yc=!1,this.#Xc=null}#ed(){this.#Xc&&(this.#Xc.style.display="none",this.#Xc=null),this.#Wc._element&&(this.#Wc._element.style.cursor="")}init(){this.#si()}};const Xa=class{#Wc;#J;#N;#rd;#ad;#hd;#cd;#fi;#dd=null;constructor(t){this.#Wc=t,this.#J=t.$,this.#N=t.state,this.#rd=this.#ud.bind(this),this.#ad=this.#pd.bind(this),this.#hd=this.#gd.bind(this),this.#cd=this.#md.bind(this),this.#fi={on:null,off:null,shiftOff:null,touchOff:null,resize:null,resizeStop:null,resizeKeyDown:null}}get#Gc(){return this.#Wc.cellService}selectCells(t){const e=t[0],s=Ve.query.findVisualLastCell(t);return this.#dd=e.nodeName,this.setMultiCells(e,s),{fixedCell:e,selectedCell:s}}setMultiCells(t,e){const s=this.#N.selectedTable,i=s.rows;if(this.deleteStyleSelectedCells(),Ve.utils.addClass(t,"se-selected-table-cell"),t===e&&!this.#N.isShiftPressed)return;const n=function(t,e){const s=t.parentNode,i=e.parentNode;return`${s.rowIndex},${t.cellIndex}-${i.rowIndex},${e.cellIndex}`}(t,e);let o=Ba.get(s);const l=o?.get(n);if(l)return this.#Wc.setState("ref",l),void this.#fd(i,l);const r=this.#vd(i,t,e);this.#Wc.setState("ref",r),o||(o=new Map,Ba.set(s,o)),o.set(n,r),this.#fd(i,r)}#vd(t,e,s){let i=!0,n=[],o=[];const l={_i:0,cs:null,ce:null,rs:null,re:null};for(let r,a,h=0,c=t.length;h<c;h++){r=t[h].cells,a=0;for(let t,c,d,u,p=0,g=r.length;p<g;p++){if(t=r[p],d=t.colSpan-1,u=t.rowSpan-1,c=p+a,n.length>0)for(let t,e=0;e<n.length;e++)t=n[e],t.row>h||(c>=t.index?(a+=t.cs,c+=t.cs,t.rs-=1,t.row=h+1,t.rs<1&&(n.splice(e,1),e--)):p===g-1&&(t.rs-=1,t.row=h+1,t.rs<1&&(n.splice(e,1),e--)));if(i){if(t!==e&&t!==s||(l.cs=null!==l.cs&&l.cs<c?l.cs:c,l.ce=null!==l.ce&&l.ce>c+d?l.ce:c+d,l.rs=null!==l.rs&&l.rs<h?l.rs:h,l.re=null!==l.re&&l.re>h+u?l.re:h+u,l._i+=1),2===l._i){i=!1,n=[],o=[],h=-1;break}}else{const t=l.cs<c?l.cs:c,e=l.ce>c+d?l.ce:c+d,s=l.rs<h?l.rs:h,i=l.re>h+u?l.re:h+u;if(Oe.getOverlapRangeAtIndex(l.cs,l.ce,c,c+d)&&Oe.getOverlapRangeAtIndex(l.rs,l.re,h,h+u)&&(l.cs!==t||l.ce!==e||l.rs!==s||l.re!==i)){l.cs=t,l.ce=e,l.rs=s,l.re=i,h=-1,n=[],o=[];break}}u>0&&o.push({index:c,cs:d+1,rs:u,row:-1}),a+=t.colSpan-1}n=n.concat(o).sort(((t,e)=>t.index-e.index)),o=[]}return l}#fd(t,e){let s=[],i=[];for(let n,o,l=0,r=t.length;l<r;l++){n=t[l].cells,o=0;for(let t,r,a,h,c=0,d=n.length;c<d;c++){if(t=n[c],a=t.colSpan-1,h=t.rowSpan-1,r=c+o,s.length>0)for(let t,e=0;e<s.length;e++)t=s[e],t.row>l||(r>=t.index?(o+=t.cs,r+=t.cs,t.rs-=1,t.row=l+1,t.rs<1&&(s.splice(e,1),e--)):c===d-1&&(t.rs-=1,t.row=l+1,t.rs<1&&(s.splice(e,1),e--)));Oe.getOverlapRangeAtIndex(e.cs,e.ce,r,r+a)&&Oe.getOverlapRangeAtIndex(e.rs,e.re,l,l+h)&&Ve.utils.addClass(t,"se-selected-table-cell"),h>0&&i.push({index:r,cs:a+1,rs:h,row:-1}),o+=t.colSpan-1}s=s.concat(i).sort(((t,e)=>t.index-e.index)),i=[]}}initCellSelection(t){this.#Wc.setState("fixedCell",t),this.#N.selectedCells?.length||this.#Wc.setState("selectedCells",[t]),this.#dd=t.nodeName,this.#Wc.setState("selectedTable",Ve.query.getParentElement(t,"TABLE")),this.deleteStyleSelectedCells(),Ve.utils.addClass(t,"se-selected-cell-focus")}startCellSelection(t,e){this.#N.isShiftPressed||this.#N.ref||this.#si(),this.#Wc.setState("isShiftPressed",e),this.initCellSelection(t),e?(this.#fi.shiftOff=this.#J.eventManager.addGlobalEvent("keyup",this.#hd,!1),this.#fi.on=this.#J.eventManager.addGlobalEvent("mousedown",this.#rd,!1)):this.#fi.on=this.#J.eventManager.addGlobalEvent("mousemove",this.#rd,!1),this.#fi.off=this.#J.eventManager.addGlobalEvent("mouseup",this.#ad,!1),this.#fi.touchOff=this.#J.eventManager.addGlobalEvent("touchmove",this.#cd,!1)}deleteStyleSelectedCells(){Ve.utils.removeClass([this.#N.fixedCell,this.#N.selectedCell],"se-selected-cell-focus");const t=this.#N.fixedCell?.closest("table");if(t){const e=t.querySelectorAll(".se-selected-table-cell");for(let t=0,s=e.length;t<s;t++)Ve.utils.removeClass(e[t],"se-selected-table-cell")}}recallStyleSelectedCells(){if(this.#N.selectedCells){const t=this.#N.selectedCells;for(let e=0,s=t.length;e<s;e++)Ve.utils.addClass(t[e],"se-selected-table-cell")}}focusCellEdge(t){Ae.isMobile||this.#J.focusManager.focusEdge(t)}#ud(t){this.#J.store.set("_preventBlur",!0);const e=Ve.query.getParentElement(Ve.query.getEventTarget(t),Ve.check.isTableCell);if(this.#N.isShiftPressed){if(e===this.#N.fixedCell)return this.#Wc.setState("isShiftPressed",!1),this.deleteStyleSelectedCells(),this.#Wc._editorEnable(!0),void this.#si();this.#Wc._editorEnable(!1)}else if(!this.#N.ref){if(e===this.#N.fixedCell)return;this.#Wc._editorEnable(!1)}e&&e!==this.#N.selectedCell&&this.#dd===e.nodeName&&this.#N.selectedTable===Ve.query.getParentElement(e,"TABLE")&&(this.#Wc.setState("selectedCell",e),this.setMultiCells(this.#N.fixedCell,this.#N.selectedCell))}#pd(t){t.stopPropagation(),this.#N.isShiftPressed?this.#fi.touchOff&&=this.#J.eventManager.removeGlobalEvent(this.#fi.touchOff):(this.#Wc._editorEnable(!0),this.#si());const e=this.#N.fixedCell;if(!e||!this.#N.selectedTable)return;if(this.#Gc.setMergeSplitButton(),this.#Wc.setState("selectedCells",Array.from(this.#N.selectedTable.querySelectorAll(".se-selected-table-cell"))),this.#N.isShiftPressed)return;e&&this.#N.selectedCell&&(this.focusCellEdge(e),e===this.#N.selectedCell&&Ve.utils.removeClass(e,"se-selected-table-cell"));const s=this.#N.selectedCells?.length>0?this.#N.selectedCell:e;this.#Wc._setController(s)}#gd(){if(this.#N.ref){this.#si(),this.#Wc._editorEnable(!0),this.focusCellEdge(this.#N.fixedCell);const t=this.#N.selectedCells?.length>0?this.#N.selectedCell:this.#N.fixedCell;this.#Wc._setController(t)}else this.#Wc._closeController()}#md(){this.#Wc.resetInfo()}#si(){this.#J.ui.disableBackWrapper();const t=this.#fi;for(const e in t)t[e]&&=this.#J.eventManager.removeGlobalEvent(t[e])}init(){this.#si()}},{_w:Ja}=Ae;const Qa=class{#Wc;#N;#J;constructor(t,{pluginOptions:e,controller_table:s}){this.#Wc=t,this.#N=t.state,this.#J=t.$,this.sliderType="",this.resizeButton=s.querySelector("._se_table_resize"),this.resizeText=s.querySelector("._se_table_resize > span > span"),this.columnFixedButton=s.querySelector("._se_table_fixed_column"),this.headerButton=s.querySelector("._se_table_header"),this.captionButton=s.querySelector("._se_table_caption");const i=function({lang:t,icons:e,options:s}){const i=s.get("_rtl")?["right","center","left","justify"]:["left","center","right","justify"];let n="";for(let s,o,l=0;l<i.length;l++)s=i[l],o=t["align"+s.charAt(0).toUpperCase()+s.slice(1)],n+=`\n\t\t<button type="button" class="se-btn se-tooltip" data-command="props_align" data-value="${s}" title="${o}" aria-label="${o}">\n\t\t\t${e["align_"+s]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${o}</span>\n\t\t\t</span>\n\t\t</button>`;const o=["top","middle","bottom"];let l="";for(let s,i,n=0;n<o.length;n++)s=o[n],i=t["align"+s.charAt(0).toUpperCase()+s.slice(1)],l+=`\n\t\t<button type="button" class="se-btn se-tooltip" data-command="props_align_vertical" data-value="${s}" title="${i}" aria-label="${i}">\n\t\t\t${e["align_"+s]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${i}</span>\n\t\t\t</span>\n\t\t</button>`;const r=`\n\t\t<div class="se-controller-content">\n\t\t\t<div class="se-controller-header">\n\t\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn close" title="${t.close}" aria-label="${t.close}">${e.cancel}</button>\n\t\t\t\t<span class="se-controller-title">${t.tableProperties}</span>\n\t\t\t</div>\n\t\t\t<div class="se-controller-body">\n\n\t\t\t\t<span>${t.border}</span>\n\t\t\t\t<div class="se-form-group se-form-w0">\n\t\t\t\t\t<button type="button" data-command="props_onborder_format" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e[ka.all]}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.border}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_onborder_style" class="se-btn se-btn-select se-tooltip se-border-style">\n\t\t\t\t\t\t<span class="se-txt"></span>\n\t\t\t\t\t\t${e.arrow_down}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.border}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-color-input __se_border_color" placeholder="${t.color}" />\n\t\t\t\t\t<button type="button" data-command="props_onpalette" data-value="border" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.color_palette}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.colorPicker}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-input-control __se__border_size" placeholder="${t.width}" />\n\t\t\t\t</div>\n\n\t\t\t\t<span>${t.color}</span>\n\t\t\t\t<div class="se-form-group se-form-w0">\n\t\t\t\t\t<button type="button" data-command="props_onpalette" data-value="font" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.font_color}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.fontColor}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-color-input __se_font_color" placeholder="${t.fontColor}" />\n\t\t\t\t\t<button type="button" data-command="props_onpalette" data-value="back" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.background_color}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.backgroundColor}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-color-input __se_back_color" placeholder="${t.backgroundColor}" />\n\t\t\t\t</div>\n\n\t\t\t\t<span>${t.font}</span>\n\t\t\t\t<div class="se-form-group se-form-w0">\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="bold" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.bold}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.bold}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="underline" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.underline}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.underline}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="italic" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.italic}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.italic}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="strike" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.strike}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.strike}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\n\t\t\t\t<div class="se-table-props-align">\n\t\t\t\t\t<span>${t.align} <span class="__se__a_table_t">( ${t.table} )</span></span>\n\t\t\t\t\t<div class="se-form-group se-form-w0 se-list-inner">\n\t\t\t\t\t\t<div class="__se__a_h">\n\t\t\t\t\t\t\t${n}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="__se__a_v">\n\t\t\t\t\t\t\t${l}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="se-form-group se-form-w0 se-form-flex-btn">\n\t\t\t\t<button type="button" class="se-btn se-btn-success" data-command="props_submit" title="${t.submitButton}" aria-label="${t.submitButton}">${e.checked}</button>\n\t\t\t\t<button type="button" class="se-btn se-btn-danger" data-command="revert" title="${t.revert}" aria-label="${t.revert}">${e.revert}</button>\n\t\t\t</div>\n\t\t</div>`,a=Ve.utils.createElement("DIV",{class:"se-controller se-table-props"},r);return{html:a,controller_props_title:a.querySelector(".se-controller-title"),borderButton:a.querySelector('[data-command="props_onborder_style"]'),borderFormatButton:a.querySelector('[data-command="props_onborder_format"]'),cell_alignment:a.querySelector(".se-table-props-align .__se__a_h"),cell_alignment_vertical:a.querySelector(".se-table-props-align .__se__a_v"),cell_alignment_table_text:a.querySelector(".se-table-props-align .__se__a_table_t"),border_style:a.querySelector('[data-command="props_onborder_style"] .se-txt'),border_color:a.querySelector(".__se_border_color"),border_width:a.querySelector(".__se__border_size"),back_color:a.querySelector(".__se_back_color"),font_color:a.querySelector(".__se_font_color"),palette_border_button:a.querySelector('[data-command="props_onpalette"][data-value="border"]'),font_bold:a.querySelector('[data-command="props_font_style"][data-value="bold"]'),font_underline:a.querySelector('[data-command="props_font_style"][data-value="underline"]'),font_italic:a.querySelector('[data-command="props_font_style"][data-value="italic"]'),font_strike:a.querySelector('[data-command="props_font_style"][data-value="strike"]')}}(this.#J),n=[this.#Wc.controller_table,this.#Wc.controller_cell];this.controller_props=new Ti(this,this.#J,i.html,{position:"bottom",parents:n,isInsideForm:!0}),this.controller_props_title=i.controller_props_title;const o=Ve.utils.createElement("DIV",{class:"se-controller se-list-layer"},null);this.controller_colorPicker=new Ti(this,this.#J,o,{position:"bottom",parents:[this.controller_props].concat(n),isInsideForm:!0,isWWTarget:!1,initMethod:()=>{this.colorPicker.hueSlider.close(),Ve.utils.removeClass(this.controller_colorPicker.currentTarget,"on")}}),this.colorPicker=new _r(this,this.#J,"",{form:o,colorList:e.colorList||La,splitNum:5,disableRemove:!0,hueSliderOptions:{controllerOptions:{isOutsideForm:!0,parents:[this.controller_colorPicker],parentsHide:!0}}});const l=function(){let t="";for(let e,s=0,i=$a.length;s<i;s++)e=$a[s],t+=`\n\t\t<div title="${e}" aria-label="${e}" style="padding: 0 12px;">\n\t\t\t<span class="se-txt">${e}</span>\n\t\t</div>`;const e=Ve.utils.createElement("DIV",null,t);return{items:$a,menus:e.querySelectorAll("div")}}(),r=i.borderButton;this.selectMenu_props_border=new Hi(this.#J,{checkList:!1,position:"bottom-center"}),this.selectMenu_props_border.on(r,this.#bd.bind(this)),this.selectMenu_props_border.create(l.items,l.menus);const a=Ua(this.#J.lang,this.#J.icons,[]),h=i.borderFormatButton;this.selectMenu_props_border_format=new Hi(this.#J,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:5}),this.selectMenu_props_border_format.on(h,this.#yd.bind(this,"all")),this.selectMenu_props_border_format.create(a.items,a.menus);const c=Ua(this.#J.lang,this.#J.icons,Sa);this.selectMenu_props_border_format_oneCell=new Hi(this.#J,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:6}),this.selectMenu_props_border_format_oneCell.on(h,this.#yd.bind(this,"outside")),this.selectMenu_props_border_format_oneCell.create(c.items,c.menus),this.maxText=this.#J.lang.maxSize,this.minText=this.#J.lang.minSize,this.propTargets={cell_alignment:i.cell_alignment,cell_alignment_vertical:i.cell_alignment_vertical,cell_alignment_table_text:i.cell_alignment_table_text,border_format:h,border_style:i.border_style,border_color:i.border_color,border_width:i.border_width,back_color:i.back_color,font_color:i.font_color,palette_border_button:i.palette_border_button,font_bold:i.font_bold,font_underline:i.font_underline,font_italic:i.font_italic,font_strike:i.font_strike},this._propsCache=[],this._currentFontStyles=[],this._propsAlignCache="",this._propsVerticalAlignCache="",this._typeCache=""}get#Uc(){return this.#Wc.selectionService}colorPickerAction(t){this.applyColorPicker(t)}controllerAction(t){const e=t.getAttribute("data-command");if(!e)return;const s=t.getAttribute("data-value");switch(e){case"props_onborder_format":this.openBorderFormatMenu();break;case"props_onborder_style":this.openBorderStyleMenu();break;case"props_onpalette":this.openColorPalette(t,s);break;case"props_font_style":this.toggleFontStyle(s);break;case"props_submit":this.submitProps(t);break;case"props_align":this.setAlignProps(t.getAttribute("data-value"));break;case"props_align_vertical":this.setVerticalAlignProps(t.getAttribute("data-value"))}}openTableProps(t){this.controller_props.currentTarget===t&&"block"===this.controller_props.form?.style.display?this.controller_props.close():(this.controller_props_title.textContent=this.#J.lang.tableProperties,this.#Cd("table"),this.controller_props.open(t,this.#Wc.controller_table.form,{isWWTarget:!1,initMethod:null,addOffset:null}))}openCellProps(t){this.controller_props.currentTarget===t&&"block"===this.controller_props.form?.style.display?this.controller_props.close():(this.controller_props_title.textContent=this.#J.lang.cellProperties,this.#Cd("cell"),this.controller_props.open(t,this.#Wc.controller_cell.form,{isWWTarget:!1,initMethod:null,addOffset:null}))}openBorderFormatMenu(){1===this._propsCache.length?this.selectMenu_props_border_format_oneCell.open():this.selectMenu_props_border_format.open()}openBorderStyleMenu(){this.selectMenu_props_border.open()}openColorPalette(t,e){const{back_color:s,font_color:i,border_color:n}=this.propTargets,o="border"===e?n:"back"===e?s:i;this.controller_colorPicker.isOpen&&e===this.sliderType?this.controller_colorPicker.close():(this.sliderType=e,Ve.utils.addClass(t,"on"),this.colorPicker.init(o?.value||"",t),this.controller_colorPicker.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null}))}toggleFontStyle(t){Ve.utils.toggleClass(this.propTargets[`font_${t}`],"on")}toggleHeader(){const t=this.headerButton,e=Ve.utils.hasClass(t,"active"),s=this.#Wc._element;if(Wa(s),e)Ve.utils.removeItem(s.querySelector("thead"));else{const t=Ve.utils.createElement("THEAD");t.innerHTML="<tr>"+za("th",this.#N.logical_cellCnt)+"</tr>",s.insertBefore(t,s.querySelector("tbody"))}Ve.utils.toggleClass(t,"active"),/TH/i.test(this.#N.tdElement.nodeName)?this.#Wc._closeController():this.#Wc._setCellControllerPosition(this.#N.tdElement,!1)}toggleCaption(){const t=this.captionButton,e=Ve.utils.hasClass(t,"active"),s=this.#Wc._element;if(e)Ve.utils.removeItem(s.querySelector("caption"));else{const t=Ve.utils.createElement("CAPTION",{class:`se-table-caption-${this.#Wc.captionPosition}`});t.innerHTML="<div><br></div>",s.insertBefore(t,s.firstElementChild)}Ve.utils.toggleClass(t,"active"),this.#Wc._setCellControllerPosition(this.#N.tdElement,!1)}resetHeaderButton(t){t.querySelector("thead")?Ve.utils.addClass(this.headerButton,"active"):Ve.utils.removeClass(this.headerButton,"active")}resetCaptionButton(t){t.querySelector("caption")?Ve.utils.addClass(this.captionButton,"active"):Ve.utils.removeClass(this.captionButton,"active")}resetPropsAlign(){const{cell_alignment:t}=this.propTargets,e=t.querySelector('[data-value="left"]'),s=t.querySelector('[data-value="right"]'),i=e.parentElement,n=s.parentElement;i.appendChild(s),n.appendChild(e)}revertProps(){const t=this._propsCache;for(let e=0,s=t.length;e<s;e++)t[e][0].style.cssText=t[e][1];this.#wd(this.propTargets.cell_alignment,this._propsAlignCache,!0),this.#wd(this.propTargets.cell_alignment_vertical,this._propsVerticalAlignCache,!0),Ve.check.isTable(t[0][0])&&this.#N.figureElement&&(this.#N.figureElement.style.float=this._propsAlignCache)}applyColorPicker(t){const e=this.propTargets[`${this.sliderType}_color`];e.style.borderColor=e.value=t,this.controller_colorPicker.close()}setAlignProps(t){this.#wd(this.propTargets.cell_alignment,t,!1)}setVerticalAlignProps(t){this.#wd(this.propTargets.cell_alignment_vertical,t,!1)}setTableLayout(t,e,s,i){if(t.includes("width")){const t=this.#N.figureElement;if(!t)return;let s,n;e?(s=this.#J.icons.reduction,n=this.minText,i||(t.style.width="100%")):(s=this.#J.icons.expansion,n=this.maxText,i||(t.style.width="max-content")),Ve.utils.changeElement(this.resizeButton.firstElementChild,s),Ve.utils.changeTxt(this.resizeText,n)}t.includes("column")&&(s?(Ve.utils.removeClass(this.#Wc._element,"se-table-layout-auto"),Ve.utils.addClass(this.#Wc._element,"se-table-layout-fixed"),Ve.utils.addClass(this.columnFixedButton,"active")):(Ve.utils.removeClass(this.#Wc._element,"se-table-layout-fixed"),Ve.utils.addClass(this.#Wc._element,"se-table-layout-auto"),Ve.utils.removeClass(this.columnFixedButton,"active")))}submitProps(t){try{t.disabled=!0;const e=this.#Wc.controller_table.form.contains(this.controller_props.currentTarget),s=e?[this.#Wc._element]:this.#N.selectedCells,i=s[0],n=Ja.getComputedStyle(i),{border_format:o,border_color:l,border_style:r,border_width:a,back_color:h,font_color:c,cell_alignment:d,cell_alignment_vertical:u}=this.propTargets,p=o.getAttribute("se-border-format")||"",g="all"!==p,m=("none"===r.textContent?"":r.textContent)||"",f="none"===p||!m,v=d.getAttribute("se-cell-align")||"",b=u.getAttribute("se-cell-align")||"",y=f?"":l.value.trim()||n.borderColor;let C=f?"":a.value.trim()||n.borderWidth;C+=Oe.is(C)?"px":"";const w=h.value.trim(),_=c.value.trim(),x=g&&!f&&C,$=`${C} ${m} ${y}`,k={left:[],top:[],right:[],bottom:[],middle:[],all:null};if(e){const t=i.style;this.#N.figureElement&&(this.#N.figureElement.style.float=v,this.#N.figureElement.style.verticalAlign=b),t.backgroundColor=w,t.color=_,this.#_d(t),x||(t.border=f?t.borderLeft=t.borderTop=t.borderRight=t.borderBottom="":$),k.left=k.top=k.right=k.bottom=s}else{const t=i.parentElement;let{rs:e,re:n,cs:o,ce:l}=this.#N.ref||{rs:t.rowIndex||0,re:t.rowIndex||0,cs:i.cellIndex||0,ce:i.cellIndex||0};const r=new Array(n-e+1).fill(0).map((()=>new Array(l-o+1).fill(0))),a=o;n-=e,e-=e,l-=o,o-=o;let h=t;for(let t,i,c,d,u,p=0,g=0,m=s.length,y=0;p<m;p++,g++){t=s[p],d=t.colSpan,u=t.rowSpan,c=t.cellIndex-a,h!==t.parentElement&&(y++,g=0,h=t.parentElement);let m=0;for(;m<=c;)c+=r[y][m]||0,m++;try{if(u>1){const t=u-1;for(let e=y;e<=y+t;e++)r[e][c]+=d-(y===e?1:0)}else d>1&&(r[y][c]+=d-1)}catch{}const C=y+u-1===n;y===e&&k.top.push(t),(y===n||C)&&k.bottom.push(t),c===o&&k.left.push(t),c!==l&&c+d-1!==l||k.right.push(t),C||y===e||y===n||c===o||c===l||k.middle.push(t),i=t.style,i.textAlign=v,i.verticalAlign=b,i.backgroundColor=w,i.color=_,this.#_d(i),x||(i.border=f?i.borderLeft=i.borderTop=i.borderRight=i.borderBottom="":$)}0===k.middle.length&&(k.middle=s)}k.all=s,x&&this.#xd(k,p,$),this.#Wc.historyPush(),this.controller_props.close(),this.#N.tdElement&&(this.#Uc.recallStyleSelectedCells(),this.#Wc.setCellInfo(this.#N.tdElement,!0),Ve.utils.addClass(this.#N.tdElement,"se-selected-cell-focus"))}catch(t){console.warn("[SUNEDITOR.plugins.table.setProps.error]",t)}finally{t.disabled=!1}}closeProps(){this.controller_props.close(),this.controller_colorPicker.close()}#Cd(t){this._typeCache=t;const e="table"===t,s=e?[this.#Wc._element]:this.#N.selectedCells;if(!s?.[0])return;const{border_format:i,border_color:n,border_style:o,border_width:l,back_color:r,font_color:a,cell_alignment:h,cell_alignment_vertical:c,cell_alignment_table_text:d,font_bold:u,font_underline:p,font_italic:g,font_strike:m}=this.propTargets,{border:f,backgroundColor:v,color:b,textAlign:y,verticalAlign:C,fontWeight:w,textDecoration:_,fontStyle:x}=Ja.getComputedStyle(s[0]),$=this.#$d(f);h.querySelector('[data-value="justify"]').style.display=e?"none":"",d.style.display=e?"":"none",c.style.display=e?"none":"";let k=Ie.rgb2hex($.c),S=$.s,E=$.w,T=Ie.rgb2hex(v),M=Ie.rgb2hex(b),H=/.+/.test(w),L=/underline/i.test(_),N=/line-through/i.test(_),A=/italic/i.test(x),B=e?this.#N.figureElement?.style.float:y,I=C;this._propsCache=[];for(let t,i,n=0;t=s[n];n++){const{cssText:s,border:n,backgroundColor:o,color:l,textAlign:r,verticalAlign:a,fontWeight:h,textDecoration:c,fontStyle:d}=t.style;if(this._propsCache.push([t,s]),i)continue;const{c:u,s:p,w:g}=this.#$d(n);let m=o,f=l;if(m||f){const e=Ja.getComputedStyle(t);m&&(m=e.backgroundColor),f&&(f=e.color)}k&&$.c!==u&&(k=""),S&&$.s!==p&&(S=""),E&&$.w!==g&&(E=""),T!==Ie.rgb2hex(m)&&(T=""),M!==Ie.rgb2hex(f)&&(M=""),B!==(e?this.#N.figureElement?.style.float:r)&&(B=""),I&&I!==a&&(I=""),H&&H!==/.+/.test(h)&&(H=!1),L&&L!==/underline/i.test(c)&&(L=!1),N&&N!==/line-through/i.test(c)&&(N=!1),A&&A!==/italic/i.test(d)&&(A=!1),k&&S&&E&&T&&M||(i=!0)}i.firstElementChild.innerHTML=this.#J.icons[ka[1===s.length?"outside":"all"]],i.setAttribute("se-border-format","all"),Ve.utils.removeClass(i,"active"),S||=$a[0],o.textContent=S,n.style.borderColor=n.value=k,l.value=E,this.#kd(S===$a[0]),r.value=r.style.borderColor=T,a.value=a.style.borderColor=M,H&&Ve.utils.addClass(u,"on"),L&&Ve.utils.addClass(p,"on"),N&&Ve.utils.addClass(m,"on"),A&&Ve.utils.addClass(g,"on"),this.#wd(h,this._propsAlignCache=B,!0),this.#wd(c,this._propsVerticalAlignCache=I,!0)}#_d(t){const{font_bold:e,font_italic:s,font_strike:i,font_underline:n}=this.propTargets;t.fontWeight=Ve.utils.hasClass(e,"on")?"bold":"",t.fontStyle=Ve.utils.hasClass(s,"on")?"italic":"",t.textDecoration=((Ve.utils.hasClass(i,"on")?"line-through ":"")+(Ve.utils.hasClass(n,"on")?"underline":"")).trim()}#$d(t){const e=t.split(/\s(?![^()]*\))/);let s="",i="",n="";return 3===e.length?(s=e[0],i=e[1],n=e[2]):2===e.length?/\d/.test(e[0])?(s=e[0],i=e[1]):(i=e[0],n=e[1]):1===e.length&&(/\d/.test(e[0])?s=e[0]:i=e[0]),{w:s,s:i,c:Ie.rgb2hex(n)}}#xd(t,e,s){const{left:i,top:n,right:o,bottom:l,all:r}=t;switch(e){case"inside":if(1===r.length)return;Ve.utils.setStyle(r.filter((t=>!l.includes(t))),Ha,s),Ve.utils.setStyle(r.filter((t=>!o.includes(t))),Ma,s);break;case"horizon":if(1===r.length)return;Ve.utils.setStyle(r.filter((t=>!l.includes(t))),Ha,s);break;case"vertical":if(1===r.length)return;Ve.utils.setStyle(r.filter((t=>!o.includes(t))),Ma,s);break;case"outside":Ve.utils.setStyle(i,Ea,s),Ve.utils.setStyle(n,Ta,s),Ve.utils.setStyle(o,Ma,s),Ve.utils.setStyle(l,Ha,s);break;case"left":Ve.utils.setStyle(i,Ea,s);break;case"top":Ve.utils.setStyle(n,Ta,s);break;case"right":Ve.utils.setStyle(o,Ma,s);break;case"bottom":Ve.utils.setStyle(l,Ha,s)}}#kd(t){const{border_color:e,border_width:s,palette_border_button:i}=this.propTargets;t?(e.disabled=!0,s.disabled=!0,i.disabled=!0,s.disabled=!0):(e.disabled=!1,s.disabled=!1,i.disabled=!1,s.disabled=!1)}#wd(t,e,s){Ve.utils.removeClass(t.querySelectorAll("button"),"on"),s||t.getAttribute("se-cell-align")!==e?(Ve.utils.addClass(t.querySelector(`[data-value="${e}"]`),"on"),t.setAttribute("se-cell-align",e)):t.setAttribute("se-cell-align","")}#bd(t){this.propTargets.border_style.textContent=t,this.#kd(t===$a[0]),this.selectMenu_props_border.close()}#yd(t,e){const{border_format:s}=this.propTargets;s.setAttribute("se-border-format",e),s.firstElementChild.innerHTML=this.#J.icons[ka[e]],e!==t?Ve.utils.addClass(s,"active"):Ve.utils.removeClass(s,"active"),this.selectMenu_props_border_format.close(),this.selectMenu_props_border_format_oneCell.close()}init(){const{border_format:t,border_color:e,border_style:s,border_width:i,back_color:n,font_color:o,cell_alignment:l,cell_alignment_vertical:r,font_bold:a,font_underline:h,font_italic:c,font_strike:d}=this.propTargets;Ve.utils.removeClass([t,e,s,i,n,o,l,r,a,h,c,d],"on")}},{_w:th,ON_OVER_COMPONENT:eh}=Ae;class sh extends Vr{static key="table";static className="";static options={isInputComponent:!0};static component(t){return Ve.check.isTable(t)?t:null}#Sd;#Ed;#Td;#Md;#Hd;#Ld=[];#Nd=!0;#Ad=!1;#Bd=!1;constructor(t,e){super(t),this.title=this.$.lang.table,this.icon="table",this.figureScrollList=["se-scroll-figure-xy","se-scroll-figure-x","se-scroll-figure-y"],this.figureScroll="string"==typeof e.scrollType?e.scrollType.toLowerCase():"x",this.captionPosition="bottom"!==e.captionPosition?"top":"bottom",this.cellControllerTop="table"==("cell"!==e.cellControllerPosition?"table":"cell");const s=Ve.utils.createElement("DIV",{class:"se-dropdown se-selector-table"},'\n\t<div class="se-table-size">\n\t\t<div class="se-table-size-picker se-controller-table-picker"></div>\n\t\t<div class="se-table-size-highlighted"></div>\n\t\t<div class="se-table-size-unhighlighted"></div>\n\t</div>\n\t<div class="se-table-size-display">1 x 1</div>'),i=s.querySelector(".se-controller-table-picker"),n=function({lang:t,icons:e}){const s=`\n\t<div class="se-arrow se-arrow-down se-visible-hidden"></div>\n\t<div class="se-btn-group">\n\t\t<button type="button" data-command="openTableProperties" class="se-btn se-tooltip">\n\t\t\t${e.table_properties}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.tableProperties}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="layout" class="se-btn se-tooltip _se_table_fixed_column">\n\t\t\t${e.fixed_column_width}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.fixedColumnWidth}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="header" class="se-btn se-tooltip _se_table_header">\n\t\t\t${e.table_header}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.tableHeader}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="caption" class="se-btn se-tooltip _se_table_caption">\n\t\t\t${e.caption}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.caption}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="resize" class="se-btn se-tooltip _se_table_resize">\n\t\t\t${e.reduction}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.minSize}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="copy" class="se-btn se-tooltip">\n\t\t\t${e.copy}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.copy}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="remove" class="se-btn se-tooltip">\n\t\t\t${e.delete}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.remove}</span>\n\t\t\t</span>\n\t\t</button>\n\t</div>`;return Ve.utils.createElement("DIV",{class:"se-controller se-controller-table"},s)}(this.$),o=function({lang:t,icons:e},s){const i=`\n\t<div class="se-arrow se-arrow-${s?"down se-visible-hidden":"up"}"></div>\n <div class="se-btn-group">\n\t\t<button type="button" data-command="openCellProperties" class="se-btn se-tooltip">\n\t\t\t${e.cell_properties}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.cellProperties}</span>\n\t\t\t</span>\n\t\t</button>\n <button type="button" data-command="oncolumn" class="se-btn se-tooltip">\n ${e.table_column}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.column}</span>\n </span>\n </button>\n <button type="button" data-command="onrow" class="se-btn se-tooltip">\n ${e.table_row}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.row}</span>\n </span>\n </button>\n <button type="button" data-command="merge" class="se-btn se-tooltip" style="display: none;">\n ${e.merge_cell}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.mergeCells}</span>\n </span>\n </button>\n <button type="button" data-command="onsplit" class="se-btn se-tooltip">\n ${e.split_cell}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.splitCells}</span>\n </span>\n </button>\n\t\t<button type="button" data-command="unmerge" class="se-btn se-tooltip">\n ${e.unmerge_cell}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.unmergeCells}</span>\n </span>\n </button>\n </div>`,n=Ve.utils.createElement("DIV",{class:"se-controller se-controller-table-cell"},i);return{html:n,splitButton:n.querySelector('[data-command="onsplit"]'),columnButton:n.querySelector('[data-command="oncolumn"]'),rowButton:n.querySelector('[data-command="onrow"]'),mergeButton:n.querySelector('[data-command="merge"]'),unmergeButton:n.querySelector('[data-command="unmerge"]')}}(this.$,this.cellControllerTop);this.$.contextProvider.applyToRoots((t=>{t.get("wrapper").appendChild(Ve.utils.createElement("DIV",{class:Ca.replace(/^\./,"")})),t.get("wrapper").appendChild(Ve.utils.createElement("DIV",{class:wa.replace(/^\./,"")})),t.get("wrapper").appendChild(Ve.utils.createElement("DIV",{class:_a.replace(/^\./,"")})),t.get("wrapper").appendChild(Ve.utils.createElement("DIV",{class:xa.replace(/^\./,"")}))})),this.cellControllerTop?(this.controller_cell=new Ti(this,this.$,o.html,{position:"top"}),this.controller_table=new Ti(this,this.$,n,{position:"top"}),this.controller_cell.sibling=this.controller_table.form,this.controller_table.sibling=this.controller_cell.form,this.controller_table.siblingMain=!0):(this.controller_table=new Ti(this,this.$,n,{position:"top"}),this.controller_cell=new Ti(this,this.$,o.html,{position:"bottom"})),this.figure=new Fi(this,this.$,null,{}),this._element=null,this.state=Na,this.#Sd=s,this.#Ed=s.querySelector(".se-table-size-highlighted"),this.#Td=s.querySelector(".se-table-size-unhighlighted"),this.#Md=s.querySelector(".se-table-size-display");const l=ih.bind(this,!0),r=ih.bind(this,!1),a={...o,openCellMenuFunc:l,closeCellMenuFunc:r};this.cellService=new Za(this,a),this.clipboardService=new Ga(this),this.gridService=new ja(this,a),this.resizeService=new Ya(this),this.selectionService=new Xa(this),this.styleService=new Qa(this,{pluginOptions:e,controller_table:n}),this.$.menu.initDropdownTarget(sh,s),this.$.eventManager.addEvent(i,"mousemove",this.#Id.bind(this)),this.$.eventManager.addEvent(i,"click",this.#Vd.bind(this))}setState(t,e){this.state[t]=e}#Od(){Object.assign(this.state,Na)}off(){this.#Rd()}componentSelect(t){if(this.#Pd(t),this.state.figureElement||this.setTableInfo(t),this.#Nd="100%"===this.state.figureElement?.style.width,this.#Ad=Ve.utils.hasClass(t,"se-table-layout-fixed")||"fixed"===t.style.tableLayout,this.styleService.setTableLayout(this.#Nd?"width|column":"width",this.#Nd,this.#Ad,!0),yi.get("__overInfo")===eh)return;if(!this.state.tdElement)return;this.setCellInfo(this.state.tdElement,!0);const e=this.state.selectedCells?.length>1,s=Ve.query.getParentElement(t,Ve.check.isFigure);this.controller_table.open(s,null,{isWWTarget:!1,initMethod:null,addOffset:null,disabled:e}),this.state.fixedCell&&(this.cellService.setUnMergeButton(),this.controller_cell.open(this.state.tdElement,this.cellControllerTop?s:null,{isWWTarget:!1,initMethod:null,addOffset:null,disabled:e}))}componentDeselect(){this.resetInfo()}componentDestroy(t){if(!t)return;const e=t.parentNode;Ve.utils.removeItem(t),this._closeTableSelectInfo(),e!==this.$.frameContext.get("wysiwyg")&&this.$.nodeTransform.removeAllParents(e,(function(t){return 0===t.childNodes.length}),null),this.$.focusManager.focus(),this.$.history.push(!1)}componentCopy({event:t,cloneContainer:e}){const s=e.querySelectorAll(".se-selected-table-cell");Ve.utils.removeClass(s,"se-selected-table-cell|se-selected-cell-focus"),s.length>0&&(this.clipboardService.copySelectedTableCells(t,e,s),this.$.ui.showToast(this.$.lang.message_copy_success,550))}onPaste({event:t,doc:e}){const s=Ve.query.getParentElement(Ve.query.getEventTarget(t),Ve.check.isTableCell);if(!s)return;const i=e.body;if(1!==i.childElementCount)return;const n=this.$.component.get(i.firstElementChild);if(n?.pluginName!==sh.key)return;const o=n.target,l=this.clipboardService.pasteTableCellMatrix(o,s),{fixedCell:r,selectedCell:a}=this.selectionService.selectCells(l);return this.setState("selectedCells",l),this.setState("fixedCell",r),this.setState("selectedCell",a),this.setState("selectedTable",Ve.query.getParentElement(r,"TABLE")),!1}retainFormat(){return{query:"table",method:t=>{const e=t.querySelector("colgroup");let s=Ve.check.isFigure(t.parentNode)?t.parentNode:null;if(!e){const e=t.rows,s=function(t){const e=t.rows;let s=0;for(let t=0,i=e.length;t<i;t++){const i=e[t].cells;let n=0;for(let t=0,e=i.length;t<e;t++)n+=i[t].colSpan;s=Math.max(s,n)}return s}(t),i=new Array(s).fill(null);for(let t,n=0,o=e.length;n<o;n++){const o=e[n].cells;t=o.length;let l=0;const r=new Array(s).fill(!1);for(let e=0;e<t;e++){const t=o[e],n=t.style.width,a=t.colSpan||1;for(;l<s&&r[l];)l++;if(l>=s)break;n&&!i[l]&&(i[l]=n);for(let t=0;t<a;t++){if(l+t>=s||!n)continue;r[l+t]=!0;const e=Oe.get(n,-1);for(let t=0;t<a;t++){const o=l+t;if(o>=s)continue;const r=i[o];if(null===r)i[o]=`width: ${n};`;else{const t=Oe.get(r.replace("width: ","").replace(";",""),-1);1===a&&e!==t&&(i[o]=`width: ${n};`)}}}l+=a}if(t===s)break}const n=[];for(let t=0;t<s;t++){const e=i[t]?` style="${i[t]}"`:"";n.push(`<col${e}>`)}const o=Ve.utils.createElement("colgroup",null,n.join(""));t.insertBefore(o,t.firstElementChild);for(let t=0;t<e.length;t++){const s=e[t].cells;for(let t=0;t<s.length;t++)Ve.utils.setStyle(s[t],"width","")}}s?Ve.utils.addClass(s,"se-flex-component|se-input-component"):(s=Ve.utils.createElement("FIGURE",{class:"se-flex-component se-input-component"}),t.parentNode.insertBefore(s,t),s.appendChild(t));const i=t.style.width;if(i&&(s.style.width="auto"===i?"max-content":i,Ve.utils.setStyle(t,"width","")),this.figureScroll){const t=`se-scroll-figure-${this.figureScroll}`;Ve.utils.addClass(s,t),Ve.utils.removeClass(s,this.figureScrollList.filter((e=>e!==t)).join("|"))}else Ve.utils.removeClass(s,this.figureScrollList.join("|"))}}}setDir(){this.#Rd(),this.styleService.resetPropsAlign()}onMouseMove({event:t}){if(this.resizeService.isResizing())return;const e=Ve.query.getEventTarget(t),s=Ve.query.getParentElement(e,Va);s&&1!==t.buttons?!1!==this.resizeService.onResizeGuide(t,s)&&(this._element&&(this._element.style.cursor=""),this.resizeService.offResizeGuide()):this.resizeService.offResizeGuide()}onMouseDown({event:t}){this.setState("ref",null),this.setState("selectedCell",null);const e=Ve.query.getEventTarget(t);if(this._element&&Ve.query.getParentElement(e,Oa))return void this._closeController();const s=Ve.query.getParentElement(e,Va);s&&(this.cellControllerTop||this.controller_cell.hide(),!1!==this.resizeService.readyResizeFromEdge(t,s)&&(this.state.isShiftPressed&&s!==this.state.fixedCell||(this.selectionService.deleteStyleSelectedCells(),/^TR$/i.test(s.nodeName)||(this.#Bd=!1,this.selectionService.startCellSelection(s,!1)))))}onMouseUp(){this.setState("isShiftPressed",!1)}onMouseLeave(){this.resizeService.offResizeGuide()}onKeyDown({event:t,range:e,line:s}){this.setState("ref",null);const i=t.code,n=Re.isTab(i);if(this.$.ui.selectMenuOn||this.resizeService.isResizing()||!n&&this.#Bd||Re.isCtrl(t))return;if(this.cellControllerTop||this.controller_cell.hide(),this.#Bd=Re.isShift(t),n){this.selectionService.deleteStyleSelectedCells();const i=Ve.query.getParentElement(s,Ve.check.isTableCell);if(i&&e.collapsed&&Ve.check.isEdgePoint(e.startContainer,e.startOffset)){this._closeController();const e=this.#Bd;this.setState("isShiftPressed",this.#Bd=!1);const s=Ve.query.getParentElement(i,"table"),n=Ve.query.getListChildren(s,Ve.check.isTableCell,null),o=e?Ve.utils.prevIndex(n,i):Ve.utils.nextIndex(n,i);if(o===n.length&&!e){if(!Ve.query.getParentElement(i,"thead")){const t=s.rows,e=this.gridService.insertBodyRow(s,t.length,this.state.cellCnt).querySelector("td div");this.$.selection.setRange(e,0,e,0)}return t.preventDefault(),t.stopPropagation(),!1}if(-1===o&&e)return!1;const l=n[o];if(!l)return;const r=l.firstElementChild||l;return this.$.selection.setRange(r,0,r,0),t.preventDefault(),t.stopPropagation(),!1}}let o=null;if(!Re.isShift(t)){if(o=Ve.query.getParentElement(s,Ve.check.isTableCell),!Ve.utils.hasClass(o,"se-selected-cell-focus"))return;return this.selectionService.deleteStyleSelectedCells(),this._editorEnable(!0),this.#zd(),void this._closeController()}return this.state.isShiftPressed||this.state.ref?void 0:(o||=Ve.query.getParentElement(s,Ve.check.isTableCell),o?(this.#Bd=t.shiftKey,this.setState("fixedCell",o),this._closeController(),this.selectionService.startCellSelection(o,this.#Bd),!1):void 0)}onKeyUp({line:t}){this.#Bd=!1,this.state.isShiftPressed&&Ve.query.getParentElement(t,Ve.check.isTableCell)===this.state.fixedCell&&(this.selectionService.deleteStyleSelectedCells(),this._editorEnable(!0),this.#zd()),this.setState("isShiftPressed",!1)}onScroll(){this.resizeService.offResizeGuide()}controllerAction(t){const e=t.getAttribute("data-command");if(e){switch(e){case"header":this.styleService.toggleHeader(),this.historyPush();break;case"caption":this.styleService.toggleCaption(),this.historyPush();break;case"onsplit":this.cellService.openSplitMenu();break;case"oncolumn":this.gridService.openColumnMenu();break;case"onrow":this.gridService.openRowMenu();break;case"openTableProperties":this.styleService.openTableProps(t);break;case"openCellProperties":this.styleService.openCellProps(t);break;case"revert":this.styleService.revertProps();break;case"merge":this.cellService.mergeCells(this.state.selectedCells);break;case"unmerge":this.cellService.unmergeCells(this.state.selectedCells);break;case"resize":this.#Nd=!this.#Nd,this.styleService.setTableLayout("width",this.#Nd,this.#Ad,!1),this.historyPush(),th.setTimeout((()=>{this.$.component.select(this._element,sh.key,{isInput:!0})}),0);break;case"layout":this.#Ad=!this.#Ad,this.styleService.setTableLayout("column",this.#Nd,this.#Ad,!1),this.historyPush(),th.setTimeout((()=>{this.$.component.select(this._element,sh.key,{isInput:!0})}),0);break;case"copy":this.$.component.copy(this.state.figureElement);break;case"remove":this.componentDestroy(this.state.figureElement)}/(^revert|Properties$)/.test(e)||this.styleService.closeProps(),/^(remove|on|open)/.test(e)||this._setCellControllerPosition(this.state.tdElement,this.state.isShiftPressed)}}setCellInfo(t,e){const s=this.setTableInfo(t);if(s&&(this.setState("fixedCell",t),this.setState("trElement",t.parentNode),this.styleService.resetHeaderButton(s),this.styleService.resetCaptionButton(s),e||0===this.state.physical_cellCnt)){this.state.tdElement!==t&&this.setState("tdElement",t),this.state.selectedCells?.length||this.setState("selectedCells",[t]);const e=s.rows;this.setState("trElements",e);const i=t.cellIndex;let n=0;for(let t=0,s=e[0].cells,i=e[0].cells.length;t<i;t++)n+=s[t].colSpan;const o=this.state.trElement.rowIndex;this.setState("rowIndex",o),this.setState("rowCnt",e.length),this.setState("physical_cellCnt",this.state.trElement.cells.length),this.setState("logical_cellCnt",n),this.setState("cellCnt",n),this.setState("physical_cellIndex",i),this.setState("current_colSpan",this.state.tdElement.colSpan-1),this.setState("current_rowSpan",this.state.trElement.cells[i].rowSpan-1);const l=Fa(s,o,i);this.setState("logical_cellIndex",l)}}setRowInfo(t){const e=this.setTableInfo(t).rows;this.setState("trElements",e),this.setState("rowCnt",e.length),this.setState("rowIndex",t.rowIndex)}setTableInfo(t){const e=this._element=Ve.query.getParentElement(t,"TABLE");return this.setState("selectedTable",e),this.setState("figureElement",Ve.query.getParentElement(e,Ve.check.isFigure)||e),e}resetInfo(){this.#zd(),this.selectionService.deleteStyleSelectedCells(),this._editorEnable(!0),this._element=null,this.#Od(),this.#Ld=[],this.#Nd=!1,this.#Ad=!1}historyPush(){this.selectionService.deleteStyleSelectedCells(),this.$.history.push(!1),this.selectionService.recallStyleSelectedCells()}_setController(t){if(!this.$.selection.get().isCollapsed&&!this.state.selectedCell)return void this.selectionService.deleteStyleSelectedCells();this.cellService.setUnMergeButton(),this.setState("tdElement",t),this.state.fixedCell===t&&Ve.utils.addClass(t,"se-selected-cell-focus"),this.state.selectedCells?.length||this.setState("selectedCells",[t]);const e=this.state.selectedTable||this._element||Ve.query.getParentElement(t,"TABLE");this.$.component.select(e,sh.key,{isInput:!0})}_setCellControllerPosition(t,e){this.setCellInfo(t,e),this.cellControllerTop||this.controller_cell.resetPosition(t)}_editorEnable(t){const e=this.$.frameContext.get("wysiwyg");e.setAttribute("contenteditable",t.toString()),t?Ve.utils.removeClass(e,"se-disabled"):Ve.utils.addClass(e,"se-disabled")}_closeController(){this.controller_table.close(!0),this.controller_cell.close(!0)}_closeTableSelectInfo(){this.$.component.deselect(),this._closeController()}#Pd(t){this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,infoOnly:!1})}#Rd(){if(!this.#Ed)return;const t=this.#Ed.style,e=this.#Td.style;t.width="1em",t.height="1em",e.width="5em",e.height="5em",Ve.utils.changeTxt(this.#Md,"1 x 1")}#Id(t){t.stopPropagation();let e=Math.ceil(t.offsetX/18),s=Math.ceil(t.offsetY/18);e=e<1?1:e,s=s<1?1:s;const i=this.$.options.get("_rtl");i&&(e=11-e),this.#Ed.style.width=e+"em",this.#Ed.style.height=s+"em";const n=e<5?5:e>8?10:e+2,o=s<5?5:s>8?10:s+2;if(this.#Td.style.width=n+"em",this.#Td.style.height=o+"em",i){const t=n-(this.#Hd||5);if(0!==t){const e=Oe.get(this.#Sd.style.left);this.#Sd.style.left=e-18*t+"px",this.#Hd=n}}Ve.utils.changeTxt(this.#Md,e+" x "+s),this.#Ld=[e,s]}#Vd(){const t=Ve.utils.createElement("TABLE"),e=this.#Ld[0],s=this.#Ld[1],i=`<tbody>${`<tr>${za("td",e)}</tr>`.repeat(s)}</tbody>`,n=`<colgroup>${`<col style="width: ${Oe.get(100/e,0)}%;">`.repeat(e)}</colgroup>`;t.innerHTML=n+i;let o="";this.figureScroll&&(o=` se-scroll-figure-${this.figureScroll}`);const l=Ve.utils.createElement("FIGURE",{class:"se-flex-component se-input-component"+o,style:"width: 100%;"});if(l.appendChild(t),this.#Nd=!0,this.$.component.insert(l,{insertBehavior:"none"})){this.#Rd(),this.$.menu.dropdownOff();const e=t.querySelector("td div");this.$.selection.setRange(e,0,e,0)}}#zd(){this.resizeService.init(),this.selectionService.init(),this.styleService.init()}}function ih(t){this.controller_cell.bringToTop(t)}const nh=sh;class oh extends Ir{static key="blockStyle";static className="se-btn-select se-btn-tool-format";constructor(t,e){super(t),this.title=this.$.lang.formats,this.inner='<span class="se-txt">'+this.$.lang.formats+"</span>"+this.$.icons.arrow_down;const s=this.$.menu.initDropdownTarget(oh,function({lang:t},e){const s=["p","blockquote","h1","h2","h3","h4","h5","h6"],i=e&&0!==e.length?e:s,n=[];for(let e,o,l,r,a,h,c,d=0,u=i.length;d<u;d++){if(e=i[d],"string"==typeof e){if(!s.includes(e))continue;o=e.toLowerCase(),l="blockquote"===o?"block":"pre"===o?"br-line":"line",a=/^h/.test(o)?o.match(/\d+/)[0]:"",r=t["tag_"+(a?"h":o)]+a,c="",h=""}else o=e.tag.toLowerCase(),l=e.command,r=e.name||o,c=e.class,h=c?' class="'+c+'"':"";n.push({command:l,value:o,title:r,innerHTML:`<${o}${h}>${r}</${o}>`,attrs:{"data-class":c||""}})}return n}(this.$,e.items),{className:"se-list-format"});this.formatList=s.querySelectorAll("li button"),this.currentFormat=""}active(t,e){let s=this.$.lang.formats;const i=e.querySelector(".se-txt");if(t){if(this.$.format.isLine(t)){const e=this.formatList,n=t.nodeName.toLowerCase(),o=(t.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let t,i=0,l=e.length;i<l;i++)if(t=e[i],n===t.getAttribute("data-value")&&o===t.getAttribute("data-class")){s=t.title;break}return Ve.utils.changeTxt(i,s),i.setAttribute("data-value",n),i.setAttribute("data-class",o),!0}}else Ve.utils.changeTxt(i,s);return!1}on(t){const e=this.formatList,s=t.querySelector(".se-txt"),i=(s.getAttribute("data-value")||"")+(s.getAttribute("data-class")||"");if(i!==this.currentFormat){for(let t,s=0,n=e.length;s<n;s++)t=e[s],i===t.getAttribute("data-value")+t.getAttribute("data-class")?Ve.utils.addClass(t,"active"):Ve.utils.removeClass(t,"active");this.currentFormat=i}}action(t){const e=t.getAttribute("data-command"),s=t.firstElementChild;"block"===e?this.$.format.applyBlock(s):"br-line"===e?this.$.format.setBrLine(s):this.$.format.setLine(s),this.$.menu.dropdownOff()}applyHeaderByShortcut({keyCode:t}){const e=t.match(/\d+$/)?.[0],s=Ve.utils.createElement(`H${e}`);this.$.format.setLine(s)}}const lh=oh;class rh extends Ir{static key="layout";static className="";constructor(t,e){super(t),this.title=this.$.lang.layout,this.icon="layout",this.selectedIndex=-1,this.items=e.items,this.$.menu.initDropdownTarget(rh,function(t){t&&0!==t.length||console.warn('[SUNEDITOR.plugins.layout.warn] To use the "layout" plugin, please define the "layouts" option.');return(t||[]).map(((t,e)=>({command:"layout",value:String(e),title:t.name,innerHTML:t.name})))}(this.items))}action(t){const e=Number(t.getAttribute("data-value")),s=this.items[this.selectedIndex=e];if(!s.html)throw this.$.menu.dropdownOff(),Error('[SUNEDITOR.layout.fail] cause : "layouts[i].html not found"');this.$.html.set(s.html),this.$.menu.dropdownOff()}}const ah=rh;class hh extends Ir{static key="lineHeight";static className="";#Fc;constructor(t,e){super(t),this.title=this.$.lang.lineHeight,this.icon="line_height";const s=`<li><button type="button" class="se-btn se-btn-list default_value" data-command="" title="${this.$.lang.default}" aria-label="${this.$.lang.default}">${this.$.lang.default}</button></li><li class="se-btn-list se-sub-list"><span></span></li>`,i=this.$.menu.initDropdownTarget(hh,(e.items||[{text:"1",value:"1em"},{text:"1.2",value:"1.2em"},{text:"1.7",value:"1.7em"},{text:"2",value:"2em"}]).map((t=>({command:t.value,title:t.text,innerHTML:t.text}))),{prependHTML:s});this.sizeList=i.querySelectorAll("li button"),this.currentSize=null,this.#Fc=i.querySelector(".se-sub-list span")}active(t,e){return this.$.format.isLine(t)&&t.style.lineHeight.length>0?(Ve.utils.addClass(e,"active"),!0):(Ve.utils.removeClass(e,"active"),!1)}on(){const t=this.$.format.getLine(this.$.selection.getNode()),e=t?t.style.lineHeight+"":"";if(e!==this.currentSize){let t=!1;const s=this.sizeList;for(let i=0,n=s.length;i<n;i++)e===s[i].getAttribute("data-command")?(Ve.utils.addClass(s[i],"active"),t=!0):Ve.utils.removeClass(s[i],"active");this.currentSize=e,t?this.#Fc.style.display="none":(this.#Fc.textContent=e,this.#Fc.style.display="block")}}action(t){const e=t.getAttribute("data-command")||"",s=this.$.format.getLines();for(let t=0,i=s.length;t<i;t++)s[t].style.lineHeight=e;this.$.menu.dropdownOff(),this.$.store.set("_lastSelectionNode",null),this.$.history.push(!1)}}const ch=hh;class dh extends Ir{static key="template";static className="";constructor(t,e){super(t),this.title=this.$.lang.template,this.icon="template",this.selectedIndex=-1,this.items=e.items,this.$.menu.initDropdownTarget(dh,function(t){t&&0!==t.length||console.warn('[SUNEDITOR.plugins.template.warn] To use the "template" plugin, please define the "templates" option.');return(t||[]).map(((t,e)=>({command:"template",value:String(e),title:t.name,innerHTML:t.name})))}(this.items))}action(t){const e=Number(t.getAttribute("data-value")),s=this.items[this.selectedIndex=e];if(!s.html)throw this.$.menu.dropdownOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.$.html.insert(s.html,{selectInserted:!1,skipCharCount:!1,skipCleaning:!1}),this.$.menu.dropdownOff()}}const uh=dh;class ph extends Ir{static key="paragraphStyle";static className="";constructor(t,e){super(t),this.title=this.$.lang.paragraphStyle,this.icon="paragraph_style";const s=this.$.menu.initDropdownTarget(ph,function({lang:t},e){const s={spaced:{name:t.menu_spaced,class:"__se__p-spaced",_class:""},bordered:{name:t.menu_bordered,class:"__se__p-bordered",_class:""},neon:{name:t.menu_neon,class:"__se__p-neon",_class:""}},i=e&&0!==e.length?e:["spaced","bordered","neon"],n=[];for(let t,e,o,l=0,r=i.length;l<r;l++){if(t=i[l],"string"==typeof t){const e=s[t.toLowerCase()];if(!e)continue;t=e}e=t.name,o=t.class?` class="${t.class}"`:"",n.push({command:t.class,title:e,innerHTML:`<div${o}>${e}</div>`,className:t._class||void 0})}return n}(this.$,e.items),{className:"se-list-format"});this.classList=s.querySelectorAll("li button")}on(){const t=this.classList,e=this.$.format.getLine(this.$.selection.getNode());for(let s=0,i=t.length;s<i;s++)Ve.utils.hasClass(e,t[s].getAttribute("data-command"))?Ve.utils.addClass(t[s],"active"):Ve.utils.removeClass(t[s],"active")}action(t){const e=t.getAttribute("data-command");let s=this.$.format.getLines();if(0!==s.length||(this.$.selection.getRangeAndAddLine(this.$.selection.getRange(),null),s=this.$.format.getLines(),0!==s.length)){for(let t=0,i=s.length;t<i;t++)Ve.utils.toggleClass(s[t],e);this.$.menu.dropdownOff(),this.$.history.push(!1)}}}const gh=ph;class mh extends Ir{static key="textStyle";static className="";constructor(t,e){super(t),this.title=this.$.lang.textStyle,this.icon="text_style";const s=this.$.menu.initDropdownTarget(mh,function({lang:t},e){const s={code:{name:t.menu_code,class:"__se__t-code",tag:"code"},shadow:{name:t.menu_shadow,class:"__se__t-shadow",tag:"span"}},i=e||Object.keys(s),n=[];for(let t,e,o,l,r=0,a=i.length;r<a;r++){if(t=i[r],"string"==typeof t){const e=s[t.toLowerCase()];if(!e)continue;t=e}o=t.name,e=t.tag||"span",l=`.${t.class.trim().replace(/\s+/g,",.")}`.replace(/,$/,""),n.push({command:e,value:l,title:o,innerHTML:`<${e} class="${t.class}">${o}</${e}>`})}return n}(this.$,e.items),{className:"se-list-format"});this.styleList=s.querySelectorAll("li button")}on(){const t=this.styleList,e=this.$.selection.getNode();for(let s,i,n,o=0,l=t.length;o<l;o++){s=t[o],i=s.getAttribute("data-value").split(",");for(let t,o,l=0;l<i.length;l++){for(t=e,n=!1;t&&!this.$.format.isLine(t)&&!this.$.component.is(t);){if(t.nodeName.toLowerCase()===s.getAttribute("data-command").toLowerCase()&&(o=i[l],/^\./.test(o)?Ve.utils.hasClass(t,o.replace(/^\./,"")):t.style[o])){n=!0;break}t=t.parentNode}if(!n)break}n?Ve.utils.addClass(s,"active"):Ve.utils.removeClass(s,"active")}}action(t){const e=t.firstElementChild,s=e.style.cssText.replace(/:.+(;|$)/g,",").split(",");s.pop();const i=e.classList;for(let t=0,e=i.length;t<e;t++)s.push("."+i[t]);const n=Ve.utils.hasClass(t,"active")?null:e.cloneNode(!1),o=n?null:[e.nodeName];this.$.inline.apply(n,{stylesToModify:s,nodesToRemove:o,strictRemove:!0}),this.$.menu.dropdownOff()}}const fh=mh;const vh=class extends Pr{static key="link";static className="se-icon-flip-rtl";#Dd;constructor(t,e){super(t),this.title=this.$.lang.link,this.icon="link",e.textToDisplay=!0,e.title=!0;const s=function({lang:t,icons:e}){const s=`\n\t<form>\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n\t\t\t\t${e.cancel}\n\t\t\t</button>\n\t\t\t<span class="se-modal-title">${t.link_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-anchor-editor"></div>\n\t\t<div class="se-modal-footer">\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}">\n\t\t\t\t<span>${t.submitButton}</span>\n\t\t\t</button>\n\t\t</div>\n\t</form>`;return Ve.utils.createElement("DIV",{class:"se-modal-content"},s)}(this.$),i=function({lang:t,icons:e}){const s=`\n\t<div class="se-arrow se-arrow-up"></div>\n\t<div class="link-content">\n\t\t<span><a target="_blank" href=""></a>&nbsp;</span>\n\t\t<div class="se-btn-group">\n\t\t\t<button type="button" data-command="update" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.edit}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.edit}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t<button type="button" data-command="copy" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.copy}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.copy}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t<button type="button" data-command="unlink" tabindex="-1" class="se-btn se-tooltip se-icon-flip-rtl">\n\t\t\t\t${e.unlink}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.unlink}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t<button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.delete}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.remove}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t</div>\n\t</div>`;return Ve.utils.createElement("DIV",{class:"se-controller se-controller-link"},s)}(this.$),n="string"==typeof e.uploadUrl?e.uploadUrl:null;this.target=null,this.isUpdateState=!1,this.pluginOptions={...e,uploadUrl:n,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:Oe.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Oe.get(e.uploadSingleSizeLimit,0),acceptedFormats:"string"==typeof e.acceptedFormats?e.acceptedFormats.trim():null,enableFileUpload:!!n},this.anchor=new Hr(this.$,s,this.pluginOptions),this.modal=new kr(this,this.$,s),this.controller=new Ti(this,this.$,i,{position:"bottom",disabled:!1}),this.#Dd=this.controller.form.querySelector("a")}active(t){if(Ve.check.isAnchor(t)&&!t.hasAttribute("data-se-non-link")){const e=this.#Dd,s=t.getAttribute("href");return e.href=s,e.textContent=e.title=t.textContent,e.target=s?.startsWith("#")?t.target:"_blank",Ve.utils.addClass(t,"on"),this.anchor.set(t),this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null}),this.target=t,!0}return this.controller.close(),!1}open(){this.modal.open()}modalOn(t){this.isUpdateState=t,this.anchor.on(t)}async modalAction(){const t=this.anchor.create(!1);if(null===t)return!1;if(this.isUpdateState){const t=this.controller.currentTarget.childNodes[0];this.$.selection.setRange(t,0,t,t.textContent.length)}else{const e=this.$.format.getLines();if(e.length>1){if(!this.$.html.insertNode(Ve.utils.createElement(e[0].nodeName,null,t),{afterNode:null,skipCharCount:!1}))return!0}else if(!this.$.html.insertNode(t,{afterNode:null,skipCharCount:!1}))return!0;this.$.selection.setRange(t.childNodes[0],0,t.childNodes[0],t.textContent.length)}return this.$.history.push(!1),!0}modalInit(){this.controller.close(),this.anchor.init()}controllerAction(t){const e=t.getAttribute("data-command");if(/update/.test(e))this.modal.open();else if(/copy/.test(e))this.$.html.copy(this.target);else if(/unlink/.test(e)){const t=Ve.query.getEdgeChild(this.controller.currentTarget,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!1),e=Ve.query.getEdgeChild(this.controller.currentTarget,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!0);this.$.selection.setRange(t,0,e,e.textContent.length),this.$.inline.apply(null,{stylesToModify:null,nodesToRemove:["A"],strictRemove:!1})}else Ve.utils.removeItem(this.controller.currentTarget),this.controller.currentTarget=null,this.$.focusManager.focus(),this.$.history.push(!1)}controllerClose(){Ve.utils.removeClass(this.controller.currentTarget,"on")}},bh="%",yh="px",Ch={BLOCK:"block",INLINE:"inline"},wh="image/*";const _h=class{#Wc;#J;#N;#Fd;#Yc;#qd;#Wd;#Ud={w:0,h:0};#Zd=null;#Gd=null;#jd=null;constructor(t,e){if(this.#Wc=t,this.#J=t.$,this.#N=t.state,this.#Fd=t.pluginOptions,this.#Yc=this.#Fd.canResize,this.#qd="auto"===this.#Fd.defaultWidth?"":this.#Fd.defaultWidth,this.#Wd="auto"===this.#Fd.defaultHeight?"":this.#Fd.defaultHeight,this.#Yc){this.#Zd=e.proportion,this.#Gd=e.inputX,this.#jd=e.inputY,this.#Gd.value=this.#Fd.defaultWidth,this.#jd.value=this.#Fd.defaultHeight;const t=this.#Kd.bind(this);this.#J.eventManager.addEvent(this.#Gd,"keyup",this.#Yd.bind(this,"x")),this.#J.eventManager.addEvent(this.#jd,"keyup",this.#Yd.bind(this,"y")),this.#J.eventManager.addEvent(this.#Gd,"change",t),this.#J.eventManager.addEvent(this.#jd,"change",t),this.#J.eventManager.addEvent(this.#Zd,"change",t),this.#J.eventManager.addEvent(e.revertBtn,"click",this.#Xd.bind(this))}}setInputSize(t,e){this.#Gd.value="auto"===t?"":t,this.#N.onlyPercentage||(this.#jd.value="auto"===e?"":e)}getInputSize(){return{w:this.#Gd?.value||"",h:this.#jd?.value||""}}setOriginSize(t,e){this.#qd=t,this.#Wd=e}applySize(t,e){t||=this.#Gd?.value||this.#Fd.defaultWidth,e||=this.#jd?.value||this.#Fd.defaultHeight,this.#N.onlyPercentage&&(t?/%$/.test(t)||(t+=bh):t="100%"),this.#Wc.figure.setSize(t,e)}on(){if(!this.#Yc)return;const t=this.#Fd.defaultWidth,e=this.#Fd.defaultHeight;this.setInputSize(t,e),this.setOriginSize(t,e)}ready(t,e,s){this.setInputSize(e,s);const i=this.#N.onlyPercentage&&this.#Wc.figure.isVertical;this.#Zd.checked=!0,this.#Gd.disabled=i,this.#jd.disabled=i,this.#Zd.disabled=i,this.#Ud=this.#Zd.checked?t.ratio:{w:0,h:0}}init(){this.#Ud={w:0,h:0},this.#Yc&&(this.setInputSize(this.#Fd.defaultWidth,this.#Fd.defaultHeight),this.#Zd.checked=!0)}#Yd(t,e){if(Re.isSpace(e.code))return void e.preventDefault();const s=e.target;if("x"===t&&this.#N.onlyPercentage&&Number(s.value)>100)s.value="100";else if(this.#Zd.checked){const e=Fi.CalcRatio(this.#Gd.value,this.#jd.value,this.#N.sizeUnit,this.#Ud);"x"===t?this.#jd.value=String(e.h):this.#Gd.value=String(e.w)}}#Kd(){this.#Ud=this.#Zd.checked?Fi.GetRatio(this.#Gd.value,this.#jd.value,this.#N.sizeUnit):{w:0,h:0}}#Xd(){this.#N.onlyPercentage?this.#Gd.value=Number(this.#qd)>100?"100":this.#qd:(this.#Gd.value=this.#qd,this.#jd.value=this.#Wd)}},{NO_EVENT:xh}=Ae;const $h=class{#Wc;#J;#Fd;#Yc;constructor(t){this.#Wc=t,this.#J=t.$,this.#Fd=t.pluginOptions,this.#Yc=this.#Fd.canResize,this._base64RenderIndex=0}get#Jd(){return this.#Wc.sizeService}serverUpload(t){if(!t.files)return;const e=this.#Fd.uploadUrl;"string"==typeof e&&e.length>0?this.#Wc.fileManager.upload(e,this.#Fd.uploadHeaders,t.files,this.#Qd.bind(this,t),this.#Jh.bind(this)):this.#tu(t)}urlUpload(t){this.#Wc.setState("produceIndex",0);const e=t.url;this.#Wc.modal.isUpdate?this.#eu(e,t.element,t.files):this.#su(e,t.anchor,t.inputWidth,t.inputHeight,t.align,t.files,t.alt,!0)}#su(t,e,s,i,n,o,l,r){this.#Wc.as!==Ch.INLINE?this.#Wc.create(t,e,s,i,n,o,l,r):this.#Wc.createInline(t,e,s,i,o,l,r)}#eu(t,e,s){e.src=t,this.#Wc.fileManager.setFileData(e,s),this.#J.component.select(e,this.#Wc.constructor.key)}#Xh(t,e){this.#Wc.setState("produceIndex",0);const s=e.result;for(let e,i=0,n=s.length;i<n;i++){if(e={name:s[i].name,size:s[i].size},t.isUpdate){this.#eu(s[i].url,t.element,e);break}this.#su(s[i].url,t.anchor,t.inputWidth,t.inputHeight,t.align,e,t.alt,i===n-1)}}#tu(t){try{const{files:e,element:s,anchor:i,inputWidth:n,inputHeight:o,align:l,alt:r,isUpdate:a}=t,h=this.#Wc.modal.isUpdate?1:e.length;if(0===h)return this.#J.ui.hideLoading(),void console.warn("[SUNEDITOR.image.base64.fail] cause : No applicable files");this._base64RenderIndex=h;const c=new Array(h);this.#Yc&&this.#Jd.setInputSize(n,o);for(let t,d,u=0,p=this.#iu.bind(this);u<h;u++)t=new FileReader,d=e[u],t.onload=function(t,e,s,a,h,d){c[d]={result:e.result,file:h},0==--this._base64RenderIndex&&(t(s,c,a,i,n,o,l,r),this.#J.ui.hideLoading())}.bind(this,p,t,a,s,d,u),t.readAsDataURL(d)}catch(t){throw this.#J.ui.hideLoading(),Error(`[SUNEDITOR.plugins.image._setBase64.fail] ${t.message}`)}}#iu(t,e,s,i,n,o,l,r){this.#Wc.setState("produceIndex",0);for(let a=0,h=e.length;a<h;a++)t?this.#eu(e[a].result,s,e[a].file):this.#su(e[a].result,i,n,o,l,e[a].file,r,a===h-1)}async#Jh(t){const e=await this.#J.eventManager.triggerEvent("onImageUploadError",{error:t}),s=e===xh?t.errorMessage:e||t.errorMessage;this.#J.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.image.error]",s)}async#Qd(t,e){if(await this.#J.eventManager.triggerEvent("imageUploadHandler",{xmlHttp:e,info:t})===xh){const s=JSON.parse(e.responseText);s.errorMessage?this.#Jh(s):this.#Xh(t,s)}}},{NO_EVENT:kh}=Ae;const Sh=class extends Pr{static key="image";static className="";static component(t){const e=Ve.check.isFigure(t)||/^span$/i.test(t.nodeName)&&Ve.check.isComponentContainer(t)?t.firstElementChild:t;return/^IMG$/i.test(e?.nodeName)?e:Ve.check.isAnchor(e)&&/^IMG$/i.test(e?.firstElementChild?.nodeName)?e?.firstElementChild:null}#Yc;#nu;#ou=null;#lu="";#ru="none";#au="30%";#_c=null;#hu=null;#cu=null;#du=null;constructor(t,e){super(t),this.title=this.$.lang.image,this.icon="image",this.pluginOptions={canResize:void 0===e.canResize||e.canResize,showHeightInput:void 0===e.showHeightInput||!!e.showHeightInput,defaultWidth:e.defaultWidth?Oe.is(e.defaultWidth)?e.defaultWidth+yh:e.defaultWidth:"auto",defaultHeight:e.defaultHeight?Oe.is(e.defaultHeight)?e.defaultHeight+yh:e.defaultHeight:"auto",percentageOnlySize:!!e.percentageOnlySize,createFileInput:void 0===e.createFileInput||e.createFileInput,createUrlInput:void 0===e.createUrlInput||!e.createFileInput||e.createUrlInput,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:Oe.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Oe.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?wh:e.acceptedFormats.trim()||wh,useFormatType:e.useFormatType??!0,defaultFormatType:[Ch.BLOCK,Ch.INLINE].includes(e.defaultFormatType)?e.defaultFormatType:Ch.BLOCK,keepFormatType:e.keepFormatType??!1,insertBehavior:e.insertBehavior};const s=this.pluginOptions.percentageOnlySize?bh:yh,i=function({lang:t,icons:e,plugins:s},i){const n=i.createFileInput?`\n\t\t<div class="se-modal-form">\n\t\t\t<label>${t.image_modal_file}</label>\n\t\t\t${kr.CreateFileInput({icons:e,lang:t},i)}\n\t\t</div>`:"",o=i.createUrlInput?`\n\t\t<div class="se-modal-form">\n\t\t\t<label>${t.image_modal_url}</label>\n\t\t\t<div class="se-modal-form-files">\n\t\t\t\t<input class="se-input-form se-input-url" data-focus type="text" />\n\t\t\t\t${s.imageGallery?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button __se__gallery" aria-label="${t.imageGallery}">\n\t\t\t\t\t\t\t${e.image_gallery}\n\t\t\t\t\t\t\t${Ve.utils.createTooltipInner(t.imageGallery)}\n\t\t\t\t\t\t\t</button>`:""}\n\t\t\t</div>\n\t\t\t<pre class="se-link-preview"></pre>\n\t\t</div>`:"",l=i.canResize?`\n\t\t<div class="se-modal-form">\n\t\t\t<div class="se-modal-size-text">\n\t\t\t\t<label class="size-w">${t.width}</label>\n\t\t\t\t<label class="se-modal-size-x">&nbsp;</label>\n\t\t\t\t<label class="size-h">${t.height}</label>\n\t\t\t</div>\n\t\t\t<input class="se-input-control _se_size_x" placeholder="auto" type="text" />\n\t\t\t<label class="se-modal-size-x">x</label>\n\t\t\t<input type="text" class="se-input-control _se_size_y" placeholder="auto" />\n\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_check_proportion" checked/>&nbsp;${t.proportion}</label>\n\t\t\t<button type="button" aria-label="${t.revert}" class="se-btn se-tooltip se-modal-btn-revert">\n\t\t\t\t${e.revert}\n\t\t\t\t${Ve.utils.createTooltipInner(t.revert)}\n\t\t\t</button>\n\t\t</div>`:"",r=i.useFormatType?`\n\t\t<div class="se-modal-form">\n\t\t\t<div class="se-modal-flex-form">\n\t\t\t\t<button type="button" data-command="asBlock" class="se-btn se-tooltip" aria-label="${t.inlineStyle}">\n\t\t\t\t\t${e.as_block}\n\t\t\t\t\t${Ve.utils.createTooltipInner(t.blockStyle)}\n\t\t\t\t</button>\n\t\t\t\t<button type="button" data-command="asInline" class="se-btn se-tooltip" aria-label="${t.inlineStyle}">\n\t\t\t\t\t${e.as_inline}\n\t\t\t\t\t${Ve.utils.createTooltipInner(t.inlineStyle)}\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</div>`:"",a=`\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn close" title="${t.close}" aria-label="${t.close}">${e.cancel}</button>\n\t\t\t<span class="se-modal-title">${t.image_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-modal-tabs">\n\t\t\t<button type="button" class="_se_tab_link active" data-tab-link="image">${t.image}</button>\n\t\t\t<button type="button" class="_se_tab_link" data-tab-link="url">${t.link}</button>\n\t\t</div>\n\t\t<form method="post" enctype="multipart/form-data">\n\t\t\t<div class="_se_tab_content _se_tab_content_image">\n\t\t\t\t<div class="se-modal-body">\n\t\t\t\t\t${n}\n\t\t\t\t\t${o}\n\t\t\t\t\t<div class="se-modal-hr"></div>\n\t\t\t\t\t<div class="se-modal-form">\n\t\t\t\t\t\t<label>${t.image_modal_altText}</label><input class="se-input-form _se_image_alt" type="text" />\n\t\t\t\t\t</div>\n\t\t\t\t\t${l}\n\t\t\t\t\t${r}\n\t\t\t\t\t<div class="se-modal-form se-modal-form-footer">\n\t\t\t\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_image_check_caption" />&nbsp;${t.caption}</label>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="se-anchor-editor _se_tab_content _se_tab_content_url" style="display: none;">\n\t\t\t</div>\n\t\t\t<div class="se-modal-footer">\n\t\t\t\t<div class="se-figure-align">\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="none" checked>${t.basic}</label>\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="left">${t.left}</label>\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="center">${t.center}</label>\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="right">${t.right}</label>\n\t\t\t\t</div>\n\t\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}"><span>${t.submitButton}</span></button>\n\t\t\t</div>\n\t\t</form>`,h=Ve.utils.createElement("DIV",{class:"se-modal-content"},a);return{html:h,alignForm:h.querySelector(".se-figure-align"),fileModalWrapper:h.querySelector(".se-flex-input-wrapper"),imgInputFile:h.querySelector(".__se__file_input"),imgUrlFile:h.querySelector(".se-input-url"),altText:h.querySelector("._se_image_alt"),captionCheckEl:h.querySelector("._se_image_check_caption"),previewSrc:h.querySelector("._se_tab_content_image .se-link-preview"),tabs:h.querySelector(".se-modal-tabs"),galleryButton:h.querySelector(".__se__gallery"),proportion:h.querySelector("._se_check_proportion"),inputX:h.querySelector("._se_size_x"),inputY:h.querySelector("._se_size_y"),revertBtn:h.querySelector(".se-modal-btn-revert"),asBlock:h.querySelector('[data-command="asBlock"]'),asInline:h.querySelector('[data-command="asInline"]'),fileRemoveBtn:h.querySelector(".se-file-remove")}}(this.$,this.pluginOptions),n=this.pluginOptions.useFormatType?"as":"",o=e.controls||(this.pluginOptions.canResize?[[n,"resize_auto,100,75,50","rotate_l","rotate_r","mirror_h","mirror_v"],["edit","align","caption","revert","copy","remove"]]:[[n,"mirror_h","mirror_v","align","caption","edit","revert","copy","remove"]]);this.alignForm=i.alignForm,o.some((t=>t.includes("align")))||(this.alignForm.style.display="none");const l=this.$.plugins.link?this.$.plugins.link.pluginOptions:{};this.anchor=new Hr(this.$,i.html,{...l,textToDisplay:!1,title:!0}),this.modal=new kr(this,this.$,i.html),this.figure=new Fi(this,this.$,o,{sizeUnit:s}),this.fileManager=new Er(this,this.$,{query:"img",loadEventName:"onImageLoad",actionEventName:"onImageAction"}),this.state={sizeUnit:s,onlyPercentage:this.pluginOptions.percentageOnlySize,produceIndex:0},this.fileModalWrapper=i.fileModalWrapper,this.imgInputFile=i.imgInputFile,this.imgUrlFile=i.imgUrlFile,this.focusElement=this.imgInputFile||this.imgUrlFile,this.altText=i.altText,this.captionCheckEl=i.captionCheckEl,this.captionEl=this.captionCheckEl?.parentElement,this.previewSrc=i.previewSrc,this.as=Ch.BLOCK,this.#Yc=this.pluginOptions.canResize,this.#nu=!this.#Yc||!this.pluginOptions.showHeightInput||this.pluginOptions.percentageOnlySize,this.sizeService=new _h(this,i),this.uploadService=new $h(this),this.$.eventManager.addEvent(i.tabs,"click",this.#uu.bind(this)),this.imgInputFile&&this.$.eventManager.addEvent(i.fileRemoveBtn,"click",this.#pu.bind(this)),this.imgUrlFile&&this.$.eventManager.addEvent(this.imgUrlFile,"input",this.#gu.bind(this)),this.imgInputFile&&this.imgUrlFile&&this.$.eventManager.addEvent(this.imgInputFile,"change",this.#mu.bind(this));const r=i.galleryButton;r&&this.$.eventManager.addEvent(r,"click",this.#fu.bind(this)),this.pluginOptions.useFormatType&&(this.as=this.pluginOptions.defaultFormatType,this.asBlock=i.asBlock,this.asInline=i.asInline,this.$.eventManager.addEvent([this.asBlock,this.asInline],"click",this.#vu.bind(this)))}setState(t,e){this.state[t]=e}open(){this.state.produceIndex=0,this.modal.open()}retainFormat(){return{query:"img",method:t=>{const e=Fi.GetContainer(t);if(e&&e.container&&(e.cover||e.inlineCover))return;const{w:s,h:i}=this.#bu(t,!0);this.#yu(s,i)}}}onFilePasteAndDrop({file:t}){/^image/.test(t.type)&&(this.submitFile([t]),this.$.focusManager.focus())}modalOn(t){t?this.imgInputFile&&this.pluginOptions.allowMultiple&&this.imgInputFile.removeAttribute("multiple"):(this.sizeService.on(),this.imgInputFile&&this.pluginOptions.allowMultiple&&this.imgInputFile.setAttribute("multiple","multiple")),this.anchor.on(t)}async modalAction(){return this.#ru=this.modal.form.querySelector('input[name="suneditor_image_radio"]:checked').value,this.modal.isUpdate&&(this.#Cu(),this.$.history.push(!1)),this.imgInputFile&&this.imgInputFile.files.length>0?await this.submitFile(this.imgInputFile.files):!!(this.imgUrlFile&&this.#lu.length>0)&&await this.submitURL(this.#lu)}modalInit(){kr.OnChangeFile(this.fileModalWrapper,[]),this.imgInputFile&&(this.imgInputFile.value=""),this.imgUrlFile&&(this.#lu=this.previewSrc.textContent=this.imgUrlFile.value=""),this.imgInputFile&&this.imgUrlFile&&(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),this.altText.value="",this.modal.form.querySelector('input[name="suneditor_image_radio"][value="none"]').checked=!0,this.captionCheckEl.checked=!1,this.#_c=null,this.#uu("init"),this.sizeService.init(),this.pluginOptions.useFormatType&&this.#wu((this.pluginOptions.keepFormatType?this.as:this.pluginOptions.defaultFormatType)===Ch.INLINE),this.anchor.init()}componentSelect(t){this.#bu(t)}componentEdit(){this.modal.open()}async componentDestroy(t){const e=t||this.#_c,s=Ve.query.getParentElement(e,Fi.is)||e,i=s.previousElementSibling||s.nextElementSibling,n=s.parentNode;!1!==await this.$.eventManager.triggerEvent("onImageDeleteBefore",{element:e,container:s,align:this.#ru,alt:this.altText.value,url:this.#lu})&&(Ve.utils.removeItem(s),this.modalInit(),n!==this.$.frameContext.get("wysiwyg")&&this.$.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.$.focusManager.focusEdge(i),this.$.history.push(!1))}async submitFile(t){if(0===t.length)return!1;let e=0;const s=[],i=this.pluginOptions.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++)if(n=t[l],/image/i.test(n.type)){if(o=n.size,i>0&&o>i){const t="[SUNEDITOR.imageUpload.fail] Size of uploadable single file: "+i/1e3+"KB",e=await this.$.eventManager.triggerEvent("onImageUploadError",{error:t,limitSize:i,uploadSize:o,file:n});return this.$.ui.alertOpen(e===kh?t:e||t,"error"),!1}s.push(n),e+=o}const n=this.pluginOptions.uploadSizeLimit,o=this.fileManager.getSize();if(n>0&&e+o>n){const t="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+n/1e3+"KB",s=await this.$.eventManager.triggerEvent("onImageUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.$.ui.alertOpen(s===kh?t:s||t,"error"),!1}const l={files:s,...this.#_u()},r=function(t,e,s){t(e=s||e)}.bind(this,this.uploadService.serverUpload.bind(this.uploadService),l),a=await this.$.eventManager.triggerEvent("onImageUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==kh||r(null)))}async submitURL(t){if(!(t||=this.#lu))return!1;const e={name:t.split("/").pop(),size:0},s={url:t,files:e,...this.#_u()},i=function(t,e,s){t(e=s||e)}.bind(this,this.uploadService.urlUpload.bind(this.uploadService),s),n=await this.$.eventManager.triggerEvent("onImageUploadBefore",{info:s,handler:i});return void 0===n||!1!==n&&(null!==n&&"object"==typeof n&&i(n),!0!==n&&n!==kh||i(null),!0)}create(t,e,s,i,n,o,l,r){const a=Ve.utils.createElement("IMG");a.src=t,a.alt=l,e=this.#xu(a,e?e.cloneNode(!1):null);const h=Fi.CreateContainer(e,"se-image-container"),c=h.cover,d=h.container;this.captionCheckEl.checked&&(this.#du=Fi.CreateCaption(c,this.$.lang.caption)),this.#_c=a,this.#hu=c,this.#cu=d,this.figure.open(a,{nonResizing:this.#nu,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0}),this.sizeService.applySize(s,i),this.figure.setAlign(a,n),this.fileManager.setFileData(a,o),this.setState("produceIndex",this.state.produceIndex+1),a.onload=this.#$u.bind(this,a,this.#au,d),this.$.component.insert(d,{scrollTo:!!r,insertBehavior:r?null:"line"})}createInline(t,e,s,i,n,o,l){const r=Ve.utils.createElement("IMG");r.src=t,r.alt=o,e=this.#xu(r,e?e.cloneNode(!1):null);const a=Fi.CreateInlineContainer(e,"se-image-container").container;this.#_c=r,this.#cu=a,this.figure.open(r,{nonResizing:this.#nu,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0}),this.sizeService.applySize(s,i),this.fileManager.setFileData(r,n),this.setState("produceIndex",this.state.produceIndex+1),r.onload=this.#$u.bind(this,r,this.#au,a),this.$.component.insert(a,{scrollTo:!!l,insertBehavior:l?null:"line"})}#bu(t,e=!1){if(!t)return;const s=this.figure.open(t,{nonResizing:this.#nu,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:e});this.anchor.set(Ve.check.isAnchor(t.parentNode)?t.parentNode:null),this.#ou=this.anchor.currentTarget,this.#_c=t,this.#hu=s.cover,this.#cu=s.container,this.#du=s.caption,this.#ru=s.align,t.style.float="",this.sizeService.setOriginSize(String(s.originWidth||s.w||""),String(s.originHeight||s.h||"")),this.altText.value=this.#_c.alt,this.imgUrlFile&&(this.#lu=this.previewSrc.textContent=this.imgUrlFile.value=this.#_c.src);(this.modal.form.querySelector('input[name="suneditor_image_radio"][value="'+this.#ru+'"]')||this.modal.form.querySelector('input[name="suneditor_image_radio"][value="none"]')).checked=!0,this.captionCheckEl.checked=!!this.#du;const{dw:i,dh:n}=this.figure.getSize(t);return this.#Yc?(this.sizeService.ready(s,i,n),this.pluginOptions.useFormatType&&this.#wu(this.$.component.isInline(s.container)),{w:i,h:n}):{w:i,h:n}}#_u(){const{w:t,h:e}=this.sizeService.getInputSize();return{element:this.#_c,anchor:this.anchor.create(!0),inputWidth:t,inputHeight:e,align:this.#ru,isUpdate:this.modal.isUpdate,alt:this.altText.value}}#wu(t){t?(Ve.utils.addClass(this.asInline,"on"),Ve.utils.removeClass(this.asBlock,"on"),this.as=Ch.INLINE,this.alignForm&&(this.alignForm.style.display="none"),this.captionEl&&(this.captionEl.style.display="none")):(Ve.utils.addClass(this.asBlock,"on"),Ve.utils.removeClass(this.asInline,"on"),this.as=Ch.BLOCK,this.alignForm&&(this.alignForm.style.display=""),this.captionEl&&(this.captionEl.style.display=""))}#Cu(){const{w:t,h:e}=this.sizeService.getInputSize(),s=t||"auto",i=e||"auto";let n=this.#_c;(this.as===Ch.BLOCK&&!this.#hu||this.as===Ch.INLINE&&this.#hu)&&(n=this.figure.convertAsFormat(n,this.as));const o=this.#hu,l=this.#cu===this.#hu?null:this.#cu;let r;const a=Oe.is(s)?s+this.state.sizeUnit:s,h=Oe.is(i)?i+this.state.sizeUnit:i;r=/%$/.test(n.style.width)?a!==l.style.width||h!==l.style.height:a!==n.style.width||h!==n.style.height,n.alt=this.altText.value;let c=!1;this.captionCheckEl.checked?this.#du||(this.#du=Fi.CreateCaption(o,this.$.lang.caption),c=!0):this.#du&&(Ve.utils.removeItem(this.#du),this.#du=null,c=!0);let d=!1;const u=this.anchor.create(!0);if(u)this.#ou===u&&l.contains(u)||(this.#ou=u.cloneNode(!1),o.insertBefore(this.#xu(n,this.#ou),this.#du),d=!0);else if(null!==this.#ou&&o.contains(this.#ou)){const t=n.cloneNode(!0);o.removeChild(this.#ou),o.insertBefore(t,this.#du),n=t}d&&Ve.utils.removeItem(u),this.#Yc&&r&&this.sizeService.applySize(s,i),(c||!this.state.onlyPercentage&&r)&&(/\d+/.test(n.style.height)||this.figure.isVertical&&this.captionCheckEl.checked)&&(/auto|%$/.test(s)||/auto|%$/.test(i)?this.figure.deleteTransform(n):this.#Yc&&r&&this.figure.isVertical||this.figure.setTransform(n,s,i,0)),this.figure.setAlign(n,this.#ru),n.onload=()=>{this.componentSelect(n)}}#yu(t,e){const{w:s,h:i}=this.sizeService.getInputSize();t||=s||"auto",e||=i||"auto";let n=this.#_c,o=this.#hu,l=null,r=this.#cu===this.#hu?null:this.#cu,a=!1;if(!o||!r){a=!0,n=this.#_c.cloneNode(!0);const e=this.pluginOptions.useFormatType&&"auto"!==t&&(/^span$/i.test(this.#_c.parentElement?.nodeName)||this.$.format.isLine(this.#_c.parentElement))?Fi.CreateInlineContainer(n,"se-image-container"):Fi.CreateContainer(n,"se-image-container");o=e.cover,r=e.container,l=e.inlineCover,this.figure.open(n,{nonResizing:!0,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0})}n.alt=this.altText.value;let h=!1;l||(this.captionCheckEl.checked?this.#du&&!a||(this.#du=Fi.CreateCaption(o,this.$.lang.caption),h=!0):this.#du&&(Ve.utils.removeItem(this.#du),this.#du=null,h=!0));let c=null;const d=this.anchor.create(!0,Ve.check.isAnchor(this.#_c.parentElement)?this.#_c.parentElement.href:null);if(d)(this.#ou!==d||a&&!r.contains(d))&&(this.#ou=d.cloneNode(!1),o.insertBefore(this.#xu(n,this.#ou),this.#du),c=this.#_c);else if(null!==this.#ou&&o.contains(this.#ou)){const t=n.cloneNode(!0);o.removeChild(this.#ou),o.insertBefore(t,this.#du),n=t}a&&(n=this.#_c,this.figure.retainFigureFormat(r,this.#_c,c?d:null,this.fileManager),this.#_c=n=r.querySelector("img"),this.#hu=o,this.#cu=r),n.style.width="",n.style.height="",n.removeAttribute("width"),n.removeAttribute("height"),this.sizeService.applySize(t,e),c&&(a?(Ve.utils.removeItem(c),0===Ve.query.getListChildren(d,(t=>/IMG/i.test(t.tagName)),null).length&&Ve.utils.removeItem(d)):Ve.utils.removeItem(d)),!h&&this.state.onlyPercentage||(/\d+/.test(n.style.height)||this.figure.isVertical&&this.captionCheckEl.checked)&&(/auto|%$/.test(t)||/auto|%$/.test(e)?this.figure.deleteTransform(n):this.figure.setTransform(n,t,e,0)),this.figure.setAlign(n,this.#ru)}#xu(t,e){return e?(e.setAttribute("data-se-non-link","true"),e.appendChild(t),e):t}#uu(t){const e=this.modal.form,s="string"==typeof t?e.querySelector("._se_tab_link"):Ve.query.getEventTarget(t);if(!/^BUTTON$/i.test(s.tagName))return!1;const i=s.getAttribute("data-tab-link");let n;const o=e.getElementsByClassName("_se_tab_content");for(n=0;n<o.length;n++)o[n].style.display="none";const l=e.getElementsByClassName("_se_tab_link");for(n=0;n<l.length;n++)Ve.utils.removeClass(l[n],"active");return e.querySelector("._se_tab_content_"+i).style.display="block",Ve.utils.addClass(s,"active"),"init"!==t&&("image"===i?this.focusElement.focus():"url"===i&&this.anchor.urlInput.focus()),!1}#pu(){this.imgInputFile.value="",this.imgUrlFile&&(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),kr.OnChangeFile(this.fileModalWrapper,[])}#vu({target:t}){this.#wu("asInline"===t.getAttribute("data-command"))}#gu(t){const e=t.target.value.trim();this.#lu=this.previewSrc.textContent=e?this.$.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.$.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#mu({target:t}){this.imgInputFile.value?(this.imgUrlFile.disabled=!0,this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),kr.OnChangeFile(this.fileModalWrapper,t.files)}#fu(){this.$.plugins.imageGallery.open(this.#ku.bind(this))}#ku(t){this.altText.value=t.getAttribute("data-value")||t.alt,this.#lu=this.previewSrc.textContent=this.imgUrlFile.value=t.getAttribute("data-command")||t.src,this.imgUrlFile.focus()}#$u(t,e,s){this.setState("produceIndex",this.state.produceIndex-1),delete t.onload,0===t.offsetWidth&&this.sizeService.applySize(e,""),0===this.state.produceIndex&&(this.$.component.applyInsertBehavior(s,null,this.pluginOptions.insertBehavior||this.$.options.get("componentInsertBehavior")),this.$.ui._iframeAutoHeight(this.$.frameContext),this.$.history.push(!1))}};const Eh=class{#Wc;#J;#N;#Fd;#Yc;#Su;#Eu;#Tu;#qd;#Wd;#Ud={w:0,h:0};#Zd=null;#Gd=null;#jd=null;#Mu=null;constructor(t,e){if(this.#Wc=t,this.#J=t.$,this.#N=t.state,this.#Fd=t.pluginOptions,this.#Yc=this.#Fd.canResize,this.#Su=this.#N.defaultRatio,this.#Eu="100%",this.#Tu=100*this.#Fd.defaultRatio+"%",this.#qd="100%"===this.#Fd.defaultWidth?"":this.#Fd.defaultWidth,this.#Wd=this.#Fd.defaultHeight===this.#N.defaultRatio?"":this.#Fd.defaultHeight,this.#Yc){this.#Zd=e.proportion,this.frameRatioOption=e.frameRatioOption,this.#Gd=e.inputX,this.#jd=e.inputY,this.#Gd.value=this.#Fd.defaultWidth,this.#jd.value=this.#Fd.defaultHeight;const t=this.#Kd.bind(this);this.#J.eventManager.addEvent(this.#Gd,"keyup",this.#Yd.bind(this,"x")),this.#J.eventManager.addEvent(this.#jd,"keyup",this.#Yd.bind(this,"y")),this.#J.eventManager.addEvent(this.#Gd,"change",t),this.#J.eventManager.addEvent(this.#jd,"change",t),this.#J.eventManager.addEvent(this.#Zd,"change",t),this.#J.eventManager.addEvent(this.frameRatioOption,"change",this.#Hu.bind(this)),this.#J.eventManager.addEvent(e.revertBtn,"click",this.#Xd.bind(this))}}setInputSize(t,e){this.#Gd.value=t===this.#Eu?"":t,this.#N.onlyPercentage||(this.#jd.value=e===this.#Tu?"":e)}getInputSize(){return{w:this.#Gd?.value||"",h:this.#jd?.value||""}}setOriginSize(t,e){this.#qd=t,this.#Wd=e}applySize(t,e){t||=this.#Gd?.value||this.#Fd.defaultWidth,e||=this.#jd?.value||this.#Fd.defaultHeight,this.#N.onlyPercentage&&(t?/%$/.test(t+"")||(t+="%"):t="100%"),this.#Wc.figure.setSize(t,e)}resolveSize(t,e,s,i){t||=this.#Eu,e||=this.#Su;const n=this.#Wc.figure.getSize(s),o=n.w!==t||n.h!==e,l=!i||o;return l&&(this.#Mu!==this.frameRatioOption?.value&&this.#Wc.figure.deleteTransform(),this.applySize(t,e)),{width:t,height:e,isChanged:l}}on(t){if(this.#Yc){if(!t){const t=this.#Fd.defaultWidth,e=this.#Fd.defaultHeight;this.setInputSize(t,e),this.setOriginSize(t,e),this.#Zd.disabled=!0}this.#Lu(this.#Wc.figure.isVertical?"":this.#Wd||this.#N.defaultRatio),this.#Mu=this.frameRatioOption?.value}}ready(t,e){const{dw:s,dh:i}=this.#Wc.figure.getSize(e);this.setInputSize(s,i);const n=t.height||t.h||this.#Wd||"";this.#Lu(n)||(this.#jd.value=String(this.#N.onlyPercentage?Oe.get(n,2):n));const o=this.#N.onlyPercentage&&this.#Wc.figure.isVertical;this.#Gd.disabled=o,this.#jd.disabled=o,this.#Zd.checked=!t.isVertical,this.#Zd.disabled=o,this.#Ud=this.#Zd.checked?t.ratio:{w:0,h:0}}init(){this.#Ud={w:0,h:0},this.#Yc&&(this.setInputSize(this.#Fd.defaultWidth,this.#Fd.defaultHeight),this.#Zd.checked=!1,this.#Zd.disabled=!0,this.#Lu(this.#N.defaultRatio))}#Xd(){this.#N.onlyPercentage?this.#Gd.value=Number(this.#qd)>100?"100":this.#qd:(this.#Gd.value=this.#qd,this.#jd.value=this.#Wd)}#Lu(t){if(!this.frameRatioOption)return;let e=!1;const s=this.frameRatioOption.options;/%$/.test(t+"")||this.#N.onlyPercentage?t=Oe.get(t,2)/100+"":(!Oe.is(t)||Number(t)>=1)&&(t=""),this.#jd.placeholder="";for(let i=0,n=s.length;i<n;i++)s[i].value===t?(e=s[i].selected=!0,this.#jd.placeholder=t?100*Number(t)+"%":""):s[i].selected=!1;return e}#Hu(t){const e=Ve.query.getEventTarget(t),s=e.options[e.selectedIndex].value;this.#Tu=this.#Wc.figure.autoRatio.current=this.#Su=s?100*Number(s)+"%":this.#Tu,this.#jd.placeholder=s?100*Number(s)+"%":"",this.#jd.value=""}#Kd(){this.#Ud=this.#Zd.checked?Fi.GetRatio(this.#Gd.value,this.#jd.value,this.#N.sizeUnit):{w:0,h:0}}#Yd(t,e){if(Re.isSpace(e.code))return void e.preventDefault();const s=Ve.query.getEventTarget(e);if("x"===t&&this.#N.onlyPercentage&&Number(s.value)>100)s.value="100";else if(this.#Zd.checked&&!this.frameRatioOption?.value){const e=Fi.CalcRatio(this.#Gd.value,this.#jd.value,this.#N.sizeUnit,this.#Ud);"x"===t?this.#jd.value=String(e.h):this.#Gd.value=String(e.w)}"y"===t&&this.#Lu(s.value||this.#N.defaultRatio)}},{NO_EVENT:Th}=Ae;const Mh=class{#Wc;#J;#Fd;constructor(t){this.#Wc=t,this.#J=t.$,this.#Fd=t.pluginOptions}serverUpload(t,e){if(!e)return;const s=this.#Fd.uploadUrl;"string"==typeof s&&s.length>0&&this.#Wc.fileManager.upload(s,this.#Fd.uploadHeaders,e,this.#Qd.bind(this,t),this.#Jh.bind(this))}#Xh(t,e){const s=e.result,i=this.#Wc.createVideoTag();for(let e=0,n=s.length;e<n;e++){const o=t.isUpdate?t.element:i.cloneNode(!1);this.#Wc.create(o,s[e].url,t.inputWidth,t.inputHeight,t.align,t.isUpdate,{name:s[e].name,size:s[e].size},e===n-1)}}async#Jh(t){const e=await this.#J.eventManager.triggerEvent("onVideoUploadError",{error:t}),s=e===Th?t.errorMessage:e||t.errorMessage;this.#J.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.video.error]",e)}async#Qd(t,e){if(await this.#J.eventManager.triggerEvent("videoUploadHandler",{xmlHttp:e,info:t})===Th){const s=JSON.parse(e.responseText);s.errorMessage?this.#Jh(s):this.#Xh(t,s)}}};const{_w:Hh,NO_EVENT:Lh}=Ae;class Nh extends Pr{static key="video";static className="";static component(t){return/^(VIDEO)$/i.test(t?.nodeName)||/^(IFRAME)$/i.test(t?.nodeName)&&this.#Nu(t.src)?t:null}static#Nu(t){return t=t?.toLowerCase()||"",!(!this.#Au.some((e=>t.endsWith(e)))&&!this.#Bu.some((e=>e.test(t))))}static#Au=[".mp4",".avi",".mov",".webm",".flv",".mkv",".m4v",".ogv"];static#Bu=[/youtu\.?be/,/vimeo\.com\//,/dailymotion\.com\/video\//,/facebook\.com\/.+\/videos\//,/facebook\.com\/watch\/\?v=/,/twitter\.com\/.+\/status\//,/twitch\.tv\/videos\//,/twitch\.tv\/[^/]+$/,/tiktok\.com\/@[^/]+\/video\//,/instagram\.com\/p\//,/instagram\.com\/tv\//,/instagram\.com\/reel\//,/linkedin\.com\/posts\//,/\.(wistia\.com|wi\.st)\/(medias|embed)\//,/loom\.com\/share\//];#Yc;#nu;#lu="";#ru="none";#_c=null;#cu=null;constructor(t,e){super(t),this.title=this.$.lang.video,this.icon="video",this.pluginOptions={canResize:void 0===e.canResize||e.canResize,showHeightInput:void 0===e.showHeightInput||!!e.showHeightInput,defaultWidth:e.defaultWidth&&Oe.get(e.defaultWidth,0)?Oe.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight&&Oe.get(e.defaultHeight,0)?Oe.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"",percentageOnlySize:!!e.percentageOnlySize,createFileInput:!!e.createFileInput,createUrlInput:void 0===e.createUrlInput||!e.createFileInput||e.createUrlInput,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:Oe.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Oe.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?"video/*":e.acceptedFormats.trim()||"video/*",defaultRatio:Oe.get(e.defaultRatio,4)||.5625,showRatioOption:void 0===e.showRatioOption||!!e.showRatioOption,ratioOptions:e.ratioOptions?e.ratioOptions:null,videoTagAttributes:e.videoTagAttributes||null,iframeTagAttributes:e.iframeTagAttributes||null,query_youtube:e.query_youtube||"",query_vimeo:e.query_vimeo||"",insertBehavior:e.insertBehavior};const s=this.pluginOptions.percentageOnlySize?"%":"px",i=function({lang:t,icons:e,plugins:s},i){let n=`\n\t<form method="post" enctype="multipart/form-data">\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n\t\t\t${e.cancel}\n\t\t\t</button>\n\t\t\t<span class="se-modal-title">${t.video_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-modal-body">`;if(i.createFileInput&&(n+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<label>${t.video_modal_file}</label>\n\t\t\t\t${kr.CreateFileInput({lang:t,icons:e},i)}\n\t\t\t</div>`),i.createUrlInput&&(n+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<label>${t.video_modal_url}</label>\n\t\t\t\t<div class="se-modal-form-files">\n\t\t\t\t\t<input class="se-input-form se-input-url" type="text" data-focus />\n\t\t\t\t\t${s.videoGallery?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button __se__gallery" aria-label="${t.videoGallery}">\n\t\t\t\t\t\t\t\t${e.video_gallery}\n\t\t\t\t\t\t\t\t${Ve.utils.createTooltipInner(t.videoGallery)}\n\t\t\t\t\t\t\t\t</button>`:""}\n\t\t\t\t</div>\n\t\t\t\t<pre class="se-link-preview"></pre>\n\t\t\t</div>`),i.canResize){const s=i.ratioOptions||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285},{name:"9:16",value:1.78}],o=i.defaultRatio,l=i.percentageOnlySize,r=l?' style="display: none !important;"':"",a=i.showHeightInput?"":' style="display: none !important;"',h=i.showRatioOption?"":' style="display: none !important;"',c=l||i.showHeightInput||i.showRatioOption?"":' style="display: none !important;"';n+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<div class="se-modal-size-text">\n\t\t\t\t\t<label class="size-w">${t.width}</label>\n\t\t\t\t\t<label class="se-modal-size-x">&nbsp;</label>\n\t\t\t\t\t<label class="size-h"${a}>${t.height}</label>\n\t\t\t\t\t<label class="size-h"${h}>(${t.ratio})</label>\n\t\t\t\t</div>\n\t\t\t\t<input class="se-input-control _se_size_x" placeholder="100%"${l?' type="number" min="1"':'type="text"'}${l?' max="100"':""}/>\n\t\t\t\t<label class="se-modal-size-x"${c}>${l?"%":"x"}</label>\n\t\t\t\t<input class="se-input-control _se_size_y" placeholder="${100*i.defaultRatio}%"\n\t\t\t\t${l?' type="number" min="1"':'type="text"'}${l?' max="100"':""}${a}/>\n\t\t\t\t<select class="se-input-select se-modal-ratio" title="${t.ratio}" aria-label="${t.ratio}"${h}>\n\t\t\t\t\t${a?"":'<option value=""> - </option>'} \n\t\t\t\t\t${s.map((t=>`<option value="${t.value}"${o.toString()===t.value.toString()?" selected":""}>${t.name}</option>`)).join("")}\n\t\t\t\t</select>\n\t\t\t\t<button type="button" title="${t.revert}" aria-label="${t.revert}" class="se-btn se-modal-btn-revert">${e.revert}</button>\n\t\t\t</div>\n\t\t\t<div class="se-modal-form se-modal-form-footer"${r}${c}>\n\t\t\t\t<label>\n\t\t\t\t\t<input type="checkbox" class="se-modal-btn-check _se_check_proportion" />&nbsp;\n\t\t\t\t\t<span>${t.proportion}</span>\n\t\t\t\t</label>\n\t\t\t</div>`}n+=`\n\t\t</div>\n\t\t<div class="se-modal-footer">\n\t\t\t<div class="se-figure-align">\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="none" checked>${t.basic}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="left">${t.left}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="center">${t.center}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="right">${t.right}</label>\n\t\t\t</div>\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}"><span>${t.submitButton}</span></button>\n\t\t</div>\n\t</form>`;const o=Ve.utils.createElement("DIV",{class:"se-modal-content"},n);return{html:o,alignForm:o.querySelector(".se-figure-align"),fileModalWrapper:o.querySelector(".se-flex-input-wrapper"),videoInputFile:o.querySelector(".__se__file_input"),videoUrlFile:o.querySelector(".se-input-url"),previewSrc:o.querySelector(".se-link-preview"),galleryButton:o.querySelector(".__se__gallery"),proportion:o.querySelector("._se_check_proportion"),frameRatioOption:o.querySelector(".se-modal-ratio"),inputX:o.querySelector("._se_size_x"),inputY:o.querySelector("._se_size_y"),revertBtn:o.querySelector(".se-modal-btn-revert"),fileRemoveBtn:o.querySelector(".se-file-remove")}}(this.$,this.pluginOptions),n=e.controls||(this.pluginOptions.canResize?[["resize_auto,75,50","align","edit","revert","copy","remove"]]:[["align","edit","copy","remove"]]);n.some((t=>t.includes("align")))||(i.alignForm.style.display="none");const o=100*this.pluginOptions.defaultRatio+"%";this.modal=new kr(this,this.$,i.html),this.figure=new Fi(this,this.$,n,{sizeUnit:s,autoRatio:{current:o,default:o}}),this.fileManager=new Er(this,this.$,{query:"iframe, video",loadEventName:"onVideoLoad",actionEventName:"onVideoAction"}),this.fileModalWrapper=i.fileModalWrapper,this.videoInputFile=i.videoInputFile,this.videoUrlFile=i.videoUrlFile,this.focusElement=this.videoUrlFile||this.videoInputFile,this.previewSrc=i.previewSrc,this.#Yc=this.pluginOptions.canResize,this.#nu=!this.#Yc||!this.pluginOptions.showHeightInput||this.pluginOptions.percentageOnlySize,this.query={youtube:{pattern:/youtu\.?be/i,action:t=>(t=this.convertUrlYoutube(t),Ie.addUrlQuery(t,this.pluginOptions.query_youtube)),tag:"iframe"},vimeo:{pattern:/vimeo\.com/i,action:t=>(t=this.convertUrlVimeo(t),Ie.addUrlQuery(t,this.pluginOptions.query_vimeo)),tag:"iframe"},...e.embedQuery};const l=[];for(const t in this.query)l.push(this.query[t].pattern);Nh.#Au=Nh.#Au.concat(this.pluginOptions.extensions||[]),Nh.#Bu=Nh.#Bu.concat(e.urlPatterns||[]),this.state={onlyPercentage:this.pluginOptions.percentageOnlySize,sizeUnit:s,defaultRatio:100*this.pluginOptions.defaultRatio+"%"},this.sizeService=new Eh(this,i),this.uploadService=new Mh(this);const r=i.galleryButton;r&&this.$.eventManager.addEvent(r,"click",this.#fu.bind(this)),this.videoInputFile&&this.$.eventManager.addEvent(i.fileRemoveBtn,"click",this.#pu.bind(this)),this.videoUrlFile&&this.$.eventManager.addEvent(this.videoUrlFile,"input",this.#gu.bind(this)),this.videoInputFile&&this.videoUrlFile&&this.$.eventManager.addEvent(this.videoInputFile,"change",this.#mu.bind(this))}setState(t,e){this.state[t]=e}open(){this.modal.open()}retainFormat(){return{query:"iframe, video",method:async t=>{if(/^(iframe)$/i.test(t?.nodeName)&&!Nh.#Nu(t.src))return;const e=Fi.GetContainer(t);if(e&&e.container&&e.cover)return;this.#bu(t,!0);const s=this.$.format.getLine(t);s&&(this.#ru=s.style.textAlign||s.style.float),this.#Cu(t)}}}onFilePasteAndDrop({file:t}){/^video/.test(t.type)&&(this.submitFile([t]),this.$.focusManager.focus())}modalOn(t){t?this.videoInputFile&&this.pluginOptions.allowMultiple&&this.videoInputFile.removeAttribute("multiple"):this.videoInputFile&&this.pluginOptions.allowMultiple&&this.videoInputFile.setAttribute("multiple","multiple"),this.sizeService.on(t)}async modalAction(){this.#ru=this.modal.form.querySelector('input[name="suneditor_video_radio"]:checked').value;let t=!1;return this.videoInputFile&&this.videoInputFile.files.length>0?t=await this.submitFile(this.videoInputFile.files):this.videoUrlFile&&this.#lu.length>0&&(t=await this.submitURL(this.#lu)),t&&Hh.setTimeout(this.$.component.select.bind(this.$.component,this.#_c,Nh.key),0),t}modalInit(){kr.OnChangeFile(this.fileModalWrapper,[]),this.videoInputFile&&(this.videoInputFile.value=""),this.videoUrlFile&&(this.#lu=this.previewSrc.textContent=this.videoUrlFile.value=""),this.videoInputFile&&this.videoUrlFile&&(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),this.modal.form.querySelector('input[name="suneditor_video_radio"][value="none"]').checked=!0,this.#nu=!1,this.sizeService.init()}componentSelect(t){this.#bu(t)}componentEdit(){this.modal.open()}async componentDestroy(t){const e=t||this.#_c,s=Ve.query.getParentElement(e,Fi.is)||e,i=s.previousElementSibling||s.nextElementSibling,n=s.parentNode;!1!==await this.$.eventManager.triggerEvent("onVideoDeleteBefore",{element:e,container:s,align:this.#ru,url:this.#lu})&&(Ve.utils.removeItem(s),this.modalInit(),n!==this.$.frameContext.get("wysiwyg")&&this.$.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.$.focusManager.focusEdge(i),this.$.history.push(!1))}findProcessUrl(t){const e=this.query;for(const s in e){const i=e[s];if(i.pattern.test(t))return{origin:t,url:i.action(t),tag:i.tag}}return null}convertUrlYoutube(t){return/^http/.test(t)||(t="https://"+t),t=t.replace("watch?v=",""),/^\/\/.+\/embed\//.test(t)||(t=t.replace(t.match(/\/\/.+\//)[0],"//www.youtube.com/embed/").replace("&","?&")),t}convertUrlVimeo(t){return t.endsWith("/")&&(t=t.slice(0,-1)),t="https://player.vimeo.com/video/"+t.slice(t.lastIndexOf("/")+1)}addQuery(t,e){if(e.length>0)if(/\?/.test(t)){const s=t.split("?");t=s[0]+"?"+e+"&"+s[1]}else t+="?"+e;return t}create(t,e,s,i,n,o,l,r){let a=null;if(o){if((t=this.#_c).src!==e){const s=this.findProcessUrl(e);if(/^iframe$/i.test(s?.tag)&&!/^iframe$/i.test(t.nodeName)){const s=this.createIframeTag();s.src=e,t.replaceWith(s),this.#_c=t=s}else if(/^video$/i.test(s?.tag)&&!/^video$/i.test(t.nodeName)){const s=this.createVideoTag();s.src=e,t.replaceWith(s),this.#_c=t=s}else t.src=e}a=this.#cu}else{t.src=e,this.#_c=t;a=Fi.CreateContainer(t,"se-video-container").container}this.#_c=t,this.#cu=a,this.figure.open(t,{nonResizing:this.#nu,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0});const h=this.sizeService.resolveSize(s,i,t,o);s=h.width,i=h.height,this.figure.setAlign(t,n),this.fileManager.setFileData(t,l),o?(this.#Yc&&h.isChanged&&this.figure.isVertical||this.figure.setTransform(t,s,i,0),this.$.history.push(!1)):this.$.component.insert(a,{scrollTo:!!r,insertBehavior:r?this.pluginOptions.insertBehavior:"line"})}createIframeTag(t){const e=Ve.utils.createElement("IFRAME");if(t)for(const s in t)e[s]=t[s];return this.#Iu(e),e}createVideoTag(t){const e=Ve.utils.createElement("VIDEO");if(t)for(const s in t)e[s]=t[s];return this.#Vu(e),e}async submitFile(t){if(0===t.length)return;let e=0;const s=[],i=this.pluginOptions.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++)if(n=t[l],/video/i.test(n.type)){if(o=n.size,i>0&&o>i){const t="[SUNEDITOR.videoUpload.fail] Size of uploadable single file: "+i/1e3+"KB",e=await this.$.eventManager.triggerEvent("onVideoUploadError",{error:t,limitSize:i,uploadSize:o,file:n});return this.$.ui.alertOpen(e===Lh?t:e||t,"error"),!1}s.push(n),e+=o}const n=this.pluginOptions.uploadSizeLimit,o=this.fileManager.getSize();if(n>0&&e+o>n){const t="[SUNEDITOR.videoUpload.fail] Size of uploadable total videos: "+n/1e3+"KB",s=await this.$.eventManager.triggerEvent("onVideoUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.$.ui.alertOpen(s===Lh?t:s||t,"error"),!1}const l={url:null,files:s,...this.#_u()},r=function(t,e,s){t(e=s||e,e.files)}.bind(this,this.uploadService.serverUpload.bind(this.uploadService),l),a=await this.$.eventManager.triggerEvent("onVideoUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==Lh||r(null)))}async submitURL(t){if(!(t=this.#lu))return!1;if(/^<iframe.*\/iframe>$/.test(t)){if(0===(t=(new DOMParser).parseFromString(t,"text/html").querySelector("iframe").src).length)return!1}const e=this.findProcessUrl(t);e&&(t=e.url);const s={name:t.split("/").pop(),size:0},i={url:t,files:s,...this.#_u(),process:e},n=function(t,e){t=e||t,this.create(this[/^iframe$/i.test(t.process?.tag)?"createIframeTag":"createVideoTag"](),t.url,t.inputWidth,t.inputHeight,t.align,t.isUpdate,t.files,!0)}.bind(this,i),o=await this.$.eventManager.triggerEvent("onVideoUploadBefore",{info:i,handler:n});return void 0===o||!1!==o&&(null!==o&&"object"==typeof o&&n(o),!0!==o&&o!==Lh||n(null),!0)}#bu(t,e=!1){if(!t)return;const s=this.figure.open(t,{nonResizing:this.#nu,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:e});this.#_c=t,this.#cu=s.container,this.#ru=s.align,t.style.float="";const i=String(s.width||s.originWidth||s.w||""),n=String(s.height||s.originHeight||s.h||"");this.sizeService.setOriginSize(i,n),this.videoUrlFile&&(this.#lu=this.previewSrc.textContent=this.videoUrlFile.value=this.#_c.src||this.#_c.querySelector("source")?.src||"");(this.modal.form.querySelector('input[name="suneditor_video_radio"][value="'+this.#ru+'"]')||this.modal.form.querySelector('input[name="suneditor_video_radio"][value="none"]')).checked=!0,this.#Yc&&this.sizeService.ready(s,t)}#_u(){const{w:t,h:e}=this.sizeService.getInputSize();return{inputWidth:t,inputHeight:e,align:this.#ru,isUpdate:this.modal.isUpdate,element:this.#_c}}#Cu(t){if(!t)return;/^video$/i.test(t.nodeName)?this.#Vu(t):/^iframe$/i.test(t.nodeName)&&this.#Iu(t);const e=t,s=t.cloneNode(!0),i=Fi.CreateContainer(s,"se-video-container"),n=i.container,o=Fi.GetContainer(e)?.container?.querySelector("figcaption");let l=null;o&&(l=Ve.utils.createElement("figcaption"),l.innerHTML=o.innerHTML,Ve.utils.removeItem(o),i.cover.appendChild(l)),this.figure.open(s,{nonResizing:this.#nu,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0});const r=(s.getAttribute("data-se-size")||",").split(","),a=r[0]||e.width||"",h=r[1]||e.height||this.state.defaultRatio||"";this.sizeService.applySize(a,h);const c=this.$.format.getLine(e);return c&&(this.#ru=c.style.textAlign||c.style.float),this.figure.setAlign(s,this.#ru),this.figure.retainFigureFormat(n,this.#_c,null,this.fileManager),s}#Vu(t){t.setAttribute("controls","true");const e=this.pluginOptions.videoTagAttributes;if(e)for(const s in e)t.setAttribute(s,e[s])}#Iu(t){t.frameBorder="0",t.allowFullscreen=!0;const e=this.pluginOptions.iframeTagAttributes;if(e)for(const s in e)t.setAttribute(s,e[s])}#pu(){this.videoInputFile.value="",this.videoUrlFile&&(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),kr.OnChangeFile(this.fileModalWrapper,[])}#gu(t){const e=Ve.query.getEventTarget(t).value.trim();/^<iframe.*\/iframe>$/.test(e)?(this.#lu=e,this.previewSrc.textContent='<IFrame :src=".."></IFrame>'):this.#lu=this.previewSrc.textContent=e?this.$.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.$.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#fu(){this.$.plugins.videoGallery.open(this.#ku.bind(this))}#ku(t){this.#lu=this.previewSrc.textContent=this.videoUrlFile.value=t.getAttribute("data-command")||t.src,this.videoUrlFile.focus()}#mu(t){this.videoInputFile.value?(this.videoUrlFile.disabled=!0,this.previewSrc.style.textDecoration="line-through"):(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration="");const e=Ve.query.getEventTarget(t);kr.OnChangeFile(this.fileModalWrapper,e.files)}}const Ah=Nh,{NO_EVENT:Bh,ON_OVER_COMPONENT:Ih}=Ae;class Vh extends Pr{static key="audio";static className="";static component(t){return/^AUDIO$/i.test(t?.nodeName)?t:null}#Ou;#Ru;#Pu="";#_c=null;constructor(t,e){super(t),this.title=this.$.lang.audio,this.icon="audio",this.pluginOptions={defaultWidth:e.defaultWidth?Oe.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight?Oe.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"",createFileInput:!!e.createFileInput,createUrlInput:void 0===e.createUrlInput||!e.createFileInput||e.createUrlInput,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:Oe.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Oe.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?"audio/*":e.acceptedFormats.trim()||"audio/*",audioTagAttributes:e.audioTagAttributes||null,insertBehavior:e.insertBehavior};const s=function({lang:t,icons:e,plugins:s},i){let n=`\n <form method="post" enctype="multipart/form-data">\n <div class="se-modal-header">\n <button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n ${e.cancel}\n </button>\n <span class="se-modal-title">${t.audio_modal_title}</span>\n </div>\n <div class="se-modal-body">`;i.createFileInput&&(n+=`\n <div class="se-modal-form">\n <label>${t.audio_modal_file}</label>\n ${kr.CreateFileInput({lang:t,icons:e},i)}\n </div>`);i.createUrlInput&&(n+=`\n <div class="se-modal-form">\n <label>${t.audio_modal_url}</label>\n\t\t\t<div class="se-modal-form-files">\n\t\t\t\t<input class="se-input-form se-input-url" data-focus type="text" />\n\t\t\t\t${s.audioGallery?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button __se__gallery" aria-label="${t.audioGallery}">\n\t\t\t\t\t\t\t${e.audio_gallery}\n\t\t\t\t\t\t\t${Ve.utils.createTooltipInner(t.audioGallery)}\n\t\t\t\t\t\t\t</button>`:""}\n\t\t\t</div>\n <pre class="se-link-preview"></pre>\n </div>`);return n+=`\n </div>\n <div class="se-modal-footer">\n <button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}">\n <span>${t.submitButton}</span>\n </button>\n </div>\n </form>`,Ve.utils.createElement("DIV",{class:"se-modal-content"},n)}(this.$,this.pluginOptions),i=function({lang:t,icons:e}){const s=`\n <div class="se-arrow se-arrow-up"></div>\n <div class="link-content">\n <div class="se-btn-group">\n <button type="button" data-command="update" tabindex="-1" class="se-btn se-tooltip">\n ${e.edit}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.edit}</span>\n </span>\n </button>\n <button type="button" data-command="copy" tabindex="-1" class="se-btn se-tooltip">\n ${e.copy}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.copy}</span>\n </span>\n </button>\n <button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n ${e.delete}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.remove}</span>\n </span>\n </button>\n </div>\n </div>`;return Ve.utils.createElement("DIV",{class:"se-controller"},s)}(this.$);this.modal=new kr(this,this.$,s),this.controller=new Ti(this,this.$,i,{position:"bottom",disabled:!0}),this.fileManager=new Er(this,this.$,{query:"audio",loadEventName:"onAudioLoad",actionEventName:"onAudioAction"}),this.figure=new Fi(this,this.$,null,{}),this.fileModalWrapper=s.querySelector(".se-flex-input-wrapper"),this.audioInputFile=s.querySelector(".__se__file_input"),this.audioUrlFile=s.querySelector(".se-input-url"),this.preview=s.querySelector(".se-link-preview"),this.#Ou=this.pluginOptions.defaultWidth,this.#Ru=this.pluginOptions.defaultHeight;const n=s.querySelector(".__se__gallery");n&&this.$.eventManager.addEvent(n,"click",this.#fu.bind(this)),this.audioInputFile&&(this.$.eventManager.addEvent(s.querySelector(".se-modal-files-edge-button"),"click",this.#pu.bind(this,this.audioUrlFile,this.preview)),this.audioUrlFile&&this.$.eventManager.addEvent(this.audioInputFile,"change",this.#zu.bind(this))),this.audioUrlFile&&this.$.eventManager.addEvent(this.audioUrlFile,"input",this.#gu.bind(this))}open(){this.modal.open()}retainFormat(){return{query:"audio",method:t=>{const e=Fi.GetContainer(t);if(e&&e.container&&e.cover)return;this.#Vu(t);const s=Fi.CreateContainer(t.cloneNode(!0),"se-flex-component");this.figure.retainFigureFormat(s.container,t,null,this.fileManager)}}}onFilePasteAndDrop({file:t}){/^audio/.test(t.type)&&(this.submitFile([t]),this.$.focusManager.focus())}modalOn(t){t?this.#_c?(this.#Pu=this.preview.textContent=this.audioUrlFile.value=this.#_c.src,this.audioInputFile&&this.pluginOptions.allowMultiple&&this.audioInputFile.removeAttribute("multiple")):this.audioInputFile&&this.pluginOptions.allowMultiple&&this.audioInputFile.removeAttribute("multiple"):this.audioInputFile&&this.pluginOptions.allowMultiple&&this.audioInputFile.setAttribute("multiple","multiple")}async modalAction(){return this.audioInputFile&&this.audioInputFile?.files.length>0?await this.submitFile(this.audioInputFile.files):!!(this.audioUrlFile&&this.#Pu.length>0)&&await this.submitURL(this.#Pu)}modalInit(){kr.OnChangeFile(this.fileModalWrapper,[]),this.audioInputFile&&(this.audioInputFile.value=""),this.audioUrlFile&&(this.#Pu=this.preview.textContent=this.audioUrlFile.value=""),this.audioInputFile&&this.audioUrlFile&&(this.audioUrlFile.disabled=!1,this.preview.style.textDecoration="")}controllerAction(t){switch(t.getAttribute("data-command")){case"update":this.audioUrlFile&&(this.#Pu=this.preview.textContent=this.audioUrlFile.value=this.#_c.src),this.open();break;case"copy":{const t=Fi.GetContainer(this.#_c);this.$.component.copy(t.container);break}case"delete":this.componentDestroy(null)}}componentSelect(t){this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,infoOnly:!1}),this.#bu(t)}async componentDestroy(t){const e=t||this.#_c,s=Fi.GetContainer(e),i=s.container||e,n=i.previousElementSibling||i.nextElementSibling;if(!1===await this.$.eventManager.triggerEvent("onAudioDeleteBefore",{element:e,container:s,url:e.getAttribute("src")}))return;const o=i.parentNode;Ve.utils.removeItem(i),this.modalInit(),this.controller.close(),o!==this.$.frameContext.get("wysiwyg")&&this.$.nodeTransform.removeAllParents(o,(function(t){return 0===t.childNodes.length}),null),this.$.focusManager.focusEdge(n),this.$.history.push(!1)}async submitFile(t){if(0===t.length)return!1;let e=0;const s=[],i=this.pluginOptions.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++)if(n=t[l],/audio/i.test(n.type)){if(o=n.size,i>0&&o>i){const t="[SUNEDITOR.audioUpload.fail] Size of uploadable single file: "+i/1e3+"KB",e=await this.$.eventManager.triggerEvent("onAudioUploadError",{error:t,limitSize:i,uploadSize:o,file:n});return this.$.ui.alertOpen(e===Bh?t:e||t,"error"),!1}s.push(n),e+=o}const n=this.pluginOptions.uploadSizeLimit;if(n>0&&e+this.fileManager.getSize()>n){const t="[SUNEDITOR.audioUpload.fail] Size of uploadable total audios: "+n/1e3+"KB",s=await this.$.eventManager.triggerEvent("onAudioUploadError",{error:t,limitSize:n,currentSize:this.fileManager.getSize(),uploadSize:e});return this.$.ui.alertOpen(s===Bh?t:s||t,"error"),!1}const o={files:s,isUpdate:this.modal.isUpdate,element:this.#_c},l=function(t,e,s){t(s=e||s,s.files)}.bind(this,this.#Du.bind(this),o),r=await this.$.eventManager.triggerEvent("onAudioUploadBefore",{info:o,handler:l});return void 0===r||!!r&&(null!==r&&"object"==typeof r&&l(r),!0!==r&&r!==Bh||l(null),!0)}async submitURL(t){if(0===t.length)return!1;const e={name:t.split("/").pop(),size:0},s={url:t,files:e,isUpdate:this.modal.isUpdate,element:this.#Fu()},i=function(t,e,s){t((s=e||s).element,s.url,s.files,s.isUpdate,!0)}.bind(this,this.create.bind(this),s),n=await this.$.eventManager.triggerEvent("onAudioUploadBefore",{info:s,handler:i});return void 0===n||!!n&&(null!==n&&"object"==typeof n&&i(n),!0!==n&&n!==Bh||i(null),!0)}create(t,e,s,i,n){if(i){if(this.#_c&&(t=this.#_c),this.fileManager.setFileData(t,s),!t||t.src===e)return void this.$.component.select(t,Vh.key);t.src=e,this.$.component.select(t,Vh.key)}else{this.fileManager.setFileData(t,s),t.src=e;const i=Fi.CreateContainer(t,"se-flex-component");if(!this.$.component.insert(i.container,{scrollTo:!!n,insertBehavior:n?this.pluginOptions.insertBehavior:"line"}))return void(n&&this.$.focusManager.focus());if(!this.$.options.get("componentInsertBehavior")){const t=this.$.format.addLine(i.container,null);t&&this.$.selection.setRange(t,0,t,0)}}i&&this.$.history.push(!1)}#bu(t){yi.get("__overInfo")!==Ih&&(this.#_c=t,this.controller.open(t,null,{isWWTarget:!1,addOffset:null}))}#Xh(t,e){const s=e.result;for(let e,i,n=0,o=s.length;n<o;n++)i=t.isUpdate?t.element:this.#Fu(),e={name:s[n].name,size:s[n].size},this.create(i,s[n].url,e,t.isUpdate,n===o-1)}#Fu(){const t=this.#Ou,e=this.#Ru,s=Ve.utils.createElement("AUDIO",{style:(t?"width:"+t+"; ":"")+(e?"height:"+e+";":"")});return this.#Vu(s),s}#Vu(t){t.setAttribute("controls","true");const e=this.pluginOptions.audioTagAttributes;if(e)for(const s in e)t.setAttribute(s,e[s])}#Du(t,e){if(!e)return;const s=this.modal.isUpdate?[e[0]]:e;this.fileManager.upload(this.pluginOptions.uploadUrl,this.pluginOptions.uploadHeaders,s,this.#Qd.bind(this,t),this.#Jh.bind(this))}async#Jh(t){const e=await this.$.eventManager.triggerEvent("onAudioUploadError",{error:t}),s=e===Bh?t.errorMessage:e||t.errorMessage;this.$.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.audio.error]",s)}async#Qd(t,e){if(await this.$.eventManager.triggerEvent("audioUploadHandler",{xmlHttp:e,info:t})===Bh){const s=JSON.parse(e.responseText);s.errorMessage?this.#Jh(s):this.#Xh(t,s)}}#gu(t){const e=Ve.query.getEventTarget(t).value.trim();this.#Pu=this.preview.textContent=e?this.$.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.$.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#fu(){this.$.plugins.audioGallery.open(this.#ku.bind(this))}#ku(t){this.#Pu=this.preview.textContent=this.audioUrlFile.value=t.getAttribute("data-command")||t.src,this.audioUrlFile.focus()}#pu(t,e){this.audioInputFile.value="",t&&(t.disabled=!1,e.style.textDecoration=""),kr.OnChangeFile(this.fileModalWrapper,[])}#zu(t){const e=Ve.query.getEventTarget(t);this.audioInputFile.value?(this.audioUrlFile.disabled=!0,this.preview.style.textDecoration="line-through"):(this.audioUrlFile.disabled=!1,this.preview.style.textDecoration=""),kr.OnChangeFile(this.fileModalWrapper,e.files)}}const Oh=Vh,{_w:Rh,NO_EVENT:Ph}=Ae;class zh extends Pr{static key="embed";static className="";static component(t){const e=t.children;let s="",i=null;if(Ve.check.isIFrame(t)&&(i=t,s=t.src),!s&&/^DIV$/i.test(t?.nodeName)&&Ve.check.isIFrame(e[0])&&(i=e[0],s=i.src),!s&&Ve.utils.hasClass(t,"se-embed-container")){i=Ve.query.getChildNode(t,(t=>t.src||t.href)),s=i?.src||i?.href}if(/^BLOCKQUOTE$/i.test(t?.nodeName)){const e=t.querySelector("a");if(e&&e.href)return i=t,s=e.href,this.#Nu(s)?i:null}return s?this.#Nu(s)?i:null:i}static#Nu(t){return t=t?.toLowerCase()||"",!!this.#Bu.some((e=>e.test(t)))}static#qu(t,e){return!!t&&e.some((e=>e instanceof RegExp?e.test(t):t.startsWith(e)))}static#Bu=null;#Eu;#Tu;#qd;#Wd;#Yc;#Wu;#nu;#lu="";#ru="none";#_c=null;#hu=null;#cu=null;#Ud={w:0,h:0};constructor(t,e){super(t),this.title=this.$.lang.embed,this.icon="embed",this.pluginOptions={canResize:void 0===e.canResize||e.canResize,showHeightInput:void 0===e.showHeightInput||!!e.showHeightInput,defaultWidth:e.defaultWidth&&Oe.get(e.defaultWidth,0)?Oe.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight&&Oe.get(e.defaultHeight,0)?Oe.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"",percentageOnlySize:!!e.percentageOnlySize,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:Oe.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Oe.get(e.uploadSingleSizeLimit,0),iframeTagAttributes:e.iframeTagAttributes||null,query_youtube:e.query_youtube||"",query_vimeo:e.query_vimeo||"",scriptSrcWhitelist:Array.isArray(e.scriptSrcWhitelist)?e.scriptSrcWhitelist:[],insertBehavior:e.insertBehavior};const s=this.pluginOptions.percentageOnlySize?"%":"px",i=function({lang:t,icons:e},s){let i=`\n\t<form method="post" enctype="multipart/form-data">\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n\t\t\t${e.cancel}\n\t\t\t</button>\n\t\t\t<span class="se-modal-title">${t.embed_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-modal-body">\n\t\t\t<div class='se-modal-form'>\n\t\t\t\t<label>${t.embed_modal_source}</label>\n\t\t\t\t<input class='se-input-form se-input-url' type='text' data-focus />\n\t\t\t\t<pre class='se-link-preview'></pre>\n\t\t\t</div>`;if(s.canResize){const n=s.percentageOnlySize,o=n?' style="display: none !important;"':"",l=s.showHeightInput?"":' style="display: none !important;"',r=s.showRatioOption?"":' style="display: none !important;"',a=n||s.showHeightInput||s.showRatioOption?"":' style="display: none !important;"';i+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<div class="se-modal-size-text">\n\t\t\t\t\t<label class="size-w">${t.width}</label>\n\t\t\t\t\t<label class="se-modal-size-x">&nbsp;</label>\n\t\t\t\t\t<label class="size-h"${l}>${t.height}</label>\n\t\t\t\t\t<label class="size-h"${r}>(${t.ratio})</label>\n\t\t\t\t</div>\n\t\t\t\t<input class="se-input-control _se_size_x" placeholder="auto"${n?' type="number" min="1"':'type="text"'}${n?' max="100"':""}/>\n\t\t\t\t<label class="se-modal-size-x"${a}>${n?"%":"x"}</label>\n\t\t\t\t<input class="se-input-control _se_size_y" placeholder="auto"\n\t\t\t\t${n?' type="number" min="1"':'type="text"'}${n?' max="100"':""}${l}/>\n\t\t\t\t<button type="button" title="${t.revert}" aria-label="${t.revert}" class="se-btn se-modal-btn-revert">${e.revert}</button>\n\t\t\t</div>\n\t\t\t<div class="se-modal-form se-modal-form-footer"${o}${a}>\n\t\t\t\t<label>\n\t\t\t\t\t<input type="checkbox" class="se-modal-btn-check _se_check_proportion" />&nbsp;\n\t\t\t\t\t<span>${t.proportion}</span>\n\t\t\t\t</label>\n\t\t\t</div>`}i+=`\n\t\t</div>\n\t\t<div class="se-modal-footer">\n\t\t\t<div class="se-figure-align">\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="none" checked>${t.basic}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="left">${t.left}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="center">${t.center}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="right">${t.right}</label>\n\t\t\t</div>\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}"><span>${t.submitButton}</span></button>\n\t\t</div>\n\t</form>`;const n=Ve.utils.createElement("DIV",{class:"se-modal-content"},i);return{html:n,figureAlignBtn:n.querySelector(".se-figure-align"),fileModalWrapper:n.querySelector(".se-flex-input-wrapper"),embedInput:n.querySelector(".se-input-url"),previewSrc:n.querySelector(".se-link-preview"),proportion:n.querySelector("._se_check_proportion"),inputX:n.querySelector("._se_size_x"),inputY:n.querySelector("._se_size_y"),revertBtn:n.querySelector(".se-modal-btn-revert")}}(this.$,this.pluginOptions),n=e.controls||(this.pluginOptions.canResize?[["resize_auto,75,50","align","edit","revert","copy","remove"]]:[["align","edit","copy","remove"]]);n.some((t=>t.includes("align")))||(i.figureAlignBtn.style.display="none"),this.modal=new kr(this,this.$,i.html),this.figure=new Fi(this,this.$,n,{sizeUnit:s}),this.fileModalWrapper=i.fileModalWrapper,this.embedInput=i.embedInput,this.focusElement=this.embedInput,this.previewSrc=i.previewSrc,this.sizeUnit=s,this.proportion=null,this.inputX=null,this.inputY=null,this.#Eu=this.pluginOptions.defaultWidth,this.#Tu=this.pluginOptions.defaultHeight,this.#qd="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.#Wd="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.#Yc=this.pluginOptions.canResize,this.#Wu=this.pluginOptions.percentageOnlySize,this.#nu=!this.#Yc||!this.pluginOptions.showHeightInput||this.#Wu,this.query={facebook:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:facebook\.com)\/(.+)/i,action:t=>`https://www.facebook.com/plugins/post.php?href=${encodeURIComponent(t)}&show_text=true&width=500`,tag:"iframe"},twitter:{pattern:/^(?:https?:\/\/)?(?:(?:www\.)?(?:twitter\.com|x\.com)\/(?:[^/?#]+\/)?status\/\d+(?:[/?#]|$)|platform\.twitter\.com\/embed\/Tweet\.html(?:[?#].*)?$)/i,action:t=>`https://platform.twitter.com/embed/Tweet.html?url=${encodeURIComponent(t)}`,tag:"iframe"},instagram:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:instagram\.com)\/p\/(.+)/i,action:t=>`https://www.instagram.com/p/${t.match(this.query.instagram.pattern)[1]}/embed`,tag:"iframe"},linkedin:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:linkedin\.com)\/(.+)\/(.+)/i,action:t=>`https://www.linkedin.com/embed/feed/update/${encodeURIComponent(t.split("/").pop())}`,tag:"iframe"},pinterest:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:pinterest\.com)\/pin\/(.+)/i,action:t=>`https://assets.pinterest.com/ext/embed.html?id=${t.match(this.query.pinterest.pattern)[1]}`,tag:"iframe"},spotify:{pattern:/(?:https?:\/\/)?(?:open\.)?(?:spotify\.com)\/(track|album|playlist|show|episode)\/(.+)/i,action:t=>{const e=t.match(this.query.spotify.pattern);return`https://open.spotify.com/embed/${e[1]}/${e[2]}`},tag:"iframe"},codepen:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:codepen\.io)\/(.+)\/pen\/(.+)/i,action:t=>{const[,e,s]=t.match(this.query.codepen.pattern);return`https://codepen.io/${e}/embed/${s}`},tag:"iframe"},...e.embedQuery};const o=[];for(const t in this.query)o.push(this.query[t].pattern);zh.#Bu=o.concat(e.urlPatterns||[]),this.$.eventManager.addEvent(this.embedInput,"input",this.#gu.bind(this)),this.#Yc&&(this.proportion=i.proportion,this.inputX=i.inputX,this.inputY=i.inputY,this.inputX.value=this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight,this.$.eventManager.addEvent(this.inputX,"keyup",this.#Yd.bind(this,"x")),this.$.eventManager.addEvent(this.inputY,"keyup",this.#Yd.bind(this,"y")),this.$.eventManager.addEvent(i.revertBtn,"click",this.#Xd.bind(this)))}open(){this.modal.open()}retainFormat(){return{query:"iframe",method:async t=>{if(!zh.#Nu(t.src))return;const e=Fi.GetContainer(t);if(e&&e.container&&e.cover)return;this.#bu(t,!0);const s=this.$.format.getLine(t);s&&(this.#ru=s.style.textAlign||s.style.float),this.#Cu(t)}}}modalOn(t){!t&&this.#Yc?(this.inputX.value=this.#qd="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.inputY.value=this.#Wd="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.proportion.disabled=!0):t&&(this.#lu=this.previewSrc.textContent=this.embedInput.value=this.#hu.getAttribute("data-se-origin")||"")}async modalAction(){this.#ru=this.modal.form.querySelector('input[name="suneditor_embed_radio"]:checked').value;let t=!1;return this.#lu.length>0&&(t=await this.submitSRC(this.#lu)),t&&Rh.setTimeout(this.$.component.select.bind(this.$.component,this.#_c,zh.key),0),t}modalInit(){kr.OnChangeFile(this.fileModalWrapper,[]),this.#lu=this.previewSrc.textContent=this.embedInput.value="",this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="none"]').checked=!0,this.#Ud={w:0,h:0},this.#nu=!1,this.#Yc&&(this.inputX.value=this.pluginOptions.defaultWidth===this.#Eu?"":this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight===this.#Tu?"":this.pluginOptions.defaultHeight,this.proportion.checked=!1,this.proportion.disabled=!0)}componentSelect(t){this.#bu(t)}componentEdit(){this.modal.open()}async componentDestroy(t){const e=t||this.#_c,s=Ve.query.getParentElement(e,Fi.is)||e,i=s.previousElementSibling||s.nextElementSibling,n=s.parentNode;!1!==await this.$.eventManager.triggerEvent("onEmbedDeleteBefore",{element:e,container:s,align:this.#ru,url:this.#lu})&&(Ve.utils.removeItem(s),this.modalInit(),n!==this.$.frameContext.get("wysiwyg")&&this.$.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.$.focusManager.focusEdge(i),this.$.history.push(!1))}findProcessUrl(t){const e=this.query;for(const s in e){const i=e[s];if(i.pattern.test(t))return{origin:t,url:i.action(t),tag:i.tag}}return null}async submitSRC(t){if(!(t||=this.#lu))return!1;let e=null;if(/^<iframe\s|^<blockquote\s/i.test(t)){const s=(new DOMParser).parseFromString(t,"text/html").body.children;if(0===s.length)return!1;for(let t=0;t<s.length;t++){const e=s[t];if(/^iframe$/i.test(e.nodeName)&&!zh.#Nu(e.getAttribute("src")||""))return!1;const i=e.querySelectorAll?.("iframe");if(i)for(let t=0;t<i.length;t++)if(!zh.#Nu(i[t].getAttribute("src")||""))return!1}e={children:s,...this.#_u(),process:null}}else{const s=this.findProcessUrl(t);if(!s)return!1;t=s.url,e={...this.#_u(),url:t,process:s}}const s=function(e,s,i){e(t,(s=i||s).process,s.url,s.children,s.inputWidth,s.inputHeight,s.align,s.isUpdate)}.bind(this,this.#Uu.bind(this),e),i=await this.$.eventManager.triggerEvent("onEmbedInputBefore",{...e,handler:s});return void 0===i||!1!==i&&(null!==i&&"object"==typeof i&&s(i),!0!==i&&i!==Ph||s(null),!0)}#bu(t,e=!1){if(!t)return;const s=this.figure.open(t,{nonResizing:this.#nu,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:e});if(this.#_c=t,this.#hu=s.cover,this.#cu=s.container,this._caption=s.caption,this.#ru=s.align,!this.#hu?.getAttribute?.("data-se-origin")){const e=t?.getAttribute?.("src")||t?.querySelector?.("a")?.href;e&&zh.#Nu(e)&&this.#hu.setAttribute("data-se-origin",e)}t.style.float="",this.#qd=String(s.originWidth||s.w||""),this.#Wd=String(s.originHeight||s.h||"");if((this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="'+this.#ru+'"]')||this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="none"]')).checked=!0,!this.#Yc)return;const i=this.#Wu&&this.figure.isVertical,{dw:n,dh:o}=this.figure.getSize(t);this.inputX.value="auto"===n?"":n,this.inputY.value="auto"===o?"":o,this.proportion.checked=!0,this.inputX.disabled=!!i,this.inputY.disabled=!!i,this.proportion.disabled=!!i,this.#Ud=this.proportion.checked?s.ratio:{w:0,h:0}}#Zu(){const t=Ve.utils.createElement("IFRAME");return this.#Iu(t),t}#Gu(){return Ve.utils.createElement("BLOCKQUOTE")}#Uu(t,e,s,i,n,o,l,r){let a=null,h=null,c=null,d=null;if(r){if(a=this.#_c,a.src!==s){const t=this.findProcessUrl(s);if(/^iframe$/i.test(t?.tag)&&!/^iframe$/i.test(a.nodeName)){const t=this.#Zu();t.src=s,a.replaceWith(t),a=t}else if(/^blockquote$/i.test(t?.tag)&&!/^blockquote$/i.test(a.nodeName)){const t=this.#Gu();t.setAttribute("src",s),a.replaceWith(t),a=t}else a.src=s}c=this.#cu,h=Ve.query.getParentElement(a,"FIGURE")}else if(e){a=this.#Zu(),a.src=s;const t=Fi.CreateContainer(a,"se-embed-container");h=t.cover,c=t.container}else{a=i[0];const t=Fi.CreateContainer(a,"se-embed-container");h=t.cover,c=t.container;const e=Array.from(i),s=this.pluginOptions.scriptSrcWhitelist;for(const t of e)if(/^script$/i.test(t.nodeName)){const e=t.getAttribute("src")||"";if(!zh.#qu(e,s))continue;d=Ve.utils.createElement("script",{src:e,async:"true"},null)}else h.appendChild(t)}this.#_c=a,this.#hu=h,this.#cu=c,this.figure.open(a,{nonResizing:this.#nu,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0}),n||=this.#Eu,o||=this.#Tu;const u=this.figure.getSize(a),p=u.w!==n||u.h!==o,g=!r||p;if(g&&this.#ju(n,o),this.figure.setAlign(a,l),h.setAttribute("data-se-origin",t),r)this.#Yc&&g&&this.figure.isVertical||this.figure.setTransform(a,n,o,0),d||this.$.history.push(!1);else{if(this.$.component.insert(c,{skipHistory:!0,scrollTo:!1,insertBehavior:this.pluginOptions.insertBehavior}),d)try{this.$.history.pause(),d.onload=()=>{Ve.utils.removeItem(d),d=null},h.appendChild(d);const t=new MutationObserver((e=>{for(const s of e)if("childList"===s.type&&!a.parentElement){this.$.history.resume(),this.$.history.push(!1),t.disconnect();break}}));t.observe(this.$.frameContext.get("wysiwyg"),{subtree:!0,childList:!0})}catch(t){this.$.history.resume(),console.warn("[SUNEDITOR] Embed tag script load error.",t)}if(!this.$.options.get("componentInsertBehavior")){const t=this.$.format.addLine(c,null);t&&this.$.selection.setRange(t,0,t,0)}}}#Cu(t){if(!t)return;this.#Iu(t);const e=t;t=t.cloneNode(!0);const s=Fi.CreateContainer(t,"se-embed-container").container;this.figure.open(t,{nonResizing:this.#nu,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0});const i=(t.getAttribute("data-se-size")||",").split(","),n=i[0]||e.width||"",o=i[1]||e.height||"";this.#ju(n,o);const l=this.$.format.getLine(e);return l&&(this.#ru=l.style.textAlign||l.style.float),this.figure.setAlign(t,this.#ru),this.figure.retainFigureFormat(s,this.#_c,null,null),t}#ju(t,e){t||=this.inputX?.value||this.pluginOptions.defaultWidth,e||=this.inputY?.value||this.pluginOptions.defaultHeight,this.#Wu&&(t?/%$/.test(t+"")||(t+="%"):t="100%"),this.figure.setSize(t,e)}#_u(){return{inputWidth:this.inputX?.value||"",inputHeight:this.inputY?.value||"",align:this.#ru,isUpdate:this.modal.isUpdate,element:this.#_c}}#Iu(t){t.frameBorder="0",t.allowFullscreen=!0;const e=this.pluginOptions.iframeTagAttributes;if(e)for(const s in e)t.setAttribute(s,e[s])}#gu(t){const e=Ve.query.getEventTarget(t).value.trim();/^<iframe.*\/iframe>$/.test(e)?(this.#lu=e,this.previewSrc.textContent='<IFrame :src=".."></IFrame>'):this.#lu=this.previewSrc.textContent=e?this.$.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.$.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#Xd(){this.#Wu?this.inputX.value=Number(this.#qd)>100?"100":this.#qd:(this.inputX.value=this.#qd,this.inputY.value=this.#Wd)}#Yd(t,e){if(Re.isSpace(e.code))return void e.preventDefault();const s=Ve.query.getEventTarget(e);if("x"===t&&this.#Wu&&Number(s.value)>100)s.value="100";else if(this.proportion.checked){const e=Fi.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this.#Ud);"x"===t?this.inputY.value=String(e.h):this.inputX.value=String(e.w)}}}const Dh=zh,{_w:Fh,_d:qh}=Ae;class Wh extends Pr{static key="math";static className="";static component(t){return Ve.utils.hasClass(t,"se-math|katex")&&Ve.check.isComponentContainer(t)?t:null}#_c=null;constructor(t,e){super(t),this.title=this.$.lang.math,this.icon="math",this.katex=null,this.mathjax=null,(this.katex=this.#Ku())||(this.mathjax=this.#Yu())||console.warn('[SUNEDITOR.plugins.math.warn] The math plugin must need either "KaTeX" or "MathJax" library. Please add the katex or mathjax option. See: https://github.com/ARA-developer/suneditor/blob/develop/guide/external-libraries.md'),this.pluginOptions={formSize:{width:"460px",height:"14em",maxWidth:"",maxHeight:"",minWidth:"400px",minHeight:"40px",...e.formSize},canResize:e.canResize??!0,autoHeight:!!e.autoHeight,fontSizeList:e.fontSizeList||[{text:"1",value:"1em"},{text:"1.5",value:"1.5em"},{text:"2",value:"2em"},{text:"2.5",value:"2.5em"}],onPaste:"function"==typeof e.onPaste?e.onPaste:null},this.pluginOptions.autoHeight&&(this.pluginOptions.formSize.height=this.pluginOptions.formSize.minHeight),this.defaultFontSize=null;const s=function(t){const{$:e,pluginOptions:s,katex:i}=t,{lang:n,icons:o}=e,{formSize:l,fontSizeList:r,canResize:a,autoHeight:h}=s,{width:c,height:d,maxWidth:u,maxHeight:p,minWidth:g,minHeight:m}=l,f=a?h?"horizontal":"auto":"none";let v=r[0].value,b=`\n <form>\n <div class="se-modal-header">\n <button type="button" data-command="close" class="se-btn se-close-btn" title="${n.close}" aria-label="${n.close}">\n ${o.cancel}\n </button>\n <span class="se-modal-title">${n.math_modal_title}</span>\n </div>\n <div class="se-modal-body">\n <div class="se-modal-form">\n <label>${n.math_modal_inputLabel} ${i?`(<a href="${Ae.KATEX_WEBSITE}" target="_blank">KaTeX</a>)`:`(<a href="${Ae.MATHJAX_WEBSITE}" target="_blank">MathJax</a>)`}</label>\n <textarea class="se-input-form se-math-exp se-modal-resize-form" type="text" data-focus style="width: ${c}; height: ${d}; min-width: ${g}; min-height: ${m}; resize: ${f};"></textarea>\n </div>\n <div class="se-modal-form">\n <label>${n.math_modal_fontSizeLabel}</label>\n <select class="se-input-select se-math-size">`;for(let t,e=0,s=r.length;e<s;e++)t=r[e],t.default&&(v=t.value),b+=`<option value="${t.value}"${t.default?" selected":""}>${t.text}</option>`;return b+=`</select>\n </div>\n <div class="se-modal-form">\n <label>${n.math_modal_previewLabel}</label>\n <p class="se-math-preview"></p>\n </div>\n </div>\n <div class="se-modal-footer">\n <button type="submit" class="se-btn-primary" title="${n.submitButton}" aria-label="${n.submitButton}">\n <span>${n.submitButton}</span>\n </button>\n </div>\n </form>`,t.defaultFontSize=v,Ve.utils.createElement("DIV",{class:"se-modal-content se-modal-responsive",style:`max-width: ${u}; max-height: ${p};`},b)}(this),i=function({lang:t,icons:e}){const s=`\n <div class="se-arrow se-arrow-up"></div>\n <div class="link-content">\n <div class="se-btn-group">\n <button type="button" data-command="update" tabindex="-1" class="se-btn se-tooltip">\n ${e.edit}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.edit}</span>\n </span>\n </button>\n <button type="button" data-command="copy" tabindex="-1" class="se-btn se-tooltip">\n ${e.copy}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.copy}</span>\n </span>\n </button>\n <button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n ${e.delete}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.remove}</span>\n </span>\n </button>\n </div>\n </div>`;return Ve.utils.createElement("DIV",{class:"se-controller se-controller-link"},s)}(this.$);this.modal=new kr(this,this.$,s),this.controller=new Ti(this,this.$,i,{position:"bottom",disabled:!0}),this.textArea=s.querySelector(".se-math-exp"),this.previewElement=s.querySelector(".se-math-preview"),this.fontSizeElement=s.querySelector(".se-math-size"),this.isUpdateState=!1,this.previewElement.style.fontSize=this.defaultFontSize,this.$.eventManager.addEvent(this.textArea,"input",this.#Xu.bind(this)),this.$.eventManager.addEvent(this.fontSizeElement,"change",function(t){this.fontSize=t.target.value}.bind(this.previewElement.style)),this.pluginOptions.onPaste&&this.$.eventManager.addEvent(this.textArea,"paste",this.pluginOptions.onPaste.bind(this))}open(){this.modal.open()}retainFormat(){return{query:".se-math, .katex, .MathJax",method:t=>{if(!this.katex&&!this.mathjax)return;const e=Uh(t);if(!e)return;const s=qh.createRange().createContextualFragment(this.#Ju(Ie.entityToHTML(this.#Qu(e,!0))));t.innerHTML=s.querySelector(".se-math, .katex").innerHTML,t.setAttribute("contenteditable","false"),Ve.utils.addClass(t,"se-component|se-inline-component|se-disable-pointer|se-math"),this.katex?Ve.utils.addClass(t,"katex"):Ve.utils.removeClass(t,"katex"),this.mathjax&&this.#tp(this.mathjax)}}}modalOn(t){if(this.isUpdateState=t,t){if(this.controller.currentTarget){const t=this.controller.currentTarget,e=Ie.entityToHTML(this.#Qu(Uh(t),!0)),s=function(t){const e=t.getAttribute("data-se-type");if(e)return e;const s=t.getAttribute("data-font-size");return s?(t.removeAttribute("data-font-size"),t.setAttribute("data-se-type",s),s):null}(t)||"1em";this.textArea.value=e,this.fontSizeElement.value=s,this.previewElement.innerHTML=this.#Ju(e),this.previewElement.style.fontSize=s}}else this.modalInit()}async modalAction(){if(0===this.textArea.value.trim().length||Ve.utils.hasClass(this.textArea,"se-error"))return this.textArea.focus(),!1;const t=this.textArea.value,e=this.previewElement.querySelector(".se-math, .katex");if(!e)return!1;if(Ve.utils.addClass(e,"se-component|se-inline-component|se-disable-pointer|se-math"),e.setAttribute("contenteditable","false"),e.setAttribute("data-se-value",Ie.htmlToEntity(this.#Qu(t,!1))),e.setAttribute("data-se-type",this.fontSizeElement.value),e.style.fontSize=this.fontSizeElement.value,this.katex?(Ve.utils.addClass(e,"katex"),Ve.utils.removeClass(e,"MathJax")):Ve.utils.removeClass(e,"katex"),this.isUpdateState){Ve.query.getParentElement(this.controller.currentTarget,".se-component").replaceWith(e);const t=this.$.component.get(e);return this.$.component.select(t.target,t.pluginName),!0}{const t=this.$.format.getLines();if(t.length>1){const s=Ve.utils.createElement(t[0].nodeName,null,e);this.$.component.insert(s,{insertBehavior:"none",scrollTo:!1})}else this.$.component.insert(e,{insertBehavior:"none",scrollTo:!1})}this.mathjax&&this.#tp(this.mathjax);const s=this.$.selection.getNearRange(e);return s?this.$.selection.setRange(s.container,s.offset,s.container,s.offset):this.$.component.select(e,Wh.key),!0}modalInit(){this.textArea.value="",this.previewElement.innerHTML="",Ve.utils.removeClass(this.textArea,"se-error")}controllerAction(t){switch(t.getAttribute("data-command")){case"update":this.modal.open();break;case"copy":this.#ep(this.#_c);break;case"delete":this.componentDestroy(this.controller.currentTarget)}}controllerClose(){this.#_c=null}componentSelect(t){if(Ve.utils.hasClass(t,"se-math|katex")&&Uh(t))return this.#_c=t,void this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null})}async componentDestroy(t){Ve.utils.removeItem(t),this.controller.close(),this.$.focusManager.focus(),this.$.history.push(!1)}#Ju(t){let e="";try{if(Ve.utils.removeClass(this.textArea,"se-error"),this.katex)e=this.katex.src.renderToString(t,{throwOnError:!0,displayMode:!0});else{if(!this.mathjax){const t=new Error('404 Not found. "KaTeX" or "MathJax" library');throw t.code="MATH_LIB_NOT_FOUND",t}e=this.mathjax.convert(t).outerHTML,/<mjx-merror/.test(e)?(Ve.utils.addClass(this.textArea,"se-error"),e=`<span class="se-math-error">${e}</span>`):e=`<span class="se-math">${e}</span>`}}catch(t){Ve.utils.addClass(this.textArea,"se-error"),e="MATH_LIB_NOT_FOUND"===t.code?`<span class="se-math-error">${t.message}</span>`:`<span class="se-math-error">Math syntax error. (Refer ${this.katex?`<a href="${Ae.KATEX_WEBSITE}" target="_blank">KaTeX</a>`:`<a href="${Ae.MATHJAX_WEBSITE}" target="_blank">MathJax</a>`})</span>`,console.warn("[SUNEDITOR.math.error] ",t.message)}return e}#Qu(t,e){return t.replace(/\\{2}/g,e?"\\":"\\\\")}async#ep(t){if(navigator.clipboard&&t)try{const e=Uh(t);await this.$.html.copy(e),Ve.utils.addClass(t,"se-copy"),Fh.setTimeout((()=>{Ve.utils.removeClass(t,"se-copy")}),120)}catch(t){console.error("[SUNEDITOR.math.copy.fail]",t)}}#Xu(t){const e=Ve.query.getEventTarget(t);this.pluginOptions.autoHeight&&(e.style.height="5px",e.style.height=e.scrollHeight+5+"px"),this.previewElement.innerHTML=this.#Ju(e.value),this.mathjax&&this.#tp(this.mathjax)}#tp(t){t.clear(),t.updateDocument()}#Ku(){const t=this.$.options.get("externalLibs").katex;if(!t)return null;if(!t.src)return console.warn("[SUNEDITOR.math.katex.fail] The katex option is set incorrectly."),null;const e=[{throwOnError:!1},t.options||{}].reduce(((t,e)=>{for(const s in e)t[s]=e[s];return t}),{});return t.options=e,t}#Yu(){const t=this.$.options.get("externalLibs").mathjax;if(!t)return null;this.$.frameOptions.get("iframe")&&console.warn("[SUNEDITOR.math.mathjax.fail] The MathJax option is not supported in the iframe.");try{const e=t.browserAdaptor();t.RegisterHTMLHandler(e);const s=new t.TeX,i=new t.CHTML;return t.src.document(document,{InputJax:s,OutputJax:i})}catch(t){return console.warn("[SUNEDITOR.math.mathjax.fail] The MathJax option is set incorrectly.",t),null}}}function Uh(t){const e=t.getAttribute("data-se-value");if(e)return e;const s=t.getAttribute("data-exp");return s?(t.removeAttribute("data-exp"),t.setAttribute("data-se-value",s),s):null}const Zh=Wh,{_w:Gh}=Ae;const jh=class extends Pr{static key="drawing";static className="";#st;#sp;constructor(t,e){super(t),this.title=this.$.lang.drawing,this.icon="drawing",this.pluginOptions={outputFormat:e.outputFormat||"dataurl",useFormatType:e.useFormatType??!1,defaultFormatType:["block","inline"].includes(e.defaultFormatType)?e.defaultFormatType:"block",keepFormatType:e.keepFormatType??!1,lineWidth:e.lineWidth||5,lineReconnect:!!e.lineReconnect,lineCap:["butt","round","square"].includes(e.lineCap)?e.lineCap:"round",lineColor:e.lineColor||"",formSize:{width:"750px",height:"50vh",maxWidth:"",maxHeight:"",minWidth:"150px",minHeight:"100px",...e.formSize},canResize:e.canResize??!0,maintainRatio:e.maintainRatio??!0},this.$.plugins.image?"svg"!==this.pluginOptions.outputFormat||this.$.plugins.image.pluginOptions.uploadUrl||console.warn('[SUNEDITOR.plugins.drawing.warn] The drawing plugin must need the "image" plugin with the "uploadUrl" option. Please add the "image" plugin with the "uploadUrl" option.'):console.warn('[SUNEDITOR.plugins.drawing.warn] The drawing plugin must need either "image" plugin. Please add the "image" plugin.');const s=function({lang:t,icons:e},s){const{width:i,height:n,maxWidth:o,maxHeight:l,minWidth:r,minHeight:a}=s.formSize,h=`\n <form>\n <div class="se-modal-header">\n <button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n ${e.cancel}\n </button>\n <span class="se-modal-title">${t.drawing_modal_title}</span>\n </div>\n <div class="se-modal-body" style="width: ${i}; height: ${n}; min-width: ${r}; min-height: ${a};">\n <canvas class="se-drawing-canvas" style="width: 100%; height: 100%;"></canvas>\n\t\t\t${s.canResize?'<div class="se-modal-resize-handle-w"></div><div class="se-modal-resize-handle-h"></div><div class="se-modal-resize-handle-c"></div>':""}\n\t\t</div>\n\t\t<div class="se-modal-body-bottom">\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<div class="se-modal-flex-form">\n\t\t\t\t\t${s.useFormatType?`\n\t\t\t\t\t\t\t<div class="se-modal-flex-group">\n\t\t\t\t\t\t\t\t<button type="button" class="se-btn se-tooltip" data-command="asBlock" aria-label="${t.blockStyle}">\n\t\t\t\t\t\t\t\t\t${e.as_block}\n\t\t\t\t\t\t\t\t\t${Ve.utils.createTooltipInner(t.blockStyle)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<button type="button" class="se-btn se-tooltip" data-command="asInline" aria-label="${t.inlineStyle}">\n\t\t\t\t\t\t\t\t\t${e.as_inline}\n\t\t\t\t\t\t\t\t\t${Ve.utils.createTooltipInner(t.inlineStyle)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</div>`:""}\n\t\t\t\t\t<div class="se-modal-flex-group">\n\t\t\t\t\t\t<button type="button" class="se-btn se-tooltip" data-command="remove" aria-label="${t.remove}">\n\t\t\t\t\t\t\t${e.eraser}\n\t\t\t\t\t\t\t${Ve.utils.createTooltipInner(t.remove)}\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n <div class="se-modal-footer">\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}">\n\t\t\t\t<span>${t.submitButton}</span>\n\t\t\t</button>\n </div>\n </form>`;return Ve.utils.createElement("DIV",{class:"se-modal-content se-modal-responsive",style:`max-width: ${o}; max-height: ${l};`},h)}(this.$,this.pluginOptions);this.modal=new kr(this,this.$,s),this.as=this.pluginOptions.defaultFormatType,this.pluginOptions.useFormatType&&(this.asBlock=s.querySelector('[data-command="asBlock"]'),this.asInline=s.querySelector('[data-command="asInline"]'),this.$.eventManager.addEvent([this.asBlock,this.asInline],"click",this.#vu.bind(this))),this.canvas=null,this.ctx=null,this.isDrawing=!1,this.points=[],this.paths=[],this.resizeObserver=null,this.#st={touchstart:this.#ip.bind(this),touchmove:this.#np.bind(this),mousedown:this.#op.bind(this),mousemove:this.#lp.bind(this),mouseup:this.#rp.bind(this),mouseleave:this.#ap.bind(this),mouseenter:this.#hp.bind(this)},this.#sp={touchstart:null,touchmove:null,mousedown:null,mousemove:null,mouseup:null,mouseleave:null,mouseenter:null},this.$.eventManager.addEvent(s.querySelector('[data-command="remove"]'),"click",this.#cp.bind(this))}open(){this.pluginOptions.useFormatType&&this.#wu("inline"===(this.pluginOptions.keepFormatType?this.as:this.pluginOptions.defaultFormatType)),this.modal.open(),this.#dp()}modalOff(){this.#up()}async modalAction(){if("svg"===this.pluginOptions.outputFormat){const t=this.#pp();this.$.plugins.image.modalInit(),this.$.plugins.image.submitFile(t)}else{const t=this.canvas.toDataURL(),e={name:"drawing",size:0};this.$.plugins.image.modalInit(),"inline"!==this.as?this.$.plugins.image.create(t,null,"auto","","none",e,""):this.$.plugins.image.createInline(t,null,"auto","","none",e,"")}return!0}#dp(){const t=this.canvas=this.modal.form.querySelector(".se-drawing-canvas");this.ctx=t.getContext("2d"),t.width=t.offsetWidth,t.height=t.offsetHeight,this.points=[],this.paths=[],this.#gp(),this.#sp.touchstart=this.$.eventManager.addEvent(t,"touchstart",this.#st.touchstart,{passive:!1,capture:!0}),this.#sp.touchmove=this.$.eventManager.addEvent(t,"touchmove",this.#st.touchmove,!0),this.#sp.mousedown=this.$.eventManager.addEvent(t,"mousedown",this.#st.mousedown,{passive:!1,capture:!0}),this.#sp.mousemove=this.$.eventManager.addEvent(t,"mousemove",this.#st.mousemove,!0),this.#sp.mouseup=this.$.eventManager.addEvent(t,"mouseup",this.#st.mouseup,!0),this.#sp.mouseleave=this.$.eventManager.addEvent(t,"mouseleave",this.#st.mouseleave),this.#sp.mouseenter=this.$.eventManager.addEvent(t,"mouseenter",this.#st.mouseenter),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),Ae.isResizeObserverSupported&&(this.resizeObserver=new ResizeObserver((()=>{const e=t.width,s=t.height,i=t.offsetWidth,n=t.offsetHeight;t.width=i,t.height=n,e===t.width&&s===t.height||(this.pluginOptions.maintainRatio&&this.#mp(e,s,i,n),this.#fp())})),this.resizeObserver.observe(t))}#up(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.canvas&&(this.$.eventManager.removeEvent(this.#sp.mousedown),this.$.eventManager.removeEvent(this.#sp.mousemove),this.$.eventManager.removeEvent(this.#sp.mouseup),this.$.eventManager.removeEvent(this.#sp.mouseleave),this.$.eventManager.removeEvent(this.#sp.mouseenter)),this.canvas=null,this.ctx=null,this.points=[],this.paths=[],this.isDrawing=!1}#gp(){this.ctx.lineWidth=this.pluginOptions.lineWidth,this.ctx.lineCap=this.pluginOptions.lineCap,this.ctx.strokeStyle=this.pluginOptions.lineColor||Gh.getComputedStyle(this.$.contextProvider.carrierWrapper).color}#vp(){this.#gp(),this.ctx.beginPath(),this.points.forEach((([t,e],s)=>{0===s?this.ctx.moveTo(t,e):this.ctx.lineTo(t,e)})),this.ctx.stroke()}#fp(){this.#gp(),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.paths.forEach((t=>{this.points=t,this.#vp()})),this.points=[]}#mp(t,e,s,i){const n=s/t,o=i/e;this.paths=this.paths.map((t=>t.map((([t,e])=>[t*n,e*o]))))}#bp(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.points=[],this.paths=[]}#yp(){const t="http://www.w3.org/2000/svg",e=document.createElementNS(t,"svg");return e.setAttribute("width",this.canvas.width+""),e.setAttribute("height",this.canvas.height+""),e.setAttribute("viewBox",`0 0 ${this.canvas.width} ${this.canvas.height}`),e.setAttribute("xmlns",t),this.paths.forEach((s=>{const i=s.reduce(((t,[e,s],i)=>t+(0===i?`M ${e} ${s}`:` L ${e} ${s}`)),""),n=document.createElementNS(t,"path");n.setAttribute("d",i),n.setAttribute("fill","none"),n.setAttribute("stroke",String(this.ctx.strokeStyle)),n.setAttribute("stroke-width",this.ctx.lineWidth+""),e.appendChild(n)})),e}#pp(){const t=this.#yp(),e=(new XMLSerializer).serializeToString(t),s=new Blob([e],{type:"image/svg+xml"}),i=new File([s],"drawing.svg",{type:"image/svg+xml"}),n=new DataTransfer;return n.items.add(i),n.files}#Cp(t){const{touches:e}=t,s=this.canvas.getBoundingClientRect();return{x:e[0].clientX-s.left,y:e[0].clientY-s.top}}#wu(t){t?(Ve.utils.addClass(this.asInline,"on"),Ve.utils.removeClass(this.asBlock,"on"),this.as="inline"):(Ve.utils.addClass(this.asBlock,"on"),Ve.utils.removeClass(this.asInline,"on"),this.as="block")}#op(t){t.preventDefault(),this.isDrawing=!0,this.points.push([t.offsetX,t.offsetY]),this.#vp()}#lp(t){t.preventDefault(),this.isDrawing&&(this.points.push([t.offsetX,t.offsetY]),this.#vp())}#ip(t){t.preventDefault();const{x:e,y:s}=this.#Cp(t);this.isDrawing=!0,this.points.push([e,s]),this.#vp()}#np(t){t.preventDefault();const{x:e,y:s}=this.#Cp(t);this.isDrawing&&(this.points.push([e,s]),this.#vp())}#rp(){this.isDrawing=!1,this.points.length>0&&(this.paths.push([...this.points]),this.points=[])}#ap(){this.isDrawing&&(this.paths.push([...this.points]),this.pluginOptions.lineReconnect||(this.points=[],this.isDrawing=!1))}#hp(t){if(1===t.buttons){if(this.isDrawing=!0,this.pluginOptions.lineReconnect){const e=this.paths.at(-1).at(-1);this.points.push([e[0],e[1]]),this.points.push([t.offsetX,t.offsetY])}else this.points.push([t.offsetX,t.offsetY]);this.#vp()}}#cp(){this.#bp()}#vu(t){this.#wu("asInline"===Ve.query.getEventTarget(t).getAttribute("data-command"))}};const Kh=class extends Ar{static key="imageGallery";static className="";constructor(t,e){super(t),this.title=this.$.lang.imageGallery,this.icon="image_gallery",this.onSelectfunction=null,this.browser=new Il(this,this.$,{title:this.$.lang.imageGallery,data:e.data,url:e.url,headers:e.headers,searchUrl:e.searchUrl,searchHeaders:e.searchHeaders,selectorHandler:this.#wp.bind(this),columnSize:4,className:"se-image-gallery"}),this.width="auto"===this.$.plugins.image.pluginOptions.defaultWidth?"":this.$.plugins.image.pluginOptions.defaultWidth,this.height="auto"===this.$.plugins.image.pluginOptions.defaultHeight?"":this.$.plugins.image.pluginOptions.defaultHeight}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#wp(t){if(this.onSelectfunction)this.onSelectfunction(t);else{const e={name:t.getAttribute("data-name"),size:0};this.$.plugins.image.modalInit(),this.$.plugins.image.create(t.getAttribute("data-command"),null,this.width,this.height,"none",e,t.alt,!0)}}};const Yh=class extends Ar{static key="videoGallery";static className="";constructor(t,e){super(t),this.title=this.$.lang.videoGallery,this.icon="video_gallery",this.onSelectfunction=null;const s="string"==typeof e.thumbnail?e.thumbnail:this.$.icons.video_thumbnail;this.browser=new Il(this,this.$,{title:this.$.lang.videoGallery,data:e.data,url:e.url,headers:e.headers,searchUrl:e.searchUrl,searchHeaders:e.searchHeaders,selectorHandler:this.#wp.bind(this),columnSize:4,className:"se-video-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>s,props:["frame"]}),this.width="auto"===this.$.plugins.video.pluginOptions.defaultWidth?"":this.$.plugins.video.pluginOptions.defaultWidth,this.height="auto"===this.$.plugins.video.pluginOptions.defaultHeight?"":this.$.plugins.video.pluginOptions.defaultHeight}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#wp(t){if(this.onSelectfunction)this.onSelectfunction(t);else{let e=t.getAttribute("data-command");const s=this.$.plugins.video.findProcessUrl(e);s&&(e=s.url);const i={name:t.getAttribute("data-name"),size:0};this.$.plugins.video.modalInit(),this.$.plugins.video.create(this.$.plugins.video["iframe"===t.getAttribute("data-frame")?"createIframeTag":"createVideoTag"]({poster:t.getAttribute("data-thumbnail")}),e,null,this.width,this.height,!1,i,!0)}}};const Xh=class extends Ar{static key="audioGallery";static className="";constructor(t,e){super(t),this.title=this.$.lang.audioGallery,this.icon="audio_gallery",this.onSelectfunction=null;const s="string"==typeof e.thumbnail?e.thumbnail:this.$.icons.audio_thumbnail;this.browser=new Il(this,this.$,{title:this.$.lang.audioGallery,data:e.data,url:e.url,headers:e.headers,searchUrl:e.searchUrl,searchHeaders:e.searchHeaders,selectorHandler:this.#wp.bind(this),columnSize:4,className:"se-audio-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>s})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#wp(t){this.onSelectfunction?this.onSelectfunction(t):(this.$.plugins.audio.modalInit(),this.$.plugins.audio.submitURL(t.getAttribute("data-command")))}};const Jh=class extends Ar{static key="fileGallery";static className="";constructor(t,e){super(t),this.title=this.$.lang.fileGallery,this.icon="file_gallery",this.onSelectfunction=null;const s="string"==typeof e.thumbnail?e.thumbnail:this.$.icons.file_thumbnail;this.browser=new Il(this,this.$,{title:this.$.lang.fileGallery,data:e.data,url:e.url,headers:e.headers,searchUrl:e.searchUrl,searchHeaders:e.searchHeaders,selectorHandler:this.#wp.bind(this),columnSize:4,className:"se-file-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>s})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#wp(t){if(this.onSelectfunction)this.onSelectfunction(t);else{const e={name:t.getAttribute("data-name"),size:0};this.$.plugins.fileUpload.create(t.getAttribute("data-command"),e,!0)}}};const Qh=class extends Ar{static key="fileBrowser";static className="";constructor(t,e){super(t),this.title=this.$.lang.fileBrowser,this.icon="file_browser",this.onSelectfunction=null;const s={video:this.$.icons.video_thumbnail,audio:this.$.icons.audio_thumbnail,file:this.$.icons.file_thumbnail},i=this.$.icons.file_thumbnail;this.browser=new Il(this,this.$,{title:this.$.lang.fileBrowser,data:e.data,url:e.url,headers:e.headers,searchUrl:e.searchUrl,searchHeaders:e.searchHeaders,selectorHandler:this.#wp.bind(this),columnSize:4,className:"se-file-browser",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:t=>s[t.type]||i,props:[...new Set((e.props??[]).concat(["frame"]))],expand:e.expand})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#wp(t){if(this.onSelectfunction)this.onSelectfunction(t);else{switch(t.getAttribute("data-type")){case"image":this.$.plugins.imageGallery.browser.selectorHandler(t);break;case"video":this.$.plugins.videoGallery.browser.selectorHandler(t);break;case"audio":this.$.plugins.audioGallery.browser.selectorHandler(t);break;case"file":this.$.plugins.fileGallery.browser.selectorHandler(t)}}}},tc={text:{default:"16px",list:[{title:"XX-Small",size:"8px"},{title:"X-Small",size:"10px"},{title:"Small",size:"13px"},{title:"Medium",size:"16px"},{title:"Large",size:"18px"},{title:"X-Large",size:"24px"},{title:"XX-Large",size:"32px"}]},px:{default:13,inc:1,min:8,max:72,list:[8,10,13,15,18,20,22,26,28,36,48,72]},pt:{default:10,inc:1,min:6,max:72,list:[6,8,10,12,14,18,22,26,32]},em:{default:1,inc:.1,min:.5,max:5,list:[.5,.75,1,1.25,1.5,1.75,2,2.5,3]},rem:{default:1,inc:.1,min:.5,max:5,list:[.5,.75,1,1.25,1.5,1.75,2,2.5,3]},vw:{inc:.1,min:.5,max:10,list:[2,3.5,4,4.5,6,8]},vh:{default:1.5,inc:.1,min:.5,max:10,list:[1,1.5,2,2.5,3,3.5,4]},"%":{default:100,inc:1,min:50,max:200,list:[50,70,90,100,120,140,160,180,200]}};class ec extends Rr{static key="fontSize";static className="se-btn-select se-btn-input se-btn-tool-font-size";#_p;constructor(t,e){super(t),this.unitMap={...tc,...e.unitMap||{}},this.sizeUnit=/text/.test(e.sizeUnit)?"":e.sizeUnit||this.$.options.get("fontSizeUnits")[0];const s=this.unitMap[this.sizeUnit||"text"],i=function({lang:t},e,s,i){const n=e.list,o=e.default,l=i?t.default:"";let r='\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">';for(let t,e,i,a,h,c=0,d=n.length;c<d;c++)t=n[c],"object"==typeof t?(e=t.title,i=t.size):e=i=t+s,a=o===i?" default_value":"",h=a&&l||e,r+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list${a}" data-command="${i}" data-value="${e}" title="${h}" aria-label="${h}" style="font-size:${i};">${h}</button>\n\t\t\t</li>`;return r+="\n\t\t</ul>\n\t</div>",Ve.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-font-size"},r)}(this.$,s,this.sizeUnit,e.showDefaultSizeLabel),n=!!this.sizeUnit&&(e.showIncDecControls??!1),o=!this.sizeUnit||(e.disableInput??!1);this.title=this.$.lang.fontSize,this.inner=!(o&&!n)&&(o?`<span class="se-txt se-not-arrow-text __se__font_size">${this.$.lang.fontSize}</span>`:`<input type="text" class="__se__font_size se-not-arrow-text" placeholder="${this.$.lang.fontSize}" />`),n?(this.beforeItem=Ve.utils.createElement("button",{class:"se-btn se-tooltip se-sub-btn",type:"button","data-command":ec.key,"data-type":"command","data-value":"dec"},`${this.$.icons.minus}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.decrease}</span></span>`),this.afterItem=Ve.utils.createElement("button",{class:"se-btn se-tooltip se-sub-btn",type:"button","data-command":ec.key,"data-type":"command","data-value":"inc"},`${this.$.icons.plus}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.increase}</span></span>`)):o?o&&!n&&(this.replaceButton=Ve.utils.createElement("button",{class:"se-btn se-tooltip se-btn-select se-btn-tool-font-size",type:"button","data-command":ec.key,"data-type":"dropdown"},`<span class="se-txt __se__font_size">${this.$.lang.fontSize}</span>${this.$.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.fontSize}</span></span>`),this.$.menu.initDropdownTarget({key:ec.key,type:"dropdown"},i)):(this.afterItem=Ve.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn",type:"button","data-command":ec.key,"data-type":"dropdown"},`${this.$.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.fontSize}</span></span>`),this.$.menu.initDropdownTarget({key:ec.key,type:"dropdown"},i)),this.currentSize="",this.sizeList=i.querySelectorAll("li button"),this.hasInputFocus=!1,this.isInputActive=!1,this.#_p=o,this.$.menu.initDropdownTarget(ec,i)}active(t,e){if(!Ve.utils.hasClass(e,"__se__font_size"))return!1;let s="";if(t){if(this.$.format.isLine(t))return;if(s=Ve.utils.getStyle(t,"fontSize"))return this.#xp(e,s),!0}else this.#xp(e,this.#$p());return!1}toolbarInputKeyDown({target:t,event:e}){const s=e.code;if(this.#_p||Re.isSpace(s))return void e.preventDefault();if(!/^(ArrowUp|ArrowDown|Enter)$/.test(s))return;const{value:i,unit:n}=this.#kp(t);if(!i)return;const o=Oe.get(i),l=this.unitMap[n];let r=o;switch(s){case"ArrowUp":r+=l.inc,r>l.max&&(r=o);break;case"ArrowDown":r-=l.inc,r<l.min&&(r=o)}e.preventDefault();try{this.isInputActive=!0;const e=this.#xp(t,r+n);if(this.#_p)return;const i=Ve.utils.createElement("SPAN",{style:"font-size: "+e+";"});this.$.inline.apply(i,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null}),Re.isEnter(s)||t.focus()}finally{this.isInputActive=!1}}toolbarInputChange({target:t,value:e,event:s}){if(!this.#_p)try{this.isInputActive=!0;let{value:s,unit:i}=this.#kp(e);const{max:n,min:o}=this.unitMap[i];s=s>n?n:s<o?o:s;const l=Ve.utils.createElement("SPAN",{style:"font-size: "+this.#xp(t,s+i)+";"});this.$.inline.apply(l,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}finally{this.isInputActive=!1,s.preventDefault(),this.$.focusManager.focus()}}on(t){const{value:e,unit:s}=this.#kp(t),i=e+s;if(i===this.currentSize)return;const n=this.sizeList;for(let t=0,e=n.length;t<e;t++)i===n[t].getAttribute("data-value")?Ve.utils.addClass(n[t],"active"):Ve.utils.removeClass(n[t],"active");this.currentSize=i}action(t){const e=t.getAttribute("data-command");if(e===ec.key){const{value:e,unit:s}=this.#kp(t);let i=Oe.get(e)+("inc"===t.getAttribute("data-value")?1:-1);const{min:n,max:o}=this.unitMap[s];i=i<n?n:i>o?o:i;const l=Ve.utils.createElement("SPAN",{style:"font-size: "+i+s+";"});this.$.inline.apply(l,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}else if(e){const t=Ve.utils.createElement("SPAN",{style:"font-size: "+e+";"});this.$.inline.apply(t,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}else this.$.inline.apply(null,{stylesToModify:["font-size"],nodesToRemove:["span"],strictRemove:!0});this.$.menu.dropdownOff()}#$p(){return this.$.frameContext.get("wwComputedStyle").fontSize}#kp(t){if(!(t="string"==typeof t?t:t.parentElement.querySelector(".__se__font_size")))return{unit:this.sizeUnit,value:this.sizeUnit?0:""};const e="string"==typeof t?t:Ve.check.isInputElement(t)?t.value:t.textContent,s=this.sizeUnit?e.split(/(\d+)/):[e,""];let i=(s.pop()||"").trim().toLowerCase();i=this.$.options.get("fontSizeUnits").includes(i)?i:this.sizeUnit;const n=s.pop();return{unit:i,value:i?Number(n):n}}#xp(t,e){return(t=t.parentElement.querySelector(".__se__font_size"))?Ve.check.isInputElement(t)?t.value=String(e):t.textContent=String(this.sizeUnit?e:this.unitMap.text.list.find((t=>t.size===e))?.title||e):0}}const sc=ec;const ic=class extends Rr{static key="pageNavigator";static className="se-btn-input se-btn-tool-pageNavigator";constructor(t){super(t),this.title=this.$.lang.pageNumber,this.inner=Ve.utils.createElement("input",{type:"number",class:"se-not-arrow-text",placeholder:"1",value:"1",min:"1"},null),this.afterItem=Ve.utils.createElement("span",{class:"se-btn se-sub-btn"},""),this.pageNum=1,this.totalPages=1,this.$.eventManager.addEvent(this.inner,"change",this.#Sp.bind(this))}display(t,e){this.pageNum=t,this.totalPages=e,this.inner.value=String(t),this.afterItem.textContent=this.inner.max=String(e)}#Sp(t){if(!this.$.frameContext.has("documentType_use_page"))return;const e=Ve.query.getEventTarget(t),s=Number(e.value)||1;this.$.frameContext.get("documentType").pageGo(s)}},{_w:nc}=Ae;class oc extends zr{static key="anchor";static className="";static component(t){return Ve.check.isAnchor(t)&&t.hasAttribute("id")&&t.hasAttribute("data-se-anchor")?t:null}#_c=null;#Ep=null;constructor(t){super(t),this.title=this.$.lang.anchor,this.icon="bookmark_anchor";const e=(new DOMParser).parseFromString(this.$.icons.bookmark_anchor,"image/svg+xml");this.bookmarkIcon=e.documentElement;const s=function({lang:t,icons:e}){const s=`\n\t<div class="se-arrow se-arrow-up"></div>\n\t<div class="link-content">\n\t\t<div class="se-controller-display"></div>\n\t\t<div class="se-btn-group">\n\t\t\t<button type="button" data-command="edit" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.edit}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.edit}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t<button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.delete}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.remove}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t</div>\n\t</div>`;return Ve.utils.createElement("DIV",{class:"se-controller se-controller-link"},s)}(this.$);this.displayId=s.querySelector(".se-controller-display"),this.controllerSelect=new Ti(this,this.$,s,{position:"bottom",disabled:!0},oc.key);const i=function({lang:t,icons:e}){const s=`\n\t\t<div class="se-arrow se-arrow-up"></div>\n\t\t<form>\n\t\t\t<div class="se-controller-display">${t.id}</div>\n\t\t\t<div class="se-btn-group se-form-group">\n\t\t\t\t<input type="text" required />\n\t\t\t\t<button type="submit" data-command="submit" class="se-btn se-tooltip se-btn-success">\n\t\t\t\t\t${e.checked}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.save}</span></span>\n\t\t\t\t</button>\n\t\t\t\t<button type="button" data-command="cancel" class="se-btn se-tooltip se-btn-danger">\n\t\t\t\t\t${e.cancel}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.cancel}</span></span>\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</form>\n\t\t`;return Ve.utils.createElement("DIV",{class:"se-controller se-controller-simple-input"},s)}(this.$);this.inputEl=i.querySelector("input"),this.controller=new Ti(this,this.$,i,{position:"bottom",disabled:!0,parents:[this.controllerSelect.form],parentsHide:!0},oc.key)}show(){this.controller.open(this.#Ep=this.$.selection.getRange()),nc.setTimeout((()=>{this.inputEl.focus()}),0)}componentSelect(t){this.#_c=t,this.displayId.textContent=t.getAttribute("id"),this.controllerSelect.open(t)}componentDeselect(){this.#$s()}controllerAction(t){const e=t.getAttribute("data-command");if(!e)return;const s=this.#_c;switch(e){case"submit":if(this.controller.close(),s)s.id=this.inputEl.value,this.$.component.select(s,oc.key);else{const t=this.inputEl.value.trim();if(!t)return void this.inputEl.focus();const e=Ve.utils.createElement("A",{id:t,"data-se-anchor":this.inputEl.value,"data-se-non-link":"true",contenteditable:"false",class:"se-component se-inline-component"});this.$.component.insert(e,{insertBehavior:"none",scrollTo:!1});const s=this.$.selection.getNearRange(e);s?this.$.selection.setRange(s.container,s.offset,s.container,s.offset):this.$.component.select(e,oc.key),this.#$s()}break;case"cancel":this.controller.close(!s),this.#Ep&&this.$.selection.setRange(this.#Ep),this.#$s(),s&&this.componentSelect(s);break;case"edit":this.inputEl.value=this.displayId.textContent,this.controllerSelect.hide(),this.controller.open(s),this.inputEl.focus();break;case"delete":{const t=this.$.selection.getNearRange(s);Ve.utils.removeItem(s),this.controllerSelect.close(!0),t&&this.$.selection.setRange(t.container,t.offset,t.container,t.offset),this.#$s();break}}}#$s(){this.#_c=null,this.#Ep=null,this.inputEl.value="",this.displayId.textContent=""}}const lc={blockquote:Dr,codeBlock:Wr,exportPDF:Gr,fileUpload:Yr,list_bulleted:Jr,list_numbered:ea,autocomplete:oa,slashCommand:ra,align:ha,font:da,fontColor:pa,backgroundColor:ma,list:ya,table:nh,blockStyle:lh,hr:va,layout:ah,lineHeight:ch,template:uh,paragraphStyle:gh,textStyle:fh,link:vh,image:Sh,video:Ah,audio:Oh,embed:Dh,math:Zh,drawing:jh,imageGallery:Kh,videoGallery:Yh,audioGallery:Xh,fileGallery:Jh,fileBrowser:Qh,fontSize:sc,pageNavigator:ic,anchor:oc};class rc{async modalAction(){return!0}modalOn(t){}modalInit(){}modalOff(t){}modalResize(){}}class ac{controllerAction(t){}controllerOn(t,e){}controllerClose(){}}class hc{browserInit(){}}class cc{colorPickerAction(t){}colorPickerHueSliderOpen(){}colorPickerHueSliderClose(){}}class dc{hueSliderAction(){}hueSliderCancelAction(){}}class uc{componentSelect(t){}componentDeselect(t){}componentEdit(t){}async componentDestroy(t){}componentCopy(t){}}const pc={contract:t,manager:e,ui:i};Object.defineProperty(window,"SUNEDITOR",{enumerable:!0,writable:!1,configurable:!1,value:{...Lr,plugins:lc,modules:pc,helper:Fe,interfaces:n}})})()})();