suneditor 3.0.0 → 3.0.1

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.
@@ -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",mention:"Mention",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:()=>so,ColorPicker:()=>Wo,Controller:()=>Ms,Figure:()=>qs,HueSlider:()=>Po,Modal:()=>Go});var e={};s.r(e),s.d(e,{ApiManager:()=>to,FileManager:()=>Ko});var i={};s.r(i),s.d(i,{ModalAnchorEditor:()=>Jo,SelectMenu:()=>Ls,_DragHandle:()=>ws});var n={};s.r(n),s.d(n,{EditorComponent:()=>Ha,ModuleBrowser:()=>Ea,ModuleColorPicker:()=>Ta,ModuleController:()=>Sa,ModuleHueSlider:()=>Ma,ModuleModal:()=>ka,PluginBrowser:()=>el,PluginCommand:()=>sl,PluginDropdown:()=>il,PluginDropdownFree:()=>nl,PluginField:()=>ol,PluginInput:()=>ll,PluginModal:()=>rl,PluginPopup:()=>al});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,w=h.includes("android"),C=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:w,isMobile:b,isTouchDevice:y,cmdIcon:C,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;"},B={"&amp;":"&","&nbsp;":" ","&apos;":"'","&quot;":'"',"&lt;":"<","&gt;":">"},A=/[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 z(t){return/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(t)}const F={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=>B[t]||t))},debounce:function(t,e){let s;return function(...i){o.clearTimeout(s),s=o.setTimeout((()=>{o.clearTimeout(s),t(...i)}),e)}},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(A,(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:z,rgb2hex:function(t){if(z(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>":""}},P=F,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(!j(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/^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 K(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 Y(t){return t?.hasAttribute("data-important-disabled")}const X={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:function(t){return/^(TD|TH)$/i.test("string"==typeof t?t:t?.nodeName)},isTableRow:function(t){return/^TR$/i.test("string"==typeof t?t:t?.nodeName)},isBreak:G,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||G(e.firstElementChild))&&q(e.textContent)},isComponentContainer:function(t){if(1!==t?.nodeType)return!1;const e=t.classList;return!!e&&(e.contains("se-component")||e.contains("se-flex-component"))},isWysiwygFrame:K,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:Y},J=X;function Q(t){const e=Object.prototype.toString.call(t);return"[object HTMLCollection]"===e||"[object NodeList]"===e||"[object Array]"===e}function tt(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 et(t,e){let s=-1;for(let i=0,n=t.length;i<n;i++)if(t[i]===e){s=i;break}return s}function st(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++)t=o[e].name.toLowerCase(),s?.includes(t)||!o[e].value?i.removeAttribute(t):"style"!==t&&i.setAttribute(o[e].name,o[e].value)}function it(t,e){if(t&&1===t.nodeType)return e.split("|").some((e=>t.classList.contains(e)))}function nt(t,e){if(!t)return;const s=Q(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 ot(t,e){if(!t)return;const s=Q(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 lt(t=l){return{w:t.documentElement.clientWidth,h:t.documentElement.clientHeight}}const rt={clone:function(t,e=!1){return t.cloneNode(e)},createElement:tt,createTextNode:function(t){return l.createTextNode(t||"")},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:et,nextIndex:function(t,e){const s=et(t,e);return-1===s?-1:s+1},prevIndex:function(t,e){const s=et(t,e);return-1===s?-1:s-1},copyTagAttributes:st,copyFormatAttributes:function(t,e){const s=e.cloneNode(!1);s.className=s.className.replace(/(\s|^)__se__format__[^\s]+/g,""),st(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=tt("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&&Y(n)||(n.disabled=e),s&&(e?n.setAttribute("data-important-disabled",""):n.removeAttribute("data-important-disabled"))}},hasClass:it,addClass:nt,removeClass:ot,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){nt(t,e),o.setTimeout((()=>{ot(t,e)}),s)},getClientSize:lt,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 at(t){let e=0;for(;t=t.previousSibling;)e+=1;return e}function ht(t,e,s){const i=[];let n=!0;return pt(t,(t=>{if(t===e&&(n=!1),n&&!J.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,rt.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,rt.removeItem(e)}i.push(t)}return!1})),i.map(at).reverse()}function ct(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 dt(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 ut(t){if(!t||J.isWysiwygFrame(t))return-1;let e=0;for(t=t.parentNode;t&&!J.isWysiwygFrame(t);)e+=1,t=t.parentNode;return e}function pt(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||J.isWysiwygFrame(t))return null;t=t.parentElement,n++}return t}const gt={getPositionIndex:at,getNodePath:ht,getNodeFromPath:ct,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:dt,getNodeDepth:ut,sortNodeByDepth:function(t,e){const s=e?1:-1,i=-1*s;t.sort((function(t,e){if(!J.isListCell(t)||!J.isListCell(e))return 0;const n=ut(t),o=ut(e);return n>o?s:n<o?i:0}))},compareElements:function(t,e){let s=t,i=e;const n=ut(t),o=ut(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=rt.getArrayIndex(l,s),a=rt.getArrayIndex(l,i);return{ancestor:s.parentElement,a:s,b:i,result:r>a?1:r<a?-1:0}},getParentElement:pt,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&&!J.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)&&!rt.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=dt(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&&!J.isBreak(t);)t=t.firstChild;for(;e&&1===e.nodeType&&e.childNodes.length>0&&!J.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(J.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(J.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 mt={query:gt,check:J,utils:rt};function ft(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 vt={is:function(t){return/^-?\d+(\.\d+)?$/.test(t+"")},get:ft,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)}},bt="ArrowLeft|ArrowUp|ArrowRight|ArrowDown",yt="F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12",wt=bt.split("|"),Ct="Backspace|Delete".split("|"),_t=`Backspace|Tab|Enter|ShiftLeft|ShiftRight|ControlLeft|ControlRight|AltLeft|AltRight|Pause|CapsLock|Escape|PageUp|PageDown|End|Home|${bt}|Insert|Delete|${yt}|NumLock|ScrollLock`.split("|"),xt="Backspace|Enter|Delete".split("|"),$t="Backspace|Enter|Delete".split("|"),kt=`ControlLeft|ControlRight|AltLeft|AltRight|Pause|CapsLock|Escape|Insert|${yt}|NumLock|ScrollLock`.split("|");const St={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)}}}},Et=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/i,Tt=/^[\u200B\uFEFF]+$/;function Mt(t){const e=t.trim();return""===e||Tt.test(e)}const Ht={strong:"**",b:"**",em:"*",i:"*",del:"~~",s:"~~",mark:"=="};function Lt(t){if(!t||0===t.length)return"";const e=[];for(let s=0;s<t.length;s++){const i=Ot(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 Nt(t){return t?"text"===t.type?t.content||"":t.children?t.children.map(Nt).join(""):"":""}function Bt(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(Et.test(e))return o;return`${o}${i.map(Bt).join("")}</${e}>`}function At(t,e){return t?t.split("\n").map((t=>t?e+t:"")).join("\n")+"\n":""}function It(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+=Ot(e,"",!1);continue}const s=e.tag;if("ul"===s||"ol"===s)a+=It(e,h,"ol"===s);else if("table"===s)a+=At(Vt(e),h);else if("figure"===s){const t=(e.children||[]).find((t=>"element"===t.type&&"table"===t.tag));a+=At(t?Vt(t):Ot(e,"",!0),h)}else"blockquote"===s||"pre"===s?a+=At(Ot(e,"",!0),h):r+=Ot(e,"",!1)}n+=`${e}${i}${c}${r.trim()}\n`,a&&(n+=a),o++}return n}function Vt(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=Lt(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 Ot(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=>Ot(t,"",!0))).join("");const l=/^h([1-6])$/.exec(i);if(l){const t=parseInt(l[1],10);return`${"#".repeat(t)} ${Lt(o).trim()}\n\n`}if("p"===i){const t=Lt(o);return t.trim()?`${t.trim()}\n\n`:"\n"}if("br"===i)return"\n";if("hr"===i)return"---\n\n";const r=Ht[i];if(r){return`${r}${Lt(o)}${r}`}if("code"===i){const t=Nt({children:o});return t.includes("`")?"`` "+t+" ``":"`"+t+"`"}if("kbd"===i){return`<kbd>${Nt({children:o})}</kbd>`}if("sub"===i){return`<sub>${Lt(o)}</sub>`}if("sup"===i){return`<sup>${Lt(o)}</sup>`}if("a"===i){const t=n.href||"",e=Lt(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=>Ot(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=Nt(i)):(e=(t.attributes?.class||"").match(/language-(\S+)/)?.[1]||"",s=Nt({children:o})),"```"+e+"\n"+s+"\n```\n\n"}if("details"===i)return Bt(t)+"\n\n";if("summary"===i)return Bt(t);if("ul"===i)return It(t,e,!1)+"\n";if("ol"===i)return It(t,e,!0)+"\n";if("table"===i)return Vt(t)+"\n";if("dl"===i){let t="";for(const e of o)"element"===e.type&&("dt"===e.tag?t+=Lt(e.children).trim()+"\n":"dd"===e.tag&&(t+=": "+Lt(e.children).trim()+"\n"));return t+"\n"}if("dt"===i||"dd"===i)return Lt(o).trim();if("div"===i){if(n.class&&/se-component/.test(n.class))return o.map((t=>Ot(t,e,!0))).join("");const t=Lt(o);return s?t+"\n\n":t}if("span"===i)return n.style||n.class?Bt(t):Lt(o);if("figure"===i)return o.map((t=>Ot(t,e,!0))).join("");if("figcaption"===i){const t=Lt(o).trim();return t?t+"\n\n":""}return"video"===i||"audio"===i||"iframe"===i?Bt(t)+"\n\n":Bt(t)}function Rt(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 zt(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)}>${Rt(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)}>${Rt(t[e]||"")}</td>`;r+="</tr>"}r+="</tbody>"}return r+="</table>",r}function Ft(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(Mt(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(Mt(e)){l++;continue}if((e.match(/^(\s*)/)[1]||"").length<=r)break;if(/^\s*[-*+]\s+/.test(e)||/^\s*\d+\.\s+/.test(e)){const s=Ft(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(Mt(s)||(s.match(/^(\s*)/)[1]||"").length<=r)break;if(!/^\s*\|/.test(s))break;e.push(s.trimStart()),l++}u+=zt(e)}}if(a){o+=`<li class="task-list-item">${h?'<input type="checkbox" checked disabled> ':'<input type="checkbox" disabled> '}${Rt(c)}${u}</li>`}else o+=`<li>${Rt(i)}${u}</li>`}}return o+=`</${i}>`,{html:o,index:l}}const Pt={jsonToMarkdown:function(t){return t?Ot(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(Mt(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}>${Rt(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(zt(t));continue}if(/^(\s*)([-*+])\s+/.test(e)){const t=Ft(i,o,!1);n.push(t.html),o=t.index;continue}if(/^(\s*)\d+\.\s+/.test(e)){const t=Ft(i,o,!0);n.push(t.html),o=t.index;continue}if(/^\s*<[a-zA-Z]/.test(e)){let t=e;if(o++,Et.test(e.match(/<(\w+)/)?.[1]||"")){n.push(t);continue}for(;o<i.length&&!Mt(i[o]);)t+="\n"+i[o],o++;n.push(t);continue}const h=[];for(;o<i.length&&!Mt(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=Rt(h.join("\n"));n.push(`<${s}>${t}</${s}>`)}else n.push(`<${s}>${Rt(i[o])}</${s}>`),o++}var l;return n.join("")}},Dt=$,qt=M,Wt=P,Ut=mt,Zt=vt,Gt={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 wt.includes(t)},isRemoveKey:function(t){return Ct.includes(t)},isNonTextKey:function(t){return _t.includes(t)},isHistoryRelevantKey:function(t){return xt.includes(t)},isDocumentTypeObserverKey:function(t){return $t.includes(t)},isNonResponseKey:function(t){return kt.includes(t)}},jt=St,Kt=Pt,Yt={env:Dt,unicode:qt,converter:Wt,dom:Ut,numbers:Zt,keyCodeMap:Gt,clipboard:jt,markdown:Kt},Xt={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>',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 Jt=s("cfbI"),Qt=s.n(Jt);function te(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 ee(t,e,s,i,n,o,l,r,a,h){const c=new Map([["key",h],["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")],["_stickyDummy",e.querySelector(".se-toolbar-sticky-dummy")],["_toolbarShadow",e.querySelector(".se-toolbar-shadow")],["_minHeight",ft(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&&se(r,c);const d=e.querySelector(".se-placeholder");return d&&c.set("placeholder",d),c}function se(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 ie={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:{"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:""},SPAN_STYLES:"font-family|font-size|color|background-color|width|height",LINE_STYLES:"text-align|margin|margin-left|margin-right|line-height",RETAIN_STYLE_MODE:["repeat","always","none"]},ne={value:"fixed",placeholder:!0,editableFrameAttributes:!0,width:!0,minWidth:!0,maxWidth:!0,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},oe={plugins:"fixed",excludedPlugins:"fixed",buttonList:"fixed",v2Migration:"fixed",strictMode:"fixed",mode:"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",spanStyles:"fixed",lineStyles:"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_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"},le=Dt._d;function re(t,e,s,i,n,o){if(!s||s.length<2)return;const l=e?.querySelector(".se-tooltip-text");for(let h,c,d,u,p,g,m,f,v,b,y,w,C,_,x=0;x<s.length;x+=2+_){if(_=0,h=s[x].split("+"),v=null,b=h.at(-1).trim?.(),b.startsWith("~"))v=t,b=h.pop().trim().substring(1);else if(b.startsWith("$~")){const t=h.pop().trim().substring(2).split(".");v=t[0],b=t[1]}else b.startsWith("$")?(_=1,b=s[x+2]):b="";d=u=p=g=m=f=c=null;for(const t of h)switch(t.trim()){case"c":d=!0;break;case"!":p=!0;break;case"s":u=!0;break;case"_":g=!0;break;case"=":f=!0;break;case"/":m=!0;break;default:c=t}c=c.split("|");for(let s=0,l=c.length;s<l;s++)w=d?c[s]+(u?"1000":""):c[s],i.has(w)||(C=n.indexOf(t),C=-1===C?"":Zt.isOdd(C)?n[C+1]:n[C-1],C&&o.add(w),i.set(w,{c:d,s:u,edge:p,space:g,enter:m,textTrigger:f,plugin:v,command:t,method:b,r:C,type:e?.getAttribute("data-type"),button:e,key:w}));(y=s[x+1])&&(l&&(r=u,a=y,l.appendChild(Ut.utils.createElement("SPAN",{class:"se-shortcut"},Dt.cmdIcon+(r?Dt.shiftIcon:"")+'+<span class="se-shortcut-key">'+a+"</span>"))))}var r,a}function ae(t,e){return[t,e].reduce(((t,e)=>{for(const s in e)t[s]=(e[s]||"").toLowerCase();return t}),{})}function he(t,e,s){const i=t.buttonList||ie.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("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())):ie.SIZE_UNITS),n.set("allowedClassName",new RegExp(`${t.allowedClassName&&"string"==typeof t.allowedClassName?t.allowedClassName+"|":""}${ie.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||ie.RETAIN_STYLE_MODE.includes(r)||(console.error(`Invalid retainStyleMode: ${r}. Valid options are ${ie.RETAIN_STYLE_MODE.join(", ")}. Using default 'repeat'.`),r="repeat"),n.set("retainStyleMode",r);const a={...ie.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:ie.TEXT_STYLE_TAGS)+(t.textStyleTags?"|"+t.textStyleTags:""));const u=ae({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",[{...ie.TAG_STYLES,...t.__tagStyles||{}},t.tagStyles||{}].reduce(((t,e)=>{for(const s in e)t[s]=e[s];return t}),{})),n.set("_textStylesRegExp",new RegExp(`\\s*[^-a-zA-Z](${ie.SPAN_STYLES}${t.spanStyles?"|"+t.spanStyles:""})\\s*:[^;]+(?!;)*`,"gi")),n.set("_lineStylesRegExp",new RegExp(`\\s*[^-a-zA-Z](${ie.LINE_STYLES}${t.lineStyles?"|"+t.lineStyles:""})\\s*:[^;]+(?!;)*`,"gi")),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",ae(Wt.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("-")),Zt.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||ie.SCOPE_SELECTION_TAGS);const p=("string"==typeof t.elementWhitelist?t.elementWhitelist:"").toLowerCase(),g=n.get("externalLibs").mathjax?ie.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",ge(t.formatClosureBrLine,(t.__defaultFormatClosureBrLine="string"==typeof t.__defaultFormatClosureBrLine?t.__defaultFormatClosureBrLine:ie.FORMAT_CLOSURE_BR_LINE).toLowerCase(),n.get("elementBlacklist"))),n.set("formatBrLine",ge((t.formatBrLine||"")+"|"+n.get("formatClosureBrLine").str,(t.__defaultFormatBrLine="string"==typeof t.__defaultFormatBrLine?t.__defaultFormatBrLine:ie.FORMAT_BR_LINE).toLowerCase(),n.get("elementBlacklist"))),n.set("formatLine",ge(ie.REQUIRED_FORMAT_LINE+"|"+(t.formatLine||"")+"|"+n.get("formatBrLine").str,(t.__defaultFormatLine="string"==typeof t.__defaultFormatLine?t.__defaultFormatLine:ie.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",ge(t.formatClosureBlock,(t.__defaultFormatClosureBlock="string"==typeof t.__defaultFormatClosureBlock?t.__defaultFormatClosureBlock:ie.FORMAT_CLOSURE_BLOCK).toLowerCase(),n.get("elementBlacklist"))),n.set("formatBlock",ge((t.formatBlock||"")+"|"+n.get("formatClosureBlock").str,(t.__defaultFormatBlock="string"==typeof t.__defaultFormatBlock?t.__defaultFormatBlock:ie.FORMAT_BLOCK).toLowerCase(),n.get("elementBlacklist"))),n.set("allowedEmptyTags",ie.ALLOWED_EMPTY_NODE_LIST+(t.allowedEmptyTags?", "+t.allowedEmptyTags:"")),n.set("__defaultElementWhitelist",ie.REQUIRED_ELEMENT_WHITELIST+"|"+("string"==typeof t.__defaultElementWhitelist?t.__defaultElementWhitelist:ie.ELEMENT_WHITELIST).toLowerCase()),n.set("__defaultAttributeWhitelist",("string"==typeof t.__defaultAttributeWhitelist?t.__defaultAttributeWhitelist:ie.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?Zt.is(t.toolbar_width)?t.toolbar_width+"px":t.toolbar_width:"auto"),n.set("toolbar_container",t.toolbar_container&&!/inline/i.test(n.get("mode"))?"string"==typeof t.toolbar_container?le.querySelector(t.toolbar_container):t.toolbar_container:null),n.set("toolbar_sticky",/balloon/i.test(n.get("mode"))?-1:void 0===t.toolbar_sticky?0:Zt.is(t.toolbar_sticky)?Zt.get(t.toolbar_sticky,0):-1),n.set("toolbar_hide",!!t.toolbar_hide);let b=null;const y=t.subToolbar;y?.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",y.mode||"balloon"),n.set("toolbar_sub_width",y.width?Zt.is(y.width)?y.width+"px":y.width:"auto"),b=n.get("_rtl")?y.buttonList.reverse():y.buttonList,n.set("buttons_sub",new Set(b.toString().split(",")))));const w=new Map;for(let s=0,i=e.length;s<i;s++)w.set(e[s].key,de(e[s].options||{},t));n.set("tabDisable",!!t.tabDisable),n.set("shortcutsHint",void 0===t.shortcutsHint||!!t.shortcutsHint);const C=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",C),n.set("fullScreenOffset",void 0===t.fullScreenOffset?0:Zt.is(t.fullScreenOffset)?Zt.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 _=n.get("externalLibs").codeMirror;_&&(n.set("codeMirror",_),_.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 x=t.icons&&"object"==typeof t.icons?[Xt,t.icons].reduce(((t,e)=>{for(const s in e)t[s]=e[s];return t}),{}):Xt;n.set("icons",x);const $=new Set(ie.CONTENT_STYLES.split("|")),k=t.spanStyles?.split("|")||[],S=n.get("__listCommonStyle"),E=ie.SPAN_STYLES.split("|");for(let t=0,e=E.length;t<e;t++)$.add(E[t]);for(const t of Object.values(n.get("tagStyles"))){const e=t.split("|");for(let t=0,s=e.length;t<s;t++)$.add(e[t])}for(let t=0,e=k.length;t<e;t++)$.add(k[t]);for(let t=0,e=S.length;t<e;t++)$.add(S[t]);const T=("string"==typeof t.allUsedStyles?t.allUsedStyles.split("|"):t.allUsedStyles)||[];for(let t=0,e=T.length;t<e;t++)$.add(T[t]);return n.set("allUsedStyles",$),n.set("toastMessageTime",{copy:1500,...t.toastMessageTime}),{o:n,i:x,l:t.lang||Qt(),v:t.value="string"==typeof t.value?t.value:null,buttons:n.get("_rtl")?i.reverse():i,subButtons:b,statusbarContainer:"string"==typeof t.statusbar_container?le.querySelector(t.statusbar_container):t.statusbar_container,frameMap:w}}function ce(t,e){let s=null,i=null,n=null;if(t.get("statusbar")&&(e||=Ut.utils.createElement("DIV",{class:"se-status-bar sun-editor-common"}),s=e.querySelector(".se-navigation")||Ut.utils.createElement("DIV",{class:"se-navigation sun-editor-common"}),e.appendChild(s),t.get("charCounter"))){if(i=e.querySelector(".se-char-counter-wrapper")||Ut.utils.createElement("DIV",{class:"se-char-counter-wrapper"}),t.get("charCounter_label")){const e=i.querySelector(".se-char-label")||Ut.utils.createElement("SPAN",{class:"se-char-label"});e.textContent=t.get("charCounter_label"),i.appendChild(e)}if(n=i.querySelector(".se-char-counter")||Ut.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")||Ut.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}}function de(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.editableFrameAttributes?e.editableFrameAttributes:t.editableFrameAttributes,r=void 0===t.width?e.width:t.width,a=void 0===t.minWidth?e.minWidth:t.minWidth,h=void 0===t.maxWidth?e.maxWidth:t.maxWidth,c=void 0===t.height?e.height:t.height,d=void 0===t.minHeight?e.minHeight:t.minHeight,u=void 0===t.maxHeight?e.maxHeight:t.maxHeight,p=void 0===t.editorStyle?e.editorStyle:t.editorStyle,g=void 0===t.iframe?e.iframe:t.iframe,m=void 0===t.iframe_fullPage?e.iframe_fullPage:t.iframe_fullPage,f=void 0===t.iframe_attributes?e.iframe_attributes:t.iframe_attributes,v=void 0===t.iframe_cssFileName?e.iframe_cssFileName:t.iframe_cssFileName,b=i||void 0===t.statusbar?e.statusbar:t.statusbar,y=i||void 0===t.statusbar_showPathLabel?e.statusbar_showPathLabel:t.statusbar_showPathLabel,w=!i&&(void 0===t.statusbar_resizeEnable?e.statusbar_resizeEnable:t.statusbar_resizeEnable),C=i||void 0===t.charCounter?e.charCounter:t.charCounter,_=i||void 0===t.charCounter_max?e.charCounter_max:t.charCounter_max,x=i||void 0===t.charCounter_label?e.charCounter_label:t.charCounter_label,$=i||void 0===t.charCounter_type?e.charCounter_type:t.charCounter_type;s.set("value",n),s.set("placeholder",o),s.set("editableFrameAttributes",{spellcheck:"false",...l}),s.set("width",r?String(Zt.is(r)?r+"px":r):"100%"),s.set("minWidth",a?String(Zt.is(a)?a+"px":a):""),s.set("maxWidth",h?String(Zt.is(h)?h+"px":h):""),s.set("height",c?String(Zt.is(c)?c+"px":c):"auto"),s.set("minHeight",d?String(Zt.is(d)?d+"px":d):""),s.set("maxHeight",u?String(Zt.is(u)?u+"px":u):""),s.set("editorStyle",p),s.set("_defaultStyles",Wt._setDefaultOptionStyle(s,"string"==typeof p?p:"")),s.set("iframe",!(!m&&!g)),s.set("iframe_fullPage",!!m),s.set("iframe_attributes",f||{}),s.set("iframe_cssFileName",g?("string"==typeof v?[v]:v)||["suneditor"]:null);const k=void 0===b||!!b;return s.set("statusbar",k),s.set("statusbar_showPathLabel",!!k&&("boolean"!=typeof y||y)),s.set("statusbar_resizeEnable",!!k&&(void 0===w||!!w)),s.set("charCounter",_>0||"boolean"==typeof C&&C),s.set("charCounter_max",Zt.is(_)&&_>-1?1*_:null),s.set("charCounter_label","string"==typeof x?x.trim():null),s.set("charCounter_type","string"==typeof $?$:"char"),s}function ue(t,e,s,i){const n=i.get("_defaultStyles");s.style.cssText=n.top;const o=Ut.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=o,e=i.get("iframe_attributes");let s=e.sandbox;if(s){const t=["allow-same-origin"],e=s.split(/\s+/),i=t.filter((t=>!e.includes(t)));i.length>0&&(s=e.concat(i).join(" "))}else s="allow-same-origin";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=n.frame}else o.setAttribute("contenteditable","true"),o.className+=" "+e.get("_editableClass"),o.style.cssText=n.frame+n.editor;const l=Ut.utils.createElement("TEXTAREA",{class:"se-wrapper-inner se-code-viewer",style:n.frame}),r=Ut.utils.createElement("TEXTAREA",{class:"se-wrapper-inner se-markdown-viewer",style:n.frame}),a=Ut.utils.createElement("SPAN",{class:"se-placeholder"});return i.get("placeholder")&&(a.textContent=i.get("placeholder")),{bottomBar:ce(i,null),wysiwygFrame:o,codeView:l,markdownView:r,placeholder:a}}function pe(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?(Ut.utils.removeItem(s),i.className+=" se-code-viewer-mirror",i):s}function ge(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 me(){const t=Ut.utils.createElement("UL",{class:"se-menu-list"});return{div:Ut.utils.createElement("DIV",{class:"se-btn-module se-btn-module-border"},t),ul:t}}function fe(t,e,s,i,n,o,l){n||="";const r=Ut.utils.createElement("LI"),a=e||"",h=/^INPUT|FIELD$/i.test(i),c="se-toolbar-separator-vertical"===t?Ut.utils.createElement("DIV",{class:t,tabindex:"-1"},null):Ut.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)&&Ut.utils.addClass(r,"se-toolbar-hidden-btn"),a&&(n+=Ut.utils.createTooltipInner(a)),n&&(c.innerHTML=n),r.appendChild(c),{li:r,button:c}}function ve(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&&(Ut.utils.addClass(e.afterItem,"se-toolbar-btn"),t.parentElement.appendChild(e.afterItem),Ut.utils.addClass(t,"se-side-btn-a"),Ut.utils.addClass(e.afterItem,"se-side-btn-after")),e.beforeItem&&(Ut.utils.addClass(e.beforeItem,"se-toolbar-btn"),t.parentElement.insertBefore(e.beforeItem,t),e.afterItem?(Ut.utils.addClass(t,"se-side-btn"),Ut.utils.removeClass(t,"se-side-btn-a")):Ut.utils.addClass(t,"se-side-btn-b"),Ut.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&&(Ut.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 be(t,e,s,i,n,o){t=JSON.parse(JSON.stringify(t));const l=function(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","",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",""]}}(s.get("_rtl"),i,n),r={},a=[],h=[];let c=null,d=null,u=null,p=null,g=null;const m=Ut.utils.createElement("DIV",{class:"se-toolbar-more-layer"}),f=Ut.utils.createElement("DIV",{class:"se-btn-tray"}),v=Ut.utils.createElement("DIV",{class:"se-toolbar-separator-vertical"});t:for(let s,b,y,w,C,_=0;_<t.length;_++)if(s=!1,C="",w=t[_],p=me(),"object"==typeof w){for(let f,v=0;v<w.length;v++){if(d=w[v],f=!1,u=e[d],/^%\d+/.test(d)&&0===v){w[0]=d.replace(/[^\d]/g,""),a.push(w),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)){C=d.substring(1),p.div.className+=" module-float-"+C;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||Dt.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=fe(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=Ut.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"'+(C?' style="float: '+C+';"':"")+"></ul></div>",m.appendChild(b),b=b.firstElementChild.firstElementChild)}f.appendChild(p.div)}else{if("|"===w){const t=v.cloneNode(!1);f.appendChild(t);continue}if(/^\/$/.test(w)){const t=Ut.utils.createElement("DIV",{class:"se-btn-module-enter"});f.appendChild(t)}}switch(f.children.length){case 0:f.style.display="none";break;case 1:Ut.utils.removeClass(f.firstElementChild,"se-btn-module-border")}m.children.length>0&&f.appendChild(m),a.length>0&&a.unshift(t);const b=Ut.utils.createElement("DIV",{class:"se-toolbar sun-editor-common"+(s.get("shortcutsHint")?"":" se-shortcut-hide")},f);return s.get("toolbar_hide")&&(b.style.display="none"),{element:b,pluginCallButtons:r,responsiveButtons:a,buttonTray:f,updateButtons:h}}const ye=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=he(e,t,s),n=i.o,o=i.i,l=i.l,r=Ut.utils.createElement("DIV",{class:"se-loading-box sun-editor-common"},'<div class="se-loading-effect"></div>'),a=Ut.utils.createElement("DIV",{class:"sun-editor sun-editor-carrier-wrapper sun-editor-common"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),h=Ut.utils.createElement("DIV",{class:"se-menu-tray"});a.appendChild(h);const c=Ut.utils.createElement("INPUT",{class:"__se__focus__temp__",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;"});c.tabIndex=0,a.appendChild(c);const d=Ut.utils.createElement("DIV",{class:"se-modal se-modal-area sun-editor-common"}),u=Ut.utils.createElement("DIV",{class:"se-modal-back"}),p=Ut.utils.createElement("DIV",{class:"se-modal-inner"});d.appendChild(u),d.appendChild(p),a.appendChild(d);const g=Ut.utils.createElement("DIV",{class:"se-alert se-modal-area sun-editor-common",style:"display: none;"}),m=Ut.utils.createElement("DIV",{class:"se-modal-back"}),f=Ut.utils.createElement("DIV",{class:"se-modal-inner"});g.appendChild(m),g.appendChild(f),a.appendChild(g),a.appendChild(Ut.utils.createElement("DIV",{class:"se-back-wrapper"})),a.appendChild(r.cloneNode(!0));const v=Ut.utils.createElement("DIV",{class:"se-drag-cursor"});a.appendChild(v),le.body.appendChild(a);let b=null,y=null;const w=be(i.buttons,s,n,o,l,!1),C=w.element;C.style.visibility="hidden",/inline/i.test(n.get("mode"))?(C.className+=" se-toolbar-inline",C.style.width=n.get("toolbar_width")):/balloon/i.test(n.get("mode"))&&(C.className+=" se-toolbar-balloon",C.style.width=n.get("toolbar_width"),C.appendChild(Ut.utils.createElement("DIV",{class:"se-arrow"}))),n.get("_toolbar_bottom")&&(C.className+=" se-toolbar-bottom"),i.subButtons&&(y=be(i.subButtons,s,n,o,l,!1),b=y.element,b.style.visibility="hidden",b.className+=" se-toolbar-balloon se-toolbar-sub",b.style.width=n.get("toolbar_sub_width"),b.appendChild(Ut.utils.createElement("DIV",{class:"se-arrow"})));const _=t[0].key||null,x=[],$=new Map,k=i.statusbarContainer;let S=null;for(let e=0,s=t.length;e<s;e++){const s=t[e],a=i.frameMap.get(s.key),h=Ut.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),c=Ut.utils.createElement("DIV",{class:"se-container"}),d=Ut.utils.createElement("DIV",{class:"se-wrapper"+("document"===n.get("type")?" se-type-document":"")+(n.get("_type_options").includes("header")?" se-type-document-header":"")});c.appendChild(Ut.utils.createElement("DIV",{class:"se-toolbar-shadow"}));const u=ue(s.key,n,h,a),p=u.bottomBar.statusbar,g=u.wysiwygFrame,m=u.placeholder;let f=u.codeView;const v=Ut.utils.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-t",title:l.insertLine},o.line_break),b=Ut.utils.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-b",title:l.insertLine},o.line_break);d.appendChild(v),d.appendChild(b),m&&d.appendChild(m),c.appendChild(Ut.utils.createElement("DIV",{class:"se-toolbar-sticky-dummy"})),c.appendChild(d),p&&(k?S||(k.appendChild(Ut.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")},p)),S=p):c.appendChild(p)),c.appendChild(r.cloneNode(!0));const y=s.key||null;let w=null;if(n.get("buttons").has("codeView")){w=Ut.utils.createElement("DIV",{class:"se-code-wrapper"},f),w.style.setProperty("display","none","important"),d.appendChild(w);const t=pe(n,a,f);if(f===t){const t=Ut.utils.createElement("TEXTAREA",{class:"se-code-view-line",readonly:"true"},null);w.insertBefore(t,f)}else f=t}let C=null,_=null;if(n.get("buttons").has("markdownView")){_=u.markdownView;const t=Ut.utils.createElement("TEXTAREA",{class:"se-markdown-view-line",readonly:"true"},null);C=Ut.utils.createElement("DIV",{class:"se-markdown-wrapper"}),C.appendChild(t),C.appendChild(_),C.style.setProperty("display","none","important"),d.appendChild(C)}const E={inner:null,page:null,pageMirror:null};n.get("_type_options").includes("header")&&(E.inner=Ut.utils.createElement("DIV",{class:"se-document-lines",style:`height: ${a.get("height")};`},'<div class="se-document-lines-inner"></div>')),n.get("_type_options").includes("page")&&(E.page=Ut.utils.createElement("DIV",{class:"se-document-page"},null),E.pageMirror=Ut.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)),h.appendChild(c),x.push(y),$.set(y,ee({target:s.target,key:s.key,options:a},h,g,w,f,C,_,S||p,E,y))}const E=n.get("toolbar_container");if(E){const t=Ut.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),e=Ut.utils.createElement("DIV",{class:"se-container"});e.appendChild(C),b&&e.appendChild(b),t.appendChild(e),E.appendChild(t),E.appendChild(Ut.utils.createElement("DIV",{class:"se-toolbar-sticky-dummy"}))}else{const t=$.get(_).get("container");if(n.get("_toolbar_bottom")){const e=t.querySelector(".se-statusbar");t.insertBefore(C,e),b&&t.insertBefore(b,C)}else t.insertBefore(C,t.firstElementChild),b&&t.insertBefore(b,t.firstElementChild)}return{context:te(C,E,h,b,k),carrierWrapper:a,options:n,plugins:s,icons:o,lang:l,value:i.v,rootId:_,rootKeys:x,frameRoots:$,pluginCallButtons:w.pluginCallButtons,responsiveButtons:w.responsiveButtons,pluginCallButtons_sub:y?y.pluginCallButtons:[],responsiveButtons_sub:y?y.responsiveButtons:[]}},{_w:we}=Dt,Ce=Math.floor(96/72*841.89105);const _e=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;#w=0;#C=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=we.getComputedStyle(this.#p);this.#g=Zt.get(t.paddingTop),this.#m=Zt.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${Zt.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${Zt.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&&we.clearTimeout(this.#M),this.#M=we.setTimeout((async()=>{await Ut.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,o=0,l=0;if(i.length>0){n=i[0].offsetHeight;for(let t=0;t<i.length;t++){const e=i[t].offsetTop;(e-o)%Ce!=0&&l++,o=e}const t=s-o;t>0&&t%Ce!=0&&l++}const r=this.#s(this.#l)?this._getWWScrollTop():0,a=Math.ceil(s/Ce)+l,h=this.#a.offsetWidth+1,c=[];for(let t=0;t<i.length;t++)c.push({number:t,top:i[t].offsetTop+n/2});this.#E=0;const d=this.#r.children,u=this.#p.children;this._initializeCache(u),c.push({number:0,top:0});for(let t=1,e=0;t<a;t++)if(e+=Ce+(1===t?this.#g+this.#m:this.#g),!c.some((t=>Math.abs(t.top-e)<3))){const s=this._calcPageBreakTop(e,d,u);if(null===s)break;c.push({number:t,top:s})}if(0===c.length)return this.#k=null,this.#w=1,void this._displayCurrentPage();c.sort(((t,e)=>t.top-e.top)),this.#d.innerHTML="",this.#$=[];for(let t,e=0;e<a;e++){if(!c[e])continue;if(t=c[e].top,s<t)break;const i=Ut.utils.createElement("DIV",{style:`top:${t-r}px`,innerHTML:String(e+1)},`<div class="se-document-page-line" style="width: ${h}px;"></div>${e+1}`);this.#d.appendChild(i),this.#$.push(i)}this.#k=this.#d.querySelectorAll(".se-document-page-line"),this.#w=this.#$.length,this._displayCurrentPage()}),400))}_getDisplayPage(){return this.#s(this.#l)?this.#l.get("wysiwyg"):we}_calcPageBreakTop(t,e,s){const{ci:i}=this._getElementAtPosition(t,s),n=s[i],o=e[i];if(!n||!o)return null;const l=t+(o.offsetTop-n.offsetTop)+(o.offsetHeight-n.offsetHeight)/2;return Math.round(l)}_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){let s=this.#E,i=e.length-1;for(;s<=i;){const e=Math.floor((s+i)/2),{top:n,height:o,bottom:l}=this.#T.get(e);if(t>=n&&t<=l)return this.#E=e,{ci:e,cm:t-l,ch:o};t<n?i=e-1:s=e+1}const n=e[s]?s:i;this.#E=n;const o=this.#T.get(n);return{ci:n,cm:t-o.bottom,ch:o.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?Ut.utils.removeClass(this.#h,"se-document-responsible"):Ut.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.#$;for(let i=0,n=s.length;i<n;i++)s[i].style.top=Zt.get(s[i].style.top)-(e-t)+"px";this.#S=e,this._displayCurrentPage()}scrollWindow(){this.#s(this.#l)||this._displayCurrentPage()}getCurrentPageNumber(){if(this.#w<=1)return 1;let t=0;if(this.#s(this.#l))t=this.#v/2;else{const e=this._getGlobalTop();if(t=we.scrollY-e+Ce/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.#C=s;return this.#C=this.#w}pageUp(){const t=this.#C-1<=1?1:this.#C-1;this._movePage(t,!1)}pageDown(){const t=this.#C+1>this.#$.length?this.#$.length:this.#C+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&&(Ut.utils.removeClass(this.#b,"active"),Ut.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.#w)}_getWWScrollTop(){const t=this._getDisplayPage();return t.scrollTop||t.scrollY||0}_movePage(t,e){const s=this._getGlobalTop(),i=this.#s(this.#l),n=Wt.nodeListToArray(this.#r.children),o=this.#d.offsetTop+Zt.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.#C=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():we.requestAnimationFrame(i)};we.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=Ut.query.getEventTarget(e);if(Ut.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&&(we.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 xe=class{#L;#N=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.#L={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>=Zt.get(i)},_range:null,_mousedown:!1,_preventBlur:!1,_preventFocus:!1}}get(t){return this.#L[t]}set(t,e){const s=this.#L[t];this.#L[t]=e,this.#B(t,e,s)}subscribe(t,e){return this.#N.has(t)||this.#N.set(t,new Set),this.#N.get(t).add(e),()=>this.#N.get(t).delete(e)}#B(t,e,s){const i=this.#N.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.#N.clear(),this.#L=null}},{_w:$e,_d:ke}=Dt;class Se{#A;#I;#V;constructor(t){this.#A=t.frameRoots,this.#I=this.#O(t.context),this.#V=this.#R({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.#A}get context(){return this.#I}get frameContext(){return this.#V}init(){this.applyToRoots((t=>{this.#z(t)}))}reset(t){this.#V.reset(t)}applyToRoots(t){this.#A.forEach(t)}#z(t){const e=t.get("options");if(t.set("wwComputedStyle",$e.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",$e),t.set("_wd",ke));const s=e.get("editableFrameAttributes");for(const e in s)t.get("wysiwyg").setAttribute(e,s[e])}#O(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()}}}#R(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(),Ut.utils.removeItem(t.get("topArea")),t.get("options").clear(),t.clear()})),this.#I.clear(),this.#V.clear(),this.#A.clear(),Ut.utils.removeItem(this.carrierWrapper),this.rootKeys=null,this.carrierWrapper=null,this.icons=null,this.lang=null,this.shadowRoot=null}}class Ee{#F;#P;#D;#q;constructor(t,e,s){this.#F=t,this.#P=s,this.#D=this.#W({value:e.options}),this.#q=this.#U({value:new Map})}get options(){return this.#D}get frameOptions(){return this.#q}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!==ne[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.#Z(v,h,""),0===v.length)return;1===s.size&&v.unshift(null);const b=[this.#P,t].reduce(((t,e)=>{for(const i in e)s.has(i||null)?this.#G(i,e,s,p,m,g):t[i]=e[i];return t}),{}),y=this.#D,w=he(b,g,h),C=w.o,_=w.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(Ut.utils.removeItem(i.get("statusbar")),l.get("statusbar")){const t=ce(l,null).statusbar;i.get("container").appendChild(t),se(t,i),u.__addStatusbarEvent(i,l)}else n.removeEvent(o.get("__statusbarEvent")),l.set("__statusbarEvent",null),se(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(Wt._setIframeStyleLinks(l.get("iframe_cssFileName")),"text/html").head.children,n=t.querySelector("style");for(;s[0];)t.insertBefore(s[0],n)}e.has("placeholder")&&(i.get("placeholder").textContent=l.get("placeholder")),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(C.get("theme"));break;case"events":{const t=C.get("events");for(const e in t)n.events[e]=t[e];break}case"autoStyleify":l.__resetAutoStyleify(C.get("autoStyleify"));break;case"textDirection":d.setDir("rtl"===C.get("textDirection")?"rtl":"ltr");break;case"historyStackDelayTime":c.resetDelayTime(C.get("historyStackDelayTime"));break;case"defaultLineBreakFormat":o.__resetBrLineBreak(C.get("defaultLineBreakFormat"))}y.setMany(C),this.#P=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")?Ut.utils.removeClass(x,"se-shortcut-hide"):Ut.utils.addClass(x,"se-shortcut-hide")}resetFrame(t){this.#q.reset(t)}#G(t,e,s,i,n,o){const l=e[t],r=Object.keys(l);if(this.#Z(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(ne,t))continue;const e=l[t];r.includes(t)&&h[t]!==e&&(i.get(a).set(this.#j(t),!0),c[t]=e)}const u={...h,...c};n.set(a,new Map(Object.entries(u))),o.push({key:a,options:u})}#j(t){return/^statusbar|^charCounter/.test(t)?"statusbar-changed":t}#Z(t,e,s){for(let i,n=0,o=t.length;n<o;n++)i=t[n],("fixed"===oe[i]||"fixed"===ne[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--)}#W(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)}}}#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)}}}_destroy(){this.#P=null,this.#D.clear(),this.#q.clear()}}const Te=class{#K;constructor(t){this.#K=t}isNode(t){return t&&"number"==typeof t.nodeType||t instanceof this.#Y().Node}isElement(t){return t&&1===t.nodeType||t instanceof this.#Y().Element}isRange(t){return t&&"Range"===t.constructor?.name||t instanceof this.#Y().Range}isSelection(t){return t&&"Selection"===t.constructor?.name||t instanceof this.#Y().Selection}#Y(){return this.#K.get("_ww")}},{_w:Me,_d:He,NO_EVENT:Le}=Dt;const Ne=class{#X;#K;#J;#Q=null;#tt=[];constructor(t,e,s){this.#X=s,this.#K=t.frameContext,this.#J=e.frameOptions,this.events=e.options.get("events")||{},this.triggerEvent=async(t,e)=>{if(Ut.check.isNonEditable(e?.frameContext?.get("wysiwyg")))return!1;const s=this.events[t];if("function"==typeof s)try{return await s({$:this.#X,...e})}catch(e){return console.error(`[SUNEDITOR.triggerEvent.${t}]`,e),!1}return Le}}addEvent(t,e,s,i){if(!t)return null;if((t===Me||t===He||"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.#tt.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===Me||e===He||"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.#J.get("iframe")&&this.#K.get("_ww").addEventListener(t,e,s),Me.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.#J.get("iframe")&&this.#K.get("_ww").removeEventListener(t,e,s),Me.removeEventListener(t,e,s),null}_injectActiveEvent(t){Ut.utils.addClass(t,"__se__active"),this.#Q=this.addGlobalEvent("mouseup",(()=>{Ut.utils.removeClass(t,"__se__active"),this.#Q=this.removeGlobalEvent(this.#Q)}))}_init(){for(let t,e=0,s=this.#tt.length;e<s;e++)t=this.#tt[e],t.target.removeEventListener(t.type,t.listener,t.useCapture);this.#tt=null,this.#Q&&=this.removeGlobalEvent(this.#Q)}};const Be=class{#X;#t;#et;#st;#e;#K;#it;#J;constructor(t){this.#X=t.$,this.#t=t.store,this.#et=this.#X.contextProvider.shadowRoot,this.#st=this.#X.contextProvider.carrierWrapper,this.#e=this.#X.context,this.#K=this.#X.frameContext,this.#it=this.#X.options,this.#J=this.#X.frameOptions}get(t){const e=this.#K.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=pt(e,K.bind(this)),c=r;for(;r&&!it(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.#K.get("wysiwygFrame");this.#K.get("wysiwyg").contains(e)&&(n=d.offsetLeft,o=d.offsetTop,l=d.parentElement.offsetWidth-(d.offsetLeft+d.offsetWidth));const u=this.#K.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.#K.get("wysiwyg").scrollHeight||0}}getGlobal(t){const e=this.#K.get("topArea"),s=this.#K.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.#K.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.#K.get("wysiwygFrame").nodeName))for(v=this.#K.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.#et?.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 w=p?p.getBoundingClientRect().top+(!p.parentElement||/^html$/i.test(p.parentElement.nodeName)?o.scrollY:0):0,C=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 _=lt(this.#K.get("_wd"));return{top:n,left:l,ts:w,ls:C,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.#K.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=lt(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=lt(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=s.offsetWidth,d=a.left,u=this.getGlobal(i).left;if(this.#it.get("_rtl")){const e=h>c?h-c:0,s=e>0?0:c-h;t.style.left=`${d-e+s}px`,u>this.getGlobal(t).left&&(t.style.left=u+"px")}else{const e=i.offsetWidth+u,s=e<=h?0:e-(d+h);t.style.left=s<0?`${d+s}px`:`${d}px`}}setAbsPosition(t,e,s){const i={left:0,right:0,top:0,...s.addOffset},n=s.position||"bottom",r=s.inst,a=!this.#it.get("_rtl");a||(i.left*=-1);const h=this.#J.get("iframe"),c=this.#K.get("wrapper").contains(e)||s.isWWTarget||!!h&&this.#K.get("wysiwyg").contains(e),d=Boolean(pt(e,".se-toolbar")),u=1===e.nodeType,p=c&&!u,g=u&&/inline/.test(o.getComputedStyle(e).display),m=lt(l),f=p?this.getWWScroll():this.#nt(),v=!c||!h&&u?e.getBoundingClientRect():this.#X.selection.getRects(e,"start").rects,b=this.getGlobal(e),y=it(t.firstElementChild,"se-arrow")?t.firstElementChild:null,w=s.sibling?.offsetHeight||0,C=y?y.offsetHeight:0,_=t.offsetHeight,x=e.offsetHeight,$=v.top,k=m.h-v.bottom,S=this.getGlobal(this.#K.get("topArea")).top,E=o.scrollY,T=this.#e.get("toolbar_main").offsetHeight,M=this.#it.get("toolbar_container"),H=this.#t.mode.isBalloon||this.#t.mode.isInline||M,L=M&&S-E-T>0||!this.#X.toolbar.isSticky&&H?0:T+(this.#X.toolbar.isSticky?this.#it.get("toolbar_sticky"):0),N=this.#K.get("statusbar")?.offsetHeight||0,{rmt:B,rmb:A,bMargin:I,rt:V}=this.#ot($,k,L,m,v,p,d);if(c&&(A-N+x<=0||B+V+x-(this.#X.toolbar.isSticky&&g?L:0)<=0)||B+x<0)return;const O=this.#K.get("topArea").getBoundingClientRect(),R=this.#t.mode.isBottom?O.bottom>=o.innerHeight-T:O.top<=T,z=this.#X.toolbar.isSticky&&"none"!==this.#e.get("toolbar_main").style.display&&(!H||R);let F=i.top,P=0,D="";"bottom"===n?(D="up",F+=v.bottom+C+E,P=A-(_+C),P-w<0&&(D="down",F-=x+_+2*C,P=B-(_+C),P-w<0&&(D="",F-=P-w-Math.max(1,P+_+C)))):(D="down",F+=v.top-_-C+E,P=(z&&!this.#t.mode.isBottom?v.top-L:B)-_-C,P-w<0&&(D="up",F+=x+_+2*C,P=(A>0?I:A)-(_+C)-N,P-w<0&&(D="",F+=P-2))),this.#lt(y,D),t.style.top=`${F}px`;const q=(1===t.nodeType?Zt.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.#X.selection.getRange();const o=this.#X.selection.getRects(e,n?"start":"end");n="start"===o.position;const r=this.#K.get("isFullScreen"),a=this.#K.get("topArea"),h=this.#st.contains(t),c=o.rects,d=r?0:o.scrollLeft,u=r?0:o.scrollTop,p=h?lt(l).w:a.offsetWidth,g=this.getGlobal(a),m=h?0:g.left,f=t.offsetWidth,v=t.offsetHeight;this.#rt(n,c,t,m,p,d,u,i),this.getGlobal(t).top-g.top<0&&(n=!n,this.#rt(n,c,t,m,p,d,u,i)),f===t.offsetWidth&&v===t.offsetHeight||this.#rt(n,c,t,m,p,d,u,i);const b=!this.#st.contains(t),y=lt(l),w=c.height,C=c.top,_=y.h-c.bottom,x=this.#X.toolbar.isSticky||!this.#t.mode.isBalloon&&!this.#t.mode.isInline?this.#e.get("toolbar_main").offsetHeight:0,{rmt:$,rmb:k,rt:S}=this.#ot(C,_,x,y,c,b,!1);if(!(k+w<=0||$+S+w<=0))return t.style.visibility="",!0}#rt(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.#K.get("topArea")).top:s.offsetHeight-this.#K.get("wysiwyg").offsetHeight);!t&&b>0&&this.#at()<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?(ot(h,"se-arrow-up"),nt(h,"se-arrow-down")):(ot(h,"se-arrow-down"),nt(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"}#at(){const t=this.#K.get("topArea");return l.documentElement.scrollHeight-(this.getGlobal(t).top+t.offsetHeight)}#ot(t,e,s,i,n,l,r){const a=this.#X.selection.getRects(this.#K.get("wysiwyg"),"start").rects;let h=0,c=0,d=0,u=0,p=0;const g=this.#J.get("iframe");u=n.top,p=i.h-n.bottom;const m=this.getGlobal(),f=this.#t.mode.isBottom;if(l){d=r||this.#X.toolbar.isSticky||this.#it.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.#X.toolbar.isSticky?s:e+s:this.#it.get("toolbar_container")&&!this.#X.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.#X.toolbar.isSticky?s:t+s:this.#it.get("toolbar_container")&&!this.#X.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.#X.toolbar.isSticky&&this.#X.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}}#lt(t,e){"up"===e?(t&&(t.style.visibility=""),nt(t,"se-arrow-up"),ot(t,"se-arrow-down")):"down"===e?(t&&(t.style.visibility=""),nt(t,"se-arrow-down"),ot(t,"se-arrow-up")):t&&(t.style.visibility="hidden")}#nt(){const t=lt(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:Ae}=Dt;const Ie=class{#F;#X;#t;#et;#ht;#e;#K;#it;#J;#ct=0;#dt=!1;constructor(t){this.#F=t,this.#X=t.$,this.#t=t.store,this.#et=this.#X.contextProvider.shadowRoot,this.#ht=this.#X.instanceCheck,this.#e=this.#X.context,this.#K=this.#X.frameContext,this.#it=this.#X.options,this.#J=this.#X.frameOptions,this.range=null,this.selectionNode=null,this.__iframeFocus=!1}get(){let t=null;return t="function"==typeof this.#et?.getSelection?this.#et.getSelection():this.#K.get("_ww").getSelection(),t?(this.#t.get("_range")||this.#K.get("wysiwyg").contains(t.focusNode)||(t.removeAllRanges(),t.addRange(this.#ut())),t):null}isRange(t){return this.#ht.isRange(t)}getRange(){const t=this.#t.get("_range")||this.#ut(),e=this.get();if(t.collapsed===e.isCollapsed||!this.#K.get("wysiwyg").contains(e.focusNode)){if(this.#X.component.is(t.startContainer)){const e=this.#X.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=Ut.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;(Ut.check.isBreak(n)||3===n.nodeType)&&o>n.textContent.length&&(o=n.textContent.length),(Ut.check.isBreak(l)||3===l.nodeType)&&r>l.textContent.length&&(r=l.textContent.length),this.#X.format.isLine(n)&&(n=n.childNodes[o>0?n.childNodes.length-1:0]||n,o=o>0?1!==n.nodeType||Ut.check.isBreak(n)?n.textContent?n.textContent.length:0:1:0),this.#X.format.isLine(l)&&(l=l.childNodes[r>0?l.childNodes.length-1:0]||l,r=r>0?1!==l.nodeType||Ut.check.isBreak(l)?l.textContent?l.textContent.length:0:1:0);const a=this.#K.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.#X.focusManager.nativeFocus()}const h=this.get();return h.removeAllRanges&&h.removeAllRanges(),h.addRange(a),this.#t.set("_range",a),this.#pt(a,this.get()),this.#J.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.#gt(t)){const s=e?.parentElement||this.#K.get("wysiwyg"),i=Ut.utils.createElement(this.#it.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.#K.get("wysiwyg").contains(this.selectionNode)||this.init(),!this.selectionNode){const t=Ut.query.getEdgeChild(this.#K.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=!!Ut.check.isElement(t)&&"absolute"===Ae.getComputedStyle(t).position;t=!t||Ut.check.isText(t)?this.getRange():t;let i="start"===e,n=Ae.scrollX,o=Ae.scrollY,l=t.getClientRects();if(l=l[i?0:l.length-1],!l){const t=this.getNode();if(this.#X.format.isLine(t)){const t=Ut.utils.createTextNode(qt.zeroWidthSpace);this.#X.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.#X.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.#K.get("wysiwygFrame").nodeName)?this.#K.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.#K.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.#ht.isSelection(t))t=t.getRangeAt(0);else if(this.#ht.isNode(t))if(s){const e=this.#K.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=Ut.query.getParentElement(t?.startContainer,(t=>1===t.nodeType));if(!i)return;delete(e={behavior:"smooth",block:"nearest",inline:"nearest",...e}).noFocus;const n=this.#K.get("_ww"),o=this.#K.get("wysiwygFrame"),l=this.#J.get("iframe"),r=!this.#t.get("isScrollable")(this.#K),a=this.#t.get("currentViewportHeight"),h=r?Ae.scrollY:l?n.scrollY:o.scrollTop,c=this.#t.mode.isBottom,d=this.#e.get("toolbar_main").offsetHeight,u=this.#X.toolbar.isSticky?d:0,p=this.#X.toolbar.isSticky?u+this.#it.get("toolbar_sticky"):u,g=this.#K.get("statusbar")?.offsetHeight||0;if(this.#dt)return i?.scrollIntoView(e),void("auto"===e?.behavior&&h!==Ae.scrollY&&(p?c?h<Ae.scrollY&&Ae.scrollBy(0,p):h>Ae.scrollY&&Ae.scrollBy(0,-p):r&&Ae.scrollBy(0,g)));const m=this.#ct,f=r?a-(c?p:0):o.offsetHeight,v=t?.getBoundingClientRect?.(),b=(v?.height>0?v.height:i.offsetHeight)||0,y=e?.behavior,w=c?0:p;if(r)if(l){const e=this.getRects(t,"end").rects,s=e.top+b-w,i=f-m-(e.top+b);if(s>=0&&i>=0)return;const n=h-(s<0?-(s-m):i);Ae.scrollTo({top:n<h?n-w:n,behavior:y})}else{const t=f+h-this.#X.offset.getGlobal(i).top-b;if(t-m>0&&f>t+m+w)return;const e=t<=m?h-t+m+g:h-t+(f-b-m);Ae.scrollTo({top:e<h?e-w:e,behavior:y})}else{const t=v?.height>0?v.top:i.getBoundingClientRect().top,e=l?t:t-o.getBoundingClientRect().top,s=e-m>0&&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=Ae.scrollY,w=this.#X.offset.getGlobal(),C=c?0:d,_=c?d:0,x=p-w.top+C,$=w.top+w.height-(p+a)+_;if(x>0){const t=(s?e:e+h-r)-b-m-x;t<0&&(r+=C,Ae.scrollTo({top:p+t,behavior:"smooth"}))}if($>0){const t=(s?e:e+h-r)+b+m-(w.height-$);t>0&&(r+=c?_:g,Ae.scrollTo({top:p+t,behavior:"smooth"}))}s||(l?n:o).scrollTo({top:r,behavior:y})}}resetRangeToTextNode(){let t=this.getRange();if(this.#gt(t)){if(!Ut.check.isWysiwygFrame(t.startContainer)||!Ut.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.#X.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.#X.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=Ut.check.isWysiwygFrame(l)?this.#K.get("wysiwyg").firstChild:l,n=r,Ut.check.isBreak(i)||1===i.nodeType&&i.childNodes.length>0){const t=Ut.check.isBreak(i);if(!t){const t=i;for(;i&&!Ut.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.#X.format.getLine(i,null);e===this.#X.format.getBlock(e,null)&&(i||=t,e=Ut.utils.createElement(Ut.query.getParentElement(i,Ut.check.isTableCell)?"DIV":this.#it.get("defaultLine")),i.parentNode.insertBefore(e,i),i!==t&&e.appendChild(i))}if(Ut.check.isBreak(i)||this.#X.component.is(i)){const e=Ut.utils.createTextNode(qt.zeroWidthSpace);i.parentNode.insertBefore(e,i),i=e,t&&l===a&&(a=i,h=1)}}if(l=i,r=n,i=Ut.check.isWysiwygFrame(a)?this.#K.get("wysiwyg").lastChild:a,n=h,Ut.check.isBreak(i)||1===i.nodeType&&i.childNodes.length>0){const t=Ut.check.isBreak(i);if(!t){for(;i&&!Ut.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.#X.format.getLine(i,null);t===this.#X.format.getBlock(t,null)&&(t=Ut.utils.createElement(Ut.check.isTableCell(t)?"DIV":this.#it.get("defaultLine")),i.parentNode.insertBefore(t,i),t.appendChild(i))}if(Ut.check.isBreak(i)){const e=Ut.utils.createTextNode(qt.zeroWidthSpace);i.parentNode.insertBefore(e,i),i=e,n=1,t&&!i.previousSibling&&Ut.utils.removeItem(a)}}return a=i,h=n,this.setRange(l,r,a,h),!0}init(){const t=this.#K.get("_wd").activeElement;if(Ut.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.#ut(),this.#pt(s,e)}#pt(t,e){let s=null;this.#t.set("_range",t),s=t.collapsed?Ut.check.isWysiwygFrame(t.commonAncestorContainer)&&t.commonAncestorContainer.children[t.startOffset]||t.commonAncestorContainer:e.anchorNode,this.selectionNode=s}#gt(t){const e=t.commonAncestorContainer;return Ut.check.isWysiwygFrame(t.startContainer)&&Ut.check.isWysiwygFrame(t.endContainer)||/FIGURE/i.test(e.nodeName)||this.#X.pluginManager.fileInfo.regExp.test(e.nodeName)&&(!this.#X.pluginManager.fileInfo.tagAttrs[e.nodeName]||this.#X.pluginManager.fileInfo.tagAttrs[e.nodeName]?.every((t=>e.hasAttribute(t))))||this.#X.component.is(e)}#ut(){const t=this.#K.get("wysiwyg"),e=this.#K.get("_wd").createRange();let s=t.firstElementChild,i=null;return s?(i=s.firstChild,i||(i=Ut.utils.createElement("BR"),s.appendChild(i))):(i=Ut.utils.createElement("BR"),s=Ut.utils.createElement(this.#it.get("defaultLine"),null,i),t.appendChild(s)),e.setStart(i,0),e.setEnd(i,0),e}__focus(){try{this.__iframeFocus=!0;const t=Ut.query.getParentElement(this.getNode(),"figcaption");t?t.focus():this.#K.get("wysiwyg").focus()}finally{Ae.setTimeout((()=>this.__iframeFocus=!1),0)}}__init(){this.#dt=this.#F._eventOrchestrator.scrollparents?.length>0,this.#ct=this.#K?.get("wysiwyg")?(Zt.get(Ae.getComputedStyle(this.#K.get("wysiwyg")).scrollMargin,0)||40)+Zt.get(Ae.getComputedStyle(this.#K.get("wrapper")).paddingBottom,0):40}};function Ve(t,e,s){const i=[];for(let n,o,l=0,r=t.length;l<r;l++)n=t[l],Ut.check.isListCell(n)?(e<0||n.previousElementSibling)&&i.push(n):(o=/\d+/.test(n.style[s])?Zt.get(n.style[s],0):0,o+=e,Ut.utils.setStyle(n,s,o<=0?"":o+"px"));return i}const Oe=class{#X;#t;#it;#K;#mt;#ft;#vt;#bt;#yt;#wt;#Ct=null;constructor(t){this.#X=t.$,this.#t=t.store,this.#it=this.#X.options,this.#K=this.#X.frameContext,this.#mt=this.#it.get("formatLine").reg,this.#ft=this.#it.get("formatBrLine").reg,this.#vt=this.#it.get("formatBlock").reg,this.#bt=this.#it.get("formatClosureBlock").reg,this.#yt=this.#it.get("formatClosureBrLine").reg,this.#wt=new RegExp("^("+this.#it.get("textStyleTags")+")$","i"),this.__resetBrLineBreak(this.#it.get("defaultLineBreakFormat"))}setLine(t){if(!this.isLine(t))throw new Error('[SUNEDITOR.format.setLine.fail] The "element" must satisfy "format.isLine()".');const e=this.#_t(),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.#X.component.is(e)||(r=t.cloneNode(!1),Ut.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.#X.selection.setRange(Ut.query.getNodeFromPath(e.firstPath,o),e.startOffset,Ut.query.getNodeFromPath(e.lastPath,l),e.endOffset),this.#X.history.push(!1),this.#K.has("documentType_use_header")&&this.#K.get("documentType").reHeader()}getLine(t,e){if(!t)return null;for(e||=()=>!0;t;){if(Ut.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.#_t().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.#X.component.is(o),l=c?"":o.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),r=Ut.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&&Ut.check.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,Ut.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&&Ut.check.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,Ut.utils.removeItem(a));const t=n.previousSibling;t&&n.nodeName===t.nodeName&&Ut.check.isSameAttributes(n,t)&&(t.innerHTML+="<BR>"+n.innerHTML,Ut.utils.removeItem(n))}c||Ut.utils.removeItem(o),l&&(u=!1)}this.#X.selection.setRange(o,0,o,0),this.#X.history.push(!1)}getBrLine(t,e){if(!t)return null;for(e||=()=>!0;t;){if(Ut.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.#X.selection.getNode(),null);let i=null;if(this.isBrLine(t)||!this.isBrLine(s||t.parentNode)||this.#X.component.is(t)){const t=e?"string"==typeof e?e:e.nodeName:this.isNormalLine(s)?s.nodeName:this.#it.get("defaultLine");i=Ut.utils.createElement(t,null,"<br>"),(e&&"string"!=typeof e||!e&&this.isLine(s))&&Ut.utils.copyTagAttributes(i,e||s,["id"])}else i=Ut.utils.createElement("BR");return Ut.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(Ut.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.#X.selection.getRangeAndAddLine(this.#X.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],Ut.check.isListCell(t))if(s=t.lastElementChild,s&&Ut.check.isListCell(t.nextElementSibling)&&e.includes(t.nextElementSibling)&&(n=s.lastElementChild,e.includes(n))){let t=null;for(;t=n.lastElementChild;)if(Ut.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),Ut.check.isTableCell(i)?(n=null,o=i):(n=i.nextSibling,o=i.parentNode);const l=t.cloneNode(!1);let r=Ut.query.getNodeDepth(i),a=null;const h=[],c=(t,e,s)=>{let i=null;if(t!==e&&!Ut.check.isTableElements(e)){if(e&&Ut.query.getNodeDepth(t)===Ut.query.getNodeDepth(e))return s;i=this.#X.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=Ut.query.getNodeDepth(t),Ut.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(;Ut.check.isList(m);)e=Ut.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.#X.nodeTransform.mergeSameTags(l,null,!1),this.#X.nodeTransform.mergeNestedTags(l,(t=>Ut.check.isList(t))),n&&Ut.query.getNodeDepth(n)>0&&(Ut.check.isList(n.parentNode)||Ut.check.isList(n.parentNode.parentNode))){const t=Ut.query.getParentElement(n,(t=>this.isBlock(t)&&!Ut.check.isList(t))),e=this.#X.nodeTransform.split(n,null,t?Ut.query.getNodeDepth(t)+1:0);e.parentNode.insertBefore(l,e)}else o.insertBefore(l,n),c(l,n);const d=Ut.query.getEdgeChildNodes(l.firstElementChild,l.lastElementChild);e.length>1?this.#X.selection.setRange(d.sc,0,d.ec,d.ec.textContent.length):this.#X.selection.setRange(d.ec,d.ec.textContent.length,d.ec,d.ec.textContent.length),this.#X.history.push(!1)}removeBlock(t,{selectedFormats:e,newBlockElement:s,shouldDelete:i,skipHistory:n}={}){const o=this.#X.selection.getRange();let l=o.startOffset,r=o.endOffset,a=Ut.query.getListChildNodes(t,null,1),h=t.parentNode,c=null,d=null,u=t.cloneNode(!1);const p=[],g=Ut.check.isList(s);let m=!1,f=!1,v=!1;const b=(e,s,i,n)=>{if(1===s.childNodes.length&&Ut.check.isZeroWidth(s)&&(s.innerHTML=qt.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)||Ut.check.isBreak(c)||Ut.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(Ut.check.isListCell(e)&&Ut.check.isListCell(a)&&Ut.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.#X.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||!Ut.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&&Ut.check.isListCell(n))if(l&&Ut.query.getNodeDepth(n)!==Ut.query.getNodeDepth(l)&&(Ut.check.isListCell(h)||Ut.utils.arrayFind(n.children,Ut.check.isList))){const e=n.nextElementSibling,s=this.#X.listFormat.removeNested(n,!1);t===s&&e===n.nextElementSibling||(t=s,f=!0)}else{const e=n;n=Ut.utils.createElement(i?e.nodeName:Ut.check.isList(t.parentNode)||Ut.check.isListCell(t.parentNode)?"LI":Ut.check.isTableCell(t.parentNode)?"DIV":this.#it.get("defaultLine"));const s=Ut.check.isListCell(n),o=e.childNodes;for(;o[0]&&(!Ut.check.isList(o[0])||s);)n.appendChild(o[0]);Ut.utils.copyFormatAttributes(n,e),v=!0}else n=n.cloneNode(!1);if(!f&&(i?(p.push(n),Ut.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=Ut.query.getListChildNodes(t,null,1),u=t.cloneNode(!1),h=t.parentNode,r=-1,y=a.length;continue}}const y=t.parentNode;let w=t.nextSibling;u?.children.length>0&&y.insertBefore(u,w),s?c=s.previousSibling:c||=t.previousSibling,w=t.nextSibling!==u?t.nextSibling:u?u.nextSibling:null,0===t.children.length||0===t.textContent.length?Ut.utils.removeItem(t):this.#X.nodeTransform.removeEmptyNode(t,null,!1);let C=null;if(this.#t.set("_lastSelectionNode",null),i)C={cc:y,sc:c,so:l,ec:w,eo:r,removeArray:p};else{c||=d,d||=c;const t=Ut.query.getEdgeChildNodes(c,d?.parentNode?c:d);t?C={cc:(t.sc||t.ec).parentNode,sc:t.sc,so:l,ec:t.ec,eo:r,removeArray:null}:this.#X.focusManager.focus()}if(n)return C;!i&&C&&(e?this.#X.selection.setRange(C.sc,l,C.ec,r):this.#X.selection.setRange(C.sc,0,C.sc,0)),this.#X.history.push(!1)}indent(){const t=this.#X.selection.getRange(),e=t.startContainer,s=t.endContainer,i=t.startOffset,n=t.endOffset,o=Ve(this.getLines(null),this.#t.get("indentSize"),this.#it.get("_rtl")?"marginRight":"marginLeft");o.length>0&&this.#X.listFormat.applyNested(o,!1),this.#t.set("_lastSelectionNode",null),this.#X.selection.setRange(e,i,s,n),this.#X.history.push(!1)}outdent(){const t=this.#X.selection.getRange(),e=t.startContainer,s=t.endContainer,i=t.startOffset,n=t.endOffset,o=Ve(this.getLines(null),-1*this.#t.get("indentSize"),this.#it.get("_rtl")?"marginRight":"marginLeft");o.length>0&&this.#X.listFormat.applyNested(o,!0),this.#t.set("_lastSelectionNode",null),this.#X.selection.setRange(e,i,s,n),this.#X.history.push(!1)}isEdgeLine(t,e,s){if(!Ut.check.isEdgePoint(t,e,s))return!1;let i=!1;const n="front"===s?"previousSibling":"nextSibling";for(;t&&!this.isLine(t)&&!Ut.check.isWysiwygFrame(t);){if(t[n]&&(!Ut.check.isBreak(t[n])||t[n][n]))return!1;i=!0,t=t.parentNode}return i}isTextStyleNode(t){return"string"==typeof t?this.#wt.test(t):1===t?.nodeType&&this.#wt.test(t.nodeName)}isLine(t){return"string"==typeof t?this.#mt.test(t):1===t?.nodeType&&(this.#mt.test(t.nodeName)||Ut.utils.hasClass(t,"__se__format__line_.+|__se__format__br_line_.+"))&&!this.#xt(t)}isNormalLine(t){return this.isLine(t)&&(this.#Ct||!this.isBrLine(t))&&!this.isBlock(t)}isBrLine(t){return this.#Ct&&this.isLine(t)||("string"==typeof t?this.#ft.test(t):1===t?.nodeType&&(this.#ft.test(t.nodeName)||Ut.utils.hasClass(t,"__se__format__br_line_.+"))&&!this.#xt(t))}isBlock(t){return"string"==typeof t?this.#vt.test(t):1===t?.nodeType&&(this.#vt.test(t.nodeName)||Ut.utils.hasClass(t,"__se__format__block_.+"))&&!this.#xt(t)}isClosureBlock(t){return"string"==typeof t?this.#bt.test(t):1===t?.nodeType&&(this.#bt.test(t.nodeName)||Ut.utils.hasClass(t,"__se__format__block_closure_.+"))&&!this.#xt(t)}isClosureBrLine(t){return"string"==typeof t?this.#yt.test(t):1===t?.nodeType&&(this.#yt.test(t.nodeName)||Ut.utils.hasClass(t,"__se__format__br_line__closure_.+"))&&!this.#xt(t)}getLines(t){if(!this.#X.selection.resetRangeToTextNode())return[];let e=this.#X.selection.getRange();if(Ut.check.isWysiwygFrame(e.startContainer)){const t=this.#K.get("wysiwyg").children,s=t.length;if(0===s)return[];this.#X.selection.setRange(t[0],0,t[s-1],t[s-1].textContent.trim().length),e=this.#X.selection.getRange()}const s=e.startContainer,i=e.endContainer,n=e.commonAncestorContainer;t||=this.isLine.bind(this);const o=Ut.query.getListChildren(n,(e=>t(e)),null);if(3!==n.nodeType&&(Ut.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!Ut.check.isTableElements(t)||/^TABLE$/i.test(t.nodeName)};let d=this.getBlock(l,c),u=this.getBlock(r,c);Ut.check.isTableElements(d)&&Ut.check.isListCell(d.parentNode)&&(d=d.parentNode),Ut.check.isTableElements(u)&&Ut.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.#X.selection.getRange().commonAncestorContainer,s=Ut.query.getParentElement(e,this.#X.component.is.bind(this.#X.component)),i=Ut.check.isTableElements(e)?this.getLines(null):this.getLines((t=>{const e=Ut.query.getParentElement(t,this.#X.component.is.bind(this.#X.component));return this.isLine(t)&&(!e||e===s)||Ut.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.#X.component.is(t)||e.test(t.nodeName))}_isExcludeSelectionElement(t){return!/FIGCAPTION/i.test(t.nodeName)&&(this.#X.component.is(t)||/FIGURE/i.test(t.nodeName))}#xt(t){return Ut.check.isExcludeFormat(t)||this.#X.component.is(t)||Ut.check.isWysiwygFrame(t)}#_t(){let t=this.#X.selection.getRange(),e=this.getLinesAndComponents(!1);if(0===e.length&&(t=this.#X.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=Ut.query.getNodePath(t.startContainer,n,null),r=Ut.query.getNodePath(t.endContainer,o,null),a=this.#X.listFormat.remove(e,!1);return a.sc&&(n=a.sc),a.ec&&(o=a.ec),this.#X.selection.setRange(Ut.query.getNodeFromPath(l,n),s,Ut.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.#Ct="br"===t}};function Re(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 ze=class{#X;#it;#$t;#kt;constructor(t){this.#X=t.$,this.#it=this.#X.options,this.#$t=this.#it.get("__listCommonStyle"),this.#kt=Wt.camelToKebabCase(this.#it.get("__listCommonStyle"))}apply(t,{stylesToModify:e,nodesToRemove:s,strictRemove:i}={}){if(Ut.query.getParentElement(this.#X.selection.getNode(),Ut.check.isNonEditable))return;this.#X.selection.resetRangeToTextNode();let n=this.#X.selection.getRangeAndAddLine(this.#X.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.#X.format.isLine(r.parentNode)&&this.#X.format.isLine(h.parentNode)||r===h&&1===r.nodeType&&Ut.check.isNonEditable(r)){const t=r.parentNode;if(!Ut.check.isListCell(t)||!Wt.getValues(t.style).some((t=>this.#kt.includes(t))))return}if(n.collapsed&&!l&&1===r.nodeType&&!Ut.check.isBreak(r)&&!this.#X.component.is(r)){let t=null;const e=r.childNodes[a];e&&(t=e.nextSibling?Ut.check.isBreak(e)?e:e.nextSibling:null);const s=Ut.utils.createTextNode(qt.zeroWidthSpace);r.insertBefore(s,t),this.#X.selection.setRange(s,1,s,1),n=this.#X.selection.getRange(),r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset}this.#X.format.isLine(r)&&(r=r.childNodes[a]||r.firstChild,a=0),this.#X.format.isLine(h)&&(h=h.childNodes[c]||h.lastChild,c=h.textContent.length),o&&(t=Ut.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.#X.format.isLine(e)&&!Ut.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},w=function(t){const e=t.cloneNode(!1);if(3===e.nodeType||Ut.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)},C=this.#X.format.getLines(null);if(0===C.length)return void console.warn("[SUNEDITOR.inline.apply.warn] There is no line to apply.");n=this.#X.selection.getRange(),r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset,this.#X.format.getLine(r,null)||(r=Ut.query.getEdgeChild(C[0],(function(t){return 3===t.nodeType}),!1),a=0),this.#X.format.getLine(h,null)||(h=Ut.query.getEdgeChild(C.at(-1),(function(t){return 3===t.nodeType}),!1),c=h.textContent.length);const _=this.#X.format.getLine(r,null)===this.#X.format.getLine(h,null),x=C.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.#St(p),S=this.#Et.bind(this,$,k),E=this.#Tt.bind(this,$,k);if(_){this.#Mt(C[0],e)&&(n=this.#X.selection.setRange(r,a,h,c));const t=this.#Ht(C[0],p,w,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&&Ut.check.isZeroWidth(m.container)&&(m.offset=f.offset=1),this.#Lt(t.ancestor,null)}else{let s=!1;x>0&&this.#Mt(C[x],e)&&(s=!0),this.#Mt(C[0],e)&&(s=!0),s&&this.#X.selection.setRange(r,a,h,c),x>0&&(p=t.cloneNode(!1),f=this.#Nt(C[x],p,w,h,c,l,o,y,S,E));for(let s,i=x-1;i>0;i--)this.#Mt(C[i],e),p=t.cloneNode(!1),s=this.#Bt(C[i],p,w,l,o,y,f.container),s.endContainer&&s.ancestor.contains(s.endContainer)&&(f.ancestor=null,f.container=s.endContainer),this.#Lt(s.ancestor,null);p=t.cloneNode(!1),m=this.#At(C[0],p,w,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.#Lt(m.ancestor,null),this.#Lt(f.ancestor||this.#X.format.getLine(f.container),null)}return this.#X.ui.offCurrentController(),this.#X.selection.setRange(m.container,m.offset,f.container,f.offset),this.#X.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&&(Ut.check.isNonEditable(t)||!this.#X.format.isTextStyleNode(t)||this.#X.component.is(t))}#Ht(t,e,s,i,n,o,l,r,a,h,c,d,u){let p=i.parentNode;for(;!(p.nextSibling||p.previousSibling||this.#X.format.isLine(p.parentNode)||Ut.check.isWysiwygFrame(p.parentNode))&&p.nodeName!==e.nodeName;)p=p.parentNode;if(!a&&!r&&p===o.parentNode&&p.nodeName===e.nodeName&&Ut.check.isZeroWidth(i.textContent.slice(0,n))&&Ut.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=!Ut.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 Ut.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,w,C,_,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=Ut.utils.createTextNode(o),h=Ut.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)}Ut.check.isZeroWidth(r)||n.appendChild(r);const c=d(n);for(c&&(x=c),x&&(t=x),w=a,y=[],_="";w!==t&&w!==m&&null!==w;)i=u(w)?null:s(w),i&&1===w.nodeType&&L(w)&&(y.push(i),_+=w.style.cssText.substring(0,w.style.cssText.indexOf(":"))+"|"),w=w.parentElement;const p=y.pop()||h;for(C=w=p;y.length>0;)w=y.pop(),C.appendChild(w),C=w;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,w!==h&&w.appendChild($),!b)continue}if(M||a!==S){if(T){if(1===a.nodeType&&!Ut.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}w=a,y=[],_="";const o=[];for(;null!==w.parentNode&&w!==m&&w!==e;)i=M?w.cloneNode(!1):s(w),1===w.nodeType&&!Ut.check.isBreak(a)&&i&&L(w)&&(u(w)?x||o.push(i):y.push(i),_+=w.style.cssText.substring(0,w.style.cssText.indexOf(":"))+"|"),w=w.parentElement;y=y.concat(o);const l=y.pop()||a;for(C=w=l;y.length>0;)w=y.pop(),C.appendChild(w),C=w;if(!u(e.parentNode)||u(l)||Ut.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=w):(e.appendChild(l),n=w);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?w:e}if(x&&3===a.nodeType)if(d(a)){const t=Ut.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||Ut.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=Ut.utils.createTextNode(t),l=Ut.utils.createTextNode(n);if(x?x=x.cloneNode(!1):u(e.parentNode)&&!x&&(e=e.cloneNode(!1),v.appendChild(e),f.push(e)),!Ut.check.isZeroWidth(o)){w=a,_="",y=[];const t=[];for(;w!==v&&w!==m&&null!==w;)1===w.nodeType&&L(w)&&(u(w)?t.push(w.cloneNode(!1)):y.push(w.cloneNode(!1)),_+=w.style.cssText.substring(0,w.style.cssText.indexOf(":"))+"|"),w=w.parentElement;for(y=y.concat(t),c=C=w=y.pop()||o;y.length>0;)w=y.pop(),C.appendChild(w),C=w;v.appendChild(c),w.textContent=o.data}if(x&&c){const t=d(c);t&&(x=t)}for(w=a,y=[],_="";w!==v&&w!==m&&null!==w;)i=u(w)?null:s(w),i&&1===w.nodeType&&L(w)&&(y.push(i),_+=w.style.cssText.substring(0,w.style.cssText.indexOf(":"))+"|"),w=w.parentElement;const p=y.pop()||l;for(C=w=p;y.length>0;)w=y.pop(),C.appendChild(w),C=w;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=qt.zeroWidthSpace),w!==l&&w.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=Ut.utils.createTextNode(qt.zeroWidthSpace),v.replaceChild(s,e);else{const t=e.childNodes;for(i=t[0];t[0];)n=t[0],v.insertBefore(n,e);Ut.utils.removeItem(e)}0===t&&(h?$=S=s:($=i,S=n))}else{if(a)for(let t=0;t<f.length;t++)Re(f[t]);h&&($=S=e)}this.#X.nodeTransform.removeEmptyNode(v,e,!1),h&&(k=$.textContent.length,E=S.textContent.length);const N=r||0===S.textContent.length;Ut.check.isBreak(S)||0!==S.textContent.length||(Ut.utils.removeItem(S),S=$),E=N?S.textContent.length:E;const B={s:0,e:0},A=Ut.query.getNodePath($,v,B),I=!S.parentNode;I&&(S=$);const V={s:0,e:0},O=Ut.query.getNodePath(S,v,I||N?null:V);k+=B.s,E=h?k:I?$.textContent.length:N?E+B.s:E+V.s;const R=this.#X.nodeTransform.mergeSameTags(v,[A,O],!0);return t.parentNode.replaceChild(v,t),$=Ut.query.getNodeFromPath(A,v),S=Ut.query.getNodeFromPath(O,v),{ancestor:v,startContainer:$,startOffset:k+R[0],endContainer:S,endOffset:E+R[1]}}#At(t,e,s,i,n,o,l,r,a,h,c){let d=i.parentNode;for(;!(d.nextSibling||d.previousSibling||this.#X.format.isLine(d.parentNode)||Ut.check.isWysiwygFrame(d.parentNode))&&d.nodeName!==e.nodeName;)d=d.parentNode;if(!l&&!o&&d.nodeName===e.nodeName&&!this.#X.format.isLine(d)&&!d.nextSibling&&Ut.check.isZeroWidth(i.textContent.slice(0,n))){let s=!0,o=i.previousSibling;for(;o;){if(!Ut.check.isZeroWidth(o)){s=!1;break}o=o.previousSibling}if(s)return Ut.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,w=i,C=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(_&&!Ut.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=Ut.query.getNodePath(c,d);c=Ut.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,w=f.pop()||d;for(b=v=w;f.length>0;)v=f.pop(),b.appendChild(v),b=v;if(h(e.parentNode)&&!h(w)&&(e=e.cloneNode(!1),m.appendChild(e),g.push(e)),!y&&h(w)){e=e.cloneNode(!1);const t=w.childNodes;for(let s=0,i=t.length;s<i;s++)e.appendChild(t[s]);w.appendChild(e),m.appendChild(w),n=h(v)?e:v,g.push(e)}else r?(e.appendChild(w),n=v):n=e;if(y&&3===d.nodeType)if(a(d)){const t=Ut.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!==w)i=_?s(d):d.cloneNode(!1),i&&(n.appendChild(i),1!==d.nodeType||Ut.check.isBreak(d)||(x=i)),t(d,x);else{let t=m;y=a(d);let o="",l="";if(3===w.nodeType){const t=w;o=t.substringData(0,C),l=t.substringData(C,t.length-C)}const r=Ut.utils.createTextNode(o),h=Ut.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)}Ut.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,Ut.check.isBreak(d)&&e.appendChild(d.cloneNode(!1)),t.appendChild(e),w=h,C=0,_=!0,n.appendChild(w)}}}(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);Ut.utils.removeItem(e),0===t&&(w=i)}else if(l){e=e.firstChild;for(let t=0;t<g.length;t++)Re(g[t])}if(o||0!==m.childNodes.length){this.#X.nodeTransform.removeEmptyNode(m,e,!1),Ut.check.isZeroWidth(m.textContent)&&(w=m.firstChild,C=0);const s={s:0,e:0},i=Ut.query.getNodePath(w,m,s);C+=s.s;const n=this.#X.nodeTransform.mergeSameTags(m,[i],!0);t.parentNode.replaceChild(m,t),w=Ut.query.getNodeFromPath(i,m),C+=n[0]}else t.childNodes?w=t.childNodes[0]:(w=Ut.utils.createTextNode(qt.zeroWidthSpace),t.appendChild(w));return{ancestor:m,container:w,offset:C,endContainer:c}}#Bt(t,e,s,i,n,o,l){if(!n){let s=null;l&&t.contains(l)&&(s=Ut.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(!Ut.check.isBreak(t)&&this._isIgnoreNodeChange(t))continue;if(1===c){a=t.childNodes,c=a.length,h=-1;continue}break}t.style.cssText+=o,Ut.utils.addClass(t,r)}if(c>0&&h===c)return t.innerHTML=i.innerHTML,{ancestor:t,endContainer:s?Ut.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(Ut.check.isBreak(p)||!r._isIgnoreNodeChange(p))i=s(p),i&&(c=!1,n.appendChild(i),1===p.nodeType&&(g=i)),Ut.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=Ut.query.getNodePath(l,p);l=Ut.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);Ut.utils.removeItem(e)}else if(n){e=e.firstChild;for(let t=0;t<h.length;t++)Re(h[t])}return this.#X.nodeTransform.removeEmptyNode(a,e,!1),this.#X.nodeTransform.mergeSameTags(a,null,!0),t.parentNode.replaceChild(a,t),{ancestor:a,endContainer:l}}#Nt(t,e,s,i,n,o,l,r,a,h){let c=i.parentNode;for(;!(c.nextSibling||c.previousSibling||this.#X.format.isLine(c.parentNode)||Ut.check.isWysiwygFrame(c.parentNode))&&c.nodeName!==e.nodeName;)c=c.parentNode;if(!l&&!o&&c.nodeName===e.nodeName&&!this.#X.format.isLine(c)&&!c.previousSibling&&Ut.check.isZeroWidth(i.textContent.slice(n))){let s=!0,o=i.nextSibling;for(;o;){if(!Ut.check.isZeroWidth(o)){s=!1;break}o=o.nextSibling}if(s)return Ut.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,w=n,C=!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(C&&!Ut.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=Ut.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(C||r!==y)i=C?s(r):r.cloneNode(!1),i&&(n.insertBefore(i,n.firstChild),1!==r.nodeType||Ut.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(w,e.length-w),o=e.substringData(0,w)}const l=Ut.utils.createTextNode(t),c=Ut.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(Ut.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,Ut.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,w=c.data.length,C=!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);Ut.utils.removeItem(e),t===p.length-1&&(y=i,w=i.textContent.length)}else if(l){e=e.firstChild;for(let t=0;t<p.length;t++)Re(p[t])}if(o||0!==g.childNodes.length){if(!l&&0===e.textContent.length)return this.#X.nodeTransform.removeEmptyNode(g,null,!1),{ancestor:null,container:null,offset:0};this.#X.nodeTransform.removeEmptyNode(g,e,!1),Ut.check.isZeroWidth(g.textContent)?(y=g.firstChild,w=y.textContent.length):Ut.check.isZeroWidth(y)&&(y=e,w=1);const s={s:0,e:0},i=Ut.query.getNodePath(y,g,s);w+=s.s;const n=this.#X.nodeTransform.mergeSameTags(g,[i],!0);t.parentNode.replaceChild(g,t),y=Ut.query.getNodeFromPath(i,g),w+=n[0]}else t.childNodes?y=t.childNodes[0]:(y=Ut.utils.createTextNode(qt.zeroWidthSpace),t.appendChild(y));return{ancestor:g,container:y,offset:1===y.nodeType&&1===w?y.childNodes.length:w}}#St(t){return t&&"string"!=typeof t&&3!==t.nodeType&&this.#X.format.isTextStyleNode(t)&&!!t.style.fontSize}#Et(t,e,s){return!s||t?null:Ut.query.getParentElement(s,this._isNonSplitNode.bind(this))||(e?null:Ut.query.getParentElement(s,this.#St.bind(this)))}#Tt(t,e,s){if(!s||t||1!==s.nodeType)return!1;const i=this._isNonSplitNode(s);return Ut.query.getParentElement(s,this._isNonSplitNode.bind(this))?i:i||!e&&this.#St(s)}#Lt(t,e){if(!Ut.check.isListCell(t))return;const s=Ut.utils.arrayFilter((e||t).childNodes,(t=>!Ut.check.isBreak(t)));if(e=s[0],!Ut.check.isElement(e)||s.length>1)return;const i=e.style,n=t.style,o=e.nodeName.toLowerCase();let l=!1;this.#it.get("_defaultStyleTagMap")[o]===this.#it.get("_defaultTagCommand").bold.toLowerCase()&&(n.fontWeight="bold"),this.#it.get("_defaultStyleTagMap")[o]===this.#it.get("_defaultTagCommand").italic.toLowerCase()&&(n.fontStyle="italic");const r=Wt.getValues(i);if(r.length>0)for(let t=0,e=this.#$t.length;t<e;t++)r.includes(this.#kt[t])&&(n[this.#$t[t]]=i[this.#$t[t]],i.removeProperty(this.#kt[t]),l=!0);if(this.#Lt(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);Ut.utils.removeItem(e)}}#Mt(t,e){if(!Ut.check.isListCell(t))return;e||=this.#kt;const s=Ut.utils.arrayFilter(t.childNodes,(t=>!Ut.check.isBreak(t))),i=t.style,n=[],o=[],l=Wt.getValues(i);for(let t=0,s=this.#kt.length;t<s;t++)l.includes(this.#kt[t])&&e.includes(this.#kt[t])&&(n.push(this.#$t[t]),o.push(this.#kt[t]));if(0===n.length)return;const r=Ut.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.#it.get("_defaultStyleTagMap")[e.nodeName.toLowerCase()]||(i=Wt.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 Fe(t){const e=t.parentNode;let s,i,n,o,l,r=e.parentNode,a=e;for(;Ut.check.isListCell(r);){for(o=Ut.query.getPositionIndex(t),s=r.nextElementSibling,i=r.parentNode,n=a;n;){if(a=a.nextSibling,Ut.check.isList(n)){for(l=n.childNodes;l[o];)i.insertBefore(l[o],s);0===l.length&&Ut.utils.removeItem(n)}else i.appendChild(n);n=a}r=i.parentNode}return 0===e.children.length&&Ut.utils.removeItem(e),i}const Pe=class{#X;#t;constructor(t){this.#X=t.$,this.#t=t.store}apply(t,e,s){const i=(t.split(":")[0]||"ol").toUpperCase(),n=t.split(":")[1]||"";let o=this.#X.selection.getRange(),l=e||this.#X.format.getLinesAndComponents(!1);if(0===l.length){if(e)return;if(o=this.#X.selection.getRangeAndAddLine(o,null),l=this.#X.format.getLinesAndComponents(!1),0===l.length)return}Ut.query.sortNodeByDepth(l,!0);const r=l[0],a=l.at(-1);let h=!Ut.check.isListCell(r)&&!this.#X.component.is(r)||r.previousElementSibling?r.previousElementSibling:r.parentElement.previousElementSibling,c=!Ut.check.isListCell(a)&&!this.#X.component.is(a)||a.nextElementSibling?a.nextElementSibling:a.parentElement.nextElementSibling;const d=o.collapsed,u={sc:o.startContainer,so:o.startContainer===o.endContainer&&Ut.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(!Ut.check.isList(this.#X.format.getBlock(l[t],(e=>this.#X.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&&!Ut.check.isWysiwygFrame(t)&&t.nodeName===i?t:h,c=e&&!Ut.check.isWysiwygFrame(e)&&e.nodeName===i?e:c;const s=h?.tagName===i,o=c?.tagName===i;let r=s?h:Ut.utils.createElement(i,{style:"list-style-type: "+n}),a=null,d=null;const u=t=>!Ut.check.isComponentContainer(t)&&!Ut.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.#X.inline._isIgnoreNodeChange(e)){if(h=l[v+1],c=e.parentNode,p=h?h.parentNode:null,o=Ut.check.isListCell(e),f=this.#X.format.isBlock(c)?c:null,g=o&&!Ut.check.isWysiwygFrame(c)?c.parentNode:c,m=o&&!Ut.check.isWysiwygFrame(c)?!h||Ut.check.isListCell(g)?c:c.nextSibling:e.nextSibling,t=Ut.utils.createElement("LI"),this.#X.component.is(e)){const s=/^HR$/i.test(e.nodeName);s||(t.innerHTML="<br>"),t.innerHTML+=e.outerHTML,s&&(t.innerHTML+="<br>")}else{Ut.utils.copyFormatAttributes(t,e);const s=e.childNodes;for(;s[0];)t.appendChild(s[0])}r.appendChild(t),h&&g===p&&!this.#X.format.isBlock(m)||(a||=r,s&&h&&g===p||h&&Ut.check.isList(p)&&p===c||r.parentNode!==g&&g.insertBefore(r,m)),Ut.utils.removeItem(e),s&&null===d&&(d=r.children.length-1),h&&(this.#X.format.getBlock(p,u)!==this.#X.format.getBlock(c,u)||Ut.check.isList(p)&&Ut.check.isList(c)&&Ut.query.getNodeDepth(p)!==Ut.query.getNodeDepth(c))&&(r=Ut.utils.createElement(i,{style:"list-style-type: "+n})),0===f?.children.length&&Ut.utils.removeItem(f)}else Ut.utils.removeItem(e);d&&(a=a.children[d]),o&&(r.innerHTML+=c.innerHTML,Ut.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.#X.format.getBlock(r),e=t?.tagName===i;let o,a;const h=t=>!Ut.check.isComponentContainer(t);e||(a=Ut.utils.createElement(i,{style:"list-style-type: "+n}));for(let t,r,c=0,d=l.length;c<d;c++)r=this.#X.format.getBlock(l[c],h),r&&Ut.check.isList(r)&&(t?t!==r?(s&&Ut.check.isListCell(r.parentNode)?this.#It(o.f):p=this.#X.format.removeBlock(o.f[0].parentElement,{selectedFormats:o.f,newBlockElement:a,shouldDelete:!1,skipHistory:!0}),r=l[c].parentNode,e||(a=Ut.utils.createElement(i,{style:"list-style-type: "+n})),t=r,o={r:t,f:[Ut.query.getParentElement(l[c],"LI")]}):o.f.push(Ut.query.getParentElement(l[c],"LI")):(t=r,o={r:t,f:[Ut.query.getParentElement(l[c],"LI")]}),c===d-1&&(s&&Ut.check.isListCell(r.parentNode)?this.#It(o.f):p=this.#X.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=>!Ut.check.isComponentContainer(t);for(let a,h,c,d,u=0,p=t.length;u<p;u++){if(c=u===p-1,h=this.#X.format.getBlock(t[u],r),d=Ut.check.isList(h),!a&&d)a=h,s={r:a,f:[Ut.query.getParentElement(t[u],"LI")]},0===u&&(i=!0);else if(a&&d)if(a!==h){const r=this.#X.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:[Ut.query.getParentElement(t[u],"LI")]},c&&(n=!0)):a=null}else s.f.push(Ut.query.getParentElement(t[u],"LI")),c&&(n=!0);if(c&&Ut.check.isList(a)){const t=this.#X.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.#X.format.getLines().filter((function(t){return Ut.check.isListCell(t)}))).length;if(0===s||!e&&!Ut.check.isListCell(t[0].previousElementSibling)&&!Ut.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&&Ut.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=Ut.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.#X.selection.getRange();for(let n,o=0,h=s;o<h;o++)n=t[o],n.parentElement!==i&&(this.#Vt(i,e,l,r,a),i=n.parentElement,e=Ut.utils.createElement(i.nodeName)),l=n.previousElementSibling,r=n.nextElementSibling,e.appendChild(n);if(this.#Vt(i,e,l,r,a),s>1){const t=Ut.query.getNodeFromPath(a.s,a.sl),e=Ut.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=Fe(t);let i,n,o;if(s){i=s.cloneNode(!1),n=s.childNodes;const e=Ut.query.getPositionIndex(t);for(;n[e];)i.appendChild(n[e])}else i=t;if(e)o=Ut.query.getListChildren(i,(t=>Ut.check.isListCell(t)&&!t.previousElementSibling),null);else{const e=Ut.query.getNodeDepth(t)+2;o=Ut.query.getListChildren(t,(t=>Ut.check.isListCell(t)&&!t.previousElementSibling&&Ut.query.getNodeDepth(t)===e),null)}for(let t=0,e=o.length;t<e;t++)Fe(o[t]);return s&&(s.parentNode.insertBefore(i,s.nextSibling),0===n?.length&&Ut.utils.removeItem(s)),i===t?i.parentNode:i}#Vt(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){Ut.check.isListCell(s)&&(t=s,i=null),t.insertBefore(e,i),n.s||(n.s=Ut.query.getNodePath(e.firstElementChild.firstChild,t,null),n.sl=t);const o=t.contains(n.sl)?Ut.query.getNodePath(n.sl,t):null;n.e=Ut.query.getNodePath(e.lastElementChild.firstChild,t,null),n.el=t,this.#X.nodeTransform.mergeSameTags(t,[n.s,n.e,o],!1),this.#X.nodeTransform.mergeNestedTags(t),o&&(n.sl=Ut.query.getNodeFromPath(o,t))}return e}#It(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=Ut.query.getPositionIndex(i);for(;e[o];)t.appendChild(e[o]);s.appendChild(t)}0===n.children.length&&Ut.utils.removeItem(n),this.#X.nodeTransform.mergeSameTags(l);const r=Ut.query.getEdgeChildNodes(e,s);return{cc:e.parentNode,sc:r.sc,ec:r.ec}}},{_d:De}=Dt;const qe=/^<[a-z0-9]+:[a-z0-9]+/i,We=/(?!<)[a-zA-Z0-9-]+/,Ue=/\s(?:on[a-z]+)\s*=\s*(?:(["'])[^"']*\1|\S+)/gi,Ze=/style=/i,Ge=/style\s*=\s*(?:"|')[^"']*(?:"|')/,je=/^\s/,Ke=/<[^\s]+\s(.+)/,Ye=/\ssize="([^"]+)"/i,Xe=/\sface="([^"]+)"/i,Je=/\scolor="([^"]+)"/i,Qe=/&quot;/g,ts=/([a-zA-Z0-9-]+)(:)([^"']+)/,es=/inherit|initial|revert|unset/i,ss=/"/g,is=/:\s*([^;]+)/,ns=/rgba\(([0-9]+\s*,\s*){3}0\)|windowtext/i,os=/[^;]+;/g,ls=/^span$/i,rs=/^(?:https?|ftps?|mailto|tel|blob|sms|geo|webcal|callto):|^[#/]|^data:image\//i,as=/^(?:href|src)\s*=/i,hs=/=\s*(?:"([^"]*)"|'([^']*)'|(\S+))/,cs=/:/i;function ds(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 rs.test(e)||!cs.test(e)}function us(t){if(!as.test(t))return!0;const e=t.match(hs);if(!e)return!0;return ds(e[1]??e[2]??e[3]??"")}function ps(t,e){return t?"*"===t?"[a-z-]+":e?t+"|"+e:t:"^"}const gs=class{#X;#t;#K;#J;#it;#ht;#Ot;#Rt;#zt;#Ft;#Pt;#Dt;#qt;#Wt;#Ut;#Zt;#Gt;#jt;#Kt;#Yt;#Xt;#Jt;#Qt;#te;#ee;constructor(t){this.#X=t.$,this.#t=t.store;const e=this.#it=this.#X.options;this.#J=this.#X.frameOptions,this.#K=this.#X.frameContext,this.#ht=this.#X.instanceCheck,this.#Rt=function(t){return this.test(t)?t:""}.bind(e.get("allowedClassName")),this.#Kt=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,o={...i,line:e.get("_lineStylesRegExp")};this.#Kt.forEach((t=>{o[t]=e.get("_textStylesRegExp")}));for(const t in o)n.set(new RegExp(`^(${t})$`),o[t]);this.#Gt=new RegExp(`^(${Object.keys(o).join("|")})$`,"i"),this.#jt=n,this.#Ot=new RegExp("\\d+("+e.get("fontSizeUnits").join("|")+")$","i");const l=e.get("_allowedExtraTag"),r=e.get("_disallowedExtraTag");this.#Yt=new RegExp(`<(${r})[^>]*>([\\s\\S]*?)<\\/\\1>|<(${r})[^>]*\\/?>`,"gi"),this.#Xt=new RegExp(`^(${r})$`,"i"),this.#Jt=new RegExp(`^(${l})$`,"i");const a=Object.keys(e.get("_defaultStyleTagMap")),h=e.get("elementWhitelist")?e.get("elementWhitelist").split("|").filter((t=>/b|i|ins|s|strike/i.test(t))):[];for(let t=0;t<h.length;t++)a.splice(a.indexOf(h[t].toLowerCase()),1);this.#Ft=0===a.length?null:new RegExp("(<\\/?)("+a.join("|")+")\\b\\s*([^>^<]+)?\\s*(?=>)","gi");const c=e.get("__defaultAttributeWhitelist");this.#zt=e.get("_editorElementWhitelist").includes("//")||"*"===e.get("_editorElementWhitelist"),this.#Pt=new RegExp("^("+ps(e.get("_editorElementWhitelist").replace("|//",""),"")+")$","i"),this.#Dt=new RegExp("^("+(e.get("elementBlacklist")||"^")+")$","i"),this.#qt=Wt.createElementWhitelist(ps(e.get("_editorElementWhitelist").replace("|//","|\x3c!--|--\x3e"),"")),this.#Wt=Wt.createElementBlacklist(e.get("elementBlacklist").replace("|//","|\x3c!--|--\x3e"));const d='\\s*=\\s*(")[^"]*\\1',u=e.get("attributeWhitelist");let p={},g="";if(u)for(const t in u)/^on[a-z]+$/i.test(u[t])||("*"===t?g=ps(u[t],c):p[t]=new RegExp("\\s(?:"+ps(u[t],c)+")"+d,"ig"));this.#Ut=new RegExp("\\s(?:"+(g||c)+"|data-se-[^\\s]+"+(e.get("v2Migration")?"|data-index|data-file-size|data-file-name|data-exp|data-font-size":"")+")"+d,"ig"),this.#Qt=p;const m=e.get("attributeBlacklist");if(p={},g="",m)for(const t in m)"*"===t?g=ps(m[t],""):p[t]=new RegExp("\\s(?:"+ps(m[t],"")+")"+d,"ig");this.#Zt=new RegExp("\\s(?:"+(g||"^")+")"+d,"ig"),this.#te=p,this.__resetAutoStyleify(e.get("autoStyleify"))}filter(t,{tagWhitelist:e,tagBlacklist:s,validate:i,validateAll:n}){if(e&&(t=t.replace(Wt.createElementWhitelist(e),"")),s&&(t=t.replace(Wt.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.#ht.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.#it.get("strictMode");let d="";if(t=this.compress(t),o&&(t=t.replace(this.#Yt,""),t=this.#se(t,this.#qt,this.#Wt).replace(/<br\/?>$/i,"")),this.#ee){const e=(new DOMParser).parseFromString(t,"text/html");Ut.query.getListChildNodes(e.body,Wt.spanToStyleNode.bind(null,this.#ee),null),t=e.body.innerHTML}(h||c)&&(t=t.replace(/(<[a-zA-Z0-9-]+)[^>]*(?=>)/g,this.#ie.bind(this,h,c)));const u=De.createRange().createContextualFragment(t);if(o)try{this.#ne(u,this.#Pt,this.#Dt,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=Ut.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||ds(String(i)))&&e.setAttribute(t,i);p[t].replaceWith(e)}if(this.#X.pluginManager.applyRetainFormat(u),l){let t=u.childNodes;e||=this.#oe(t),e&&(t=this.#le(u).childNodes);for(let s,i=0,n=t.length;i<n;i++)s=t[i],this.#Jt.test(s.nodeName)?d+=s.outerHTML:d+=this.#re(s,e)}return d||=t,o&&(s&&(d=d.replace("string"==typeof s?Wt.createElementWhitelist(s):s,"")),i&&(d=d.replace("string"==typeof i?Wt.createElementBlacklist(i):i,""))),a&&(d=this.#ae(d)),d}insert(t,{selectInserted:e,skipCharCount:s,skipCleaning:i}={}){this.#K.get("wysiwyg").contains(this.#X.selection.get().focusNode)||this.#X.focusManager.focus(),this.remove(),this.#X.focusManager.focus();let n=null;if("string"==typeof t){i||(t=this.clean(t,{forceFormat:!1,whitelist:null,blacklist:null}));try{if(Ut.check.isListCell(this.#X.format.getLine(this.#X.selection.getNode(),null))){const e=De.createRange().createContextualFragment(t).childNodes;this.#oe(e)&&(t=this.#he(e))}const i=De.createRange().createContextualFragment(t).childNodes;if(!s){const t="byte-html"===this.#J.get("charCounter_type")?"outerHTML":"textContent";let e="";for(let s=0,n=i.length;s<n;s++)e+=i[s][t];if(!this.#X.char.check(e))return}let o,l,r,a,h;for(;o=i[0];)3===a?.nodeType&&1===l?.nodeType&&Ut.check.isBreak(o)?(a=o,Ut.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.#X.selection.setRange(h.container||h,h.startOffset||0,l,c):this.#X.component.is(l)||this.#X.selection.setRange(l,c,l,c)}catch(t){if(this.#K.get("isReadOnly")||this.#K.get("isDisabled"))return;throw Error(`[SUNEDITOR.html.insert.error] ${t.message}`)}}else if(this.#X.component.is(t))this.#X.component.insert(t,{skipCharCount:s,insertBehavior:"none"});else{let e=null;(this.#X.format.isLine(t)||Ut.check.isMedia(t))&&(e=this.#X.format.getLine(this.#X.selection.getNode(),null)),this.insertNode(t,{afterNode:e,skipCharCount:s})}if(this.#t.set("_lastSelectionNode",null),n){const t=Ut.query.getListChildNodes(n,null,null);if(t.length>0){n=t.at(-1);const e=3===n?.nodeType?n.textContent.length:1;this.#X.selection.setRange(n,e,n,e)}else this.#X.focusManager.focus()}else this.#X.focusManager.focus();this.#X.history.push(!1)}insertNode(t,{afterNode:e,skipCharCount:s}={}){let i=null;if(this.#K.get("isReadOnly")||!s&&!this.#X.char.check(t))return i;let n=null,o=null;if(e){const t=this.#X.format.isLine(e)||this.#X.format.isBlock(e)||this.#X.component.is(e)?this.#X.format.addLine(e,null):e;o=this.#X.selection.setRange(t,1,t,1)}else o=this.#X.selection.getRange();let l,r,a,h=Ut.check.isListCell(o.commonAncestorContainer)?o.commonAncestorContainer:this.#X.format.getLine(this.#X.selection.getNode(),null),c=Ut.check.isListCell(h)&&(Ut.check.isListCell(t)||Ut.check.isList(t)),d=null;const u=this.#X.format.isBrLine(h),p=this.#X.format.isLine(t)||this.#X.format.isBlock(t)||this.#X.component.isBasic(t);if(c&&(a=e||Ut.check.isList(t)?h.lastChild:h.nextElementSibling,d=Ut.check.isList(t)?h:(a||h).parentNode),!e&&(p||this.#X.component.isBasic(t)||Ut.check.isMedia(t))){const t=Ut.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&&Ut.check.isListCell(i)&&!h.parentElement)h=Ut.utils.createElement("LI"),d.appendChild(h),i.appendChild(d),a=null;else if(3===i.nodeType||Ut.check.isBreak(i)||c){const n=Ut.query.getParentElement(i,(t=>this.#X.format.isBlock(t)||Ut.check.isListCell(t)));if(e=this.#X.nodeTransform.split(i,s.offset,n?Ut.query.getNodeDepth(n)+1:0))if(c){if(h.contains(i)){const s=Ut.check.isList(h.lastElementChild);let i=null;t||(i=h.cloneNode(!1),i.appendChild(e.textContent.trim()?e:Ut.utils.createTextNode(qt.zeroWidthSpace))),s&&(i||(i=h.cloneNode(!1),i.appendChild(Ut.utils.createTextNode(qt.zeroWidthSpace))),i.appendChild(h.lastElementChild)),i&&(h.parentNode.insertBefore(i,h.nextElementSibling),a=e=i)}}else e=e.previousSibling;else Ut.check.isListCell(h)||(a=e=h)}}o=e||p?this.#X.selection.getRange():this.#X.selection.getRangeAndAddLine(this.#X.selection.getRange(),null);const g=o.commonAncestorContainer,m=o.startOffset,f=o.endOffset,v=o.startContainer===g&&this.#X.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(Ut.check.isBreak(l))e=l,l=l.parentNode;else{const s=l.childNodes[m],i=3===s?.nodeType&&Ut.check.isZeroWidth(s)&&Ut.check.isBreak(s.nextSibling)?s.nextSibling:s;i?!i.nextSibling&&Ut.check.isBreak(i)?(l.removeChild(i),e=null):e=Ut.check.isBreak(i)&&!Ut.check.isBreak(t)?i:i.nextSibling:e=null}else{if(b===y){e=Ut.check.isEdgePoint(y,f)?y.nextSibling:y.splitText(f);let t=b;Ut.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.#X.format.isLine(i)?i.innerHTML="<br>":this.#X.format.isBlock(i)&&(i.innerHTML="<"+this.#it.get("defaultLine")+"><br></"+this.#it.get("defaultLine")+">")),Ut.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 Ut.check.isWysiwygFrame(i)&&!this.#X.format.isLine(t)?(l=i.appendChild(Ut.utils.createElement(this.#it.get("defaultLine"))),e=null):l=(e=p?y:i===n?i.nextSibling:i)&&e.parentNode?e.parentNode:g;for(;e&&!this.#X.format.isLine(e)&&e.parentNode!==g;)e=e.parentNode}}try{const s=this.#K.get("wysiwyg");if(!c){if((Ut.check.isWysiwygFrame(e)||l===s.parentNode)&&(l=s,e=null),this.#X.format.isLine(t)||this.#X.format.isBlock(t)||!Ut.check.isListCell(l)&&this.#X.component.isBasic(t)){const t=l;if(Ut.check.isListCell(e))l=e.previousElementSibling||e;else if(!r&&!e){const t=this.remove(),s=3===t.container.nodeType?Ut.check.isListCell(this.#X.format.getLine(t.container,null))?t.container:this.#X.format.getLine(t.container,null)||t.container.parentNode:t.container,i=Ut.check.isWysiwygFrame(s)||this.#X.format.isBlock(s);l=i?s:s.parentNode,e=i?null:s.nextSibling}0===t.childNodes.length&&l!==t&&Ut.utils.removeItem(t)}if(!p||u||this.#X.format.isBlock(l)||Ut.check.isListCell(l)||Ut.check.isWysiwygFrame(l)||(e=l.nextElementSibling,l=l.parentNode),Ut.check.isWysiwygFrame(l)&&(3===t.nodeType||Ut.check.isBreak(t))){const e=Ut.utils.createElement(this.#it.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,Ut.check.isListCell(t)&&!Ut.check.isList(l)){if(Ut.check.isListCell(l))e=l.nextElementSibling,l=l.parentNode;else{const t=Ut.utils.createElement("ol");l.insertBefore(t,e),l=t,e=null}c=!0}if(this.#ce(t,l),l.insertBefore(t,e),c)if(Ut.check.isZeroWidth(h.textContent.trim()))Ut.utils.removeItem(h),t=t.lastChild;else{const e=Ut.utils.arrayFind(h.children,Ut.check.isList);e&&(t!==e?(t.appendChild(e),t=e.previousSibling):(l.appendChild(t),t=l),Ut.check.isZeroWidth(h.textContent.trim())&&Ut.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),Ut.utils.removeItem(s)}if((this.#X.format.isLine(t)||this.#X.component.isBasic(t))&&b===y){const t=this.#X.format.getLine(g,null);1===t?.nodeType&&Ut.check.isEmptyLine(t)&&Ut.utils.removeItem(t)}if(u&&!Ut.check.isList(t)&&(this.#X.format.isLine(t)||this.#X.format.isBlock(t))&&(t=this.#de(t)),!this.#X.component.isBasic(t)){let e=1;if(3===t.nodeType)e=t.textContent.length,this.#X.selection.setRange(t,e,t,e);else if(!Ut.check.isBreak(t)&&!Ut.check.isListCell(t)&&this.#X.format.isLine(l)){let s=null;t.previousSibling&&!Ut.check.isBreak(t.previousSibling)||(s=Ut.utils.createTextNode(qt.zeroWidthSpace),t.parentNode.insertBefore(s,t)),t.nextSibling&&!Ut.check.isBreak(t.nextSibling)||(s=Ut.utils.createTextNode(qt.zeroWidthSpace),t.parentNode.insertBefore(s,t.nextSibling)),this.#X.inline._isIgnoreNodeChange(t)&&(t=t.nextSibling,e=0),this.#X.selection.setRange(t,e,t,e)}}i=t}return i}remove(){this.#X.selection.resetRangeToTextNode();const t=this.#X.selection.getRange(),e=0===t.startOffset,s=Ut.check.isEdgePoint(t.endContainer,t.endOffset,"end");let i=null,n=null,o=null;e&&(n=this.#X.format.getLine(t.startContainer),i=n?n.previousElementSibling:null,n=n?i:n),s&&(o=this.#X.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(Ut.check.isWysiwygFrame(a)&&Ut.check.isWysiwygFrame(h)){this.set("");return{container:this.#X.selection.getNode(),offset:0,commonCon:u}}if(u===a&&u===h){if(this.#X.component.isBasic(u)){const t=this.#X.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 Ut.utils.removeItem(t),this.#X.format.isLine(e)?0===e.childNodes.length?(Ut.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=Ut.query.getNextDeepestNode(u,this.#K.get("wysiwyg")),e=Ut.query.getPreviousDeepestNode(u,this.#K.get("wysiwyg")),s=this.#X.format.getLine(u);Ut.utils.removeItem(u);let i=t||e,n=t?0:3===i?.nodeType?i.textContent.length:1;const o=this.#X.format.getLine(i)||this.#X.component.get(i);return s!==o&&(i=o,n=0===n?0:1),Ut.check.isZeroWidth(s)&&!s.contains(i)&&Ut.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&&Ut.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=Ut.query.getListChildNodes(u,null,null);let f=Ut.utils.getArrayIndex(m,a),v=Ut.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.#X.format.isLine(u)||this.#X.format.isBlock(u)||Ut.check.isWysiwygFrame(u)||Ut.check.isBreak(u)||Ut.check.isMedia(u))return{container:u,offset:0,commonCon:u};if(Ut.check.isText(u))return{container:u,offset:d,commonCon:u};m.push(u),a=h=u}else if(a=h=m[0],Ut.check.isBreak(a)||Ut.check.isZeroWidth(a))return{container:Ut.check.isMedia(u)?u:a,offset:0,commonCon:u};f=v=0}const b=Ut.check.isText,y=Ut.check.isElement,w=f===v;let C=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)C=this.#ue(e,w);else{if(b(h))g=Ut.utils.createTextNode(h.substringData(d,h.length-d));else{if(this.#X.component.is(h))continue;g=Ut.utils.createTextNode(h.textContent)}g.length>0?h.data=g.data:C=this.#ue(h,w)}else{if(y(a)){if(this.#X.component.is(a))continue;p=Ut.utils.createTextNode(a.textContent)}else{const t=a,s=h;e===h?(p=Ut.utils.createTextNode(t.substringData(0,c)+s.substringData(d,s.length-d)),r=c):p=Ut.utils.createTextNode(t.substringData(0,c))}if(p.length>0?a.data=p.data:C=this.#ue(a,w),e===h)break}else C=this.#ue(e,w)}const _=Ut.query.getParentElement(h,"ul"),x=Ut.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(Ut.utils.createElement("BR")),r=1):r=l.textContent.length:r=0)),this.#X.format.getLine(l)||a&&a.parentNode||(o?(l=o,r=0):n&&(l=n,r=1)),!Ut.check.isWysiwygFrame(l)&&0===l.childNodes.length){const t=this.#X.nodeTransform.removeAllParents(l,null,null);t&&(l=t.sc||t.ec||this.#K.get("wysiwyg"))}return l&&(1!==l.nodeType||this.#X.format.isLine(l)||Ut.check.isBreak(l))||(l=C?.sc||C?.ec,r=3===l?.nodeType?l.textContent.length:1),this.#X.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.#X.facade.changeFrameContext(s[o]);const l=Ut.utils.createElement("DIV",null,this._convertToCode(this.#K.get("wysiwyg"),!0)),r=Ut.check.isTableCell,a=Ut.check.isEmptyLine,h=[],c=[];Ut.query.getListChildren(l,(t=>{t.hasAttribute("contenteditable")&&h.push(t);const e=t.parentElement;return r(e)&&e.children.length<=1&&a(t)&&c.push(e),!1}),null);for(let t=0,e=h.length;t<e;t++)h[t].removeAttribute("contenteditable");for(let t=0,e=c.length;t<e;t++)c[t].innerHTML="<br>";this.#pe(l);const d=l.innerHTML;if(this.#J.get("iframe_fullPage"))if(e){const t=Ut.utils.getAttributesToString(this.#K.get("_wd").body,["contenteditable"]);i=`<!DOCTYPE html><html>${this.#K.get("_wd").head.outerHTML}<body ${t}>${d}</body></html>`}else i=d;else i=t?`<div class="${this.#it.get("_editableClass")+""+(this.#it.get("_rtl")?" se-rtl":"")}">${d}</div>`:l.innerHTML;n[s[o]]=i}return this.#X.facade.changeFrameContext(i),s.length>1?n:n[s[0]]}set(t,{rootKey:e}={}){this.#X.ui.offCurrentController(),this.#X.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.#X.facade.changeFrameContext(e[t]),this.#K.get("isMarkdownView")){const t=Wt.htmlToJson(s);this.#K.get("markdown").value=Kt.jsonToMarkdown(t)}else if(this.#K.get("isCodeView")){const t=this._convertToCode(s,!1);this.#X.viewer._setCodeView(t)}else this.#K.get("wysiwyg").innerHTML=s,this.#X.pluginManager.resetFileInfo(),this.#X.history.push(!1,e[t])}add(t,{rootKey:e}={}){this.#X.ui.offCurrentController(),e?Array.isArray(e)||(e=[e]):e=[this.#t.get("rootKey")];for(let s=0;s<e.length;s++){this.#X.facade.changeFrameContext(e[s]);const i=this.clean(t,{forceFormat:!0,whitelist:null,blacklist:null});if(this.#K.get("isMarkdownView")){const t=Wt.htmlToJson(i);this.#K.get("markdown").value+="\n"+Kt.jsonToMarkdown(t)}else if(this.#K.get("isCodeView"))this.#X.viewer._setCodeView(this.#X.viewer._getCodeView()+"\n"+this._convertToCode(i,!1));else{const t=Ut.utils.createElement("DIV",null,i),n=Array.from(t.children);for(let t=0,e=n.length;t<e;t++)this.#K.get("wysiwyg").appendChild(n[t]);this.#X.history.push(!1,e[s]),this.#X.selection.scrollTo(n.at(-1))}}}getJson({withFrame:t,rootKey:e}={}){return Wt.htmlToJson(this.get({withFrame:t,rootKey:e}))}setJson(t,{rootKey:e}={}){this.set(Wt.jsonToHtml(t),{rootKey:e})}async copy(t){try{return!("string"!=typeof t&&!Ut.check.isElement(t)&&!Ut.check.isText(t))&&(!1===await jt.write(t)?(this.#X.ui.showToast(this.#X.lang.message_copy_fail,this.#it.get("toastMessageTime").copy,"error"),!1):(this.#X.ui.showToast(this.#X.lang.message_copy_success,this.#it.get("toastMessageTime").copy),!0))}catch(t){return console.error("[SUNEDITOR.html.copy.fail] :",t),this.#X.ui.showToast(this.#X.lang.message_copy_fail,this.#it.get("toastMessageTime").copy,"error"),!1}}setFullPage(t,{rootKey:e}={}){if(!this.#J.get("iframe"))return!1;e?Array.isArray(e)||(e=[e]):e=[this.#t.get("rootKey")];for(let s=0;s<e.length;s++)this.#X.facade.changeFrameContext(e[s]),t.head&&(this.#K.get("_wd").head.innerHTML=t.head.replace(this.#Yt,"")),t.body&&(this.#K.get("_wd").body.innerHTML=this.clean(t.body,{forceFormat:!0,whitelist:null,blacklist:null})),this.#X.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?De.createRange().createContextualFragment(t):t,l=t=>this.#X.format.isLine(t)||this.#X.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:Ut.check.isList(u.parentElement)||(s+=Wt.htmlToEntity(/^\n+$/.test(u.data)?"":u.data)):s+="\n\x3c!-- "+u.textContent.trim()+" --\x3e"+p}(o,""),s.trim()+r}#ue(t,e){const s=this.#X.format.getLine(t,null);if(Ut.utils.removeItem(t),!Ut.check.isListCell(s)||e)return;const i=this.#X.nodeTransform.removeAllParents(s,null,null);return Ut.check.isList(s?.firstChild)&&s.insertBefore(Ut.utils.createTextNode(qt.zeroWidthSpace),s.firstChild),i?{sc:i.sc,ec:i.ec}:null}#de(t){const e=t.parentNode;let s,i;for(;this.#X.format.isLine(t)||this.#X.format.isBlock(t);){for(s=t.childNodes,i=null;s[0];)if(i=s[0],this.#X.format.isLine(i)||this.#X.format.isBlock(i)){if(this.#de(i),!t.parentNode)break;s=t.childNodes}else e.insertBefore(i,t);0===t.childNodes.length&&Ut.utils.removeItem(t),t=Ut.utils.createElement("BR"),e.insertBefore(t,i.nextSibling)}return t}#re(t,e){const s=this.#it.get("defaultLine");if(1===t.nodeType){if(this.#Xt.test(t.nodeName))return"";if(Ut.check.isExcludeFormat(t))return t.outerHTML;const i=Ut.query.getListChildNodes(t,(t=>Ut.check.isSpanWithoutAttr(t)&&!Ut.query.getParentElement(t,Ut.check.isExcludeFormat)),null)||[];for(let t,e=i.length-1;e>=0;e--)t=i[e],t.outerHTML=t.innerHTML;if(!e||this.#X.format.isLine(t)||this.#X.format.isBlock(t)||this.#X.component.is(t)||Ut.check.isMedia(t)||Ut.check.isFigure(t)||Ut.check.isAnchor(t)&&Ut.check.isMedia(t.firstElementChild)){const e=t;return Ut.check.isSpanWithoutAttr(t)?e.innerHTML:e.outerHTML}{const e=t;return"<"+s+">"+(Ut.check.isSpanWithoutAttr(t)?e.innerHTML:e.outerHTML)+"</"+s+">"}}if(3===t.nodeType){if(!e)return Wt.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+">"+Wt.htmlToEntity(t)+"</"+s+">");return n}return 8===t.nodeType&&this.#zt?"\x3c!--"+t.textContent.trim()+"--\x3e":""}#ne(t,e,s,i,n,o,l){const r=[],a=[],h=[],c=[],d=Ut.query.getListChildNodes(t,(d=>{if(1!==d.nodeType)return n&&Ut.check.isList(d.parentElement)&&r.push(d),3!==d.nodeType||d.textContent.trim()||r.push(d),!1;if(i&&(s.test(d.nodeName)||!e.test(d.nodeName)&&0===d.childNodes.length&&Ut.check.isExcludeFormat(d)))return r.push(d),!1;"PRE"===d.nodeName&&this.#ge(d);const u=!Ut.query.getParentElement(d,Ut.check.isExcludeFormat);if(n){if(!Ut.check.isTableElements(d)&&!Ut.check.isListCell(d)&&!Ut.check.isAnchor(d)&&(this.#X.format.isLine(d)||this.#X.format.isBlock(d)||this.#X.format.isTextStyleNode(d))&&0===d.childNodes.length&&u)return a.push(d),!1;if(Ut.check.isList(d.parentNode)&&!Ut.check.isList(d)&&!Ut.check.isListCell(d))return h.push(d),!1;if(Ut.check.isTableCell(d)){const t=d.firstElementChild;if(!this.#X.format.isLine(t)&&!this.#X.format.isBlock(t)&&!this.#X.component.is(t))return c.push(d),!1}}if(o&&u&&d.className){const t=Array.from(d.classList).map(this.#Rt).join(" ").trim();t?d.className=t:d.removeAttribute("class")}if(!n)return!1;return!l&&d.parentNode!==t&&u&&(Ut.check.isListCell(d)&&!Ut.check.isList(d.parentNode)||(this.#X.format.isLine(d)||this.#X.component.is(d))&&!this.#X.format.isBlock(d.parentNode)&&!Ut.query.getParentElement(d,this.#X.component.is.bind(this.#X.component)))}),null);for(let t=0,e=r.length;t<e;t++)Ut.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(Ut.query.getParentElement(t,Ut.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],Ut.check.isZeroWidth(t.textContent.trim())&&Ut.utils.removeItem(t);for(let t=0,e=a.length;t<e;t++)Ut.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=Ut.utils.createElement("LI"),this.#X.format.isLine(t)){for(s=t.childNodes;s[0];)e.appendChild(s[0]);i.insertBefore(e,t),Ut.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++)t=c[s],e=Ut.utils.createElement("DIV"),e.innerHTML=0===t.textContent.trim().length&&0===t.children.length?"<br>":t.innerHTML,t.innerHTML=e.outerHTML}#ae(t){if(!this.#Ft)return t;const e=this.#it.get("_defaultStyleTagMap");return t.replace(this.#Ft,((t,s,i,n)=>s+("string"==typeof e[i]?e[i]:i)+(n?" "+n:"")))}#le(t){let e,s="";const i=t.childNodes;for(let t,n=0,o=i.length;n<o;n++)t=i[n],this.#Jt.test(t.nodeName)?s+=t.outerHTML:8===t.nodeType?s+="\x3c!-- "+t.textContent+" --\x3e":/meta/i.test(t.nodeName)||this.#X.format.isLine(t)||this.#X.format.isBlock(t)||this.#X.component.is(t)||Ut.check.isExcludeFormat(t)?(e&&(s+=e.outerHTML,e=null),s+=t.outerHTML):(e||=Ut.utils.createElement(this.#it.get("defaultLine")),this.#X.format.isTextStyleNode(t)&&t.removeAttribute("style"),e.appendChild(t),n--,o--);return e&&(s+=e.outerHTML),De.createRange().createContextualFragment(s)}#he(t){let e="";for(let s,i=0,n=t.length;i<n;i++)s=t[i],1===s.nodeType?Ut.check.isList(s)?e+=s.innerHTML:Ut.check.isListCell(s)?e+=s.outerHTML:this.#X.format.isLine(s)?e+="<li>"+(s.innerHTML.trim()||"<br>")+"</li>":this.#X.format.isBlock(s)&&!Ut.check.isTableElements(s)?e+=this.#he(s.children):e+="<li>"+s.outerHTML+"</li>":e+="<li>"+(s.textContent||"<br>")+"</li>";return e}#oe(t){let e=!1;for(let s,i=0,n=t.length;i<n;i++)if(s=t[i],1===s.nodeType&&!this.#X.format.isTextStyleNode(s)&&!Ut.check.isBreak(s)&&!this.#Xt.test(s.nodeName)){e=!0;break}return e}#me(t,e,s){let i=(t.match(Ge)||[])[0];if(this.#Kt.includes(s)&&!i&&(t.match(Ke)||[])[1]){const e=(t.match(Ye)||[])[1],s=(t.match(Xe)||[])[1],n=(t.match(Je)||[])[1];(e||s||n)&&(i='style="'+(e?"font-size:"+Zt.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.#jt)if(e.test(s)){t=i;break}if(!t)return e;const n=i.replace(Qe,"").match(t);if(!n)return e;const o=[];for(let t,e=0,s=n.length;e<s;e++)if(t=n[e].match(ts),t&&!es.test(t[3])){const e=Wt.kebabToCamelCase(t[1].trim()),s=this.#K.get("wwComputedStyle")[e]?.replace(ss,""),i=t[3].trim();switch(e){case"fontFamily":if(!this.#X.plugins.font||!this.#X.plugins.font.fontArray.includes(i))continue;break;case"fontSize":if(!this.#X.plugins.fontSize)continue;this.#Ot.test(t[0])||(t[0]=t[0].replace((t[0].match(is)||[])[1],Wt.toFontUnit.bind(null,this.#it.get("fontSizeUnits")[0])));break;case"color":if(!this.#X.plugins.fontColor||ns.test(i))continue;break;case"backgroundColor":if(!this.#X.plugins.backgroundColor||ns.test(i))continue}s!==i&&o.push(t[0])}o.length>0&&e.push('style="'+o.join(";")+'"')}return e}#se(t,e,s){return e.test("<font>")&&(t=t.replace(/(<\/?)font(\s?)/gi,"$1span$2")),t.replace(e,"").replace(s,"")}#ce(t,e){const s=t=>{this.#fe(t,e);const i=t.childNodes;for(let t=0,e=i.length;t<e;t++)s(i[t])};s(t)}#fe(t,e){if(!this.#X.format.isTextStyleNode(t))return;const s=(t.style.cssText.match(os)||[]).map((function(t){return t.trim()})),i=t.nodeName;if(ls.test(i)&&0===s.length)return t;const n=this.#X.format;let o=!1;return function e(l){if(!Ut.check.isWysiwygFrame(l)&&n.isTextStyleNode(l)){if(l.nodeName===i){o=!0;const e=l.style.cssText.match(os)||[];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}#ie(t,e,s,i){if(qe.test(s))return s;let n=null;const o=i.match(We)[0].toLowerCase();if(t){const t=this.#te[o];s=s.replace(Ue,""),s=t?s.replace(t,""):s.replace(this.#Zt,"");const e=this.#Qt[o];n=e?s.match(e):s.match(this.#Ut)}if(!e)return s;if("a"===o){const t=s.match(/(?:(?:id|name)\s*=\s*(?:"|')[^"']*(?:"|'))/g);t&&(n||=[],n.push(t[0]))}else n&&Ze.test(n.toString())||(this.#Kt.includes(o)?n=this.#me(s,n,o):this.#X.format.isLine(o)?n=this.#me(s,n,"line"):this.#Gt.test(o)&&(n=this.#me(s,n,o)));if(Ut.check.isMedia(o)||Ut.check.isFigure(o)){const t=s.match(Ge);n||=[],t&&n.push(t[0])}if(n)for(let t,e=0,s=n.length;e<s;e++)t=us(n[e].trim())?n[e]:"",i+=(je.test(t)?"":" ")+t;return i}__resetAutoStyleify(t){if(t.length>0){const e=this.#it.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.#ee=s}else this.#ee=null}_destroy(){this.#jt&&this.#jt.clear()}#ge(t){if(1!==t.children.length||"CODE"!==t.firstElementChild?.nodeName)return;const e=t.firstElementChild,s=(e.className||"").match(/language-(\S+)/);for(s&&(Ut.utils.addClass(t,"language-"+s[1]),t.setAttribute("data-se-lang",s[1]));e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}#pe(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=Ut.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 ms=class{#X;#it;constructor(t){this.#X=t.$,this.#it=this.#X.options}split(t,e,s){if(Ut.check.isWysiwygFrame(t)||this.#X.component.is(t)||!t)return t;if(e&&!Zt.is(e)){const s=t.childNodes;let i=Ut.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),Ut.check.isText(t)){if(r=Ut.query.getPositionIndex(t),(e=Number(e))>=0&&t.length!==e){t.splitText(e);const s=Ut.query.getNodeFromPath([r+1],i);Ut.check.isZeroWidth(s)&&(s.data=qt.zeroWidthSpace)}}else if(1===t.nodeType){if(0===e){for(;t.firstChild;)t=t.firstChild;if(3===t.nodeType){const e=Ut.utils.createTextNode(qt.zeroWidthSpace);t.parentNode.insertBefore(e,t),t=e}}t.previousSibling?t=t.previousSibling:Ut.query.getNodeDepth(t)===s&&(h=!1)}1===t.nodeType&&(a=0);let c=t;for(;Ut.query.getNodeDepth(c)>s;)for(r=Ut.query.getPositionIndex(c)+a,c=c.parentNode,l=n,n=c.cloneNode(!1),o=c.childNodes,l&&(Ut.check.isListCell(n)&&Ut.check.isList(l)&&l.firstElementChild?(n.innerHTML=l.firstElementChild.innerHTML,Ut.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,Ut.check.isList),n.childNodes.length>0?d.insertBefore(n,c):n=c,Ut.check.isListCell(n)&&n.children&&Ut.check.isList(n.children[0])&&n.insertBefore(Ut.utils.createElement("BR"),n.children[0]),0===i.childNodes.length&&Ut.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(!(Ut.check.isBreak(h)||Ut.check.isMedia(h)||Ut.check.isInputElement(h)))if(s&&this.#X.inline._isIgnoreNodeChange(h)||!s&&(Ut.check.isTableElements(h)||Ut.check.isListCell(h)||this.#X.format.isLine(h)&&!this.#X.format.isBrLine(h)))(Ut.check.isTableElements(h)||Ut.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(Ut.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)}}Ut.utils.copyTagAttributes(h,t),t.parentNode.insertBefore(h,t),Ut.utils.removeItem(t)}if(!c){1===h.nodeType&&o(h,l+1,d);break}if(h.nodeName===c.nodeName&&Ut.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;Ut.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.#X.component.is(t))return!1;const e=t.textContent.trim();return 0===e.length||/^(\n|\u200B)+$/.test(e)},function t(s){if(!Ut.check.isWysiwygFrame(s)){const n=s.parentNode;n&&e(s)&&(i={sc:s.previousElementSibling,ec:s.nextElementSibling},Ut.utils.removeItem(s),t(n))}}(t),i}removeEmptyNode(t,e,s){const i=this.#it.get("allowedEmptyTags");e&&=Ut.query.getParentElement(e,(e=>t===e.parentElement));const n=s=>{if(this.#X.format._isNotTextNode(s)||s===e||Ut.check.isNonEditable(s))return 0;if(s===t||!Ut.check.isZeroWidth(s.textContent)||s.firstChild&&Ut.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.#X.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?Ut.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 fs(t){t&&!it(t,"se-blink")&&(nt(t,"se-blink"),o.setTimeout((()=>{ot(t,"se-blink")}),600))}const vs=class{#X;#K;#J;constructor(t){this.#X=t.$,this.#K=this.#X.frameContext,this.#J=this.#X.frameOptions}check(t){const e=this.#J.get("charCounter_max");if(e){const s=this.getLength("string"==typeof t?t:"byte-html"===this.#J.get("charCounter_type")&&1===t.nodeType?t.outerHTML:t.textContent);if(s>0&&s+this.getLength()>e)return fs(this.#K.get("charWrapper")),!1}return!0}getLength(t){return"string"!=typeof t&&(t="byte-html"===this.#J.get("charCounter_type")?this.#K.get("wysiwyg").innerHTML:this.#K.get("wysiwyg").textContent),/byte/.test(this.#J.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)}display(t){const e=(t||this.#K).get("charCounter");e&&o.setTimeout((()=>{e.textContent=String(this.getLength())}),0)}test(t,e){let s=0;t&&(s=this.getLength(t)),this.display();const i=this.#J.get("charCounter_max");if(i>0){let t=!1;const n=this.getLength();if(n>i){if(t=!0,s>0&&e){this.#X.selection.init();const t=this.#X.selection.getRange(),e=t.endOffset-1,s=this.#X.selection.getNode().textContent,i=t.endOffset-1;this.#X.selection.getNode().textContent=s.slice(0,i<0?0:i)+s.slice(t.endOffset,s.length),this.#X.selection.setRange(t.endContainer,e,t.endContainer,e)}}else n+s>i&&(t=!0);if(t&&(fs(this.#K.get("charWrapper")),s>0))return!1}return!0}};const bs=class{#X;#it;#ve=!1;constructor(t){this.#X=t.$,this.#it=this.#X.options,this.keyMap=new Map,this.reverseKeys=new Set}command(t,e,s,i,n,o,l,r){if(this.#ve)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&&!Gt.isSpace(i)||a.enter&&!Gt.isEnter(i)||a.textTrigger&&!t.key.trim()||a.edge&&!o)&&(a.plugin&&"string"==typeof a.method?this.#X.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.#X.commandDispatcher.run(a.command,a.type,a.button),!0)}disable(){this.#ve=!0}enable(){this.#ve=!1}_registerShortcuts(){const t=this.#it.get("shortcuts"),e=this.#it.get("_reverseCommandArray"),s=this.keyMap=new Map,i=this.reverseKeys;for(const n of Object.keys(t)){re(n.startsWith("_")?"":n,null,t[n],s,e,i)}}_destroy(){this.keyMap.clear(),this.reverseKeys.clear()}},ys=new Map([["__figureInst",null],["__dragInst",null],["__dragHandler",null],["__dragContainer",null],["__dragCover",null],["__dragMove",null],["__overInfo",null]]),ws=ys,{_w:Cs,isMobile:_s,ON_OVER_COMPONENT:xs}=Dt,$s="2147483646",ks="2147483645",Ss="2147483642",Es="2147483641",Ts={left:0,right:0,top:0};const Ms=class{#X;#be;#ye;#we=Ts;#Ce=!1;#_e=!1;#xe=null;#$e=null;#ke=null;#Se=[];#Ee=new Map;constructor(t,e,s,i,n){this.#X=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.#be="function"==typeof i.initMethod?i.initMethod:null,this.#ye={keydown:this.#Te.bind(this),mousedown:this.#Me.bind(this)};for(const t of this.parents)Ut.check.isElement(t)?this.parentsForm.push(t):(t.#Se.push(this),this.parentsForm.push(t.form));this.#X.contextProvider.carrierWrapper.appendChild(s),this.#X.eventManager.addEvent(s,"click",this.#He.bind(this)),this.#X.eventManager.addEvent(s,"mouseenter",this.#Le.bind(this)),this.#X.eventManager.addEvent(s,"mouseleave",this.#Ne.bind(this))}open(t,e,{isWWTarget:s,passive:i,initMethod:n,disabled:o,addOffset:l}={}){if(ys.get("__overInfo")===xs&&(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.#Ee.clear(),i||(this.#X.store.mode.isBalloon?this.#X.toolbar.hide():this.#X.store.mode.isSubBalloon&&this.#X.subToolbar.hide(),this.#X.store.get("hasFocus")||(o??this.disabled?this.#X.ui.setControllerOnDisabledButtons(!0):this.#X.ui.setControllerOnDisabledButtons(!1))),this.currentPositionTarget=e||t,this.isWWTarget=s??this.isWWTarget,"function"==typeof n&&(this.#be=n),i||(this.#X.ui.currentControllerName=this.kind),this.#we={left:0,right:0,top:0,...l},!i){const t=this.isOutsideForm?this.parentsForm:[];this.#X.ui.opendControllers?.forEach((e=>{t.includes(e.form)||(e.form.style.zIndex=Es)})),this.parentsHide&&this.parentsForm.forEach((t=>{t.style.display="none",t.setAttribute("data-se-hidden-by-children","1")}))}this.#Be(),this.#Ae(this.form,this.currentPositionTarget,!1);const r=this.#X.instanceCheck.isRange(t);this.currentTarget=r?null:t,this.#Ie(this.form,t,r,i),Cs.setTimeout((()=>ys.set("__overInfo",!1)),0)}close(t){(t||this.isOpen&&!this.#_e)&&(this.form.removeAttribute("data-se-hidden-by-parent"),this.form.removeAttribute("data-se-hidden-by-children"),this.#Ee.clear(),this.#Ve("close"),this.toTop=!1,this.isOpen=!1,this.#_e=!1,this.__offset={},this.#we=Ts,this.#Oe(),this.#be?.(),this.#Re(),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.#X.component.deselect())}hide(){this.#Ve("hide"),this.form.style.display="none"}show(){this.#Ae(this.form,this.currentPositionTarget,!1)}bringToTop(t){this.toTop=t,this.form.style.zIndex=t?$s:ks}resetPosition(t){this.#Ae(this.form,t||this.currentPositionTarget,!0)}_scrollReposition(){this.form.hasAttribute("data-se-hidden-by-parent")||this.form.hasAttribute("data-se-hidden-by-children")||this.#Ae(this.form,this.currentPositionTarget,!1)&&Cs.setTimeout((()=>{this.#Ve("show")}),0)}#Ve(t){for(const e of this.#Se)if("hide"===t&&"none"!==e.form.style.display){const t=this.#ze(e);e.#Ee.set(this,!0);const s=this.#ze(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.#Ve("show");continue}const t=this.#ze(e);e.#Ee.set(this,!1);const s=this.#ze(e);t&&!s&&(e.form.removeAttribute("data-se-hidden-by-parent"),e.show())}else e[t]?.(!0)}#ze(t){for(const e of t.#Ee.values())if(!0===e)return!0;return!1}async#Ie(t,e,s,i){const n={position:this.position,inst:this,form:t,target:e,isRangeTarget:s,notInCarrier:!this.#X.contextProvider.carrierWrapper.contains(t)};!1!==await this.#X.eventManager.triggerEvent("onBeforeShowController",{caller:this.kind,frameContext:this.#X.frameContext,info:n})&&(t.style.display="block",this.#X.contextProvider.shadowRoot&&(this.#xe=this.#X.eventManager.addEvent(t,"mousedown",(t=>t.stopPropagation()))),i||(this.#X.ui.onControllerContext(),this.#X.store.set("controlActive",!0)),this.isOpen||this.#X.ui.opendControllers.push(n),this.#X.store.set("_preventBlur",!0),this.isOpen=!0,this.host.controllerOn?.(t,e),this.#X.eventManager.triggerEvent("onShowController",{caller:this.kind,frameContext:this.#X.frameContext,info:n}))}#Re(){this.form.style.display="none",this.#X.ui.opendControllers=this.#X.ui.opendControllers.filter((t=>t.form!==this.form)),this.#X.ui.currentControllerName!==this.kind&&this.#X.ui.opendControllers.length>0||(this.#X.ui.setControllerOnDisabledButtons(!1),this.#X.ui.offControllerContext(),this.#X.frameContext.get("lineBreaker_t").style.display=this.#X.frameContext.get("lineBreaker_b").style.display="none",this.#X.store.set("_lastSelectionNode",null),this.#X.ui.currentControllerName="",this.#X.store.set("_preventBlur",!1),Cs.setTimeout((()=>{this.#X.store.set("controlActive",!1)}),0),this.#xe&&=this.#X.eventManager.removeEvent(this.#xe))}#Ae(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.#X.selection.isRange(e)){if(!this.#X.offset.setRangePosition(this.form,e,{position:"bottom"}))return this.hide(),!1}else{const i=this.#X.offset.setAbsPosition(t,e,{addOffset:this.#we,position:this.position,isWWTarget:this.isWWTarget,inst:this,sibling:this.sibling});if(!i)return this.hide(),!1;if(s||!this.sibling||this.siblingMain)this.#Ce=!1;else{const e=t.offsetTop-this.#we.top;"bottom"===i.position?(this.#Ce=!0,t.style.top=e+this.sibling.offsetHeight-1+"px"):(this.#Ce=!1,t.style.top=e-this.sibling.offsetHeight+2+"px")}}return t.style.zIndex=this.toTop?ks:this.#Ce?Ss:Es,t.style.visibility="",!0}#Be(){this.#Oe(),this.#$e=this.#X.eventManager.addGlobalEvent("keydown",this.#ye.keydown,!0),this.#ke=this.#X.eventManager.addGlobalEvent(_s?"click":"mousedown",this.#ye.mousedown,!0)}#Oe(){this.#X.component.__removeGlobalEvent(),this.#$e&&=this.#X.eventManager.removeGlobalEvent(this.#$e),this.#ke&&=this.#X.eventManager.removeGlobalEvent(this.#ke)}#Fe(){if(this.#X.ui.selectMenuOn)return!0;const t=this.#X.ui.opendControllers;for(let e=0;e<t.length;e++)if(t[e].inst===this&&t[e].fixed)return!0;return!1}#Pe(t){if(Ut.check.isWysiwygFrame(t)||t.contains(this.form))return!1;if(Ut.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&&(!!Ut.query.getParentElement(t,".se-controller")||(this.#X.component.isInline(s)?t===s:t?.contains(s)))}#He(t){const e=Ut.query.getEventTarget(t),s=Ut.query.getCommandTarget(e);s&&(t.stopPropagation(),t.preventDefault(),"close"!==s.getAttribute("data-command")?this.host.controllerAction(s):this.close())}#Le(t){if(this.#X.ui.currentControllerName=this.kind,this.parentsForm.length>0&&this.isInsideForm)return;Ut.query.getEventTarget(t).style.zIndex=this.toTop?$s:ks}#Ne(t){if(this.parentsForm.length>0&&this.isInsideForm)return;Ut.query.getEventTarget(t).style.zIndex=this.toTop?ks:this.#Ce?Ss:Es}#Te(t){if(this.#Fe())return;const e=t.code;if(Gt.isCtrl(t)||!Gt.isNonResponseKey(e))return;const s=Ut.query.getEventTarget(t);if(Gt.isEsc(e)){if(this.#Se.some((({isOpen:t})=>t)))return}else{if(this.form.contains(s)||this.#Pe(s))return;if(this.#X.pluginManager.fileInfo.pluginRegExp.test(this.kind))return}this.#De(s),this.close()}#Me(t){const e=Ut.query.getEventTarget(t);this.host?._element?.contains(e)?this.#_e=!0:(this.#_e=!1,e===this.host._element||e===this.currentTarget||this.#Fe()||this.form.contains(e)||this.#Pe(e)||Ut.query.getParentElement(e,".se-line-breaker-component")||(this.#De(e),this.close(!0)))}#De(t){this.#X.frameContext.get("wysiwyg").contains(t)||(this.#X.component.__prevent=!1)}},{_w:Hs}=Dt;const Ls=class{#X;#qe;#We;#Ue;#Ze;#ye;#Ge=null;#je=null;#Ke=null;#$e=null;#Ye=null;#Xe=null;#tt=null;constructor(t,e){this.#X=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.maxHeight=e.maxHeight||"",this.minWidth=e.minWidth||"",this.#qe=/^(left|right)$/.test(this.position)?"left"===this.position?"right":"left":this.position,this.#We=/^(left|right)$/.test(this.subPosition)?"left"===this.subPosition?"right":"left":this.subPosition,this.#Ue="ltr"!==e.dir&&("rtl"===e.dir||null),this.#Ze={mousedown:this.#Je.bind(this),mousemove:this.#Qe.bind(this),click:this.#ts.bind(this),keydown:this.#es.bind(this)},this.#ye={keydown:this.#ss.bind(this),mousedown:this.#Me.bind(this),click:this.#is.bind(this)}}create(t,e){this.form.firstElementChild.innerHTML="",e||=t;let s="";for(let t=0,i=e.length;t<i;t++)t>0&&t%this.splitNum==0&&(this.#ns(s),s=""),s+=`<li class="se-select-item" data-index="${t}">${"string"==typeof e[t]?e[t]:e[t].outerHTML}</li>`;this.#ns(s),this.items=t,this.menus=Array.from(this.form.querySelectorAll("li")),this.menuLen=this.menus.length}on(t,e,s={}){this.#Ge=t,this.#je=Ut.check.isInputElement(t)?t:this.#X.frameContext.get("_ww"),this.#Ke=e;let i="";this.maxHeight&&(i+="max-height:"+this.maxHeight+";overflow-y:auto;"),this.minWidth&&(i+="min-width:"+this.minWidth+";"),this.form=Ut.utils.createElement("DIV",{class:"se-select-menu"+(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.#X.ui.selectMenuOn=!0,this.openMethod?.(),this.#os(),this.#Be();const s=t?t.split("-"):[],i=s[0]||(null!==this.#Ue&&this.#Ue!==this.#X.options.get("_rtl")?this.#qe:this.position),n=s[1]||(null!==this.#Ue&&this.#Ue!==this.#X.options.get("_rtl")?this.#We:this.subPosition);this.#ls(i,n,e),this.isOpen=!0}close(){this.#X.ui.selectMenuOn=!1,Ut.utils.removeClass(this.#Ge,"on"),this.#rs(),this.form?.removeAttribute("style"),this.isOpen=!1,this.closeMethod?.()}getItem(t){return this.items[t]}setItem(t){this.#as(t)}#ns(t){this.form.firstElementChild.innerHTML+=`<ul class="se-list-basic se-list-checked${this.horizontal?" se-list-horizontal":""}">${t}</ul>`}#rs(){this.#hs(),this.#Oe(),this.index=-1,this.item=null,this._onItem&&(Ut.utils.removeClass(this._onItem,"se-select-on"),this._onItem=null)}#cs(t){t=this.index+t;const e=this.menuLen,s=this.index=t>=e?0:t<0?e-1:t;this.#as(s)}#as(t){Ut.utils.removeClass(this.form,"se-select-menu-mouse-move");const e=this.menuLen;for(let s=0;s<e;s++)s===t?Ut.utils.addClass(this.menus[s],"active"):Ut.utils.removeClass(this.menus[s],"active");this.index=t,this.item=this.items[t]}#ls(t,e,s,i){const n=t,o=this.form,l=this.#Ge;o.style.visibility="hidden",o.style.display="block",Ut.utils.removeClass(o,"se-select-menu-scroll"),Ut.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.#X.offset.get(l),g=l.offsetTop,m=p.top,f=l.offsetHeight,v=Ut.utils.getClientSize().h-(m-Hs.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.#X.offset.getGlobal(o).top;const i=t-(m-s)-v-f;i>0&&(u-=i+4,o.style.top=u+"px"),s=this.#X.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.#ls("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";const w=this.#X.offset.getGlobal(o).left;let C=0;switch(c+"-"+(c?n:e)){case"true-left":C=p.left-Hs.scrollX+w,C<0&&(d=d=h+a+1);break;case"true-right":C=Hs.innerWidth-(w+r),C<0&&(d=h-r-1);break;case"false-center":{C=Hs.innerWidth-(w+r),C<0&&(d+=C-4),o.style.left=d+"px";const t=this.#X.offset.getGlobal(o).left;t<0&&(d-=t-4);break}case"false-left":C=Hs.innerWidth-(p.left-Hs.scrollX+r),C<0&&(d+=C-4);break;case"false-right":w<0&&(d-=w-4)}if(s){const t=o.firstElementChild.querySelector(s);t&&(this._onItem=t,Ut.utils.addClass(t,"se-select-on"))}o.style.left=d+"px",o.style.top=u+"px",o.style.visibility=""}#ds(t){this.checkList&&Ut.utils.toggleClass(this.menus[t],"se-checked"),this.#Ke(this.getItem(t))}#os(){this.#hs(),this.#tt={mousedown:this.#X.eventManager.addEvent(this.form,"mousedown",this.#Ze.mousedown),mousemove:this.#X.eventManager.addEvent(this.form,"mousemove",this.#Ze.mousemove),click:this.#X.eventManager.addEvent(this.form,"click",this.#Ze.click),keydown:this.#X.eventManager.addEvent(this.#je,"keydown",this.#Ze.keydown)}}#hs(){this.#tt&&(this.#X.eventManager.removeEvent(this.#tt.mousedown),this.#X.eventManager.removeEvent(this.#tt.mousemove),this.#X.eventManager.removeEvent(this.#tt.click),this.#X.eventManager.removeEvent(this.#tt.keydown),this.#tt=null)}#Be(){this.#Oe(),this.#$e=this.#X.eventManager.addGlobalEvent("keydown",this.#ye.keydown,!0),this.#Ye=this.#X.eventManager.addGlobalEvent("mousedown",this.#ye.mousedown,!0)}#Oe(){this.#$e&&=this.#X.eventManager.removeGlobalEvent(this.#$e),this.#Ye&&=this.#X.eventManager.removeGlobalEvent(this.#Ye),this.#Xe&&=this.#X.eventManager.removeGlobalEvent(this.#Xe)}#es(t){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":t.preventDefault(),t.stopPropagation(),e=1;break;case"Enter":case"Space":this.index>-1?(t.preventDefault(),t.stopPropagation(),this.#ds(this.index)):this.close()}e&&this.#cs(e)}#Je(t){if(Dt.isGecko){const e=Ut.query.getEventTarget(t),s=Ut.query.getParentElement(e,".se-select-item");s&&this.#X.eventManager._injectActiveEvent(s)}}#Qe(t){const e=Ut.query.getEventTarget(t);Ut.utils.addClass(this.form,"se-select-menu-mouse-move");const s=e.getAttribute("data-index");s&&(this.index=Number(s))}#ts(t){let e=Ut.query.getEventTarget(t),s=null;for(;!s&&!/UL/i.test(e.tagName)&&!Ut.utils.hasClass(e,"se-select-menu");)s=e.getAttribute("data-index"),e=e.parentElement;s&&this.#ds(Number(s))}#ss(t){Gt.isEsc(t.code)&&this.close()}#Me(t){const e=Ut.query.getEventTarget(t);this.form.contains(e)||(this.#Ge.contains(e)?Ut.check.isInputElement(e)||(this.#Xe=this.#X.eventManager.addGlobalEvent("click",this.#ye.click,!0)):this.close())}#is(t){this.#Xe=this.#X.eventManager.removeGlobalEvent(this.#Xe),t.target===this.#Ge&&(t.stopPropagation(),this.close())}},{_w:Ns,ON_OVER_COMPONENT:Bs}=Dt,As={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 Is=!1,Vs=!1,Os=0,Rs=0;class zs{#X;#us;#ps;#gs="";#ms="";#fs=0;#vs=0;#bs=0;#ys=0;#ws="__se__float-none|__se__float-left|__se__float-center|__se__float-right";#Cs=!1;#_s={w:"",h:""};#xs=null;constructor(t,e,s,i){this.#X=e,this.kind=t.constructor.key||t.constructor.name,this._alignIcons={none:this.#X.icons.format_float_none,left:this.#X.icons.format_float_left,right:this.#X.icons.format_float_right,center:this.#X.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=Ds(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?Ut.utils.createElement("DIV",{class:"se-controller se-controller-resizing"},i):null}(this,e,s||[]);if(this.controller=n?new Ms(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 Ls(e,{checkList:!1,position:"bottom-center"}),this.selectMenu_align.on(this.alignButton,this.#$s.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 Ls(e,{checkList:!1,position:"bottom-center"}),this.selectMenu_as.on(this.asButton,this.#ks.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=Zt.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 Ls(e,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.selectMenu_resize.on(this.resizeButton,this.#Ss.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.#Es.bind(this),this.__containerResizing=this.#Ts.bind(this),this.__onContainerEvent=null,this.__offContainerEvent=null,this.#us=this.#Ms.bind(this),this.#ps=this.#Hs.bind(this),this.#X.eventManager.addEvent(this.alignButton,"click",this.#Ls.bind(this)),this.#X.eventManager.addEvent(this.asButton,"click",this.#Ns.bind(this)),this.#X.eventManager.addEvent(this.resizeButton,"click",this.#Bs.bind(this)),this.#X.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 Ut.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.#X.eventManager.addEvent(s,"mousedown",this.#As.bind(this))}}))}static CreateContainer(t,e){return Ut.utils.createElement("DIV",{class:"se-component"+(e?" "+e:"")},Ut.utils.createElement("FIGURE",null,t)),zs.GetContainer(t)}static CreateInlineContainer(t,e){return Ut.utils.createElement("SPAN",{class:"se-component se-inline-component"+(e?" "+e:"")},t),zs.GetContainer(t)}static CreateCaption(t,e){const s=Ut.utils.createElement("FIGCAPTION",null,"<div>"+e+"</div>");return t.appendChild(s),s}static GetContainer(t){const e=Ut.query.getParentElement(t,"FIGURE",2),s=Ut.query.getParentElement(t,"SPAN",2),i=e||s,n=Ut.query.getParentElement(t,(t=>t.parentElement===i),0)||t;return{target:n,container:Ut.query.getParentElement(n,zs.is,3)||e,cover:e,inlineCover:Ut.utils.hasClass(s,"se-inline-component")?s:null,caption:Ut.query.getEdgeChild(n.parentElement,"FIGCAPTION",!1),isVertical:Ps(n)}}static GetRatio(t,e,s){let i=0,n=0;if(/\d+/.test(t+"")&&/\d+/.test(e+"")){if((!Zt.is(t)&&String(t).replace(/\d+|\./g,"")||s||"px")===(!Zt.is(e)&&String(e).replace(/\d+|\./g,"")||s||"px")){const s=Zt.get(t,4),o=Zt.get(e,4);i=s/o,n=o/s}}return{w:Zt.get(i,4),h:Zt.get(n,4)}}static CalcRatio(t,e,s,i){if(i?.w&&i?.h&&/\d+/.test(t+"")&&/\d+/.test(e+"")){const n=!Zt.is(t)&&String(t).replace(/\d+|\./g,"")||s||"px",o=!Zt.is(e)&&String(e).replace(/\d+|\./g,"")||s||"px";if(n===o){const s="%"===n?2:0,l=t,r=e;e=Zt.get(i.h*Zt.get(l,s),s)+o,t=Zt.get(i.w*Zt.get(r,s),s)+n}}return{w:t,h:e}}static is(t){return Ut.check.isComponentContainer(t)||/^(HR)$/.test(t?.nodeName)}close(){this.#X.store.set("_preventBlur",!1),Ut.utils.removeClass(this._cover,"se-figure-selected"),this.#X.component.__removeDragEvent(),this.#Is(),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.');ys.get("__overInfo")===Bs&&(i=!0);const l=zs.GetContainer(t),r=l.target;let a=!1;if(!l.container){if(this.#X.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}ys.set("__figureInst",this),this.#Vs(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.#X.offset.getLocal(h),f=(r.getAttribute("data-se-size")||"").split(",");let v=Zt.get(r.style.width,2)||c,b=Zt.get(r.style.height,2)||d;this.isVertical&&([v,b]=[b,v]);const y=zs.GetRatio(v,b,this.sizeUnit),w={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.#gs=w.width,this.#ms=w.height,o)return w;const C=this.#X.frameContext.get("_figure");this.#X.ui.setFigureContainer(C.main),this.#X.ui.opendControllers=this.#X.ui.opendControllers.filter((t=>t.form!==C.main)),C.main.style.top=u+"px",C.main.style.left=p+"px",C.main.style.width=(this.isVertical?d:c)+"px",C.main.style.height=(this.isVertical?c:d)+"px",C.border.style.top="0px",C.border.style.left="0px",C.border.style.width=(this.isVertical?d:c)+"px",C.border.style.height=(this.isVertical?c:d)+"px",this.__offset={left:p+g,top:u+m},this.#X.ui.opendControllers.push({position:"none",form:C.main,target:h,inst:this,notInCarrier:!0});const _=/%$/.test(r.style.width)&&/%$/.test(l.container.style.width)?Zt.get(l.container.style.width,0)/100+"":"";for(let t=0,e=this.percentageButtons.length;t<e;t++)this.percentageButtons[t].getAttribute("data-value")===_?Ut.utils.addClass(this.percentageButtons[t],"active"):Ut.utils.removeClass(this.percentageButtons[t],"active");if(this.captionButton&&(l.caption?Ut.utils.addClass(this.captionButton,"active"):Ut.utils.removeClass(this.captionButton,"active")),C.display.style.display=s||this._inlineCover?"none":"",C.border.style.display=i?"none":"",C.main.style.display="block",ys.get("__overInfo")!==Bs){const t=e?"none":"flex",s=C.handles;for(let e=0,i=s.length;e<i;e++)s[e].style.display=t;if(this.controller){const t=this.getSize(r);Ut.utils.changeTxt(C.display,this.#X.lang["none"===this.align?"basic":this.align]+" ("+t.dw+", "+t.dh+")"),this.#Os(),this.#Rs(),this.#X.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":"")}Ut.utils.removeClass(this._cover,"se-figure-over-selected"),this.controller?.open(C.main,null,{initMethod:this.#us,isWWTarget:!1,addOffset:null}),Ns.setTimeout((()=>ys.set("__overInfo",!1)),0)}else Ut.utils.addClass(this._cover,"se-figure-over-selected");return Ut.utils.addClass(this._cover,"se-figure-selected"),this.#bs=this.#fs=c,this.#ys=this.#vs=d,this._inlineCover||ys.get("__overInfo")===Bs&&!Ut.utils.hasClass(l.container,"se-input-component")||this.#zs(C.main),w}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=Ps(t);let s="",i="",n="",o="";if(!t)return{w:s,h:i,dw:n,dh:o};const l=zs.GetContainer(t),r=l.target;return l.container?(s=/%$/.test(r.style.width)?(l.container&&Zt.get(l.container.style.width,2)||100)+"%":r.style.width,i=l.inlineCover?l.inlineCover.style.height||t.style.height||String(t.height||""):Zt.get(l.cover?.style.paddingBottom,0)>0&&!e?l.cover?.style.height:/%$/.test(r.style.height)&&/%$/.test(r.style.width)?(l.container&&Zt.get(l.container.style.height,2)||100)+"%":r.style.height,s||="auto",i||="auto"):this.#X.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=zs.GetContainer(t);if(!s.cover)return;const i=s.target,n=s.container,o=s.cover;if(/%$/.test(i.style.width)&&"center"===e&&!this.#X.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%":""),Ut.utils.hasClass(n,"__se__float-"+e)||(Ut.utils.removeClass(n,this.#ws),Ut.utils.addClass(n,"__se__float-"+e)),this.autoRatio){const{w:t,h:e}=this.getSize(this._element);this.__setCoverPaddingBottom(t,e)}this.#Os()}convertAsFormat(t,e){t||=this._element,this.as=e||"block";const{container:s,inlineCover:i,target:n}=zs.GetContainer(t),{w:o,h:l}=this.getSize(n),r=n.cloneNode(!1);switch(r.style.width="",r.style.height="",r.removeAttribute("width"),r.removeAttribute("height"),e){case"inline":{if(i)break;this.#X.component.deselect();const t=s.nextElementSibling,e=s.parentElement,n=zs.CreateInlineContainer(r);Ut.utils.addClass(n.container,s.className.split(" ").filter((t=>"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this.#Fs(n,o,l);const a=Ut.utils.createElement(this.#X.options.get("defaultLine"),null,n.container);e.insertBefore(a,t),Ut.utils.removeItem(s);break}case"block":{if(!i)break;this.#X.component.deselect(),this.#X.selection.setRange(s,0,s,1);const t=this.#X.html.remove(),e=this.#X.nodeTransform.split(t.container,t.offset,0);e?.previousElementSibling&&Ut.check.isZeroWidth(e.previousElementSibling)&&Ut.utils.removeItem(e.previousElementSibling);const n=zs.CreateContainer(r);Ut.utils.addClass(n.container,s.className.split(" ").filter((t=>"se-inline-component"!==t&&"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this.#Fs(n,o,l),(e||t.container).parentElement.insertBefore(n.container,e);break}}return r}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=Fs(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)Ut.utils.removeItem(this._caption),Ns.setTimeout(this.#X.component.select.bind(this.#X.component,n,this.kind),0),this._caption=null;else{const t=zs.CreateCaption(this._cover,this.#X.lang.caption),e=Ut.query.getEdgeChild(t,(t=>3===t.nodeType),!1);e?this.#X.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.#X.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.#X.history.push(!1),/^remove|caption$/.test(e)||this.#X.component.select(n,this.kind))}}retainFigureFormat(t,e,s,i){const n=this.#X.component.isInline(t),o=e.parentNode;let l=this.#X.format.isBlock(o)||Ut.check.isWysiwygFrame(o)?e:zs.GetContainer(e)?.container||o||e;if(Ut.query.getParentElement(e,Ut.check.isExcludeFormat))l=s&&s!==e?s:e,l.parentNode.replaceChild(t,l);else if(n&&this.#X.format.isLine(l)){const s=n&&/^SPAN$/i.test(e.parentElement.nodeName)?e.parentElement:e;s.parentElement.replaceChild(t,s)}else if(Ut.check.isListCell(l)){const s=Ut.query.getParentElement(e,(t=>t.parentNode===l));l.insertBefore(t,s),Ut.utils.removeItem(e),this.#X.nodeTransform.removeEmptyNode(s,null,!0)}else if(this.#X.format.isLine(l)){const s=Ut.query.getParentElement(e,(t=>t.parentNode===l));l=this.#X.nodeTransform.split(l,s),l.parentNode.insertBefore(t,l),Ut.utils.removeItem(e),this.#X.nodeTransform.removeEmptyNode(l,null,!0)}else if(this.#X.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||Ut.check.isZeroWidth(l))&&Ut.utils.removeItem(l)}else l=Ut.check.isFigure(l.parentNode)?Ut.query.getParentElement(l.parentNode,zs.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.#Ps(e),this._applySize(s[0]||"auto",s[1]||"","")}setTransform(t,e,s,i){try{this.#Cs=!0;const n=Fs(t),o=n.r+1*(i||0);i=Math.abs(o)>=360?0:o;const l=this.isVertical=Ps(i);e=Zt.get(e,0),s=Zt.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=zs.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.#Ds(),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.#qs(r)}finally{this.#Cs=!1}}_displayResizeHandles(t){const e=t?"flex":"none";this.controller&&(this.controller.form.style.display=e);const s=this.#X.frameContext.get("_figure"),i=s.handles;for(let t=0,s=i.length;t<s;t++)i[t].style.display=e;"none"===e?(Ut.utils.addClass(s.main,"se-resize-ing"),this.#xs=this.#X.eventManager.addGlobalEvent("keydown",this.#ps)):Ut.utils.removeClass(s.main,"se-resize-ing")}#Fs(t,e,s){const i=this.kind;t.target.onload=()=>this.#X.component.select(t.target,i),this.#Vs(t),t.inlineCover&&(this.setAlign(t.target,"none"),this.deleteTransform()),this.setFigureSize(e,s)}#Vs(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=Ps(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=Zt.is(t)?t+this.sizeUnit:t,/%$/.test(t)||/%$/.test(e)||i||n||this.#Ds();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=Zt.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.#Ws()}__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)?Zt.get(Zt.get(e,2)/100*Zt.get(t,2),2)+"%":e:this._cover.style.paddingBottom=e)}_setAutoSize(){this._caption&&(this._caption.style.marginTop=""),this.deleteTransform(),this.#Ds(),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.#Ws()}_setPercentSize(t,e){e||=this.autoRatio?/%$/.test(this.autoRatio.current)?this.autoRatio.current:this.autoRatio.default:e,e=!e||/%$/.test(e+"")||Zt.get(e,0)?Zt.is(e)?e+this.sizeUnit:e||(this.autoRatio?this.autoRatio.default:""):Zt.is(e)?e+"%":e;const s=/%$/.test(e+"");this._container.style.width=String(Zt.is(t)?t+"%":t),this._container.style.height="",this._element!==this._cover||this.#X.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.#qs(this._element),this.#Ws()):this.#Ws()}#Ds(){this._cover&&(this._cover.style.width="",this._cover.style.height=""),this._container.style.width="",this._container.style.height="",Ut.utils.removeClass(this._container,this.#ws),Ut.utils.addClass(this._container,"__se__float-"+this.align),"center"===this.align&&this.setAlign(this._element,this.align)}_setRevert(){this.setFigureSize(this.#_s.w,this.#_s.h)}#Os(){this.alignButton&&Ut.utils.changeElement(this.alignButton.firstElementChild,this._alignIcons[this.align])}#Rs(){this.asButton&&Ut.utils.changeElement(this.asButton.firstElementChild,this.#X.icons[`as_${this.as}`])}#Ws(){if(this.#Cs)return;const t=(this._element.getAttribute("data-se-size")||",").split(",");this.#_s.w=t[0],this.#_s.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:"")}#qs(t){const e=Ut.query.getEdgeChild(Ut.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="")}#Ps(t){const e=Ut.query.getEdgeChild(Ut.query.getParentElement(t,"FIGURE"),"FIGCAPTION",!1);e&&(e.style.marginTop="")}#Us(){this.#X.component.__removeDragEvent(),this.#Is(),this._displayResizeHandles(!0),this.#X.ui.offCurrentController(),this.#X.ui.disableBackWrapper()}#Is(){this.#X.eventManager.removeGlobalEvent(this.__onContainerEvent),this.#X.eventManager.removeGlobalEvent(this.__offContainerEvent),this.#X.eventManager.removeGlobalEvent(this.#xs)}#zs(t){const e=this.#X.frameContext.get("wrapper").querySelector(".se-drag-handle");Ut.utils.removeClass(e,"se-drag-handle-full"),e.style.opacity="",e.style.width="",e.style.height="",ys.set("__dragHandler",e),ys.set("__dragContainer",this._container),ys.set("__dragCover",this._cover),ys.set("__dragMove",this.#Zs.bind(this,e,t)),ys.get("__dragMove")(),e.style.display="block"}#Zs(t,e){t.style.display="block",t.style.left=e.offsetLeft+(this.#X.options.get("_rtl")?t.offsetWidth:e.offsetWidth-1.5*t.offsetWidth)+"px",t.style.top=e.offsetTop-t.offsetHeight+.5+"px"}#As(t){t.stopPropagation(),t.preventDefault();const e=ys.get("__figureInst");if(!e)return;const s=Ut.query.getEventTarget(t),i=e._resize_direction=s.classList[0];e._resizeClientX=t.clientX,e._resizeClientY=t.clientY,this.#X.frameContext.get("_figure").main.style.float=/l/.test(i)?"right":/r/.test(i)?"left":"none",this.#X.ui.enableBackWrapper(As[i]);const{w:n,h:o,dw:l,dh:r}=this.getSize(e._element);if(Is=Vs=!1,Os=Rs=0,!this.isVertical){const t=!n||/auto|%$/.test(n),s=!o||/auto|%$/.test(o);if("tl|bl|tr|br".includes(i)&&t&&s?Is=!0:"lw|rw".includes(i)&&t&&(Vs=!0),Is||Vs){const t=e._cover||e._element;Rs=t.offsetWidth,Os=Wt.getWidthInPercentage(t,this.#X.frameContext.get("wysiwygFrame"))/100}}e.__onContainerEvent=this.#X.eventManager.addGlobalEvent("mousemove",e.__containerResizing),e.__offContainerEvent=this.#X.eventManager.addGlobalEvent("mouseup",e.__containerResizingOff),e._displayResizeHandles(!1);const a=this.#X.frameContext.get("_figure").display;a.style.display="block",Ut.utils.changeTxt(a,l+" * "+r)}#Ts(t){const e=this._resize_direction,s=t.clientX,i=t.clientY,n=this.isVertical;let o=n?this.#ys:this.#bs,l=n?this.#bs:this.#ys;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.#X.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.#gs:Math.round(o),u=!n&&/w$/.test(e)?this.#ms:Math.round(l),p=Os?d/Rs*Os*100:d;Ut.utils.changeTxt(this.#X.frameContext.get("_figure").display,Os?Zt.get(p>100?100:p,2).toFixed(2)+"%":p+" * "+u),this.#fs=d,this.#vs=u}#Es(){this.#Us();let t=this.isVertical?this.#vs:this.#fs,e=this.isVertical?this.#fs:this.#vs;if(t=Math.round(t)||t,e=Math.round(e)||e,!this.isVertical&&!/%$/.test(t+"")){const s=this.#X.frameContext.get("wysiwygFrame").clientWidth-Zt.get(this.#X.frameContext.get("wwComputedStyle").getPropertyValue("padding-left"))+Zt.get(this.#X.frameContext.get("wwComputedStyle").getPropertyValue("padding-right"))-2;Zt.get(t,0)>s&&(e=Math.round(e/t*s),t=s)}if(Is||Vs){t=t/(this._cover||this._element).offsetWidth*Os*100;const e=Zt.get(t>100?100:t,2)+"%";this._setPercentSize(e,Vs?this.getSize(this._element).h:"")}else this._applySize(t,e,this._resize_direction),this.isVertical&&this.setTransform(this._element,t,e,0);this.#X.history.push(!1),this.#X.component.select(this._element,this.kind)}#Hs(t){Gt.isEsc(t.code)&&(this.#Us(),this.#X.component.select(this._element,this.kind))}#$s(t){this.setAlign(this._element,t),this.selectMenu_align.close(),this.#X.component.select(this._element,this.kind)}#ks(t){this.convertAsFormat(this._element,t),this.selectMenu_as.close()}#Ss(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!==Zt.get(e,0)&&/%$/.test(e)?e:"")}this.selectMenu_resize.close(),this.#X.component.select(this._element,this.kind)}#Ms(){const t=this.#X.frameContext.get("_figure");t.main.style.display="none",this.#X.ui.setFigureContainer(null),this.#X.ui.opendControllers=this.#X.ui.opendControllers.filter((e=>e.form!==t.main))}#Ls(){this.selectMenu_align.open("",'[data-command="'+this.align+'"]')}#Ns(){this.selectMenu_as.open("",'[data-command="'+this.as+'"]')}#Bs(){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=Zt.get(e);i=100===t?"auto":"resize_percent"+t}}else"auto"===s&&("auto"===e?i="auto":/%$/.test(e)&&(i="resize_percent"+Zt.get(e)));this.selectMenu_resize.open("",'[data-command="'+i+'"]')}}function Fs(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 Ps(t){return/^(90|270)$/.test(Math.abs(Zt.is(t)?t:Fs(t).r).toString())}function Ds(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:Zt.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 qs=zs,{_w:Ws,ON_OVER_COMPONENT:Us,isMobile:Zs}=Dt,Gs=/^Arrow(Left|Up|Right|Down)$/,js=/^Arrow(Left|Up)$/;function Ks(t,e,s){t.preventDefault(),t.stopPropagation(),Ys(e),s.setData("text/html",e.outerHTML)}function Ys(t){Ut.utils.removeClass(t,"se-component-selected"),Ut.utils.removeClass(t.querySelectorAll(".se-figure-selected"),"se-figure-selected"),Ut.utils.removeClass(t.querySelectorAll(".se-selected-table-cell"),"se-selected-table-cell"),Ut.utils.removeClass(t.querySelector(".se-selected-cell-focus"),"se-selected-cell-focus")}const Xs=class{#F;#X;#t;#Gs;#st;#it;#K;#js;#Ks;#Ys=null;#Xs=null;#Js=null;#Ye=null;constructor(t){this.#F=t,this.#X=t.$,this.#t=t.store,this.#Gs=this.#X.contextProvider,this.#st=this.#Gs.carrierWrapper,this.#it=this.#X.options,this.#K=this.#X.frameContext,this.#js=this.#X.eventManager,this.info=null,this.isSelected=!1,this.currentTarget=null,this.currentPlugin=null,this.currentPluginName="",this.currentInfo=null,this.#Ks={copy:this.#Qs.bind(this),cut:this.#ti.bind(this),keydown:this.#ei.bind(this),mousedown:this.#Me.bind(this)},this.__selectionSelected=!1,this.__prevent=!1}_init(){this.#Gs.applyToRoots((t=>{const e=Ut.utils.createElement("DIV",{class:"se-drag-handle",draggable:"true"},this.#Gs.icons.selection);t.get("wrapper").appendChild(e),this.#js.addEvent(e,"mouseenter",this.#si.bind(this)),this.#js.addEvent(e,"mouseleave",this.#ii.bind(this)),this.#js.addEvent(e,"dragstart",this.#ni.bind(this)),this.#js.addEvent(e,"dragend",this.#oi.bind(this)),this.#js.addEvent(e,"click",this.#li.bind(this))}))}insert(t,{skipCharCount:e=!1,skipHistory:s=!1,scrollTo:i=!0,insertBehavior:n}={}){if(this.#K.get("isReadOnly")||!e&&!this.#X.char.check(t))return null;void 0===n&&(n=this.#it.get("componentInsertBehavior"));const o=this.#X.html.remove(),l=this.isInline(t);this.#X.selection.getRangeAndAddLine(this.#X.selection.getRange(),o.container);const r=this.#X.selection.getNode();let a=null,h=this.#X.format.getLine(r,null);try{if(Ut.check.isListCell(h))this.#X.html.insertNode(t,{afterNode:l?null:Ut.check.isZeroWidth(r)?(r||o.container||{}).nextSibling:null,skipCharCount:!0}),l||t.nextSibling||t.parentNode.appendChild(Ut.utils.createElement("BR"));else{if(!l&&this.#X.selection.getRange().collapsed&&(3===o.container?.nodeType||Ut.check.isBreak(o.container))){const t=Ut.query.getParentElement(o.container,this.#X.format.isBlock.bind(this.#X.format));a=this.#X.nodeTransform.split(o.container,o.offset,t?Ut.query.getNodeDepth(t)+1:0),a&&(h=a.previousSibling)}this.#X.html.insertNode(t,{afterNode:l||this.#X.format.isBlock(h)?null:h,skipCharCount:!0}),!l&&h&&Ut.check.isZeroWidth(h)&&Ut.utils.removeItem(h)}if(l){const e=Ut.utils.createTextNode(qt.zeroWidthSpace);t.parentNode.insertBefore(e,t.nextSibling)}}catch(t){console.error("Component insert error:",t)}s||this.#X.history.push(!1),this.#K.has("documentType_use_header")&&this.#K.get("documentType").reHeader();const c=a||t;return i&&this.#X.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.#X.selection.getNearRange(t);e?this.#X.selection.setRange(e.container,e.offset,e.container,e.offset):this.select(i.target,i.pluginName)}else switch(s){case"auto":this.#ri(t)||this.select(i.target,i.pluginName);break;case"select":this.#X.selection.setRange(t,0,t,0),i?this.select(i.target,i.pluginName):e&&(e=Ut.query.getEdgeChildNodes(e,null).sc||e,this.#X.selection.setRange(e,0,e,0));break;case"line":if(!this.#ri(t)){const e=this.#X.format.addLine(t,null);e&&this.#X.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(Ut.check.isComponentContainer(t)&&!Ut.utils.hasClass(t,"se-inline-component")&&(t=t.firstElementChild||t),/^FIGURE$/i.test(t.nodeName)&&(t=t.firstElementChild),!t)return null;const n=this.#X.pluginManager.findComponentInfo(t);if(!n)return null;e=n.target,s=n.pluginName,i=n.options,o=n.launcher}if(!e&&t.nodeName){this.#ai(t)&&(n=!0);const l=this.#X.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=qs.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:Ut.utils.hasClass(r,"se-input-component")}}select(t,e,{isInput:s=!1}={}){const i=this.get(t);if(!i||Ut.check.isUneditable(Ut.query.getParentElement(t,this.is.bind(this)))||Ut.check.isUneditable(t))return!1;const n=i.launcher||this.#X.plugins[e];if(!n)return;const o=ws.get("__overInfo")!==Us;if(!s&&o){if(this.#t.get("_mousedown"))return;this.#t.set("_preventBlur",!0),this.__selectionSelected=!0,this.isInline(i.container)&&this.#X.selection.setRange(i.container,0,i.container,0),this.#X.focusManager.blur(),Ws.setTimeout((()=>{this.__selectionSelected=!1}))}let l;this.isSelected=!0,this.__prevent=!0,"function"==typeof n.componentSelect&&(l=n.componentSelect(t));const r=Ut.utils.hasClass(i.target,"se-component-line-break");(r||!l&&!Ut.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,ws.set("__dragInst",this);const a=ws.get("__overInfo");if(Ws.setTimeout((()=>{ws.set("__overInfo",a===Us&&void 0),a!==Us&&this.#Be(),i.isFile||this.#hi(),Ut.utils.addClass(i.container,"se-component-selected")}),0),!o||this.#t.get("hasFocus")||this.#t.get("_preventFocus")||(this.#F._eventOrchestrator.__postFocusEvent(this.#K,null),this.#t.set("_preventFocus",!0)),r||a===Us){if(r||!Ut.utils.hasClass(i.container,"se-input-component")){const t=this.#K.get("wrapper").querySelector(".se-drag-handle");Ut.utils.addClass(t,"se-drag-handle-full"),this.#X.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.#X.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",ws.set("__dragHandler",t),ws.set("__dragContainer",i.container),ws.set("__dragCover",i.cover),t.style.display="block"}}else{if(!this.isInline(i.container))return;const t=i.container;let e=null;t.previousSibling&&!Ut.check.isBreak(t.previousSibling)||(e=Ut.utils.createTextNode(qt.zeroWidthSpace),t.parentNode.insertBefore(e,t)),t.nextSibling&&!Ut.check.isBreak(t.nextSibling)||(e=Ut.utils.createTextNode(qt.zeroWidthSpace),t.parentNode.insertBefore(e,t.nextSibling)),this.#t.set("controlActive",!0)}}deselect(){Ws.setTimeout((()=>{this.#t.set("controlActive",!1)}),0),this.__deselect(),this.#X.ui.setControllerOnDisabledButtons(!1),!this.#t.get("_preventFocus")||this.#t.get("hasFocus")||this.__prevent||(this.#F._eventOrchestrator.__postBlurEvent(this.#K,null),this.#t.set("_preventFocus",!1))}is(t){return!!t&&(!(!/^FIGURE$/i.test(t.nodeName)&&!Ut.check.isComponentContainer(t))||!!this.#X.pluginManager.findComponentInfo(t))}isInline(t){if(!t)return!1;if(/^FIGURE$/i.test(t.nodeName)&&(t=t.parentElement),Ut.utils.hasClass(t,"se-inline-component"))return!0;return!(!this.#X.pluginManager.findComponentInfo(t)||!Ut.utils.hasClass(t,"se-inline-component")&&!Ut.utils.hasClass(t.parentElement,"se-inline-component"))}isBasic(t){return this.is(t)&&!this.isInline(t)}async copy(t){const e=Ut.utils.clone(t,!0);Ys(e),!1!==await this.#X.html.copy(e)&&Ut.utils.flashClass(t,"se-copy")}hoverSelect(t){const e=Ut.query.getParentElement(t,Ut.check.isFigure);let s=this.get(t);s||e?(s||=this.get(e),s&&!Ut.utils.hasClass(s.container,"se-component-selected")&&(this.#X.ui.offCurrentController(),ws.set("__overInfo",Us),this.select(s.target,s.pluginName))):null===ws.get("__overInfo")||Ut.utils.hasClass(t,"se-drag-handle")||(this.__deselect(),ws.set("__overInfo",null))}__deselect(){if(this.#t.set("_preventBlur",!1),ws.set("__overInfo",null),this.__removeDragEvent(),this.currentInfo){const t=this.currentInfo.container,e=this.currentInfo.cover;Ws.setTimeout((()=>{Ys(t),Ut.utils.removeClass(e,"se-figure-over-selected")}),0)}this.#K.get("lineBreaker_t")&&(this.#K.get("lineBreaker_t").style.display=this.#K.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.#X.ui._offControllers()}_setComponentLineBreaker(t){const e=ws.get("__overInfo")===Us;this.#F._eventOrchestrator._lineBreakComp=null;const s=this.get(t);if(!s)return;const i=this.#K,n=s.container,o=Ut.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.#X.ui.getVisibleFigure()||c,u=Ut.check.isListCell(n.parentNode);let p,g;const m=this.#it.get("_rtl"),f=m?["right","left"]:["left","right"],{top:v,left:b,right:y,scrollX:w,scrollY:C}=this.#X.offset.getLocal(c),_=m?y:b;if(u?!Ut.check.isBreak(n.previousElementSibling)&&!n.previousSibling?.textContent?.trim()||this.is(n.previousElementSibling):!this.#X.format.isLine(n.previousElementSibling)){const t=Ws.getComputedStyle(l),s=Zt.get(t.height,1),i=Zt.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",C+","+w),e?Ut.utils.removeClass(l,"se-on-selected"):Ut.utils.addClass(l,"se-on-selected"),a.display="block",a.visibility=""}else a.display="none";if(u?!Ut.check.isBreak(n.nextElementSibling)&&!n.nextSibling?.textContent?.trim()||this.is(n.nextElementSibling):!this.#X.format.isLine(n.nextElementSibling)){const t=Ws.getComputedStyle(r),s=Zt.get(t.height,1),i=Zt.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",C+","+f[0]+","+w),e?Ut.utils.removeClass(r,"se-on-selected"):Ut.utils.addClass(r,"se-on-selected"),h.display="block",h.visibility=""}else h.display="none"}__removeGlobalEvent(){this.#ci(),this.#Ys&&=this.#js.removeGlobalEvent(this.#Ys),this.#Xs&&=this.#js.removeGlobalEvent(this.#Xs),this.#Js&&=this.#js.removeGlobalEvent(this.#Js)}__removeDragEvent(){this.#st.querySelector(".se-drag-cursor").style.left="-10000px",ws.get("__dragHandler")&&(ws.get("__dragHandler").style.display="none"),Ut.utils.removeClass([ws.get("__dragHandler"),ws.get("__dragContainer")],"se-dragging"),Ut.utils.removeClass([ws.get("__dragCover"),ws.get("__dragContainer")],"se-drag-over"),ws.set("__figureInst",null),ws.set("__dragInst",null),ws.set("__dragHandler",null),ws.set("__dragContainer",null),ws.set("__dragCover",null),ws.set("__dragMove",null),ws.set("__overInfo",null)}#Be(){this.__removeGlobalEvent(),this.#Ys=this.#js.addGlobalEvent("copy",this.#Ks.copy),this.#Xs=this.#js.addGlobalEvent("cut",this.#Ks.cut),this.#Js=this.#js.addGlobalEvent("keydown",this.#Ks.keydown)}#hi(){this.#ci(),this.#Ye=this.#js.addGlobalEvent(Zs?"click":"mousedown",this.#Ks.mousedown,!0)}#ci(){this.#Ye&&=this.#js.removeGlobalEvent(this.#Ye)}#ri(t){const e=t.nextElementSibling;if(!e){const e=this.#X.format.addLine(t,null);return e&&this.#X.selection.setRange(e,0,e,0),!0}return!!this.#X.format.isLine(e)&&(this.#X.selection.setRange(e,0,e,0),!0)}#ai(t){const e=t.nodeName.toLowerCase();return this.#X.pluginManager.fileInfo.regExp.test(e)&&(!this.#X.pluginManager.fileInfo.tagAttrs[e]||this.#X.pluginManager.fileInfo.tagAttrs[e]?.every((e=>t.hasAttribute(e))))}#si(){this.#t.set("_preventBlur",!0),this.#X.ui._visibleControllers(!1,Ut.utils.hasClass(ws.get("__dragHandler"),"se-drag-handle-full")),Ut.utils.addClass(ws.get("__dragCover")||ws.get("__dragContainer"),"se-drag-over")}#ii(){this.#t.set("_preventBlur",!1),Ut.utils.hasClass(ws.get("__dragHandler"),"se-drag-handle-full")||this.#X.ui._visibleControllers(!0,!0),Ut.utils.removeClass([ws.get("__dragCover"),ws.get("__dragContainer")],"se-drag-over")}#ni(t){const e=ws.get("__dragCover")||ws.get("__dragContainer");e?(this.#t.set("_preventBlur",!1),Ut.utils.addClass(ws.get("__dragHandler"),"se-dragging"),Ut.utils.addClass(ws.get("__dragContainer"),"se-dragging"),t.dataTransfer.setDragImage(e,this.#it.get("_rtl")?e.offsetWidth:-5,-5)):t.preventDefault()}#oi(){this.#t.set("_preventBlur",!1),Ut.utils.removeClass([ws.get("__dragHandler"),ws.get("__dragContainer")],"se-dragging"),this.__removeDragEvent()}#li(t){const e=Ut.query.getEventTarget(t);if(!Ut.utils.hasClass(e,"se-drag-handle-full"))return;const s=ws.get("__dragInst");s&&(this.__removeDragEvent(),this.select(s.currentTarget,s.currentPluginName))}#Me(t){const e=Ut.query.getEventTarget(t);this.currentTarget?.contains(e)||Ut.query.getParentElement(e,".se-controller")||Ut.utils.hasClass(e,"se-drag-handle")||this.currentPluginName===this.#X.ui.currentControllerName&&this.#X.ui.opendControllers.some((({form:t})=>t.contains(e)))||this.deselect()}#Qs(t){const e=Ut.query.getEventTarget(t);if(Ut.check.isInputElement(e)&&Ut.query.getParentElement(e,".se-modal"))return;const s=this.info;if(!s)return;const i=s.container.cloneNode(!0);"function"==typeof this.#X.plugins[s.pluginName]?.componentCopy&&!1!==this.#X.plugins[s.pluginName].componentCopy({event:t,cloneContainer:i,info:s})||Ks(t,i,t.clipboardData),Ut.utils.flashClass(s.container,"se-copy")}#ti(t){const e=this.info;if(!e)return;const s=e.container.cloneNode(!0);Ut.utils.removeClass(s,"se-component-selected"),Ks(t,s,t.clipboardData),this.deselect(),Ut.utils.removeItem(e.container)}async#ei(t){if(this.#X.ui.selectMenuOn)return;const e=t.code;if(Gt.isCtrl(t)){if("ControlRight"!==e&&"ControlLeft"!==e){const s=this.#X.shortcuts.keyMap.get(e+(t.shiftKey?"1000":""));/^(redo|undo)$/.test(s?.command)&&(t.preventDefault(),t.stopPropagation(),this.#X.commandDispatcher.run(s.command,s.type,s.button))}}else if(!Gt.isRemoveKey(e)||(t.preventDefault(),t.stopPropagation(),"function"!=typeof this.currentPlugin?.componentDestroy||this.info.isInputType&&this.#t.get("hasFocus"))){if(Gt.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=Ut.check.isListCell(s.parentNode)?Ut.utils.createElement("BR"):Ut.utils.createElement(this.#X.format.isLine(i)?i.nodeName:this.#it.get("defaultLine"),null,"<br>");const o=this.currentPluginName;return this.deselect(),s.parentNode.insertBefore(n,s),!1===this.select(e.target,o)&&this.#X.focusManager.blur(),void this.#X.history.push(!1)}if(Gs.lastIndex=0,Gs.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.#X.format.getLine(s,null);i=t?.previousElementSibling,n=0;break}case"ArrowDown":{const t=this.#X.format.getLine(s,null);i=t?.nextElementSibling;break}}else js.lastIndex=0,js.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.#X.selection.setRange(i,n,i,n)}finally{this.#t.set("_preventBlur",!1)}}else Gt.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.#X.selection.setRange(t,e,t,e)}else this.#X.focusManager.focus()}}_destroy(){this.__removeGlobalEvent(),this.__removeDragEvent()}};const Js=class{#F;#X;#di;#Gs;#it;#ui;#pi;#gi=[];#mi=[];#fi={tags:null,regExp:null,pluginRegExp:null,pluginMap:null};#vi=[];#bi=new Map;#yi=new Map([["onMouseMove",[]],["onMouseLeave",[]],["onMouseDown",[]],["onMouseUp",[]],["onScroll",[]],["onClick",[]],["onBeforeInput",[]],["onInput",[]],["onKeyDown",[]],["onKeyUp",[]],["onFocus",[]],["onBlur",[]],["onPaste",[]],["onFilePasteAndDrop",[]]]);constructor(t,e){this.#F=t,this.#X=t.$,this.#di=e.plugins||{},this.#Gs=this.#X.contextProvider,this.#it=this.#X.options,this.#ui=e.pluginCallButtons,this.#pi=e.pluginCallButtons_sub}get plugins(){return this.#di}get fileInfo(){return this.#fi}findComponentInfo(t){for(const e of this.#vi){const s=e(t);if(s)return s}return null}applyRetainFormat(t){let e;(e=this.#it.get("__pluginRetainFilter"))&&this.#bi.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.#yi.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.#yi.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.#gi.length;e<s;e++)this.#gi[e](t)}resetFileInfo(){for(let t=0,e=this.#mi.length;t<e;t++)this.#mi[t]()}register(t,e,s){let i=this.#di[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.#di[t]&&(i=this.#di[t]=new this.#di[t](this.#F,s||{})),e){const{icons:s,lang:n}=this.#Gs;for(let t=0,o=e.length;t<o;t++)ve(e[t],i,s,n);this.#X.commandDispatcher.activeCommands.includes(t)||"function"!=typeof this.#di[t].active||this.#X.commandDispatcher.activeCommands.push(t)}}init(t){this.#fi.tags=[],this.#fi.pluginMap={},this.#fi.tagAttrs={};const e=this.#di,s=[];let i;for(const n in e){if(this.register(n,this.#ui[n],t[n]),this.register(n,this.#pi[n],t[n]),i=this.#di[n],"object"==typeof i.__fileManagement){const t=i.__fileManagement;if(this.#gi.push(t._checkInfo.bind(t)),this.#mi.push(t._resetInfo.bind(t)),Array.isArray(t.tagNames)){const e=t.tagNames;this.#fi.tags=this.#fi.tags.concat(e),s.push(n);for(let s,i=0,o=e.length;i<o;i++)s=e[i].toLowerCase(),this.#fi.pluginMap[s]=n,t.tagAttrs&&(this.#fi.tagAttrs[s]=t.tagAttrs)}}"function"==typeof i.constructor.component&&this.#vi.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.#yi.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.#bi.set(t.query,{key:i.constructor.key,method:t.method})}}for(const t of this.#yi.values())t.sort(((t,e)=>t.index-e.index));(this.#it.get("buttons").has("pageBreak")||this.#it.get("buttons_sub")?.has("pageBreak"))&&this.#vi.push(function(t,e,s){return s&&Ut.utils.hasClass(s,"se-page-break")?{target:s,launcher:{destroy:s=>{const i=s.previousElementSibling||s.nextElementSibling;Ut.utils.removeItem(s),t.focusEdge(i),e.push(!1)}}}:null}.bind(null,this.#X.focusManager,this.#X.history)),this.#fi.regExp=new RegExp(`^(${this.#fi.tags.join("|")||"\\^"})$`,"i"),this.#fi.pluginRegExp=new RegExp(`^(${0===s.length?"\\^":s.join("|")})$`,"i"),this.#ui=null,this.#pi=null}get(t){return this.#di[t]}_destroy(){for(const t in this.#di){const e=this.#di[t];e._destroy?.(),e.editor=null}this.#di=null,this.#fi=null,this.#vi=null,this.#yi?.clear(),this.#bi?.clear()}};class Qs{#F;#X;#t;#it;#K;#J;constructor(t){this.#F=t,this.#X=t.$,this.#t=t.store,this.#it=this.#X.options,this.#K=this.#X.frameContext,this.#J=this.#X.frameOptions}focus(t){if(t&&this.#X.facade.changeFrameContext(t),"none"!==this.#K.get("wysiwygFrame").style.display){if(this.#t.set("_preventBlur",!1),this.#J.get("iframe")||!this.#K.get("wysiwyg").contains(this.#X.selection.getNode()))this.nativeFocus();else try{const t=this.#X.selection.getRange();if(t.startContainer===t.endContainer&&Ut.check.isWysiwygFrame(t.startContainer)){const e=t.commonAncestorContainer.children[t.startOffset];if(!this.#X.format.isLine(e)&&!this.#X.component.is(e)){const t=Ut.utils.createElement("BR"),s=Ut.utils.createElement(this.#it.get("defaultLine"),null,t);return this.#K.get("wysiwyg").insertBefore(s,e),void this.#X.selection.setRange(t,0,t,0)}}this.#X.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.#K.get("wysiwyg").lastElementChild;const e=this.#X.component.get(t);e?this.#X.component.select(e.target,e.pluginName):t?(3!==t.nodeType&&(t=Ut.query.getEdgeChild(t,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!0)),t?this.#X.selection.setRange(t,t.textContent.length,t,t.textContent.length):this.nativeFocus()):this.focus()}nativeFocus(){this.#X.selection.__focus(),this.#X.selection.init()}blur(){this.#J.get("iframe")?this.#K.get("wysiwygFrame").blur():this.#K.get("wysiwyg").blur()}}const{NO_EVENT:ti}=Dt,ei={bold:["font-weight"],underline:["text-decoration"],italic:["font-style"],strike:["text-decoration"]};class si{#F;#X;#t;#K;#it;#js;#wi=null;#Ci=null;#_i=null;#xi=null;constructor(t){this.#F=t,this.#X=t.$,this.#t=t.store,this.#K=this.#X.frameContext,this.#it=this.#X.options,this.#js=this.#X.eventManager}async execute(t,e){if(!this.#K.get("isReadOnly")||/copy|cut|selectAll|codeView|markdownView|fullScreen|print|preview|showBlocks|finder/.test(t))switch(t){case"selectAll":this.#$i();break;case"copy":{const t=this.#X.selection.getRange();if(t.collapsed)break;const e=Ut.utils.createElement("div",null,t.cloneContents());await this.#X.html.copy(e.innerHTML);break}case"newDocument":this.#X.html.set(`<${this.#it.get("defaultLine")}><br></${this.#it.get("defaultLine")}>`),this.#X.focusManager.focus(),this.#X.history.push(!1),this.#K.has("documentType_use_header")&&this.#K.get("documentType").reHeader();break;case"finder":this.#X.finder.open(!0);break;case"codeView":this.#X.viewer.codeView(!this.#K.get("isCodeView"));break;case"markdownView":this.#X.viewer.markdownView(!this.#K.get("isMarkdownView"));break;case"fullScreen":this.#X.viewer.fullScreen(!this.#K.get("isFullScreen"));break;case"indent":this.#X.format.indent();break;case"outdent":this.#X.format.outdent();break;case"undo":this.#X.history.undo();break;case"redo":this.#X.history.redo();break;case"removeFormat":this.#X.inline.remove(),this.#X.focusManager.focus();break;case"print":this.#X.viewer.print();break;case"preview":this.#X.viewer.preview();break;case"showBlocks":this.#X.viewer.showBlocks(!this.#K.get("isShowBlocks"));break;case"dir":this.#X.ui.setDir(this.#it.get("_rtl")?"ltr":"rtl");break;case"dir_ltr":this.#X.ui.setDir("ltr");break;case"dir_rtl":this.#X.ui.setDir("rtl");break;case"save":await this.#ki();break;case"copyFormat":this.#Si(e);break;case"pageBreak":this.#Ei();break;case"pageUp":this.#K.get("documentType").pageUp();break;case"pageDown":this.#K.get("documentType").pageDown();break;default:this.#Ti(t)}}copyFormat(){if(this.#_i?.length)try{const t=[...this.#_i],e=t.pop();if(this.#X.inline.remove(),e){const s=this.#X.inline.apply(e,{stylesToModify:null,nodesToRemove:[e.nodeName],strictRemove:!1}),{parent:i,inner:n}=this.#X.nodeTransform.createNestedNode(t);s.parentNode.insertBefore(i,s),n.appendChild(s),this.#X.selection.setRange(s,Ut.check.isZeroWidth(s)?1:0,s,1)}if(this.#it.get("copyFormatKeepOn"))return;this.#xi()}catch(t){console.warn("[SUNEDITOR.copyFormat.error] ",t),this.#xi?.()||(this.#_i=null,this.#xi=null)}}#$i(){this.#X.ui.offCurrentController(),this.#X.menu.containerOff();const t=this.#K.get("wysiwyg");let e=null,s="";const i=this.#it.get("scopeSelectionTags"),n=this.#X.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;(Ut.check.isList(t)||Ut.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)||Ut.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=Ut.query.getParentElement(e||this.#X.selection.getNode(),(t=>o.includes(t.nodeName?.toLowerCase())))||t,{first:r,last:a}=ii(l);if(!r||!a)return;const h=Ut.check.isZeroWidth;for(;h(r)&&h(a)&&l!==t;)l=l.parentElement,({first:r,last:a}=ii(Ut.query.getParentElement(l,(t=>o.includes(t.nodeName?.toLowerCase())))||t));if(!r||!a)return;let c=null;if(Ut.check.isMedia(r)||(c=this.#X.component.get(r))||Ut.check.isTableElements(r)){c||=this.#X.component.get(r);const t=Ut.utils.createElement("BR"),e=Ut.utils.createElement(this.#it.get("defaultLine"),null,t);r=c?c.container||c.cover:r,r.parentElement.insertBefore(e,r),r=t}if(Ut.check.isMedia(a)||(c=this.#X.component.get(a))||Ut.check.isTableElements(a)){c||=this.#X.component.get(a);const t=Ut.utils.createElement("BR"),e=Ut.utils.createElement(this.#it.get("defaultLine"),null,t);a=c?c.container||c.cover:a,a.parentElement.appendChild(e),a=t}this.#X.toolbar._showBalloon(this.#X.selection.setRange(r,0,a,a.textContent.length))}async#ki(){const t=this.#K;if(!t.get("isChanged"))return;const e=this.#X.html.get(),s=await this.#js.triggerEvent("onSave",{frameContext:t,data:e});if(s===ti){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.#X.history.getRootStack()[this.#t.get("rootKey")].index),this.#X.commandDispatcher.applyTargets("save",(t=>{t.disabled=!0}))}#Si(t){if("function"==typeof this.#xi)return void this.#xi();const e=this.#K.get("wysiwyg");this.#_i=[...this.#F._eventOrchestrator.__cacheStyleNodes],this.#xi=this.#Mi.bind(this,this.#js,e,t),Ut.utils.addClass(e,"se-copy-format-cursor"),Ut.utils.addClass(t,"on"),this.#wi=this.#js.addGlobalEvent("keydown",(t=>{Gt.isEsc(t.code)&&this.#xi?.()})),this.#Ci=this.#js.addGlobalEvent("mousedown",(s=>{e.contains(s.target)||s.target===t||this.#xi?.()}))}#Mi(t,e,s){return this.#wi=t.removeGlobalEvent(this.#wi),this.#Ci=t.removeGlobalEvent(this.#Ci),this.#_i=null,this.#xi=null,Ut.utils.removeClass(e,"se-copy-format-cursor"),Ut.utils.removeClass(s,"on"),!0}#Ti(t){t=this.#it.get("_defaultTagCommand")[t.toLowerCase()]||t;let e=this.#it.get("convertTextTags")[t]||t;const s=this.#t.get("currentNodesMap"),i=s.includes(this.#it.get("_styleCommandMap")[e])?null:Ut.utils.createElement(e);/^sub$/i.test(e)&&s.includes("superscript")?e="sup":/^sup$/i.test(e)&&s.includes("subscript")&&(e="sub"),this.#X.inline.apply(i,{stylesToModify:ei[t]||null,nodesToRemove:[e],strictRemove:!1}),this.#X.focusManager.focus()}#Ei(){const t=Ut.utils.createElement("DIV",{class:"se-component se-component-line-break se-page-break"});this.#X.component.insert(t,{skipCharCount:!0,insertBehavior:"line"});const e=t.nextElementSibling||this.#X.format.addLine(t);this.#X.selection.setRange(e,1,e,1),this.#X.history.push(!1)}}const ii=function(t){const e=Ut.check.isContentLess;return{first:Ut.query.getEdgeChild(Ut.query.getEdgeChild(t,(t=>!e(t)),!1),(t=>0===t.childNodes.length||3===t.nodeType||Z(t)||U(t)),!1)||t.firstChild,last:Ut.query.getEdgeChild(t.lastChild,(t=>0===t.childNodes.length||3===t.nodeType||Z(t)||U(t)),!0)||t.lastChild}},ni=".se-menu-list .se-toolbar-btn[data-command]",oi=["bold","underline","italic","strike","subscript","superscript","indent","outdent"],li=oi.concat(["undo","redo","save","fullScreen","showBlocks","codeView","markdownView","finder","dir","dir_ltr","dir_rtl"]);class ri{#X;#e;#it;#Hi;#Li=new Map;#Ni=oi;constructor(t){this.#X=t.$,this.#e=this.#X.context,this.#it=this.#X.options,this.#Hi=new si(t),this.allCommandButtons=new Map,this.subAllCommandButtons=new Map}get targets(){return this.#Li}get activeCommands(){return this.#Ni}run(t,e,s){if(e){if(/more/i.test(e)){const e=Ut.query.getParentElement(s,".se-toolbar"),i=Ut.utils.hasClass(e,"se-toolbar-sub")?this.#X.subToolbar:this.#X.toolbar;if(s!==i.currentMoreLayerActiveButton){const n=e.querySelector("."+t);n&&(i._moreLayerOn(s,n),i._showBalloon(),i._showInline()),Ut.utils.addClass(s,"on")}else i.currentMoreLayerActiveButton&&(i._moreLayerOff(),i._showBalloon(),i._showInline());return void this.#X.viewer._resetFullScreenHeight()}if(/container/.test(e)&&(null===this.#X.menu.targetMap[t]||s!==this.#X.menu.currentContainerActiveButton))return void this.#X.menu.containerOn(s);if(this.#X.ui.isButtonDisabled(s))return;if(/dropdown/.test(e)&&(null===this.#X.menu.targetMap[t]||s!==this.#X.menu.currentDropdownActiveButton))return void this.#X.menu.dropdownOn(s);if(/modal/.test(e))return void this.#X.plugins[t].open(s);/command/.test(e)?this.#X.plugins[t].action(s):/browser/.test(e)?this.#X.plugins[t].open(null):/popup/.test(e)&&this.#X.plugins[t].show()}else t&&this.#Hi.execute(t,s);/dropdown/.test(e)?this.#X.menu.dropdownOff():/command/.test(e)||(this.#X.menu.dropdownOff(),this.#X.menu.containerOff())}runFromTarget(t){if(Ut.check.isInputElement(t))return;const e=Ut.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.#Li.has(t)&&this.#Li.get(t).forEach(e)}registerTargets(t,e){if(!t||!e)return;(li.includes(t)||this.#X.plugins[t])&&(this.#Li.get(t)?this.#Li.get(t).includes(e)||this.#Li.get(t).push(e):this.#Li.set(t,[e]))}resetTargets(){this.#Li=new Map,this._initCommandButtons()}_initCommandButtons(){const t=this.#e;this.#Bi(this.allCommandButtons,t.get("toolbar_buttonTray")),this.#Bi(this.subAllCommandButtons,t.get("toolbar_sub_buttonTray"))}_copyFormat(){this.#Hi.copyFormat()}#Bi(t,e){if(!e)return;const s=e.querySelectorAll(ni),i=this.#it.get("shortcuts"),n=this.#it.get("_reverseCommandArray"),o=this.#X.shortcuts.keyMap,l=this.#X.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),re(r,e,i[r],o,n,l)}_destroy(){this.#Li.clear(),this.allCommandButtons.clear(),this.subAllCommandButtons.clear(),this.#Ni=null}}const ai=`${ni}:not([class~="se-code-view-enabled"]):not([data-type="MORE"])`,hi=`${ni}:not([class~="se-component-enabled"]):not([data-type="MORE"])`,{_w:ci}=Dt;const di=class{#F;#X;#t;#Gs;#st;#it;#e;#A;#K;#js;#Ai;#Ii;#Vi;#Oi;#Ri=null;#zi;#Fi=!1;#Pi=null;#Di=null;#qi=[];#Wi=[];#Ui=!1;#Zi=null;#Gi=null;constructor(t){this.#F=t,this.#X=t.$,this.#t=t.store,this.#Gs=this.#X.contextProvider,this.#st=this.#Gs.carrierWrapper,this.#it=this.#X.options,this.#e=this.#X.context,this.#A=this.#X.frameRoots,this.#K=this.#X.frameContext,this.#js=this.#X.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 Ut.utils.createElement("DIV",{class:"se-alert-content"},s)}(this.#Gs);this.alertModal=e,this.alertMessage=e.querySelector("span");const s=function(){const t='<div class="se-toast-container"><span></span></div>';return Ut.utils.createElement("DIV",{class:"se-toast"},t)}();this.toastPopup=s,this.toastContainer=s.querySelector(".se-toast-container"),this.toastMessage=s.querySelector("span"),this.#st.appendChild(s),this.#Ai=this.#st.querySelector(".se-alert"),this.#Ii=this.#st.querySelector(".se-alert .se-modal-inner"),this.#Ii.appendChild(e),this.#Vi=[this.#ji.bind(this),this.#Ki.bind(this)],this.#Oi=!1,this.#zi=this.#st.querySelector(".se-back-wrapper"),this.selectMenuOn=!1,this.opendControllers=[],this.controllerTargetContext=null,this._figureContainer=null}setEditorStyle(t,e){e||=this.#K;const s=e.get("options");s.set("editorStyle",t);const i=Wt._setDefaultOptionStyle(s,t);s.set("_defaultStyles",i),e.get("topArea").style.cssText=i.top;const n=e.get("code");if(this.#it.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.#it,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&&Ut.utils.removeClass(e,s),t&&Ut.utils.addClass(e,t))};i(this.#st),this.#Gs.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.#it.get("_rtl")!==e){try{this.#it.set("_rtl",e),this.offCurrentController();const s=this.#K,i=this.#X.pluginManager.plugins;for(const e in i)i[e].setDir?.(t);const n=this.#e.get("toolbar_wrapper"),o=this.#e.get("statusbar_wrapper");e?(this.#Gs.applyToRoots((t=>{Ut.utils.addClass([t.get("topArea"),t.get("wysiwyg"),t.get("documentTypePageMirror")],"se-rtl")})),Ut.utils.addClass([this.#st,n,o],"se-rtl")):(this.#Gs.applyToRoots((t=>{Ut.utils.removeClass([t.get("topArea"),t.get("wysiwyg"),t.get("documentTypePageMirror")],"se-rtl")})),Ut.utils.removeClass([this.#st,n,o],"se-rtl"));const l=Ut.query.getListChildren(s.get("wysiwyg"),(t=>this.#X.format.isLine(t)&&!!(t.style.marginRight||t.style.marginLeft||t.style.textAlign)),null);for(let t,e,s,i=0;t=l[i];i++)t=l[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.#Yi(e),s.has("documentType_use_header")&&(e?s.get("wrapper").appendChild(s.get("documentTypeInner")):s.get("wrapper").insertBefore(s.get("documentTypeInner"),s.get("wysiwygFrame"))),s.has("documentType_use_page")&&(e?s.get("wrapper").insertBefore(s.get("documentTypePage"),s.get("wysiwygFrame")):s.get("wrapper").appendChild(s.get("documentTypePage"))),this.#t.mode.isBalloon?this.#X.toolbar._showBalloon():this.#t.mode.isSubBalloon&&this.#X.subToolbar._showBalloon()}catch(t){this.#it.set("_rtl",!e),console.warn(`[SUNEDITOR.ui.setDir.fail] ${t.toString()}`)}this.#t.set("_lastSelectionNode",null),this.#F._eventOrchestrator.applyTagEffect()}}readOnly(t,e){const s=e?this.#A.get(e):this.#K;s.set("isReadOnly",!!t),this._toggleControllerButtons(!!t),t?(this.offCurrentController(),this.offCurrentModal(),this.#X.toolbar?.currentMoreLayerActiveButton?.disabled&&this.#X.toolbar._moreLayerOff(),this.#X.subToolbar?.currentMoreLayerActiveButton?.disabled&&this.#X.subToolbar._moreLayerOff(),this.#X.menu?.currentDropdownActiveButton?.disabled&&this.#X.menu.dropdownOff(),this.#X.menu?.currentContainerActiveButton?.disabled&&this.#X.menu.containerOff(),s.get("code").setAttribute("readOnly","true"),Ut.utils.addClass(s.get("wysiwyg"),"se-read-only")):(s.get("code").removeAttribute("readOnly"),Ut.utils.removeClass(s.get("wysiwyg"),"se-read-only")),this.#it.get("hasCodeMirror")&&this.#X.viewer._codeMirrorEditor("readonly",!!t,e)}disable(t){const e=t?this.#A.get(t):this.#K;this.#X.toolbar.disable(),this.offCurrentController(),this.offCurrentModal(),e.get("wysiwyg").setAttribute("contenteditable","false"),e.set("isDisabled",!0),this.#it.get("hasCodeMirror")?this.#X.viewer._codeMirrorEditor("readonly",!0,t):e.get("code").disabled=!0}enable(t){const e=t?this.#A.get(t):this.#K;this.#X.toolbar.enable(),e.get("wysiwyg").setAttribute("contenteditable","true"),e.set("isDisabled",!1),this.#it.get("hasCodeMirror")?this.#X.viewer._codeMirrorEditor("readonly",!1,t):e.get("code").disabled=!1}show(t){const e=(t?this.#A.get(t):this.#K).get("topArea").style;"none"===e.display&&(e.display="block")}hide(t){(t?this.#A.get(t):this.#K).get("topArea").style.display="none"}showLoading(t){(t?this.#A.get(t).get("container"):this.#st).querySelector(".se-loading-box").style.display="block"}hideLoading(t){(t?this.#A.get(t).get("container"):this.#st).querySelector(".se-loading-box").style.display="none"}alertOpen(t,e){this.alertMessage.textContent=t,Ut.utils.removeClass(this.alertModal,"se-alert-error|se-alert-success"),e&&Ut.utils.addClass(this.alertModal,`se-alert-${e}`),this.#Oi&&(this.#Ri=this.#js.addEvent(this.#Ii,"click",this.#Vi[1])),this.#Pi&&=this.#js.removeGlobalEvent(this.#Pi),this.#Pi=this.#js.addGlobalEvent("keydown",this.#Vi[0]),this.#Ai.style.display="block",Ut.utils.addClass(this.alertModal,"se-modal-show")}alertClose(){Ut.utils.removeClass(this.alertModal,"se-modal-show"),Ut.utils.removeClass(this.alertModal,"se-alert-*"),this.#Ai.style.display="none",this.#Ri&&=this.#js.removeEvent(this.#Ri),this.#Pi&&=this.#js.removeGlobalEvent(this.#Pi)}showToast(t,e=1e3,s){Ut.utils.hasClass(this.toastContainer,"se-toast-show")&&this.closeToast(),Ut.utils.removeClass(this.toastPopup,"se-toast-error|se-toast-success"),s&&Ut.utils.addClass(this.toastPopup,`se-toast-${s}`),this.toastPopup.style.display="block",this.toastMessage.textContent=t,Ut.utils.addClass(this.toastContainer,"se-toast-show"),this.#Di=ci.setTimeout((()=>{this.closeToast()}),e)}closeToast(){this.#Di&&ci.clearTimeout(this.#Di),this.#Di=null,Ut.utils.removeClass(this.toastContainer,"se-toast-show"),this.toastPopup.style.display="none"}setControllerOnDisabledButtons(t){return t&&!this.#Fi?(this._toggleControllerButtons(!0),this.#Fi=!0):!t&&this.#Fi&&(this._toggleControllerButtons(!1),this.#Fi=!1),this.#Fi}onControllerContext(){this.controllerTargetContext=this.#K.get("topArea")}offControllerContext(){this.controllerTargetContext=null}enableBackWrapper(t){this.#zi.style.cursor=t,this.#zi.style.display="block"}disableBackWrapper(){this.#zi.style.display="none",this.#zi.style.cursor="default"}offCurrentController(){this.#X.component.__deselect()}offCurrentModal(){this.opendModal?.close()}getVisibleFigure(){return"block"===this._figureContainer?.style.display?this._figureContainer:null}setFigureContainer(t){this._figureContainer=t}preventToolbarHide(t){this.#Ui=t}get isPreventToolbarHide(){return this.#Ui}reset(t){t.set("_editorHeight",t.get("wysiwygFrame").offsetHeight),this.#Zi=t.get("lineBreaker_t"),this.#Gi=t.get("lineBreaker_b")}_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.#X.toolbar.balloonOffset.top-e+"px",this.#e.get("toolbar_main").style.left=this.#X.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.#X.subToolbar.balloonOffset.top-e+"px",this.#e.get("toolbar_sub_main").style.left=this.#X.subToolbar.balloonOffset.left-s+"px"),this.controllerTargetContext!==this.#K.get("topArea")&&this.offCurrentController(),this.#Xi(s,e)}_repositionControllers(){const t=this.opendControllers;if(0!==t.length){ws.get("__dragMove")&&ws.get("__dragMove")();for(let e=0;e<t.length;e++)t[e].notInCarrier||t[e].inst?._scrollReposition()}}#Xi(t,e){if(this.#Zi){const s=this.#Zi.style;if("none"!==s.display){const i=(this.#Zi.getAttribute("data-offset")||",").split(",");s.top=Zt.get(s.top,0)-(e-Zt.get(i[0],0))+"px",s.left=Zt.get(s.left,0)-(t-Zt.get(i[1],0))+"px",this.#Zi.setAttribute("data-offset",e+","+t)}}if(this.#Gi){const s=this.#Gi.style;if("none"!==s.display){const i=(this.#Gi.getAttribute("data-offset")||",").split(",");s.top=Zt.get(s.top,0)-(e-Zt.get(i[0],0))+"px",s[i[1]]=Zt.get(s[i[1]],0)-(t-Zt.get(i[2],0))+"px",this.#Gi.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.#Zi.style.visibility=i,this.#Gi.style.visibility=i}setCurrentControllerContext;#Yi(t){const e=this.#Gs.icons,s=this.#X.commandDispatcher?.targets;if(!s)return;const i=this.#X.shortcuts?.keyMap;this.#X.shortcuts?.reverseKeys?.forEach((t=>{const e=i?.get(t);e&&([e.command,e.r]=[e.r,e.command])})),this.#X.commandDispatcher.applyTargets("dir",(s=>{Ut.utils.changeTxt(s.querySelector(".se-tooltip-text"),this.#Gs.lang[t?"dir_ltr":"dir_rtl"]),Ut.utils.changeElement(s.firstElementChild,e[t?"dir_ltr":"dir_rtl"])})),t?(Ut.utils.addClass(s.get("dir_rtl"),"active"),Ut.utils.removeClass(s.get("dir_ltr"),"active")):(Ut.utils.addClass(s.get("dir_ltr"),"active"),Ut.utils.removeClass(s.get("dir_rtl"),"active"))}_initToggleButtons(){const t=this.#e;this.#Wi=Wt.nodeListToArray(t.get("toolbar_buttonTray").querySelectorAll(ai)),this.#qi=Wt.nodeListToArray(t.get("toolbar_buttonTray").querySelectorAll(hi)),this.#it.has("_subMode")&&(this.#Wi=this.#Wi.concat(Wt.nodeListToArray(t.get("toolbar_sub_buttonTray").querySelectorAll(ai))),this.#qi=this.#qi.concat(Wt.nodeListToArray(t.get("toolbar_sub_buttonTray").querySelectorAll(hi))))}_toggleCodeViewButtons(t){Ut.utils.setDisabled(this.#Wi,t)}_toggleControllerButtons(t){Ut.utils.setDisabled(this.#qi,t)}isButtonDisabled(t){return!(!this.#K.get("isReadOnly")||!Ut.utils.arrayIncludes(this.#qi,t))}_updatePlaceholder(t){t||=this.#K;const e=t.get("placeholder");if(e){if(t.get("isCodeView"))return void(e.style.display="none");this.#X.facade.isEmpty(t)?e.style.display="block":e.style.display="none"}}_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)ci.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>Zt.get(t)?"auto":"no")}Dt.isResizeObserverSupported||this._emitResizeEvent(t,s,null)}),0);else if(!Dt.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+Zt.get(t.get("wwComputedStyle").getPropertyValue("padding-left"))+Zt.get(t.get("wwComputedStyle").getPropertyValue("padding-right")):e,t.get("_editorHeight")!==e&&(this.#js.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.#Oi=!this.#js.addEvent(this.alertModal.querySelector('[data-command="close"]'),"click",this.alertClose.bind(this)),this._initToggleButtons()}#Ki(t){const e=Ut.query.getEventTarget(t);(/close/.test(e.getAttribute("data-command"))||e===this.#Ii)&&this.alertClose()}#ji(t){Gt.isEsc(t.code)&&this.alertClose()}_destroy(){this.#Di&&ci.clearTimeout(this.#Di),this.#Pi&&=this.#js.removeGlobalEvent(this.#Pi),this.#Ri&&=this.#js.removeEvent(this.#Ri),this.opendModal=null,this.opendBrowser=null,this.#Zi=null,this.#Gi=null,this.#qi=null,this.#Wi=null}};function ui(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(ct(c.s.path,c.frame),c.s.offset,ct(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 w(t,e,s,i){let n,o;e?(n={path:ht(e.startContainer,null,null),offset:e.startOffset},o={path:ht(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 C(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])||C(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),w(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){w(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++)C(t[e])},resetButtons(t,s){const i=!Zt.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:pi}=Dt;const gi=class{#F;#X;#t;#Ji;#Qi;#e;#K;#it;#js;#tn;#en;#sn;#in="default";#nn=null;#on=null;#ln=!1;#rn=!1;constructor(t,{keyName:e,balloon:s,inline:i,balloonAlways:n,res:o}){this.#F=t,this.#X=t.$,this.#t=t.store,this.#Ji=this.#X.icons,this.#Qi=this.#X.lang,this.#e=this.#X.context,this.#K=this.#X.frameContext,this.#it=this.#X.options,this.#js=this.#X.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.#tn=o,this.#en=o,this.#sn="visualViewport"in pi;const l=!this.isSub&&!s&&!i,r=this.#it.get("toolbar_sticky");if(this.#ln=l&&r>=0&&!this.#it.get("toolbar_container")&&"undefined"!=typeof CSS&&CSS.supports("position","sticky"),this.isBottomMode=this.#t.mode.isBottom,this.#ln){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&&Ut.utils.addClass(this.#e.get(this.keyName.main),"se-toolbar-relative");this._setResponsive()}get isSticky(){if(this.isSub)return!1;const t=this.#it.get("toolbar_sticky");if(t<0)return!1;if(this.#ln){const e=this.#e.get(this.keyName.main);return!(!e||0===e.offsetWidth||"none"===e.style.display)&&(this.isBottomMode?e.getBoundingClientRect().bottom>=pi.innerHeight-t-1:e.getBoundingClientRect().top<=t+1)}return this.#rn}get isCSSSticky(){return this.#ln}disable(){this._moreLayerOff(),this.#X.menu.dropdownOff(),this.#X.menu.containerOff(),Ut.utils.setDisabled(this.#e.get(this.keyName.buttonTray).querySelectorAll(".se-menu-list .se-toolbar-btn[data-type]"),!0)}enable(){Ut.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.#K.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.#K.get("_stickyDummy").style.display="none"),this.isBalloonMode&&(this.balloonOffset={top:0,left:0}))}resetResponsiveToolbar(){this.#X.menu.containerOff();const t=this.#on;if(t){let e=0;e=(this.isBalloonMode||this.isInlineMode)&&"auto"===this.#it.get("toolbar_width")||this.#t.mode.isSubBalloon&&"auto"===this.#it.get("toolbar_sub_width")?this.#K.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.#in!==s&&(this.#in=s,this.setButtons(this.#nn[s]))}}setButtons(t){this._moreLayerOff(),this.#X.menu.dropdownOff(),this.#X.menu.containerOff();const e=be(t,this.#X.plugins,this.#it,this.#Ji,this.#Qi,!0);e.updateButtons.forEach((t=>ve(t.button,t.plugin,this.#Ji,this.#Qi))),this.#e.get(this.keyName.main).replaceChild(e.buttonTray,this.#e.get(this.keyName.buttonTray)),this.#e.set(this.keyName.buttonTray,e.buttonTray),this.#an(),this.#js.triggerEvent("onSetToolbarButtons",{buttonTray:e.buttonTray,frameContext:this.#K})}_resetSticky(){if(this.#ln)return;const t=this.#K.get("wrapper");if(!t)return;const e=this.#e.get(this.keyName.main),s=this.#it.get("toolbar_sticky");if(this.#K.get("isFullScreen")||0===e.offsetWidth||s<0)return;const i=this.#sn?pi.visualViewport.pageTop:pi.scrollY,n=this.#K.get("_minHeight"),o=t.offsetHeight,l=this.#X.offset.getGlobal(this.#K.get("topArea"));if(this.isBottomMode){const t=i+pi.innerHeight,r=l.top+o,a=t-s-(this.isInlineMode?e.offsetHeight:0),h=this.#it.get("toolbar_container")?t-s-l.top-n-e.offsetHeight:a-l.top-n;a>r?this.#hn():h<0?(this.isSticky||this.#cn(1),e.style.bottom=1+h+this.#dn()+"px",e.style.top="auto"):this.#cn(1)}else{const t=i+s,r=(this.isBalloonMode||this.isInlineMode?l.top:this.#X.offset.getGlobal(this.#it.get("toolbar_container")).top)-(this.isInlineMode?e.offsetHeight:0),a=this.#it.get("toolbar_container")?l.top-i+o-n-s-e.offsetHeight:o+r+s-t-n;t<r?this.#hn():a<0?(this.isSticky||this.#cn(1),e.style.top=1+a+this.#dn()+"px"):this.#cn(1)}}#an(){this.#X.shortcuts._registerShortcuts(),this.#X.commandDispatcher.resetTargets(),this.#X.ui._initToggleButtons(),this.#X.history.resetButtons(this.#K.get("key"),null),this._resetSticky(),this.#t.set("_lastSelectionNode",null),this.#X.viewer._setButtonsActive(),this.#t.get("hasFocus")&&this.#F._eventOrchestrator.applyTagEffect(),this.#K.get("isReadOnly")&&this.#X.ui.setControllerOnDisabledButtons(!0)}_setResponsive(){if(0===this.#en?.length)return void(this.#en=null);this.#in="default";const t=this.#on=[],e=this.#tn,s=this.#nn={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.#X.selection.getRange(),s=this.#e.get(this.keyName.main),i=this.#X.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=Ut.query.getListChildNodes(e.commonAncestorContainer,null,null);n=Ut.utils.getArrayIndex(t,i.focusNode)<Ut.utils.getArrayIndex(t,i.anchorNode)}this._setBalloonOffset(n,e),this.#js.triggerEvent("onShowToolbar",{toolbar:s,mode:"balloon",frameContext:this.#K})}_setBalloonOffset(t,e){const s=this.#e.get(this.keyName.main),i=this.#K.get("topArea"),n=this.#X.offset.getGlobal(i).top;if(!this.#X.offset.setRangePosition(s,e,{position:t?"top":"bottom",addTop:n}))return void this.hide();if(this.#it.get("toolbar_container")){const t=i.parentElement;let e=this.#it.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.#X.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.#hn(),t.style.top="0px",this.inlineToolbarAttr.width=t.style.width=this.#it.get(this.keyName.width),this.isBottomMode){const e=this.#K.get("topArea");this.inlineToolbarAttr.top=t.style.top=this.#X.offset.getGlobal(e).top+e.offsetHeight-this.#X.offset.getGlobal(t).top+"px"}else this.inlineToolbarAttr.top=t.style.top=this.#X.offset.getGlobal(this.#K.get("topArea")).top-this.#X.offset.getGlobal(t).top-t.offsetHeight-1+"px";this._resetSticky(),this.inlineToolbarAttr.isShow=!0,this.#js.triggerEvent("onShowToolbar",{toolbar:t,mode:"inline",frameContext:this.#K}),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",Ut.utils.removeClass(this.currentMoreLayerActiveButton,"on"),this.currentMoreLayerActiveButton=null}}#cn(t){const e=this.#e.get(this.keyName.main);if(!this.isInlineMode){const t=this.#it.get("toolbar_container")?this.#e.get("_stickyDummy"):this.#K.get("_stickyDummy");t.style.height=e.offsetHeight+"px",t.style.display="block"}if(this.isBottomMode){const t=this.#it.get("toolbar_sticky")+this.#dn();e.style.bottom=`${t}px`,e.style.top="auto"}else{const s=this.#it.get("toolbar_sticky")+t+this.#dn();e.style.top=`${s}px`}e.style.width=this.isInlineMode?this.inlineToolbarAttr.width:e.offsetWidth+"px",Ut.utils.addClass(e,"se-toolbar-sticky"),this.#rn=!0}#dn(){return this.#sn?pi.visualViewport.offsetTop:0}#hn(){(this.#it.get("toolbar_container")?this.#e.get("_stickyDummy"):this.#K.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.#K.get("wrapper").style.marginBottom=""):(t.style.top=this.isInlineMode?this.inlineToolbarAttr.top:"",this.#K.get("wrapper").style.marginTop=""),t.style.width=this.isInlineMode?this.inlineToolbarAttr.width:"",Ut.utils.removeClass(t,"se-toolbar-sticky"),this.#rn=!1}_destroy(){this._moreLayerOff()}};function mi(t){return/free$/.test(t)}const fi=class{#X;#t;#Gs;#e;#js;#un;#pn=[];#gn=null;#mn=null;#fn=null;#vn=null;#bn=null;#yn=null;#wn=null;constructor(t){this.#X=t.$,this.#t=t.store,this.#Gs=this.#X.contextProvider,this.#e=this.#X.context,this.#js=this.#X.eventManager,this.targetMap={},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.#un={mousedown:this.#Cn.bind(this),containerDown:this.containerOff.bind(this),keydown:this.#_n.bind(this),mousemove:this.#xn.bind(this),mouseout:this.#$n.bind(this)},this.#gn=null,this.#mn=null,this.#fn=null,this.#yn=null,this.#wn=null}initDropdownTarget({key:t,type:e},s){if(!t)throw Error("[SUNEDITOR.init.fail] The plugin's key is not added.");mi(e)||(s.setAttribute("data-key",t),this.#pn.push(t)),this.#e.get("menuTray").appendChild(s),this.targetMap[t]=s}dropdownOn(t){this.#Oe();const e=this.#kn(t);if(e){const s=Ut.query.getParentElement(e,".se-btn-tray").querySelector('[data-command="'+e.getAttribute("data-ref")+'"]');if(s)return this.#X.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,this.#Sn(s,n),this.#gn=this.#js.addGlobalEvent("mousedown",this.#un.mousedown,!1),this.#pn.includes(i)&&(this.menus=Wt.nodeListToArray(n.querySelectorAll("[data-command]")),this.menus.length>0&&(this.#mn=this.#js.addGlobalEvent("keydown",this.#un.keydown,!1),this.#vn=this.#js.addEvent(n,"mousemove",this.#un.mousemove,!1),this.#bn=this.#js.addEvent(n,"mouseout",this.#un.mouseout,!1))),this.currentDropdownPlugin=this.#X.plugins[i],this.currentDropdownPlugin?.on(s),this.#t.set("_preventBlur",!0)}dropdownOff(){this.#Oe(),mi(this.currentDropdownType)&&this.currentDropdownPlugin?.off?.(),this.index=-1,this.menus=[],this.#yn=null,this.#wn=null,this.currentButton=null,this.currentDropdown&&(this.currentDropdownName="",this.currentDropdownType="",this.currentDropdown.style.display="none",this.currentDropdown=null,this.currentDropdownActiveButton&&Ut.utils.removeClass(this.currentDropdownActiveButton.parentElement.children,"on"),this.currentDropdownActiveButton=null,this.#X.ui.preventToolbarHide(!1)),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.#Oe(),this.currentContainerActiveButton=t;const e=this.currentContainerName=this.currentContainerActiveButton.getAttribute("data-command");this.#Sn(t,this.currentContainer=this.targetMap[e]),this.#fn=this.#js.addGlobalEvent("mousedown",this.#un.containerDown,!1),this.#X.plugins[e].on&&this.#X.plugins[e].on(t),this.#t.set("_preventBlur",!0)}containerOff(){this.#Oe(),this.currentContainer&&(this.currentContainerName="",this.currentContainer.style.display="none",this.currentContainer=null,Ut.utils.removeClass(this.currentContainerActiveButton,"on"),this.currentContainerActiveButton=null,this.#X.ui.preventToolbarHide(!1)),this.#t.set("_preventBlur",!1)}__resetMenuPosition(t,e){this.#X.offset.setRelPosition(e,this.#Gs.carrierWrapper,t.parentElement,Ut.query.getParentElement(t,".se-toolbar"),{preferUp:this.#t.mode.isBottom})}__restoreMenuPosition(){this.#yn&&this.#wn&&this.#Sn(this.#yn,this.#wn)}#Sn(t,e){e.style.visibility="hidden",e.style.display="block",e.style.height="",Ut.utils.addClass(t.parentElement.children,"on"),this.#X.offset.setRelPosition(e,this.#Gs.carrierWrapper,t.parentElement,Ut.query.getParentElement(t,".se-toolbar"),{preferUp:this.#t.mode.isBottom}),e.style.visibility="",this.#yn=t,this.#wn=e}#kn(t){const e=Ut.query.getParentElement(t,".se-more-layer");return e&&"block"!==e.style.display&&e.getAttribute("data-ref")?e:null}#cs(t){Ut.utils.removeClass(this.currentDropdown,"se-select-menu-mouse-move"),Ut.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?Ut.utils.addClass(this.menus[t],"on"):Ut.utils.removeClass(this.menus[t],"on")}#Oe(){this.#gn&&=this.#js.removeGlobalEvent(this.#gn),this.#fn&&=this.#js.removeGlobalEvent(this.#fn),this.#mn&&(this.#mn=this.#js.removeGlobalEvent(this.#mn),this.#vn&&=this.#js.removeEvent(this.#vn),this.#bn&&=this.#js.removeEvent(this.#bn),Ut.utils.removeClass(this.menus,"on"),Ut.utils.removeClass(this.currentDropdown,"se-select-menu-key-action|se-select-menu-mouse-move"))}#Cn(t){const e=Ut.query.getEventTarget(t);Ut.query.getParentElement(e,".se-dropdown")||this.dropdownOff()}#$n(){this.index=-1}#_n(t){switch(t.code){case"ArrowUp":case"ArrowLeft":t.preventDefault(),t.stopPropagation(),this.#cs(-1);break;case"ArrowDown":case"ArrowRight":t.preventDefault(),t.stopPropagation(),this.#cs(1);break;case"Enter":case"Space":{if(this.index<0)break;const e=this.menus[this.index];if(!e||"function"!=typeof this.#X.plugins[this.currentDropdownName].action)return;t.preventDefault(),t.stopPropagation(),this.#X.plugins[this.currentDropdownName].action(e),this.dropdownOff();break}}}#xn(t){Ut.utils.addClass(this.currentDropdown,"se-select-menu-mouse-move"),Ut.utils.removeClass(this.currentDropdown,"se-select-menu-key-action");const e=this.menus.indexOf(t.target);-1!==e&&(this.index=1*e)}_destroy(){this.#Oe()}},{_w:vi,_d:bi}=Dt;function yi(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=vi.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 wi=class{#F;#X;#t;#Ji;#Qi;#A;#e;#K;#it;#J;#js;#Xt;#En="";#Tn="";#Mn="";#Hn="";#Ln="";#Nn="";#Bn="";#An="";#In="";#Vn="";#On="";#Rn=0;#zn=!1;#Fn=!1;#Pn=!1;#Dn=null;#qn="";constructor(t){this.#F=t,this.#X=t.$,this.#t=t.store,this.#Ji=this.#X.icons,this.#Qi=this.#X.lang,this.#A=this.#X.frameRoots,this.#e=this.#X.context,this.#K=this.#X.frameContext,this.#it=this.#X.options,this.#J=this.#X.frameOptions,this.#js=this.#X.eventManager,this.#Xt=new RegExp(`^(${this.#it.get("_disallowedExtraTag")})$`,"i")}codeView(t){const e=this.#K;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.#X.ui.offCurrentController(),this.#X.ui.offCurrentModal();const s=e.get("codeWrapper"),i=e.get("code"),n=e.get("wysiwygFrame"),o=e.get("wrapper");t?(this.#X.finder.close(),this.#Wn(),s.style.setProperty("display","flex","important"),n.style.display="none",e.get("isFullScreen")?i.style.height="100%":"auto"!==this.#J.get("height")||this.#it.get("hasCodeMirror")||(i.style.height=i.scrollHeight>0?i.scrollHeight+"px":"auto"),this.#it.get("hasCodeMirror")&&this._codeMirrorEditor("refresh",null,null),e.get("isFullScreen")||(this.#X.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.#X.toolbar.isInlineMode=!0,this.#t.mode.isBalloon=this.#X.toolbar.isBalloonMode=!1,this.#X.toolbar._showInline())),this.#t.mode.isBalloon&&this.#X.subToolbar.hide(),yi(e),this.#t.set("_range",null),i.focus(),Ut.utils.addClass(this.#X.commandDispatcher.targets.get("codeView"),"active"),Ut.utils.addClass(o,"se-source-view-status")):(Ut.check.isNonEditable(n)||this.#Un(),n.scrollTop=0,s.style.setProperty("display","none","important"),n.style.display="block","auto"!==this.#J.get("height")||this.#it.get("hasCodeMirror")||(e.get("code").style.height="0px"),e.get("isFullScreen")||(this.#X.ui.preventToolbarHide(!1),/balloon/.test(this.#it.get("mode"))&&(this.#e.get("toolbar_arrow").style.display="",this.#t.mode.isInline=this.#X.toolbar.isInlineMode=!1,this.#t.mode.isBalloon=this.#X.toolbar.isBalloonMode=!0,this.#F._eventOrchestrator._hideToolbar())),this.#X.focusManager.nativeFocus(),Ut.utils.removeClass(this.#X.commandDispatcher.targets.get("codeView"),"active"),Ut.check.isNonEditable(n)||(this.#X.history.push(!1),this.#X.history.resetButtons(e.get("key"),null)),Ut.utils.removeClass(o,"se-source-view-status")),this.#X.ui._updatePlaceholder(e),this.#X.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.#js.triggerEvent("onToggleCodeView",{frameContext:e,is:e.get("isCodeView")})}markdownView(t){const e=this.#K;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.#X.ui.offCurrentController(),this.#X.ui.offCurrentModal();const s=e.get("markdownWrapper"),i=e.get("markdown"),n=e.get("wysiwygFrame"),o=e.get("wrapper");t?(this.#X.finder.close(),this.#Zn(),s.style.setProperty("display","flex","important"),n.style.display="none",e.get("isFullScreen")?i.style.height="100%":"auto"===this.#J.get("height")&&(i.style.height=i.scrollHeight>0?i.scrollHeight+"px":"auto"),e.get("isFullScreen")||(this.#X.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.#X.toolbar.isInlineMode=!0,this.#t.mode.isBalloon=this.#X.toolbar.isBalloonMode=!1,this.#X.toolbar._showInline())),this.#t.mode.isBalloon&&this.#X.subToolbar.hide(),yi(e,"markdown"),this.#t.set("_range",null),i.focus(),Ut.utils.addClass(this.#X.commandDispatcher.targets.get("markdownView"),"active"),Ut.utils.addClass(o,"se-source-view-status")):(Ut.check.isNonEditable(n)||this.#Gn(),n.scrollTop=0,s.style.setProperty("display","none","important"),n.style.display="block","auto"===this.#J.get("height")&&(i.style.height="0px"),e.get("isFullScreen")||(this.#X.ui.preventToolbarHide(!1),/balloon/.test(this.#it.get("mode"))&&(this.#e.get("toolbar_arrow").style.display="",this.#t.mode.isInline=this.#X.toolbar.isInlineMode=!1,this.#t.mode.isBalloon=this.#X.toolbar.isBalloonMode=!0,this.#F._eventOrchestrator._hideToolbar())),this.#X.focusManager.nativeFocus(),Ut.utils.removeClass(this.#X.commandDispatcher.targets.get("markdownView"),"active"),Ut.check.isNonEditable(n)||(this.#X.history.push(!1),this.#X.history.resetButtons(e.get("key"),null)),Ut.utils.removeClass(o,"se-source-view-status")),this.#X.ui._updatePlaceholder(e),this.#X.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.#js.triggerEvent("onToggleMarkdownView",{frameContext:e,is:e.get("isMarkdownView")})}fullScreen(t){const e=this.#K;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.#K.get("isCodeView"),p=this.#K.get("isMarkdownView"),g=this.#e.get("toolbar_arrow");this.#X.ui.offCurrentController();const m="none"===i.style.display||this.#t.mode.isInline&&!this.#X.toolbar.inlineToolbarAttr.isShow;if(t){this.#qn=s.style.cssText,this.#Tn=n.style.cssText,this.#Mn=o.style.cssText,this.#Hn=l.style.cssText,this.#Ln=r.style.cssText,this.#Nn=a?.style.cssText,this.#Bn=h?.style.cssText,this.#An=c?.style.cssText,this.#In=d?.style.cssText,this.#Vn=i.style.cssText,g&&(this.#On=g.style.cssText),(this.#t.mode.isBalloon||this.#t.mode.isInline)&&(g&&(g.style.display="none"),this.#Pn=this.#t.mode.isInline,this.#Fn=this.#t.mode.isBalloon,this.#t.mode.isInline=this.#X.toolbar.isInlineMode=!1,this.#t.mode.isBalloon=this.#X.toolbar.isBalloonMode=!1),this.#it.get("toolbar_container")&&(this.#Dn=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.#zn=!0,e.get("_stickyDummy").style.display="none",Ut.utils.removeClass(i,"se-toolbar-sticky")),this.#En=bi.body.style.overflow,bi.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.#J.get("_defaultStyles").editor+(u||p?"display: none;":""),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.#Rn=vi.innerHeight-i.offsetHeight,n.style.height=this.#Rn-(e.has("statusbar")?e.get("statusbar").offsetHeight:0)-this.#it.get("fullScreenOffset")+"px",this.#J.get("iframe")&&"auto"===this.#J.get("height")&&(n.style.overflow="auto",this.#X.ui._iframeAutoHeight(e)),e.get("topArea").style.marginTop=this.#it.get("fullScreenOffset")+"px";const t=this.#Ji.reduction;this.#X.commandDispatcher.applyTargets("fullScreen",(e=>{Ut.utils.changeElement(e.firstElementChild,t),Ut.utils.addClass(e,"active")}))}else{o.style.cssText=this.#Mn.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+(u||p?"display: none;":""),l.style.cssText=this.#Hn.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+`display: ${u?"flex":"none"} !important;`,r.style.cssText=this.#Ln,a&&(a.style.cssText=this.#Nn),h&&(h.style.cssText=this.#Bn.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+`display: ${p?"flex":"none"} !important;`),c&&(c.style.cssText=this.#An),d&&(d.style.cssText=this.#In),i.style.cssText=this.#Vn,n.style.cssText=this.#Tn,s.style.cssText=this.#qn,g&&(g.style.cssText=this.#On),bi.body.style.overflow=this.#En,"auto"!==this.#J.get("height")||this.#it.get("hasCodeMirror")||this._codeViewAutoHeight(e.get("code"),e.get("codeNumbers"),!0),this.#Dn&&(this.#Dn.appendChild(i),this.#Dn=null),this.#it.get("toolbar_sticky")>-1&&Ut.utils.removeClass(i,"se-toolbar-sticky"),this.#zn&&!this.#it.get("toolbar_container")&&(this.#zn=!1,e.get("_stickyDummy").style.display="block",Ut.utils.addClass(i,"se-toolbar-sticky")),this.#t.mode.isInline=this.#X.toolbar.isInlineMode=this.#Pn,this.#t.mode.isBalloon=this.#X.toolbar.isBalloonMode=this.#Fn,e.get("isCodeView")||(this.#t.mode.isInline?this.#X.toolbar._showInline():this.#t.mode.isBalloon&&this.#X.toolbar._showBalloon()),this.#X.toolbar._resetSticky(),e.get("topArea").style.marginTop="";const t=this.#Ji.expansion;this.#X.commandDispatcher.applyTargets("fullScreen",(e=>{Ut.utils.changeElement(e.firstElementChild,t),Ut.utils.removeClass(e,"active")}))}!m||e.get("isCodeView")||e.get("isMarkdownView")||this.#X.toolbar.hide(),this.#js.triggerEvent("onToggleFullScreen",{frameContext:e,is:e.get("isFullScreen")})}showBlocks(t){const e=this.#K;void 0===t&&(t=!e.get("isShowBlocks")),e.set("isShowBlocks",!!t),t?(Ut.utils.addClass(e.get("wysiwyg"),"se-show-block"),Ut.utils.addClass(this.#X.commandDispatcher.targets.get("showBlocks"),"active")):(Ut.utils.removeClass(e.get("wysiwyg"),"se-show-block"),Ut.utils.removeClass(this.#X.commandDispatcher.targets.get("showBlocks"),"active")),this.#X.ui._syncFrameState(e)}_setButtonsActive(){const t=this.#K;if(t.get("isCodeView")?Ut.utils.addClass(this.#X.commandDispatcher.targets.get("codeView"),"active"):Ut.utils.removeClass(this.#X.commandDispatcher.targets.get("codeView"),"active"),t.get("isFullScreen")){const t=this.#Ji.reduction;this.#X.commandDispatcher.applyTargets("fullScreen",(e=>{Ut.utils.changeElement(e.firstElementChild,t),Ut.utils.addClass(e,"active")}))}else{const t=this.#Ji.expansion;this.#X.commandDispatcher.applyTargets("fullScreen",(e=>{Ut.utils.changeElement(e.firstElementChild,t),Ut.utils.removeClass(e,"active")}))}t.get("isMarkdownView")?Ut.utils.addClass(this.#X.commandDispatcher.targets.get("markdownView"),"active"):Ut.utils.removeClass(this.#X.commandDispatcher.targets.get("markdownView"),"active"),t.get("isShowBlocks")?Ut.utils.addClass(this.#X.commandDispatcher.targets.get("showBlocks"),"active"):Ut.utils.removeClass(this.#X.commandDispatcher.targets.get("showBlocks"),"active")}print(){const t=Ut.utils.createElement("IFRAME",{style:"display: none;"});bi.body.appendChild(t);const e=vi.getComputedStyle(this.#K.get("wysiwyg")).padding,s=this.#it.get("printTemplate")?this.#it.get("printTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.#X.html.get()):this.#X.html.get(),i=Ut.query.getIframeDocument(t),n=this.#K.get("_wd"),o=this.#it.get("_rtl")?" se-rtl":"",l=`\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.#J.get("iframe")){const t=this.#it.get("printClass")?'class="'+this.#it.get("printClass")+o+'"':this.#J.get("iframe_fullPage")?Ut.utils.getAttributesToString(n.body,["contenteditable"]):'class="'+this.#it.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${l}\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=bi.head.getElementsByTagName("link"),e=bi.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${l}\n\t\t\t\t\t</head>\n\t\t\t\t\t<body class="${(this.#it.get("printClass")||this.#it.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.#X.ui.showLoading(),vi.setTimeout((()=>{try{if(t.focus(),Dt.isEdge||Dt.isChromium||"StyleMedia"in Dt._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.#X.ui.hideLoading(),Ut.utils.removeItem(t)}}),1e3)}preview(){this.#X.menu.dropdownOff(),this.#X.menu.containerOff(),this.#X.ui.offCurrentController(),this.#X.ui.offCurrentModal();const t=this.#it.get("previewTemplate")?this.#it.get("previewTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.#X.html.get({withFrame:!0})):this.#X.html.get({withFrame:!0}),e=vi.open("","_blank"),s=this.#K.get("_wd"),i=this.#it.get("_rtl")?" se-rtl":"";if(this.#J.get("iframe")){const n=this.#it.get("printClass")?'class="'+this.#it.get("printClass")+i+'"':this.#J.get("iframe_fullPage")?Ut.utils.getAttributesToString(s.body,["contenteditable"]):'class="'+this.#it.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=bi.head.getElementsByTagName("link"),n=bi.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.#Qi.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.#it.get("printClass")?this.#it.get("printClass"):this.#it.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.#K.get("isFullScreen"))return this.#Rn+=vi.innerHeight-this.#e.get("toolbar_main").offsetHeight-(this.#K.has("statusbar")?this.#K.get("statusbar").offsetHeight:0)-this.#Rn,this.#K.get("wrapper").style.height=this.#Rn+"px",!0}_codeMirrorEditor(t,e,s){const i=s?this.#A.get(s).get("options"):this.#J;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.#it.get("hasCodeMirror")?this._codeMirrorEditor("set",t,null):this.#K.get("code").value=t}_getCodeView(){return this.#it.get("hasCodeMirror")?this._codeMirrorEditor("get",null,null):this.#K.get("code").value}_codeViewAutoHeight(t,e,s){s&&(t.style.height=t.scrollHeight+"px"),this.#jn(e,t)}_scrollLineNumbers(t){t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft}_markdownViewAutoHeight(t,e,s){s&&(t.style.height=t.scrollHeight+"px"),this.#jn(e,t)}_scrollMarkdownLineNumbers(t){t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft}#Un(){const t=this._getCodeView();if(this.#J.get("iframe_fullPage")){const e=this.#K.get("_wd"),s=(new DOMParser).parseFromString(t,"text/html");if(!this.#Xt.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.#J.get("height")||s.head.querySelector("style"))||(i+=Wt._setIframeStyleLinks(this.#J.get("iframe_cssFileName"))+Wt._setAutoHeightStyle(this.#J.get("height"))),e.head.innerHTML=i,e.body.innerHTML=this.#X.html.clean(s.body.innerHTML,{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.#it.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(!Ut.utils.hasClass(e.body,"sun-editor-editable")){const t=this.#it.get("_editableClass").split(" ");for(let s=0;s<t.length;s++)Ut.utils.addClass(e.body,t[s])}}else this.#K.get("wysiwyg").innerHTML=t.length>0?this.#X.html.clean(t,{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.#it.get("freeCodeViewMode")}):"<"+this.#it.get("defaultLine")+"><br></"+this.#it.get("defaultLine")+">"}#Wn(){const t=this.#X.html._convertToCode(this.#K.get("wysiwyg"),!1);let e="";if(this.#J.get("iframe_fullPage")){const s=Ut.utils.getAttributesToString(this.#K.get("_wd").body,null);e="<!DOCTYPE html>\n<html>\n"+this.#K.get("_wd").head.outerHTML.replace(/>(?!\n)/g,">\n")+"<body "+s+">\n"+t+"</body>\n</html>"}else e=t;this._setCodeView(e)}#Zn(){const t=Wt.htmlToJson(this.#K.get("wysiwyg").innerHTML),e=Kt.jsonToMarkdown(t);this.#K.get("markdown").value=e}#Gn(){const t=this.#K.get("markdown").value,e=Kt.markdownToHtml(t,this.#it.get("defaultLine"));this.#K.get("wysiwyg").innerHTML=e.length>0?this.#X.html.clean(e,{forceFormat:!0,whitelist:null,blacklist:null}):"<"+this.#it.get("defaultLine")+"><br></"+this.#it.get("defaultLine")+">"}#jn(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:Ci,_w:_i}=Dt;class xi{#X;#t;#Kn;#Yn;#Xn;#Jn;#Qn;#to;#eo;#so;#io;#no;#oo;#lo;#ro=!1;#ao=!0;#ho=[];#co=-1;#do="";#uo={matchCase:!1,wholeWord:!1,regex:!1};#po;#go=[];#mo=null;#fo=null;#vo=null;#bo=null;#yo=null;#wo=!1;static#Co=!1;static#_o(){if(xi.#Co)return;xi.#Co=!0;const t=Ci.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}",Ci.head.appendChild(t)}constructor(t){if(this.#X=t.$,this.#t=t.store,this.#po=!!_i.Highlight&&!!CSS?.highlights,this.#X.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(${Dt.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=Ut.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.#X);this.#Kn=t.panel,this.#Yn=t.findInput,this.#Xn=t.replaceInput,this.#Jn=t.countDisplay,this.#Qn=t.replaceRow,this.#to=t.btnCase,this.#eo=t.btnWord,this.#so=t.btnRegex,this.#io=t.btnPrev,this.#no=t.btnNext,this.#oo=t.btnReplace,this.#lo=t.btnReplaceAll,this.#xo();const e=this.#X.frameRoots.values().next().value.get("container");if(this.#t.mode.isBottom){const t=this.#X.context.get("toolbar_main");e.insertBefore(this.#Kn,t)}else{const t=e.querySelector(".se-wrapper");e.insertBefore(this.#Kn,t)}Dt.isResizeObserverSupported&&(this.#vo=new ResizeObserver((()=>this.#$o())).observe(this.#X.context.get("toolbar_main")))}}get isOpen(){return this.#ro}open(t=!0){const e=this.#X.frameContext;if(!e.get("isCodeView")&&!e.get("isMarkdownView")&&(this.#ro=!0,this.#ko(),this.#Kn)){this.#io.disabled=!0,this.#no.disabled=!0,this.#oo.disabled=!0,this.#lo.disabled=!0,this.#$o();const e=this.#X.selection.get(),s=e&&!e.isCollapsed?e.toString().trim():"";Ut.utils.addClass(this.#Kn,"se-find-replace-open"),this.#t.set("_preventBlur",!0),this.#So(),t&&this.#Eo(t),s&&(this.#Yn.value=s),this.#Yn.focus(),this.#Yn.select(),this.#Yn.value&&this.#To()}}#$o(){if(!this.#ro||!this.#Kn)return;const t=this.#X.options.get("toolbar_sticky");this.#t.mode.isBottom?(this.#Kn.style.top="auto",this.#Kn.style.bottom=t>=0?t+this.#X.context.get("toolbar_main").offsetHeight+"px":"0px"):this.#Kn.style.top=t>=0?t+this.#X.context.get("toolbar_main").offsetHeight+"px":"0px"}close(){this.#ro&&(this.#ro=!1,this.#Mo(),this.#ho=[],this.#co=-1,this.#Ho(),this.#Lo(),this.#Kn&&(Ut.utils.removeClass(this.#Kn,"se-find-replace-open"),this.#No(),this.#t.set("_preventBlur",!1),this.#X.focusManager.nativeFocus()))}findNext(){this.#ro&&0!==this.#ho.length&&(this.#co=(this.#co+1)%this.#ho.length,this.#Bo())}findPrev(){this.#ro&&0!==this.#ho.length&&(this.#co=(this.#co-1+this.#ho.length)%this.#ho.length,this.#Bo())}search(t,{matchCase:e,wholeWord:s,regex:i}={}){return this.#ro||this.open(),void 0!==e&&(this.#uo.matchCase=e),void 0!==s&&(this.#uo.wholeWord=s),void 0!==i&&(this.#uo.regex=i),this.#do=t||"",this.#Yn&&(this.#Yn.value=this.#do),this.#To(),this.#ho.length}replace(t){this.#Ao(t)}replaceAll(t){this.#Io(t)}get matchInfo(){return{current:this.#co+1,total:this.#ho.length}}refresh(){this.#ro&&this.#do&&!this.#wo&&(this.#wo=!0,this.#Vo(),this.#go=[],this.#wo=!1,clearTimeout(this.#fo),this.#fo=setTimeout((()=>this.#To()),300))}#So(){this.#No(),this.#bo=this.#X.eventManager.addGlobalEvent("keydown",(t=>{"Escape"===t.key&&(t.preventDefault(),t.stopPropagation(),this.close())}),!0)}#No(){this.#bo&&=this.#X.eventManager.removeGlobalEvent(this.#bo)}#ko(){this.#Lo();const t=this.#X.frameContext.get("wysiwyg");this.#yo=new MutationObserver((()=>this.refresh())),this.#yo.observe(t,{childList:!0,subtree:!0,characterData:!0})}#Lo(){this.#yo&&(this.#yo.disconnect(),this.#yo=null)}#xo(){const t=this.#X.eventManager;t.addEvent(this.#Yn,"input",this.#Oo.bind(this)),t.addEvent(this.#Yn,"keydown",this.#Ro.bind(this)),t.addEvent(this.#Xn,"keydown",this.#zo.bind(this)),t.addEvent(this.#Kn,"click",this.#Fo.bind(this)),Dt.isGecko&&t.addEvent(this.#Kn,"mousedown",(t=>{if("BUTTON"===t.target.tagName){t.preventDefault();const e=Ut.query.getCommandTarget(t.target);e&&this.#X.eventManager._injectActiveEvent(e)}this.#t.set("_preventBlur",!0)}))}#Oo(){this.#X.options.get("finder_liveSearch")&&(clearTimeout(this.#fo),this.#fo=setTimeout((()=>this.#To()),120))}#Ro(t){"Escape"===t.key?(t.preventDefault(),this.close()):"Enter"===t.key&&(t.preventDefault(),this.#X.options.get("finder_liveSearch")||this.#Yn.value===this.#do?t.shiftKey?this.findPrev():this.findNext():this.#To())}#zo(t){"Escape"===t.key?(t.preventDefault(),this.close()):"Enter"===t.key&&(t.preventDefault(),this.#Ao())}#Fo(t){const e=Ut.query.getEventTarget(t),s=Ut.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.#Eo(!this.#ao);break;case"close":this.close();break;case"replace":this.#Ao();break;case"replace-all":this.#Io();break;case"opt-case":this.#uo.matchCase=!this.#uo.matchCase,Ut.utils.toggleClass(this.#to,"on",this.#uo.matchCase),this.#To();break;case"opt-word":this.#uo.wholeWord=!this.#uo.wholeWord,Ut.utils.toggleClass(this.#eo,"on",this.#uo.wholeWord),this.#To();break;case"opt-regex":this.#uo.regex=!this.#uo.regex,Ut.utils.toggleClass(this.#so,"on",this.#uo.regex),this.#To()}}#Eo(t){this.#ao=t,this.#Qn.style.display=t?"":"none",Ut.utils.toggleClass(this.#Kn.querySelector(".se-find-toggle-replace"),"on",t),t&&this.#Xn.focus()}#To(){const t=this.#Yn?this.#Yn.value:this.#do;if(this.#wo=!0,this.#Mo(),this.#ho=[],this.#co=-1,!t)return this.#do="",this.#Ho(),void Ut.utils.removeClass(this.#Yn,"se-find-no-match");this.#do=t;const e=this.#X.frameContext.get("wysiwyg");this.#mo=this.#Po(),this.#ho=this.#Do(t,e),this.#ho.length>0?(this.#co=0,this.#qo(),this.#Bo(),Ut.utils.removeClass(this.#Yn,"se-find-no-match")):this.#Yn&&Ut.utils.toggleClass(this.#Yn,"se-find-no-match",t.length>0),this.#Ho(),this.#wo=!1}#Do(t,e){const s=[];if(!t||!e)return s;const i=this.#uo.matchCase?"g":"gi";let n;if(this.#uo.regex)try{n=new RegExp(t,i)}catch{return s}else{const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=this.#uo.wholeWord?new RegExp(`\\b${e}\\b`,i):new RegExp(e,i)}const o=this.#mo,l=this.#X.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}#qo(){if(0===this.#ho.length)return;const t=this.#X.frameContext.get("options").get("iframe");this.#po&&!t?this.#Wo():this.#Uo()}#Wo(){xi.#_o();const t=new Highlight(...this.#ho);CSS.highlights.set("se-find-match",t),this.#Zo()}#Zo(){if(this.#co>=0&&this.#co<this.#ho.length){const t=new Highlight(this.#ho[this.#co]);CSS.highlights.set("se-find-current",t)}else CSS.highlights.delete("se-find-current")}#Uo(){this.#Vo();const t=this.#mo;for(let e=this.#ho.length-1;e>=0;e--){const s=this.#ho[e],i=this.#Go(t,s,e);for(let t=0;t<i.length;t++)this.#go.push(i[t])}this.#go.reverse(),this.#jo()}#Go(t,e,s){const i=e.startContainer,n=e.endContainer,o=[];if(i===n)o.push(this.#Ko(t,i,e.startOffset,e.endOffset,s));else{const l=[i];let r=i;for(;r&&r!==n;)r=this.#Yo(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.#Ko(t,a,h,c,s))}}return o}#Ko(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}#Yo(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}#jo(){for(const t of this.#go)Ut.utils.removeClass(t,"se-find-current");if(this.#co>=0)for(const t of this.#go)t.getAttribute("data-se-find-idx")===String(this.#co)&&Ut.utils.addClass(t,"se-find-current")}#Mo(){const t=this.#X.frameContext.get("options").get("iframe");this.#po&&!t&&(CSS.highlights.delete("se-find-match"),CSS.highlights.delete("se-find-current")),this.#Vo()}#Vo(){const t=this.#X.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.#go=[]}}#Bo(){if(this.#co<0||this.#co>=this.#ho.length)return;const t=this.#X.frameContext.get("options").get("iframe");if(this.#po&&!t){this.#Zo();const t=this.#ho[this.#co];this.#X.selection.scrollTo(t,{behavior:"auto"})}else{this.#jo();const t=this.#go.find((t=>t.getAttribute("data-se-find-idx")===String(this.#co)));t&&this.#X.selection.scrollTo(t,{behavior:"auto",noFocus:!0})}this.#Ho()}#Ao(t){if(this.#co<0||0===this.#ho.length)return;this.#Mo();const e=this.#X.frameContext.get("wysiwyg"),s=this.#Do(this.#do,e);this.#co>=s.length||(this.#Xo(s[this.#co],t??(this.#Xn?this.#Xn.value:"")),this.#X.history.push(!1),this.#To(),this.#co>=this.#ho.length&&this.#ho.length>0&&(this.#co=0,this.#Bo()))}#Io(t){if(0===this.#ho.length)return;this.#Mo();const e=this.#X.frameContext.get("wysiwyg"),s=this.#Do(this.#do,e);if(0!==s.length){t=t??(this.#Xn?this.#Xn.value:"");for(let e=s.length-1;e>=0;e--)this.#Xo(s[e],t);e.normalize(),this.#X.history.push(!1),this.#To()}}#Xo(t,e){const s=t.startContainer,i=this.#mo.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())}#Ho(){if(!this.#Kn)return;const t=this.#ho.length>0;this.#Jn.textContent=t?`${this.#co+1}/${this.#ho.length}`:this.#do?"0":"",this.#io.disabled=!t,this.#no.disabled=!t,this.#oo.disabled=!t,this.#lo.disabled=!t}#Po(){const t=this.#X.frameContext;return t.get("options").get("iframe")?t.get("_wd"):Ci}_destroy(){this.#No(),this.#Lo(),this.#vo&&=this.#vo.disconnect(),clearTimeout(this.#fo)}}const $i=xi;const ki=class{$;constructor(t){this.$=t.$}},{isMobile:Si,_w:Ei}=Dt;function Ti(t){const e=Ut.query.getEventTarget(t);let s=e;this.$.store.mode.isBalloon&&!this.$.context.get("toolbar_sub_main")?.contains(s)&&this._hideToolbar_sub();const i=Ut.check.isInputElement(s);if(i?this.$.store.set("_preventBlur",!1):this.$.frameContext.get("wysiwyg").contains(this.$.selection.getNode())||this.$.focusManager.focus(),Ut.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(),!Ut.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{Ei.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")||(Si?this.$.store.set("_preventBlur",!0):(t.preventDefault(),Dt.isGecko&&n&&this.$.eventManager._injectActiveEvent(s)))}n!==this.$.menu.currentDropdownName&&n!==this.$.menu.currentContainerName||t.stopPropagation()}}function Mi(t){const e=Ut.query.getEventTarget(t),s=Ut.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 Hi(t){const e=Ut.query.getEventTarget(t);this.$.commandDispatcher.runFromTarget(e)}const{_w:Li}=Dt;async function Ni(t,e){const s=Ut.query.getEventTarget(e);this.$.store.set("_mousedown",!0),this.__onDownEv&&Bi.call(this),this.__onDownEv=this.$.eventManager.addGlobalEvent("mouseup",Bi.bind(this)),t.get("isReadOnly")||Ut.check.isNonEditable(t.get("wysiwyg"))||(this.$.format._isExcludeSelectionElement(s)?e.preventDefault():(this._setSelectionSync(),Li.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 Bi(){this.$.store.set("_mousedown",!1),this.__onDownEv=this.$.eventManager.removeGlobalEvent(this.__onDownEv)}async function Ai(t,e){!1!==await this.$.eventManager.triggerEvent("onMouseUp",{frameContext:t,event:e})&&await this._callPluginEventAsync("onMouseUp",{frameContext:t,event:e})}async function Ii(t,e){const s=Ut.query.getEventTarget(e);if(t.get("isReadOnly"))return e.preventDefault(),Ut.check.isAnchor(s)&&Li.open(s.href,s.target),!1;if(Ut.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&&!Ut.check.isNonEditable(s)&&!Ut.check.isList(l)){const t=this.$.selection.getRange();if(this.$.format.getLine(t.startContainer)===this.$.format.getLine(t.endContainer))if(Ut.check.isList(l)){e.preventDefault();const t=n.nextElementSibling,s=Ut.utils.createElement("LI",null,n);l.insertBefore(s,t),this.$.focusManager.focus()}else Ut.check.isWysiwygFrame(n)||this.$.component.is(n)||Ut.check.isTableElements(n)&&!Ut.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)&&Li.setTimeout(this._toggleToolbarBalloon.bind(this),0)}function Vi(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return!1;const s=Ut.query.getEventTarget(e);!1!==ws.get("__overInfo")&&this.$.component.hoverSelect(s),this._callPluginEvent("onMouseMove",{frameContext:t,event:e})}async function Oi(t,e){!1!==await this.$.eventManager.triggerEvent("onMouseLeave",{frameContext:t,event:e})&&await this._callPluginEventAsync("onMouseLeave",{frameContext:t,event:e})}async function Ri(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;const s=(null===e.data?"":void 0===e.data?" ":e.data)||"";if(Gt.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 zi(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)&&!Ut.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 Fi={"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})=>Ut.utils.removeItem(e),"select.component.fallback":({ports:t},{cmponentInfo:e})=>{!1===t.component.select(e.target,e.pluginName)&&t.focusManager.blur()}},Pi={"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(Ut.check.isZeroWidth(s))return Ut.utils.removeItem(s),e;const i=s.childNodes;for(;i[0];)t.appendChild(i[0]);return Ut.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(Ut.check.isZeroWidth(s))return Ut.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 Ut.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=Ut.utils.createElement(i);for(;s.firstChild&&!Ut.check.isBreak(s.firstChild);)o.appendChild(s.firstChild);s.firstChild&&Ut.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(Ut.utils.createElement(t.options.get("defaultLine"),null,"<br>"),e)},"backspace.component.select":({ports:t},{selectionNode:e,range:s,fileComponentInfo:i})=>{let n=null;Ut.check.isBreak(e)?Ut.utils.removeItem(e):Ut.check.isBreak(n=s.startContainer.childNodes?.[s.startOffset])&&Ut.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&&Ut.utils.removeItem(s),0===i.textContent.length&&Ut.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=Ut.utils.createTextNode(qt.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;Ut.utils.removeItem(s),0===i.children.length&&Ut.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)},"delete.component.select":({ports:t},{formatEl:e,fileComponentInfo:s})=>{if(Ut.check.isListCell(e)){const t=s.container.previousSibling;Ut.check.isZeroWidth(t)&&Ut.utils.removeItem(t)}else Ut.check.isZeroWidth(e)&&Ut.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(Ut.check.isZeroWidth(s)&&(Ut.utils.removeItem(s),Ut.check.isTable(i))){let e=Ut.query.getEdgeChild(i,Ut.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(),Ut.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=Ut.utils.arrayFind(i.children,Ut.check.isList)||i.nextElementSibling||n.parentElement.nextElementSibling;if(o&&(Ut.check.isList(o)||Ut.utils.arrayFind(o.children,Ut.check.isList))){let s,n;if(e.e.preventDefault(),Ut.check.isList(o)){const t=o.firstElementChild;for(n=t.childNodes,s=n[0];n[0];)i.insertBefore(n[0],o);Ut.utils.removeItem(t)}else{for(s=o.firstChild,n=o.childNodes;n[0];)i.appendChild(n[0]);Ut.utils.removeItem(o)}t.selection.setRange(s,0,s,0),t.history.push(!0)}},"tab.format.indent":({ports:t,ctx:e},{range:s,formatEl:i,shift:n})=>{const o=t.format.getLines(null),l=[],r=[],a=Ut.check.isListCell(o[0]),h=Ut.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],Ut.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(!Ut.check.isZeroWidth(t)){/^\s{1,4}$/.test(t.textContent)?Ut.utils.removeItem(t):/^\s{1,4}/.test(t.textContent)&&(t.textContent=t.textContent.replace(/^\s{1,4}/,""));break}}const e=Ut.query.getEdgeChild(r[0],"text",!1),s=Ut.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=Ut.query.findTextIndexOnLine(i,s.startContainer,s.startOffset,(e=>t.component.is(e))),o=t.format.isLine(i.previousElementSibling)?Ut.query.findTabEndIndex(i.previousElementSibling,e,2):0;o>e&&(n=o-e)}const o=Ut.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=Ut.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&&(Ut.check.isBreak(e)?r[i].insertBefore(t.cloneNode(!1),e):e.textContent=t.textContent+e.textContent);const i=Ut.query.getEdgeChild(r[0],"text",!1),n=Ut.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,ctx:e},{formatEl:s})=>{const i=t.format.addLine(s,e.options.get("defaultLine")).firstChild;if(Ut.check.isBreak(i)){const e=Ut.utils.createTextNode(qt.zeroWidthSpace);i.parentNode.insertBefore(e,i),t.selection.setRange(e,1,e,1)}else t.selection.setRange(i,0,i,0)},"enter.list.addItem":({ports:t},{formatEl:e,selectionNode:s})=>{const i=Ut.utils.createElement("BR"),n=Ut.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(Ut.check.isListCell(i.parentElement)){const t=s.parentNode.parentElement;i=t.parentElement;const o=Ut.utils.createElement("LI");o.innerHTML="<br>",Ut.utils.copyTagAttributes(o,s,e.options.get("lineAttrReset")),n=o,i.insertBefore(n,t.nextElementSibling)}else{let o;o=Ut.check.isTableCell(i.parentElement)?"DIV":Ut.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=Ut.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?Ut.utils.removeItem(n[o-1]):Ut.utils.removeItem(e);const l=i.nextElementSibling,r=t.format.addLine(i,t.format.isLine(l)?l:null);Ut.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&&Ut.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.format.insertBrNode":({ports:t},{wSelection:e})=>{const s=e.focusNode.nextSibling,i=Ut.utils.createElement("BR");t.html.insertNode(i,{afterNode:null,skipCharCount:!0});const n=i.previousSibling,o=i.nextSibling;Ut.check.isBreak(s)||Ut.check.isBreak(n)||o&&!Ut.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})=>{const l=Ut.utils.createElement("BR"),r=Ut.utils.createElement(s.nodeName,null,l);Ut.utils.copyTagAttributes(r,s,e.options.get("lineAttrReset"));let a=l,h=i;do{if(!Ut.check.isBreak(h)&&1===h.nodeType){const t=h.cloneNode(!1);t.appendChild(a),a=t}h=h.parentElement}while(s!==h&&s.contains(h));if(r.appendChild(a),s.parentNode.insertBefore(r,n&&!o?s:s.nextElementSibling),o)t.selection.setRange(l,1,l,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&&Ut.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(Ut.check.isWysiwygFrame(h.container)&&(t.enterPrevent(e.e),e.fc.get("wysiwyg").appendChild(r),c=r,Ut.utils.copyTagAttributes(c,s,e.options.get("lineAttrReset")),t.selection.setRange(c,d,c,d)));const u=t.format.getBlock(h.container);if(c=c.contains(u)?Ut.query.getEdgeChild(u,(e=>Boolean(t.format.getLine(e))),!1):c,l){if(o&&!n)c.parentNode.insertBefore(r,h.prevContainer&&h.container!==h.prevContainer?c:c.nextElementSibling),c=r,d=0;else if(d=h.offset,n){const t=c.parentNode.insertBefore(r,c);o&&(c=t,d=0)}}else o&&n?(c.parentNode.insertBefore(r,h.prevContainer&&h.container===h.prevContainer?c.nextElementSibling:c),c=r,d=0):o?(c=c.parentNode.insertBefore(r,c.nextElementSibling),c=r,d=0):c=t.nodeTransform.split(h.container,h.offset,Ut.query.getNodeDepth(s));t.enterPrevent(e.e),Ut.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=Ut.check.isZeroWidth(s)?t.format.addLine(s,s.cloneNode(!1)):t.nodeTransform.split(i.endContainer,i.endOffset,Ut.query.getNodeDepth(s)),t.enterPrevent(e.e),Ut.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(Ut.utils.createTextNode(" "),{afterNode:null,skipCharCount:!0});e&&t.selection.setRange(e,e.length,e,e.length)},"keydown.input.insertZWS":({ports:t})=>{const e=Ut.utils.createTextNode(qt.zeroWidthSpace);t.html.insertNode(e,{afterNode:null,skipCharCount:!0}),t.selection.setRange(e,1,e,1)}};function Di(t){const e=t.selection.getRange(),s=e.startContainer,i=e.endContainer,n=t.format.getBlock(s),o=t.format.getBlock(i),l=Ut.check.isTableCell(n),r=Ut.check.isTableCell(o);if((l&&!n.previousElementSibling&&!n.parentElement.previousElementSibling||r&&!o.nextElementSibling&&!o.parentElement.nextElementSibling)&&n!==o){const s=Ut.query.getParentElement(e.commonAncestorContainer,Ut.check.isFigure)?.parentElement||e.commonAncestorContainer;if(l){if(r)return Ut.utils.removeItem(Ut.query.getParentElement(n,(t=>s===t.parentNode))),t.focusManager.nativeFocus(),!0;Ut.utils.removeItem(Ut.query.getParentElement(n,(t=>s===t.parentNode)))}else Ut.utils.removeItem(Ut.query.getParentElement(o,(t=>s===t.parentNode)))}const a=1===s.nodeType?Ut.query.getParentElement(s,".se-component"):null,h=1===i.nodeType?Ut.query.getParentElement(i,".se-component"):null;return a&&Ut.utils.removeItem(a),h&&Ut.utils.removeItem(h),!1}function qi(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=Wi(t,i.childNodes[n],o,i),Ut.check.isComponentContainer(l)||Ut.check.isNonEditable(l)?l:null):(l=Wi(t,i,o,i),Ut.check.isEdgePoint(i,n,s?"front":"end")&&(Ut.check.isComponentContainer(l)||Ut.check.isNonEditable(l))?l:null)}function Wi(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}const Ui=()=>({t:"event.prevent"}),Zi=()=>({t:"event.prevent.stop"}),Gi=()=>({t:"cache.styleNode"}),ji=t=>({t:"cache.formatAttrsTemp",p:{attrs:t}}),Ki=()=>({t:"component.deselect"}),Yi=()=>({t:"focusManager.nativeFocus"}),Xi=t=>({t:"history.push",p:t}),Ji=()=>({t:"documentType.refreshHeader"}),Qi=(t,e,s,i,n)=>({t:"format.removeBlock",p:{rangeEl:t,selectedFormats:e,newBlockElement:s,shouldDelete:i,skipHistory:n}}),tn=t=>({t:"dom.utils.removeItem",p:{item:t}}),en=t=>({t:"select.component.fallback",p:{cmponentInfo:t}}),sn=(t,e)=>({t:"del.format.removeAndMove",p:{container:t,formatEl:e}}),nn=t=>({t:"backspace.format.maintain",p:{formatEl:t}}),on=t=>({t:"backspace.brline.strip",p:{formatEl:t}}),ln=(t,e,s)=>({t:"backspace.component.select",p:{selectionNode:t,range:e,fileComponentInfo:s}}),rn=(t,e,s,i)=>({t:"backspace.component.remove",p:{isList:t,sel:e,formatEl:s,fileComponentInfo:i}}),an=(t,e,s)=>({t:"backspace.list.mergePrev",p:{prev:t,formatEl:e,rangeEl:s}}),hn=t=>({t:"backspace.list.removeNested",p:{range:t}}),cn=(t,e)=>({t:"delete.component.select",p:{formatEl:t,fileComponentInfo:e}}),dn=(t,e)=>({t:"delete.component.selectNext",p:{formatEl:t,nextEl:e}}),un=(t,e,s)=>({t:"delete.list.removeNested",p:{range:t,formatEl:e,rangeEl:s}}),pn=(t,e,s)=>({t:"tab.format.indent",p:{range:t,formatEl:e,shift:s}}),gn=t=>({t:"enter.scrollTo",p:{range:t}}),mn=t=>({t:"enter.line.addDefault",p:{formatEl:t}}),fn=(t,e)=>({t:"enter.list.addItem",p:{formatEl:t,selectionNode:e}}),vn=(t,e)=>({t:"enter.format.exitEmpty",p:{formatEl:t,rangeEl:e}}),bn=(t,e,s,i,n)=>({t:"enter.format.cleanBrAndZWS",p:{selectionNode:t,selectionFormat:e,brBlock:s,children:i,offset:n}}),yn=(t,e,s,i)=>({t:"enter.format.insertBrHtml",p:{brBlock:t,range:e,wSelection:s,offset:i}}),wn=t=>({t:"enter.format.insertBrNode",p:{wSelection:t}}),Cn=(t,e,s,i)=>({t:"enter.format.breakAtEdge",p:{formatEl:t,selectionNode:e,formatStartEdge:s,formatEndEdge:i}}),_n=(t,e,s,i)=>({t:"enter.format.breakWithSelection",p:{formatEl:t,range:e,formatStartEdge:s,formatEndEdge:i}}),xn=(t,e)=>({t:"enter.format.breakAtCursor",p:{formatEl:t,range:e}}),$n=t=>({t:"enter.figcaption.exitInList",p:{formatEl:t}}),kn=()=>({t:"keydown.input.insertNbsp"}),Sn=()=>({t:"keydown.input.insertZWS"});function En(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;if(t.push(Ki()),t.push(Gi()),c&&Di(e))return t.push(Zi()),!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(Zi()),!1;if(i.isLine(h)&&c&&Ut.check.isEdgePoint(r.startContainer,r.startOffset,"front")&&(!r.startContainer.previousSibling||Ut.check.isZeroWidth(r.startContainer.previousSibling))&&i.getLine(r.startContainer)!==i.getLine(r.endContainer)&&(i.isLine(h.previousElementSibling)||Ut.check.isListCell(h)))return t.push(Zi()),t.push(sn(r.startContainer,h)),t.push(Xi(!0)),!1;if(!c&&!h.previousElementSibling&&0===r.startOffset&&!a.previousSibling&&!Ut.check.isListCell(h)&&i.isLine(h)&&(!i.isBrLine(h)||i.isClosureBrLine(h)||Ut.check.isWysiwygFrame(h.parentNode)))return i.isClosureBlock(h.parentNode)?(t.push(Zi()),!1):i.isBrLine(h)&&Ut.check.isWysiwygFrame(h.parentNode)?(t.push(Zi()),t.push(on(h)),t.push(Xi(!0)),!1):(Ut.check.isWysiwygFrame(h.parentNode)&&h.childNodes.length<=1&&(!h.firstChild||Ut.check.isZeroWidth(h.textContent))&&(t.push(Zi()),t.push(nn(h))),t.push(Yi()),!1);const d=r.startContainer;if(h&&!h.previousElementSibling&&0===r.startOffset&&3===d.nodeType&&Ut.check.isZeroWidth(d)&&!0===function(t,e,s){let i=e.parentNode.previousSibling;const n=e.parentNode.nextSibling;i||(n?i=n:(i=Ut.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,d,h))return!0;if(!c&&h&&(0===r.startOffset||a===h)){const s=a===h?qi(e,r,!0):Ut.check.isElement(a.previousSibling)?a.previousSibling:Ut.check.isEdgePoint(r.startContainer,r.startOffset)?Ut.query.getPreviousDeepestNode(r.startContainer):null;if(n.is(s)){const e=n.get(s);if(e)return t.push(Zi()),t.push(ln(a,r,e)),!0}}if(qi(e,r,!0))return t.push(Zi()),!0;!c&&i.isEdgeLine(r.startContainer,r.startOffset,"front")&&i.isLine(h.previousElementSibling)&&t.push(ji(h.previousElementSibling.attributes)),h=i.getLine(r.startContainer,null);const u=i.getBlock(h,null),p=r.commonAncestorContainer;if(u&&h&&!Ut.check.isTableCell(u)&&!/^FIGCAPTION$/i.test(u.nodeName)){if(Ut.check.isListCell(h)&&Ut.check.isList(u)&&(Ut.check.isListCell(u.parentElement)||h.previousElementSibling)&&(a===h||3===a.nodeType&&(!a.previousSibling||Ut.check.isList(a.previousSibling)))&&(i.getLine(r.startContainer,null)!==i.getLine(r.endContainer,null)?u.contains(r.startContainer):0===r.startOffset&&r.collapsed)){if(r.startContainer!==r.endContainer)t.push(Ui()),t.push(hn(r)),t.push(Xi(!0));else{let e=h.previousElementSibling||u.parentElement;if(Ut.check.isListCell(e)){t.push(Ui());let s=e;if(!e.contains(h)&&Ut.check.isListCell(s)&&Ut.check.isList(s.lastElementChild)){for(s=s.lastElementChild.lastElementChild;Ut.check.isListCell(s)&&Ut.check.isList(s.lastElementChild);)s=s.lastElementChild&&s.lastElementChild.lastElementChild;e=s}t.push(an(e,h,u)),t.push(Xi(!0))}}return!0}if(!c&&0===r.startOffset){let e=!0,s=p;for(;s&&s!==u&&!Ut.check.isWysiwygFrame(s);){if(s.previousSibling&&(1===s.previousSibling.nodeType||!Ut.check.isZeroWidth(s.previousSibling.textContent.trim()))){e=!1;break}s=s.parentNode}if(e&&u.parentNode)return t.push(Ui()),t.push(Qi(u,Ut.check.isListCell(h)?[h]:null,null,!1,!1)),t.push(Xi(!0)),!0}}if(!c&&h&&(0===r.startOffset||a===h&&h.childNodes[r.startOffset])){const e=Ut.check.isListCell(h),s=a===h?h.childNodes[r.startOffset]:a,i=(e?s:h).previousSibling,o=e||(3===p.nodeType||Ut.check.isBreak(p))&&!p.previousSibling&&0===r.startOffset;if(s&&(e||!s.previousSibling)&&(p&&n.is(p.previousSibling)||o&&n.is(i))){const o=n.get(i);return o?(t.push(Zi()),t.push(rn(e,s,h,o))):n.is(i)&&(t.push(Zi()),t.push(tn(i))),!0}if(s&&Ut.check.isNonEditable(s.previousSibling))return t.push(Zi()),t.push(tn(s.previousSibling)),!0}return!0}const{isOSX_IOS:Tn}=Dt;async function Mn(t,e){const s=[];switch(e.keyCode){case"Backspace":if(!1===En(s,t,e))return s;break;case"Delete":if(!1===function(t,e,s){const{format:i,component:n}=e,{range:o,selectionNode:l}=s;let{formatEl:r}=s;const a=!o.collapsed||o.startContainer!==o.endContainer;if(t.push(Ki()),t.push(Gi()),a&&Di(e))return t.push(Zi()),!0;if(!a&&i.isEdgeLine(o.endContainer,o.endOffset,"end")&&!r.nextSibling)return t.push(Zi()),!1;if(i.isLine(r)&&a&&Ut.check.isEdgePoint(o.endContainer,o.endOffset,"end")&&(!o.endContainer.nextSibling||Ut.check.isZeroWidth(o.endContainer.nextSibling))&&i.getLine(o.startContainer)!==i.getLine(o.endContainer)&&(i.isLine(r.nextElementSibling)||Ut.check.isListCell(r)))return t.push(Zi()),t.push(sn(o.endContainer,r)),t.push(Xi(!0)),!1;if(!a&&r&&(o.endOffset===o.endContainer.textContent.length||l===r)){const s=l===r?qi(e,o,!1):Ut.check.isElement(l.nextSibling)?l.nextSibling:Ut.check.isEdgePoint(o.endContainer,o.endOffset)?Ut.query.getNextDeepestNode(o.endContainer,null):null;if(n.is(s)){const e=n.get(s);if(e)return t.push(Zi()),t.push(cn(r,e)),!0}}if(qi(e,o,!1))return t.push(Zi()),!0;if((i.isLine(l)||null===l.nextSibling||Ut.check.isZeroWidth(l.nextSibling)&&null===l.nextSibling.nextSibling)&&o.startOffset===l.textContent.length){const e=r.nextElementSibling;if(!e)return!0;if(n.is(e))return t.push(Ui()),t.push(dn(r,e)),!0}if(!a&&(Ut.check.isEdgePoint(o.endContainer,o.endOffset)||l===r&&r.childNodes[o.startOffset])){const e=l===r&&r.childNodes[o.startOffset]||l;if(e&&Ut.check.isNonEditable(e.nextSibling))return t.push(Zi()),t.push(tn(e.nextSibling)),!0;if(n.is(e))return t.push(Zi()),t.push(tn(e)),!0}!a&&i.isEdgeLine(o.endContainer,o.endOffset,"end")&&i.isLine(r.nextElementSibling)&&t.push(ji(r.attributes)),r=i.getLine(o.startContainer,null);const h=i.getBlock(r,null);return!(Ut.check.isListCell(r)&&Ut.check.isList(h)&&(l===r||3===l.nodeType&&(!l.nextSibling||Ut.check.isList(l.nextSibling))&&(i.getLine(o.startContainer,null)!==i.getLine(o.endContainer,null)?h.contains(o.endContainer):o.endOffset===l.textContent.length&&o.collapsed))&&(t.push(un(o,r,h)),0))}(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(Ui()),r||a||Ut.check.isWysiwygFrame(n)||(t.push(pn(o,l,h)),t.push(Xi(!1))),!0)}(s,0,e))return s;break;case"Enter":if(!1===function(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(Ki());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(Ui()),!1}if(!c){const s=!r.endContainer.nextSibling&&i.isEdgeLine(r.endContainer,r.endOffset,"end"),n=!r.startContainer.previousSibling&&i.isEdgeLine(r.startContainer,r.startOffset,"front");if(s&&(/^H[1-6]$/i.test(a.nodeName)||/^HR$/i.test(a.nodeName)))return e.enterPrevent(d),t.push(mn(a)),t.push(gn(r)),!0;if(g&&a&&!Ut.check.isTableCell(g)&&!/^FIGCAPTION$/i.test(g.nodeName)){const s=o.getRange();if(Ut.check.isEdgePoint(s.endContainer,s.endOffset)&&Ut.check.isList(h.nextSibling))return e.enterPrevent(d),t.push(fn(a,h)),t.push(gn(r)),!0;if((3!==s.commonAncestorContainer.nodeType||!s.commonAncestorContainer.nextElementSibling)&&Ut.check.isZeroWidth(a.innerText.trim())&&!Ut.check.isListCell(a.nextElementSibling))return e.enterPrevent(d),t.push(vn(a,g)),!0}if(p||g===a&&i.isClosureBlock(g)&&i.isLine(a)){e.enterPrevent(d);const s=h===p,n=o.get(),l=h.childNodes,a=n.focusOffset,c=h.previousElementSibling,u=h.nextSibling;return!i.isClosureBrLine(p)&&l&&(s&&r.collapsed&&l.length-1<=a+1&&Ut.check.isBreak(l[a])&&(!l[a+1]||(!l[a+2]||Ut.check.isZeroWidth(l[a+2].textContent))&&3===l[a+1].nodeType&&Ut.check.isZeroWidth(l[a+1].textContent))&&a>0&&Ut.check.isBreak(l[a-1])||!s&&Ut.check.isZeroWidth(h.textContent)&&Ut.check.isBreak(c)&&(Ut.check.isBreak(c.previousSibling)||!Ut.check.isZeroWidth(c.previousSibling?.textContent))&&(!u||!Ut.check.isBreak(u)&&Ut.check.isZeroWidth(u.textContent)))?(t.push(bn(h,s,p,l,a)),t.push(gn(r)),!0):(s?t.push(yn(p,r,n,a)):t.push(wn(n)),t.push(gn(r)),!0)}if(r.collapsed&&(n||s))return e.enterPrevent(d),t.push(Cn(a,h,n,s)),t.push(gn(r)),!0;if(a)return t.push(Ui()),u?t.push(_n(a,r,n,s)):t.push(xn(a,r)),t.push(gn(r)),!0}return u?(t.push(gn(r)),!0):(g&&Ut.query.getParentElement(g,"FIGCAPTION")&&Ut.query.getParentElement(g,Ut.check.isList)&&(e.enterPrevent(d),t.push($n(a)),t.push(gn(r))),!0)}(s,t,e))return s}const{fc:i,keyCode:n,shift:o,alt:l,ctrl:r,range:a}=e;if(o&&(Tn?l:r)&&Gt.isSpace(n))return s.push(Zi()),s.push(kn()),s;const h=!a.collapsed||a.startContainer!==a.endContainer;return r||l||h||Gt.isNonTextKey(n)||!Ut.check.isBreak(a.commonAncestorContainer)?!i.has("documentType_use_header")||!h||r||l||o||Gt.isDirectionKey(n)?(function(t,e,s){const{component:i}=e,{formatEl:n,range:o,selectionNode:l,keyCode:r}=s;let a=null;switch(r){case"ArrowUp":i.is(n.previousElementSibling)&&(a=i.get(n.previousElementSibling));break;case"ArrowLeft":if(Ut.check.isEdgePoint(l,o.startOffset,"front")){const t=l.previousElementSibling||Ut.query.getPreviousDeepestNode(l);t?i.is(t)&&(a=i.get(t)):i.is(n.previousElementSibling)&&(a=i.get(n.previousElementSibling))}break;case"ArrowDown":i.is(n.nextElementSibling)&&(a=i.get(n.nextElementSibling));break;case"ArrowRight":if(Ut.check.isEdgePoint(l,o.endOffset,"end")){const t=l.nextElementSibling||Ut.query.getNextDeepestNode(l);t?i.is(t)&&(a=i.get(t)):i.is(n.nextElementSibling)&&(a=i.get(n.nextElementSibling))}}a&&!a.options?.isInputComponent&&(t.push(Ui()),t.push(en(a)))}(s,t,e),s):(s.push(Ji()),s):(s.push(Sn()),s)}const{_w:Hn}=Dt,Ln=new RegExp(qt.zeroWidthSpace+"+",""),Nn={ctrl:!1,alt:!1},Bn=Object.preventExtensions({value:[]});async function An(t,e){if(this.isComposing=Gt.isComposing(e))return!0;if(this.$.ui.selectMenuOn||!e.isTrusted)return;let s=this.$.selection.getNode();if(Ut.check.isInputElement(s))return;if(this.$.menu.currentDropdownName)return;const i=e.code,n=Gt.isShift(e),o=Nn.ctrl=Gt.isCtrl(e),l=Nn.alt=Gt.isAlt(e);if(!o&&t.get("isReadOnly")&&!Gt.isDirectionKey(i))return e.preventDefault(),!1;if(this.$.menu.dropdownOff(),this.$.store.mode.isBalloon?this._hideToolbar():this.$.store.mode.isSubBalloon&&this._hideToolbar_sub(),!1===await this.$.eventManager.triggerEvent("onKeyDown",{frameContext:t,event:e}))return;Gt.isEnter(i)&&this.$.format.isLine(this.$.selection.getRange()?.startContainer)&&(this.$.selection.resetRangeToTextNode(),s=this.$.selection.getNode());const r=this.$.selection.getRange(),a=this.$.format.getLine(s,null)||s;if(o&&!Gt.isNonTextKey(i)&&this.$.shortcuts.command(e,o,n,i,"",!1,null,null))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1;if(!o&&!Gt.isNonTextKey(i)&&this.$.format.isLine(a)&&r.collapsed&&Ut.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);if(!1===await this._callPluginEventAsync("onKeyDown",{frameContext:t,event:e,range:r,line:a}))return;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=function(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)},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(e){i._iframeAutoHeight(s),b&&t.scrollparents.length>0||o.scrollTo(e,{behavior:"auto",block:"nearest",inline:"nearest"})},enterPrevent(e){e.preventDefault(),b&&(t.__focusTemp.focus({preventScroll:!0}),s.get("wysiwyg").focus({preventScroll:!0}))}}}(this,{_styleNodes:Bn}),d=await Mn(c,h);await async function(t,e){const s={...Fi,...Pi};for(const i of t){if("action.stop"===i.t)return!1;const t=s[i.t];if(t&&!1===await t(e,i.p))return!1}}(d,{ports:c,ctx:h})}async function In(t,e){if(this._onShortcutKey||this.$.menu.currentDropdownName)return;const s=e.code,i=Gt.isCtrl(e),n=Gt.isAlt(e);if(i&&(Nn.ctrl=!1),n&&(Nn.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)&&!Gt.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());Gt.isEsc(s)||this._showToolbarBalloonDelay()}if(Gt.isBackspace(s)&&Ut.check.isWysiwygFrame(l)&&""===l.textContent&&0===l.children.length){e.preventDefault(),e.stopPropagation(),l.innerHTML="";const i=this.$.store.get("currentNodes")[0],n=Ut.utils.createElement(this.$.format.isLine(i)&&!Ut.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")&&Gt.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++)Gt.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)||Ut.check.isList(l)||null===this._setDefaultLine(this.$.format.isBlock(a)?"DIV":this.$.options.get("defaultLine"))||(l=this.$.selection.getNode());if(!Nn.ctrl&&!Nn.alt&&!Gt.isNonTextKey(s)&&3===l.nodeType&&qt.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(Ln)||"").length;t=o.startOffset-s,e=o.endOffset-s,l.textContent=l.textContent.replace(qt.zeroWidthRegExp,""),this.$.selection.setRange(l,t<0?0:t,l,e<0?0:e)}if(Gt.isRemoveKey(s)&&Ut.check.isZeroWidth(r?.textContent)&&!r.previousElementSibling&&!Ut.check.isListCell(r)){const t=this.$.options.get("retainStyleMode");"none"!==t&&Bn.value?.length>0?"repeat"===t?this.__retainTimer?(this.__retainTimer=Hn.clearTimeout(this.__retainTimer),this._clearRetainStyleNodes(r)):(this.__retainTimer=Hn.setTimeout((()=>{this.__retainTimer=null}),0),this._retainStyleNodes(r,Bn.value)):(this.__retainTimer=null,this._retainStyleNodes(r,Bn.value)):this._clearRetainStyleNodes(r)}if(t.has("documentType_use_header"))if(Gt.isDocumentTypeObserverKey(s)){t.get("documentType").reHeader();const e=Ut.query.getParentElement(this.$.selection.selectionNode,this.$.format.isLine.bind(this.$.format));t.get("documentType").on(e)}else{const e=Ut.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})&&Gt.isHistoryRelevantKey(s)&&this.$.history.push(!0)}const{_w:Vn}=Dt;function On(t,e){const s=e.clipboardData;return!s||this._dataTransferAction("paste",e,s,t)}async function Rn(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 zn(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(),Vn.setTimeout((()=>{this.$.history.push(!1)}),0)}const{_w:Fn}=Dt;function Pn(t,e,s,i,n){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-Fn.scrollY,c.x=t.left-Fn.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+Fn.scrollX+c.x+i}px`,e.style.top=`${d.top+Fn.scrollY+c.y-5+n}px`,e.style.height=`${d.height+10}px`,e.style.display="block"}else e.style.display="none"}function Dn(t){t.style.display="none"}function qn(t,e,s){try{if(t.get("isReadOnly"))return s.preventDefault(),s.stopPropagation(),!1;const e=s.dataTransfer;if(!e)return!0;const{sc:i,so:n,ec:o,eo:l}=this.$.selection.getDragEventLocationRange(s);if(!i)return;if(Ut.query.getParentElement(i,".se-disable-pointer"))return void s.preventDefault();if(ws.get("__dragContainer")){if(s.preventDefault(),ws.get("__dragContainer").contains(s.target))return void this.$.component.deselect();const e=ws.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{e.style.display="none"}}class Wn{#X;constructor({$:t}){this.#X=t}execute(t){if(!this.#X.options.get("__lineFormatFilter"))return null;if(this.#X.pluginManager.fileInfo.pluginRegExp.test(this.#X.ui.currentControllerName))return;const e=this.#X.selection.getRange(),s=e.commonAncestorContainer,i=e.startContainer,n=e.endOffset,o=this.#X.format.getBlock(s,null);let l,r,a;if(o)return a=Ut.utils.createElement(t||this.#X.options.get("defaultLine")),a.innerHTML=o.innerHTML,0===a.childNodes.length&&(a.innerHTML=qt.zeroWidthSpace),o.innerHTML=a.outerHTML,a=o.firstChild,l=a.childNodes[n]||Ut.query.getEdgeChildNodes(a,null).sc,l||(l=Ut.utils.createTextNode(qt.zeroWidthSpace),a.insertBefore(l,a.firstChild)),r=l.textContent.length,void this.#X.selection.setRange(l,r,l,r);if(3===s.nodeType&&this.#X.component.is(s.parentElement)){const t=this.#X.component.get(s.parentElement);if(!t)return;const e=t.container;if(s.parentElement===e){const t=s.nextElementSibling?e:e.nextElementSibling,i=Ut.utils.createElement(this.#X.options.get("defaultLine"),null,s);return e.parentElement.insertBefore(i,t),void this.#X.focusManager.focusEdge(i)}return this.#X.component.select(t.target,t.pluginName),null}if(1===s.nodeType&&"true"===s.getAttribute("data-se-embed")){let t=s.nextElementSibling;return this.#X.format.isLine(t)||(t=this.#X.format.addLine(s,this.#X.options.get("defaultLine"))),void this.#X.selection.setRange(t.firstChild,0,t.firstChild,0)}if(!this.#X.format.isBlock(i)&&!Ut.check.isWysiwygFrame(i)||!this.#X.component.is(i.children[e.startOffset])&&!this.#X.component.is(i.children[e.startOffset-1])){if(Ut.query.getParentElement(s,Ut.check.isExcludeFormat))return null;if(this.#X.format.isBlock(s)&&s.childNodes.length<=1){let t=null;return 1===s.childNodes.length&&Ut.check.isBreak(s.firstChild)?t=s.firstChild:(t=Ut.utils.createTextNode(qt.zeroWidthSpace),s.appendChild(t)),void this.#X.selection.setRange(t,1,t,1)}try{if(3===s.nodeType&&(a=Ut.utils.createElement(t||this.#X.options.get("defaultLine")),s.parentNode.insertBefore(a,s),a.appendChild(s)),Ut.check.isBreak(a.nextSibling)&&Ut.utils.removeItem(a.nextSibling),Ut.check.isBreak(a.previousSibling)&&Ut.utils.removeItem(a.previousSibling),Ut.check.isBreak(l)){const t=Ut.utils.createTextNode(qt.zeroWidthSpace);l.parentNode.insertBefore(t,l),l=t}}catch{return this.#X.frameContext.get("_wd").execCommand("formatBlock",!1,`<${t||this.#X.options.get("defaultLine")}>`),this.#X.store.set("_lastSelectionNode",null),void this.#X.selection.init()}if(a&&(Ut.check.isBreak(a.nextSibling)&&Ut.utils.removeItem(a.nextSibling),Ut.check.isBreak(a.previousSibling)&&Ut.utils.removeItem(a.previousSibling),Ut.check.isBreak(l))){const t=Ut.utils.createTextNode(qt.zeroWidthSpace);l.parentNode.insertBefore(t,l),l=t}this.#X.store.set("_lastSelectionNode",null),i?this.#X.selection.setRange(i,1,i,1):this.#X.focusManager.nativeFocus()}}}class Un{#Jo;#X;#Qo;constructor(t){this.#Jo=t,this.#X=t.$,this.#Qo=new RegExp(`^(${Object.keys(this.#X.options.get("_defaultStyleTagMap")).join("|")})$`,"i")}update(t){if(t||=this.#X.selection.getNode(),t===this.#X.store.get("_lastSelectionNode"))return;this.#X.store.set("_lastSelectionNode",t);const e=this.#X.options.get("_rtl")?"marginRight":"marginLeft",s=this.#X.plugins,i=this.#X.commandDispatcher.targets,n=this.#Qo,o=this.#X.options.get("_styleCommandMap"),l=[],r=[],a=this.#X.options.get("_textStyleTags"),h=[],c=[],d=this.#X.commandDispatcher.activeCommands,u=d.length;let p="";if(this.#X.component.is(t)&&!this.#X.component.__selectionSelected){const e=this.#X.component.get(t);if(!e)return;return this.#X.store.set("_lastSelectionNode",null),void this.#X.component.select(e.target,e.pluginName)}for(;t.firstChild;)t=t.firstChild;const g=this.#X.frameContext,m=!g.get("isReadOnly");for(let g=t;!Ut.check.isWysiwygFrame(g)&&g;g=g.parentElement)if(1===g.nodeType&&!Ut.check.isBreak(g)){if(this.#tl(g))return void this.#X.focusManager.blur();if(p=g.nodeName.toLowerCase(),r.push(p),a.includes(p)&&!this.#X.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.#X.format.isLine(g)){if(!l.includes("outdent")&&i.has("outdent")&&(Ut.check.isListCell(g)||g.style[e]&&Zt.get(g.style[e],0)>0)&&i.get("outdent").filter((t=>!Ut.check.isImportantDisabled(t)&&(t.disabled=!1,!0))).length>0&&l.push("outdent"),!l.includes("indent")&&i.has("indent")){const t=Ut.check.isListCell(g)&&!g.previousElementSibling;i.get("indent").filter((e=>!Ut.check.isImportantDisabled(e)&&(e.disabled=t,!0))).length>0&&l.push("indent")}}else n.test(p)&&(p=o[p]||p,l.push(p),Ut.utils.addClass(i.get(p),"active"))}return this.#el(l),this.#Jo.__cacheStyleNodes=h.reverse(),this.#X.store.set("currentNodes",r.reverse()),this.#X.store.set("currentNodesMap",l),this.#X.frameOptions.get("statusbar_showPathLabel")&&g.get("navigation")&&(g.get("navigation").textContent=this.#X.options.get("_rtl")?this.#X.store.get("currentNodes").reverse().join(" < "):this.#X.store.get("currentNodes").join(" > ")),t}reset(){this.#el([])}#el(t){const e=this.#X.commandDispatcher.activeCommands,s=this.#X.commandDispatcher.targets,i=this.#X.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)?Ut.check.isImportantDisabled(t)||(t.disabled=!0):/^indent$/i.test(n)?Ut.check.isImportantDisabled(t)||(t.disabled=!1):Ut.utils.removeClass(t,"active"))}}#tl(t){return Ut.check.isElement(t)&&"true"===t.getAttribute("data-se-non-focus")}}const{_w:Zn,isMobile:Gn,isTouchDevice:jn}=Dt;function Kn(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 Yn=class extends ki{#t;#Gs;#e;#it;#js;#o;#sl;#il;#nl=null;#ol=null;#ll=null;#rl=null;constructor(t){super(t),this.#t=this.$.store,this.#Gs=this.$.contextProvider,this.#e=this.$.context,this.#it=this.$.options,this.#js=this.$.eventManager,this.#o=this.$.toolbar,this.#sl=this.$.ui,this.#il=this.$.menu,this.isComposing=!1,this.scrollparents=[],this.defaultLineManager=new Wn(this),this.selectionState=new Un(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.#Gs.carrierWrapper.querySelector(".__se__focus__temp__")}applyTagEffect(t){return this.selectionState.update(t)}_showToolbarBalloonDelay(){this.#nl&&Zn.clearTimeout(this.#nl),this.#nl=Zn.setTimeout((()=>{Zn.clearTimeout(this.#nl),this.#nl=null,this.#t.mode.isSubBalloon?this.$.subToolbar._showBalloon():this.#o._showBalloon()}),250)}_toggleToolbarBalloon(){this.$.selection.init();const t=this.$.selection.getRange(),e=this.#it.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.#sl.isPreventToolbarHide||this.$.frameContext.get("isFullScreen")||this.#o.hide()}_hideToolbar_sub(){this.$.subToolbar&&!this.#sl.isPreventToolbarHide&&this.$.subToolbar.hide()}_setDefaultLine(t){return this.defaultLineManager.execute(t)}async _dataTransferAction(t,e,s,i){try{return this.#sl.showLoading(),await this.#al(t,e,s,i),e.preventDefault(),e.stopPropagation(),!1}catch(t){console.warn("[SUNEDITOR.paste.error]",t)}finally{this.#sl.hideLoading()}}async#al(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=Wt.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," "))),!r){if(this.#it.get("autoLinkify")){const t=(new DOMParser).parseFromString(o,"text/html");Ut.query.getListChildNodes(t.body,Wt.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.#js.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.#js.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=Ti.bind(this),e=Hi.bind(this);this.#js.addEvent(this.#e.get("menuTray"),"mousedown",t,!1),this.#js.addEvent(this.#e.get("menuTray"),"click",Mi.bind(this),!0),this.#js.addEvent(this.#e.get("toolbar_main"),"mousedown",t,!1),this.#js.addEvent(this.#e.get("toolbar_main"),"click",e,!1),this.#it.has("_subMode")&&(this.#js.addEvent(this.#e.get("toolbar_sub_main"),"mousedown",t,!1),this.#js.addEvent(this.#e.get("toolbar_sub_main"),"click",e,!1)),this.#o._setResponsive(),Dt.isResizeObserverSupported&&(this._toolbarObserver=new ResizeObserver((()=>{Zn.setTimeout((()=>{this.#o.resetResponsiveToolbar()}),0)})),this._wwFrameObserver=new ResizeObserver((t=>{Zn.setTimeout((()=>{t.forEach((t=>{this.#sl._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.#it.get("closeModalOutsideClick")&&this.#js.addEvent(this.#Gs.carrierWrapper.querySelector(".se-modal .se-modal-inner"),"click",(t=>{t.target===this.#Gs.carrierWrapper.querySelector(".se-modal .se-modal-inner")&&this.#sl.offCurrentModal()}),!1),this.#js.addEvent(Zn,"resize",this.#hl.bind(this),!1),this.#js.addEvent(Zn.visualViewport,"resize",this.#cl.bind(this),!1),this.#js.addEvent(Zn,"scroll",this.#dl.bind(this),!1),jn&&this.#js.addEvent(Zn.visualViewport,"scroll",this.#ul.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.#Gs.carrierWrapper.querySelector(".se-drag-cursor"),o=Vi.bind(this,t);this.#js.addEvent(s,"mousemove",o,!1),this.#js.addEvent(s,"mouseleave",Oi.bind(this,t),!1),this.#js.addEvent(s,"mousedown",Ni.bind(this,t),!1),this.#js.addEvent(s,"mouseup",Ai.bind(this,t),!1),this.#js.addEvent(s,"click",Ii.bind(this,t),!1),this.#js.addEvent(s,"beforeinput",Ri.bind(this,t),!1),this.#js.addEvent(s,"input",zi.bind(this,t),!1),this.#js.addEvent(s,"keydown",An.bind(this,t),!1),this.#js.addEvent(s,"keyup",In.bind(this,t),!1),this.#js.addEvent(s,"paste",On.bind(this,t),!1),this.#js.addEvent(s,"copy",Rn.bind(this,t),!1),this.#js.addEvent(s,"cut",zn.bind(this,t),!1),this.#js.addEvent(s,"dragover",Pn.bind(this,t,n,e?this.$.frameContext.get("topArea"):null,!this.#it.get("toolbar_container")&&!this.#t.mode.isBalloon&&!this.#t.mode.isInline),!1),this.#js.addEvent(s,"dragend",Dn.bind(this,n),!1),this.#js.addEvent(s,"drop",qn.bind(this,t,n),!1),this.#js.addEvent(s,"scroll",this.#pl.bind(this,t,s),{passive:!0,capture:!1}),this.#js.addEvent(s,"focus",this.#gl.bind(this,t),!1),this.#js.addEvent(s,"blur",this.#ml.bind(this,t),!1),this.#js.addEvent(i,"mousedown",this.#fl.bind(this,t),!1);const l=t.get("wrapper").querySelector(".se-drag-handle");if(this.#js.addEvent(l,"wheel",(t=>{t.preventDefault(),this.$.component.deselect()}),!1),this.#js.addEvent(t.get("lineBreaker_t"),"pointerdown",this.#vl.bind(this,"t"),!1),this.#js.addEvent(t.get("lineBreaker_b"),"pointerdown",this.#vl.bind(this,"b"),!1),jn&&this.#js.addEvent(s,"touchstart",o,{passive:!0,capture:!1}),!this.#it.get("hasCodeMirror")){const e=t.get("codeNumbers"),s=this.$.viewer._codeViewAutoHeight.bind(this.$.viewer,t.get("code"),e,"auto"===this.$.frameOptions.get("height"));this.#js.addEvent(i,"keydown",s,!1),this.#js.addEvent(i,"keyup",s,!1),this.#js.addEvent(i,"paste",s,!1),this.#it.get("tabDisable")||this.#js.addEvent(i,"keydown",Kn,!1),e&&this.#js.addEvent(i,"scroll",this.$.viewer._scrollLineNumbers.bind(i,e),!1)}const r=t.get("markdown");if(r){this.#js.addEvent(r,"mousedown",this.#bl.bind(this,t),!1);const e=t.get("markdownNumbers"),s=this.$.viewer._markdownViewAutoHeight.bind(this.$.viewer,r,e,"auto"===this.$.frameOptions.get("height"));this.#js.addEvent(r,"keydown",s,!1),this.#js.addEvent(r,"keyup",s,!1),this.#js.addEvent(r,"paste",s,!1),this.#it.get("tabDisable")||this.#js.addEvent(r,"keydown",Kn,!1),e&&this.#js.addEvent(r,"scroll",this.$.viewer._scrollMarkdownLineNumbers.bind(r,e),!1)}t.has("statusbar")&&this.__addStatusbarEvent(t,t.get("options"));const a=this.#yl.bind(this),h=Ut.query.getScrollParents(t.get("originElement"));for(const t of h)this.scrollparents.push(t),this.#js.addEvent(t,"scroll",a,!1);this.#js.addEvent(this.__focusTemp,"focus",(t=>t.preventDefault()),!1),this.__eventDoc!==t.get("_wd")&&(this.__eventDoc=t.get("_wd"),this.#js.addEvent(this.__eventDoc,"selectionchange",this.#wl.bind(this,this.__eventDoc),!1))}__addStatusbarEvent(t,e){/\d+/.test(e.get("height"))&&e.get("statusbar_resizeEnable")?e.set("__statusbarEvent",this.#js.addEvent(t.get("statusbar"),"mousedown",this.#Cl.bind(this),!1)):Ut.utils.addClass(t.get("statusbar"),"se-resizing-none")}_removeAllEvents(){this.#js._init(),this._wwFrameObserver&&(this._wwFrameObserver.disconnect(),this._wwFrameObserver=null),this._toolbarObserver&&(this._toolbarObserver.disconnect(),this._toolbarObserver=null),this.#nl&&(Zn.clearTimeout(this.#nl),this.#nl=null),this.__retainTimer&&(Zn.clearTimeout(this.__retainTimer),this.__retainTimer=null),this.#ll&&=this.#js.removeGlobalEvent(this.#ll),this.#rl&&=this.#js.removeGlobalEvent(this.#rl),this.#ol&&=this.#js.removeGlobalEvent(this.#ol),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.#js.removeGlobalEvent(this.#ll),this.#ll=this.#js.addGlobalEvent("mouseup",(()=>{this.$.selection.init(),this.#js.removeGlobalEvent(this.#ll)}))}_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=Ut.utils.createTextNode(qt.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.#js.removeEvent(this.__inputBlurEvent),this.__inputKeyEvent=this.#js.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.#js.triggerEvent("onFocus",{frameContext:t,event:e}),this._callPluginEvent("onFocus",{frameContext:t,event:e})}__postBlurEvent(t,e){this.#t.mode.isInline?Zn.setTimeout((()=>{this.#t.get("hasFocus")||this._hideToolbar()}),0):this.#t.mode.isBalloon&&this._hideToolbar(),this.#t.mode.isSubBalloon&&this._hideToolbar_sub(),this.#js.triggerEvent("onBlur",{frameContext:t,event:e}),this._callPluginEvent("onBlur",{frameContext:t,event:e})}__setViewportSize(){this.#t.set("currentViewportHeight",Zt.get(Zn.visualViewport.height,0))}#_l(){this.#il.currentDropdownActiveButton&&this.#il.currentDropdown&&this.#il.__resetMenuPosition(this.#il.currentDropdownActiveButton,this.#il.currentDropdown),this.#sl._repositionControllers()}#xl(){Dt.isResizeObserverSupported||(this.#o.resetResponsiveToolbar(),this.#it.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.#sl.opendBrowser;if(s&&"block"===s.area.style.display&&(s.body.style.maxHeight=Ut.utils.getClientSize().h-s.header.offsetHeight-50+"px"),this.#il.currentDropdownActiveButton&&this.#il.currentDropdown&&this.#il.__resetMenuPosition(this.#il.currentDropdownActiveButton,this.#il.currentDropdown),this.$.viewer._resetFullScreenHeight())return;const i=this.$.frameContext;i.get("isCodeView")&&this.#t.mode.isInline?this.#o._showInline():(this.#sl._iframeAutoHeight(i),this.#o.isSticky&&(this.#o.isCSSSticky||(this.#e.get("toolbar_main").style.width=i.get("topArea").offsetWidth-2+"px"),this.#o._resetSticky()))}#pl(t,e,s){this.#sl._syncScrollPosition(e),this.#_l(),this._callPluginEvent("onScroll",{frameContext:t,event:s}),t.has("documentType_use_page")&&t.get("documentType").scrollPage(),this.#js.triggerEvent("onScroll",{frameContext:t,event:s})}#gl(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.#js.triggerEvent("onNativeFocus",{frameContext:t,event:e});const s=t.get("key");this._inputFocus?this.#t.mode.isInline&&Zn.setTimeout((()=>{this.#o._showInline()}),0):this.#t.get("rootKey")===s&&this.#t.get("_preventBlur")||this.#t.get("_preventFocus")||(this.#t.set("_preventFocus",!0),Ut.utils.removeClass(this.$.commandDispatcher.targets.get("codeView"),"active"),this.#sl._toggleCodeViewButtons(!1),this.$.facade.changeFrameContext(s),this.$.history.resetButtons(s,null),Zn.setTimeout((()=>{this.__postFocusEvent(t,e)}),0))}#ml(t,e){t.get("isCodeView")||t.get("isReadOnly")||t.get("isDisabled")||(this.#t.set("hasFocus",!1),this.#t.set("_lastSelectionNode",null),this.#js.triggerEvent("onNativeBlur",{frameContext:t,event:e}),this._inputFocus||this.#t.get("_preventBlur")||(this.#t.set("_preventFocus",!1),this.selectionState.reset(),this.#t.set("currentNodes",[]),this.#t.set("currentNodesMap",[]),this.#sl.offCurrentController(),this.#Gs.applyToRoots((t=>{t.get("navigation")&&(t.get("navigation").textContent="")})),this.$.history.check(t.get("key"),this.#t.get("_range")),this.__postBlurEvent(t,e)))}#Cl(t){t.stopPropagation(),this._resizeClientY=t.clientY,this.#sl.enableBackWrapper("ns-resize"),this.#rl=this.#js.addGlobalEvent("mousemove",this.#$l.bind(this)),this.#ol=this.#js.addGlobalEvent("mouseup",this.#kl.bind(this))}#$l(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,Dt.isResizeObserverSupported||this.#sl._emitResizeEvent(e,i,null)}#kl(){this.#sl.disableBackWrapper(),this.#rl&&=this.#js.removeGlobalEvent(this.#rl),this.#ol&&=this.#js.removeGlobalEvent(this.#ol)}#vl(t,e){e.preventDefault();const s=this._lineBreakComp;if(!s)return;const i=Ut.check.isListCell(s.parentElement),n=Ut.utils.createElement(i?"BR":Ut.check.isTableCell(s.parentElement)?"DIV":this.#it.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)}}}#hl(){this.#t.set("initViewportHeight",Zn.visualViewport.height),Gn||this.#sl.offCurrentController(),this.#t.mode.isBalloon?this.#o.hide():this.#t.mode.isSubBalloon&&this.$.subToolbar.hide(),this.#xl()}#cl(){Gn&&this.#it.get("toolbar_sticky")>-1&&(this.#o._resetSticky(),this.#il.__restoreMenuPosition()),this.#_l(),this.__setViewportSize()}#dl(){this.#it.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.#_l(),this.$.frameContext.has("documentType_use_page")&&this.$.frameContext.get("documentType").scrollWindow()}#ul(){this.#it.get("toolbar_sticky")>-1&&(this.#o._resetSticky(),this.#il.__restoreMenuPosition())}#wl(t){let e=t.getSelection().anchorNode;this.#Gs.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(),t.has("documentType_use_header")){const e=Ut.query.getParentElement(this.$.selection.selectionNode,this.$.format.isLine.bind(this.$.format));t.get("documentType").on(e)}}}))}#yl(){this.#il.dropdownOff(),this.#_l()}#fl(t){this.$.facade.changeFrameContext(t.get("key")),Ut.utils.addClass(this.$.commandDispatcher.targets.get("codeView"),"active"),this.#sl._toggleCodeViewButtons(!0)}#bl(t){this.$.facade.changeFrameContext(t.get("key")),Ut.utils.addClass(this.$.commandDispatcher.targets.get("markdownView"),"active"),this.#sl._toggleCodeViewButtons(!0)}};const Xn=class{#Sl=new Map;#El=new Map;$=null;constructor(t,e){const{product:s,options:i}=e;this.store=new xe(s),this.$={facade:t,store:this.store},this.#Tl(s,i),this.#Ml(),this.#Hl(s),this.#Ll(),this.#Nl(),this._eventOrchestrator=new Yn(this)}#Tl(t,e){const s=new Se(t),i=new Ee(this,t,e);this.#Sl.set("contextProvider",s),this.#Sl.set("optionProvider",i),this.#Sl.set("instanceCheck",new Te(s.frameContext)),this.#Sl.set("eventManager",new Ne(s,i,this.$))}#Ml(){const t=this.#Sl.get("contextProvider"),e=this.#Sl.get("optionProvider");Object.assign(this.$,{contextProvider:t,optionProvider:e,instanceCheck:this.#Sl.get("instanceCheck"),eventManager:this.#Sl.get("eventManager"),frameRoots:t.frameRoots,context:t.context,options:e.options,icons:t.icons,lang:t.lang,frameContext:t.frameContext,frameOptions:e.frameOptions})}#Hl(t){this.#El.set("offset",new Be(this)),this.#El.set("selection",new Ie(this)),this.#El.set("html",new gs(this)),this.#El.set("nodeTransform",new ms(this)),this.#El.set("format",new Oe(this)),this.#El.set("inline",new ze(this)),this.#El.set("listFormat",new Pe(this)),this.#El.set("char",new vs(this)),this.#El.set("shortcuts",new bs(this)),this.#El.set("component",new Xs(this)),this.#El.set("pluginManager",new Js(this,t)),this.#El.set("focusManager",new Qs(this)),this.#El.set("ui",new di(this)),this.#El.set("commandDispatcher",new ri(this)),this.#El.set("toolbar",new gi(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.#El.set("subToolbar",new gi(this,{keyName:"toolbar_sub",balloon:this.store.mode.isSubBalloon,balloonAlways:this.store.mode.isSubBalloonAlways,inline:!1,res:t.responsiveButtons_sub})),this.#El.set("menu",new fi(this)),this.#El.set("viewer",new wi(this)),this.#El.set("finder",new $i(this)),this.#El.set("history",ui(this))}#Nl(){for(const[,t]of this.#El)"function"==typeof t?._init&&t._init()}#Ll(){const t=this.#El.get("pluginManager");Object.assign(this.$,{offset:this.#El.get("offset"),selection:this.#El.get("selection"),format:this.#El.get("format"),inline:this.#El.get("inline"),listFormat:this.#El.get("listFormat"),html:this.#El.get("html"),nodeTransform:this.#El.get("nodeTransform"),char:this.#El.get("char"),component:this.#El.get("component"),focusManager:this.#El.get("focusManager"),pluginManager:t,plugins:t.plugins,ui:this.#El.get("ui"),commandDispatcher:this.#El.get("commandDispatcher"),history:this.#El.get("history"),shortcuts:this.#El.get("shortcuts"),toolbar:this.#El.get("toolbar"),subToolbar:this.#El.get("subToolbar"),menu:this.#El.get("menu"),viewer:this.#El.get("viewer"),finder:this.#El.get("finder")})}_destroy(){if(null===this.$)return;const t=[];for(const[e,s]of this.#El)try{s?._destroy?.()}catch(s){t.push(`[Logic:${e}] ${s.message}`)}this.#El.clear();try{this._eventOrchestrator?._removeAllEvents()}catch(e){t.push(`[EventOrchestrator] ${e.message}`)}this._eventOrchestrator=null;for(const[e,s]of this.#Sl)try{s?._destroy?.()}catch(s){t.push(`[Config:${e}] ${s.message}`)}this.#Sl.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 Jn=class{#F;$;constructor(t,e){const s=ye(t,e),i=new Xn(this,{product:s,options:e});this.#F=i,this.$=i.$,this.#Bl(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 Ut.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.#Al(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.#Al(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()})),Ut.utils.removeItem(this.$.context.get("toolbar_wrapper")),Ut.utils.removeItem(this.$.context.get("toolbar_sub_wrapper")),Ut.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}#Al(t){this.$.contextProvider.reset(t),this.$.optionProvider.resetFrame(t.get("options")),this.$.ui.reset(t)}#Il(t){this.$.store.set("initViewportHeight",Dt._w.visualViewport.height),this.#F._eventOrchestrator.__setViewportSize(),this.$.contextProvider.init(),this.#Al(this.$.frameRoots.get(this.$.store.get("rootKey"))),this.#rs(t),this.$.contextProvider.applyToRoots((t=>{this.#F._eventOrchestrator._addFrameEvents(t),this.#Vl(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(),Dt._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)}#Vl(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())),"document"===this.$.options.get("type")&&(t.set("documentType",new _e(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))}#rs(t){this.$.pluginManager.init(t),this.$.shortcuts._registerShortcuts(),this.$.commandDispatcher._initCommandButtons(),this.$.ui.init()}#Ol(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">'+Wt._setIframeStyleLinks(s.get("iframe_cssFileName"))+Wt._setAutoHeightStyle(s.get("height")),t.contentDocument.body.className=e.get("_editableClass"),t.contentDocument.body.setAttribute("contenteditable","true")}async#Bl(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=>{this.$.eventManager.addEvent(t.get("wysiwygFrame"),"load",(({target:s})=>{this.#Ol(s,this.$.optionProvider.options,t.get("options")),e()}))}));e.push(s)}})),this.$.contextProvider.applyToRoots((t=>{t.get("wrapper").appendChild(t.get("wysiwygFrame")),t.get("documentTypeInner")&&(this.$.options.get("_rtl")?t.get("wrapper").appendChild(t.get("documentTypeInner")):t.get("wrapper").insertBefore(t.get("documentTypeInner"),t.get("wysiwygFrame"))),t.get("documentTypePage")&&(this.$.options.get("_rtl")?t.get("wrapper").insertBefore(t.get("documentTypePage"),t.get("wysiwygFrame")):t.get("wrapper").appendChild(t.get("documentTypePage")),t.get("wrapper").appendChild(t.get("documentTypePageMirror")))})),e.length>0&&await Promise.all(e),this.#Il(t)}};function Qn(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 to=class{#X;#Rl;constructor(t,e,s){this.#X=e,this.kind=t.constructor.key||t.constructor.name,this.#Rl=Dt.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.#zl(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.#Rl;if(l&&(r.responseType=l),r.onreadystatechange=this.#Fl.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.#zl(e||this.url),s||=this.headers,i||=this.data,n||=this.responseType;const o=this.#Rl;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.#X.ui.hideLoading()}else{console.error(`[SUNEDITOR.ApiManager[${this.kind}].upload.serverException]`,o);try{l(Qn(o))}finally{this.#X.ui.hideLoading()}}},o.onerror=()=>{this.#X.ui.hideLoading(),l(new Error("Network error"))},o.send(i)}))}cancel(){this.#Rl&&(this.#Rl.onreadystatechange=null,this.#Rl.onload=null,this.#Rl.onerror=null,this.#Rl.abort())}#zl(t){return t.replace(/([^:])\/+/g,"$1/").replace(/\/(\?|#|$)/,"$1")}async#Fl(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.#X.ui.hideLoading()}else{console.error(`[SUNEDITOR.ApiManager[${this.kind}].upload.serverException]`,t);try{const e=Qn(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.#X.ui.alertOpen(n,"error")}catch(t){throw Error(`[SUNEDITOR.ApiManager[${this.kind}].upload.errorCallBack.fail] ${t.message}`)}finally{this.#X.ui.hideLoading()}}}};function eo(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 so=class{#X;#Pl;#un;#Oi=!1;#Pi=null;constructor(t,e,s){this.#X=e,this.useSearch=s.useSearch??!0;const i=Ut.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<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<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=Ut.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.#X,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.#Pl=n._loading,this.title=s.title,this.listClass=s.listClass||"se-preview-list",this.directData=s.data,this.url=s.url,this.urlHeader=s.headers,this.searchUrl=s.searchUrl,this.searchUrlHeader=s.searchUrlHeader,this.drawItemHandler=(s.drawItemHandler||eo).bind({thumbnail:s.thumbnail,props:s.props||[]}),this.selectorHandler=s.selectorHandler,this.columnSize=s.columnSize||4,this.folderDefaultPath="",this.closeArrow=this.#X.icons.menu_arrow_right,this.openArrow=this.#X.icons.menu_arrow_down,this.icon_folder=this.#X.icons.side_menu_folder_item,this.icon_folder_item=this.#X.icons.side_menu_folder,this.icon_item=this.#X.icons.side_menu_item,this.items=[],this.folders={},this.tree={},this.data={},this.selectedTags=[],this.keyword="",this.sideInner=null,this.apiManager=new to(this,e,{method:"GET"}),this.#un=t=>{Gt.isEsc(t.code)&&this.close()},i.appendChild(Ut.utils.createElement("DIV",{class:"se-browser-back"})),i.appendChild(o),this.#X.contextProvider.carrierWrapper.appendChild(i),this.#X.eventManager.addEvent(this.tagArea,"click",this.#Dl.bind(this)),this.#X.eventManager.addEvent(this.list,"click",this.#ql.bind(this)),this.#X.eventManager.addEvent(this.side,"click",this.#Wl.bind(this)),this.#X.eventManager.addEvent(o,"mousedown",this.#Ul.bind(this)),this.#X.eventManager.addEvent(o,"click",this.#Zl.bind(this)),this.#X.eventManager.addEvent(i.querySelector("form.se-browser-search-form"),"submit",this.#Gl.bind(this)),this.#X.eventManager.addEvent(this.sideOpenBtn=i.querySelector(".se-side-open-btn"),"click",this.#jl.bind(this)),this.#X.eventManager.addEvent([this.header,i.querySelector(".se-browser-main")],"mousedown",this.#Kl.bind(this))}open(t={}){this.#Be();const e=t.listClass||this.listClass;Ut.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.#X.ui.opendBrowser=this,this.closeArrow=this.#X.options.get("_rtl")?this.#X.icons.menu_arrow_left:this.#X.icons.menu_arrow_right,this.directData?this.#Yl(this.directData):this.#Xl(t.url||this.url,t.urlHeader||this.urlHeader,!1),this.body.style.maxHeight=Ut.utils.getClientSize().h-(this.#X.offset.getGlobal(this.body).top-o.scrollY)-20+"px"}close(){this.#Oe(),this.apiManager.cancel(),this.area.style.display="none",this.selectedTags=[],this.items=[],this.folders={},this.tree={},this.data={},this.keyword="",this.list.innerHTML=this.tagArea.innerHTML=this.titleArea.textContent="",this.#X.ui.opendBrowser=null,this.sideInner=null,this.host.browserInit?.()}search(t){this.searchUrl?(this.keyword=t,this.#Xl(this.searchUrl+"?keyword="+t,this.searchUrlHeader,!1)):(this.keyword=t.toLowerCase(),this.#Jl(this.items,!1))}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.#Pl.style.display="block"}closeBrowserLoading(){this.#Pl.style.display="none"}#Xl(t,e,s){this.apiManager.call({method:"GET",url:t,headers:e,callBack:this.#Ql.bind(this),errorCallBack:this.#tr.bind(this)}),s||(this.sideOpenBtn.style.display="none",this.showBrowserLoading())}#Jl(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,e&&(this.items=t,this.tagArea.innerHTML=a)}#Be(){this.#Oe(),this.#Pi=this.#X.eventManager.addGlobalEvent("keydown",this.#un,!0)}#Oe(){this.#Pi&&=this.#X.eventManager.removeGlobalEvent(this.#Pi)}#Yl(t){if(Array.isArray(t))return t.length>0&&this.#Jl(t,!0),!0;if("object"==typeof t){this.sideOpenBtn.style.display="",this.#er(t),this.side.innerHTML="";const e=this.sideInner=Ut.utils.createElement("div",null);if(this.#sr(this.tree,e),this.side.appendChild(e),this.folderDefaultPath){const t=e.querySelector(`[data-command="${this.folderDefaultPath}"]`);t.click(),this.folderDefaultPath.includes("/")&&(Ut.utils.removeClass(t.parentElement,"se-menu-hidden"),t.parentElement.previousElementSibling.querySelector("button").innerHTML=this.openArrow)}return!0}return!1}#er(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.#er(i,n)}))}#sr(t,e){for(const s in t){const i=t[s];if(i)if(Object.keys(i.children).length>0){const t=Ut.utils.createElement("div",i.key?{"data-command":i.key,"aria-label":i.name}:null,`<span class="se-menu-icon">${i.key?this.icon_folder:this.icon_folder_item}</span><span>${i.name}</span>`),s=Ut.utils.createElement("div",{class:"se-menu-folder"},t);t.insertBefore(Ut.utils.createElement("button",null,this.closeArrow),t.firstElementChild);const n=document.createElement("div");Ut.utils.addClass(n,"se-menu-child|se-menu-hidden"),this.#sr(i.children,n),s.appendChild(n),e.appendChild(s)}else{const t=Ut.utils.createElement("div",{"data-command":i.key,"aria-label":i.name,class:"se-menu-folder-item"},`<span class="se-menu-icon">${this.icon_item}</span><span>${i.name}</span>`);if(e===this.sideInner){const s=Ut.utils.createElement("div",{class:"se-menu-folder"},t);e.appendChild(s)}else e.appendChild(t)}}}#Ql(t){try{const e=JSON.parse(t.responseText),s=e.result;if(this.#Yl(s))return;e.nullMessage&&(this.list.innerHTML=e.nullMessage)}catch(t){throw Error(`[SUNEDITOR.browser.drawList.fail] cause: "${t.message}"`)}finally{this.closeBrowserLoading()}}#tr(t,e){throw this.closeBrowserLoading(),Error(`[SUNEDITOR.browser.get.serverException] status: ${e.status}, response: ${t.errorMessage||e.responseText}`)}#Dl(t){const e=Ut.query.getEventTarget(t);if(!Ut.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),Ut.utils.removeClass(i,"on")):(this.selectedTags.push(s),Ut.utils.addClass(i,"on")),this.#Jl(this.items,!1)}#ql(t){const e=Ut.query.getEventTarget(t);if(t.preventDefault(),t.stopPropagation(),e===this.list)return;const s=Ut.query.getCommandTarget(e);s&&(this.close(),this.selectorHandler(s))}#Wl(t){const e=Ut.query.getEventTarget(t);if(t.stopPropagation(),/^button$/i.test(e.nodeName)){const t=e.parentElement.parentElement.querySelector(".se-menu-child");return void(Ut.utils.hasClass(t,"se-menu-hidden")?(Ut.utils.removeClass(t,"se-menu-hidden"),e.innerHTML=this.openArrow):(Ut.utils.addClass(t,"se-menu-hidden"),e.innerHTML=this.closeArrow))}const s=Ut.query.getCommandTarget(e);if(!s||Ut.utils.hasClass(s,"active"))return;const i=this.data[s.getAttribute("data-command")];Ut.utils.removeClass(this.side.querySelectorAll(".active"),"active"),Ut.utils.addClass([s,Ut.query.getParentElement(s,".se-menu-folder")],"active"),this.tagArea.innerHTML="","string"==typeof i?this.#Xl(i,this.urlHeader,!0):this.#Jl(i,!1)}#Ul(t){const e=Ut.query.getEventTarget(t);/se-browser-inner/.test(e.className)?this.#Oi=!0:this.#Oi=!1}#Zl(t){const e=Ut.query.getEventTarget(t);t.stopPropagation(),(/close/.test(e.getAttribute("data-command"))||this.#Oi)&&this.close()}#Gl(t){const e=t.currentTarget;t.preventDefault(),this.search(e.querySelector('input[type="text"]').value)}#jl(t){const e=Ut.query.getEventTarget(t);Ut.utils.hasClass(e,"active")?(Ut.utils.removeClass(this.side,"se-side-show"),Ut.utils.removeClass(e,"active")):(Ut.utils.addClass(this.side,"se-side-show"),Ut.utils.addClass(e,"active"))}#Kl({target:t}){t!==this.sideOpenBtn&&Ut.utils.hasClass(this.sideOpenBtn,"active")&&(Ut.utils.removeClass(this.side,"se-side-show"),Ut.utils.removeClass(this.sideOpenBtn,"active"))}},{isTouchDevice:io}=Dt,no=240,oo=120,lo={hex:"#FFFFFF",r:255,g:255,b:255,h:0,s:1,l:1};let ro,ao=0,ho=!1,co=!1,uo=120,po=120,go=lo,mo=!1;const{slider:fo,offscreenCanvas:vo,offscreenCtx:bo,wheel:yo,wheelCtx:wo,wheelPointer:Co,gradientBar:_o,gradientPointer:xo,fanalColorHex:$o,fanalColorBackground:ko}=function(){const t=document.createElement("canvas");t.width=no,t.height=no;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;">${lo.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=Ut.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 So(t){const{target:e,touches:s}=t,i=s[0].clientX,n=s[0].clientY;e===yo?(t.preventDefault(),co=!1,ho=!0,Ho(i,n)):e===_o&&(t.preventDefault(),co=!0,ho=!1,Lo(i))}function Eo(t){t.preventDefault();const{touches:e}=t,s=e[0].clientX,i=e[0].clientY;ho?Ho(s,i):co&&Lo(s)}function To({target:t,clientX:e,clientY:s}){t===yo?(co=!1,ho=!0,Ho(e,s)):t===_o&&(co=!0,ho=!1,Lo(e))}function Mo({clientX:t,clientY:e}){ho?Ho(t,e):co&&Lo(t)}function Ho(t,e){const s=yo.getBoundingClientRect();t=t-s.left-oo,e=e-s.top-oo;const i=180*Math.atan2(e,t)/Math.PI,n=Math.min(Math.sqrt(t*t+e*e),oo),o=oo+n*Math.cos(i*Math.PI/180),l=oo+n*Math.sin(i*Math.PI/180);Co.style.left=`${o}px`,Co.style.top=`${l}px`,function(t,e){uo=t,po=e,No(Bo())}(o,l),Ao()}function Lo(t){const e=_o.getBoundingClientRect();let s=t-e.left;s=Math.max(14,Math.min(s,e.width-14)),xo.style.left=`${s}px`,function(t){const e=_o.getBoundingClientRect();let s=t-e.left;s<0&&(s=0);s>e.width&&(s=e.width);const i=14;s>=_o.width-i?s=_o.width:s<=i&&(s=0);const n=1-s/e.width;ao=n,Oo()}(t),Ao()}function No(t){const e=_o.getContext("2d"),s=e.createLinearGradient(0,0,_o.width,0);s.addColorStop(0,"black"),s.addColorStop(1,t.hex),e.fillStyle=s,e.fillRect(0,0,_o.width,_o.height)}function Bo(){return Vo(bo)}function Ao(){ro.color=go=Vo(wo),Io(go.hex)}function Io(t){ko.style.backgroundColor=$o.textContent=t}function Vo(t){const e=t.getImageData(uo,po,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[zo(o),zo(l),zo(r)]}(e);const o=uo-oo,l=po-oo;Math.sqrt(o*o+l*l)<3&&(n=1-ao),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:zo(n)}}function Oo(){wo.clearRect(0,0,no,no),wo.drawImage(vo,0,0),wo.globalAlpha=ao,wo.fillStyle="black",wo.beginPath(),wo.arc(oo,oo,oo,0,2*Math.PI),wo.fill(),wo.globalAlpha=1}function Ro(t){return t*Math.PI/180}function zo(t){const e=Math.pow(10,10);return Math.round(t*e)/e}function Fo(){!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<=oo;s+=1){t.beginPath();const i=50+(oo-s)/oo*50;t.fillStyle=`hsl(${e}, 100%, ${i}%)`;const n=oo+Math.cos(Ro(e))*s,o=oo-Math.sin(Ro(e))*s;t.arc(n,o,1.5,0,2*Math.PI),t.fill()}mo=!0}(bo),mo&&Oo()}Fo();const Po=class{#X;#ir;#nr;#or;#lr;#rr;#ar;constructor(t,e,s={},i=""){if(this.#X=e,this.inst=t,this.ctx={wheelX:uo,wheelY:po,lightness:ao,wheelPointerX:"50%",wheelPointerY:"50%",gradientPointerX:"calc(100% - 14px)",color:lo},this.isOpen=!1,this.controlle=null,this.#ir=null,this.#nr=null,this.#or=null,this.#lr=null,this.#rr=null,this.#ar=null,!s.isNewForm){const n=function({lang:t,icons:e},s){const i=Ut.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 Ms(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 go}open(t){this.attach(),this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null})}close(){this.ctx={gradientPointerX:xo.style.left,wheelPointerX:Co.style.left,wheelPointerY:Co.style.top,wheelX:uo,wheelY:po,lightness:ao,color:ro?.color||""},this.controller.close()}attach(t){mo||Fo(),this.init(),(t||this.circle).appendChild(fo),ro=this.ctx,ro&&(uo=ro.wheelX,po=ro.wheelY,ao=ro.lightness,Co.style.left=ro.wheelPointerX,Co.style.top=ro.wheelPointerY,xo.style.left=ro.gradientPointerX,Io(ro.color.hex),Oo(),No(Bo())),io&&(this.#rr=this.#X.eventManager.addGlobalEvent("touchstart",So,{passive:!1,capture:!0}),this.#nr=this.#X.eventManager.addGlobalEvent("touchmove",Eo,!0),this.#ar=this.#X.eventManager.addGlobalEvent("touchend",(()=>{ho=!1,co=!1}),!0)),this.#ir=this.#X.eventManager.addGlobalEvent("mousedown",To,{passive:!1,capture:!0}),this.#lr=this.#X.eventManager.addGlobalEvent("mousemove",Mo,!0),this.#or=this.#X.eventManager.addGlobalEvent("mouseup",(()=>{ho=!1,co=!1}),!0),this.isOpen=!0}init(){this.isOpen=!1,ho=!1,co=!1,this.#ir&&=this.#X.eventManager.removeGlobalEvent(this.#ir),this.#lr&&=this.#X.eventManager.removeGlobalEvent(this.#lr),this.#or&&=this.#X.eventManager.removeGlobalEvent(this.#or),this.#rr&&=this.#X.eventManager.removeGlobalEvent(this.#rr),this.#nr&&=this.#X.eventManager.removeGlobalEvent(this.#nr),this.#ar&&=this.#X.eventManager.removeGlobalEvent(this.#ar)}},Do=["#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 qo(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 Wo=class{#X;constructor(t,e,s,i){this.#X=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||=Do,o=s===Do?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">${qo(n,o)}</div>`,n=[]),"object"==typeof t&&(l+=`<div class="se-selector-color">${qo(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>`,Ut.utils.createElement("DIV",{class:"se-list-inner"},l)}(this.#X,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.#X.icons.color_checked,"image/svg+xml");this.checkedIcon=n.documentElement,i.disableHEXInput||(this.hueSlider=new Po(this,e,i.hueSliderOptions,"se-dropdown"),this.#X.eventManager.addEvent(this.target.querySelector(".__se_hue"),"click",this.#hr.bind(this)),this.#X.eventManager.addEvent(this.inputElement,"input",this.#cr.bind(this)),this.#X.eventManager.addEvent(this.target.querySelector("form"),"submit",this.#dr.bind(this))),i.disableRemove||this.#X.eventManager.addEvent(this.target.querySelector(".__se_remove"),"click",this.#ur.bind(this)),this.#X.eventManager.addEvent(this.target,"click",this.#pr.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.#gr(t,s))||this.defaultColor;i=Wt.isHexColor(i)?i:Wt.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),Ut.utils.addClass(t,"active")):(Ut.utils.removeClass(t,"active"),t.contains(this.checkedIcon)&&Ut.utils.removeItem(this.checkedIcon));this.#mr(this.#fr(i))}setHexColor(t){this.currentColor=t,this.inputElement.style.borderColor=t}hueSliderClose(){this.hueSlider.close()}hueSliderAction(t){this.#mr(t.hex)}hueSliderCancelAction(){this.form.style.display="block",this.host.colorPickerHueSliderClose?.()}#mr(t){t=!t||/^#/.test(t)?t:"#"+t,this.inputElement.value=t,this.setHexColor.call(this,t)}#gr(t,e){let s="";const i=this.styleProperties;for(;t&&!e(t)&&!Ut.check.isWysiwygFrame(t)&&0===s.length;)W(t)&&t.style[i]&&(s=t.style[i]),t=t.parentNode;return s}#fr(t){if(!t||/^#/.test(t))return t;const e=Ut.utils.createElement("div",{style:"display: none; color: "+t}),s=Dt._w.getComputedStyle(Dt._d.body.appendChild(e)).color.match(/\d+/g).map((function(t){return parseInt(t,10)}));return Ut.utils.removeItem(e),s.length>=3?"#"+((1<<24)+(s[0]<<16)+(s[1]<<8)+s[2]).toString(16).substring(1):""}#hr(){this.hueSlider.open(this.targetButton),this.host.colorPickerHueSliderOpen?.()}#dr(t){t.preventDefault(),this.host.colorPickerAction?.(this.currentColor)}#pr(t){const e=Ut.query.getEventTarget(t).getAttribute("data-value");e&&this.host.colorPickerAction?.(e)}#ur(){this.host.colorPickerAction?.(null)}#cr(t){const e=Ut.query.getEventTarget(t);this.setHexColor(e.value)}},{_w:Uo}=Dt,Zo={w:"ns-resize",h:"ew-resize",c:"nwse-resize",wRTL:"ns-resize",hRTL:"ew-resize",cRTL:"nesw-resize"};const Go=class{#X;#vr;#br;#yr;#Vi;#ye;#Pi=null;#wr=!1;#Cr=null;#_r=null;#xr="";#$r=0;#kr=0;#Sr=null;#Er=null;constructor(t,e,s){this.#X=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.#vr=this.#X.contextProvider.carrierWrapper.querySelector(".se-modal"),this.#br=this.#X.contextProvider.carrierWrapper.querySelector(".se-modal .se-modal-inner"),this.#Vi=[this.#Tr.bind(this),this.#Mr.bind(this)],this.#br.appendChild(s),this.#X.eventManager.addEvent(s.querySelector("form"),"submit",this.#He.bind(this)),this.#wr=!this.#X.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.#yr=s.querySelector(".se-modal-resize-form"))&&(this.#yr=s.querySelector(".se-modal-body"))&&(this.#X.eventManager.addEvent(s.querySelector(".se-modal-resize-handle-w"),"mousedown",this.#Hr.bind(this,"w")),this.#X.eventManager.addEvent(s.querySelector(".se-modal-resize-handle-h"),"mousedown",this.#Hr.bind(this,"h")),this.#X.eventManager.addEvent(s.querySelector(".se-modal-resize-handle-c"),"mousedown",this.#Hr.bind(this,"c")),this.#ye={mousemove:this.#Lr.bind(this),mouseup:this.#Nr.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${Ut.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.#X.ui.offCurrentModal(),this.#Br(!0),this.#wr&&(this.#Cr&&this.#X.eventManager.removeEvent(this.#Cr),this.#Cr=this.#X.eventManager.addEvent(this.#br,"click",this.#Vi[1])),this.#Pi&&=this.#X.eventManager.removeGlobalEvent(this.#Pi),this.#Pi=this.#X.eventManager.addGlobalEvent("keydown",this.#Vi[0]),this.isUpdate=this.kind===this.#X.ui.currentControllerName,this.#X.ui.opendModal=this,this.isUpdate||this.inst.modalInit?.(),this.inst.modalOn?.(this.isUpdate),Ut.utils.addClass(this.#vr,"se-backdrop-show"),Ut.utils.addClass(this.form,"se-modal-show"),this.#yr){const t=this.#Ar(),{maxWidth:e,maxHeight:s}=Uo.getComputedStyle(this.form),i=this.form.offsetWidth-t.width+"px",n=`${this.form.offsetTop+(this.form.offsetHeight-this.#yr.offsetHeight)}px`;e&&"string"==typeof this.#xr&&Ut.utils.setStyle(this.#yr,"max-width",`calc(${e} - ${i})`),s&&Ut.utils.setStyle(this.#yr,"max-height",`calc(${s} - ${n})`)}this.focusElement&&this.focusElement.focus()}close(){this.#Oe(),this.#Br(!1),Uo.setTimeout((()=>{this.#X.ui.opendModal=null}),0),this.#wr&&this.#Cr&&(this.#X.eventManager.removeEvent(this.#Cr),this.#Cr=null),this.#Pi&&=this.#X.eventManager.removeGlobalEvent(this.#Pi),Ut.utils.removeClass(this.#vr,"se-backdrop-show"),Ut.utils.removeClass(this.form,"se-modal-show"),this.inst.modalInit?.(),this.inst.modalOff?.(this.isUpdate),this.isUpdate||this.#X.focusManager.focus()}#Br(t){const e=this.#X.ui.opendControllers;for(let s=0;s<e.length;s++)e[s].fixed=t,e[s].form.style.display=t?"none":"block"}#Ar(){const t=this.#X.offset.getGlobal(this.#yr);return this.#$r=t.top,this.#kr=t.left,t}#Be(t){this.#Oe(),this.#X.ui.enableBackWrapper(Zo[t]),this.#Sr=this.#X.eventManager.addGlobalEvent("mousemove",this.#ye.mousemove,!0),this.#Er=this.#X.eventManager.addGlobalEvent("mouseup",this.#ye.mouseup,!0)}#Oe(){this.#X.ui.disableBackWrapper(),this.#Sr&&=this.#X.eventManager.removeGlobalEvent(this.#Sr),this.#Er&&=this.#X.eventManager.removeGlobalEvent(this.#Er)}async#He(t){t.preventDefault(),t.stopPropagation(),this.#X.ui.showLoading();try{const t=await this.inst.modalAction();!1===t?this.#X.ui.hideLoading():void 0===t?this.close():(this.close(),this.#X.ui.hideLoading())}catch(t){throw this.close(),this.#X.ui.hideLoading(),Error(`[SUNEDITOR.Modal[${this.kind}].warn] ${t.message}`)}}#Mr(t){const e=Ut.query.getEventTarget(t);(/close/.test(e.getAttribute("data-command"))||e===this.#br)&&this.close()}#Tr(t){Gt.isEsc(t.code)&&this.close()}#Hr(t,e){this.#_r=Ut.query.getEventTarget(e),Ut.utils.addClass(this.#_r,"active"),this.#Be(this.#xr=t+(this.#X.options.get("_rtl")?"RTL":""))}#Lr(t){switch(this.#xr){case"w":case"wRTL":{const e=t.clientY-this.#$r-this.#yr.offsetHeight;this.#yr.style.height=this.#yr.offsetHeight+e+"px";break}case"h":{const e=t.clientX-this.#kr-this.#yr.offsetWidth;this.#yr.style.width=this.#yr.offsetWidth+e+"px";break}case"hRTL":{const e=this.#kr-t.clientX;this.#yr.style.width=this.#yr.offsetWidth+e+"px";break}case"c":{const e=t.clientX-this.#kr-this.#yr.offsetWidth,s=t.clientY-this.#$r-this.#yr.offsetHeight;this.#yr.style.width=this.#yr.offsetWidth+e+"px",this.#yr.style.height=this.#yr.offsetHeight+s+"px";break}case"cRTL":{const e=this.#kr-t.clientX,s=t.clientY-this.#$r-this.#yr.offsetHeight;this.#yr.style.width=this.#yr.offsetWidth+e+"px",this.#yr.style.height=this.#yr.offsetHeight+s+"px";break}}this.#Ar(),this.inst.modalResize?.()}#Nr(){Ut.utils.removeClass(this.#_r,"active"),this.#_r=null,this.#Oe()}};function jo(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 Ko=class{#X;constructor(t,e,s){this.#X=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 to(this,e),this._resetInfo,this._checkInfo}upload(t,e,s,i,n){this.#X.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.#X.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.#X.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()===jo(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();jo(t,"index")&&n.includes(Number(jo(t,"index")))?i.push(Number(jo(t,"index"))):(i.push(this.infoIndex),t.removeAttribute("data-se-index"),this.#Ir(t,null))}if(t&&this.loadEventName)this.#X.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.#X.eventManager.triggerEvent(this.actionEventName,n),this.#X.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.#X.eventManager.triggerEvent(this.actionEventName,{...t,index:this.infoList[e].index,pluginName:this.kind}),this.#X.eventManager.triggerEvent("onFileManagerAction",{...t,index:this.infoList[e].index,pluginName:this.kind});this.infoList=[],this.infoIndex=0}#Vr(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.#X.eventManager.triggerEvent(this.actionEventName,{element:null,index:t,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind}))}#Ir(t,e){let s=Number(jo(t,"index")),i=null,n="";if(e||={name:jo(t,"file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:Number(jo(t,"file-size"))||0},s&&this.#X.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=jo(t,"file-name"),i.size=Number(jo(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(jo(e,"index")))}.bind(this,this.#Vr.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.#X.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.#X.eventManager.triggerEvent(this.actionEventName,o),this.#X.eventManager.triggerEvent("onFileManagerAction",{...o,pluginName:this.kind})}},{_w:Yo,NO_EVENT:Xo}=Dt;const Jo=class{#X;#Or;#Rr;#zr;#Fr;constructor(t,e,s){this.#X=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=Zt.get(s.uploadSizeLimit,0)||null,this.uploadSingleSizeLimit=Zt.get(s.uploadSingleSizeLimit,0)||null,this.input=Ut.utils.createElement("input",{type:"file",accept:s.acceptedFormats||"*"}),this.#X.eventManager.addEvent(this.input,"change",this.#Pr.bind(this)),this.fileManager=new Ko(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${Ut.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${Ut.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${Ut.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>",Ut.utils.createElement("DIV",null,r)}(t,s,this.relList);if(this.host=(Yo.location.origin+Yo.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.#Rr=this.relList.length>0,this.#Rr){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(Ut.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.#X.icons.checked+"</span>"));this.#zr=new Ls(t,{checkList:!0,position:"right-middle",dir:"ltr"}),this.#zr.on(this.relButton,this.#Dr.bind(this)),this.#zr.create(n),this.#X.eventManager.addEvent(this.relButton,"click",this.#qr.bind(this))}this.#Or=e,this.#Or.querySelector(".se-anchor-editor").appendChild(i),this.#Fr=new Ls(t,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.#Fr.on(this.urlInput,this.#Wr.bind(this)),this.#X.eventManager.addEvent(this.newWindowCheck,"change",this.#Ur.bind(this)),this.#X.eventManager.addEvent(this.downloadCheck,"change",this.#Zr.bind(this)),this.#X.eventManager.addEvent(this.urlInput,"input",this.#Gr.bind(this)),this.#X.eventManager.addEvent(this.urlInput,"focus",this.#jr.bind(this)),this.#X.eventManager.addEvent(this.bookmarkButton,"click",this.#Kr.bind(this)),this.#X.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.#Yr(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.#X.selection.get().toString().trim(),this.newWindowCheck.checked=this.openNewWindow,this.titleInput.value="";this.#Xr(t&&this.currentTarget?this.currentTarget.rel:this.defaultRel.default||""),this.#Jr(this.linkValue)}create(t){if(0===this.linkValue.length)return null;const e=this.linkValue,s=0===this.displayInput.value.length?e:this.displayInput.value,i=this.currentTarget||Ut.utils.createElement("A");return this.#Qr(i,e,s,this.titleInput.value,t),this.linkValue=this.preview.textContent=this.urlInput.value=this.displayInput.value="",i}init(){this.currentTarget=null,this.linkValue=this.preview.textContent=this.urlInput.value="",this.displayInput.value="",this.newWindowCheck.checked=!1,this.downloadCheck.checked=!1,this.#Xr(this.defaultRel.default||"")}#Qr(t,e,s,i,n){!this.#Yr(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}#Yr(t){const e=Yo.location.href.replace(/\/$/,"");return 0===t.indexOf("#")||0===t.indexOf(e)&&t.indexOf("#")===(e.includes("#")?e.substring(0,e.indexOf("#")).length:e.length)}#Xr(t){if(!this.#Rr)return;const e=this.currentRel=t?t.split(" "):[],s=this.#zr.form.querySelectorAll("button");for(let t,i=0,n=s.length;i<n;i++)t=s[i].getAttribute("data-command"),e.includes(t)?Ut.utils.addClass(s[i],"se-checked"):Ut.utils.removeClass(s[i],"se-checked");this.relPreview.title=this.relPreview.textContent=e.join(" "),e.length>0?Ut.utils.addClass(this.relButton,"on"):Ut.utils.removeClass(this.relButton,"on")}#ta(t){const e=Ut.query.getListChildren(this.#X.frameContext.get("wysiwyg"),(t=>/h[1-6]/i.test(t.nodeName)||Ut.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(Ut.check.isAnchor(t)?`<div><span class="se-text-prefix-icon">${this.#X.icons.bookmark_anchor}</span>${t.id}</div>`:`<div style="${t.style.cssText}">${t.textContent}</div>`));0===i.length?this.#Fr.close():(this.#Fr.create(i,n),this.#Fr.open(this.#X.options.get("_rtl")?"bottom-right":""))}#Jr(t){const e=this.preview,s=this.#X.options.get("defaultUrlProtocol"),i=this.noAutoPrefix,n=/^(mailto:|tel:|sms:|https*:\/\/|#)/.test(t)||0===t.indexOf(s),o=!!s&&RegExp("^"+qt.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.#Yr(t)?(this.bookmark.style.display="block",Ut.utils.addClass(this.bookmarkButton,"active")):(this.bookmark.style.display="none",Ut.utils.removeClass(this.bookmarkButton,"active")),!this.#Yr(t)&&this.downloadCheck.checked?this.download.style.display="block":this.download.style.display="none"}#ea(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(" ")}#sa(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}#ia(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#na(t){const e=await this.#X.eventManager.triggerEvent("onFileUploadError",{error:t});if(!1===e)return;const s=e===Xo?t.errorMessage:e||t.errorMessage;this.#X.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.fileUpload.error]",s)}#oa(t){const e=JSON.parse(t.responseText);e.errorMessage?this.#na(e):this.#ia(e)}async#Pr(t){const e=Ut.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.#oa.bind(this),s),n=await this.#X.eventManager.triggerEvent("onFileUploadBefore",{info:s,handler:i});return void 0===n||!1!==n&&(null!==n&&"object"==typeof n&&i(n),void(!0!==n&&n!==Xo||i(null)))}#qr(){this.#zr.open(this.#X.options.get("_rtl")?"left-middle":"")}#Wr(t){const e=t.id||"h_"+Math.random().toString().replace(/.+\./,"");t.id=e,this.urlInput.value="#"+e,this.#Jr(this.urlInput.value),this.#Fr.close(),this.urlInput.focus()}#Dr(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(", ")}#Gr(t){const e=Ut.query.getEventTarget(t).value.trim();this.#Jr(e),this.#Yr(e)?this.#ta(e):this.#Fr.close()}#jr(){const t=this.urlInput.value;this.#Yr(t)&&this.#ta(t)}#Kr(){let t=this.urlInput.value;this.#Yr(t)?(t=t.substring(1),this.bookmark.style.display="none",Ut.utils.removeClass(this.bookmarkButton,"active")):(t="#"+t,this.bookmark.style.display="block",Ut.utils.addClass(this.bookmarkButton,"active"),this.downloadCheck.checked=!1,this.download.style.display="none",this.#ta(t)),this.urlInput.value=t,this.#Jr(t),this.urlInput.focus()}#Ur(t){if("string"!=typeof this.defaultRel.check_new_window)return;Ut.query.getEventTarget(t).checked?this.#Xr(this.#ea(this.defaultRel.check_new_window)):this.#Xr(this.#sa(this.defaultRel.check_new_window))}#Zr(t){Ut.query.getEventTarget(t).checked?(this.download.style.display="block",this.bookmark.style.display="none",Ut.utils.removeClass(this.bookmarkButton,"active"),this.linkValue=this.preview.textContent=this.urlInput.value=this.urlInput.value.replace(/^#+/,""),"string"==typeof this.defaultRel.check_bookmark&&this.#Xr(this.#ea(this.defaultRel.check_bookmark))):(this.download.style.display="none","string"==typeof this.defaultRel.check_bookmark&&this.#Xr(this.#sa(this.defaultRel.check_bookmark)))}},Qo={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 Jn(i,e)}};class tl extends ki{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 el extends tl{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 sl extends tl{static type="command";action(t){throw new Error(`[${this.constructor.name}] Abstract method 'action()' must be implemented`)}}class il extends tl{static type="dropdown";on(t){}action(t){throw new Error(`[${this.constructor.name}] Abstract method 'action()' must be implemented`)}}class nl extends tl{static type="dropdown-free";on(t){}off(){}}class ol extends tl{static type="field"}class ll extends tl{static type="input";toolbarInputKeyDown(t){}toolbarInputChange(t){}}class rl extends tl{static type="modal";open(t){throw new Error(`[${this.constructor.name}] Abstract method 'open()' must be implemented`)}}class al extends tl{static type="popup";show(){throw new Error(`[${this.constructor.name}] Abstract method 'show()' must be implemented`)}}const hl=class extends sl{static key="blockquote";static className="";constructor(t){super(t),this.title=this.$.lang.tag_blockquote,this.icon="blockquote",this.quoteTag=Ut.utils.createElement("BLOCKQUOTE")}active(t,e){return/blockquote/i.test(t?.nodeName)?(Ut.utils.addClass(e,"active"),!0):(Ut.utils.removeClass(e,"active"),!1)}action(){const t=Ut.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))}},cl=["javascript","typescript","html","css","json","python","java","c","cpp","csharp","go","rust","ruby","php","swift","kotlin","sql","bash","markdown","xml","yaml"];class dl extends sl{static key="codeBlock";static className="";#la;#ra;#aa;#ha;#ca;#da;#ua;#pa;#ga;constructor(t,e){if(super(t),this.title=this.$.lang.codeBlock||"Code Block",this.icon="code_block",this.#la=Ut.utils.createElement("PRE"),this.#aa=e?.langs??cl,!this.#aa.length)return;this.afterItem=Ut.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":dl.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>",Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-code-block"},i)}(this.$,this.#aa);this.#ra=s.querySelectorAll("li button"),this.$.menu.initDropdownTarget({key:dl.key,type:"dropdown"},s);const i=Ut.utils.createElement("DIV",{class:"se-controller se-code-lang"});this.#ha=Ut.utils.createElement("DIV",{class:"se-code-lang-button"}),this.#ma(""),i.appendChild(this.#ha),this.#da=new Ms(this,this.$,i,{position:"top",isWWTarget:!0}),this.#ga=Wt.debounce((t=>{this.#pa=this.$.eventManager.removeEvent(this.#pa),t&&i.contains(t.relatedTarget)?this.#fa():this.#va()}),0),this.#ca=new Ls(this.$,{position:"bottom-right",dir:this.$.options.get("_rtl")?"rtl":"ltr",maxHeight:"214px",minWidth:"132px",closeMethod:this.#ga}),this.#ca.on(this.#ha,this.#ba.bind(this)),this.#ya(""),this.$.eventManager.addEvent(this.#ha,"click",(t=>{if(t.preventDefault(),t.stopPropagation(),this.#ca.isOpen)this.#ca.close();else{const t=this.#wa(this.#ua);this.#ya(t);const e=this.#ca.items,s=t?e.indexOf(t):0;this.#ca.open(null,s>=0?`[data-index="${s}"]`:null)}}))}onMouseMove({event:t}){if(!this.#da)return;const e=Ut.query.getEventTarget(t).closest("pre");e&&!this.#Ca()&&0===this.$.ui.opendControllers.length&&this.#_a(e)}active(t,e){return/^PRE$/i.test(t?.nodeName)?(Ut.utils.addClass(e,"active"),!0):(Ut.utils.removeClass(e,"active"),!1)}action(t){const e=t?.getAttribute("data-value")||"",s=this.$.selection.getNode(),i=Ut.query.getParentElement(s,(t=>/^PRE$/i.test(t.nodeName)));if(i&&!e)this.$.format.setLine(Ut.utils.createElement(this.$.options.get("defaultLine")));else if(i||this.$.format.setBrLine(this.#la.cloneNode(!1)),e){const t=Ut.query.getParentElement(this.$.selection.getNode(),(t=>/^PRE$/i.test(t.nodeName)));t&&this.#xa(t,e)}this.$.menu.dropdownOff(),this.$.focusManager.focus(),this.$.history.push(!1)}on(){if(!this.#ra)return;const t=this.#wa(this.$.selection.getNode());for(let e=0,s=this.#ra.length;e<s;e++){const s=this.#ra[e];Ut.utils.toggleClass(s,"active",s.getAttribute("data-value")===t)}}#_a(t){this.#ua===t&&this.#da.isOpen||(this.#ua&&this.#ua!==t&&Ut.utils.removeClass(this.#ua,"se-pre-code-focus"),this.#ua=t,Ut.utils.addClass(t,"se-pre-code-focus"),this.#da.open(t,null,{passive:!0,addOffset:{right:t.offsetWidth}}),this.#ma(this.#wa(t)),this.#$a())}#va(){this.#ca?.isOpen||this.#ka()}#ka(){this.#ca?.isOpen&&this.#ca.close(),Ut.utils.removeClass(this.#ua,"se-pre-code-focus"),this.#da.close(!0)}controllerClose(){this.#ua&&(Ut.utils.removeClass(this.#ua,"se-pre-code-focus"),this.#ua=null)}#ba(t){this.#ua&&(this.#xa(this.#ua,t),this.#ma(t),this.#ca.close(),this.#va(),this.$.focusManager.focus(),this.$.history.push(!1))}#$a(){this.#pa??=this.$.eventManager.addEvent(this.#ua,"mouseleave",this.#ga)}#fa(){this.#pa??=this.$.eventManager.addEvent(this.#da.form,"mouseleave",this.#ga)}#ya(t){const e=this.$.lang.codeLanguage_none||"None",s=t&&!this.#aa.includes(t),i=s?["",t,...this.#aa]:["",...this.#aa],n=s?[e,t,...this.#aa]:[e,...this.#aa];this.#ca.create(i,n)}#ma(t){this.#ha.innerHTML=`<span class="se-code-lang-icon">&lt;/&gt;</span><span class="se-code-lang-text">${t||this.$.lang.codeLanguage||"Language"}</span>`}#Ca(){return this.#ca?.isOpen||this.#da?.isOpen}#wa(t){const e="PRE"===t?.nodeName?t:Ut.query.getParentElement(t,(t=>/^PRE$/i.test(t.nodeName)));return e&&e.className.match(/language-(\S+)/)?.[1]||""}#xa(t,e){t.className=t.className.replace(/\s*language-\S+/g,"").trim(),e?(Ut.utils.addClass(t,"language-"+e),t.setAttribute("data-se-lang",e)):t.removeAttribute("data-se-lang")}destroy(){this.#ua&&Ut.utils.removeClass(this.#ua,"se-pre-code-focus"),this.#da?.form?.parentNode?.removeChild(this.#da.form),this.#ua=null}}const ul=dl,{_w:pl,_d:gl}=Dt;const ml=class extends sl{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 to(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=Ut.utils.createElement("div",{class:i},e.innerHTML);t=Ut.utils.createElement("div",{style:"position: absolute; top: -10000px; left: -10000px; width: 21cm; columns: 21cm; height: auto;"},n);const o=pl.getComputedStyle(e).padding,l=Ut.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}`,gl.body.appendChild(t),!1===await this.$.eventManager.triggerEvent("onExportPDFBefore",{target:t}))return;return void await this.#Sa(t)}catch(t){console.error("[SUNEDITOR.plugins.exportPDF.error]",t.message)}finally{Ut.utils.removeItem(t),this.$.ui.hideLoading()}}async#Sa(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=Ut.utils.createElement("A",{href:o,download:l,style:"display: none;"},null);try{gl.body.appendChild(r),r.click()}finally{pl.setTimeout((()=>{Ut.utils.removeItem(r),URL.revokeObjectURL(o)}),100)}}},{NO_EVENT:fl}=Dt;class vl extends sl{static key="fileUpload";static className="";static options={eventIndex:1e4};static component(t){return Ut.check.isAnchor(t)&&t.hasAttribute("data-se-file-download")?t:null}#Ea;#Ta=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=Zt.get(e.uploadSizeLimit,0),this.uploadSingleSizeLimit=Zt.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=Ut.utils.createElement("input",{type:"file",accept:this.acceptedFormats}),this.allowMultiple&&this.input.setAttribute("multiple","multiple"),this.#Ea=this.acceptedFormats.split(", ");const s={"custom-download":{command:"download",title:this.$.lang.download,icon:"download",action:t=>{const e=t.getAttribute("href");e&&Ut.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 qs(this,this.$,i,{}),this.fileManager=new Ko(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 Ut.utils.createElement("DIV",{class:"se-controller se-controller-simple-input"},s)}(this.$);this.controller=new Ms(this,this.$,t,{position:"bottom",disabled:!0},vl.key),this.editInput=t.querySelector("input")}this.$.eventManager.addEvent(this.input,"change",this.#Pr.bind(this))}action(){this.$.store.set("_preventBlur",!0),this.input.click()}onFilePasteAndDrop({file:t}){const e=t.type;this.#Ea.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.#Ta.textContent=this.editInput.value}this.controller.close(),this.$.component.select(this.#Ta,vl.key)}}componentSelect(t){this.#Ta=t;const e=this.figure.controller.form.querySelector('[data-command="__c__as"]');if(e)return Ut.check.isFigure(t.parentElement)?(e.innerHTML=this.$.icons.reduction+Ut.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+Ut.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:!Ut.check.isFigure(t.parentElement),initMethod:null,addOffset:null}),this.editInput.focus()}async componentDestroy(t){if(!t)return;const e=qs.GetContainer(t),s=Ut.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;Ut.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===fl?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===fl?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.#oa.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!==fl||r(null)))}convertFormat(t,e){if("link"===e){this.figure.close();const{container:e}=qs.GetContainer(t),s=e.nextElementSibling,i=e.parentElement;t.removeAttribute("data-se-non-focus"),t.setAttribute("contenteditable","false"),Ut.utils.addClass(t,"se-component|se-inline-component");const n=Ut.utils.createElement(this.$.options.get("defaultLine"),null,t);i.insertBefore(n,s),Ut.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&&Ut.check.isZeroWidth(s.previousElementSibling)&&Ut.utils.removeItem(s.previousElementSibling),t.setAttribute("data-se-non-focus","true"),t.removeAttribute("contenteditable"),Ut.utils.removeClass(t,"se-component|se-component-selected|se-inline-component");const i=qs.CreateContainer(t,"se-file-figure se-flex-component");(s||e.container).parentElement.insertBefore(i.container,s)}this.$.history.push(!1),this.$.component.select(t,vl.key)}create(t,e,s){const i=e.name||t,n=Ut.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=qs.CreateContainer(n);if(Ut.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,vl.key);else{const t=this.$.format.addLine(o.container,null);t&&this.$.selection.setRange(t,0,t,0)}}else this.$.focusManager.focus()}#ia(t){t.result.forEach(((t,e,s)=>{this.create(t.url,{name:t.name,size:t.size},e===s.length-1)}))}async#na(t){const e=await this.$.eventManager.triggerEvent("onFileUploadError",{error:t});if(!1===e)return;const s=e===fl?t.errorMessage:e||t.errorMessage;this.$.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.fileUpload.error]",s)}#oa(t){const e=JSON.parse(t.responseText);e.errorMessage?this.#na(e):this.#ia(e)}async#Pr(t){const e=Ut.query.getEventTarget(t);await this.submitFile(e.files)}}const bl=vl;class yl extends sl{static key="list_bulleted";static className="se-icon-flip-rtl";#Ma;constructor(t){super(t),this.title=this.$.lang.bulletedList,this.icon="list_bulleted",this.afterItem=Ut.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":yl.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 Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.#Ma=e.querySelectorAll("li button ul"),this.$.menu.initDropdownTarget({key:yl.key,type:"dropdown"},e)}active(t,e){return Ut.check.isListCell(t)&&/^UL$/i.test(t.parentElement.nodeName)?(Ut.utils.addClass(e,"active"),!0):(Ut.utils.removeClass(e,"active"),!1)}action(t){const e=this.$.format.getBlock(this.$.selection.getNode()),s=t?.querySelector("ul")?.style.listStyleType;Ut.check.isList(e)&&s?e.style.listStyleType=s:this.submit(s),this.$.menu.dropdownOff()}on(){const t=this.#Ma,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?Ut.utils.addClass(e.parentElement,"active"):Ut.utils.removeClass(e.parentElement,"active")}shortcut({range:t,info:e}){const{startContainer:s}=t;if(Ut.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 wl=yl;class Cl extends sl{static key="list_numbered";static className="se-icon-flip-rtl";#Ma;constructor(t){super(t),this.title=this.$.lang.numberedList,this.icon="list_numbered",this.afterItem=Ut.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":Cl.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${_l(["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${_l(["lower-latin","upper-latin","lower-greek"])}\n\t\t</ul>\n\t</div>`;return Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.#Ma=e.querySelectorAll("li button ol"),this.$.menu.initDropdownTarget({key:Cl.key,type:"dropdown"},e)}active(t,e){return Ut.check.isListCell(t)&&/^OL$/i.test(t.parentElement.nodeName)?(Ut.utils.addClass(e,"active"),!0):(Ut.utils.removeClass(e,"active"),!1)}action(t){const e=this.$.format.getBlock(this.$.selection.getNode()),s=t?.querySelector("ol")?.style.listStyleType;Ut.check.isList(e)&&s?e.style.listStyleType=s:this.submit(s),this.$.menu.dropdownOff()}on(){const t=this.#Ma,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?Ut.utils.addClass(e.parentElement,"active"):Ut.utils.removeClass(e.parentElement,"active")}shortcut({range:t,info:e}){const{startContainer:s}=t;if(Ut.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 _l(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 xl=Cl,{debounce:$l}=Wt;const kl=class extends ol{static key="mention";static className="";#Ha=0;#La=0;#Na=null;constructor(t,e){super(t),this.title=this.$.lang.mention,this.icon="mention",this.triggerText=e.triggerText||"@",this.limitSize=e.limitSize||5,this.searchStartLength=e.searchStartLength||0,this.delayTime="number"==typeof e.delayTime?e.delayTime:200,this.directData=e.data,this.apiUrl=e.apiUrl?.replace(/\s/g,"").replace(/\{limitSize\}/i,String(this.limitSize))||"",this.apiManager=new to(this,this.$,{headers:e.apiHeaders}),this.cachingData=e.useCachingData??1?new Map:null,this.cachingFieldData=e.useCachingFieldData??1?[]:null;const s=Ut.utils.createElement("DIV",{class:"se-controller se-empty-controller"},"<div></div>");this.selectMenu=new Ls(this.$,{position:"right-bottom",dir:"ltr",closeMethod:()=>this.controller.close()}),this.controller=new Ms(this,this.$,s,{position:"bottom",initMethod:()=>{this.apiManager.cancel(),this.selectMenu.close()}},null),this.selectMenu.on(s.firstElementChild,this.#Ba.bind(this)),this.onInput=$l(this.onInput.bind(this),this.delayTime)}async onInput(){this.directData||this.apiManager.cancel();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),n=i.lastIndexOf(this.triggerText);if(n>-1){const t=i.substring(n+1,s),o=i[n-1]?.trim();if(!/\s/.test(t)&&(!o||Ut.check.isZeroWidth(o))){if(t.length<this.searchStartLength)return;const i=e.parentNode;if(Ut.check.isAnchor(i)&&!i.getAttribute("data-se-mention"))return;try{return await this.#Aa(t,e),this.#Ha=n,this.#Na=e,void(this.#La=s)}catch(t){console.warn("[SUNEDITOR.mention.api.file] ",t)}}}this.selectMenu.close()}async#Aa(t,e){const s=this.limitSize,i=t.toLowerCase();let n=null;if(this.cachingData&&(n=this.cachingData.get(t)),!n)if(this.directData)n=this.directData.filter((t=>t.key.toLowerCase().startsWith(i))).slice(0,s);else{const e=await this.apiManager.asyncCall({method:"GET",url:this.#Ia(t)});n=JSON.parse(e.responseText)}if(this.cachingFieldData){const t=new Set;n=this.cachingFieldData.concat(n).filter((({key:e})=>!t.has(e)&&(t.add(e),e.toLowerCase().startsWith(i)))).slice(0,s)}if(!n?.length)return this.selectMenu.close(),!1;const o=[],l=[];for(let t,e=0,s=n.length;e<s;e++)t=n[e],o.push(t),l.push(`<div class="se-mention-item"><span>${t.key}</span><span>${t.name}</span></div>`);return 0===o.length?(this.selectMenu.close(),!1):(this.controller.open(e,null,{isWWTarget:!0,initMethod:null,addOffset:null}),this.selectMenu.create(o,l),this.selectMenu.open(),this.selectMenu.setItem(0),this.cachingData&&this.cachingData.set(t,o),!0)}#Ia(t){return this.apiUrl.replace(/\{key\}/i,t)}#Ba(t){if(!t)return!1;let e=null;const{key:s,name:i,url:n}=t,o=this.#Na.parentNode;if(Ut.check.isAnchor(o))e=o,e.setAttribute("data-se-mention",s),e.setAttribute("href",n),e.setAttribute("title",i),e.textContent=this.triggerText+s;else if(this.$.selection.setRange(this.#Na,this.#Ha,this.#Na,this.#La),e=Ut.utils.createElement("A",{"data-se-mention":s,href:n,title:i,target:"_blank"},this.triggerText+s),!this.$.html.insertNode(e,{afterNode:null,skipCharCount:!1}))return!1;this.selectMenu.close();const l=Ut.utils.createTextNode(" ");e.parentNode.insertBefore(l,e.nextSibling),this.$.selection.setRange(l,1,l,1),this.cachingFieldData&&!this.cachingFieldData.some((e=>e.key===t.key))&&this.cachingFieldData.push(t)}};class Sl extends il{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";const s=function({lang:t,icons:e,options:s},i){const n=Array.isArray(i)?i:s.get("_rtl")?["right","center","left","justify"]:["left","center","right","justify"];let o="";for(let s,i,l=0;l<n.length;l++)s=n[l],i=t["align"+s.charAt(0).toUpperCase()+s.slice(1)],o+=`\n\t\t<li>\n\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${s}" title="${i}" aria-label="${i}">\n\t\t\t\t<span class="se-list-icon">${e["align_"+s]}</span>${i}\n\t\t\t</button>\n\t\t</li>`;return Ut.utils.createElement("div",{class:"se-dropdown se-list-layer se-list-align"},`\n\t\t<div class="se-list-inner">\n\t\t\t<ul class="se-list-basic">${o}</ul>\n\t\t</div>`)}(this.$,e.items),i=this._itemMenu=s.querySelector("ul");this.defaultDir="",this.alignIcons={justify:this.$.icons.align_justify,left:this.$.icons.align_left,right:this.$.icons.align_right,center:this.$.icons.align_center},this.alignList=i.querySelectorAll("li button"),this.$.menu.initDropdownTarget(Sl,s)}active(t,e){const s=e.firstElementChild;if(t){if(this.$.format.isLine(t)){const i=t.style.textAlign;return i?(Ut.utils.changeElement(s,this.alignIcons[i]||this.alignIcons[this.defaultDir]),e.setAttribute("data-focus",i),!0):void 0}}else Ut.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")?Ut.utils.addClass(s[t],"active"):Ut.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++)Ut.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.#Va();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.#Va()}#Va(){const t=this.$.frameContext.get("wwComputedStyle").getPropertyValue("text-align");return["left","center","right","justify"].includes(t)?t:this.$.options.get("_rtl")?"right":"left"}}const El=Sl;class Tl extends il{static key="font";static className="se-btn-select se-btn-tool-font";#Oa;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=function({lang:t},e){let s=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list default_value" data-command="" title="${t.default}" aria-label="${t.default}">\n\t\t\t\t\t${t.default}\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t\t<li class="se-btn-list se-sub-list"><span></span></li>`;for(let t,i,n=0,o=e.length;n<o;n++)t=e[n],i=t.split(",")[0],s+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${t}" data-txt="${i}" title="${i}" aria-label="${i}" style="font-family:${t};">${i}</button>\n\t\t\t</li>`;return s+="\n\t\t</ul>\n\t</div>",Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-font-family"},s)}(this.$,s);this.currentFont="",this.fontList=i.querySelectorAll("ul li button"),this.fontArray=s,this.#Oa=i.querySelector(".se-sub-list span"),this.$.menu.initDropdownTarget(Tl,i)}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=Ut.utils.getStyle(t,"fontFamily")){const t=n.replace(/["']/g,"");return Ut.utils.changeTxt(s,t),Ut.utils.changeTxt(i,this.$.lang.font+" ("+t+")"),!0}}else{const t=this.$.store.get("hasFocus")?this.$.frameContext.get("wwComputedStyle").fontFamily:this.$.lang.font;Ut.utils.changeTxt(s,t),Ut.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,"")?(Ut.utils.addClass(e[i],"active"),t=!0):Ut.utils.removeClass(e[i],"active");this.currentFont=s,t?this.#Oa.style.display="none":(this.#Oa.textContent=s,this.#Oa.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=Ut.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 Ml=Tl;class Hl extends nl{static key="fontColor";static className="";constructor(t,e){super(t),this.title=this.$.lang.fontColor,this.icon="font_color";const s=Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new Wo(this,this.$,"color",{form:s,colorList:e.items,splitNum:e.splitNum,disableHEXInput:e.disableHEXInput,hueSliderOptions:{controllerOptions:{isOutsideForm:!0}}}),this.$.menu.initDropdownTarget(Hl,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=Ut.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=Ut.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 Ll=Hl;class Nl extends nl{static key="backgroundColor";static className="";constructor(t,e){super(t),this.title=this.$.lang.backgroundColor,this.icon="background_color";const s=Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new Wo(this,this.$,"backgroundColor",{form:s,colorList:e.items,splitNum:e.splitNum,disableHEXInput:e.disableHEXInput,hueSliderOptions:{controllerOptions:{isOutsideForm:!0}}}),this.$.menu.initDropdownTarget(Nl,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=Ut.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=Ut.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 Bl=Nl;class Al extends il{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=function({lang:t},e){const s=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}];let i="";for(let t=0,e=s.length;t<e;t++)i+=`\n\t\t<li>\n\t\t\t<button type="button" class="se-btn se-btn-list" data-command="hr" title="${s[t].name}" aria-label="${s[t].name}">\n\t\t\t\t<hr${s[t].class?` class="${s[t].class}"`:""}${s[t].style?` style="${s[t].style}"`:""}/>\n\t\t\t</button>\n\t\t</li>`;return Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-line"},`\n\t\t<div class="se-list-inner">\n\t\t\t<ul class="se-list-basic">${i}</ul>\n\t\t</div>`)}(this.$,e.items);this.list=s.querySelectorAll("button"),this.$.menu.initDropdownTarget(Al,s)}componentSelect(t){Ut.utils.addClass(t,"on")}componentDeselect(t){Ut.utils.removeClass(t,"on")}componentDestroy(t){if(!t)return;const e=t.previousElementSibling||t.nextElementSibling;Ut.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"),Ut.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=Ut.utils.createElement("hr",{class:t});return this.$.focusManager.focus(),this.$.component.insert(e,{insertBehavior:"line"}),e}}const Il=Al;class Vl extends il{static key="list";static className="se-icon-flip-rtl";#Ma;#Ra;constructor(t){super(t),this.title=this.$.lang.list,this.icon="list_numbered";const e=function({lang:t,icons:e}){const s=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-tooltip se-icon-flip-rtl" data-command="ol" title="${t.numberedList}" aria-label="${t.numberedList}">\n\t\t\t\t\t${e.list_numbered}\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-tooltip se-icon-flip-rtl" data-command="ul" title="${t.bulletedList}" aria-label="${t.bulletedList}">\n\t\t\t\t\t${e.list_bulleted}\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t</ul>\n\t</div>`;return Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},s)}(this.$);this.#Ma=e.querySelectorAll("li button"),this.#Ra={bulleted:this.$.icons.list_bulleted,numbered:this.$.icons.list_numbered},this.$.menu.initDropdownTarget(Vl,e)}active(t,e){const s=e.firstElementChild;if(Ut.check.isList(t)){const i=t.nodeName.toLowerCase();return e.setAttribute("data-focus",i),Ut.utils.addClass(e,"active"),/^ul$/.test(i)?Ut.utils.changeElement(s,this.#Ra.bulleted):Ut.utils.changeElement(s,this.#Ra.numbered),!0}return e.removeAttribute("data-focus"),Ut.utils.changeElement(s,this.#Ra.numbered),Ut.utils.removeClass(e,"active"),!1}on(t){const e=t.getAttribute("data-focus")||"",s=this.#Ma;for(let t=0,i=s.length;t<i;t++)e===s[t].getAttribute("data-command")?Ut.utils.addClass(s[t],"active"):Ut.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 Ol=Vl,Rl=".se-table-resize-line",zl=".se-table-resize-line-prev",Fl=".se-table-resize-row",Pl=".se-table-resize-row-prev",Dl=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],ql={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"},Wl=["all","inside","horizon","vertical"],Ul="borderLeft",Zl="borderTop",Gl="borderRight",jl="borderBottom",Kl=["#bbf7d0","#fde68a","#fecaca","#e9d5ff","#bfdbfe","#22c55e","#eab308","#ef4444","#a855f7","#3b82f6","#15803d","#ca8a04","#b91c1c","#7e22ce","#1d4ed8","#e5e7eb","#9ca3af","#6b7280","#374151","#000000"],Yl={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:Xl}=Dt,Jl=new WeakMap,Ql=new WeakMap;function tr(t){return/^(TD|TH|TR)$/i.test(t?.nodeName)}function er(t){return/^CAPTION$/i.test(t.nodeName)}function sr(t,e){const s=t.clientX,i=Zt.get(Xl.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 ir(t,e){const s=t.clientY,i=Zt.get(Xl.getComputedStyle(e).height,0),n=e.getBoundingClientRect();return{is:Math.ceil(i+n.top-s)<=6,startY:s}}function nr(t,e){return`<${t=t.toLowerCase()}><div><br></div></${t}>`.repeat(e)}function or(t){return t=t.toLowerCase(),Ut.utils.createElement(t,null,"<div><br></div>")}function lr(t,e,s){let i=Ql.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),Ql.set(t,i)),i[e]?.[s]??0}function rr(t,e){const s=Ut.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 ar(t){t&&(Jl.delete(t),Ql.delete(t))}function hr(t,e,s){const i=[];let n="";for(const o in ql){if(s.includes(o))continue;const l=ql[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:Ut.utils.createElement("DIV",null,n).querySelectorAll("button")}}const cr=class{#za;#X;#L;constructor(t,{mergeButton:e,unmergeButton:s,splitButton:i,openCellMenuFunc:n,closeCellMenuFunc:o}){this.#za=t,this.#X=t.$,this.#L=t.state,this.mergeButton=e,this.unmergeButton=s,this.splitButton=i;const l=(r=this.#X.lang,{items:["vertical","horizontal"],menus:Ut.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 Ls(this.#X,{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#Fa(){return this.#za.selectionService}openSplitMenu(){this.selectMenu_split.open()}mergeCells(t,e=!1){const s=t[0].closest("table");ar(s);const{clonedTable:i,clonedSelectedCells:n}=e?{clonedTable:s,clonedSelectedCells:t}:rr(s,t);this.#za.setTableInfo(i),t=n,this.#za.setState("ref",null),this.#Fa.setMultiCells(t[0],Ut.query.findVisualLastCell(t));const o=this.#L.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.#X.format.isLine(s[t])&&Ut.check.isZeroWidth(s[t].textContent)&&Ut.utils.removeItem(s[t]);d+=e.innerHTML,Ut.utils.removeItem(e),0===u.cells.length&&(r?a=u:r=u,c-=1)}if(r){const t=this.#L.trElements,e=Ut.utils.getArrayIndex(t,r),s=Ut.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-=Zt.getOverlapRangeAtIndex(e,s,o,o+i));else i.push(t[o]);for(let t=0,e=i.length;t<e;t++)Ut.utils.removeItem(i[t])}l.innerHTML+=d,l.colSpan=h,l.rowSpan=c,e||(s.replaceWith(i),this.#za._closeTableSelectInfo(),this.#za._setController(l),this.#Fa.focusCellEdge(l),this.#Fa.initCellSelection(l),this.#za.setState("ref",null),this.#za.setState("selectedCells",[l]),this.#za.setCellInfo(l,!0),this.setUnMergeButton(),this.setMergeSplitButton(),this.#za.historyPush())}unmergeCells(t,e=!1){if(!t?.length)return;const s=t[0].closest("table");ar(s);const{clonedTable:i,clonedSelectedCells:n}=e?{clonedTable:s,clonedSelectedCells:t}:rr(s,t);this.#za.setState("ref",null),this.#za.setTableInfo(i);let o=(t=n)[0],l=Ut.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.#za.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=or("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.#za.setState("selectedCells",null),e||(s.replaceWith(i),this.#za._closeTableSelectInfo(),this.#za.setTableInfo(i),o!==l?(l=!r||l.closest("tr").rowIndex>r.closest("tr").rowIndex||l.cellIndex>r.cellIndex?l:r,this.#Fa.setMultiCells(o,l),this.#za.setState("selectedCells",Array.from(a.querySelectorAll(".se-selected-table-cell")))):this.#za.setCellInfo(l,!0),this.#Fa.initCellSelection(o),this.#za.setState("selectedCell",l),this.setUnMergeButton(),this.#za.controller_cell.resetPosition(l),this.#za.historyPush())}findMergedCells(t){const e=[];return t?.forEach((t=>{t&&(t.rowSpan>1||t.colSpan>1)&&e.push(t)})),e}setMergeSplitButton(){this.#L.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.#L.selectedCells?.length?this.#L.selectedCells:[this.#L.fixedCell]).length>0?this.unmergeButton.disabled=!1:this.unmergeButton.disabled=!0}_OnSplitCells(t){ar(this.#za._element);const e="vertical"===t,s=this.#L.tdElement,i=this.#L.trElements,n=this.#L.trElement,o=this.#L.logical_cellIndex,l=this.#L.rowIndex,r=or(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.#L.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=Ut.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=Ut.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.#L.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.#Fa.focusCellEdge(s),this.#Fa.deleteStyleSelectedCells(),this.#X.history.push(!1),this.#za._setController(s),this.#za.setState("selectedCell",s),this.#za.setState("fixedCell",s),this.#L.selectedCells?.length||this.#za.setState("selectedCells",[s])}};const dr=class{#za;#L;constructor(t){this.#za=t,this.#L=t.state}get#Fa(){return this.#za.selectionService}get#Pa(){return this.#za.gridService}get#Da(){return this.#za.cellService}copySelectedTableCells(t,e,s){t.preventDefault(),t.stopPropagation();const i=s[0].closest("table"),n=i.cloneNode(!1),o=Ut.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=lr(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=Ut.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=Ut.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;ar(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.#Fa.deleteStyleSelectedCells();const r=e.closest("table"),{clonedTable:a,clonedSelectedCells:h}=rr(r,[e]),c=a;e=h[0];let d=c.rows;this.#za.setTableInfo(c),this.#za.setCellInfo(e,!0);const u={physicalCellCnt:this.#L.physical_cellCnt,logicalCellCnt:this.#L.logical_cellCnt,rowCnt:this.#L.rowCnt,rowIndex:this.#L.rowIndex,physicalCellIndex:this.#L.physical_cellIndex,logicalCellIndex:this.#L.logical_cellIndex,currentColSpan:this.#L.current_colSpan,currentRowSpan:this.#L.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.#Pa.editRow("down",e);for(let t=0;t<g;t++)this.#Pa.editColumn("right",e);this.#za.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.#Da.unmergeCells(b,!0),this.#za.setState("trElements",d=c.rows));const w=[],C=[],_=[];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(;C[t]?.[i];)i++;for(let e=1;e<l;e++){const s=t+e;C[s]||=[];for(let t=0;t<o;t++)C[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&&w.push(h),i+=o}}if(w.length>0){for(const t of w)this.#za.setState("ref",null),this.#za.setState("trElements",c.rows),this.#Da.mergeCells(t,!0);this.#za.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.#za._closeTableSelectInfo(),this.#za.setTableInfo(c),this.#Da.setMergeSplitButton(),this.#Da.setUnMergeButton(),this.#Fa.focusCellEdge(x[0]),this.#za.historyPush(),x}};const ur=class{#za;#X;#L;constructor(t,{columnButton:e,rowButton:s,openCellMenuFunc:i,closeCellMenuFunc:n}){this.#za=t,this.#X=t.$,this.#L=t.state;const o=(l=this.#X.lang,r=this.#X.icons,{items:["insert-left","insert-right","delete"],menus:Ut.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 Ls(this.#X,{checkList:!1,position:"bottom-center",openMethod:i,closeMethod:n}),this.selectMenu_column.on(e,this.#qa.bind(this)),this.selectMenu_column.create(o.items,o.menus);const a=function(t,e){return{items:["insert-above","insert-below","delete"],menus:Ut.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.#X.lang,this.#X.icons);this.selectMenu_row=new Ls(this.#X,{checkList:!1,position:"bottom-center",openMethod:i,closeMethod:n}),this.selectMenu_row.on(s,this.#Wa.bind(this)),this.selectMenu_row.create(a.items,a.menus)}get#Fa(){return this.#za.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.#L.tdElement?.nodeName)?"none":"",this.selectMenu_row.open()}editTable(t,e){const s=this.#za._element,i="row"===t;if(i){const t=this.#L.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>"+nr("td",this.#L.logical_cellCnt)+"</tr></tbody>":(Ut.utils.removeItem(this.#L.figureElement),this.#za._closeTableSelectInfo()))}}if(this.#L.ref){const t=this.#L.tdElement,s=this.#L.selectedCells;if(i)if(e)this.#za.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.#za.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.#za.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.#za.setCellInfo(t[s],!0),this.editColumn(e)}}e||this.#za.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&&(Ut.utils.removeItem(t[e]),e--);0===s.children.length&&Ut.utils.removeItem(s)}}editColumn(t,e,s){e&&this.#za.setCellInfo(e,!0);const i=!t,n="left"===t,o=this.#L.current_colSpan,l=this.#L.logical_cellIndex+(i||n?0:o+1),r=this.#L.trElements;let a,h=[],c=[],d=0;const u=[],p=[];for(let t,e,s,n,g,m=0,f=this.#L.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-=Zt.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=or(e[0].nodeName),s=t.insertBefore(s,e[a]))}}const g=this.#za._element.querySelector("colgroup");if(g){const t=g.querySelectorAll("col");if(i)Ut.utils.removeItem(t[a]);else{if(!(!Ut.utils.hasClass(this.#za._element,"se-table-layout-fixed")&&"fixed"!==this.#za._element.style.tableLayout)&&Array.prototype.some.call(t,(t=>Zt.get(t.style.width)>0))){let e=0;for(let s,i=0,n=t.length;i<n;i++)s=Zt.get(t[i].style.width),s-=Math.round(s*n*.1/2),e+=s,t[i].style.width=`${s}%`;const s=Ut.utils.createElement("col",{style:`width:${100-e}%`});g.insertBefore(s,t[a])}else g.insertBefore(Ut.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,Ut.utils.removeItem(u[i]),0===s.cells.length&&(t||=Ut.utils.getArrayIndex(r,s),e=Ut.utils.getArrayIndex(r,s),Ut.utils.removeItem(s));for(let s,i=0,n=p.length;i<n;i++)s=p[i],s.cell.rowSpan=Zt.getOverlapRangeAtIndex(t,e,s.i,s.rs);this.#za._closeController()}else this.#za._setCellControllerPosition(s||this.#L.tdElement,!0);return s||this.#L.tdElement}editRow(t,e,s){this.#Fa.deleteStyleSelectedCells(),e&&this.#za.setCellInfo(e,!0);const i=!t,n="up"===t,o=this.#L.rowIndex,l=i||n?o:o+this.#L.current_rowSpan+1,r=i?-1:1,a=this.#L.trElements;let h=this.#L.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.#za._element.deleteRow(l)}else this.insertBodyRow(this.#za._element,l,h);i?this.#za._closeController():this.#za._setCellControllerPosition(s||this.#L.tdElement,!0)}insertBodyRow(t,e,s){const i=t.insertRow(e);return i.innerHTML=nr("td",s),i}#qa(t){switch(ar(this.#za._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.#za.historyPush()}#Wa(t){switch(ar(this.#za._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.#za.historyPush()}},{_w:pr}=Dt;const gr=class{#za;#X;#L;#Ks;#Ua=!1;#Za=null;#Ga=null;constructor(t){this.#za=t,this.#X=t.$,this.#L=t.state,this.#Ks={resize:null,resizeStop:null,resizeKeyDown:null}}get#Fa(){return this.#za.selectionService}isResizing(){return this.#Ua}onResizeGuide(t,e){const s=sr(t,e);if(s.is)return this.#za._element&&(this.#za._element.style.cursor=""),this.#Is(),"block"===this.#Za?.style.display&&(this.#Za.style.display="none"),this.#Za=this.#X.frameContext.get("wrapper").querySelector(Rl),this.#ja(Ut.query.getParentElement(e,Ut.check.isTable),e,this.#Za,s.isLeft),this.#Za.style.display="block",!1;return ir(t,e).is?(this.#Is(),this.#za._element=Ut.query.getParentElement(e,Ut.check.isTable),this.#za._element.style.cursor="ns-resize","block"===this.#Za?.style.display&&(this.#Za.style.display="none"),this.#Za=this.#X.frameContext.get("wrapper").querySelector(Fl),this.#Ka(Ut.query.getParentElement(e,Ut.check.isTable),e,this.#Za),this.#Za.style.display="block",!1):void 0}offResizeGuide(){this.#Ya()}readyResizeFromEdge(t,e){const s=sr(t,e);if(s.is){try{this.#Fa.deleteStyleSelectedCells(),this.#za.setCellInfo(e,!0);const t=this.#L.logical_cellIndex+this.#L.current_colSpan-(s.isLeft?1:0);if(this.#X.ui.enableBackWrapper("ew-resize"),this.#Za||=this.#X.frameContext.get("wrapper").querySelector(Rl),this.#Ga=this.#X.frameContext.get("wrapper").querySelector(zl),t<0||t===this.#L.logical_cellCnt-1)return this._startFigureResizing(s.startX,t<0),this.#za._editorEnable(!1),!1;const i=this.#za._element.querySelector("colgroup").querySelectorAll("col")[t<0?0:t];this._startCellResizing(i,s.startX,Zt.get(pr.getComputedStyle(i).width,0),s.isLeft),this.#za._editorEnable(!1)}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.#za._editorEnable(!0),this.#Is()}finally{this.#za.setState("fixedCell",null),this.#za.setState("selectedCell",null),this.#za.controller_table.hide(),this.#za.controller_cell.hide()}return!1}const i=ir(t,e);if(i.is){try{let t=Ut.query.getParentElement(e,Ut.check.isTableRow),s=e.rowSpan;if(s>1)for(;Ut.check.isTableRow(t)&&s>1;)t=t.nextElementSibling,--s;this.#Fa.deleteStyleSelectedCells(),this.#za.setRowInfo(t),this.#X.ui.enableBackWrapper("ns-resize"),this.#Za||=this.#X.frameContext.get("wrapper").querySelector(Fl),this.#Ga=this.#X.frameContext.get("wrapper").querySelector(Pl),this._startRowResizing(t,i.startY,Zt.get(pr.getComputedStyle(t).height,0)),this.#za._editorEnable(!1)}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.#za._editorEnable(!0),this.#Is()}finally{this.#za.setState("fixedCell",null),this.#za.setState("selectedCell",null),this.#za.controller_table.hide(),this.#za.controller_cell.hide()}return!1}}#Xa(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||Zt.get(e,0))/s*100;t.style.width=i+"%"}}))}_startCellResizing(t,e,s,i){const n=this.#L.figureElement;Ut.utils.removeClass(n,"se-component-selected"),this.#Xa(this.#za._element),this.#ja(n,this.#L.tdElement,this.#Ga,i),this.#Ga.style.display="block";const o=t.style.width,l=t.nextElementSibling,r=l.style.width,a=Ut.utils.hasClass(this.#za._element,"se-table-layout-fixed")?r:Wt.getWidthInPercentage(l||t);ws.get("__dragHandler")&&(ws.get("__dragHandler").style.display="none"),this.#Ja(this.#Qa.bind(this,t,l,n,this.#L.tdElement,this.#Za,i,e,s,Zt.get(o,0),Zt.get(a,0),this.#za._element.offsetWidth),(()=>{this.#Is(),this.#Xa(this.#za._element),this.#X.history.push(!0),this.#X.component.hoverSelect(this.#za._element),this.#za._editorEnable(!0)}),(e=>{this._stopResize(t,o,"width",e),this._stopResize(l,r,"width",e)}))}#Qa(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.#ja(s,i,n,o)}}_startRowResizing(t,e,s){const i=this.#L.figureElement;Ut.utils.removeClass(i,"se-component-selected"),this.#Ka(i,t,this.#Ga),this.#Ga.style.display="block";const n=t.style.height;ws.get("__dragHandler")&&(ws.get("__dragHandler").style.display="none"),this.#Ja(this.#th.bind(this,t,i,this.#Za,e,s),(()=>{this.#Is(),this.#X.history.push(!0),this.#X.component.hoverSelect(this.#za._element),this.#za._editorEnable(!0)}),this._stopResize.bind(this,t,n,"height"))}#th(t,e,s,i,n,o){const l=n+(o.clientY-i);t.style.height=`${l}px`,this.#Ka(e,t,s)}_startFigureResizing(t,e){const s=this.#L.figureElement;Ut.utils.removeClass(s,"se-component-selected"),this.#ja(s,s,this.#Ga,e),this.#Ga.style.display="block";const i=Wt.getWidthInPercentage(s);ws.get("__dragHandler")&&(ws.get("__dragHandler").style.display="none"),this.#Ja(this.#eh.bind(this,s,this.#Za,e,t,s.offsetWidth,Zt.get(i,0)),(()=>{this.#Is(),Zt.get(s.style.width,0)>100&&(s.style.width="100%"),this.#X.history.push(!0),this.#X.component.hoverSelect(this.#za._element),this.#za._editorEnable(!0)}),this._stopResize.bind(this,s,s.style.width,"width"))}#eh(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.#ja(t,t,e,s))}#ja(t,e,s,i){const n=this.#X.offset.getLocal(e),o=this.#X.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`}#Ka(t,e,s){const i=this.#X.offset.getLocal(e),n=this.#X.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){Gt.isEsc(i.code)&&(this.#Is(),this.#X.component.hoverSelect(this.#za._element),this.#za._editorEnable(!0),t.style[s]=e,"width"===s&&this.#X.component.select(this.#za._element,this.#za.constructor.key,{isInput:!0}))}#Ja(t,e,s){this.#Ks.resize=this.#X.eventManager.addGlobalEvent("mousemove",t,!1),this.#Ks.resizeStop=this.#X.eventManager.addGlobalEvent("mouseup",e,!1),this.#Ks.resizeKeyDown=this.#X.eventManager.addGlobalEvent("keydown",s,!1),this.#Ua=!0}#Is(){this.#Ua=!1,this.#X.ui.disableBackWrapper(),this.#Ya(),this.#Ga&&(this.#Ga.style.display="none",this.#Ga=null);const t=this.#Ks;for(const e in t)t[e]&&=this.#X.eventManager.removeGlobalEvent(t[e]);this.#Ua=!1,this.#Za=null}#Ya(){this.#Za&&(this.#Za.style.display="none",this.#Za=null),this.#za._element&&(this.#za._element.style.cursor="")}init(){this.#Is()}};const mr=class{#za;#X;#L;#sh;#ih;#nh;#oh;#Ks;#lh=null;constructor(t){this.#za=t,this.#X=t.$,this.#L=t.state,this.#sh=this.#rh.bind(this),this.#ih=this.#ah.bind(this),this.#nh=this.#hh.bind(this),this.#oh=this.#ch.bind(this),this.#Ks={on:null,off:null,shiftOff:null,touchOff:null,resize:null,resizeStop:null,resizeKeyDown:null}}get#Da(){return this.#za.cellService}selectCells(t){const e=t[0],s=Ut.query.findVisualLastCell(t);return this.#lh=e.nodeName,this.setMultiCells(e,s),{fixedCell:e,selectedCell:s}}setMultiCells(t,e){const s=this.#L.selectedTable,i=s.rows;if(this.deleteStyleSelectedCells(),Ut.utils.addClass(t,"se-selected-table-cell"),t===e&&!this.#L.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=Jl.get(s);const l=o?.get(n);if(l)return this.#za.setState("ref",l),void this.#dh(i,l);const r=this.#uh(i,t,e);this.#za.setState("ref",r),o||(o=new Map,Jl.set(s,o)),o.set(n,r),this.#dh(i,r)}#uh(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(Zt.getOverlapRangeAtIndex(l.cs,l.ce,c,c+d)&&Zt.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}#dh(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--)));Zt.getOverlapRangeAtIndex(e.cs,e.ce,r,r+a)&&Zt.getOverlapRangeAtIndex(e.rs,e.re,l,l+h)&&Ut.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.#za.setState("fixedCell",t),this.#L.selectedCells?.length||this.#za.setState("selectedCells",[t]),this.#lh=t.nodeName,this.#za.setState("selectedTable",Ut.query.getParentElement(t,"TABLE")),this.deleteStyleSelectedCells(),Ut.utils.addClass(t,"se-selected-cell-focus")}startCellSelection(t,e){this.#L.isShiftPressed||this.#L.ref||this.#Is(),this.#za.setState("isShiftPressed",e),this.initCellSelection(t),e?(this.#Ks.shiftOff=this.#X.eventManager.addGlobalEvent("keyup",this.#nh,!1),this.#Ks.on=this.#X.eventManager.addGlobalEvent("mousedown",this.#sh,!1)):this.#Ks.on=this.#X.eventManager.addGlobalEvent("mousemove",this.#sh,!1),this.#Ks.off=this.#X.eventManager.addGlobalEvent("mouseup",this.#ih,!1),this.#Ks.touchOff=this.#X.eventManager.addGlobalEvent("touchmove",this.#oh,!1)}deleteStyleSelectedCells(){Ut.utils.removeClass([this.#L.fixedCell,this.#L.selectedCell],"se-selected-cell-focus");const t=this.#L.fixedCell?.closest("table");if(t){const e=t.querySelectorAll(".se-selected-table-cell");for(let t=0,s=e.length;t<s;t++)Ut.utils.removeClass(e[t],"se-selected-table-cell")}}recallStyleSelectedCells(){if(this.#L.selectedCells){const t=this.#L.selectedCells;for(let e=0,s=t.length;e<s;e++)Ut.utils.addClass(t[e],"se-selected-table-cell")}}focusCellEdge(t){Dt.isMobile||this.#X.focusManager.focusEdge(t)}#rh(t){this.#X.store.set("_preventBlur",!0);const e=Ut.query.getParentElement(Ut.query.getEventTarget(t),Ut.check.isTableCell);if(this.#L.isShiftPressed){if(e===this.#L.fixedCell)return this.#za.setState("isShiftPressed",!1),this.deleteStyleSelectedCells(),this.#za._editorEnable(!0),void this.#Is();this.#za._editorEnable(!1)}else if(!this.#L.ref){if(e===this.#L.fixedCell)return;this.#za._editorEnable(!1)}e&&e!==this.#L.selectedCell&&this.#lh===e.nodeName&&this.#L.selectedTable===Ut.query.getParentElement(e,"TABLE")&&(this.#za.setState("selectedCell",e),this.setMultiCells(this.#L.fixedCell,this.#L.selectedCell))}#ah(t){t.stopPropagation(),this.#L.isShiftPressed?this.#Ks.touchOff&&=this.#X.eventManager.removeGlobalEvent(this.#Ks.touchOff):(this.#za._editorEnable(!0),this.#Is());const e=this.#L.fixedCell;if(!e||!this.#L.selectedTable)return;if(this.#Da.setMergeSplitButton(),this.#za.setState("selectedCells",Array.from(this.#L.selectedTable.querySelectorAll(".se-selected-table-cell"))),this.#L.isShiftPressed)return;e&&this.#L.selectedCell&&(this.focusCellEdge(e),e===this.#L.selectedCell&&Ut.utils.removeClass(e,"se-selected-table-cell"));const s=this.#L.selectedCells?.length>0?this.#L.selectedCell:e;this.#za._setController(s)}#hh(){if(this.#L.ref){this.#Is(),this.#za._editorEnable(!0),this.focusCellEdge(this.#L.fixedCell);const t=this.#L.selectedCells?.length>0?this.#L.selectedCell:this.#L.fixedCell;this.#za._setController(t)}else this.#za._closeController()}#ch(){this.#za.resetInfo()}#Is(){this.#X.ui.disableBackWrapper();const t=this.#Ks;for(const e in t)t[e]&&=this.#X.eventManager.removeGlobalEvent(t[e])}init(){this.#Is()}},{_w:fr}=Dt;const vr=class{#za;#L;#X;constructor(t,{pluginOptions:e,controller_table:s}){this.#za=t,this.#L=t.state,this.#X=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[ql.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=Ut.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.#X),n=[this.#za.controller_table,this.#za.controller_cell];this.controller_props=new Ms(this,this.#X,i.html,{position:"bottom",parents:n,isInsideForm:!0}),this.controller_props_title=i.controller_props_title;const o=Ut.utils.createElement("DIV",{class:"se-controller se-list-layer"},null);this.controller_colorPicker=new Ms(this,this.#X,o,{position:"bottom",parents:[this.controller_props].concat(n),isInsideForm:!0,isWWTarget:!1,initMethod:()=>{this.colorPicker.hueSlider.close(),Ut.utils.removeClass(this.controller_colorPicker.currentTarget,"on")}}),this.colorPicker=new Wo(this,this.#X,"",{form:o,colorList:e.colorList||Kl,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=Dl.length;s<i;s++)e=Dl[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=Ut.utils.createElement("DIV",null,t);return{items:Dl,menus:e.querySelectorAll("div")}}(),r=i.borderButton;this.selectMenu_props_border=new Ls(this.#X,{checkList:!1,position:"bottom-center"}),this.selectMenu_props_border.on(r,this.#ph.bind(this)),this.selectMenu_props_border.create(l.items,l.menus);const a=hr(this.#X.lang,this.#X.icons,[]),h=i.borderFormatButton;this.selectMenu_props_border_format=new Ls(this.#X,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:5}),this.selectMenu_props_border_format.on(h,this.#gh.bind(this,"all")),this.selectMenu_props_border_format.create(a.items,a.menus);const c=hr(this.#X.lang,this.#X.icons,Wl);this.selectMenu_props_border_format_oneCell=new Ls(this.#X,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:6}),this.selectMenu_props_border_format_oneCell.on(h,this.#gh.bind(this,"outside")),this.selectMenu_props_border_format_oneCell.create(c.items,c.menus),this.maxText=this.#X.lang.maxSize,this.minText=this.#X.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#Fa(){return this.#za.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.#X.lang.tableProperties,this.#mh("table"),this.controller_props.open(t,this.#za.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.#X.lang.cellProperties,this.#mh("cell"),this.controller_props.open(t,this.#za.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,Ut.utils.addClass(t,"on"),this.colorPicker.init(o?.value||"",t),this.controller_colorPicker.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null}))}toggleFontStyle(t){Ut.utils.toggleClass(this.propTargets[`font_${t}`],"on")}toggleHeader(){const t=this.headerButton,e=Ut.utils.hasClass(t,"active"),s=this.#za._element;if(ar(s),e)Ut.utils.removeItem(s.querySelector("thead"));else{const t=Ut.utils.createElement("THEAD");t.innerHTML="<tr>"+nr("th",this.#L.logical_cellCnt)+"</tr>",s.insertBefore(t,s.querySelector("tbody"))}Ut.utils.toggleClass(t,"active"),/TH/i.test(this.#L.tdElement.nodeName)?this.#za._closeController():this.#za._setCellControllerPosition(this.#L.tdElement,!1)}toggleCaption(){const t=this.captionButton,e=Ut.utils.hasClass(t,"active"),s=this.#za._element;if(e)Ut.utils.removeItem(s.querySelector("caption"));else{const t=Ut.utils.createElement("CAPTION",{class:`se-table-caption-${this.#za.captionPosition}`});t.innerHTML="<div><br></div>",s.insertBefore(t,s.firstElementChild)}Ut.utils.toggleClass(t,"active"),this.#za._setCellControllerPosition(this.#L.tdElement,!1)}resetHeaderButton(t){t.querySelector("thead")?Ut.utils.addClass(this.headerButton,"active"):Ut.utils.removeClass(this.headerButton,"active")}resetCaptionButton(t){t.querySelector("caption")?Ut.utils.addClass(this.captionButton,"active"):Ut.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.#fh(this.propTargets.cell_alignment,this._propsAlignCache,!0),this.#fh(this.propTargets.cell_alignment_vertical,this._propsVerticalAlignCache,!0),Ut.check.isTable(t[0][0])&&this.#L.figureElement&&(this.#L.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.#fh(this.propTargets.cell_alignment,t,!1)}setVerticalAlignProps(t){this.#fh(this.propTargets.cell_alignment_vertical,t,!1)}setTableLayout(t,e,s,i){if(t.includes("width")){const t=this.#L.figureElement;if(!t)return;let s,n;e?(s=this.#X.icons.reduction,n=this.minText,i||(t.style.width="100%")):(s=this.#X.icons.expansion,n=this.maxText,i||(t.style.width="max-content")),Ut.utils.changeElement(this.resizeButton.firstElementChild,s),Ut.utils.changeTxt(this.resizeText,n)}t.includes("column")&&(s?(Ut.utils.removeClass(this.#za._element,"se-table-layout-auto"),Ut.utils.addClass(this.#za._element,"se-table-layout-fixed"),Ut.utils.addClass(this.columnFixedButton,"active")):(Ut.utils.removeClass(this.#za._element,"se-table-layout-fixed"),Ut.utils.addClass(this.#za._element,"se-table-layout-auto"),Ut.utils.removeClass(this.columnFixedButton,"active")))}submitProps(t){try{t.disabled=!0;const e=this.#za.controller_table.form.contains(this.controller_props.currentTarget),s=e?[this.#za._element]:this.#L.selectedCells,i=s[0],n=fr.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 w=f?"":a.value.trim()||n.borderWidth;w+=Zt.is(w)?"px":"";const C=h.value.trim(),_=c.value.trim(),x=g&&!f&&w,$=`${w} ${m} ${y}`,k={left:[],top:[],right:[],bottom:[],middle:[],all:null};if(e){const t=i.style;this.#L.figureElement&&(this.#L.figureElement.style.float=v,this.#L.figureElement.style.verticalAlign=b),t.backgroundColor=C,t.color=_,this.#vh(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.#L.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 w=y+u-1===n;y===e&&k.top.push(t),(y===n||w)&&k.bottom.push(t),c===o&&k.left.push(t),c!==l&&c+d-1!==l||k.right.push(t),w||y===e||y===n||c===o||c===l||k.middle.push(t),i=t.style,i.textAlign=v,i.verticalAlign=b,i.backgroundColor=C,i.color=_,this.#vh(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.#bh(k,p,$),this.#za.historyPush(),this.controller_props.close(),this.#L.tdElement&&(this.#Fa.recallStyleSelectedCells(),this.#za.setCellInfo(this.#L.tdElement,!0),Ut.utils.addClass(this.#L.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()}#mh(t){this._typeCache=t;const e="table"===t,s=e?[this.#za._element]:this.#L.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:w,fontWeight:C,textDecoration:_,fontStyle:x}=fr.getComputedStyle(s[0]),$=this.#yh(f);h.querySelector('[data-value="justify"]').style.display=e?"none":"",d.style.display=e?"":"none",c.style.display=e?"none":"";let k=Wt.rgb2hex($.c),S=$.s,E=$.w,T=Wt.rgb2hex(v),M=Wt.rgb2hex(b),H=/.+/.test(C),L=/underline/i.test(_),N=/line-through/i.test(_),B=/italic/i.test(x),A=e?this.#L.figureElement?.style.float:y,I=w;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.#yh(n);let m=o,f=l;if(m||f){const e=fr.getComputedStyle(t);m&&(m=e.backgroundColor),f&&(f=e.color)}k&&$.c!==u&&(k=""),S&&$.s!==p&&(S=""),E&&$.w!==g&&(E=""),T!==Wt.rgb2hex(m)&&(T=""),M!==Wt.rgb2hex(f)&&(M=""),A!==(e?this.#L.figureElement?.style.float:r)&&(A=""),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),B&&B!==/italic/i.test(d)&&(B=!1),k&&S&&E&&T&&M||(i=!0)}i.firstElementChild.innerHTML=this.#X.icons[ql[1===s.length?"outside":"all"]],i.setAttribute("se-border-format","all"),Ut.utils.removeClass(i,"active"),S||=Dl[0],o.textContent=S,n.style.borderColor=n.value=k,l.value=E,this.#wh(S===Dl[0]),r.value=r.style.borderColor=T,a.value=a.style.borderColor=M,H&&Ut.utils.addClass(u,"on"),L&&Ut.utils.addClass(p,"on"),N&&Ut.utils.addClass(m,"on"),B&&Ut.utils.addClass(g,"on"),this.#fh(h,this._propsAlignCache=A,!0),this.#fh(c,this._propsVerticalAlignCache=I,!0)}#vh(t){const{font_bold:e,font_italic:s,font_strike:i,font_underline:n}=this.propTargets;t.fontWeight=Ut.utils.hasClass(e,"on")?"bold":"",t.fontStyle=Ut.utils.hasClass(s,"on")?"italic":"",t.textDecoration=((Ut.utils.hasClass(i,"on")?"line-through ":"")+(Ut.utils.hasClass(n,"on")?"underline":"")).trim()}#yh(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:Wt.rgb2hex(n)}}#bh(t,e,s){const{left:i,top:n,right:o,bottom:l,all:r}=t;switch(e){case"inside":if(1===r.length)return;Ut.utils.setStyle(r.filter((t=>!l.includes(t))),jl,s),Ut.utils.setStyle(r.filter((t=>!o.includes(t))),Gl,s);break;case"horizon":if(1===r.length)return;Ut.utils.setStyle(r.filter((t=>!l.includes(t))),jl,s);break;case"vertical":if(1===r.length)return;Ut.utils.setStyle(r.filter((t=>!o.includes(t))),Gl,s);break;case"outside":Ut.utils.setStyle(i,Ul,s),Ut.utils.setStyle(n,Zl,s),Ut.utils.setStyle(o,Gl,s),Ut.utils.setStyle(l,jl,s);break;case"left":Ut.utils.setStyle(i,Ul,s);break;case"top":Ut.utils.setStyle(n,Zl,s);break;case"right":Ut.utils.setStyle(o,Gl,s);break;case"bottom":Ut.utils.setStyle(l,jl,s)}}#wh(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)}#fh(t,e,s){Ut.utils.removeClass(t.querySelectorAll("button"),"on"),s||t.getAttribute("se-cell-align")!==e?(Ut.utils.addClass(t.querySelector(`[data-value="${e}"]`),"on"),t.setAttribute("se-cell-align",e)):t.setAttribute("se-cell-align","")}#ph(t){this.propTargets.border_style.textContent=t,this.#wh(t===Dl[0]),this.selectMenu_props_border.close()}#gh(t,e){const{border_format:s}=this.propTargets;s.setAttribute("se-border-format",e),s.firstElementChild.innerHTML=this.#X.icons[ql[e]],e!==t?Ut.utils.addClass(s,"active"):Ut.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;Ut.utils.removeClass([t,e,s,i,n,o,l,r,a,h,c,d],"on")}},{_w:br,ON_OVER_COMPONENT:yr}=Dt;class wr extends nl{static key="table";static className="";static options={isInputComponent:!0};static component(t){return Ut.check.isTable(t)?t:null}#Ch;#_h;#xh;#$h;#kh;#Sh=[];#Eh=!0;#Th=!1;#Mh=!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=Ut.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 Ut.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=Ut.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(Ut.utils.createElement("DIV",{class:Rl.replace(/^\./,"")})),t.get("wrapper").appendChild(Ut.utils.createElement("DIV",{class:zl.replace(/^\./,"")})),t.get("wrapper").appendChild(Ut.utils.createElement("DIV",{class:Fl.replace(/^\./,"")})),t.get("wrapper").appendChild(Ut.utils.createElement("DIV",{class:Pl.replace(/^\./,"")}))})),this.cellControllerTop?(this.controller_cell=new Ms(this,this.$,o.html,{position:"top"}),this.controller_table=new Ms(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 Ms(this,this.$,n,{position:"top"}),this.controller_cell=new Ms(this,this.$,o.html,{position:"bottom"})),this.figure=new qs(this,this.$,null,{}),this._element=null,this.state=Yl,this.#Ch=s,this.#_h=s.querySelector(".se-table-size-highlighted"),this.#xh=s.querySelector(".se-table-size-unhighlighted"),this.#$h=s.querySelector(".se-table-size-display");const l=Cr.bind(this,!0),r=Cr.bind(this,!1),a={...o,openCellMenuFunc:l,closeCellMenuFunc:r};this.cellService=new cr(this,a),this.clipboardService=new dr(this),this.gridService=new ur(this,a),this.resizeService=new gr(this),this.selectionService=new mr(this),this.styleService=new vr(this,{pluginOptions:e,controller_table:n}),this.$.menu.initDropdownTarget(wr,s),this.$.eventManager.addEvent(i,"mousemove",this.#Hh.bind(this)),this.$.eventManager.addEvent(i,"click",this.#Lh.bind(this))}setState(t,e){this.state[t]=e}#Nh(){Object.assign(this.state,Yl)}off(){this.#Bh()}componentSelect(t){if(this.#Ah(t),this.state.figureElement||this.setTableInfo(t),this.#Eh="100%"===this.state.figureElement?.style.width,this.#Th=Ut.utils.hasClass(t,"se-table-layout-fixed")||"fixed"===t.style.tableLayout,this.styleService.setTableLayout(this.#Eh?"width|column":"width",this.#Eh,this.#Th,!0),ws.get("__overInfo")===yr)return;if(!this.state.tdElement)return;this.setCellInfo(this.state.tdElement,!0);const e=this.state.selectedCells?.length>1,s=Ut.query.getParentElement(t,Ut.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;Ut.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");Ut.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=Ut.query.getParentElement(Ut.query.getEventTarget(t),Ut.check.isTableCell);if(!s)return;const i=e.body;if(1!==i.childElementCount)return;const n=this.$.component.get(i.firstElementChild);if(n.pluginName!==wr.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",Ut.query.getParentElement(r,"TABLE")),!1}retainFormat(){return{query:"table",method:t=>{const e=t.querySelector("colgroup");let s=Ut.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=Ut.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++)Ut.utils.setStyle(s[t],"width","")}}s?Ut.utils.addClass(s,"se-flex-component|se-input-component"):(s=Ut.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,Ut.utils.setStyle(t,"width","")),this.figureScroll){const t=`se-scroll-figure-${this.figureScroll}`;Ut.utils.addClass(s,t),Ut.utils.removeClass(s,this.figureScrollList.filter((e=>e!==t)).join("|"))}else Ut.utils.removeClass(s,this.figureScrollList.join("|"))}}}setDir(){this.#Bh(),this.styleService.resetPropsAlign()}onMouseMove({event:t}){if(this.resizeService.isResizing())return;const e=Ut.query.getEventTarget(t),s=Ut.query.getParentElement(e,tr);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=Ut.query.getEventTarget(t);if(this._element&&Ut.query.getParentElement(e,er))return void this._closeController();const s=Ut.query.getParentElement(e,tr);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.#Mh=!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=Gt.isTab(i);if(this.$.ui.selectMenuOn||this.resizeService.isResizing()||!n&&this.#Mh||Gt.isCtrl(t))return;if(this.cellControllerTop||this.controller_cell.hide(),this.#Mh=Gt.isShift(t),n){this.selectionService.deleteStyleSelectedCells();const i=Ut.query.getParentElement(s,Ut.check.isTableCell);if(i&&e.collapsed&&Ut.check.isEdgePoint(e.startContainer,e.startOffset)){this._closeController();const e=this.#Mh;this.setState("isShiftPressed",this.#Mh=!1);const s=Ut.query.getParentElement(i,"table"),n=Ut.query.getListChildren(s,Ut.check.isTableCell,null),o=e?Ut.utils.prevIndex(n,i):Ut.utils.nextIndex(n,i);if(o===n.length&&!e){if(!Ut.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(!Gt.isShift(t)){if(o=Ut.query.getParentElement(s,Ut.check.isTableCell),!Ut.utils.hasClass(o,"se-selected-cell-focus"))return;return this.selectionService.deleteStyleSelectedCells(),this._editorEnable(!0),this.#Ih(),void this._closeController()}return this.state.isShiftPressed||this.state.ref?void 0:(o||=Ut.query.getParentElement(s,Ut.check.isTableCell),o?(this.#Mh=t.shiftKey,this.setState("fixedCell",o),this._closeController(),this.selectionService.startCellSelection(o,this.#Mh),!1):void 0)}onKeyUp({line:t}){this.#Mh=!1,this.state.isShiftPressed&&Ut.query.getParentElement(t,Ut.check.isTableCell)===this.state.fixedCell&&(this.selectionService.deleteStyleSelectedCells(),this._editorEnable(!0),this.#Ih()),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.#Eh=!this.#Eh,this.styleService.setTableLayout("width",this.#Eh,this.#Th,!1),this.historyPush(),br.setTimeout((()=>{this.$.component.select(this._element,wr.key,{isInput:!0})}),0);break;case"layout":this.#Th=!this.#Th,this.styleService.setTableLayout("column",this.#Eh,this.#Th,!1),this.historyPush(),br.setTimeout((()=>{this.$.component.select(this._element,wr.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=lr(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=Ut.query.getParentElement(t,"TABLE");return this.setState("selectedTable",e),this.setState("figureElement",Ut.query.getParentElement(e,Ut.check.isFigure)||e),e}resetInfo(){this.#Ih(),this.selectionService.deleteStyleSelectedCells(),this._editorEnable(!0),this._element=null,this.#Nh(),this.#Sh=[],this.#Eh=!1,this.#Th=!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&&Ut.utils.addClass(t,"se-selected-cell-focus"),this.state.selectedCells?.length||this.setState("selectedCells",[t]);const e=this.state.selectedTable||this._element||Ut.query.getParentElement(t,"TABLE");this.$.component.select(e,wr.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?Ut.utils.removeClass(e,"se-disabled"):Ut.utils.addClass(e,"se-disabled")}_closeController(){this.controller_table.close(!0),this.controller_cell.close(!0)}_closeTableSelectInfo(){this.$.component.deselect(),this._closeController()}#Ah(t){this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,infoOnly:!1})}#Bh(){if(!this.#_h)return;const t=this.#_h.style,e=this.#xh.style;t.width="1em",t.height="1em",e.width="5em",e.height="5em",Ut.utils.changeTxt(this.#$h,"1 x 1")}#Hh(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.#_h.style.width=e+"em",this.#_h.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.#xh.style.width=n+"em",this.#xh.style.height=o+"em",i){const t=n-(this.#kh||5);if(0!==t){const e=Zt.get(this.#Ch.style.left);this.#Ch.style.left=e-18*t+"px",this.#kh=n}}Ut.utils.changeTxt(this.#$h,e+" x "+s),this.#Sh=[e,s]}#Lh(){const t=Ut.utils.createElement("TABLE"),e=this.#Sh[0],s=this.#Sh[1],i=`<tbody>${`<tr>${nr("td",e)}</tr>`.repeat(s)}</tbody>`,n=`<colgroup>${`<col style="width: ${Zt.get(100/e,0)}%;">`.repeat(e)}</colgroup>`;t.innerHTML=n+i;let o="";this.figureScroll&&(o=` se-scroll-figure-${this.figureScroll}`);const l=Ut.utils.createElement("FIGURE",{class:"se-flex-component se-input-component"+o,style:"width: 100%;"});if(l.appendChild(t),this.#Eh=!0,this.$.component.insert(l,{insertBehavior:"none"})){this.#Bh(),this.$.menu.dropdownOff();const e=t.querySelector("td div");this.$.selection.setRange(e,0,e,0)}}#Ih(){this.resizeService.init(),this.selectionService.init(),this.styleService.init()}}function Cr(t){this.controller_cell.bringToTop(t)}const _r=wr;class xr extends il{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=function({lang:t},e){const s=["p","blockquote","h1","h2","h3","h4","h5","h6"],i=e&&0!==e.length?e:s;let n='\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">';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+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${l}" data-value="${o}" data-class="${c}" title="${r}" aria-label="${r}">\n\t\t\t\t\t<${o}${h}>${r}</${o}>\n\t\t\t\t</button>\n\t\t\t</li>`}return n+="\n\t\t</ul>\n\t</div>",Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(this.$,e.items);this.formatList=s.querySelectorAll("li button"),this.currentFormat="",this.$.menu.initDropdownTarget(xr,s)}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 Ut.utils.changeTxt(i,s),i.setAttribute("data-value",n),i.setAttribute("data-class",o),!0}}else Ut.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")?Ut.utils.addClass(t,"active"):Ut.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=Ut.utils.createElement(`H${e}`);this.$.format.setLine(s)}}const $r=xr;class kr extends il{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;const s=function(t){t&&0!==t.length||console.warn('[SUNEDITOR.plugins.layout.warn] To use the "layout" plugin, please define the "layouts" option.');let e='\n\t<div class="se-dropdown se-list-inner">\n\t\t<ul class="se-list-basic">';for(let s,i=0,n=(t||[]).length;i<n;i++)s=t[i],e+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-value="${i}" title="${s.name}" aria-label="${s.name}">\n\t\t\t\t\t${s.name}\n\t\t\t\t</button>\n\t\t\t</li>`;return e+="\n\t\t</ul>\n\t</div>",Ut.utils.createElement("DIV",{class:"se-list-layer"},e)}(this.items);this.$.menu.initDropdownTarget(kr,s)}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 Sr=kr;class Er extends il{static key="lineHeight";static className="";#Oa;constructor(t,e){super(t),this.title=this.$.lang.lineHeight,this.icon="line_height";const s=function({lang:t},e){const s=e||[{text:"1",value:"1em"},{text:"1.2",value:"1.2em"},{text:"1.7",value:"1.7em"},{text:"2",value:"2em"}];let i=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list default_value" data-command="" title="${t.default}" aria-label="${t.default}">\n\t\t\t\t\t${t.default}\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t\t<li class="se-btn-list se-sub-list"><span></span></li>`;for(let t,e=0,n=s.length;e<n;e++)t=s[e],i+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${t.value}" title="${t.text}" aria-label="${t.text}">\n\t\t\t\t\t${t.text}\n\t\t\t\t</button>\n\t\t\t</li>`;return i+="\n\t\t</ul>\n\t</div>",Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},i)}(this.$,e.items);this.sizeList=s.querySelectorAll("li button"),this.currentSize=null,this.#Oa=s.querySelector(".se-sub-list span"),this.$.menu.initDropdownTarget(Er,s)}active(t,e){return this.$.format.isLine(t)&&t.style.lineHeight.length>0?(Ut.utils.addClass(e,"active"),!0):(Ut.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")?(Ut.utils.addClass(s[i],"active"),t=!0):Ut.utils.removeClass(s[i],"active");this.currentSize=e,t?this.#Oa.style.display="none":(this.#Oa.textContent=e,this.#Oa.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 Tr=Er;class Mr extends il{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;const s=function(t){t&&0!==t.length||console.warn('[SUNEDITOR.plugins.template.warn] To use the "template" plugin, please define the "templates" option.');let e='<div class="se-dropdown se-list-inner"><ul class="se-list-basic">';for(let s,i=0,n=(t||[]).length;i<n;i++)s=t[i],e+=`\n\t\t<li>\n\t\t\t<button \n\t\t\t\ttype="button" \n\t\t\t\tclass="se-btn se-btn-list" \n\t\t\t\tdata-value="${i}" \n\t\t\t\ttitle="${s.name}" \n\t\t\t\taria-label="${s.name}"\n\t\t\t>\n\t\t\t\t${s.name}\n\t\t\t</button>\n\t\t</li>`;return e+="</ul></div>",Ut.utils.createElement("DIV",{class:"se-list-layer"},e)}(this.items);this.$.menu.initDropdownTarget(Mr,s)}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 Hr=Mr;class Lr extends il{static key="paragraphStyle";static className="";constructor(t,e){super(t),this.title=this.$.lang.paragraphStyle,this.icon="paragraph_style";const s=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"];let n='\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">';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}e=t.name,o=t.class?` class="${t.class}"`:"",l=t._class,n+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list${l?" "+l:""}" data-command="${t.class}" title="${e}" aria-label="${e}">\n\t\t\t\t\t<div${o}>${e}</div>\n\t\t\t\t</button>\n\t\t\t</li>`}return n+="\n\t\t</ul>\n\t</div>",Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(this.$,e.items);this.classList=s.querySelectorAll("li button"),this.$.menu.initDropdownTarget(Lr,s)}on(){const t=this.classList,e=this.$.format.getLine(this.$.selection.getNode());for(let s=0,i=t.length;s<i;s++)Ut.utils.hasClass(e,t[s].getAttribute("data-command"))?Ut.utils.addClass(t[s],"active"):Ut.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++)Ut.utils.toggleClass(s[t],e);this.$.menu.dropdownOff(),this.$.history.push(!1)}}}const Nr=Lr;class Br extends il{static key="textStyle";static className="";constructor(t,e){super(t),this.title=this.$.lang.textStyle,this.icon="text_style";const s=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);let n='<div class="se-list-inner"><ul class="se-list-basic">';for(let t,e,o,l,r,a,h=0,c=i.length;h<c;h++){if(t=i[h],l="",a="",r=[],"string"==typeof t){const e=s[t.toLowerCase()];if(!e)continue;t=e}o=t.name,e=t.tag||"span",l+=` class="${t.class}"`,a+=`.${t.class.trim().replace(/\s+/g,",.")}`,r.push("class"),a=a.replace(/,$/,""),n+=`\n\t\t<li>\n\t\t\t<button \n\t\t\t\ttype="button" \n\t\t\t\tclass="se-btn se-btn-list" \n\t\t\t\tdata-command="${e}" \n\t\t\t\tdata-value="${a}" \n\t\t\t\ttitle="${o}" \n\t\t\t\taria-label="${o}"\n\t\t\t>\n\t\t\t\t<${e}${l}>${o}</${e}>\n\t\t\t</button>\n\t\t</li>`}return n+="</ul></div>",Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(this.$,e.items);this.styleList=s.querySelectorAll("li button"),this.$.menu.initDropdownTarget(Br,s)}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)?Ut.utils.hasClass(t,o.replace(/^\./,"")):t.style[o])){n=!0;break}t=t.parentNode}if(!n)break}n?Ut.utils.addClass(s,"active"):Ut.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=Ut.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 Ar=Br;const Ir=class extends rl{static key="link";static className="se-icon-flip-rtl";#Vh;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 Ut.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 Ut.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:Zt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Zt.get(e.uploadSingleSizeLimit,0),acceptedFormats:"string"==typeof e.acceptedFormats?e.acceptedFormats.trim():null,enableFileUpload:!!n},this.anchor=new Jo(this.$,s,this.pluginOptions),this.modal=new Go(this,this.$,s),this.controller=new Ms(this,this.$,i,{position:"bottom",disabled:!1}),this.#Vh=this.controller.form.querySelector("a")}active(t){if(Ut.check.isAnchor(t)&&!t.hasAttribute("data-se-non-link")){const e=this.#Vh,s=t.getAttribute("href");return e.href=s,e.textContent=e.title=t.textContent,e.target=s?.startsWith("#")?t.target:"_blank",Ut.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(Ut.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=Ut.query.getEdgeChild(this.controller.currentTarget,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!1),e=Ut.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 Ut.utils.removeItem(this.controller.currentTarget),this.controller.currentTarget=null,this.$.focusManager.focus(),this.$.history.push(!1)}controllerClose(){Ut.utils.removeClass(this.controller.currentTarget,"on")}},Vr="%",Or="px",Rr={BLOCK:"block",INLINE:"inline"},zr="image/*";const Fr=class{#za;#X;#L;#Oh;#Ua;#Rh;#zh;#Fh={w:0,h:0};#Ph=null;#Dh=null;#qh=null;constructor(t,e){if(this.#za=t,this.#X=t.$,this.#L=t.state,this.#Oh=t.pluginOptions,this.#Ua=this.#Oh.canResize,this.#Rh="auto"===this.#Oh.defaultWidth?"":this.#Oh.defaultWidth,this.#zh="auto"===this.#Oh.defaultHeight?"":this.#Oh.defaultHeight,this.#Ua){this.#Ph=e.proportion,this.#Dh=e.inputX,this.#qh=e.inputY,this.#Dh.value=this.#Oh.defaultWidth,this.#qh.value=this.#Oh.defaultHeight;const t=this.#Wh.bind(this);this.#X.eventManager.addEvent(this.#Dh,"keyup",this.#Uh.bind(this,"x")),this.#X.eventManager.addEvent(this.#qh,"keyup",this.#Uh.bind(this,"y")),this.#X.eventManager.addEvent(this.#Dh,"change",t),this.#X.eventManager.addEvent(this.#qh,"change",t),this.#X.eventManager.addEvent(this.#Ph,"change",t),this.#X.eventManager.addEvent(e.revertBtn,"click",this.#Zh.bind(this))}}setInputSize(t,e){this.#Dh.value="auto"===t?"":t,this.#L.onlyPercentage||(this.#qh.value="auto"===e?"":e)}getInputSize(){return{w:this.#Dh?.value||"",h:this.#qh?.value||""}}setOriginSize(t,e){this.#Rh=t,this.#zh=e}applySize(t,e){t||=this.#Dh?.value||this.#Oh.defaultWidth,e||=this.#qh?.value||this.#Oh.defaultHeight,this.#L.onlyPercentage&&(t?/%$/.test(t)||(t+=Vr):t="100%"),this.#za.figure.setSize(t,e)}on(){if(!this.#Ua)return;const t=this.#Oh.defaultWidth,e=this.#Oh.defaultHeight;this.setInputSize(t,e),this.setOriginSize(t,e)}ready(t,e,s){this.setInputSize(e,s);const i=this.#L.onlyPercentage&&this.#za.figure.isVertical;this.#Ph.checked=!0,this.#Dh.disabled=i,this.#qh.disabled=i,this.#Ph.disabled=i,this.#Fh=this.#Ph.checked?t.ratio:{w:0,h:0}}init(){this.#Fh={w:0,h:0},this.#Ua&&(this.setInputSize(this.#Oh.defaultWidth,this.#Oh.defaultHeight),this.#Ph.checked=!0)}#Uh(t,e){if(Gt.isSpace(e.code))return void e.preventDefault();const s=e.target;if("x"===t&&this.#L.onlyPercentage&&Number(s.value)>100)s.value="100";else if(this.#Ph.checked){const e=qs.CalcRatio(this.#Dh.value,this.#qh.value,this.#L.sizeUnit,this.#Fh);"x"===t?this.#qh.value=String(e.h):this.#Dh.value=String(e.w)}}#Wh(){this.#Fh=this.#Ph.checked?qs.GetRatio(this.#Dh.value,this.#qh.value,this.#L.sizeUnit):{w:0,h:0}}#Zh(){this.#L.onlyPercentage?this.#Dh.value=Number(this.#Rh)>100?"100":this.#Rh:(this.#Dh.value=this.#Rh,this.#qh.value=this.#zh)}},{NO_EVENT:Pr}=Dt;const Dr=class{#za;#X;#Oh;#Ua;constructor(t){this.#za=t,this.#X=t.$,this.#Oh=t.pluginOptions,this.#Ua=this.#Oh.canResize,this._base64RenderIndex=0}get#Gh(){return this.#za.sizeService}serverUpload(t){if(!t.files)return;const e=this.#Oh.uploadUrl;"string"==typeof e&&e.length>0?this.#za.fileManager.upload(e,this.#Oh.uploadHeaders,t.files,this.#jh.bind(this,t),this.#na.bind(this)):this.#Kh(t)}urlUpload(t){this.#za.setState("produceIndex",0);const e=t.url;this.#za.modal.isUpdate?this.#Yh(e,t.element,t.files):this.#Xh(e,t.anchor,t.inputWidth,t.inputHeight,t.align,t.files,t.alt,!0)}#Xh(t,e,s,i,n,o,l,r){this.#za.as!==Rr.INLINE?this.#za.create(t,e,s,i,n,o,l,r):this.#za.createInline(t,e,s,i,o,l,r)}#Yh(t,e,s){e.src=t,this.#za.fileManager.setFileData(e,s),this.#X.component.select(e,this.#za.constructor.key)}#ia(t,e){this.#za.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.#Yh(s[i].url,t.element,e);break}this.#Xh(s[i].url,t.anchor,t.inputWidth,t.inputHeight,t.align,e,t.alt,i===n-1)}}#Kh(t){try{const{files:e,element:s,anchor:i,inputWidth:n,inputHeight:o,align:l,alt:r,isUpdate:a}=t,h=this.#za.modal.isUpdate?1:e.length;if(0===h)return this.#X.ui.hideLoading(),void console.warn("[SUNEDITOR.image.base64.fail] cause : No applicable files");this._base64RenderIndex=h;const c=new Array(h);this.#Ua&&this.#Gh.setInputSize(n,o);for(let t,d,u=0,p=this.#Jh.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.#X.ui.hideLoading())}.bind(this,p,t,a,s,d,u),t.readAsDataURL(d)}catch(t){throw this.#X.ui.hideLoading(),Error(`[SUNEDITOR.plugins.image._setBase64.fail] ${t.message}`)}}#Jh(t,e,s,i,n,o,l,r){this.#za.setState("produceIndex",0);for(let a=0,h=e.length;a<h;a++)t?this.#Yh(e[a].result,s,e[a].file):this.#Xh(e[a].result,i,n,o,l,e[a].file,r,a===h-1)}async#na(t){const e=await this.#X.eventManager.triggerEvent("onImageUploadError",{error:t}),s=e===Pr?t.errorMessage:e||t.errorMessage;this.#X.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.image.error]",s)}async#jh(t,e){if(await this.#X.eventManager.triggerEvent("imageUploadHandler",{xmlHttp:e,info:t})===Pr){const s=JSON.parse(e.responseText);s.errorMessage?this.#na(s):this.#ia(t,s)}}},{NO_EVENT:qr}=Dt;const Wr=class extends rl{static key="image";static className="";static component(t){const e=Ut.check.isFigure(t)||/^span$/i.test(t.nodeName)&&Ut.check.isComponentContainer(t)?t.firstElementChild:t;return/^IMG$/i.test(e?.nodeName)?e:Ut.check.isAnchor(e)&&/^IMG$/i.test(e?.firstElementChild?.nodeName)?e?.firstElementChild:null}#Ua;#Qh;#tc=null;#ec="";#sc="none";#ic="30%";#Ta=null;#nc=null;#oc=null;#lc=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?Zt.is(e.defaultWidth)?e.defaultWidth+Or:e.defaultWidth:"auto",defaultHeight:e.defaultHeight?Zt.is(e.defaultHeight)?e.defaultHeight+Or: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:Zt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Zt.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?zr:e.acceptedFormats.trim()||zr,useFormatType:e.useFormatType??!0,defaultFormatType:[Rr.BLOCK,Rr.INLINE].includes(e.defaultFormatType)?e.defaultFormatType:Rr.BLOCK,keepFormatType:e.keepFormatType??!1,insertBehavior:e.insertBehavior};const s=this.pluginOptions.percentageOnlySize?Vr:Or,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${Go.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${Ut.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${Ut.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${Ut.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${Ut.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=Ut.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 Jo(this.$,i.html,{...l,textToDisplay:!1,title:!0}),this.modal=new Go(this,this.$,i.html),this.figure=new qs(this,this.$,o,{sizeUnit:s}),this.fileManager=new Ko(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=Rr.BLOCK,this.#Ua=this.pluginOptions.canResize,this.#Qh=!this.#Ua||!this.pluginOptions.showHeightInput||this.pluginOptions.percentageOnlySize,this.sizeService=new Fr(this,i),this.uploadService=new Dr(this),this.$.eventManager.addEvent(i.tabs,"click",this.#rc.bind(this)),this.imgInputFile&&this.$.eventManager.addEvent(i.fileRemoveBtn,"click",this.#ac.bind(this)),this.imgUrlFile&&this.$.eventManager.addEvent(this.imgUrlFile,"input",this.#hc.bind(this)),this.imgInputFile&&this.imgUrlFile&&this.$.eventManager.addEvent(this.imgInputFile,"change",this.#cc.bind(this));const r=i.galleryButton;r&&this.$.eventManager.addEvent(r,"click",this.#dc.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.#uc.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=qs.GetContainer(t);if(e&&e.container&&(e.cover||e.inlineCover))return;const{w:s,h:i}=this.#pc(t,!0);this.#gc(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.#sc=this.modal.form.querySelector('input[name="suneditor_image_radio"]:checked').value,this.modal.isUpdate&&(this.#mc(),this.$.history.push(!1)),this.imgInputFile&&this.imgInputFile.files.length>0?await this.submitFile(this.imgInputFile.files):!!(this.imgUrlFile&&this.#ec.length>0)&&await this.submitURL(this.#ec)}modalInit(){Go.OnChangeFile(this.fileModalWrapper,[]),this.imgInputFile&&(this.imgInputFile.value=""),this.imgUrlFile&&(this.#ec=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.#Ta=null,this.#rc("init"),this.sizeService.init(),this.pluginOptions.useFormatType&&this.#fc((this.pluginOptions.keepFormatType?this.as:this.pluginOptions.defaultFormatType)===Rr.INLINE),this.anchor.init()}componentSelect(t){this.#pc(t)}componentEdit(){this.modal.open()}async componentDestroy(t){const e=t||this.#Ta,s=Ut.query.getParentElement(e,qs.is)||e,i=s.previousElementSibling||s.nextElementSibling,n=s.parentNode;!1!==await this.$.eventManager.triggerEvent("onImageDeleteBefore",{element:e,container:s,align:this.#sc,alt:this.altText.value,url:this.#ec})&&(Ut.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===qr?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===qr?t:s||t,"error"),!1}const l={files:s,...this.#vc()},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!==qr||r(null)))}async submitURL(t){if(!(t||=this.#ec))return!1;const e={name:t.split("/").pop(),size:0},s={url:t,files:e,...this.#vc()},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!==qr||i(null),!0)}create(t,e,s,i,n,o,l,r){const a=Ut.utils.createElement("IMG");a.src=t,a.alt=l,e=this.#bc(a,e?e.cloneNode(!1):null);const h=qs.CreateContainer(e,"se-image-container"),c=h.cover,d=h.container;this.captionCheckEl.checked&&(this.#lc=qs.CreateCaption(c,this.$.lang.caption)),this.#Ta=a,this.#nc=c,this.#oc=d,this.figure.open(a,{nonResizing:this.#Qh,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.#yc.bind(this,a,this.#ic,d),this.$.component.insert(d,{scrollTo:!!r,insertBehavior:r?null:"line"})}createInline(t,e,s,i,n,o,l){const r=Ut.utils.createElement("IMG");r.src=t,r.alt=o,e=this.#bc(r,e?e.cloneNode(!1):null);const a=qs.CreateInlineContainer(e,"se-image-container").container;this.#Ta=r,this.#oc=a,this.figure.open(r,{nonResizing:this.#Qh,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.#yc.bind(this,r,this.#ic,a),this.$.component.insert(a,{scrollTo:!!l,insertBehavior:l?null:"line"})}#pc(t,e=!1){if(!t)return;const s=this.figure.open(t,{nonResizing:this.#Qh,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:e});this.anchor.set(Ut.check.isAnchor(t.parentNode)?t.parentNode:null),this.#tc=this.anchor.currentTarget,this.#Ta=t,this.#nc=s.cover,this.#oc=s.container,this.#lc=s.caption,this.#sc=s.align,t.style.float="",this.sizeService.setOriginSize(String(s.originWidth||s.w||""),String(s.originHeight||s.h||"")),this.altText.value=this.#Ta.alt,this.imgUrlFile&&(this.#ec=this.previewSrc.textContent=this.imgUrlFile.value=this.#Ta.src);(this.modal.form.querySelector('input[name="suneditor_image_radio"][value="'+this.#sc+'"]')||this.modal.form.querySelector('input[name="suneditor_image_radio"][value="none"]')).checked=!0,this.captionCheckEl.checked=!!this.#lc;const{dw:i,dh:n}=this.figure.getSize(t);return this.#Ua?(this.sizeService.ready(s,i,n),this.pluginOptions.useFormatType&&this.#fc(this.$.component.isInline(s.container)),{w:i,h:n}):{w:i,h:n}}#vc(){const{w:t,h:e}=this.sizeService.getInputSize();return{element:this.#Ta,anchor:this.anchor.create(!0),inputWidth:t,inputHeight:e,align:this.#sc,isUpdate:this.modal.isUpdate,alt:this.altText.value}}#fc(t){t?(Ut.utils.addClass(this.asInline,"on"),Ut.utils.removeClass(this.asBlock,"on"),this.as=Rr.INLINE,this.alignForm&&(this.alignForm.style.display="none"),this.captionEl&&(this.captionEl.style.display="none")):(Ut.utils.addClass(this.asBlock,"on"),Ut.utils.removeClass(this.asInline,"on"),this.as=Rr.BLOCK,this.alignForm&&(this.alignForm.style.display=""),this.captionEl&&(this.captionEl.style.display=""))}#mc(){const{w:t,h:e}=this.sizeService.getInputSize(),s=t||"auto",i=e||"auto";let n=this.#Ta;(this.as===Rr.BLOCK&&!this.#nc||this.as===Rr.INLINE&&this.#nc)&&(n=this.figure.convertAsFormat(n,this.as));const o=this.#nc,l=this.#oc===this.#nc?null:this.#oc;let r;const a=Zt.is(s)?s+this.state.sizeUnit:s,h=Zt.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.#lc||(this.#lc=qs.CreateCaption(o,this.$.lang.caption),c=!0):this.#lc&&(Ut.utils.removeItem(this.#lc),this.#lc=null,c=!0);let d=!1;const u=this.anchor.create(!0);if(u)this.#tc===u&&l.contains(u)||(this.#tc=u.cloneNode(!1),o.insertBefore(this.#bc(n,this.#tc),this.#lc),d=!0);else if(null!==this.#tc&&o.contains(this.#tc)){const t=n.cloneNode(!0);o.removeChild(this.#tc),o.insertBefore(t,this.#lc),n=t}d&&Ut.utils.removeItem(u),this.#Ua&&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.#Ua&&r&&this.figure.isVertical||this.figure.setTransform(n,s,i,0)),this.figure.setAlign(n,this.#sc),n.onload=()=>{this.componentSelect(n)}}#gc(t,e){const{w:s,h:i}=this.sizeService.getInputSize();t||=s||"auto",e||=i||"auto";let n=this.#Ta,o=this.#nc,l=null,r=this.#oc===this.#nc?null:this.#oc,a=!1;if(!o||!r){a=!0,n=this.#Ta.cloneNode(!0);const e=this.pluginOptions.useFormatType&&"auto"!==t&&(/^span$/i.test(this.#Ta.parentElement?.nodeName)||this.$.format.isLine(this.#Ta.parentElement))?qs.CreateInlineContainer(n,"se-image-container"):qs.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.#lc&&!a||(this.#lc=qs.CreateCaption(o,this.$.lang.caption),h=!0):this.#lc&&(Ut.utils.removeItem(this.#lc),this.#lc=null,h=!0));let c=null;const d=this.anchor.create(!0);if(d)(this.#tc!==d||a&&!r.contains(d))&&(this.#tc=d.cloneNode(!1),o.insertBefore(this.#bc(n,this.#tc),this.#lc),c=this.#Ta);else if(null!==this.#tc&&o.contains(this.#tc)){const t=n.cloneNode(!0);o.removeChild(this.#tc),o.insertBefore(t,this.#lc),n=t}a&&(n=this.#Ta,this.figure.retainFigureFormat(r,this.#Ta,c?d:null,this.fileManager),this.#Ta=n=r.querySelector("img"),this.#nc=o,this.#oc=r),n.style.width="",n.style.height="",n.removeAttribute("width"),n.removeAttribute("height"),this.sizeService.applySize(t,e),c&&(a?(Ut.utils.removeItem(c),0===Ut.query.getListChildren(d,(t=>/IMG/i.test(t.tagName)),null).length&&Ut.utils.removeItem(d)):Ut.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.#sc)}#bc(t,e){return e?(e.appendChild(t),e):t}#rc(t){const e=this.modal.form,s="string"==typeof t?e.querySelector("._se_tab_link"):Ut.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++)Ut.utils.removeClass(l[n],"active");return e.querySelector("._se_tab_content_"+i).style.display="block",Ut.utils.addClass(s,"active"),"init"!==t&&("image"===i?this.focusElement.focus():"url"===i&&this.anchor.urlInput.focus()),!1}#ac(){this.imgInputFile.value="",this.imgUrlFile&&(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),Go.OnChangeFile(this.fileModalWrapper,[])}#uc({target:t}){this.#fc("asInline"===t.getAttribute("data-command"))}#hc(t){const e=t.target.value.trim();this.#ec=this.previewSrc.textContent=e?this.$.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.$.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#cc({target:t}){this.imgInputFile.value?(this.imgUrlFile.disabled=!0,this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),Go.OnChangeFile(this.fileModalWrapper,t.files)}#dc(){this.$.plugins.imageGallery.open(this.#wc.bind(this))}#wc(t){this.altText.value=t.getAttribute("data-value")||t.alt,this.#ec=this.previewSrc.textContent=this.imgUrlFile.value=t.getAttribute("data-command")||t.src,this.imgUrlFile.focus()}#yc(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 Ur=class{#za;#X;#L;#Oh;#Ua;#Cc;#_c;#xc;#Rh;#zh;#Fh={w:0,h:0};#Ph=null;#Dh=null;#qh=null;#$c=null;constructor(t,e){if(this.#za=t,this.#X=t.$,this.#L=t.state,this.#Oh=t.pluginOptions,this.#Ua=this.#Oh.canResize,this.#Cc=this.#L.defaultRatio,this.#_c="100%",this.#xc=100*this.#Oh.defaultRatio+"%",this.#Rh="100%"===this.#Oh.defaultWidth?"":this.#Oh.defaultWidth,this.#zh=this.#Oh.defaultHeight===this.#L.defaultRatio?"":this.#Oh.defaultHeight,this.#Ua){this.#Ph=e.proportion,this.frameRatioOption=e.frameRatioOption,this.#Dh=e.inputX,this.#qh=e.inputY,this.#Dh.value=this.#Oh.defaultWidth,this.#qh.value=this.#Oh.defaultHeight;const t=this.#Wh.bind(this);this.#X.eventManager.addEvent(this.#Dh,"keyup",this.#Uh.bind(this,"x")),this.#X.eventManager.addEvent(this.#qh,"keyup",this.#Uh.bind(this,"y")),this.#X.eventManager.addEvent(this.#Dh,"change",t),this.#X.eventManager.addEvent(this.#qh,"change",t),this.#X.eventManager.addEvent(this.#Ph,"change",t),this.#X.eventManager.addEvent(this.frameRatioOption,"change",this.#kc.bind(this)),this.#X.eventManager.addEvent(e.revertBtn,"click",this.#Zh.bind(this))}}setInputSize(t,e){this.#Dh.value=t===this.#_c?"":t,this.#L.onlyPercentage||(this.#qh.value=e===this.#xc?"":e)}getInputSize(){return{w:this.#Dh?.value||"",h:this.#qh?.value||""}}setOriginSize(t,e){this.#Rh=t,this.#zh=e}applySize(t,e){t||=this.#Dh?.value||this.#Oh.defaultWidth,e||=this.#qh?.value||this.#Oh.defaultHeight,this.#L.onlyPercentage&&(t?/%$/.test(t+"")||(t+="%"):t="100%"),this.#za.figure.setSize(t,e)}resolveSize(t,e,s,i){t||=this.#_c,e||=this.#Cc;const n=this.#za.figure.getSize(s),o=n.w!==t||n.h!==e,l=!i||o;return l&&(this.#$c!==this.frameRatioOption?.value&&this.#za.figure.deleteTransform(),this.applySize(t,e)),{width:t,height:e,isChanged:l}}on(t){if(this.#Ua){if(!t){const t=this.#Oh.defaultWidth,e=this.#Oh.defaultHeight;this.setInputSize(t,e),this.setOriginSize(t,e),this.#Ph.disabled=!0}this.#Sc(this.#za.figure.isVertical?"":this.#zh||this.#L.defaultRatio),this.#$c=this.frameRatioOption?.value}}ready(t,e){const{dw:s,dh:i}=this.#za.figure.getSize(e);this.setInputSize(s,i);const n=t.height||t.h||this.#zh||"";this.#Sc(n)||(this.#qh.value=String(this.#L.onlyPercentage?Zt.get(n,2):n));const o=this.#L.onlyPercentage&&this.#za.figure.isVertical;this.#Dh.disabled=o,this.#qh.disabled=o,this.#Ph.checked=!t.isVertical,this.#Ph.disabled=o,this.#Fh=this.#Ph.checked?t.ratio:{w:0,h:0}}init(){this.#Fh={w:0,h:0},this.#Ua&&(this.setInputSize(this.#Oh.defaultWidth,this.#Oh.defaultHeight),this.#Ph.checked=!1,this.#Ph.disabled=!0,this.#Sc(this.#L.defaultRatio))}#Zh(){this.#L.onlyPercentage?this.#Dh.value=Number(this.#Rh)>100?"100":this.#Rh:(this.#Dh.value=this.#Rh,this.#qh.value=this.#zh)}#Sc(t){if(!this.frameRatioOption)return;let e=!1;const s=this.frameRatioOption.options;/%$/.test(t+"")||this.#L.onlyPercentage?t=Zt.get(t,2)/100+"":(!Zt.is(t)||Number(t)>=1)&&(t=""),this.#qh.placeholder="";for(let i=0,n=s.length;i<n;i++)s[i].value===t?(e=s[i].selected=!0,this.#qh.placeholder=t?100*Number(t)+"%":""):s[i].selected=!1;return e}#kc(t){const e=Ut.query.getEventTarget(t),s=e.options[e.selectedIndex].value;this.#xc=this.#za.figure.autoRatio.current=this.#Cc=s?100*Number(s)+"%":this.#xc,this.#qh.placeholder=s?100*Number(s)+"%":"",this.#qh.value=""}#Wh(){this.#Fh=this.#Ph.checked?qs.GetRatio(this.#Dh.value,this.#qh.value,this.#L.sizeUnit):{w:0,h:0}}#Uh(t,e){if(Gt.isSpace(e.code))return void e.preventDefault();const s=Ut.query.getEventTarget(e);if("x"===t&&this.#L.onlyPercentage&&Number(s.value)>100)s.value="100";else if(this.#Ph.checked&&!this.frameRatioOption?.value){const e=qs.CalcRatio(this.#Dh.value,this.#qh.value,this.#L.sizeUnit,this.#Fh);"x"===t?this.#qh.value=String(e.h):this.#Dh.value=String(e.w)}"y"===t&&this.#Sc(s.value||this.#L.defaultRatio)}},{NO_EVENT:Zr}=Dt;const Gr=class{#za;#X;#Oh;constructor(t){this.#za=t,this.#X=t.$,this.#Oh=t.pluginOptions}serverUpload(t,e){if(!e)return;const s=this.#Oh.uploadUrl;"string"==typeof s&&s.length>0&&this.#za.fileManager.upload(s,this.#Oh.uploadHeaders,e,this.#jh.bind(this,t),this.#na.bind(this))}#ia(t,e){const s=e.result,i=this.#za.createVideoTag();for(let e=0,n=s.length;e<n;e++){const o=t.isUpdate?t.element:i.cloneNode(!1);this.#za.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#na(t){const e=await this.#X.eventManager.triggerEvent("onVideoUploadError",{error:t}),s=e===Zr?t.errorMessage:e||t.errorMessage;this.#X.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.video.error]",e)}async#jh(t,e){if(await this.#X.eventManager.triggerEvent("videoUploadHandler",{xmlHttp:e,info:t})===Zr){const s=JSON.parse(e.responseText);s.errorMessage?this.#na(s):this.#ia(t,s)}}};const{_w:jr,NO_EVENT:Kr}=Dt;class Yr extends rl{static key="video";static className="";static component(t){return/^(VIDEO)$/i.test(t?.nodeName)||/^(IFRAME)$/i.test(t?.nodeName)&&this.#Ec(t.src)?t:null}static#Ec(t){return t=t?.toLowerCase()||"",!(!this.#Tc.some((e=>t.endsWith(e)))&&!this.#Mc.some((e=>e.test(t))))}static#Tc=[".mp4",".avi",".mov",".webm",".flv",".mkv",".m4v",".ogv"];static#Mc=[/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\//];#Ua;#Qh;#ec="";#sc="none";#Ta=null;#oc=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&&Zt.get(e.defaultWidth,0)?Zt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight&&Zt.get(e.defaultHeight,0)?Zt.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:Zt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Zt.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?"video/*":e.acceptedFormats.trim()||"video/*",defaultRatio:Zt.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${Go.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${Ut.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=Ut.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 Go(this,this.$,i.html),this.figure=new qs(this,this.$,n,{sizeUnit:s,autoRatio:{current:o,default:o}}),this.fileManager=new Ko(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.#Ua=this.pluginOptions.canResize,this.#Qh=!this.#Ua||!this.pluginOptions.showHeightInput||this.pluginOptions.percentageOnlySize,this.query={youtube:{pattern:/youtu\.?be/i,action:t=>(t=this.convertUrlYoutube(t),Wt.addUrlQuery(t,this.pluginOptions.query_youtube)),tag:"iframe"},vimeo:{pattern:/vimeo\.com/i,action:t=>(t=this.convertUrlVimeo(t),Wt.addUrlQuery(t,this.pluginOptions.query_vimeo)),tag:"iframe"},...e.embedQuery};const l=[];for(const t in this.query)l.push(this.query[t].pattern);Yr.#Tc=Yr.#Tc.concat(this.pluginOptions.extensions||[]),Yr.#Mc=Yr.#Mc.concat(e.urlPatterns||[]),this.state={onlyPercentage:this.pluginOptions.percentageOnlySize,sizeUnit:s,defaultRatio:100*this.pluginOptions.defaultRatio+"%"},this.sizeService=new Ur(this,i),this.uploadService=new Gr(this);const r=i.galleryButton;r&&this.$.eventManager.addEvent(r,"click",this.#dc.bind(this)),this.videoInputFile&&this.$.eventManager.addEvent(i.fileRemoveBtn,"click",this.#ac.bind(this)),this.videoUrlFile&&this.$.eventManager.addEvent(this.videoUrlFile,"input",this.#hc.bind(this)),this.videoInputFile&&this.videoUrlFile&&this.$.eventManager.addEvent(this.videoInputFile,"change",this.#cc.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)&&!Yr.#Ec(t.src))return;const e=qs.GetContainer(t);if(e&&e.container&&e.cover)return;this.#pc(t,!0);const s=this.$.format.getLine(t);s&&(this.#sc=s.style.textAlign||s.style.float),this.#mc(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.#sc=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.#ec.length>0&&(t=await this.submitURL(this.#ec)),t&&jr.setTimeout(this.$.component.select.bind(this.$.component,this.#Ta,Yr.key),0),t}modalInit(){Go.OnChangeFile(this.fileModalWrapper,[]),this.videoInputFile&&(this.videoInputFile.value=""),this.videoUrlFile&&(this.#ec=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.#Qh=!1,this.sizeService.init()}componentSelect(t){this.#pc(t)}componentEdit(){this.modal.open()}async componentDestroy(t){const e=t||this.#Ta,s=Ut.query.getParentElement(e,qs.is)||e,i=s.previousElementSibling||s.nextElementSibling,n=s.parentNode;!1!==await this.$.eventManager.triggerEvent("onVideoDeleteBefore",{element:e,container:s,align:this.#sc,url:this.#ec})&&(Ut.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.#Ta).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.#Ta=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.#Ta=t=s}else t.src=e}a=this.#oc}else{t.src=e,this.#Ta=t;a=qs.CreateContainer(t,"se-video-container").container}this.#Ta=t,this.#oc=a,this.figure.open(t,{nonResizing:this.#Qh,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.#Ua&&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=Ut.utils.createElement("IFRAME");if(t)for(const s in t)e[s]=t[s];return this.#Hc(e),e}createVideoTag(t){const e=Ut.utils.createElement("VIDEO");if(t)for(const s in t)e[s]=t[s];return this.#Lc(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===Kr?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===Kr?t:s||t,"error"),!1}const l={url:null,files:s,...this.#vc()},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!==Kr||r(null)))}async submitURL(t){if(!(t=this.#ec))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.#vc(),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!==Kr||n(null),!0)}#pc(t,e=!1){if(!t)return;const s=this.figure.open(t,{nonResizing:this.#Qh,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:e});this.#Ta=t,this.#oc=s.container,this.#sc=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.#ec=this.previewSrc.textContent=this.videoUrlFile.value=this.#Ta.src||this.#Ta.querySelector("source")?.src||"");(this.modal.form.querySelector('input[name="suneditor_video_radio"][value="'+this.#sc+'"]')||this.modal.form.querySelector('input[name="suneditor_video_radio"][value="none"]')).checked=!0,this.#Ua&&this.sizeService.ready(s,t)}#vc(){const{w:t,h:e}=this.sizeService.getInputSize();return{inputWidth:t,inputHeight:e,align:this.#sc,isUpdate:this.modal.isUpdate,element:this.#Ta}}#mc(t){if(!t)return;/^video$/i.test(t.nodeName)?this.#Lc(t):/^iframe$/i.test(t.nodeName)&&this.#Hc(t);const e=t,s=t.cloneNode(!0),i=qs.CreateContainer(s,"se-video-container"),n=i.container,o=qs.GetContainer(e)?.container?.querySelector("figcaption");let l=null;o&&(l=Ut.utils.createElement("figcaption"),l.innerHTML=o.innerHTML,Ut.utils.removeItem(o),i.cover.appendChild(l)),this.figure.open(s,{nonResizing:this.#Qh,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.#sc=c.style.textAlign||c.style.float),this.figure.setAlign(s,this.#sc),this.figure.retainFigureFormat(n,this.#Ta,null,this.fileManager),s}#Lc(t){t.setAttribute("controls","true");const e=this.pluginOptions.videoTagAttributes;if(e)for(const s in e)t.setAttribute(s,e[s])}#Hc(t){t.frameBorder="0",t.allowFullscreen=!0;const e=this.pluginOptions.iframeTagAttributes;if(e)for(const s in e)t.setAttribute(s,e[s])}#ac(){this.videoInputFile.value="",this.videoUrlFile&&(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),Go.OnChangeFile(this.fileModalWrapper,[])}#hc(t){const e=Ut.query.getEventTarget(t).value.trim();/^<iframe.*\/iframe>$/.test(e)?(this.#ec=e,this.previewSrc.textContent='<IFrame :src=".."></IFrame>'):this.#ec=this.previewSrc.textContent=e?this.$.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.$.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#dc(){this.$.plugins.videoGallery.open(this.#wc.bind(this))}#wc(t){this.#ec=this.previewSrc.textContent=this.videoUrlFile.value=t.getAttribute("data-command")||t.src,this.videoUrlFile.focus()}#cc(t){this.videoInputFile.value?(this.videoUrlFile.disabled=!0,this.previewSrc.style.textDecoration="line-through"):(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration="");const e=Ut.query.getEventTarget(t);Go.OnChangeFile(this.fileModalWrapper,e.files)}}const Xr=Yr,{NO_EVENT:Jr,ON_OVER_COMPONENT:Qr}=Dt;class ta extends rl{static key="audio";static className="";static component(t){return/^AUDIO$/i.test(t?.nodeName)?t:null}#Nc;#Bc;#Ac="";#Ta=null;constructor(t,e){super(t),this.title=this.$.lang.audio,this.icon="audio",this.pluginOptions={defaultWidth:e.defaultWidth?Zt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight?Zt.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:Zt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Zt.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 ${Go.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${Ut.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>`,Ut.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 Ut.utils.createElement("DIV",{class:"se-controller"},s)}(this.$);this.modal=new Go(this,this.$,s),this.controller=new Ms(this,this.$,i,{position:"bottom",disabled:!0}),this.fileManager=new Ko(this,this.$,{query:"audio",loadEventName:"onAudioLoad",actionEventName:"onAudioAction"}),this.figure=new qs(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.#Nc=this.pluginOptions.defaultWidth,this.#Bc=this.pluginOptions.defaultHeight;const n=s.querySelector(".__se__gallery");n&&this.$.eventManager.addEvent(n,"click",this.#dc.bind(this)),this.audioInputFile&&(this.$.eventManager.addEvent(s.querySelector(".se-modal-files-edge-button"),"click",this.#ac.bind(this,this.audioUrlFile,this.preview)),this.audioUrlFile&&this.$.eventManager.addEvent(this.audioInputFile,"change",this.#Ic.bind(this))),this.audioUrlFile&&this.$.eventManager.addEvent(this.audioUrlFile,"input",this.#hc.bind(this))}open(){this.modal.open()}retainFormat(){return{query:"audio",method:t=>{const e=qs.GetContainer(t);if(e&&e.container&&e.cover)return;this.#Lc(t);const s=qs.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.#Ta?(this.#Ac=this.preview.textContent=this.audioUrlFile.value=this.#Ta.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.#Ac.length>0)&&await this.submitURL(this.#Ac)}modalInit(){Go.OnChangeFile(this.fileModalWrapper,[]),this.audioInputFile&&(this.audioInputFile.value=""),this.audioUrlFile&&(this.#Ac=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.#Ac=this.preview.textContent=this.audioUrlFile.value=this.#Ta.src),this.open();break;case"copy":{const t=qs.GetContainer(this.#Ta);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.#pc(t)}async componentDestroy(t){const e=t||this.#Ta,s=qs.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;Ut.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===Jr?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===Jr?t:s||t,"error"),!1}const o={files:s,isUpdate:this.modal.isUpdate,element:this.#Ta},l=function(t,e,s){t(s=e||s,s.files)}.bind(this,this.#Vc.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!==Jr||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.#Oc()},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!==Jr||i(null),!0)}create(t,e,s,i,n){if(i){if(this.#Ta&&(t=this.#Ta),this.fileManager.setFileData(t,s),!t||t.src===e)return void this.$.component.select(t,ta.key);t.src=e,this.$.component.select(t,ta.key)}else{this.fileManager.setFileData(t,s),t.src=e;const i=qs.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)}#pc(t){ws.get("__overInfo")!==Qr&&(this.#Ta=t,this.controller.open(t,null,{isWWTarget:!1,addOffset:null}))}#ia(t,e){const s=e.result;for(let e,i,n=0,o=s.length;n<o;n++)i=t.isUpdate?t.element:this.#Oc(),e={name:s[n].name,size:s[n].size},this.create(i,s[n].url,e,t.isUpdate,n===o-1)}#Oc(){const t=this.#Nc,e=this.#Bc,s=Ut.utils.createElement("AUDIO",{style:(t?"width:"+t+"; ":"")+(e?"height:"+e+";":"")});return this.#Lc(s),s}#Lc(t){t.setAttribute("controls","true");const e=this.pluginOptions.audioTagAttributes;if(e)for(const s in e)t.setAttribute(s,e[s])}#Vc(t,e){if(!e)return;const s=this.modal.isUpdate?[e[0]]:e;this.fileManager.upload(this.pluginOptions.uploadUrl,this.pluginOptions.uploadHeaders,s,this.#jh.bind(this,t),this.#na.bind(this))}async#na(t){const e=await this.$.eventManager.triggerEvent("onAudioUploadError",{error:t}),s=e===Jr?t.errorMessage:e||t.errorMessage;this.$.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.audio.error]",s)}async#jh(t,e){if(await this.$.eventManager.triggerEvent("audioUploadHandler",{xmlHttp:e,info:t})===Jr){const s=JSON.parse(e.responseText);s.errorMessage?this.#na(s):this.#ia(t,s)}}#hc(t){const e=Ut.query.getEventTarget(t).value.trim();this.#Ac=this.preview.textContent=e?this.$.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.$.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#dc(){this.$.plugins.audioGallery.open(this.#wc.bind(this))}#wc(t){this.#Ac=this.preview.textContent=this.audioUrlFile.value=t.getAttribute("data-command")||t.src,this.audioUrlFile.focus()}#ac(t,e){this.audioInputFile.value="",t&&(t.disabled=!1,e.style.textDecoration=""),Go.OnChangeFile(this.fileModalWrapper,[])}#Ic(t){const e=Ut.query.getEventTarget(t);this.audioInputFile.value?(this.audioUrlFile.disabled=!0,this.preview.style.textDecoration="line-through"):(this.audioUrlFile.disabled=!1,this.preview.style.textDecoration=""),Go.OnChangeFile(this.fileModalWrapper,e.files)}}const ea=ta,{_w:sa,NO_EVENT:ia}=Dt;class na extends rl{static key="embed";static className="";static component(t){const e=t.children;let s="",i=null;if(Ut.check.isIFrame(t)&&(i=t,s=t.src),!s&&/^DIV$/i.test(t?.nodeName)&&Ut.check.isIFrame(e[0])&&(i=e[0],s=i.src),!s&&Ut.utils.hasClass(t,"se-embed-container")){i=Ut.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.#Ec(s)?i:null}return s?this.#Ec(s)?i:null:i}static#Ec(t){return t=t?.toLowerCase()||"",!!this.#Mc.some((e=>e.test(t)))}static#Mc=null;#_c;#xc;#Rh;#zh;#Ua;#Rc;#Qh;#ec="";#sc="none";#Ta=null;#nc=null;#oc=null;#Fh={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&&Zt.get(e.defaultWidth,0)?Zt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight&&Zt.get(e.defaultHeight,0)?Zt.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"",percentageOnlySize:!!e.percentageOnlySize,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:Zt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Zt.get(e.uploadSingleSizeLimit,0),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},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=Ut.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 Go(this,this.$,i.html),this.figure=new qs(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.#_c=this.pluginOptions.defaultWidth,this.#xc=this.pluginOptions.defaultHeight,this.#Rh="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.#zh="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.#Ua=this.pluginOptions.canResize,this.#Rc=this.pluginOptions.percentageOnlySize,this.#Qh=!this.#Ua||!this.pluginOptions.showHeightInput||this.#Rc,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);na.#Mc=o.concat(e.urlPatterns||[]),this.$.eventManager.addEvent(this.embedInput,"input",this.#hc.bind(this)),this.#Ua&&(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.#Uh.bind(this,"x")),this.$.eventManager.addEvent(this.inputY,"keyup",this.#Uh.bind(this,"y")),this.$.eventManager.addEvent(i.revertBtn,"click",this.#Zh.bind(this)))}open(){this.modal.open()}retainFormat(){return{query:"iframe",method:async t=>{if(!na.#Ec(t.src))return;const e=qs.GetContainer(t);if(e&&e.container&&e.cover)return;this.#pc(t,!0);const s=this.$.format.getLine(t);s&&(this.#sc=s.style.textAlign||s.style.float),this.#mc(t)}}}modalOn(t){!t&&this.#Ua?(this.inputX.value=this.#Rh="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.inputY.value=this.#zh="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.proportion.disabled=!0):t&&(this.#ec=this.previewSrc.textContent=this.embedInput.value=this.#nc.getAttribute("data-se-origin")||"")}async modalAction(){this.#sc=this.modal.form.querySelector('input[name="suneditor_embed_radio"]:checked').value;let t=!1;return this.#ec.length>0&&(t=await this.submitSRC(this.#ec)),t&&sa.setTimeout(this.$.component.select.bind(this.$.component,this.#Ta,na.key),0),t}modalInit(){Go.OnChangeFile(this.fileModalWrapper,[]),this.#ec=this.previewSrc.textContent=this.embedInput.value="",this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="none"]').checked=!0,this.#Fh={w:0,h:0},this.#Qh=!1,this.#Ua&&(this.inputX.value=this.pluginOptions.defaultWidth===this.#_c?"":this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight===this.#xc?"":this.pluginOptions.defaultHeight,this.proportion.checked=!1,this.proportion.disabled=!0)}componentSelect(t){this.#pc(t)}componentEdit(){this.modal.open()}async componentDestroy(t){const e=t||this.#Ta,s=Ut.query.getParentElement(e,qs.is)||e,i=s.previousElementSibling||s.nextElementSibling,n=s.parentNode;!1!==await this.$.eventManager.triggerEvent("onEmbedDeleteBefore",{element:e,container:s,align:this.#sc,url:this.#ec})&&(Ut.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.#ec))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;e={children:s,...this.#vc(),process:null}}else{const s=this.findProcessUrl(t);if(!s)return!1;t=s.url,e={...this.#vc(),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.#zc.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!==ia||s(null),!0)}#pc(t,e=!1){if(!t)return;const s=this.figure.open(t,{nonResizing:this.#Qh,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:e});if(this.#Ta=t,this.#nc=s.cover,this.#oc=s.container,this._caption=s.caption,this.#sc=s.align,!this.#nc?.getAttribute?.("data-se-origin")){const e=t?.getAttribute?.("src")||t?.querySelector?.("a")?.href;e&&na.#Ec(e)&&this.#nc.setAttribute("data-se-origin",e)}t.style.float="",this.#Rh=String(s.originWidth||s.w||""),this.#zh=String(s.originHeight||s.h||"");if((this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="'+this.#sc+'"]')||this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="none"]')).checked=!0,!this.#Ua)return;const i=this.#Rc&&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.#Fh=this.proportion.checked?s.ratio:{w:0,h:0}}#Fc(){const t=Ut.utils.createElement("IFRAME");return this.#Hc(t),t}#Pc(){return Ut.utils.createElement("BLOCKQUOTE")}#zc(t,e,s,i,n,o,l,r){let a=null,h=null,c=null,d=null;if(r){if(a=this.#Ta,a.src!==s){const t=this.findProcessUrl(s);if(/^iframe$/i.test(t?.tag)&&!/^iframe$/i.test(a.nodeName)){const t=this.#Fc();t.src=s,a.replaceWith(t),a=t}else if(/^blockquote$/i.test(t?.tag)&&!/^blockquote$/i.test(a.nodeName)){const t=this.#Pc();t.setAttribute("src",s),a.replaceWith(t),a=t}else a.src=s}c=this.#oc,h=Ut.query.getParentElement(a,"FIGURE")}else if(e){a=this.#Fc(),a.src=s;const t=qs.CreateContainer(a,"se-embed-container");h=t.cover,c=t.container}else{a=i[0];const t=qs.CreateContainer(a,"se-embed-container");h=t.cover,c=t.container;const e=Array.from(i);for(const t of e)/^script$/i.test(t.nodeName)?d=Ut.utils.createElement("script",{src:t.getAttribute("src"),async:"true"},null):h.appendChild(t)}this.#Ta=a,this.#nc=h,this.#oc=c,this.figure.open(a,{nonResizing:this.#Qh,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0}),n||=this.#_c,o||=this.#xc;const u=this.figure.getSize(a),p=u.w!==n||u.h!==o,g=!r||p;if(g&&this.#Dc(n,o),this.figure.setAlign(a,l),h.setAttribute("data-se-origin",t),r)this.#Ua&&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=()=>{Ut.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)}}}#mc(t){if(!t)return;this.#Hc(t);const e=t;t=t.cloneNode(!0);const s=qs.CreateContainer(t,"se-embed-container").container;this.figure.open(t,{nonResizing:this.#Qh,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.#Dc(n,o);const l=this.$.format.getLine(e);return l&&(this.#sc=l.style.textAlign||l.style.float),this.figure.setAlign(t,this.#sc),this.figure.retainFigureFormat(s,this.#Ta,null,null),t}#Dc(t,e){t||=this.inputX?.value||this.pluginOptions.defaultWidth,e||=this.inputY?.value||this.pluginOptions.defaultHeight,this.#Rc&&(t?/%$/.test(t+"")||(t+="%"):t="100%"),this.figure.setSize(t,e)}#vc(){return{inputWidth:this.inputX?.value||"",inputHeight:this.inputY?.value||"",align:this.#sc,isUpdate:this.modal.isUpdate,element:this.#Ta}}#Hc(t){t.frameBorder="0",t.allowFullscreen=!0;const e=this.pluginOptions.iframeTagAttributes;if(e)for(const s in e)t.setAttribute(s,e[s])}#hc(t){const e=Ut.query.getEventTarget(t).value.trim();/^<iframe.*\/iframe>$/.test(e)?(this.#ec=e,this.previewSrc.textContent='<IFrame :src=".."></IFrame>'):this.#ec=this.previewSrc.textContent=e?this.$.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.$.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#Zh(){this.#Rc?this.inputX.value=Number(this.#Rh)>100?"100":this.#Rh:(this.inputX.value=this.#Rh,this.inputY.value=this.#zh)}#Uh(t,e){if(Gt.isSpace(e.code))return void e.preventDefault();const s=Ut.query.getEventTarget(e);if("x"===t&&this.#Rc&&Number(s.value)>100)s.value="100";else if(this.proportion.checked){const e=qs.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this.#Fh);"x"===t?this.inputY.value=String(e.h):this.inputX.value=String(e.w)}}}const oa=na,{_w:la,_d:ra}=Dt;class aa extends rl{static key="math";static className="";static component(t){return Ut.utils.hasClass(t,"se-math|katex")&&Ut.check.isComponentContainer(t)?t:null}#Ta=null;constructor(t,e){super(t),this.title=this.$.lang.math,this.icon="math",this.katex=null,this.mathjax=null,(this.katex=this.#qc())||(this.mathjax=this.#Wc())||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="${Dt.KATEX_WEBSITE}" target="_blank">KaTeX</a>)`:`(<a href="${Dt.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,Ut.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 Ut.utils.createElement("DIV",{class:"se-controller se-controller-link"},s)}(this.$);this.modal=new Go(this,this.$,s),this.controller=new Ms(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.#Uc.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=ha(t);if(!e)return;const s=ra.createRange().createContextualFragment(this.#Zc(Wt.entityToHTML(this.#Gc(e,!0))));t.innerHTML=s.querySelector(".se-math, .katex").innerHTML,t.setAttribute("contenteditable","false"),Ut.utils.addClass(t,"se-component|se-inline-component|se-disable-pointer|se-math"),this.katex?Ut.utils.addClass(t,"katex"):Ut.utils.removeClass(t,"katex"),this.mathjax&&this.#jc(this.mathjax)}}}modalOn(t){if(this.isUpdateState=t,t){if(this.controller.currentTarget){const t=this.controller.currentTarget,e=Wt.entityToHTML(this.#Gc(ha(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.#Zc(e),this.previewElement.style.fontSize=s}}else this.modalInit()}async modalAction(){if(0===this.textArea.value.trim().length||Ut.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(Ut.utils.addClass(e,"se-component|se-inline-component|se-disable-pointer|se-math"),e.setAttribute("contenteditable","false"),e.setAttribute("data-se-value",Wt.htmlToEntity(this.#Gc(t,!1))),e.setAttribute("data-se-type",this.fontSizeElement.value),e.style.fontSize=this.fontSizeElement.value,this.katex?(Ut.utils.addClass(e,"katex"),Ut.utils.removeClass(e,"MathJax")):Ut.utils.removeClass(e,"katex"),this.isUpdateState){Ut.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=Ut.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.#jc(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,aa.key),!0}modalInit(){this.textArea.value="",this.previewElement.innerHTML="",Ut.utils.removeClass(this.textArea,"se-error")}controllerAction(t){switch(t.getAttribute("data-command")){case"update":this.modal.open();break;case"copy":this.#Kc(this.#Ta);break;case"delete":this.componentDestroy(this.controller.currentTarget)}}controllerClose(){this.#Ta=null}componentSelect(t){if(Ut.utils.hasClass(t,"se-math|katex")&&ha(t))return this.#Ta=t,void this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null})}async componentDestroy(t){Ut.utils.removeItem(t),this.controller.close(),this.$.focusManager.focus(),this.$.history.push(!1)}#Zc(t){let e="";try{if(Ut.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)?(Ut.utils.addClass(this.textArea,"se-error"),e=`<span class="se-math-error">${e}</span>`):e=`<span class="se-math">${e}</span>`}}catch(t){Ut.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="${Dt.KATEX_WEBSITE}" target="_blank">KaTeX</a>`:`<a href="${Dt.MATHJAX_WEBSITE}" target="_blank">MathJax</a>`})</span>`,console.warn("[SUNEDITOR.math.error] ",t.message)}return e}#Gc(t,e){return t.replace(/\\{2}/g,e?"\\":"\\\\")}async#Kc(t){if(navigator.clipboard&&t)try{const e=ha(t);await this.$.html.copy(e),Ut.utils.addClass(t,"se-copy"),la.setTimeout((()=>{Ut.utils.removeClass(t,"se-copy")}),120)}catch(t){console.error("[SUNEDITOR.math.copy.fail]",t)}}#Uc(t){const e=Ut.query.getEventTarget(t);this.pluginOptions.autoHeight&&(e.style.height="5px",e.style.height=e.scrollHeight+5+"px"),this.previewElement.innerHTML=this.#Zc(e.value),this.mathjax&&this.#jc(this.mathjax)}#jc(t){t.clear(),t.updateDocument()}#qc(){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}#Wc(){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 ha(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 ca=aa,{_w:da}=Dt;const ua=class extends rl{static key="drawing";static className="";#tt;#Yc;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${Ut.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${Ut.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${Ut.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 Ut.utils.createElement("DIV",{class:"se-modal-content se-modal-responsive",style:`max-width: ${o}; max-height: ${l};`},h)}(this.$,this.pluginOptions);this.modal=new Go(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.#uc.bind(this))),this.canvas=null,this.ctx=null,this.isDrawing=!1,this.points=[],this.paths=[],this.resizeObserver=null,this.#tt={touchstart:this.#Xc.bind(this),touchmove:this.#Jc.bind(this),mousedown:this.#Qc.bind(this),mousemove:this.#td.bind(this),mouseup:this.#ed.bind(this),mouseleave:this.#sd.bind(this),mouseenter:this.#id.bind(this)},this.#Yc={touchstart:null,touchmove:null,mousedown:null,mousemove:null,mouseup:null,mouseleave:null,mouseenter:null},this.$.eventManager.addEvent(s.querySelector('[data-command="remove"]'),"click",this.#nd.bind(this))}open(){this.pluginOptions.useFormatType&&this.#fc("inline"===(this.pluginOptions.keepFormatType?this.as:this.pluginOptions.defaultFormatType)),this.modal.open(),this.#od()}modalOff(){this.#ld()}async modalAction(){if("svg"===this.pluginOptions.outputFormat){const t=this.#rd();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}#od(){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.#ad(),this.#Yc.touchstart=this.$.eventManager.addEvent(t,"touchstart",this.#tt.touchstart,{passive:!1,capture:!0}),this.#Yc.touchmove=this.$.eventManager.addEvent(t,"touchmove",this.#tt.touchmove,!0),this.#Yc.mousedown=this.$.eventManager.addEvent(t,"mousedown",this.#tt.mousedown,{passive:!1,capture:!0}),this.#Yc.mousemove=this.$.eventManager.addEvent(t,"mousemove",this.#tt.mousemove,!0),this.#Yc.mouseup=this.$.eventManager.addEvent(t,"mouseup",this.#tt.mouseup,!0),this.#Yc.mouseleave=this.$.eventManager.addEvent(t,"mouseleave",this.#tt.mouseleave),this.#Yc.mouseenter=this.$.eventManager.addEvent(t,"mouseenter",this.#tt.mouseenter),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),Dt.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.#hd(e,s,i,n),this.#cd())})),this.resizeObserver.observe(t))}#ld(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.canvas&&(this.$.eventManager.removeEvent(this.#Yc.mousedown),this.$.eventManager.removeEvent(this.#Yc.mousemove),this.$.eventManager.removeEvent(this.#Yc.mouseup),this.$.eventManager.removeEvent(this.#Yc.mouseleave),this.$.eventManager.removeEvent(this.#Yc.mouseenter)),this.canvas=null,this.ctx=null,this.points=[],this.paths=[],this.isDrawing=!1}#ad(){this.ctx.lineWidth=this.pluginOptions.lineWidth,this.ctx.lineCap=this.pluginOptions.lineCap,this.ctx.strokeStyle=this.pluginOptions.lineColor||da.getComputedStyle(this.$.contextProvider.carrierWrapper).color}#dd(){this.#ad(),this.ctx.beginPath(),this.points.forEach((([t,e],s)=>{0===s?this.ctx.moveTo(t,e):this.ctx.lineTo(t,e)})),this.ctx.stroke()}#cd(){this.#ad(),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.paths.forEach((t=>{this.points=t,this.#dd()})),this.points=[]}#hd(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]))))}#ud(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.points=[],this.paths=[]}#pd(){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}#rd(){const t=this.#pd(),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}#gd(t){const{touches:e}=t,s=this.canvas.getBoundingClientRect();return{x:e[0].clientX-s.left,y:e[0].clientY-s.top}}#fc(t){t?(Ut.utils.addClass(this.asInline,"on"),Ut.utils.removeClass(this.asBlock,"on"),this.as="inline"):(Ut.utils.addClass(this.asBlock,"on"),Ut.utils.removeClass(this.asInline,"on"),this.as="block")}#Qc(t){t.preventDefault(),this.isDrawing=!0,this.points.push([t.offsetX,t.offsetY]),this.#dd()}#td(t){t.preventDefault(),this.isDrawing&&(this.points.push([t.offsetX,t.offsetY]),this.#dd())}#Xc(t){t.preventDefault();const{x:e,y:s}=this.#gd(t);this.isDrawing=!0,this.points.push([e,s]),this.#dd()}#Jc(t){t.preventDefault();const{x:e,y:s}=this.#gd(t);this.isDrawing&&(this.points.push([e,s]),this.#dd())}#ed(){this.isDrawing=!1,this.points.length>0&&(this.paths.push([...this.points]),this.points=[])}#sd(){this.isDrawing&&(this.paths.push([...this.points]),this.pluginOptions.lineReconnect||(this.points=[],this.isDrawing=!1))}#id(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.#dd()}}#nd(){this.#ud()}#uc(t){this.#fc("asInline"===Ut.query.getEventTarget(t).getAttribute("data-command"))}};const pa=class extends el{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 so(this,this.$,{title:this.$.lang.imageGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#md.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()}#md(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 ga=class extends el{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 so(this,this.$,{title:this.$.lang.videoGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#md.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()}#md(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 ma=class extends el{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 so(this,this.$,{title:this.$.lang.audioGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#md.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()}#md(t){this.onSelectfunction?this.onSelectfunction(t):(this.$.plugins.audio.modalInit(),this.$.plugins.audio.submitURL(t.getAttribute("data-command")))}};const fa=class extends el{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 so(this,this.$,{title:this.$.lang.fileGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#md.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()}#md(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 va=class extends el{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 so(this,this.$,{title:this.$.lang.fileBrowser,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#md.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"]))]})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#md(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)}}}},ba={text:{default:"13px",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 ya extends ll{static key="fontSize";static className="se-btn-select se-btn-input se-btn-tool-font-size";#fd;constructor(t,e){super(t),this.unitMap={...ba,...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>",Ut.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=Ut.utils.createElement("button",{class:"se-btn se-tooltip se-sub-btn","data-command":ya.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=Ut.utils.createElement("button",{class:"se-btn se-tooltip se-sub-btn","data-command":ya.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=Ut.utils.createElement("button",{class:"se-btn se-tooltip se-btn-select se-btn-tool-font-size","data-command":ya.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:ya.key,type:"dropdown"},i)):(this.afterItem=Ut.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":ya.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:ya.key,type:"dropdown"},i)),this.currentSize="",this.sizeList=i.querySelectorAll("li button"),this.hasInputFocus=!1,this.isInputActive=!1,this.#fd=o,this.$.menu.initDropdownTarget(ya,i)}active(t,e){if(!Ut.utils.hasClass(e,"__se__font_size"))return!1;let s="";if(t){if(this.$.format.isLine(t))return;if(s=Ut.utils.getStyle(t,"fontSize"))return this.#vd(e,s),!0}else this.#vd(e,this.#bd());return!1}toolbarInputKeyDown({target:t,event:e}){const s=e.code;if(this.#fd||Gt.isSpace(s))return void e.preventDefault();if(!/^(ArrowUp|ArrowDown|Enter)$/.test(s))return;const{value:i,unit:n}=this.#yd(t);if(!i)return;const o=Zt.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.#vd(t,r+n);if(this.#fd)return;const i=Ut.utils.createElement("SPAN",{style:"font-size: "+e+";"});this.$.inline.apply(i,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null}),Gt.isEnter(s)||t.focus()}finally{this.isInputActive=!1}}toolbarInputChange({target:t,value:e,event:s}){if(!this.#fd)try{this.isInputActive=!0;let{value:s,unit:i}=this.#yd(e);const{max:n,min:o}=this.unitMap[i];s=s>n?n:s<o?o:s;const l=Ut.utils.createElement("SPAN",{style:"font-size: "+this.#vd(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.#yd(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")?Ut.utils.addClass(n[t],"active"):Ut.utils.removeClass(n[t],"active");this.currentSize=i}action(t){const e=t.getAttribute("data-command");if(e===ya.key){const{value:e,unit:s}=this.#yd(t);let i=Zt.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=Ut.utils.createElement("SPAN",{style:"font-size: "+i+s+";"});this.$.inline.apply(l,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}else if(e){const t=Ut.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()}#bd(){return this.$.frameContext.get("wwComputedStyle").fontSize}#yd(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:Ut.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}}#vd(t,e){return(t=t.parentElement.querySelector(".__se__font_size"))?Ut.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 wa=ya;const Ca=class extends ll{static key="pageNavigator";static className="se-btn-input se-btn-tool-pageNavigator";constructor(t){super(t),this.title=this.$.lang.pageNumber,this.inner=Ut.utils.createElement("input",{type:"number",class:"se-not-arrow-text",placeholder:"1",value:"1",min:"1"},null),this.afterItem=Ut.utils.createElement("span",{class:"se-btn se-sub-btn"},""),this.pageNum=1,this.totalPages=1,this.$.eventManager.addEvent(this.inner,"change",this.#wd.bind(this))}display(t,e){this.pageNum=t,this.totalPages=e,this.inner.value=String(t),this.afterItem.textContent=this.inner.max=String(e)}#wd(t){if(!this.$.frameContext.has("documentType_use_page"))return;const e=Ut.query.getEventTarget(t),s=Number(e.value)||1;this.$.frameContext.get("documentType").pageGo(s)}},{_w:_a}=Dt;class xa extends al{static key="anchor";static className="";static component(t){return Ut.check.isAnchor(t)&&t.hasAttribute("id")&&t.hasAttribute("data-se-anchor")?t:null}#Ta=null;#Cd=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 Ut.utils.createElement("DIV",{class:"se-controller se-controller-link"},s)}(this.$);this.displayId=s.querySelector(".se-controller-display"),this.controllerSelect=new Ms(this,this.$,s,{position:"bottom",disabled:!0},xa.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 Ut.utils.createElement("DIV",{class:"se-controller se-controller-simple-input"},s)}(this.$);this.inputEl=i.querySelector("input"),this.controller=new Ms(this,this.$,i,{position:"bottom",disabled:!0,parents:[this.controllerSelect.form],parentsHide:!0},xa.key)}show(){this.controller.open(this.#Cd=this.$.selection.getRange()),_a.setTimeout((()=>{this.inputEl.focus()}),0)}componentSelect(t){this.#Ta=t,this.displayId.textContent=t.getAttribute("id"),this.controllerSelect.open(t)}componentDeselect(){this.#rs()}controllerAction(t){const e=t.getAttribute("data-command");if(!e)return;const s=this.#Ta;switch(e){case"submit":if(this.controller.close(),s)s.id=this.inputEl.value,this.$.component.select(s,xa.key);else{const t=this.inputEl.value.trim();if(!t)return void this.inputEl.focus();const e=Ut.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,xa.key),this.#rs()}break;case"cancel":this.controller.close(!s),this.#Cd&&this.$.selection.setRange(this.#Cd),this.#rs(),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);Ut.utils.removeItem(s),this.controllerSelect.close(!0),t&&this.$.selection.setRange(t.container,t.offset,t.container,t.offset),this.#rs();break}}}#rs(){this.#Ta=null,this.#Cd=null,this.inputEl.value="",this.displayId.textContent=""}}const $a={blockquote:hl,codeBlock:ul,exportPDF:ml,fileUpload:bl,list_bulleted:wl,list_numbered:xl,mention:kl,align:El,font:Ml,fontColor:Ll,backgroundColor:Bl,list:Ol,table:_r,blockStyle:$r,hr:Il,layout:Sr,lineHeight:Tr,template:Hr,paragraphStyle:Nr,textStyle:Ar,link:Ir,image:Wr,video:Xr,audio:ea,embed:oa,math:ca,drawing:ua,imageGallery:pa,videoGallery:ga,audioGallery:ma,fileGallery:fa,fileBrowser:va,fontSize:wa,pageNavigator:Ca,anchor:xa};class ka{async modalAction(){return!0}modalOn(t){}modalInit(){}modalOff(t){}modalResize(){}}class Sa{controllerAction(t){}controllerOn(t,e){}controllerClose(){}}class Ea{browserInit(){}}class Ta{colorPickerAction(t){}colorPickerHueSliderOpen(){}colorPickerHueSliderClose(){}}class Ma{hueSliderAction(){}hueSliderCancelAction(){}}class Ha{componentSelect(t){}componentDeselect(t){}componentEdit(t){}async componentDestroy(t){}componentCopy(t){}}const La={contract:t,manager:e,ui:i};Object.defineProperty(window,"SUNEDITOR",{enumerable:!0,writable:!1,configurable:!1,value:{...Qo,plugins:$a,modules:La,helper:Yt,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",mention:"Mention",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:()=>so,ColorPicker:()=>Wo,Controller:()=>Ms,Figure:()=>qs,HueSlider:()=>Po,Modal:()=>Go});var e={};s.r(e),s.d(e,{ApiManager:()=>to,FileManager:()=>Ko});var i={};s.r(i),s.d(i,{ModalAnchorEditor:()=>Jo,SelectMenu:()=>Ls,_DragHandle:()=>ws});var n={};s.r(n),s.d(n,{EditorComponent:()=>Ha,ModuleBrowser:()=>Ea,ModuleColorPicker:()=>Ta,ModuleController:()=>Sa,ModuleHueSlider:()=>Ma,ModuleModal:()=>ka,PluginBrowser:()=>el,PluginCommand:()=>sl,PluginDropdown:()=>il,PluginDropdownFree:()=>nl,PluginField:()=>ol,PluginInput:()=>ll,PluginModal:()=>rl,PluginPopup:()=>al});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,w=h.includes("android"),C=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:w,isMobile:b,isTouchDevice:y,cmdIcon:C,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;"},B={"&amp;":"&","&nbsp;":" ","&apos;":"'","&quot;":'"',"&lt;":"<","&gt;":">"},A=/[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 z(t){return/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(t)}const F={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=>B[t]||t))},debounce:function(t,e){let s;return function(...i){o.clearTimeout(s),s=o.setTimeout((()=>{o.clearTimeout(s),t(...i)}),e)}},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(A,(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:z,rgb2hex:function(t){if(z(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>":""}},P=F,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(!j(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/^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 K(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 Y(t){return t?.hasAttribute("data-important-disabled")}const X={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:function(t){return/^(TD|TH)$/i.test("string"==typeof t?t:t?.nodeName)},isTableRow:function(t){return/^TR$/i.test("string"==typeof t?t:t?.nodeName)},isBreak:G,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||G(e.firstElementChild))&&q(e.textContent)},isComponentContainer:function(t){if(1!==t?.nodeType)return!1;const e=t.classList;return!!e&&(e.contains("se-component")||e.contains("se-flex-component"))},isWysiwygFrame:K,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:Y},J=X;function Q(t){const e=Object.prototype.toString.call(t);return"[object HTMLCollection]"===e||"[object NodeList]"===e||"[object Array]"===e}function tt(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 et(t,e){let s=-1;for(let i=0,n=t.length;i<n;i++)if(t[i]===e){s=i;break}return s}function st(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++)t=o[e].name.toLowerCase(),s?.includes(t)||!o[e].value?i.removeAttribute(t):"style"!==t&&i.setAttribute(o[e].name,o[e].value)}function it(t,e){if(t&&1===t.nodeType)return e.split("|").some((e=>t.classList.contains(e)))}function nt(t,e){if(!t)return;const s=Q(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 ot(t,e){if(!t)return;const s=Q(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 lt(t=l){return{w:t.documentElement.clientWidth,h:t.documentElement.clientHeight}}const rt={clone:function(t,e=!1){return t.cloneNode(e)},createElement:tt,createTextNode:function(t){return l.createTextNode(t||"")},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:et,nextIndex:function(t,e){const s=et(t,e);return-1===s?-1:s+1},prevIndex:function(t,e){const s=et(t,e);return-1===s?-1:s-1},copyTagAttributes:st,copyFormatAttributes:function(t,e){const s=e.cloneNode(!1);s.className=s.className.replace(/(\s|^)__se__format__[^\s]+/g,""),st(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=tt("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&&Y(n)||(n.disabled=e),s&&(e?n.setAttribute("data-important-disabled",""):n.removeAttribute("data-important-disabled"))}},hasClass:it,addClass:nt,removeClass:ot,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){nt(t,e),o.setTimeout((()=>{ot(t,e)}),s)},getClientSize:lt,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 at(t){let e=0;for(;t=t.previousSibling;)e+=1;return e}function ht(t,e,s){const i=[];let n=!0;return pt(t,(t=>{if(t===e&&(n=!1),n&&!J.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,rt.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,rt.removeItem(e)}i.push(t)}return!1})),i.map(at).reverse()}function ct(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 dt(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 ut(t){if(!t||J.isWysiwygFrame(t))return-1;let e=0;for(t=t.parentNode;t&&!J.isWysiwygFrame(t);)e+=1,t=t.parentNode;return e}function pt(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||J.isWysiwygFrame(t))return null;t=t.parentElement,n++}return t}const gt={getPositionIndex:at,getNodePath:ht,getNodeFromPath:ct,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:dt,getNodeDepth:ut,sortNodeByDepth:function(t,e){const s=e?1:-1,i=-1*s;t.sort((function(t,e){if(!J.isListCell(t)||!J.isListCell(e))return 0;const n=ut(t),o=ut(e);return n>o?s:n<o?i:0}))},compareElements:function(t,e){let s=t,i=e;const n=ut(t),o=ut(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=rt.getArrayIndex(l,s),a=rt.getArrayIndex(l,i);return{ancestor:s.parentElement,a:s,b:i,result:r>a?1:r<a?-1:0}},getParentElement:pt,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&&!J.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)&&!rt.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=dt(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&&!J.isBreak(t);)t=t.firstChild;for(;e&&1===e.nodeType&&e.childNodes.length>0&&!J.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(J.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(J.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 mt={query:gt,check:J,utils:rt};function ft(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 vt={is:function(t){return/^-?\d+(\.\d+)?$/.test(t+"")},get:ft,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)}},bt="ArrowLeft|ArrowUp|ArrowRight|ArrowDown",yt="F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12",wt=bt.split("|"),Ct="Backspace|Delete".split("|"),_t=`Backspace|Tab|Enter|ShiftLeft|ShiftRight|ControlLeft|ControlRight|AltLeft|AltRight|Pause|CapsLock|Escape|PageUp|PageDown|End|Home|${bt}|Insert|Delete|${yt}|NumLock|ScrollLock`.split("|"),xt="Backspace|Enter|Delete".split("|"),$t="Backspace|Enter|Delete".split("|"),kt=`ControlLeft|ControlRight|AltLeft|AltRight|Pause|CapsLock|Escape|Insert|${yt}|NumLock|ScrollLock`.split("|");const St={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)}}}},Et=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/i,Tt=/^[\u200B\uFEFF]+$/;function Mt(t){const e=t.trim();return""===e||Tt.test(e)}const Ht={strong:"**",b:"**",em:"*",i:"*",del:"~~",s:"~~",mark:"=="};function Lt(t){if(!t||0===t.length)return"";const e=[];for(let s=0;s<t.length;s++){const i=Ot(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 Nt(t){return t?"text"===t.type?t.content||"":t.children?t.children.map(Nt).join(""):"":""}function Bt(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(Et.test(e))return o;return`${o}${i.map(Bt).join("")}</${e}>`}function At(t,e){return t?t.split("\n").map((t=>t?e+t:"")).join("\n")+"\n":""}function It(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+=Ot(e,"",!1);continue}const s=e.tag;if("ul"===s||"ol"===s)a+=It(e,h,"ol"===s);else if("table"===s)a+=At(Vt(e),h);else if("figure"===s){const t=(e.children||[]).find((t=>"element"===t.type&&"table"===t.tag));a+=At(t?Vt(t):Ot(e,"",!0),h)}else"blockquote"===s||"pre"===s?a+=At(Ot(e,"",!0),h):r+=Ot(e,"",!1)}n+=`${e}${i}${c}${r.trim()}\n`,a&&(n+=a),o++}return n}function Vt(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=Lt(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 Ot(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=>Ot(t,"",!0))).join("");const l=/^h([1-6])$/.exec(i);if(l){const t=parseInt(l[1],10);return`${"#".repeat(t)} ${Lt(o).trim()}\n\n`}if("p"===i){const t=Lt(o);return t.trim()?`${t.trim()}\n\n`:"\n"}if("br"===i)return"\n";if("hr"===i)return"---\n\n";const r=Ht[i];if(r){return`${r}${Lt(o)}${r}`}if("code"===i){const t=Nt({children:o});return t.includes("`")?"`` "+t+" ``":"`"+t+"`"}if("kbd"===i){return`<kbd>${Nt({children:o})}</kbd>`}if("sub"===i){return`<sub>${Lt(o)}</sub>`}if("sup"===i){return`<sup>${Lt(o)}</sup>`}if("a"===i){const t=n.href||"",e=Lt(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=>Ot(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=Nt(i)):(e=(t.attributes?.class||"").match(/language-(\S+)/)?.[1]||"",s=Nt({children:o})),"```"+e+"\n"+s+"\n```\n\n"}if("details"===i)return Bt(t)+"\n\n";if("summary"===i)return Bt(t);if("ul"===i)return It(t,e,!1)+"\n";if("ol"===i)return It(t,e,!0)+"\n";if("table"===i)return Vt(t)+"\n";if("dl"===i){let t="";for(const e of o)"element"===e.type&&("dt"===e.tag?t+=Lt(e.children).trim()+"\n":"dd"===e.tag&&(t+=": "+Lt(e.children).trim()+"\n"));return t+"\n"}if("dt"===i||"dd"===i)return Lt(o).trim();if("div"===i){if(n.class&&/se-component/.test(n.class))return o.map((t=>Ot(t,e,!0))).join("");const t=Lt(o);return s?t+"\n\n":t}if("span"===i)return n.style||n.class?Bt(t):Lt(o);if("figure"===i)return o.map((t=>Ot(t,e,!0))).join("");if("figcaption"===i){const t=Lt(o).trim();return t?t+"\n\n":""}return"video"===i||"audio"===i||"iframe"===i?Bt(t)+"\n\n":Bt(t)}function Rt(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 zt(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)}>${Rt(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)}>${Rt(t[e]||"")}</td>`;r+="</tr>"}r+="</tbody>"}return r+="</table>",r}function Ft(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(Mt(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(Mt(e)){l++;continue}if((e.match(/^(\s*)/)[1]||"").length<=r)break;if(/^\s*[-*+]\s+/.test(e)||/^\s*\d+\.\s+/.test(e)){const s=Ft(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(Mt(s)||(s.match(/^(\s*)/)[1]||"").length<=r)break;if(!/^\s*\|/.test(s))break;e.push(s.trimStart()),l++}u+=zt(e)}}if(a){o+=`<li class="task-list-item">${h?'<input type="checkbox" checked disabled> ':'<input type="checkbox" disabled> '}${Rt(c)}${u}</li>`}else o+=`<li>${Rt(i)}${u}</li>`}}return o+=`</${i}>`,{html:o,index:l}}const Pt={jsonToMarkdown:function(t){return t?Ot(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(Mt(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}>${Rt(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(zt(t));continue}if(/^(\s*)([-*+])\s+/.test(e)){const t=Ft(i,o,!1);n.push(t.html),o=t.index;continue}if(/^(\s*)\d+\.\s+/.test(e)){const t=Ft(i,o,!0);n.push(t.html),o=t.index;continue}if(/^\s*<[a-zA-Z]/.test(e)){let t=e;if(o++,Et.test(e.match(/<(\w+)/)?.[1]||"")){n.push(t);continue}for(;o<i.length&&!Mt(i[o]);)t+="\n"+i[o],o++;n.push(t);continue}const h=[];for(;o<i.length&&!Mt(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=Rt(h.join("\n"));n.push(`<${s}>${t}</${s}>`)}else n.push(`<${s}>${Rt(i[o])}</${s}>`),o++}var l;return n.join("")}},Dt=$,qt=M,Wt=P,Ut=mt,Zt=vt,Gt={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 wt.includes(t)},isRemoveKey:function(t){return Ct.includes(t)},isNonTextKey:function(t){return _t.includes(t)},isHistoryRelevantKey:function(t){return xt.includes(t)},isDocumentTypeObserverKey:function(t){return $t.includes(t)},isNonResponseKey:function(t){return kt.includes(t)}},jt=St,Kt=Pt,Yt={env:Dt,unicode:qt,converter:Wt,dom:Ut,numbers:Zt,keyCodeMap:Gt,clipboard:jt,markdown:Kt},Xt={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>',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 Jt=s("cfbI"),Qt=s.n(Jt);function te(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 ee(t,e,s,i,n,o,l,r,a,h){const c=new Map([["key",h],["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")],["_stickyDummy",e.querySelector(".se-toolbar-sticky-dummy")],["_toolbarShadow",e.querySelector(".se-toolbar-shadow")],["_minHeight",ft(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&&se(r,c);const d=e.querySelector(".se-placeholder");return d&&c.set("placeholder",d),c}function se(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 ie={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:{"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:""},SPAN_STYLES:"font-family|font-size|color|background-color|width|height",LINE_STYLES:"text-align|margin|margin-left|margin-right|line-height",RETAIN_STYLE_MODE:["repeat","always","none"]},ne={value:"fixed",placeholder:!0,editableFrameAttributes:!0,width:!0,minWidth:!0,maxWidth:!0,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},oe={plugins:"fixed",excludedPlugins:"fixed",buttonList:"fixed",v2Migration:"fixed",strictMode:"fixed",mode:"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",spanStyles:"fixed",lineStyles:"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_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"},le=Dt._d;function re(t,e,s,i,n,o){if(!s||s.length<2)return;const l=e?.querySelector(".se-tooltip-text");for(let h,c,d,u,p,g,m,f,v,b,y,w,C,_,x=0;x<s.length;x+=2+_){if(_=0,h=s[x].split("+"),v=null,b=h.at(-1).trim?.(),b.startsWith("~"))v=t,b=h.pop().trim().substring(1);else if(b.startsWith("$~")){const t=h.pop().trim().substring(2).split(".");v=t[0],b=t[1]}else b.startsWith("$")?(_=1,b=s[x+2]):b="";d=u=p=g=m=f=c=null;for(const t of h)switch(t.trim()){case"c":d=!0;break;case"!":p=!0;break;case"s":u=!0;break;case"_":g=!0;break;case"=":f=!0;break;case"/":m=!0;break;default:c=t}c=c.split("|");for(let s=0,l=c.length;s<l;s++)w=d?c[s]+(u?"1000":""):c[s],i.has(w)||(C=n.indexOf(t),C=-1===C?"":Zt.isOdd(C)?n[C+1]:n[C-1],C&&o.add(w),i.set(w,{c:d,s:u,edge:p,space:g,enter:m,textTrigger:f,plugin:v,command:t,method:b,r:C,type:e?.getAttribute("data-type"),button:e,key:w}));(y=s[x+1])&&(l&&(r=u,a=y,l.appendChild(Ut.utils.createElement("SPAN",{class:"se-shortcut"},Dt.cmdIcon+(r?Dt.shiftIcon:"")+'+<span class="se-shortcut-key">'+a+"</span>"))))}var r,a}function ae(t,e){return[t,e].reduce(((t,e)=>{for(const s in e)t[s]=(e[s]||"").toLowerCase();return t}),{})}function he(t,e,s){const i=t.buttonList||ie.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("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())):ie.SIZE_UNITS),n.set("allowedClassName",new RegExp(`${t.allowedClassName&&"string"==typeof t.allowedClassName?t.allowedClassName+"|":""}${ie.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||ie.RETAIN_STYLE_MODE.includes(r)||(console.error(`Invalid retainStyleMode: ${r}. Valid options are ${ie.RETAIN_STYLE_MODE.join(", ")}. Using default 'repeat'.`),r="repeat"),n.set("retainStyleMode",r);const a={...ie.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:ie.TEXT_STYLE_TAGS)+(t.textStyleTags?"|"+t.textStyleTags:""));const u=ae({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",[{...ie.TAG_STYLES,...t.__tagStyles||{}},t.tagStyles||{}].reduce(((t,e)=>{for(const s in e)t[s]=e[s];return t}),{})),n.set("_textStylesRegExp",new RegExp(`\\s*[^-a-zA-Z](${ie.SPAN_STYLES}${t.spanStyles?"|"+t.spanStyles:""})\\s*:[^;]+(?!;)*`,"gi")),n.set("_lineStylesRegExp",new RegExp(`\\s*[^-a-zA-Z](${ie.LINE_STYLES}${t.lineStyles?"|"+t.lineStyles:""})\\s*:[^;]+(?!;)*`,"gi")),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",ae(Wt.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("-")),Zt.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||ie.SCOPE_SELECTION_TAGS);const p=("string"==typeof t.elementWhitelist?t.elementWhitelist:"").toLowerCase(),g=n.get("externalLibs").mathjax?ie.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",ge(t.formatClosureBrLine,(t.__defaultFormatClosureBrLine="string"==typeof t.__defaultFormatClosureBrLine?t.__defaultFormatClosureBrLine:ie.FORMAT_CLOSURE_BR_LINE).toLowerCase(),n.get("elementBlacklist"))),n.set("formatBrLine",ge((t.formatBrLine||"")+"|"+n.get("formatClosureBrLine").str,(t.__defaultFormatBrLine="string"==typeof t.__defaultFormatBrLine?t.__defaultFormatBrLine:ie.FORMAT_BR_LINE).toLowerCase(),n.get("elementBlacklist"))),n.set("formatLine",ge(ie.REQUIRED_FORMAT_LINE+"|"+(t.formatLine||"")+"|"+n.get("formatBrLine").str,(t.__defaultFormatLine="string"==typeof t.__defaultFormatLine?t.__defaultFormatLine:ie.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",ge(t.formatClosureBlock,(t.__defaultFormatClosureBlock="string"==typeof t.__defaultFormatClosureBlock?t.__defaultFormatClosureBlock:ie.FORMAT_CLOSURE_BLOCK).toLowerCase(),n.get("elementBlacklist"))),n.set("formatBlock",ge((t.formatBlock||"")+"|"+n.get("formatClosureBlock").str,(t.__defaultFormatBlock="string"==typeof t.__defaultFormatBlock?t.__defaultFormatBlock:ie.FORMAT_BLOCK).toLowerCase(),n.get("elementBlacklist"))),n.set("allowedEmptyTags",ie.ALLOWED_EMPTY_NODE_LIST+(t.allowedEmptyTags?", "+t.allowedEmptyTags:"")),n.set("__defaultElementWhitelist",ie.REQUIRED_ELEMENT_WHITELIST+"|"+("string"==typeof t.__defaultElementWhitelist?t.__defaultElementWhitelist:ie.ELEMENT_WHITELIST).toLowerCase()),n.set("__defaultAttributeWhitelist",("string"==typeof t.__defaultAttributeWhitelist?t.__defaultAttributeWhitelist:ie.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?Zt.is(t.toolbar_width)?t.toolbar_width+"px":t.toolbar_width:"auto"),n.set("toolbar_container",t.toolbar_container&&!/inline/i.test(n.get("mode"))?"string"==typeof t.toolbar_container?le.querySelector(t.toolbar_container):t.toolbar_container:null),n.set("toolbar_sticky",/balloon/i.test(n.get("mode"))?-1:void 0===t.toolbar_sticky?0:Zt.is(t.toolbar_sticky)?Zt.get(t.toolbar_sticky,0):-1),n.set("toolbar_hide",!!t.toolbar_hide);let b=null;const y=t.subToolbar;y?.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",y.mode||"balloon"),n.set("toolbar_sub_width",y.width?Zt.is(y.width)?y.width+"px":y.width:"auto"),b=n.get("_rtl")?y.buttonList.reverse():y.buttonList,n.set("buttons_sub",new Set(b.toString().split(",")))));const w=new Map;for(let s=0,i=e.length;s<i;s++)w.set(e[s].key,de(e[s].options||{},t));n.set("tabDisable",!!t.tabDisable),n.set("shortcutsHint",void 0===t.shortcutsHint||!!t.shortcutsHint);const C=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",C),n.set("fullScreenOffset",void 0===t.fullScreenOffset?0:Zt.is(t.fullScreenOffset)?Zt.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 _=n.get("externalLibs").codeMirror;_&&(n.set("codeMirror",_),_.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 x=t.icons&&"object"==typeof t.icons?[Xt,t.icons].reduce(((t,e)=>{for(const s in e)t[s]=e[s];return t}),{}):Xt;n.set("icons",x);const $=new Set(ie.CONTENT_STYLES.split("|")),k=t.spanStyles?.split("|")||[],S=n.get("__listCommonStyle"),E=ie.SPAN_STYLES.split("|");for(let t=0,e=E.length;t<e;t++)$.add(E[t]);for(const t of Object.values(n.get("tagStyles"))){const e=t.split("|");for(let t=0,s=e.length;t<s;t++)$.add(e[t])}for(let t=0,e=k.length;t<e;t++)$.add(k[t]);for(let t=0,e=S.length;t<e;t++)$.add(S[t]);const T=("string"==typeof t.allUsedStyles?t.allUsedStyles.split("|"):t.allUsedStyles)||[];for(let t=0,e=T.length;t<e;t++)$.add(T[t]);return n.set("allUsedStyles",$),n.set("toastMessageTime",{copy:1500,...t.toastMessageTime}),{o:n,i:x,l:t.lang||Qt(),v:t.value="string"==typeof t.value?t.value:null,buttons:n.get("_rtl")?i.reverse():i,subButtons:b,statusbarContainer:"string"==typeof t.statusbar_container?le.querySelector(t.statusbar_container):t.statusbar_container,frameMap:w}}function ce(t,e){let s=null,i=null,n=null;if(t.get("statusbar")&&(e||=Ut.utils.createElement("DIV",{class:"se-status-bar sun-editor-common"}),s=e.querySelector(".se-navigation")||Ut.utils.createElement("DIV",{class:"se-navigation sun-editor-common"}),e.appendChild(s),t.get("charCounter"))){if(i=e.querySelector(".se-char-counter-wrapper")||Ut.utils.createElement("DIV",{class:"se-char-counter-wrapper"}),t.get("charCounter_label")){const e=i.querySelector(".se-char-label")||Ut.utils.createElement("SPAN",{class:"se-char-label"});e.textContent=t.get("charCounter_label"),i.appendChild(e)}if(n=i.querySelector(".se-char-counter")||Ut.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")||Ut.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}}function de(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.editableFrameAttributes?e.editableFrameAttributes:t.editableFrameAttributes,r=void 0===t.width?e.width:t.width,a=void 0===t.minWidth?e.minWidth:t.minWidth,h=void 0===t.maxWidth?e.maxWidth:t.maxWidth,c=void 0===t.height?e.height:t.height,d=void 0===t.minHeight?e.minHeight:t.minHeight,u=void 0===t.maxHeight?e.maxHeight:t.maxHeight,p=void 0===t.editorStyle?e.editorStyle:t.editorStyle,g=void 0===t.iframe?e.iframe:t.iframe,m=void 0===t.iframe_fullPage?e.iframe_fullPage:t.iframe_fullPage,f=void 0===t.iframe_attributes?e.iframe_attributes:t.iframe_attributes,v=void 0===t.iframe_cssFileName?e.iframe_cssFileName:t.iframe_cssFileName,b=i||void 0===t.statusbar?e.statusbar:t.statusbar,y=i||void 0===t.statusbar_showPathLabel?e.statusbar_showPathLabel:t.statusbar_showPathLabel,w=!i&&(void 0===t.statusbar_resizeEnable?e.statusbar_resizeEnable:t.statusbar_resizeEnable),C=i||void 0===t.charCounter?e.charCounter:t.charCounter,_=i||void 0===t.charCounter_max?e.charCounter_max:t.charCounter_max,x=i||void 0===t.charCounter_label?e.charCounter_label:t.charCounter_label,$=i||void 0===t.charCounter_type?e.charCounter_type:t.charCounter_type;s.set("value",n),s.set("placeholder",o),s.set("editableFrameAttributes",{spellcheck:"false",...l}),s.set("width",r?String(Zt.is(r)?r+"px":r):"100%"),s.set("minWidth",a?String(Zt.is(a)?a+"px":a):""),s.set("maxWidth",h?String(Zt.is(h)?h+"px":h):""),s.set("height",c?String(Zt.is(c)?c+"px":c):"auto"),s.set("minHeight",d?String(Zt.is(d)?d+"px":d):""),s.set("maxHeight",u?String(Zt.is(u)?u+"px":u):""),s.set("editorStyle",p),s.set("_defaultStyles",Wt._setDefaultOptionStyle(s,"string"==typeof p?p:"")),s.set("iframe",!(!m&&!g)),s.set("iframe_fullPage",!!m),s.set("iframe_attributes",f||{}),s.set("iframe_cssFileName",g?("string"==typeof v?[v]:v)||["suneditor"]:null);const k=void 0===b||!!b;return s.set("statusbar",k),s.set("statusbar_showPathLabel",!!k&&("boolean"!=typeof y||y)),s.set("statusbar_resizeEnable",!!k&&(void 0===w||!!w)),s.set("charCounter",_>0||"boolean"==typeof C&&C),s.set("charCounter_max",Zt.is(_)&&_>-1?1*_:null),s.set("charCounter_label","string"==typeof x?x.trim():null),s.set("charCounter_type","string"==typeof $?$:"char"),s}function ue(t,e,s,i){const n=i.get("_defaultStyles");s.style.cssText=n.top;const o=Ut.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=o,e=i.get("iframe_attributes");let s=e.sandbox;if(s){const t=["allow-same-origin"],e=s.split(/\s+/),i=t.filter((t=>!e.includes(t)));i.length>0&&(s=e.concat(i).join(" "))}else s="allow-same-origin";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=n.frame}else o.setAttribute("contenteditable","true"),o.className+=" "+e.get("_editableClass"),o.style.cssText=n.frame+n.editor;const l=Ut.utils.createElement("TEXTAREA",{class:"se-wrapper-inner se-code-viewer",style:n.frame}),r=Ut.utils.createElement("TEXTAREA",{class:"se-wrapper-inner se-markdown-viewer",style:n.frame}),a=Ut.utils.createElement("SPAN",{class:"se-placeholder"});return i.get("placeholder")&&(a.textContent=i.get("placeholder")),{bottomBar:ce(i,null),wysiwygFrame:o,codeView:l,markdownView:r,placeholder:a}}function pe(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?(Ut.utils.removeItem(s),i.className+=" se-code-viewer-mirror",i):s}function ge(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 me(){const t=Ut.utils.createElement("UL",{class:"se-menu-list"});return{div:Ut.utils.createElement("DIV",{class:"se-btn-module se-btn-module-border"},t),ul:t}}function fe(t,e,s,i,n,o,l){n||="";const r=Ut.utils.createElement("LI"),a=e||"",h=/^INPUT|FIELD$/i.test(i),c="se-toolbar-separator-vertical"===t?Ut.utils.createElement("DIV",{class:t,tabindex:"-1"},null):Ut.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)&&Ut.utils.addClass(r,"se-toolbar-hidden-btn"),a&&(n+=Ut.utils.createTooltipInner(a)),n&&(c.innerHTML=n),r.appendChild(c),{li:r,button:c}}function ve(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&&(Ut.utils.addClass(e.afterItem,"se-toolbar-btn"),t.parentElement.appendChild(e.afterItem),Ut.utils.addClass(t,"se-side-btn-a"),Ut.utils.addClass(e.afterItem,"se-side-btn-after")),e.beforeItem&&(Ut.utils.addClass(e.beforeItem,"se-toolbar-btn"),t.parentElement.insertBefore(e.beforeItem,t),e.afterItem?(Ut.utils.addClass(t,"se-side-btn"),Ut.utils.removeClass(t,"se-side-btn-a")):Ut.utils.addClass(t,"se-side-btn-b"),Ut.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&&(Ut.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 be(t,e,s,i,n,o){t=JSON.parse(JSON.stringify(t));const l=function(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","",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",""]}}(s.get("_rtl"),i,n),r={},a=[],h=[];let c=null,d=null,u=null,p=null,g=null;const m=Ut.utils.createElement("DIV",{class:"se-toolbar-more-layer"}),f=Ut.utils.createElement("DIV",{class:"se-btn-tray"}),v=Ut.utils.createElement("DIV",{class:"se-toolbar-separator-vertical"});t:for(let s,b,y,w,C,_=0;_<t.length;_++)if(s=!1,C="",w=t[_],p=me(),"object"==typeof w){for(let f,v=0;v<w.length;v++){if(d=w[v],f=!1,u=e[d],/^%\d+/.test(d)&&0===v){w[0]=d.replace(/[^\d]/g,""),a.push(w),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)){C=d.substring(1),p.div.className+=" module-float-"+C;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||Dt.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=fe(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=Ut.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"'+(C?' style="float: '+C+';"':"")+"></ul></div>",m.appendChild(b),b=b.firstElementChild.firstElementChild)}f.appendChild(p.div)}else{if("|"===w){const t=v.cloneNode(!1);f.appendChild(t);continue}if(/^\/$/.test(w)){const t=Ut.utils.createElement("DIV",{class:"se-btn-module-enter"});f.appendChild(t)}}switch(f.children.length){case 0:f.style.display="none";break;case 1:Ut.utils.removeClass(f.firstElementChild,"se-btn-module-border")}m.children.length>0&&f.appendChild(m),a.length>0&&a.unshift(t);const b=Ut.utils.createElement("DIV",{class:"se-toolbar sun-editor-common"+(s.get("shortcutsHint")?"":" se-shortcut-hide")},f);return s.get("toolbar_hide")&&(b.style.display="none"),{element:b,pluginCallButtons:r,responsiveButtons:a,buttonTray:f,updateButtons:h}}const ye=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=he(e,t,s),n=i.o,o=i.i,l=i.l,r=Ut.utils.createElement("DIV",{class:"se-loading-box sun-editor-common"},'<div class="se-loading-effect"></div>'),a=Ut.utils.createElement("DIV",{class:"sun-editor sun-editor-carrier-wrapper sun-editor-common"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),h=Ut.utils.createElement("DIV",{class:"se-menu-tray"});a.appendChild(h);const c=Ut.utils.createElement("INPUT",{class:"__se__focus__temp__",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;"});c.tabIndex=0,a.appendChild(c);const d=Ut.utils.createElement("DIV",{class:"se-modal se-modal-area sun-editor-common"}),u=Ut.utils.createElement("DIV",{class:"se-modal-back"}),p=Ut.utils.createElement("DIV",{class:"se-modal-inner"});d.appendChild(u),d.appendChild(p),a.appendChild(d);const g=Ut.utils.createElement("DIV",{class:"se-alert se-modal-area sun-editor-common",style:"display: none;"}),m=Ut.utils.createElement("DIV",{class:"se-modal-back"}),f=Ut.utils.createElement("DIV",{class:"se-modal-inner"});g.appendChild(m),g.appendChild(f),a.appendChild(g),a.appendChild(Ut.utils.createElement("DIV",{class:"se-back-wrapper"})),a.appendChild(r.cloneNode(!0));const v=Ut.utils.createElement("DIV",{class:"se-drag-cursor"});a.appendChild(v),le.body.appendChild(a);let b=null,y=null;const w=be(i.buttons,s,n,o,l,!1),C=w.element;C.style.visibility="hidden",/inline/i.test(n.get("mode"))?(C.className+=" se-toolbar-inline",C.style.width=n.get("toolbar_width")):/balloon/i.test(n.get("mode"))&&(C.className+=" se-toolbar-balloon",C.style.width=n.get("toolbar_width"),C.appendChild(Ut.utils.createElement("DIV",{class:"se-arrow"}))),n.get("_toolbar_bottom")&&(C.className+=" se-toolbar-bottom"),i.subButtons&&(y=be(i.subButtons,s,n,o,l,!1),b=y.element,b.style.visibility="hidden",b.className+=" se-toolbar-balloon se-toolbar-sub",b.style.width=n.get("toolbar_sub_width"),b.appendChild(Ut.utils.createElement("DIV",{class:"se-arrow"})));const _=t[0].key||null,x=[],$=new Map,k=i.statusbarContainer;let S=null;for(let e=0,s=t.length;e<s;e++){const s=t[e],a=i.frameMap.get(s.key),h=Ut.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),c=Ut.utils.createElement("DIV",{class:"se-container"}),d=Ut.utils.createElement("DIV",{class:"se-wrapper"+("document"===n.get("type")?" se-type-document":"")+(n.get("_type_options").includes("header")?" se-type-document-header":"")});c.appendChild(Ut.utils.createElement("DIV",{class:"se-toolbar-shadow"}));const u=ue(s.key,n,h,a),p=u.bottomBar.statusbar,g=u.wysiwygFrame,m=u.placeholder;let f=u.codeView;const v=Ut.utils.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-t",title:l.insertLine},o.line_break),b=Ut.utils.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-b",title:l.insertLine},o.line_break);d.appendChild(v),d.appendChild(b),m&&d.appendChild(m),c.appendChild(Ut.utils.createElement("DIV",{class:"se-toolbar-sticky-dummy"})),c.appendChild(d),p&&(k?S||(k.appendChild(Ut.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")},p)),S=p):c.appendChild(p)),c.appendChild(r.cloneNode(!0));const y=s.key||null;let w=null;if(n.get("buttons").has("codeView")){w=Ut.utils.createElement("DIV",{class:"se-code-wrapper"},f),w.style.setProperty("display","none","important"),d.appendChild(w);const t=pe(n,a,f);if(f===t){const t=Ut.utils.createElement("TEXTAREA",{class:"se-code-view-line",readonly:"true"},null);w.insertBefore(t,f)}else f=t}let C=null,_=null;if(n.get("buttons").has("markdownView")){_=u.markdownView;const t=Ut.utils.createElement("TEXTAREA",{class:"se-markdown-view-line",readonly:"true"},null);C=Ut.utils.createElement("DIV",{class:"se-markdown-wrapper"}),C.appendChild(t),C.appendChild(_),C.style.setProperty("display","none","important"),d.appendChild(C)}const E={inner:null,page:null,pageMirror:null};n.get("_type_options").includes("header")&&(E.inner=Ut.utils.createElement("DIV",{class:"se-document-lines",style:`height: ${a.get("height")};`},'<div class="se-document-lines-inner"></div>')),n.get("_type_options").includes("page")&&(E.page=Ut.utils.createElement("DIV",{class:"se-document-page"},null),E.pageMirror=Ut.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)),h.appendChild(c),x.push(y),$.set(y,ee({target:s.target,key:s.key,options:a},h,g,w,f,C,_,S||p,E,y))}const E=n.get("toolbar_container");if(E){const t=Ut.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),e=Ut.utils.createElement("DIV",{class:"se-container"});e.appendChild(C),b&&e.appendChild(b),t.appendChild(e),E.appendChild(t),E.appendChild(Ut.utils.createElement("DIV",{class:"se-toolbar-sticky-dummy"}))}else{const t=$.get(_).get("container");if(n.get("_toolbar_bottom")){const e=t.querySelector(".se-statusbar");t.insertBefore(C,e),b&&t.insertBefore(b,C)}else t.insertBefore(C,t.firstElementChild),b&&t.insertBefore(b,t.firstElementChild)}return{context:te(C,E,h,b,k),carrierWrapper:a,options:n,plugins:s,icons:o,lang:l,value:i.v,rootId:_,rootKeys:x,frameRoots:$,pluginCallButtons:w.pluginCallButtons,responsiveButtons:w.responsiveButtons,pluginCallButtons_sub:y?y.pluginCallButtons:[],responsiveButtons_sub:y?y.responsiveButtons:[]}},{_w:we}=Dt,Ce=Math.floor(96/72*841.89105);const _e=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;#w=0;#C=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=we.getComputedStyle(this.#p);this.#g=Zt.get(t.paddingTop),this.#m=Zt.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${Zt.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${Zt.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&&we.clearTimeout(this.#M),this.#M=we.setTimeout((async()=>{await Ut.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,o=0,l=0;if(i.length>0){n=i[0].offsetHeight;for(let t=0;t<i.length;t++){const e=i[t].offsetTop;(e-o)%Ce!=0&&l++,o=e}const t=s-o;t>0&&t%Ce!=0&&l++}const r=this.#s(this.#l)?this._getWWScrollTop():0,a=Math.ceil(s/Ce)+l,h=this.#a.offsetWidth+1,c=[];for(let t=0;t<i.length;t++)c.push({number:t,top:i[t].offsetTop+n/2});this.#E=0;const d=this.#r.children,u=this.#p.children;this._initializeCache(u),c.push({number:0,top:0});for(let t=1,e=0;t<a;t++)if(e+=Ce+(1===t?this.#g+this.#m:this.#g),!c.some((t=>Math.abs(t.top-e)<3))){const s=this._calcPageBreakTop(e,d,u);if(null===s)break;c.push({number:t,top:s})}if(0===c.length)return this.#k=null,this.#w=1,void this._displayCurrentPage();c.sort(((t,e)=>t.top-e.top)),this.#d.innerHTML="",this.#$=[];for(let t,e=0;e<a;e++){if(!c[e])continue;if(t=c[e].top,s<t)break;const i=Ut.utils.createElement("DIV",{style:`top:${t-r}px`,innerHTML:String(e+1)},`<div class="se-document-page-line" style="width: ${h}px;"></div>${e+1}`);this.#d.appendChild(i),this.#$.push(i)}this.#k=this.#d.querySelectorAll(".se-document-page-line"),this.#w=this.#$.length,this._displayCurrentPage()}),400))}_getDisplayPage(){return this.#s(this.#l)?this.#l.get("wysiwyg"):we}_calcPageBreakTop(t,e,s){const{ci:i}=this._getElementAtPosition(t,s),n=s[i],o=e[i];if(!n||!o)return null;const l=t+(o.offsetTop-n.offsetTop)+(o.offsetHeight-n.offsetHeight)/2;return Math.round(l)}_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){let s=this.#E,i=e.length-1;for(;s<=i;){const e=Math.floor((s+i)/2),{top:n,height:o,bottom:l}=this.#T.get(e);if(t>=n&&t<=l)return this.#E=e,{ci:e,cm:t-l,ch:o};t<n?i=e-1:s=e+1}const n=e[s]?s:i;this.#E=n;const o=this.#T.get(n);return{ci:n,cm:t-o.bottom,ch:o.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?Ut.utils.removeClass(this.#h,"se-document-responsible"):Ut.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.#$;for(let i=0,n=s.length;i<n;i++)s[i].style.top=Zt.get(s[i].style.top)-(e-t)+"px";this.#S=e,this._displayCurrentPage()}scrollWindow(){this.#s(this.#l)||this._displayCurrentPage()}getCurrentPageNumber(){if(this.#w<=1)return 1;let t=0;if(this.#s(this.#l))t=this.#v/2;else{const e=this._getGlobalTop();if(t=we.scrollY-e+Ce/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.#C=s;return this.#C=this.#w}pageUp(){const t=this.#C-1<=1?1:this.#C-1;this._movePage(t,!1)}pageDown(){const t=this.#C+1>this.#$.length?this.#$.length:this.#C+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&&(Ut.utils.removeClass(this.#b,"active"),Ut.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.#w)}_getWWScrollTop(){const t=this._getDisplayPage();return t.scrollTop||t.scrollY||0}_movePage(t,e){const s=this._getGlobalTop(),i=this.#s(this.#l),n=Wt.nodeListToArray(this.#r.children),o=this.#d.offsetTop+Zt.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.#C=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():we.requestAnimationFrame(i)};we.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=Ut.query.getEventTarget(e);if(Ut.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&&(we.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 xe=class{#L;#N=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.#L={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>=Zt.get(i)},_range:null,_mousedown:!1,_preventBlur:!1,_preventFocus:!1}}get(t){return this.#L[t]}set(t,e){const s=this.#L[t];this.#L[t]=e,this.#B(t,e,s)}subscribe(t,e){return this.#N.has(t)||this.#N.set(t,new Set),this.#N.get(t).add(e),()=>this.#N.get(t).delete(e)}#B(t,e,s){const i=this.#N.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.#N.clear(),this.#L=null}},{_w:$e,_d:ke}=Dt;class Se{#A;#I;#V;constructor(t){this.#A=t.frameRoots,this.#I=this.#O(t.context),this.#V=this.#R({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.#A}get context(){return this.#I}get frameContext(){return this.#V}init(){this.applyToRoots((t=>{this.#z(t)}))}reset(t){this.#V.reset(t)}applyToRoots(t){this.#A.forEach(t)}#z(t){const e=t.get("options");if(t.set("wwComputedStyle",$e.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",$e),t.set("_wd",ke));const s=e.get("editableFrameAttributes");for(const e in s)t.get("wysiwyg").setAttribute(e,s[e])}#O(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()}}}#R(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(),Ut.utils.removeItem(t.get("topArea")),t.get("options").clear(),t.clear()})),this.#I.clear(),this.#V.clear(),this.#A.clear(),Ut.utils.removeItem(this.carrierWrapper),this.rootKeys=null,this.carrierWrapper=null,this.icons=null,this.lang=null,this.shadowRoot=null}}class Ee{#F;#P;#D;#q;constructor(t,e,s){this.#F=t,this.#P=s,this.#D=this.#W({value:e.options}),this.#q=this.#U({value:new Map})}get options(){return this.#D}get frameOptions(){return this.#q}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!==ne[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.#Z(v,h,""),0===v.length)return;1===s.size&&v.unshift(null);const b=[this.#P,t].reduce(((t,e)=>{for(const i in e)s.has(i||null)?this.#G(i,e,s,p,m,g):t[i]=e[i];return t}),{}),y=this.#D,w=he(b,g,h),C=w.o,_=w.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(Ut.utils.removeItem(i.get("statusbar")),l.get("statusbar")){const t=ce(l,null).statusbar;i.get("container").appendChild(t),se(t,i),u.__addStatusbarEvent(i,l)}else n.removeEvent(o.get("__statusbarEvent")),l.set("__statusbarEvent",null),se(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(Wt._setIframeStyleLinks(l.get("iframe_cssFileName")),"text/html").head.children,n=t.querySelector("style");for(;s[0];)t.insertBefore(s[0],n)}e.has("placeholder")&&(i.get("placeholder").textContent=l.get("placeholder")),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(C.get("theme"));break;case"events":{const t=C.get("events");for(const e in t)n.events[e]=t[e];break}case"autoStyleify":l.__resetAutoStyleify(C.get("autoStyleify"));break;case"textDirection":d.setDir("rtl"===C.get("textDirection")?"rtl":"ltr");break;case"historyStackDelayTime":c.resetDelayTime(C.get("historyStackDelayTime"));break;case"defaultLineBreakFormat":o.__resetBrLineBreak(C.get("defaultLineBreakFormat"))}y.setMany(C),this.#P=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")?Ut.utils.removeClass(x,"se-shortcut-hide"):Ut.utils.addClass(x,"se-shortcut-hide")}resetFrame(t){this.#q.reset(t)}#G(t,e,s,i,n,o){const l=e[t],r=Object.keys(l);if(this.#Z(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(ne,t))continue;const e=l[t];r.includes(t)&&h[t]!==e&&(i.get(a).set(this.#j(t),!0),c[t]=e)}const u={...h,...c};n.set(a,new Map(Object.entries(u))),o.push({key:a,options:u})}#j(t){return/^statusbar|^charCounter/.test(t)?"statusbar-changed":t}#Z(t,e,s){for(let i,n=0,o=t.length;n<o;n++)i=t[n],("fixed"===oe[i]||"fixed"===ne[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--)}#W(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)}}}#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)}}}_destroy(){this.#P=null,this.#D.clear(),this.#q.clear()}}const Te=class{#K;constructor(t){this.#K=t}isNode(t){return t&&"number"==typeof t.nodeType||t instanceof this.#Y().Node}isElement(t){return t&&1===t.nodeType||t instanceof this.#Y().Element}isRange(t){return t&&"Range"===t.constructor?.name||t instanceof this.#Y().Range}isSelection(t){return t&&"Selection"===t.constructor?.name||t instanceof this.#Y().Selection}#Y(){return this.#K.get("_ww")}},{_w:Me,_d:He,NO_EVENT:Le}=Dt;const Ne=class{#X;#K;#J;#Q=null;#tt=[];constructor(t,e,s){this.#X=s,this.#K=t.frameContext,this.#J=e.frameOptions,this.events=e.options.get("events")||{},this.triggerEvent=async(t,e)=>{if(Ut.check.isNonEditable(e?.frameContext?.get("wysiwyg")))return!1;const s=this.events[t];if("function"==typeof s)try{return await s({$:this.#X,...e})}catch(e){return console.error(`[SUNEDITOR.triggerEvent.${t}]`,e),!1}return Le}}addEvent(t,e,s,i){if(!t)return null;if((t===Me||t===He||"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.#tt.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===Me||e===He||"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.#J.get("iframe")&&this.#K.get("_ww").addEventListener(t,e,s),Me.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.#J.get("iframe")&&this.#K.get("_ww").removeEventListener(t,e,s),Me.removeEventListener(t,e,s),null}_injectActiveEvent(t){Ut.utils.addClass(t,"__se__active"),this.#Q=this.addGlobalEvent("mouseup",(()=>{Ut.utils.removeClass(t,"__se__active"),this.#Q=this.removeGlobalEvent(this.#Q)}))}_init(){for(let t,e=0,s=this.#tt.length;e<s;e++)t=this.#tt[e],t.target.removeEventListener(t.type,t.listener,t.useCapture);this.#tt=null,this.#Q&&=this.removeGlobalEvent(this.#Q)}};const Be=class{#X;#t;#et;#st;#e;#K;#it;#J;constructor(t){this.#X=t.$,this.#t=t.store,this.#et=this.#X.contextProvider.shadowRoot,this.#st=this.#X.contextProvider.carrierWrapper,this.#e=this.#X.context,this.#K=this.#X.frameContext,this.#it=this.#X.options,this.#J=this.#X.frameOptions}get(t){const e=this.#K.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=pt(e,K.bind(this)),c=r;for(;r&&!it(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.#K.get("wysiwygFrame");this.#K.get("wysiwyg").contains(e)&&(n=d.offsetLeft,o=d.offsetTop,l=d.parentElement.offsetWidth-(d.offsetLeft+d.offsetWidth));const u=this.#K.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.#K.get("wysiwyg").scrollHeight||0}}getGlobal(t){const e=this.#K.get("topArea"),s=this.#K.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.#K.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.#K.get("wysiwygFrame").nodeName))for(v=this.#K.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.#et?.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 w=p?p.getBoundingClientRect().top+(!p.parentElement||/^html$/i.test(p.parentElement.nodeName)?o.scrollY:0):0,C=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 _=lt(this.#K.get("_wd"));return{top:n,left:l,ts:w,ls:C,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.#K.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=lt(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=lt(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=s.offsetWidth,d=a.left,u=this.getGlobal(i).left;if(this.#it.get("_rtl")){const e=h>c?h-c:0,s=e>0?0:c-h;t.style.left=`${d-e+s}px`,u>this.getGlobal(t).left&&(t.style.left=u+"px")}else{const e=i.offsetWidth+u,s=e<=h?0:e-(d+h);t.style.left=s<0?`${d+s}px`:`${d}px`}}setAbsPosition(t,e,s){const i={left:0,right:0,top:0,...s.addOffset},n=s.position||"bottom",r=s.inst,a=!this.#it.get("_rtl");a||(i.left*=-1);const h=this.#J.get("iframe"),c=this.#K.get("wrapper").contains(e)||s.isWWTarget||!!h&&this.#K.get("wysiwyg").contains(e),d=Boolean(pt(e,".se-toolbar")),u=1===e.nodeType,p=c&&!u,g=u&&/inline/.test(o.getComputedStyle(e).display),m=lt(l),f=p?this.getWWScroll():this.#nt(),v=!c||!h&&u?e.getBoundingClientRect():this.#X.selection.getRects(e,"start").rects,b=this.getGlobal(e),y=it(t.firstElementChild,"se-arrow")?t.firstElementChild:null,w=s.sibling?.offsetHeight||0,C=y?y.offsetHeight:0,_=t.offsetHeight,x=e.offsetHeight,$=v.top,k=m.h-v.bottom,S=this.getGlobal(this.#K.get("topArea")).top,E=o.scrollY,T=this.#e.get("toolbar_main").offsetHeight,M=this.#it.get("toolbar_container"),H=this.#t.mode.isBalloon||this.#t.mode.isInline||M,L=M&&S-E-T>0||!this.#X.toolbar.isSticky&&H?0:T+(this.#X.toolbar.isSticky?this.#it.get("toolbar_sticky"):0),N=this.#K.get("statusbar")?.offsetHeight||0,{rmt:B,rmb:A,bMargin:I,rt:V}=this.#ot($,k,L,m,v,p,d);if(c&&(A-N+x<=0||B+V+x-(this.#X.toolbar.isSticky&&g?L:0)<=0)||B+x<0)return;const O=this.#K.get("topArea").getBoundingClientRect(),R=this.#t.mode.isBottom?O.bottom>=o.innerHeight-T:O.top<=T,z=this.#X.toolbar.isSticky&&"none"!==this.#e.get("toolbar_main").style.display&&(!H||R);let F=i.top,P=0,D="";"bottom"===n?(D="up",F+=v.bottom+C+E,P=A-(_+C),P-w<0&&(D="down",F-=x+_+2*C,P=B-(_+C),P-w<0&&(D="",F-=P-w-Math.max(1,P+_+C)))):(D="down",F+=v.top-_-C+E,P=(z&&!this.#t.mode.isBottom?v.top-L:B)-_-C,P-w<0&&(D="up",F+=x+_+2*C,P=(A>0?I:A)-(_+C)-N,P-w<0&&(D="",F+=P-2))),this.#lt(y,D),t.style.top=`${F}px`;const q=(1===t.nodeType?Zt.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.#X.selection.getRange();const o=this.#X.selection.getRects(e,n?"start":"end");n="start"===o.position;const r=this.#K.get("isFullScreen"),a=this.#K.get("topArea"),h=this.#st.contains(t),c=o.rects,d=r?0:o.scrollLeft,u=r?0:o.scrollTop,p=h?lt(l).w:a.offsetWidth,g=this.getGlobal(a),m=h?0:g.left,f=t.offsetWidth,v=t.offsetHeight;this.#rt(n,c,t,m,p,d,u,i),this.getGlobal(t).top-g.top<0&&(n=!n,this.#rt(n,c,t,m,p,d,u,i)),f===t.offsetWidth&&v===t.offsetHeight||this.#rt(n,c,t,m,p,d,u,i);const b=!this.#st.contains(t),y=lt(l),w=c.height,C=c.top,_=y.h-c.bottom,x=this.#X.toolbar.isSticky||!this.#t.mode.isBalloon&&!this.#t.mode.isInline?this.#e.get("toolbar_main").offsetHeight:0,{rmt:$,rmb:k,rt:S}=this.#ot(C,_,x,y,c,b,!1);if(!(k+w<=0||$+S+w<=0))return t.style.visibility="",!0}#rt(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.#K.get("topArea")).top:s.offsetHeight-this.#K.get("wysiwyg").offsetHeight);!t&&b>0&&this.#at()<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?(ot(h,"se-arrow-up"),nt(h,"se-arrow-down")):(ot(h,"se-arrow-down"),nt(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"}#at(){const t=this.#K.get("topArea");return l.documentElement.scrollHeight-(this.getGlobal(t).top+t.offsetHeight)}#ot(t,e,s,i,n,l,r){const a=this.#X.selection.getRects(this.#K.get("wysiwyg"),"start").rects;let h=0,c=0,d=0,u=0,p=0;const g=this.#J.get("iframe");u=n.top,p=i.h-n.bottom;const m=this.getGlobal(),f=this.#t.mode.isBottom;if(l){d=r||this.#X.toolbar.isSticky||this.#it.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.#X.toolbar.isSticky?s:e+s:this.#it.get("toolbar_container")&&!this.#X.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.#X.toolbar.isSticky?s:t+s:this.#it.get("toolbar_container")&&!this.#X.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.#X.toolbar.isSticky&&this.#X.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}}#lt(t,e){"up"===e?(t&&(t.style.visibility=""),nt(t,"se-arrow-up"),ot(t,"se-arrow-down")):"down"===e?(t&&(t.style.visibility=""),nt(t,"se-arrow-down"),ot(t,"se-arrow-up")):t&&(t.style.visibility="hidden")}#nt(){const t=lt(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:Ae}=Dt;const Ie=class{#F;#X;#t;#et;#ht;#e;#K;#it;#J;#ct=0;#dt=!1;constructor(t){this.#F=t,this.#X=t.$,this.#t=t.store,this.#et=this.#X.contextProvider.shadowRoot,this.#ht=this.#X.instanceCheck,this.#e=this.#X.context,this.#K=this.#X.frameContext,this.#it=this.#X.options,this.#J=this.#X.frameOptions,this.range=null,this.selectionNode=null,this.__iframeFocus=!1}get(){let t=null;return t="function"==typeof this.#et?.getSelection?this.#et.getSelection():this.#K.get("_ww").getSelection(),t?(this.#t.get("_range")||this.#K.get("wysiwyg").contains(t.focusNode)||(t.removeAllRanges(),t.addRange(this.#ut())),t):null}isRange(t){return this.#ht.isRange(t)}getRange(){const t=this.#t.get("_range")||this.#ut(),e=this.get();if(t.collapsed===e.isCollapsed||!this.#K.get("wysiwyg").contains(e.focusNode)){if(this.#X.component.is(t.startContainer)){const e=this.#X.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=Ut.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;(Ut.check.isBreak(n)||3===n.nodeType)&&o>n.textContent.length&&(o=n.textContent.length),(Ut.check.isBreak(l)||3===l.nodeType)&&r>l.textContent.length&&(r=l.textContent.length),this.#X.format.isLine(n)&&(n=n.childNodes[o>0?n.childNodes.length-1:0]||n,o=o>0?1!==n.nodeType||Ut.check.isBreak(n)?n.textContent?n.textContent.length:0:1:0),this.#X.format.isLine(l)&&(l=l.childNodes[r>0?l.childNodes.length-1:0]||l,r=r>0?1!==l.nodeType||Ut.check.isBreak(l)?l.textContent?l.textContent.length:0:1:0);const a=this.#K.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.#X.focusManager.nativeFocus()}const h=this.get();return h.removeAllRanges&&h.removeAllRanges(),h.addRange(a),this.#t.set("_range",a),this.#pt(a,this.get()),this.#J.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.#gt(t)){const s=e?.parentElement||this.#K.get("wysiwyg"),i=Ut.utils.createElement(this.#it.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.#K.get("wysiwyg").contains(this.selectionNode)||this.init(),!this.selectionNode){const t=Ut.query.getEdgeChild(this.#K.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=!!Ut.check.isElement(t)&&"absolute"===Ae.getComputedStyle(t).position;t=!t||Ut.check.isText(t)?this.getRange():t;let i="start"===e,n=Ae.scrollX,o=Ae.scrollY,l=t.getClientRects();if(l=l[i?0:l.length-1],!l){const t=this.getNode();if(this.#X.format.isLine(t)){const t=Ut.utils.createTextNode(qt.zeroWidthSpace);this.#X.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.#X.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.#K.get("wysiwygFrame").nodeName)?this.#K.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.#K.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.#ht.isSelection(t))t=t.getRangeAt(0);else if(this.#ht.isNode(t))if(s){const e=this.#K.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=Ut.query.getParentElement(t?.startContainer,(t=>1===t.nodeType));if(!i)return;delete(e={behavior:"smooth",block:"nearest",inline:"nearest",...e}).noFocus;const n=this.#K.get("_ww"),o=this.#K.get("wysiwygFrame"),l=this.#J.get("iframe"),r=!this.#t.get("isScrollable")(this.#K),a=this.#t.get("currentViewportHeight"),h=r?Ae.scrollY:l?n.scrollY:o.scrollTop,c=this.#t.mode.isBottom,d=this.#e.get("toolbar_main").offsetHeight,u=this.#X.toolbar.isSticky?d:0,p=this.#X.toolbar.isSticky?u+this.#it.get("toolbar_sticky"):u,g=this.#K.get("statusbar")?.offsetHeight||0;if(this.#dt)return i?.scrollIntoView(e),void("auto"===e?.behavior&&h!==Ae.scrollY&&(p?c?h<Ae.scrollY&&Ae.scrollBy(0,p):h>Ae.scrollY&&Ae.scrollBy(0,-p):r&&Ae.scrollBy(0,g)));const m=this.#ct,f=r?a-(c?p:0):o.offsetHeight,v=t?.getBoundingClientRect?.(),b=(v?.height>0?v.height:i.offsetHeight)||0,y=e?.behavior,w=c?0:p;if(r)if(l){const e=this.getRects(t,"end").rects,s=e.top+b-w,i=f-m-(e.top+b);if(s>=0&&i>=0)return;const n=h-(s<0?-(s-m):i);Ae.scrollTo({top:n<h?n-w:n,behavior:y})}else{const t=f+h-this.#X.offset.getGlobal(i).top-b;if(t-m>0&&f>t+m+w)return;const e=t<=m?h-t+m+g:h-t+(f-b-m);Ae.scrollTo({top:e<h?e-w:e,behavior:y})}else{const t=v?.height>0?v.top:i.getBoundingClientRect().top,e=l?t:t-o.getBoundingClientRect().top,s=e-m>0&&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=Ae.scrollY,w=this.#X.offset.getGlobal(),C=c?0:d,_=c?d:0,x=p-w.top+C,$=w.top+w.height-(p+a)+_;if(x>0){const t=(s?e:e+h-r)-b-m-x;t<0&&(r+=C,Ae.scrollTo({top:p+t,behavior:"smooth"}))}if($>0){const t=(s?e:e+h-r)+b+m-(w.height-$);t>0&&(r+=c?_:g,Ae.scrollTo({top:p+t,behavior:"smooth"}))}s||(l?n:o).scrollTo({top:r,behavior:y})}}resetRangeToTextNode(){let t=this.getRange();if(this.#gt(t)){if(!Ut.check.isWysiwygFrame(t.startContainer)||!Ut.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.#X.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.#X.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=Ut.check.isWysiwygFrame(l)?this.#K.get("wysiwyg").firstChild:l,n=r,Ut.check.isBreak(i)||1===i.nodeType&&i.childNodes.length>0){const t=Ut.check.isBreak(i);if(!t){const t=i;for(;i&&!Ut.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.#X.format.getLine(i,null);e===this.#X.format.getBlock(e,null)&&(i||=t,e=Ut.utils.createElement(Ut.query.getParentElement(i,Ut.check.isTableCell)?"DIV":this.#it.get("defaultLine")),i.parentNode.insertBefore(e,i),i!==t&&e.appendChild(i))}if(Ut.check.isBreak(i)||this.#X.component.is(i)){const e=Ut.utils.createTextNode(qt.zeroWidthSpace);i.parentNode.insertBefore(e,i),i=e,t&&l===a&&(a=i,h=1)}}if(l=i,r=n,i=Ut.check.isWysiwygFrame(a)?this.#K.get("wysiwyg").lastChild:a,n=h,Ut.check.isBreak(i)||1===i.nodeType&&i.childNodes.length>0){const t=Ut.check.isBreak(i);if(!t){for(;i&&!Ut.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.#X.format.getLine(i,null);t===this.#X.format.getBlock(t,null)&&(t=Ut.utils.createElement(Ut.check.isTableCell(t)?"DIV":this.#it.get("defaultLine")),i.parentNode.insertBefore(t,i),t.appendChild(i))}if(Ut.check.isBreak(i)){const e=Ut.utils.createTextNode(qt.zeroWidthSpace);i.parentNode.insertBefore(e,i),i=e,n=1,t&&!i.previousSibling&&Ut.utils.removeItem(a)}}return a=i,h=n,this.setRange(l,r,a,h),!0}init(){const t=this.#K.get("_wd").activeElement;if(Ut.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.#ut(),this.#pt(s,e)}#pt(t,e){let s=null;this.#t.set("_range",t),s=t.collapsed?Ut.check.isWysiwygFrame(t.commonAncestorContainer)&&t.commonAncestorContainer.children[t.startOffset]||t.commonAncestorContainer:e.anchorNode,this.selectionNode=s}#gt(t){const e=t.commonAncestorContainer;return Ut.check.isWysiwygFrame(t.startContainer)&&Ut.check.isWysiwygFrame(t.endContainer)||/FIGURE/i.test(e.nodeName)||this.#X.pluginManager.fileInfo.regExp.test(e.nodeName)&&(!this.#X.pluginManager.fileInfo.tagAttrs[e.nodeName]||this.#X.pluginManager.fileInfo.tagAttrs[e.nodeName]?.every((t=>e.hasAttribute(t))))||this.#X.component.is(e)}#ut(){const t=this.#K.get("wysiwyg"),e=this.#K.get("_wd").createRange();let s=t.firstElementChild,i=null;return s?(i=s.firstChild,i||(i=Ut.utils.createElement("BR"),s.appendChild(i))):(i=Ut.utils.createElement("BR"),s=Ut.utils.createElement(this.#it.get("defaultLine"),null,i),t.appendChild(s)),e.setStart(i,0),e.setEnd(i,0),e}__focus(){try{this.__iframeFocus=!0;const t=Ut.query.getParentElement(this.getNode(),"figcaption");t?t.focus():this.#K.get("wysiwyg").focus()}finally{Ae.setTimeout((()=>this.__iframeFocus=!1),0)}}__init(){this.#dt=this.#F._eventOrchestrator.scrollparents?.length>0,this.#ct=this.#K?.get("wysiwyg")?(Zt.get(Ae.getComputedStyle(this.#K.get("wysiwyg")).scrollMargin,0)||40)+Zt.get(Ae.getComputedStyle(this.#K.get("wrapper")).paddingBottom,0):40}};function Ve(t,e,s){const i=[];for(let n,o,l=0,r=t.length;l<r;l++)n=t[l],Ut.check.isListCell(n)?(e<0||n.previousElementSibling)&&i.push(n):(o=/\d+/.test(n.style[s])?Zt.get(n.style[s],0):0,o+=e,Ut.utils.setStyle(n,s,o<=0?"":o+"px"));return i}const Oe=class{#X;#t;#it;#K;#mt;#ft;#vt;#bt;#yt;#wt;#Ct=null;constructor(t){this.#X=t.$,this.#t=t.store,this.#it=this.#X.options,this.#K=this.#X.frameContext,this.#mt=this.#it.get("formatLine").reg,this.#ft=this.#it.get("formatBrLine").reg,this.#vt=this.#it.get("formatBlock").reg,this.#bt=this.#it.get("formatClosureBlock").reg,this.#yt=this.#it.get("formatClosureBrLine").reg,this.#wt=new RegExp("^("+this.#it.get("textStyleTags")+")$","i"),this.__resetBrLineBreak(this.#it.get("defaultLineBreakFormat"))}setLine(t){if(!this.isLine(t))throw new Error('[SUNEDITOR.format.setLine.fail] The "element" must satisfy "format.isLine()".');const e=this.#_t(),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.#X.component.is(e)||(r=t.cloneNode(!1),Ut.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.#X.selection.setRange(Ut.query.getNodeFromPath(e.firstPath,o),e.startOffset,Ut.query.getNodeFromPath(e.lastPath,l),e.endOffset),this.#X.history.push(!1),this.#K.has("documentType_use_header")&&this.#K.get("documentType").reHeader()}getLine(t,e){if(!t)return null;for(e||=()=>!0;t;){if(Ut.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.#_t().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.#X.component.is(o),l=c?"":o.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),r=Ut.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&&Ut.check.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,Ut.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&&Ut.check.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,Ut.utils.removeItem(a));const t=n.previousSibling;t&&n.nodeName===t.nodeName&&Ut.check.isSameAttributes(n,t)&&(t.innerHTML+="<BR>"+n.innerHTML,Ut.utils.removeItem(n))}c||Ut.utils.removeItem(o),l&&(u=!1)}this.#X.selection.setRange(o,0,o,0),this.#X.history.push(!1)}getBrLine(t,e){if(!t)return null;for(e||=()=>!0;t;){if(Ut.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.#X.selection.getNode(),null);let i=null;if(this.isBrLine(t)||!this.isBrLine(s||t.parentNode)||this.#X.component.is(t)){const t=e?"string"==typeof e?e:e.nodeName:this.isNormalLine(s)?s.nodeName:this.#it.get("defaultLine");i=Ut.utils.createElement(t,null,"<br>"),(e&&"string"!=typeof e||!e&&this.isLine(s))&&Ut.utils.copyTagAttributes(i,e||s,["id"])}else i=Ut.utils.createElement("BR");return Ut.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(Ut.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.#X.selection.getRangeAndAddLine(this.#X.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],Ut.check.isListCell(t))if(s=t.lastElementChild,s&&Ut.check.isListCell(t.nextElementSibling)&&e.includes(t.nextElementSibling)&&(n=s.lastElementChild,e.includes(n))){let t=null;for(;t=n.lastElementChild;)if(Ut.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),Ut.check.isTableCell(i)?(n=null,o=i):(n=i.nextSibling,o=i.parentNode);const l=t.cloneNode(!1);let r=Ut.query.getNodeDepth(i),a=null;const h=[],c=(t,e,s)=>{let i=null;if(t!==e&&!Ut.check.isTableElements(e)){if(e&&Ut.query.getNodeDepth(t)===Ut.query.getNodeDepth(e))return s;i=this.#X.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=Ut.query.getNodeDepth(t),Ut.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(;Ut.check.isList(m);)e=Ut.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.#X.nodeTransform.mergeSameTags(l,null,!1),this.#X.nodeTransform.mergeNestedTags(l,(t=>Ut.check.isList(t))),n&&Ut.query.getNodeDepth(n)>0&&(Ut.check.isList(n.parentNode)||Ut.check.isList(n.parentNode.parentNode))){const t=Ut.query.getParentElement(n,(t=>this.isBlock(t)&&!Ut.check.isList(t))),e=this.#X.nodeTransform.split(n,null,t?Ut.query.getNodeDepth(t)+1:0);e.parentNode.insertBefore(l,e)}else o.insertBefore(l,n),c(l,n);const d=Ut.query.getEdgeChildNodes(l.firstElementChild,l.lastElementChild);e.length>1?this.#X.selection.setRange(d.sc,0,d.ec,d.ec.textContent.length):this.#X.selection.setRange(d.ec,d.ec.textContent.length,d.ec,d.ec.textContent.length),this.#X.history.push(!1)}removeBlock(t,{selectedFormats:e,newBlockElement:s,shouldDelete:i,skipHistory:n}={}){const o=this.#X.selection.getRange();let l=o.startOffset,r=o.endOffset,a=Ut.query.getListChildNodes(t,null,1),h=t.parentNode,c=null,d=null,u=t.cloneNode(!1);const p=[],g=Ut.check.isList(s);let m=!1,f=!1,v=!1;const b=(e,s,i,n)=>{if(1===s.childNodes.length&&Ut.check.isZeroWidth(s)&&(s.innerHTML=qt.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)||Ut.check.isBreak(c)||Ut.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(Ut.check.isListCell(e)&&Ut.check.isListCell(a)&&Ut.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.#X.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||!Ut.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&&Ut.check.isListCell(n))if(l&&Ut.query.getNodeDepth(n)!==Ut.query.getNodeDepth(l)&&(Ut.check.isListCell(h)||Ut.utils.arrayFind(n.children,Ut.check.isList))){const e=n.nextElementSibling,s=this.#X.listFormat.removeNested(n,!1);t===s&&e===n.nextElementSibling||(t=s,f=!0)}else{const e=n;n=Ut.utils.createElement(i?e.nodeName:Ut.check.isList(t.parentNode)||Ut.check.isListCell(t.parentNode)?"LI":Ut.check.isTableCell(t.parentNode)?"DIV":this.#it.get("defaultLine"));const s=Ut.check.isListCell(n),o=e.childNodes;for(;o[0]&&(!Ut.check.isList(o[0])||s);)n.appendChild(o[0]);Ut.utils.copyFormatAttributes(n,e),v=!0}else n=n.cloneNode(!1);if(!f&&(i?(p.push(n),Ut.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=Ut.query.getListChildNodes(t,null,1),u=t.cloneNode(!1),h=t.parentNode,r=-1,y=a.length;continue}}const y=t.parentNode;let w=t.nextSibling;u?.children.length>0&&y.insertBefore(u,w),s?c=s.previousSibling:c||=t.previousSibling,w=t.nextSibling!==u?t.nextSibling:u?u.nextSibling:null,0===t.children.length||0===t.textContent.length?Ut.utils.removeItem(t):this.#X.nodeTransform.removeEmptyNode(t,null,!1);let C=null;if(this.#t.set("_lastSelectionNode",null),i)C={cc:y,sc:c,so:l,ec:w,eo:r,removeArray:p};else{c||=d,d||=c;const t=Ut.query.getEdgeChildNodes(c,d?.parentNode?c:d);t?C={cc:(t.sc||t.ec).parentNode,sc:t.sc,so:l,ec:t.ec,eo:r,removeArray:null}:this.#X.focusManager.focus()}if(n)return C;!i&&C&&(e?this.#X.selection.setRange(C.sc,l,C.ec,r):this.#X.selection.setRange(C.sc,0,C.sc,0)),this.#X.history.push(!1)}indent(){const t=this.#X.selection.getRange(),e=t.startContainer,s=t.endContainer,i=t.startOffset,n=t.endOffset,o=Ve(this.getLines(null),this.#t.get("indentSize"),this.#it.get("_rtl")?"marginRight":"marginLeft");o.length>0&&this.#X.listFormat.applyNested(o,!1),this.#t.set("_lastSelectionNode",null),this.#X.selection.setRange(e,i,s,n),this.#X.history.push(!1)}outdent(){const t=this.#X.selection.getRange(),e=t.startContainer,s=t.endContainer,i=t.startOffset,n=t.endOffset,o=Ve(this.getLines(null),-1*this.#t.get("indentSize"),this.#it.get("_rtl")?"marginRight":"marginLeft");o.length>0&&this.#X.listFormat.applyNested(o,!0),this.#t.set("_lastSelectionNode",null),this.#X.selection.setRange(e,i,s,n),this.#X.history.push(!1)}isEdgeLine(t,e,s){if(!Ut.check.isEdgePoint(t,e,s))return!1;let i=!1;const n="front"===s?"previousSibling":"nextSibling";for(;t&&!this.isLine(t)&&!Ut.check.isWysiwygFrame(t);){if(t[n]&&(!Ut.check.isBreak(t[n])||t[n][n]))return!1;i=!0,t=t.parentNode}return i}isTextStyleNode(t){return"string"==typeof t?this.#wt.test(t):1===t?.nodeType&&this.#wt.test(t.nodeName)}isLine(t){return"string"==typeof t?this.#mt.test(t):1===t?.nodeType&&(this.#mt.test(t.nodeName)||Ut.utils.hasClass(t,"__se__format__line_.+|__se__format__br_line_.+"))&&!this.#xt(t)}isNormalLine(t){return this.isLine(t)&&(this.#Ct||!this.isBrLine(t))&&!this.isBlock(t)}isBrLine(t){return this.#Ct&&this.isLine(t)||("string"==typeof t?this.#ft.test(t):1===t?.nodeType&&(this.#ft.test(t.nodeName)||Ut.utils.hasClass(t,"__se__format__br_line_.+"))&&!this.#xt(t))}isBlock(t){return"string"==typeof t?this.#vt.test(t):1===t?.nodeType&&(this.#vt.test(t.nodeName)||Ut.utils.hasClass(t,"__se__format__block_.+"))&&!this.#xt(t)}isClosureBlock(t){return"string"==typeof t?this.#bt.test(t):1===t?.nodeType&&(this.#bt.test(t.nodeName)||Ut.utils.hasClass(t,"__se__format__block_closure_.+"))&&!this.#xt(t)}isClosureBrLine(t){return"string"==typeof t?this.#yt.test(t):1===t?.nodeType&&(this.#yt.test(t.nodeName)||Ut.utils.hasClass(t,"__se__format__br_line__closure_.+"))&&!this.#xt(t)}getLines(t){if(!this.#X.selection.resetRangeToTextNode())return[];let e=this.#X.selection.getRange();if(Ut.check.isWysiwygFrame(e.startContainer)){const t=this.#K.get("wysiwyg").children,s=t.length;if(0===s)return[];this.#X.selection.setRange(t[0],0,t[s-1],t[s-1].textContent.trim().length),e=this.#X.selection.getRange()}const s=e.startContainer,i=e.endContainer,n=e.commonAncestorContainer;t||=this.isLine.bind(this);const o=Ut.query.getListChildren(n,(e=>t(e)),null);if(3!==n.nodeType&&(Ut.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!Ut.check.isTableElements(t)||/^TABLE$/i.test(t.nodeName)};let d=this.getBlock(l,c),u=this.getBlock(r,c);Ut.check.isTableElements(d)&&Ut.check.isListCell(d.parentNode)&&(d=d.parentNode),Ut.check.isTableElements(u)&&Ut.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.#X.selection.getRange().commonAncestorContainer,s=Ut.query.getParentElement(e,this.#X.component.is.bind(this.#X.component)),i=Ut.check.isTableElements(e)?this.getLines(null):this.getLines((t=>{const e=Ut.query.getParentElement(t,this.#X.component.is.bind(this.#X.component));return this.isLine(t)&&(!e||e===s)||Ut.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.#X.component.is(t)||e.test(t.nodeName))}_isExcludeSelectionElement(t){return!/FIGCAPTION/i.test(t.nodeName)&&(this.#X.component.is(t)||/FIGURE/i.test(t.nodeName))}#xt(t){return Ut.check.isExcludeFormat(t)||this.#X.component.is(t)||Ut.check.isWysiwygFrame(t)}#_t(){let t=this.#X.selection.getRange(),e=this.getLinesAndComponents(!1);if(0===e.length&&(t=this.#X.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=Ut.query.getNodePath(t.startContainer,n,null),r=Ut.query.getNodePath(t.endContainer,o,null),a=this.#X.listFormat.remove(e,!1);return a.sc&&(n=a.sc),a.ec&&(o=a.ec),this.#X.selection.setRange(Ut.query.getNodeFromPath(l,n),s,Ut.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.#Ct="br"===t}};function Re(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 ze=class{#X;#it;#$t;#kt;constructor(t){this.#X=t.$,this.#it=this.#X.options,this.#$t=this.#it.get("__listCommonStyle"),this.#kt=Wt.camelToKebabCase(this.#it.get("__listCommonStyle"))}apply(t,{stylesToModify:e,nodesToRemove:s,strictRemove:i}={}){if(Ut.query.getParentElement(this.#X.selection.getNode(),Ut.check.isNonEditable))return;this.#X.selection.resetRangeToTextNode();let n=this.#X.selection.getRangeAndAddLine(this.#X.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.#X.format.isLine(r.parentNode)&&this.#X.format.isLine(h.parentNode)||r===h&&1===r.nodeType&&Ut.check.isNonEditable(r)){const t=r.parentNode;if(!Ut.check.isListCell(t)||!Wt.getValues(t.style).some((t=>this.#kt.includes(t))))return}if(n.collapsed&&!l&&1===r.nodeType&&!Ut.check.isBreak(r)&&!this.#X.component.is(r)){let t=null;const e=r.childNodes[a];e&&(t=e.nextSibling?Ut.check.isBreak(e)?e:e.nextSibling:null);const s=Ut.utils.createTextNode(qt.zeroWidthSpace);r.insertBefore(s,t),this.#X.selection.setRange(s,1,s,1),n=this.#X.selection.getRange(),r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset}this.#X.format.isLine(r)&&(r=r.childNodes[a]||r.firstChild,a=0),this.#X.format.isLine(h)&&(h=h.childNodes[c]||h.lastChild,c=h.textContent.length),o&&(t=Ut.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.#X.format.isLine(e)&&!Ut.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},w=function(t){const e=t.cloneNode(!1);if(3===e.nodeType||Ut.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)},C=this.#X.format.getLines(null);if(0===C.length)return void console.warn("[SUNEDITOR.inline.apply.warn] There is no line to apply.");n=this.#X.selection.getRange(),r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset,this.#X.format.getLine(r,null)||(r=Ut.query.getEdgeChild(C[0],(function(t){return 3===t.nodeType}),!1),a=0),this.#X.format.getLine(h,null)||(h=Ut.query.getEdgeChild(C.at(-1),(function(t){return 3===t.nodeType}),!1),c=h.textContent.length);const _=this.#X.format.getLine(r,null)===this.#X.format.getLine(h,null),x=C.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.#St(p),S=this.#Et.bind(this,$,k),E=this.#Tt.bind(this,$,k);if(_){this.#Mt(C[0],e)&&(n=this.#X.selection.setRange(r,a,h,c));const t=this.#Ht(C[0],p,w,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&&Ut.check.isZeroWidth(m.container)&&(m.offset=f.offset=1),this.#Lt(t.ancestor,null)}else{let s=!1;x>0&&this.#Mt(C[x],e)&&(s=!0),this.#Mt(C[0],e)&&(s=!0),s&&this.#X.selection.setRange(r,a,h,c),x>0&&(p=t.cloneNode(!1),f=this.#Nt(C[x],p,w,h,c,l,o,y,S,E));for(let s,i=x-1;i>0;i--)this.#Mt(C[i],e),p=t.cloneNode(!1),s=this.#Bt(C[i],p,w,l,o,y,f.container),s.endContainer&&s.ancestor.contains(s.endContainer)&&(f.ancestor=null,f.container=s.endContainer),this.#Lt(s.ancestor,null);p=t.cloneNode(!1),m=this.#At(C[0],p,w,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.#Lt(m.ancestor,null),this.#Lt(f.ancestor||this.#X.format.getLine(f.container),null)}return this.#X.ui.offCurrentController(),this.#X.selection.setRange(m.container,m.offset,f.container,f.offset),this.#X.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&&(Ut.check.isNonEditable(t)||!this.#X.format.isTextStyleNode(t)||this.#X.component.is(t))}#Ht(t,e,s,i,n,o,l,r,a,h,c,d,u){let p=i.parentNode;for(;!(p.nextSibling||p.previousSibling||this.#X.format.isLine(p.parentNode)||Ut.check.isWysiwygFrame(p.parentNode))&&p.nodeName!==e.nodeName;)p=p.parentNode;if(!a&&!r&&p===o.parentNode&&p.nodeName===e.nodeName&&Ut.check.isZeroWidth(i.textContent.slice(0,n))&&Ut.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=!Ut.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 Ut.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,w,C,_,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=Ut.utils.createTextNode(o),h=Ut.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)}Ut.check.isZeroWidth(r)||n.appendChild(r);const c=d(n);for(c&&(x=c),x&&(t=x),w=a,y=[],_="";w!==t&&w!==m&&null!==w;)i=u(w)?null:s(w),i&&1===w.nodeType&&L(w)&&(y.push(i),_+=w.style.cssText.substring(0,w.style.cssText.indexOf(":"))+"|"),w=w.parentElement;const p=y.pop()||h;for(C=w=p;y.length>0;)w=y.pop(),C.appendChild(w),C=w;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,w!==h&&w.appendChild($),!b)continue}if(M||a!==S){if(T){if(1===a.nodeType&&!Ut.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}w=a,y=[],_="";const o=[];for(;null!==w.parentNode&&w!==m&&w!==e;)i=M?w.cloneNode(!1):s(w),1===w.nodeType&&!Ut.check.isBreak(a)&&i&&L(w)&&(u(w)?x||o.push(i):y.push(i),_+=w.style.cssText.substring(0,w.style.cssText.indexOf(":"))+"|"),w=w.parentElement;y=y.concat(o);const l=y.pop()||a;for(C=w=l;y.length>0;)w=y.pop(),C.appendChild(w),C=w;if(!u(e.parentNode)||u(l)||Ut.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=w):(e.appendChild(l),n=w);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?w:e}if(x&&3===a.nodeType)if(d(a)){const t=Ut.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||Ut.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=Ut.utils.createTextNode(t),l=Ut.utils.createTextNode(n);if(x?x=x.cloneNode(!1):u(e.parentNode)&&!x&&(e=e.cloneNode(!1),v.appendChild(e),f.push(e)),!Ut.check.isZeroWidth(o)){w=a,_="",y=[];const t=[];for(;w!==v&&w!==m&&null!==w;)1===w.nodeType&&L(w)&&(u(w)?t.push(w.cloneNode(!1)):y.push(w.cloneNode(!1)),_+=w.style.cssText.substring(0,w.style.cssText.indexOf(":"))+"|"),w=w.parentElement;for(y=y.concat(t),c=C=w=y.pop()||o;y.length>0;)w=y.pop(),C.appendChild(w),C=w;v.appendChild(c),w.textContent=o.data}if(x&&c){const t=d(c);t&&(x=t)}for(w=a,y=[],_="";w!==v&&w!==m&&null!==w;)i=u(w)?null:s(w),i&&1===w.nodeType&&L(w)&&(y.push(i),_+=w.style.cssText.substring(0,w.style.cssText.indexOf(":"))+"|"),w=w.parentElement;const p=y.pop()||l;for(C=w=p;y.length>0;)w=y.pop(),C.appendChild(w),C=w;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=qt.zeroWidthSpace),w!==l&&w.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=Ut.utils.createTextNode(qt.zeroWidthSpace),v.replaceChild(s,e);else{const t=e.childNodes;for(i=t[0];t[0];)n=t[0],v.insertBefore(n,e);Ut.utils.removeItem(e)}0===t&&(h?$=S=s:($=i,S=n))}else{if(a)for(let t=0;t<f.length;t++)Re(f[t]);h&&($=S=e)}this.#X.nodeTransform.removeEmptyNode(v,e,!1),h&&(k=$.textContent.length,E=S.textContent.length);const N=r||0===S.textContent.length;Ut.check.isBreak(S)||0!==S.textContent.length||(Ut.utils.removeItem(S),S=$),E=N?S.textContent.length:E;const B={s:0,e:0},A=Ut.query.getNodePath($,v,B),I=!S.parentNode;I&&(S=$);const V={s:0,e:0},O=Ut.query.getNodePath(S,v,I||N?null:V);k+=B.s,E=h?k:I?$.textContent.length:N?E+B.s:E+V.s;const R=this.#X.nodeTransform.mergeSameTags(v,[A,O],!0);return t.parentNode.replaceChild(v,t),$=Ut.query.getNodeFromPath(A,v),S=Ut.query.getNodeFromPath(O,v),{ancestor:v,startContainer:$,startOffset:k+R[0],endContainer:S,endOffset:E+R[1]}}#At(t,e,s,i,n,o,l,r,a,h,c){let d=i.parentNode;for(;!(d.nextSibling||d.previousSibling||this.#X.format.isLine(d.parentNode)||Ut.check.isWysiwygFrame(d.parentNode))&&d.nodeName!==e.nodeName;)d=d.parentNode;if(!l&&!o&&d.nodeName===e.nodeName&&!this.#X.format.isLine(d)&&!d.nextSibling&&Ut.check.isZeroWidth(i.textContent.slice(0,n))){let s=!0,o=i.previousSibling;for(;o;){if(!Ut.check.isZeroWidth(o)){s=!1;break}o=o.previousSibling}if(s)return Ut.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,w=i,C=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(_&&!Ut.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=Ut.query.getNodePath(c,d);c=Ut.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,w=f.pop()||d;for(b=v=w;f.length>0;)v=f.pop(),b.appendChild(v),b=v;if(h(e.parentNode)&&!h(w)&&(e=e.cloneNode(!1),m.appendChild(e),g.push(e)),!y&&h(w)){e=e.cloneNode(!1);const t=w.childNodes;for(let s=0,i=t.length;s<i;s++)e.appendChild(t[s]);w.appendChild(e),m.appendChild(w),n=h(v)?e:v,g.push(e)}else r?(e.appendChild(w),n=v):n=e;if(y&&3===d.nodeType)if(a(d)){const t=Ut.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!==w)i=_?s(d):d.cloneNode(!1),i&&(n.appendChild(i),1!==d.nodeType||Ut.check.isBreak(d)||(x=i)),t(d,x);else{let t=m;y=a(d);let o="",l="";if(3===w.nodeType){const t=w;o=t.substringData(0,C),l=t.substringData(C,t.length-C)}const r=Ut.utils.createTextNode(o),h=Ut.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)}Ut.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,Ut.check.isBreak(d)&&e.appendChild(d.cloneNode(!1)),t.appendChild(e),w=h,C=0,_=!0,n.appendChild(w)}}}(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);Ut.utils.removeItem(e),0===t&&(w=i)}else if(l){e=e.firstChild;for(let t=0;t<g.length;t++)Re(g[t])}if(o||0!==m.childNodes.length){this.#X.nodeTransform.removeEmptyNode(m,e,!1),Ut.check.isZeroWidth(m.textContent)&&(w=m.firstChild,C=0);const s={s:0,e:0},i=Ut.query.getNodePath(w,m,s);C+=s.s;const n=this.#X.nodeTransform.mergeSameTags(m,[i],!0);t.parentNode.replaceChild(m,t),w=Ut.query.getNodeFromPath(i,m),C+=n[0]}else t.childNodes?w=t.childNodes[0]:(w=Ut.utils.createTextNode(qt.zeroWidthSpace),t.appendChild(w));return{ancestor:m,container:w,offset:C,endContainer:c}}#Bt(t,e,s,i,n,o,l){if(!n){let s=null;l&&t.contains(l)&&(s=Ut.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(!Ut.check.isBreak(t)&&this._isIgnoreNodeChange(t))continue;if(1===c){a=t.childNodes,c=a.length,h=-1;continue}break}t.style.cssText+=o,Ut.utils.addClass(t,r)}if(c>0&&h===c)return t.innerHTML=i.innerHTML,{ancestor:t,endContainer:s?Ut.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(Ut.check.isBreak(p)||!r._isIgnoreNodeChange(p))i=s(p),i&&(c=!1,n.appendChild(i),1===p.nodeType&&(g=i)),Ut.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=Ut.query.getNodePath(l,p);l=Ut.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);Ut.utils.removeItem(e)}else if(n){e=e.firstChild;for(let t=0;t<h.length;t++)Re(h[t])}return this.#X.nodeTransform.removeEmptyNode(a,e,!1),this.#X.nodeTransform.mergeSameTags(a,null,!0),t.parentNode.replaceChild(a,t),{ancestor:a,endContainer:l}}#Nt(t,e,s,i,n,o,l,r,a,h){let c=i.parentNode;for(;!(c.nextSibling||c.previousSibling||this.#X.format.isLine(c.parentNode)||Ut.check.isWysiwygFrame(c.parentNode))&&c.nodeName!==e.nodeName;)c=c.parentNode;if(!l&&!o&&c.nodeName===e.nodeName&&!this.#X.format.isLine(c)&&!c.previousSibling&&Ut.check.isZeroWidth(i.textContent.slice(n))){let s=!0,o=i.nextSibling;for(;o;){if(!Ut.check.isZeroWidth(o)){s=!1;break}o=o.nextSibling}if(s)return Ut.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,w=n,C=!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(C&&!Ut.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=Ut.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(C||r!==y)i=C?s(r):r.cloneNode(!1),i&&(n.insertBefore(i,n.firstChild),1!==r.nodeType||Ut.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(w,e.length-w),o=e.substringData(0,w)}const l=Ut.utils.createTextNode(t),c=Ut.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(Ut.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,Ut.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,w=c.data.length,C=!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);Ut.utils.removeItem(e),t===p.length-1&&(y=i,w=i.textContent.length)}else if(l){e=e.firstChild;for(let t=0;t<p.length;t++)Re(p[t])}if(o||0!==g.childNodes.length){if(!l&&0===e.textContent.length)return this.#X.nodeTransform.removeEmptyNode(g,null,!1),{ancestor:null,container:null,offset:0};this.#X.nodeTransform.removeEmptyNode(g,e,!1),Ut.check.isZeroWidth(g.textContent)?(y=g.firstChild,w=y.textContent.length):Ut.check.isZeroWidth(y)&&(y=e,w=1);const s={s:0,e:0},i=Ut.query.getNodePath(y,g,s);w+=s.s;const n=this.#X.nodeTransform.mergeSameTags(g,[i],!0);t.parentNode.replaceChild(g,t),y=Ut.query.getNodeFromPath(i,g),w+=n[0]}else t.childNodes?y=t.childNodes[0]:(y=Ut.utils.createTextNode(qt.zeroWidthSpace),t.appendChild(y));return{ancestor:g,container:y,offset:1===y.nodeType&&1===w?y.childNodes.length:w}}#St(t){return t&&"string"!=typeof t&&3!==t.nodeType&&this.#X.format.isTextStyleNode(t)&&!!t.style.fontSize}#Et(t,e,s){return!s||t?null:Ut.query.getParentElement(s,this._isNonSplitNode.bind(this))||(e?null:Ut.query.getParentElement(s,this.#St.bind(this)))}#Tt(t,e,s){if(!s||t||1!==s.nodeType)return!1;const i=this._isNonSplitNode(s);return Ut.query.getParentElement(s,this._isNonSplitNode.bind(this))?i:i||!e&&this.#St(s)}#Lt(t,e){if(!Ut.check.isListCell(t))return;const s=Ut.utils.arrayFilter((e||t).childNodes,(t=>!Ut.check.isBreak(t)));if(e=s[0],!Ut.check.isElement(e)||s.length>1)return;const i=e.style,n=t.style,o=e.nodeName.toLowerCase();let l=!1;this.#it.get("_defaultStyleTagMap")[o]===this.#it.get("_defaultTagCommand").bold.toLowerCase()&&(n.fontWeight="bold"),this.#it.get("_defaultStyleTagMap")[o]===this.#it.get("_defaultTagCommand").italic.toLowerCase()&&(n.fontStyle="italic");const r=Wt.getValues(i);if(r.length>0)for(let t=0,e=this.#$t.length;t<e;t++)r.includes(this.#kt[t])&&(n[this.#$t[t]]=i[this.#$t[t]],i.removeProperty(this.#kt[t]),l=!0);if(this.#Lt(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);Ut.utils.removeItem(e)}}#Mt(t,e){if(!Ut.check.isListCell(t))return;e||=this.#kt;const s=Ut.utils.arrayFilter(t.childNodes,(t=>!Ut.check.isBreak(t))),i=t.style,n=[],o=[],l=Wt.getValues(i);for(let t=0,s=this.#kt.length;t<s;t++)l.includes(this.#kt[t])&&e.includes(this.#kt[t])&&(n.push(this.#$t[t]),o.push(this.#kt[t]));if(0===n.length)return;const r=Ut.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.#it.get("_defaultStyleTagMap")[e.nodeName.toLowerCase()]||(i=Wt.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 Fe(t){const e=t.parentNode;let s,i,n,o,l,r=e.parentNode,a=e;for(;Ut.check.isListCell(r);){for(o=Ut.query.getPositionIndex(t),s=r.nextElementSibling,i=r.parentNode,n=a;n;){if(a=a.nextSibling,Ut.check.isList(n)){for(l=n.childNodes;l[o];)i.insertBefore(l[o],s);0===l.length&&Ut.utils.removeItem(n)}else i.appendChild(n);n=a}r=i.parentNode}return 0===e.children.length&&Ut.utils.removeItem(e),i}const Pe=class{#X;#t;constructor(t){this.#X=t.$,this.#t=t.store}apply(t,e,s){const i=(t.split(":")[0]||"ol").toUpperCase(),n=t.split(":")[1]||"";let o=this.#X.selection.getRange(),l=e||this.#X.format.getLinesAndComponents(!1);if(0===l.length){if(e)return;if(o=this.#X.selection.getRangeAndAddLine(o,null),l=this.#X.format.getLinesAndComponents(!1),0===l.length)return}Ut.query.sortNodeByDepth(l,!0);const r=l[0],a=l.at(-1);let h=!Ut.check.isListCell(r)&&!this.#X.component.is(r)||r.previousElementSibling?r.previousElementSibling:r.parentElement.previousElementSibling,c=!Ut.check.isListCell(a)&&!this.#X.component.is(a)||a.nextElementSibling?a.nextElementSibling:a.parentElement.nextElementSibling;const d=o.collapsed,u={sc:o.startContainer,so:o.startContainer===o.endContainer&&Ut.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(!Ut.check.isList(this.#X.format.getBlock(l[t],(e=>this.#X.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&&!Ut.check.isWysiwygFrame(t)&&t.nodeName===i?t:h,c=e&&!Ut.check.isWysiwygFrame(e)&&e.nodeName===i?e:c;const s=h?.tagName===i,o=c?.tagName===i;let r=s?h:Ut.utils.createElement(i,{style:"list-style-type: "+n}),a=null,d=null;const u=t=>!Ut.check.isComponentContainer(t)&&!Ut.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.#X.inline._isIgnoreNodeChange(e)){if(h=l[v+1],c=e.parentNode,p=h?h.parentNode:null,o=Ut.check.isListCell(e),f=this.#X.format.isBlock(c)?c:null,g=o&&!Ut.check.isWysiwygFrame(c)?c.parentNode:c,m=o&&!Ut.check.isWysiwygFrame(c)?!h||Ut.check.isListCell(g)?c:c.nextSibling:e.nextSibling,t=Ut.utils.createElement("LI"),this.#X.component.is(e)){const s=/^HR$/i.test(e.nodeName);s||(t.innerHTML="<br>"),t.innerHTML+=e.outerHTML,s&&(t.innerHTML+="<br>")}else{Ut.utils.copyFormatAttributes(t,e);const s=e.childNodes;for(;s[0];)t.appendChild(s[0])}r.appendChild(t),h&&g===p&&!this.#X.format.isBlock(m)||(a||=r,s&&h&&g===p||h&&Ut.check.isList(p)&&p===c||r.parentNode!==g&&g.insertBefore(r,m)),Ut.utils.removeItem(e),s&&null===d&&(d=r.children.length-1),h&&(this.#X.format.getBlock(p,u)!==this.#X.format.getBlock(c,u)||Ut.check.isList(p)&&Ut.check.isList(c)&&Ut.query.getNodeDepth(p)!==Ut.query.getNodeDepth(c))&&(r=Ut.utils.createElement(i,{style:"list-style-type: "+n})),0===f?.children.length&&Ut.utils.removeItem(f)}else Ut.utils.removeItem(e);d&&(a=a.children[d]),o&&(r.innerHTML+=c.innerHTML,Ut.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.#X.format.getBlock(r),e=t?.tagName===i;let o,a;const h=t=>!Ut.check.isComponentContainer(t);e||(a=Ut.utils.createElement(i,{style:"list-style-type: "+n}));for(let t,r,c=0,d=l.length;c<d;c++)r=this.#X.format.getBlock(l[c],h),r&&Ut.check.isList(r)&&(t?t!==r?(s&&Ut.check.isListCell(r.parentNode)?this.#It(o.f):p=this.#X.format.removeBlock(o.f[0].parentElement,{selectedFormats:o.f,newBlockElement:a,shouldDelete:!1,skipHistory:!0}),r=l[c].parentNode,e||(a=Ut.utils.createElement(i,{style:"list-style-type: "+n})),t=r,o={r:t,f:[Ut.query.getParentElement(l[c],"LI")]}):o.f.push(Ut.query.getParentElement(l[c],"LI")):(t=r,o={r:t,f:[Ut.query.getParentElement(l[c],"LI")]}),c===d-1&&(s&&Ut.check.isListCell(r.parentNode)?this.#It(o.f):p=this.#X.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=>!Ut.check.isComponentContainer(t);for(let a,h,c,d,u=0,p=t.length;u<p;u++){if(c=u===p-1,h=this.#X.format.getBlock(t[u],r),d=Ut.check.isList(h),!a&&d)a=h,s={r:a,f:[Ut.query.getParentElement(t[u],"LI")]},0===u&&(i=!0);else if(a&&d)if(a!==h){const r=this.#X.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:[Ut.query.getParentElement(t[u],"LI")]},c&&(n=!0)):a=null}else s.f.push(Ut.query.getParentElement(t[u],"LI")),c&&(n=!0);if(c&&Ut.check.isList(a)){const t=this.#X.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.#X.format.getLines().filter((function(t){return Ut.check.isListCell(t)}))).length;if(0===s||!e&&!Ut.check.isListCell(t[0].previousElementSibling)&&!Ut.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&&Ut.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=Ut.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.#X.selection.getRange();for(let n,o=0,h=s;o<h;o++)n=t[o],n.parentElement!==i&&(this.#Vt(i,e,l,r,a),i=n.parentElement,e=Ut.utils.createElement(i.nodeName)),l=n.previousElementSibling,r=n.nextElementSibling,e.appendChild(n);if(this.#Vt(i,e,l,r,a),s>1){const t=Ut.query.getNodeFromPath(a.s,a.sl),e=Ut.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=Fe(t);let i,n,o;if(s){i=s.cloneNode(!1),n=s.childNodes;const e=Ut.query.getPositionIndex(t);for(;n[e];)i.appendChild(n[e])}else i=t;if(e)o=Ut.query.getListChildren(i,(t=>Ut.check.isListCell(t)&&!t.previousElementSibling),null);else{const e=Ut.query.getNodeDepth(t)+2;o=Ut.query.getListChildren(t,(t=>Ut.check.isListCell(t)&&!t.previousElementSibling&&Ut.query.getNodeDepth(t)===e),null)}for(let t=0,e=o.length;t<e;t++)Fe(o[t]);return s&&(s.parentNode.insertBefore(i,s.nextSibling),0===n?.length&&Ut.utils.removeItem(s)),i===t?i.parentNode:i}#Vt(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){Ut.check.isListCell(s)&&(t=s,i=null),t.insertBefore(e,i),n.s||(n.s=Ut.query.getNodePath(e.firstElementChild.firstChild,t,null),n.sl=t);const o=t.contains(n.sl)?Ut.query.getNodePath(n.sl,t):null;n.e=Ut.query.getNodePath(e.lastElementChild.firstChild,t,null),n.el=t,this.#X.nodeTransform.mergeSameTags(t,[n.s,n.e,o],!1),this.#X.nodeTransform.mergeNestedTags(t),o&&(n.sl=Ut.query.getNodeFromPath(o,t))}return e}#It(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=Ut.query.getPositionIndex(i);for(;e[o];)t.appendChild(e[o]);s.appendChild(t)}0===n.children.length&&Ut.utils.removeItem(n),this.#X.nodeTransform.mergeSameTags(l);const r=Ut.query.getEdgeChildNodes(e,s);return{cc:e.parentNode,sc:r.sc,ec:r.ec}}},{_d:De}=Dt;const qe=/^<[a-z0-9]+:[a-z0-9]+/i,We=/(?!<)[a-zA-Z0-9-]+/,Ue=/\s(?:on[a-z]+)\s*=\s*(?:(["'])[^"']*\1|\S+)/gi,Ze=/style=/i,Ge=/style\s*=\s*(?:"|')[^"']*(?:"|')/,je=/^\s/,Ke=/<[^\s]+\s(.+)/,Ye=/\ssize="([^"]+)"/i,Xe=/\sface="([^"]+)"/i,Je=/\scolor="([^"]+)"/i,Qe=/&quot;/g,ts=/([a-zA-Z0-9-]+)(:)([^"']+)/,es=/inherit|initial|revert|unset/i,ss=/"/g,is=/:\s*([^;]+)/,ns=/rgba\(([0-9]+\s*,\s*){3}0\)|windowtext/i,os=/[^;]+;/g,ls=/^span$/i,rs=/^(?:https?|ftps?|mailto|tel|blob|sms|geo|webcal|callto):|^[#/]|^data:image\//i,as=/^(?:href|src)\s*=/i,hs=/=\s*(?:"([^"]*)"|'([^']*)'|(\S+))/,cs=/:/i;function ds(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 rs.test(e)||!cs.test(e)}function us(t){if(!as.test(t))return!0;const e=t.match(hs);if(!e)return!0;return ds(e[1]??e[2]??e[3]??"")}function ps(t,e){return t?"*"===t?"[a-z-]+":e?t+"|"+e:t:"^"}const gs=class{#X;#t;#K;#J;#it;#ht;#Ot;#Rt;#zt;#Ft;#Pt;#Dt;#qt;#Wt;#Ut;#Zt;#Gt;#jt;#Kt;#Yt;#Xt;#Jt;#Qt;#te;#ee;constructor(t){this.#X=t.$,this.#t=t.store;const e=this.#it=this.#X.options;this.#J=this.#X.frameOptions,this.#K=this.#X.frameContext,this.#ht=this.#X.instanceCheck,this.#Rt=function(t){return this.test(t)?t:""}.bind(e.get("allowedClassName")),this.#Kt=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,o={...i,line:e.get("_lineStylesRegExp")};this.#Kt.forEach((t=>{o[t]=e.get("_textStylesRegExp")}));for(const t in o)n.set(new RegExp(`^(${t})$`),o[t]);this.#Gt=new RegExp(`^(${Object.keys(o).join("|")})$`,"i"),this.#jt=n,this.#Ot=new RegExp("\\d+("+e.get("fontSizeUnits").join("|")+")$","i");const l=e.get("_allowedExtraTag"),r=e.get("_disallowedExtraTag");this.#Yt=new RegExp(`<(${r})[^>]*>([\\s\\S]*?)<\\/\\1>|<(${r})[^>]*\\/?>`,"gi"),this.#Xt=new RegExp(`^(${r})$`,"i"),this.#Jt=new RegExp(`^(${l})$`,"i");const a=Object.keys(e.get("_defaultStyleTagMap")),h=e.get("elementWhitelist")?e.get("elementWhitelist").split("|").filter((t=>/b|i|ins|s|strike/i.test(t))):[];for(let t=0;t<h.length;t++)a.splice(a.indexOf(h[t].toLowerCase()),1);this.#Ft=0===a.length?null:new RegExp("(<\\/?)("+a.join("|")+")\\b\\s*([^>^<]+)?\\s*(?=>)","gi");const c=e.get("__defaultAttributeWhitelist");this.#zt=e.get("_editorElementWhitelist").includes("//")||"*"===e.get("_editorElementWhitelist"),this.#Pt=new RegExp("^("+ps(e.get("_editorElementWhitelist").replace("|//",""),"")+")$","i"),this.#Dt=new RegExp("^("+(e.get("elementBlacklist")||"^")+")$","i"),this.#qt=Wt.createElementWhitelist(ps(e.get("_editorElementWhitelist").replace("|//","|\x3c!--|--\x3e"),"")),this.#Wt=Wt.createElementBlacklist(e.get("elementBlacklist").replace("|//","|\x3c!--|--\x3e"));const d='\\s*=\\s*(")[^"]*\\1',u=e.get("attributeWhitelist");let p={},g="";if(u)for(const t in u)/^on[a-z]+$/i.test(u[t])||("*"===t?g=ps(u[t],c):p[t]=new RegExp("\\s(?:"+ps(u[t],c)+")"+d,"ig"));this.#Ut=new RegExp("\\s(?:"+(g||c)+"|data-se-[^\\s]+"+(e.get("v2Migration")?"|data-index|data-file-size|data-file-name|data-exp|data-font-size":"")+")"+d,"ig"),this.#Qt=p;const m=e.get("attributeBlacklist");if(p={},g="",m)for(const t in m)"*"===t?g=ps(m[t],""):p[t]=new RegExp("\\s(?:"+ps(m[t],"")+")"+d,"ig");this.#Zt=new RegExp("\\s(?:"+(g||"^")+")"+d,"ig"),this.#te=p,this.__resetAutoStyleify(e.get("autoStyleify"))}filter(t,{tagWhitelist:e,tagBlacklist:s,validate:i,validateAll:n}){if(e&&(t=t.replace(Wt.createElementWhitelist(e),"")),s&&(t=t.replace(Wt.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.#ht.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.#it.get("strictMode");let d="";if(t=this.compress(t),o&&(t=t.replace(this.#Yt,""),t=this.#se(t,this.#qt,this.#Wt).replace(/<br\/?>$/i,"")),this.#ee){const e=(new DOMParser).parseFromString(t,"text/html");Ut.query.getListChildNodes(e.body,Wt.spanToStyleNode.bind(null,this.#ee),null),t=e.body.innerHTML}(h||c)&&(t=t.replace(/(<[a-zA-Z0-9-]+)[^>]*(?=>)/g,this.#ie.bind(this,h,c)));const u=De.createRange().createContextualFragment(t);if(o)try{this.#ne(u,this.#Pt,this.#Dt,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=Ut.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||ds(String(i)))&&e.setAttribute(t,i);p[t].replaceWith(e)}if(this.#X.pluginManager.applyRetainFormat(u),l){let t=u.childNodes;e||=this.#oe(t),e&&(t=this.#le(u).childNodes);for(let s,i=0,n=t.length;i<n;i++)s=t[i],this.#Jt.test(s.nodeName)?d+=s.outerHTML:d+=this.#re(s,e)}return d||=t,o&&(s&&(d=d.replace("string"==typeof s?Wt.createElementWhitelist(s):s,"")),i&&(d=d.replace("string"==typeof i?Wt.createElementBlacklist(i):i,""))),a&&(d=this.#ae(d)),d}insert(t,{selectInserted:e,skipCharCount:s,skipCleaning:i}={}){this.#K.get("wysiwyg").contains(this.#X.selection.get().focusNode)||this.#X.focusManager.focus(),this.remove(),this.#X.focusManager.focus();let n=null;if("string"==typeof t){i||(t=this.clean(t,{forceFormat:!1,whitelist:null,blacklist:null}));try{if(Ut.check.isListCell(this.#X.format.getLine(this.#X.selection.getNode(),null))){const e=De.createRange().createContextualFragment(t).childNodes;this.#oe(e)&&(t=this.#he(e))}const i=De.createRange().createContextualFragment(t).childNodes;if(!s){const t="byte-html"===this.#J.get("charCounter_type")?"outerHTML":"textContent";let e="";for(let s=0,n=i.length;s<n;s++)e+=i[s][t];if(!this.#X.char.check(e))return}let o,l,r,a,h;for(;o=i[0];)3===a?.nodeType&&1===l?.nodeType&&Ut.check.isBreak(o)?(a=o,Ut.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.#X.selection.setRange(h.container||h,h.startOffset||0,l,c):this.#X.component.is(l)||this.#X.selection.setRange(l,c,l,c)}catch(t){if(this.#K.get("isReadOnly")||this.#K.get("isDisabled"))return;throw Error(`[SUNEDITOR.html.insert.error] ${t.message}`)}}else if(this.#X.component.is(t))this.#X.component.insert(t,{skipCharCount:s,insertBehavior:"none"});else{let e=null;(this.#X.format.isLine(t)||Ut.check.isMedia(t))&&(e=this.#X.format.getLine(this.#X.selection.getNode(),null)),this.insertNode(t,{afterNode:e,skipCharCount:s})}if(this.#t.set("_lastSelectionNode",null),n){const t=Ut.query.getListChildNodes(n,null,null);if(t.length>0){n=t.at(-1);const e=3===n?.nodeType?n.textContent.length:1;this.#X.selection.setRange(n,e,n,e)}else this.#X.focusManager.focus()}else this.#X.focusManager.focus();this.#X.history.push(!1)}insertNode(t,{afterNode:e,skipCharCount:s}={}){let i=null;if(this.#K.get("isReadOnly")||!s&&!this.#X.char.check(t))return i;let n=null,o=null;if(e){const t=this.#X.format.isLine(e)||this.#X.format.isBlock(e)||this.#X.component.is(e)?this.#X.format.addLine(e,null):e;o=this.#X.selection.setRange(t,1,t,1)}else o=this.#X.selection.getRange();let l,r,a,h=Ut.check.isListCell(o.commonAncestorContainer)?o.commonAncestorContainer:this.#X.format.getLine(this.#X.selection.getNode(),null),c=Ut.check.isListCell(h)&&(Ut.check.isListCell(t)||Ut.check.isList(t)),d=null;const u=this.#X.format.isBrLine(h),p=this.#X.format.isLine(t)||this.#X.format.isBlock(t)||this.#X.component.isBasic(t);if(c&&(a=e||Ut.check.isList(t)?h.lastChild:h.nextElementSibling,d=Ut.check.isList(t)?h:(a||h).parentNode),!e&&(p||this.#X.component.isBasic(t)||Ut.check.isMedia(t))){const t=Ut.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&&Ut.check.isListCell(i)&&!h.parentElement)h=Ut.utils.createElement("LI"),d.appendChild(h),i.appendChild(d),a=null;else if(3===i.nodeType||Ut.check.isBreak(i)||c){const n=Ut.query.getParentElement(i,(t=>this.#X.format.isBlock(t)||Ut.check.isListCell(t)));if(e=this.#X.nodeTransform.split(i,s.offset,n?Ut.query.getNodeDepth(n)+1:0))if(c){if(h.contains(i)){const s=Ut.check.isList(h.lastElementChild);let i=null;t||(i=h.cloneNode(!1),i.appendChild(e.textContent.trim()?e:Ut.utils.createTextNode(qt.zeroWidthSpace))),s&&(i||(i=h.cloneNode(!1),i.appendChild(Ut.utils.createTextNode(qt.zeroWidthSpace))),i.appendChild(h.lastElementChild)),i&&(h.parentNode.insertBefore(i,h.nextElementSibling),a=e=i)}}else e=e.previousSibling;else Ut.check.isListCell(h)||(a=e=h)}}o=e||p?this.#X.selection.getRange():this.#X.selection.getRangeAndAddLine(this.#X.selection.getRange(),null);const g=o.commonAncestorContainer,m=o.startOffset,f=o.endOffset,v=o.startContainer===g&&this.#X.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(Ut.check.isBreak(l))e=l,l=l.parentNode;else{const s=l.childNodes[m],i=3===s?.nodeType&&Ut.check.isZeroWidth(s)&&Ut.check.isBreak(s.nextSibling)?s.nextSibling:s;i?!i.nextSibling&&Ut.check.isBreak(i)?(l.removeChild(i),e=null):e=Ut.check.isBreak(i)&&!Ut.check.isBreak(t)?i:i.nextSibling:e=null}else{if(b===y){e=Ut.check.isEdgePoint(y,f)?y.nextSibling:y.splitText(f);let t=b;Ut.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.#X.format.isLine(i)?i.innerHTML="<br>":this.#X.format.isBlock(i)&&(i.innerHTML="<"+this.#it.get("defaultLine")+"><br></"+this.#it.get("defaultLine")+">")),Ut.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 Ut.check.isWysiwygFrame(i)&&!this.#X.format.isLine(t)?(l=i.appendChild(Ut.utils.createElement(this.#it.get("defaultLine"))),e=null):l=(e=p?y:i===n?i.nextSibling:i)&&e.parentNode?e.parentNode:g;for(;e&&!this.#X.format.isLine(e)&&e.parentNode!==g;)e=e.parentNode}}try{const s=this.#K.get("wysiwyg");if(!c){if((Ut.check.isWysiwygFrame(e)||l===s.parentNode)&&(l=s,e=null),this.#X.format.isLine(t)||this.#X.format.isBlock(t)||!Ut.check.isListCell(l)&&this.#X.component.isBasic(t)){const t=l;if(Ut.check.isListCell(e))l=e.previousElementSibling||e;else if(!r&&!e){const t=this.remove(),s=3===t.container.nodeType?Ut.check.isListCell(this.#X.format.getLine(t.container,null))?t.container:this.#X.format.getLine(t.container,null)||t.container.parentNode:t.container,i=Ut.check.isWysiwygFrame(s)||this.#X.format.isBlock(s);l=i?s:s.parentNode,e=i?null:s.nextSibling}0===t.childNodes.length&&l!==t&&Ut.utils.removeItem(t)}if(!p||u||this.#X.format.isBlock(l)||Ut.check.isListCell(l)||Ut.check.isWysiwygFrame(l)||(e=l.nextElementSibling,l=l.parentNode),Ut.check.isWysiwygFrame(l)&&(3===t.nodeType||Ut.check.isBreak(t))){const e=Ut.utils.createElement(this.#it.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,Ut.check.isListCell(t)&&!Ut.check.isList(l)){if(Ut.check.isListCell(l))e=l.nextElementSibling,l=l.parentNode;else{const t=Ut.utils.createElement("ol");l.insertBefore(t,e),l=t,e=null}c=!0}if(this.#ce(t,l),l.insertBefore(t,e),c)if(Ut.check.isZeroWidth(h.textContent.trim()))Ut.utils.removeItem(h),t=t.lastChild;else{const e=Ut.utils.arrayFind(h.children,Ut.check.isList);e&&(t!==e?(t.appendChild(e),t=e.previousSibling):(l.appendChild(t),t=l),Ut.check.isZeroWidth(h.textContent.trim())&&Ut.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),Ut.utils.removeItem(s)}if((this.#X.format.isLine(t)||this.#X.component.isBasic(t))&&b===y){const t=this.#X.format.getLine(g,null);1===t?.nodeType&&Ut.check.isEmptyLine(t)&&Ut.utils.removeItem(t)}if(u&&!Ut.check.isList(t)&&(this.#X.format.isLine(t)||this.#X.format.isBlock(t))&&(t=this.#de(t)),!this.#X.component.isBasic(t)){let e=1;if(3===t.nodeType)e=t.textContent.length,this.#X.selection.setRange(t,e,t,e);else if(!Ut.check.isBreak(t)&&!Ut.check.isListCell(t)&&this.#X.format.isLine(l)){let s=null;t.previousSibling&&!Ut.check.isBreak(t.previousSibling)||(s=Ut.utils.createTextNode(qt.zeroWidthSpace),t.parentNode.insertBefore(s,t)),t.nextSibling&&!Ut.check.isBreak(t.nextSibling)||(s=Ut.utils.createTextNode(qt.zeroWidthSpace),t.parentNode.insertBefore(s,t.nextSibling)),this.#X.inline._isIgnoreNodeChange(t)&&(t=t.nextSibling,e=0),this.#X.selection.setRange(t,e,t,e)}}i=t}return i}remove(){this.#X.selection.resetRangeToTextNode();const t=this.#X.selection.getRange(),e=0===t.startOffset,s=Ut.check.isEdgePoint(t.endContainer,t.endOffset,"end");let i=null,n=null,o=null;e&&(n=this.#X.format.getLine(t.startContainer),i=n?n.previousElementSibling:null,n=n?i:n),s&&(o=this.#X.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(Ut.check.isWysiwygFrame(a)&&Ut.check.isWysiwygFrame(h)){this.set("");return{container:this.#X.selection.getNode(),offset:0,commonCon:u}}if(u===a&&u===h){if(this.#X.component.isBasic(u)){const t=this.#X.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 Ut.utils.removeItem(t),this.#X.format.isLine(e)?0===e.childNodes.length?(Ut.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=Ut.query.getNextDeepestNode(u,this.#K.get("wysiwyg")),e=Ut.query.getPreviousDeepestNode(u,this.#K.get("wysiwyg")),s=this.#X.format.getLine(u);Ut.utils.removeItem(u);let i=t||e,n=t?0:3===i?.nodeType?i.textContent.length:1;const o=this.#X.format.getLine(i)||this.#X.component.get(i);return s!==o&&(i=o,n=0===n?0:1),Ut.check.isZeroWidth(s)&&!s.contains(i)&&Ut.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&&Ut.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=Ut.query.getListChildNodes(u,null,null);let f=Ut.utils.getArrayIndex(m,a),v=Ut.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.#X.format.isLine(u)||this.#X.format.isBlock(u)||Ut.check.isWysiwygFrame(u)||Ut.check.isBreak(u)||Ut.check.isMedia(u))return{container:u,offset:0,commonCon:u};if(Ut.check.isText(u))return{container:u,offset:d,commonCon:u};m.push(u),a=h=u}else if(a=h=m[0],Ut.check.isBreak(a)||Ut.check.isZeroWidth(a))return{container:Ut.check.isMedia(u)?u:a,offset:0,commonCon:u};f=v=0}const b=Ut.check.isText,y=Ut.check.isElement,w=f===v;let C=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)C=this.#ue(e,w);else{if(b(h))g=Ut.utils.createTextNode(h.substringData(d,h.length-d));else{if(this.#X.component.is(h))continue;g=Ut.utils.createTextNode(h.textContent)}g.length>0?h.data=g.data:C=this.#ue(h,w)}else{if(y(a)){if(this.#X.component.is(a))continue;p=Ut.utils.createTextNode(a.textContent)}else{const t=a,s=h;e===h?(p=Ut.utils.createTextNode(t.substringData(0,c)+s.substringData(d,s.length-d)),r=c):p=Ut.utils.createTextNode(t.substringData(0,c))}if(p.length>0?a.data=p.data:C=this.#ue(a,w),e===h)break}else C=this.#ue(e,w)}const _=Ut.query.getParentElement(h,"ul"),x=Ut.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(Ut.utils.createElement("BR")),r=1):r=l.textContent.length:r=0)),this.#X.format.getLine(l)||a&&a.parentNode||(o?(l=o,r=0):n&&(l=n,r=1)),!Ut.check.isWysiwygFrame(l)&&0===l.childNodes.length){const t=this.#X.nodeTransform.removeAllParents(l,null,null);t&&(l=t.sc||t.ec||this.#K.get("wysiwyg"))}return l&&(1!==l.nodeType||this.#X.format.isLine(l)||Ut.check.isBreak(l))||(l=C?.sc||C?.ec,r=3===l?.nodeType?l.textContent.length:1),this.#X.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.#X.facade.changeFrameContext(s[o]);const l=Ut.utils.createElement("DIV",null,this._convertToCode(this.#K.get("wysiwyg"),!0)),r=Ut.check.isTableCell,a=Ut.check.isEmptyLine,h=[],c=[];Ut.query.getListChildren(l,(t=>{t.hasAttribute("contenteditable")&&h.push(t);const e=t.parentElement;return r(e)&&e.children.length<=1&&a(t)&&c.push(e),!1}),null);for(let t=0,e=h.length;t<e;t++)h[t].removeAttribute("contenteditable");for(let t=0,e=c.length;t<e;t++)c[t].innerHTML="<br>";this.#pe(l);const d=l.innerHTML;if(this.#J.get("iframe_fullPage"))if(e){const t=Ut.utils.getAttributesToString(this.#K.get("_wd").body,["contenteditable"]);i=`<!DOCTYPE html><html>${this.#K.get("_wd").head.outerHTML}<body ${t}>${d}</body></html>`}else i=d;else i=t?`<div class="${this.#it.get("_editableClass")+""+(this.#it.get("_rtl")?" se-rtl":"")}">${d}</div>`:l.innerHTML;n[s[o]]=i}return this.#X.facade.changeFrameContext(i),s.length>1?n:n[s[0]]}set(t,{rootKey:e}={}){this.#X.ui.offCurrentController(),this.#X.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.#X.facade.changeFrameContext(e[t]),this.#K.get("isMarkdownView")){const t=Wt.htmlToJson(s);this.#K.get("markdown").value=Kt.jsonToMarkdown(t)}else if(this.#K.get("isCodeView")){const t=this._convertToCode(s,!1);this.#X.viewer._setCodeView(t)}else this.#K.get("wysiwyg").innerHTML=s,this.#X.pluginManager.resetFileInfo(),this.#X.history.push(!1,e[t])}add(t,{rootKey:e}={}){this.#X.ui.offCurrentController(),e?Array.isArray(e)||(e=[e]):e=[this.#t.get("rootKey")];for(let s=0;s<e.length;s++){this.#X.facade.changeFrameContext(e[s]);const i=this.clean(t,{forceFormat:!0,whitelist:null,blacklist:null});if(this.#K.get("isMarkdownView")){const t=Wt.htmlToJson(i);this.#K.get("markdown").value+="\n"+Kt.jsonToMarkdown(t)}else if(this.#K.get("isCodeView"))this.#X.viewer._setCodeView(this.#X.viewer._getCodeView()+"\n"+this._convertToCode(i,!1));else{const t=Ut.utils.createElement("DIV",null,i),n=Array.from(t.children);for(let t=0,e=n.length;t<e;t++)this.#K.get("wysiwyg").appendChild(n[t]);this.#X.history.push(!1,e[s]),this.#X.selection.scrollTo(n.at(-1))}}}getJson({withFrame:t,rootKey:e}={}){return Wt.htmlToJson(this.get({withFrame:t,rootKey:e}))}setJson(t,{rootKey:e}={}){this.set(Wt.jsonToHtml(t),{rootKey:e})}async copy(t){try{return!("string"!=typeof t&&!Ut.check.isElement(t)&&!Ut.check.isText(t))&&(!1===await jt.write(t)?(this.#X.ui.showToast(this.#X.lang.message_copy_fail,this.#it.get("toastMessageTime").copy,"error"),!1):(this.#X.ui.showToast(this.#X.lang.message_copy_success,this.#it.get("toastMessageTime").copy),!0))}catch(t){return console.error("[SUNEDITOR.html.copy.fail] :",t),this.#X.ui.showToast(this.#X.lang.message_copy_fail,this.#it.get("toastMessageTime").copy,"error"),!1}}setFullPage(t,{rootKey:e}={}){if(!this.#J.get("iframe"))return!1;e?Array.isArray(e)||(e=[e]):e=[this.#t.get("rootKey")];for(let s=0;s<e.length;s++)this.#X.facade.changeFrameContext(e[s]),t.head&&(this.#K.get("_wd").head.innerHTML=t.head.replace(this.#Yt,"")),t.body&&(this.#K.get("_wd").body.innerHTML=this.clean(t.body,{forceFormat:!0,whitelist:null,blacklist:null})),this.#X.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?De.createRange().createContextualFragment(t):t,l=t=>this.#X.format.isLine(t)||this.#X.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:Ut.check.isList(u.parentElement)||(s+=Wt.htmlToEntity(/^\n+$/.test(u.data)?"":u.data)):s+="\n\x3c!-- "+u.textContent.trim()+" --\x3e"+p}(o,""),s.trim()+r}#ue(t,e){const s=this.#X.format.getLine(t,null);if(Ut.utils.removeItem(t),!Ut.check.isListCell(s)||e)return;const i=this.#X.nodeTransform.removeAllParents(s,null,null);return Ut.check.isList(s?.firstChild)&&s.insertBefore(Ut.utils.createTextNode(qt.zeroWidthSpace),s.firstChild),i?{sc:i.sc,ec:i.ec}:null}#de(t){const e=t.parentNode;let s,i;for(;this.#X.format.isLine(t)||this.#X.format.isBlock(t);){for(s=t.childNodes,i=null;s[0];)if(i=s[0],this.#X.format.isLine(i)||this.#X.format.isBlock(i)){if(this.#de(i),!t.parentNode)break;s=t.childNodes}else e.insertBefore(i,t);0===t.childNodes.length&&Ut.utils.removeItem(t),t=Ut.utils.createElement("BR"),e.insertBefore(t,i.nextSibling)}return t}#re(t,e){const s=this.#it.get("defaultLine");if(1===t.nodeType){if(this.#Xt.test(t.nodeName))return"";if(Ut.check.isExcludeFormat(t))return t.outerHTML;const i=Ut.query.getListChildNodes(t,(t=>Ut.check.isSpanWithoutAttr(t)&&!Ut.query.getParentElement(t,Ut.check.isExcludeFormat)),null)||[];for(let t,e=i.length-1;e>=0;e--)t=i[e],t.outerHTML=t.innerHTML;if(!e||this.#X.format.isLine(t)||this.#X.format.isBlock(t)||this.#X.component.is(t)||Ut.check.isMedia(t)||Ut.check.isFigure(t)||Ut.check.isAnchor(t)&&Ut.check.isMedia(t.firstElementChild)){const e=t;return Ut.check.isSpanWithoutAttr(t)?e.innerHTML:e.outerHTML}{const e=t;return"<"+s+">"+(Ut.check.isSpanWithoutAttr(t)?e.innerHTML:e.outerHTML)+"</"+s+">"}}if(3===t.nodeType){if(!e)return Wt.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+">"+Wt.htmlToEntity(t)+"</"+s+">");return n}return 8===t.nodeType&&this.#zt?"\x3c!--"+t.textContent.trim()+"--\x3e":""}#ne(t,e,s,i,n,o,l){const r=[],a=[],h=[],c=[],d=Ut.query.getListChildNodes(t,(d=>{if(1!==d.nodeType)return n&&Ut.check.isList(d.parentElement)&&r.push(d),3!==d.nodeType||d.textContent.trim()||r.push(d),!1;if(i&&(s.test(d.nodeName)||!e.test(d.nodeName)&&0===d.childNodes.length&&Ut.check.isExcludeFormat(d)))return r.push(d),!1;"PRE"===d.nodeName&&this.#ge(d);const u=!Ut.query.getParentElement(d,Ut.check.isExcludeFormat);if(n){if(!Ut.check.isTableElements(d)&&!Ut.check.isListCell(d)&&!Ut.check.isAnchor(d)&&(this.#X.format.isLine(d)||this.#X.format.isBlock(d)||this.#X.format.isTextStyleNode(d))&&0===d.childNodes.length&&u)return a.push(d),!1;if(Ut.check.isList(d.parentNode)&&!Ut.check.isList(d)&&!Ut.check.isListCell(d))return h.push(d),!1;if(Ut.check.isTableCell(d)){const t=d.firstElementChild;if(!this.#X.format.isLine(t)&&!this.#X.format.isBlock(t)&&!this.#X.component.is(t))return c.push(d),!1}}if(o&&u&&d.className){const t=Array.from(d.classList).map(this.#Rt).join(" ").trim();t?d.className=t:d.removeAttribute("class")}if(!n)return!1;return!l&&d.parentNode!==t&&u&&(Ut.check.isListCell(d)&&!Ut.check.isList(d.parentNode)||(this.#X.format.isLine(d)||this.#X.component.is(d))&&!this.#X.format.isBlock(d.parentNode)&&!Ut.query.getParentElement(d,this.#X.component.is.bind(this.#X.component)))}),null);for(let t=0,e=r.length;t<e;t++)Ut.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(Ut.query.getParentElement(t,Ut.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],Ut.check.isZeroWidth(t.textContent.trim())&&Ut.utils.removeItem(t);for(let t=0,e=a.length;t<e;t++)Ut.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=Ut.utils.createElement("LI"),this.#X.format.isLine(t)){for(s=t.childNodes;s[0];)e.appendChild(s[0]);i.insertBefore(e,t),Ut.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++)t=c[s],e=Ut.utils.createElement("DIV"),e.innerHTML=0===t.textContent.trim().length&&0===t.children.length?"<br>":t.innerHTML,t.innerHTML=e.outerHTML}#ae(t){if(!this.#Ft)return t;const e=this.#it.get("_defaultStyleTagMap");return t.replace(this.#Ft,((t,s,i,n)=>s+("string"==typeof e[i]?e[i]:i)+(n?" "+n:"")))}#le(t){let e,s="";const i=t.childNodes;for(let t,n=0,o=i.length;n<o;n++)t=i[n],this.#Jt.test(t.nodeName)?s+=t.outerHTML:8===t.nodeType?s+="\x3c!-- "+t.textContent+" --\x3e":/meta/i.test(t.nodeName)||this.#X.format.isLine(t)||this.#X.format.isBlock(t)||this.#X.component.is(t)||Ut.check.isExcludeFormat(t)?(e&&(s+=e.outerHTML,e=null),s+=t.outerHTML):(e||=Ut.utils.createElement(this.#it.get("defaultLine")),this.#X.format.isTextStyleNode(t)&&t.removeAttribute("style"),e.appendChild(t),n--,o--);return e&&(s+=e.outerHTML),De.createRange().createContextualFragment(s)}#he(t){let e="";for(let s,i=0,n=t.length;i<n;i++)s=t[i],1===s.nodeType?Ut.check.isList(s)?e+=s.innerHTML:Ut.check.isListCell(s)?e+=s.outerHTML:this.#X.format.isLine(s)?e+="<li>"+(s.innerHTML.trim()||"<br>")+"</li>":this.#X.format.isBlock(s)&&!Ut.check.isTableElements(s)?e+=this.#he(s.children):e+="<li>"+s.outerHTML+"</li>":e+="<li>"+(s.textContent||"<br>")+"</li>";return e}#oe(t){let e=!1;for(let s,i=0,n=t.length;i<n;i++)if(s=t[i],1===s.nodeType&&!this.#X.format.isTextStyleNode(s)&&!Ut.check.isBreak(s)&&!this.#Xt.test(s.nodeName)){e=!0;break}return e}#me(t,e,s){let i=(t.match(Ge)||[])[0];if(this.#Kt.includes(s)&&!i&&(t.match(Ke)||[])[1]){const e=(t.match(Ye)||[])[1],s=(t.match(Xe)||[])[1],n=(t.match(Je)||[])[1];(e||s||n)&&(i='style="'+(e?"font-size:"+Zt.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.#jt)if(e.test(s)){t=i;break}if(!t)return e;const n=i.replace(Qe,"").match(t);if(!n)return e;const o=[];for(let t,e=0,s=n.length;e<s;e++)if(t=n[e].match(ts),t&&!es.test(t[3])){const e=Wt.kebabToCamelCase(t[1].trim()),s=this.#K.get("wwComputedStyle")[e]?.replace(ss,""),i=t[3].trim();switch(e){case"fontFamily":if(!this.#X.plugins.font||!this.#X.plugins.font.fontArray.includes(i))continue;break;case"fontSize":if(!this.#X.plugins.fontSize)continue;this.#Ot.test(t[0])||(t[0]=t[0].replace((t[0].match(is)||[])[1],Wt.toFontUnit.bind(null,this.#it.get("fontSizeUnits")[0])));break;case"color":if(!this.#X.plugins.fontColor||ns.test(i))continue;break;case"backgroundColor":if(!this.#X.plugins.backgroundColor||ns.test(i))continue}s!==i&&o.push(t[0])}o.length>0&&e.push('style="'+o.join(";")+'"')}return e}#se(t,e,s){return e.test("<font>")&&(t=t.replace(/(<\/?)font(\s?)/gi,"$1span$2")),t.replace(e,"").replace(s,"")}#ce(t,e){const s=t=>{this.#fe(t,e);const i=t.childNodes;for(let t=0,e=i.length;t<e;t++)s(i[t])};s(t)}#fe(t,e){if(!this.#X.format.isTextStyleNode(t))return;const s=(t.style.cssText.match(os)||[]).map((function(t){return t.trim()})),i=t.nodeName;if(ls.test(i)&&0===s.length)return t;const n=this.#X.format;let o=!1;return function e(l){if(!Ut.check.isWysiwygFrame(l)&&n.isTextStyleNode(l)){if(l.nodeName===i){o=!0;const e=l.style.cssText.match(os)||[];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}#ie(t,e,s,i){if(qe.test(s))return s;let n=null;const o=i.match(We)[0].toLowerCase();if(t){const t=this.#te[o];s=s.replace(Ue,""),s=t?s.replace(t,""):s.replace(this.#Zt,"");const e=this.#Qt[o];n=e?s.match(e):s.match(this.#Ut)}if(!e)return s;if("a"===o){const t=s.match(/(?:(?:id|name)\s*=\s*(?:"|')[^"']*(?:"|'))/g);t&&(n||=[],n.push(t[0]))}else n&&Ze.test(n.toString())||(this.#Kt.includes(o)?n=this.#me(s,n,o):this.#X.format.isLine(o)?n=this.#me(s,n,"line"):this.#Gt.test(o)&&(n=this.#me(s,n,o)));if(Ut.check.isMedia(o)||Ut.check.isFigure(o)){const t=s.match(Ge);n||=[],t&&n.push(t[0])}if(n)for(let t,e=0,s=n.length;e<s;e++)t=us(n[e].trim())?n[e]:"",i+=(je.test(t)?"":" ")+t;return i}__resetAutoStyleify(t){if(t.length>0){const e=this.#it.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.#ee=s}else this.#ee=null}_destroy(){this.#jt&&this.#jt.clear()}#ge(t){if(1!==t.children.length||"CODE"!==t.firstElementChild?.nodeName)return;const e=t.firstElementChild,s=(e.className||"").match(/language-(\S+)/);for(s&&(Ut.utils.addClass(t,"language-"+s[1]),t.setAttribute("data-se-lang",s[1]));e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}#pe(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=Ut.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 ms=class{#X;#it;constructor(t){this.#X=t.$,this.#it=this.#X.options}split(t,e,s){if(Ut.check.isWysiwygFrame(t)||this.#X.component.is(t)||!t)return t;if(e&&!Zt.is(e)){const s=t.childNodes;let i=Ut.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),Ut.check.isText(t)){if(r=Ut.query.getPositionIndex(t),(e=Number(e))>=0&&t.length!==e){t.splitText(e);const s=Ut.query.getNodeFromPath([r+1],i);Ut.check.isZeroWidth(s)&&(s.data=qt.zeroWidthSpace)}}else if(1===t.nodeType){if(0===e){for(;t.firstChild;)t=t.firstChild;if(3===t.nodeType){const e=Ut.utils.createTextNode(qt.zeroWidthSpace);t.parentNode.insertBefore(e,t),t=e}}t.previousSibling?t=t.previousSibling:Ut.query.getNodeDepth(t)===s&&(h=!1)}1===t.nodeType&&(a=0);let c=t;for(;Ut.query.getNodeDepth(c)>s;)for(r=Ut.query.getPositionIndex(c)+a,c=c.parentNode,l=n,n=c.cloneNode(!1),o=c.childNodes,l&&(Ut.check.isListCell(n)&&Ut.check.isList(l)&&l.firstElementChild?(n.innerHTML=l.firstElementChild.innerHTML,Ut.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,Ut.check.isList),n.childNodes.length>0?d.insertBefore(n,c):n=c,Ut.check.isListCell(n)&&n.children&&Ut.check.isList(n.children[0])&&n.insertBefore(Ut.utils.createElement("BR"),n.children[0]),0===i.childNodes.length&&Ut.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(!(Ut.check.isBreak(h)||Ut.check.isMedia(h)||Ut.check.isInputElement(h)))if(s&&this.#X.inline._isIgnoreNodeChange(h)||!s&&(Ut.check.isTableElements(h)||Ut.check.isListCell(h)||this.#X.format.isLine(h)&&!this.#X.format.isBrLine(h)))(Ut.check.isTableElements(h)||Ut.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(Ut.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)}}Ut.utils.copyTagAttributes(h,t),t.parentNode.insertBefore(h,t),Ut.utils.removeItem(t)}if(!c){1===h.nodeType&&o(h,l+1,d);break}if(h.nodeName===c.nodeName&&Ut.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;Ut.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.#X.component.is(t))return!1;const e=t.textContent.trim();return 0===e.length||/^(\n|\u200B)+$/.test(e)},function t(s){if(!Ut.check.isWysiwygFrame(s)){const n=s.parentNode;n&&e(s)&&(i={sc:s.previousElementSibling,ec:s.nextElementSibling},Ut.utils.removeItem(s),t(n))}}(t),i}removeEmptyNode(t,e,s){const i=this.#it.get("allowedEmptyTags");e&&=Ut.query.getParentElement(e,(e=>t===e.parentElement));const n=s=>{if(this.#X.format._isNotTextNode(s)||s===e||Ut.check.isNonEditable(s))return 0;if(s===t||!Ut.check.isZeroWidth(s.textContent)||s.firstChild&&Ut.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.#X.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?Ut.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 fs(t){t&&!it(t,"se-blink")&&(nt(t,"se-blink"),o.setTimeout((()=>{ot(t,"se-blink")}),600))}const vs=class{#X;#K;#J;constructor(t){this.#X=t.$,this.#K=this.#X.frameContext,this.#J=this.#X.frameOptions}check(t){const e=this.#J.get("charCounter_max");if(e){const s=this.getLength("string"==typeof t?t:"byte-html"===this.#J.get("charCounter_type")&&1===t.nodeType?t.outerHTML:t.textContent);if(s>0&&s+this.getLength()>e)return fs(this.#K.get("charWrapper")),!1}return!0}getLength(t){return"string"!=typeof t&&(t="byte-html"===this.#J.get("charCounter_type")?this.#K.get("wysiwyg").innerHTML:this.#K.get("wysiwyg").textContent),/byte/.test(this.#J.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)}display(t){const e=(t||this.#K).get("charCounter");e&&o.setTimeout((()=>{e.textContent=String(this.getLength())}),0)}test(t,e){let s=0;t&&(s=this.getLength(t)),this.display();const i=this.#J.get("charCounter_max");if(i>0){let t=!1;const n=this.getLength();if(n>i){if(t=!0,s>0&&e){this.#X.selection.init();const t=this.#X.selection.getRange(),e=t.endOffset-1,s=this.#X.selection.getNode().textContent,i=t.endOffset-1;this.#X.selection.getNode().textContent=s.slice(0,i<0?0:i)+s.slice(t.endOffset,s.length),this.#X.selection.setRange(t.endContainer,e,t.endContainer,e)}}else n+s>i&&(t=!0);if(t&&(fs(this.#K.get("charWrapper")),s>0))return!1}return!0}};const bs=class{#X;#it;#ve=!1;constructor(t){this.#X=t.$,this.#it=this.#X.options,this.keyMap=new Map,this.reverseKeys=new Set}command(t,e,s,i,n,o,l,r){if(this.#ve)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&&!Gt.isSpace(i)||a.enter&&!Gt.isEnter(i)||a.textTrigger&&!t.key.trim()||a.edge&&!o)&&(a.plugin&&"string"==typeof a.method?this.#X.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.#X.commandDispatcher.run(a.command,a.type,a.button),!0)}disable(){this.#ve=!0}enable(){this.#ve=!1}_registerShortcuts(){const t=this.#it.get("shortcuts"),e=this.#it.get("_reverseCommandArray"),s=this.keyMap=new Map,i=this.reverseKeys;for(const n of Object.keys(t)){if(this.#X.plugins[n])continue;re(n.startsWith("_")?"":n,null,t[n],s,e,i)}}_destroy(){this.keyMap.clear(),this.reverseKeys.clear()}},ys=new Map([["__figureInst",null],["__dragInst",null],["__dragHandler",null],["__dragContainer",null],["__dragCover",null],["__dragMove",null],["__overInfo",null]]),ws=ys,{_w:Cs,isMobile:_s,ON_OVER_COMPONENT:xs}=Dt,$s="2147483646",ks="2147483645",Ss="2147483642",Es="2147483641",Ts={left:0,right:0,top:0};const Ms=class{#X;#be;#ye;#we=Ts;#Ce=!1;#_e=!1;#xe=null;#$e=null;#ke=null;#Se=[];#Ee=new Map;constructor(t,e,s,i,n){this.#X=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.#be="function"==typeof i.initMethod?i.initMethod:null,this.#ye={keydown:this.#Te.bind(this),mousedown:this.#Me.bind(this)};for(const t of this.parents)Ut.check.isElement(t)?this.parentsForm.push(t):(t.#Se.push(this),this.parentsForm.push(t.form));this.#X.contextProvider.carrierWrapper.appendChild(s),this.#X.eventManager.addEvent(s,"click",this.#He.bind(this)),this.#X.eventManager.addEvent(s,"mouseenter",this.#Le.bind(this)),this.#X.eventManager.addEvent(s,"mouseleave",this.#Ne.bind(this))}open(t,e,{isWWTarget:s,passive:i,initMethod:n,disabled:o,addOffset:l}={}){if(ys.get("__overInfo")===xs&&(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.#Ee.clear(),i||(this.#X.store.mode.isBalloon?this.#X.toolbar.hide():this.#X.store.mode.isSubBalloon&&this.#X.subToolbar.hide(),this.#X.store.get("hasFocus")||(o??this.disabled?this.#X.ui.setControllerOnDisabledButtons(!0):this.#X.ui.setControllerOnDisabledButtons(!1))),this.currentPositionTarget=e||t,this.isWWTarget=s??this.isWWTarget,"function"==typeof n&&(this.#be=n),i||(this.#X.ui.currentControllerName=this.kind),this.#we={left:0,right:0,top:0,...l},!i){const t=this.isOutsideForm?this.parentsForm:[];this.#X.ui.opendControllers?.forEach((e=>{t.includes(e.form)||(e.form.style.zIndex=Es)})),this.parentsHide&&this.parentsForm.forEach((t=>{t.style.display="none",t.setAttribute("data-se-hidden-by-children","1")}))}this.#Be(),this.#Ae(this.form,this.currentPositionTarget,!1);const r=this.#X.instanceCheck.isRange(t);this.currentTarget=r?null:t,this.#Ie(this.form,t,r,i),Cs.setTimeout((()=>ys.set("__overInfo",!1)),0)}close(t){(t||this.isOpen&&!this.#_e)&&(this.form.removeAttribute("data-se-hidden-by-parent"),this.form.removeAttribute("data-se-hidden-by-children"),this.#Ee.clear(),this.#Ve("close"),this.toTop=!1,this.isOpen=!1,this.#_e=!1,this.__offset={},this.#we=Ts,this.#Oe(),this.#be?.(),this.#Re(),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.#X.component.deselect())}hide(){this.#Ve("hide"),this.form.style.display="none"}show(){this.#Ae(this.form,this.currentPositionTarget,!1)}bringToTop(t){this.toTop=t,this.form.style.zIndex=t?$s:ks}resetPosition(t){this.#Ae(this.form,t||this.currentPositionTarget,!0)}_scrollReposition(){this.form.hasAttribute("data-se-hidden-by-parent")||this.form.hasAttribute("data-se-hidden-by-children")||this.#Ae(this.form,this.currentPositionTarget,!1)&&Cs.setTimeout((()=>{this.#Ve("show")}),0)}#Ve(t){for(const e of this.#Se)if("hide"===t&&"none"!==e.form.style.display){const t=this.#ze(e);e.#Ee.set(this,!0);const s=this.#ze(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.#Ve("show");continue}const t=this.#ze(e);e.#Ee.set(this,!1);const s=this.#ze(e);t&&!s&&(e.form.removeAttribute("data-se-hidden-by-parent"),e.show())}else e[t]?.(!0)}#ze(t){for(const e of t.#Ee.values())if(!0===e)return!0;return!1}async#Ie(t,e,s,i){const n={position:this.position,inst:this,form:t,target:e,isRangeTarget:s,notInCarrier:!this.#X.contextProvider.carrierWrapper.contains(t)};!1!==await this.#X.eventManager.triggerEvent("onBeforeShowController",{caller:this.kind,frameContext:this.#X.frameContext,info:n})&&(t.style.display="block",this.#X.contextProvider.shadowRoot&&(this.#xe=this.#X.eventManager.addEvent(t,"mousedown",(t=>t.stopPropagation()))),i||(this.#X.ui.onControllerContext(),this.#X.store.set("controlActive",!0)),this.isOpen||this.#X.ui.opendControllers.push(n),this.#X.store.set("_preventBlur",!0),this.isOpen=!0,this.host.controllerOn?.(t,e),this.#X.eventManager.triggerEvent("onShowController",{caller:this.kind,frameContext:this.#X.frameContext,info:n}))}#Re(){this.form.style.display="none",this.#X.ui.opendControllers=this.#X.ui.opendControllers.filter((t=>t.form!==this.form)),this.#X.ui.currentControllerName!==this.kind&&this.#X.ui.opendControllers.length>0||(this.#X.ui.setControllerOnDisabledButtons(!1),this.#X.ui.offControllerContext(),this.#X.frameContext.get("lineBreaker_t").style.display=this.#X.frameContext.get("lineBreaker_b").style.display="none",this.#X.store.set("_lastSelectionNode",null),this.#X.ui.currentControllerName="",this.#X.store.set("_preventBlur",!1),Cs.setTimeout((()=>{this.#X.store.set("controlActive",!1)}),0),this.#xe&&=this.#X.eventManager.removeEvent(this.#xe))}#Ae(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.#X.selection.isRange(e)){if(!this.#X.offset.setRangePosition(this.form,e,{position:"bottom"}))return this.hide(),!1}else{const i=this.#X.offset.setAbsPosition(t,e,{addOffset:this.#we,position:this.position,isWWTarget:this.isWWTarget,inst:this,sibling:this.sibling});if(!i)return this.hide(),!1;if(s||!this.sibling||this.siblingMain)this.#Ce=!1;else{const e=t.offsetTop-this.#we.top;"bottom"===i.position?(this.#Ce=!0,t.style.top=e+this.sibling.offsetHeight-1+"px"):(this.#Ce=!1,t.style.top=e-this.sibling.offsetHeight+2+"px")}}return t.style.zIndex=this.toTop?ks:this.#Ce?Ss:Es,t.style.visibility="",!0}#Be(){this.#Oe(),this.#$e=this.#X.eventManager.addGlobalEvent("keydown",this.#ye.keydown,!0),this.#ke=this.#X.eventManager.addGlobalEvent(_s?"click":"mousedown",this.#ye.mousedown,!0)}#Oe(){this.#X.component.__removeGlobalEvent(),this.#$e&&=this.#X.eventManager.removeGlobalEvent(this.#$e),this.#ke&&=this.#X.eventManager.removeGlobalEvent(this.#ke)}#Fe(){if(this.#X.ui.selectMenuOn)return!0;const t=this.#X.ui.opendControllers;for(let e=0;e<t.length;e++)if(t[e].inst===this&&t[e].fixed)return!0;return!1}#Pe(t){if(Ut.check.isWysiwygFrame(t)||t.contains(this.form))return!1;if(Ut.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&&(!!Ut.query.getParentElement(t,".se-controller")||(this.#X.component.isInline(s)?t===s:t?.contains(s)))}#He(t){const e=Ut.query.getEventTarget(t),s=Ut.query.getCommandTarget(e);s&&(t.stopPropagation(),t.preventDefault(),"close"!==s.getAttribute("data-command")?this.host.controllerAction(s):this.close())}#Le(t){if(this.#X.ui.currentControllerName=this.kind,this.parentsForm.length>0&&this.isInsideForm)return;Ut.query.getEventTarget(t).style.zIndex=this.toTop?$s:ks}#Ne(t){if(this.parentsForm.length>0&&this.isInsideForm)return;Ut.query.getEventTarget(t).style.zIndex=this.toTop?ks:this.#Ce?Ss:Es}#Te(t){if(this.#Fe())return;const e=t.code;if(Gt.isCtrl(t)||!Gt.isNonResponseKey(e))return;const s=Ut.query.getEventTarget(t);if(Gt.isEsc(e)){if(this.#Se.some((({isOpen:t})=>t)))return}else{if(this.form.contains(s)||this.#Pe(s))return;if(this.#X.pluginManager.fileInfo.pluginRegExp.test(this.kind))return}this.#De(s),this.close()}#Me(t){const e=Ut.query.getEventTarget(t);this.host?._element?.contains(e)?this.#_e=!0:(this.#_e=!1,e===this.host._element||e===this.currentTarget||this.#Fe()||this.form.contains(e)||this.#Pe(e)||Ut.query.getParentElement(e,".se-line-breaker-component")||(this.#De(e),this.close(!0)))}#De(t){this.#X.frameContext.get("wysiwyg").contains(t)||(this.#X.component.__prevent=!1)}},{_w:Hs}=Dt;const Ls=class{#X;#qe;#We;#Ue;#Ze;#ye;#Ge=null;#je=null;#Ke=null;#$e=null;#Ye=null;#Xe=null;#tt=null;constructor(t,e){this.#X=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.maxHeight=e.maxHeight||"",this.minWidth=e.minWidth||"",this.#qe=/^(left|right)$/.test(this.position)?"left"===this.position?"right":"left":this.position,this.#We=/^(left|right)$/.test(this.subPosition)?"left"===this.subPosition?"right":"left":this.subPosition,this.#Ue="ltr"!==e.dir&&("rtl"===e.dir||null),this.#Ze={mousedown:this.#Je.bind(this),mousemove:this.#Qe.bind(this),click:this.#ts.bind(this),keydown:this.#es.bind(this)},this.#ye={keydown:this.#ss.bind(this),mousedown:this.#Me.bind(this),click:this.#is.bind(this)}}create(t,e){this.form.firstElementChild.innerHTML="",e||=t;let s="";for(let t=0,i=e.length;t<i;t++)t>0&&t%this.splitNum==0&&(this.#ns(s),s=""),s+=`<li class="se-select-item" data-index="${t}">${"string"==typeof e[t]?e[t]:e[t].outerHTML}</li>`;this.#ns(s),this.items=t,this.menus=Array.from(this.form.querySelectorAll("li")),this.menuLen=this.menus.length}on(t,e,s={}){this.#Ge=t,this.#je=Ut.check.isInputElement(t)?t:this.#X.frameContext.get("_ww"),this.#Ke=e;let i="";this.maxHeight&&(i+="max-height:"+this.maxHeight+";overflow-y:auto;"),this.minWidth&&(i+="min-width:"+this.minWidth+";"),this.form=Ut.utils.createElement("DIV",{class:"se-select-menu"+(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.#X.ui.selectMenuOn=!0,this.openMethod?.(),this.#os(),this.#Be();const s=t?t.split("-"):[],i=s[0]||(null!==this.#Ue&&this.#Ue!==this.#X.options.get("_rtl")?this.#qe:this.position),n=s[1]||(null!==this.#Ue&&this.#Ue!==this.#X.options.get("_rtl")?this.#We:this.subPosition);this.#ls(i,n,e),this.isOpen=!0}close(){this.#X.ui.selectMenuOn=!1,Ut.utils.removeClass(this.#Ge,"on"),this.#rs(),this.form?.removeAttribute("style"),this.isOpen=!1,this.closeMethod?.()}getItem(t){return this.items[t]}setItem(t){this.#as(t)}#ns(t){this.form.firstElementChild.innerHTML+=`<ul class="se-list-basic se-list-checked${this.horizontal?" se-list-horizontal":""}">${t}</ul>`}#rs(){this.#hs(),this.#Oe(),this.index=-1,this.item=null,this._onItem&&(Ut.utils.removeClass(this._onItem,"se-select-on"),this._onItem=null)}#cs(t){t=this.index+t;const e=this.menuLen,s=this.index=t>=e?0:t<0?e-1:t;this.#as(s)}#as(t){Ut.utils.removeClass(this.form,"se-select-menu-mouse-move");const e=this.menuLen;for(let s=0;s<e;s++)s===t?Ut.utils.addClass(this.menus[s],"active"):Ut.utils.removeClass(this.menus[s],"active");this.index=t,this.item=this.items[t]}#ls(t,e,s,i){const n=t,o=this.form,l=this.#Ge;o.style.visibility="hidden",o.style.display="block",Ut.utils.removeClass(o,"se-select-menu-scroll"),Ut.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.#X.offset.get(l),g=l.offsetTop,m=p.top,f=l.offsetHeight,v=Ut.utils.getClientSize().h-(m-Hs.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.#X.offset.getGlobal(o).top;const i=t-(m-s)-v-f;i>0&&(u-=i+4,o.style.top=u+"px"),s=this.#X.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.#ls("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";const w=this.#X.offset.getGlobal(o).left;let C=0;switch(c+"-"+(c?n:e)){case"true-left":C=p.left-Hs.scrollX+w,C<0&&(d=d=h+a+1);break;case"true-right":C=Hs.innerWidth-(w+r),C<0&&(d=h-r-1);break;case"false-center":{C=Hs.innerWidth-(w+r),C<0&&(d+=C-4),o.style.left=d+"px";const t=this.#X.offset.getGlobal(o).left;t<0&&(d-=t-4);break}case"false-left":C=Hs.innerWidth-(p.left-Hs.scrollX+r),C<0&&(d+=C-4);break;case"false-right":w<0&&(d-=w-4)}if(s){const t=o.firstElementChild.querySelector(s);t&&(this._onItem=t,Ut.utils.addClass(t,"se-select-on"))}o.style.left=d+"px",o.style.top=u+"px",o.style.visibility=""}#ds(t){this.checkList&&Ut.utils.toggleClass(this.menus[t],"se-checked"),this.#Ke(this.getItem(t))}#os(){this.#hs(),this.#tt={mousedown:this.#X.eventManager.addEvent(this.form,"mousedown",this.#Ze.mousedown),mousemove:this.#X.eventManager.addEvent(this.form,"mousemove",this.#Ze.mousemove),click:this.#X.eventManager.addEvent(this.form,"click",this.#Ze.click),keydown:this.#X.eventManager.addEvent(this.#je,"keydown",this.#Ze.keydown)}}#hs(){this.#tt&&(this.#X.eventManager.removeEvent(this.#tt.mousedown),this.#X.eventManager.removeEvent(this.#tt.mousemove),this.#X.eventManager.removeEvent(this.#tt.click),this.#X.eventManager.removeEvent(this.#tt.keydown),this.#tt=null)}#Be(){this.#Oe(),this.#$e=this.#X.eventManager.addGlobalEvent("keydown",this.#ye.keydown,!0),this.#Ye=this.#X.eventManager.addGlobalEvent("mousedown",this.#ye.mousedown,!0)}#Oe(){this.#$e&&=this.#X.eventManager.removeGlobalEvent(this.#$e),this.#Ye&&=this.#X.eventManager.removeGlobalEvent(this.#Ye),this.#Xe&&=this.#X.eventManager.removeGlobalEvent(this.#Xe)}#es(t){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":t.preventDefault(),t.stopPropagation(),e=1;break;case"Enter":case"Space":this.index>-1?(t.preventDefault(),t.stopPropagation(),this.#ds(this.index)):this.close()}e&&this.#cs(e)}#Je(t){if(Dt.isGecko){const e=Ut.query.getEventTarget(t),s=Ut.query.getParentElement(e,".se-select-item");s&&this.#X.eventManager._injectActiveEvent(s)}}#Qe(t){const e=Ut.query.getEventTarget(t);Ut.utils.addClass(this.form,"se-select-menu-mouse-move");const s=e.getAttribute("data-index");s&&(this.index=Number(s))}#ts(t){let e=Ut.query.getEventTarget(t),s=null;for(;!s&&!/UL/i.test(e.tagName)&&!Ut.utils.hasClass(e,"se-select-menu");)s=e.getAttribute("data-index"),e=e.parentElement;s&&this.#ds(Number(s))}#ss(t){Gt.isEsc(t.code)&&this.close()}#Me(t){const e=Ut.query.getEventTarget(t);this.form.contains(e)||(this.#Ge.contains(e)?Ut.check.isInputElement(e)||(this.#Xe=this.#X.eventManager.addGlobalEvent("click",this.#ye.click,!0)):this.close())}#is(t){this.#Xe=this.#X.eventManager.removeGlobalEvent(this.#Xe),t.target===this.#Ge&&(t.stopPropagation(),this.close())}},{_w:Ns,ON_OVER_COMPONENT:Bs}=Dt,As={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 Is=!1,Vs=!1,Os=0,Rs=0;class zs{#X;#us;#ps;#gs="";#ms="";#fs=0;#vs=0;#bs=0;#ys=0;#ws="__se__float-none|__se__float-left|__se__float-center|__se__float-right";#Cs=!1;#_s={w:"",h:""};#xs=null;constructor(t,e,s,i){this.#X=e,this.kind=t.constructor.key||t.constructor.name,this._alignIcons={none:this.#X.icons.format_float_none,left:this.#X.icons.format_float_left,right:this.#X.icons.format_float_right,center:this.#X.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=Ds(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?Ut.utils.createElement("DIV",{class:"se-controller se-controller-resizing"},i):null}(this,e,s||[]);if(this.controller=n?new Ms(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 Ls(e,{checkList:!1,position:"bottom-center"}),this.selectMenu_align.on(this.alignButton,this.#$s.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 Ls(e,{checkList:!1,position:"bottom-center"}),this.selectMenu_as.on(this.asButton,this.#ks.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=Zt.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 Ls(e,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.selectMenu_resize.on(this.resizeButton,this.#Ss.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.#Es.bind(this),this.__containerResizing=this.#Ts.bind(this),this.__onContainerEvent=null,this.__offContainerEvent=null,this.#us=this.#Ms.bind(this),this.#ps=this.#Hs.bind(this),this.#X.eventManager.addEvent(this.alignButton,"click",this.#Ls.bind(this)),this.#X.eventManager.addEvent(this.asButton,"click",this.#Ns.bind(this)),this.#X.eventManager.addEvent(this.resizeButton,"click",this.#Bs.bind(this)),this.#X.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 Ut.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.#X.eventManager.addEvent(s,"mousedown",this.#As.bind(this))}}))}static CreateContainer(t,e){return Ut.utils.createElement("DIV",{class:"se-component"+(e?" "+e:"")},Ut.utils.createElement("FIGURE",null,t)),zs.GetContainer(t)}static CreateInlineContainer(t,e){return Ut.utils.createElement("SPAN",{class:"se-component se-inline-component"+(e?" "+e:"")},t),zs.GetContainer(t)}static CreateCaption(t,e){const s=Ut.utils.createElement("FIGCAPTION",null,"<div>"+e+"</div>");return t.appendChild(s),s}static GetContainer(t){const e=Ut.query.getParentElement(t,"FIGURE",2),s=Ut.query.getParentElement(t,"SPAN",2),i=e||s,n=Ut.query.getParentElement(t,(t=>t.parentElement===i),0)||t;return{target:n,container:Ut.query.getParentElement(n,zs.is,3)||e,cover:e,inlineCover:Ut.utils.hasClass(s,"se-inline-component")?s:null,caption:Ut.query.getEdgeChild(n.parentElement,"FIGCAPTION",!1),isVertical:Ps(n)}}static GetRatio(t,e,s){let i=0,n=0;if(/\d+/.test(t+"")&&/\d+/.test(e+"")){if((!Zt.is(t)&&String(t).replace(/\d+|\./g,"")||s||"px")===(!Zt.is(e)&&String(e).replace(/\d+|\./g,"")||s||"px")){const s=Zt.get(t,4),o=Zt.get(e,4);i=s/o,n=o/s}}return{w:Zt.get(i,4),h:Zt.get(n,4)}}static CalcRatio(t,e,s,i){if(i?.w&&i?.h&&/\d+/.test(t+"")&&/\d+/.test(e+"")){const n=!Zt.is(t)&&String(t).replace(/\d+|\./g,"")||s||"px",o=!Zt.is(e)&&String(e).replace(/\d+|\./g,"")||s||"px";if(n===o){const s="%"===n?2:0,l=t,r=e;e=Zt.get(i.h*Zt.get(l,s),s)+o,t=Zt.get(i.w*Zt.get(r,s),s)+n}}return{w:t,h:e}}static is(t){return Ut.check.isComponentContainer(t)||/^(HR)$/.test(t?.nodeName)}close(){this.#X.store.set("_preventBlur",!1),Ut.utils.removeClass(this._cover,"se-figure-selected"),this.#X.component.__removeDragEvent(),this.#Is(),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.');ys.get("__overInfo")===Bs&&(i=!0);const l=zs.GetContainer(t),r=l.target;let a=!1;if(!l.container){if(this.#X.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}ys.set("__figureInst",this),this.#Vs(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.#X.offset.getLocal(h),f=(r.getAttribute("data-se-size")||"").split(",");let v=Zt.get(r.style.width,2)||c,b=Zt.get(r.style.height,2)||d;this.isVertical&&([v,b]=[b,v]);const y=zs.GetRatio(v,b,this.sizeUnit),w={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.#gs=w.width,this.#ms=w.height,o)return w;const C=this.#X.frameContext.get("_figure");this.#X.ui.setFigureContainer(C.main),this.#X.ui.opendControllers=this.#X.ui.opendControllers.filter((t=>t.form!==C.main)),C.main.style.top=u+"px",C.main.style.left=p+"px",C.main.style.width=(this.isVertical?d:c)+"px",C.main.style.height=(this.isVertical?c:d)+"px",C.border.style.top="0px",C.border.style.left="0px",C.border.style.width=(this.isVertical?d:c)+"px",C.border.style.height=(this.isVertical?c:d)+"px",this.__offset={left:p+g,top:u+m},this.#X.ui.opendControllers.push({position:"none",form:C.main,target:h,inst:this,notInCarrier:!0});const _=/%$/.test(r.style.width)&&/%$/.test(l.container.style.width)?Zt.get(l.container.style.width,0)/100+"":"";for(let t=0,e=this.percentageButtons.length;t<e;t++)this.percentageButtons[t].getAttribute("data-value")===_?Ut.utils.addClass(this.percentageButtons[t],"active"):Ut.utils.removeClass(this.percentageButtons[t],"active");if(this.captionButton&&(l.caption?Ut.utils.addClass(this.captionButton,"active"):Ut.utils.removeClass(this.captionButton,"active")),C.display.style.display=s||this._inlineCover?"none":"",C.border.style.display=i?"none":"",C.main.style.display="block",ys.get("__overInfo")!==Bs){const t=e?"none":"flex",s=C.handles;for(let e=0,i=s.length;e<i;e++)s[e].style.display=t;if(this.controller){const t=this.getSize(r);Ut.utils.changeTxt(C.display,this.#X.lang["none"===this.align?"basic":this.align]+" ("+t.dw+", "+t.dh+")"),this.#Os(),this.#Rs(),this.#X.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":"")}Ut.utils.removeClass(this._cover,"se-figure-over-selected"),this.controller?.open(C.main,null,{initMethod:this.#us,isWWTarget:!1,addOffset:null}),Ns.setTimeout((()=>ys.set("__overInfo",!1)),0)}else Ut.utils.addClass(this._cover,"se-figure-over-selected");return Ut.utils.addClass(this._cover,"se-figure-selected"),this.#bs=this.#fs=c,this.#ys=this.#vs=d,this._inlineCover||ys.get("__overInfo")===Bs&&!Ut.utils.hasClass(l.container,"se-input-component")||this.#zs(C.main),w}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=Ps(t);let s="",i="",n="",o="";if(!t)return{w:s,h:i,dw:n,dh:o};const l=zs.GetContainer(t),r=l.target;return l.container?(s=/%$/.test(r.style.width)?(l.container&&Zt.get(l.container.style.width,2)||100)+"%":r.style.width,i=l.inlineCover?l.inlineCover.style.height||t.style.height||String(t.height||""):Zt.get(l.cover?.style.paddingBottom,0)>0&&!e?l.cover?.style.height:/%$/.test(r.style.height)&&/%$/.test(r.style.width)?(l.container&&Zt.get(l.container.style.height,2)||100)+"%":r.style.height,s||="auto",i||="auto"):this.#X.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=zs.GetContainer(t);if(!s.cover)return;const i=s.target,n=s.container,o=s.cover;if(/%$/.test(i.style.width)&&"center"===e&&!this.#X.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%":""),Ut.utils.hasClass(n,"__se__float-"+e)||(Ut.utils.removeClass(n,this.#ws),Ut.utils.addClass(n,"__se__float-"+e)),this.autoRatio){const{w:t,h:e}=this.getSize(this._element);this.__setCoverPaddingBottom(t,e)}this.#Os()}convertAsFormat(t,e){t||=this._element,this.as=e||"block";const{container:s,inlineCover:i,target:n}=zs.GetContainer(t),{w:o,h:l}=this.getSize(n),r=n.cloneNode(!1);switch(r.style.width="",r.style.height="",r.removeAttribute("width"),r.removeAttribute("height"),e){case"inline":{if(i)break;this.#X.component.deselect();const t=s.nextElementSibling,e=s.parentElement,n=zs.CreateInlineContainer(r);Ut.utils.addClass(n.container,s.className.split(" ").filter((t=>"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this.#Fs(n,o,l);const a=Ut.utils.createElement(this.#X.options.get("defaultLine"),null,n.container);e.insertBefore(a,t),Ut.utils.removeItem(s);break}case"block":{if(!i)break;this.#X.component.deselect(),this.#X.selection.setRange(s,0,s,1);const t=this.#X.html.remove(),e=this.#X.nodeTransform.split(t.container,t.offset,0);e?.previousElementSibling&&Ut.check.isZeroWidth(e.previousElementSibling)&&Ut.utils.removeItem(e.previousElementSibling);const n=zs.CreateContainer(r);Ut.utils.addClass(n.container,s.className.split(" ").filter((t=>"se-inline-component"!==t&&"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this.#Fs(n,o,l),(e||t.container).parentElement.insertBefore(n.container,e);break}}return r}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=Fs(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)Ut.utils.removeItem(this._caption),Ns.setTimeout(this.#X.component.select.bind(this.#X.component,n,this.kind),0),this._caption=null;else{const t=zs.CreateCaption(this._cover,this.#X.lang.caption),e=Ut.query.getEdgeChild(t,(t=>3===t.nodeType),!1);e?this.#X.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.#X.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.#X.history.push(!1),/^remove|caption$/.test(e)||this.#X.component.select(n,this.kind))}}retainFigureFormat(t,e,s,i){const n=this.#X.component.isInline(t),o=e.parentNode;let l=this.#X.format.isBlock(o)||Ut.check.isWysiwygFrame(o)?e:zs.GetContainer(e)?.container||o||e;if(Ut.query.getParentElement(e,Ut.check.isExcludeFormat))l=s&&s!==e?s:e,l.parentNode.replaceChild(t,l);else if(n&&this.#X.format.isLine(l)){const s=n&&/^SPAN$/i.test(e.parentElement.nodeName)?e.parentElement:e;s.parentElement.replaceChild(t,s)}else if(Ut.check.isListCell(l)){const s=Ut.query.getParentElement(e,(t=>t.parentNode===l));l.insertBefore(t,s),Ut.utils.removeItem(e),this.#X.nodeTransform.removeEmptyNode(s,null,!0)}else if(this.#X.format.isLine(l)){const s=Ut.query.getParentElement(e,(t=>t.parentNode===l));l=this.#X.nodeTransform.split(l,s),l.parentNode.insertBefore(t,l),Ut.utils.removeItem(e),this.#X.nodeTransform.removeEmptyNode(l,null,!0)}else if(this.#X.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||Ut.check.isZeroWidth(l))&&Ut.utils.removeItem(l)}else l=Ut.check.isFigure(l.parentNode)?Ut.query.getParentElement(l.parentNode,zs.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.#Ps(e),this._applySize(s[0]||"auto",s[1]||"","")}setTransform(t,e,s,i){try{this.#Cs=!0;const n=Fs(t),o=n.r+1*(i||0);i=Math.abs(o)>=360?0:o;const l=this.isVertical=Ps(i);e=Zt.get(e,0),s=Zt.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=zs.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.#Ds(),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.#qs(r)}finally{this.#Cs=!1}}_displayResizeHandles(t){const e=t?"flex":"none";this.controller&&(this.controller.form.style.display=e);const s=this.#X.frameContext.get("_figure"),i=s.handles;for(let t=0,s=i.length;t<s;t++)i[t].style.display=e;"none"===e?(Ut.utils.addClass(s.main,"se-resize-ing"),this.#xs=this.#X.eventManager.addGlobalEvent("keydown",this.#ps)):Ut.utils.removeClass(s.main,"se-resize-ing")}#Fs(t,e,s){const i=this.kind;t.target.onload=()=>this.#X.component.select(t.target,i),this.#Vs(t),t.inlineCover&&(this.setAlign(t.target,"none"),this.deleteTransform()),this.setFigureSize(e,s)}#Vs(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=Ps(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=Zt.is(t)?t+this.sizeUnit:t,/%$/.test(t)||/%$/.test(e)||i||n||this.#Ds();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=Zt.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.#Ws()}__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)?Zt.get(Zt.get(e,2)/100*Zt.get(t,2),2)+"%":e:this._cover.style.paddingBottom=e)}_setAutoSize(){this._caption&&(this._caption.style.marginTop=""),this.deleteTransform(),this.#Ds(),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.#Ws()}_setPercentSize(t,e){e||=this.autoRatio?/%$/.test(this.autoRatio.current)?this.autoRatio.current:this.autoRatio.default:e,e=!e||/%$/.test(e+"")||Zt.get(e,0)?Zt.is(e)?e+this.sizeUnit:e||(this.autoRatio?this.autoRatio.default:""):Zt.is(e)?e+"%":e;const s=/%$/.test(e+"");this._container.style.width=String(Zt.is(t)?t+"%":t),this._container.style.height="",this._element!==this._cover||this.#X.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.#qs(this._element),this.#Ws()):this.#Ws()}#Ds(){this._cover&&(this._cover.style.width="",this._cover.style.height=""),this._container.style.width="",this._container.style.height="",Ut.utils.removeClass(this._container,this.#ws),Ut.utils.addClass(this._container,"__se__float-"+this.align),"center"===this.align&&this.setAlign(this._element,this.align)}_setRevert(){this.setFigureSize(this.#_s.w,this.#_s.h)}#Os(){this.alignButton&&Ut.utils.changeElement(this.alignButton.firstElementChild,this._alignIcons[this.align])}#Rs(){this.asButton&&Ut.utils.changeElement(this.asButton.firstElementChild,this.#X.icons[`as_${this.as}`])}#Ws(){if(this.#Cs)return;const t=(this._element.getAttribute("data-se-size")||",").split(",");this.#_s.w=t[0],this.#_s.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:"")}#qs(t){const e=Ut.query.getEdgeChild(Ut.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="")}#Ps(t){const e=Ut.query.getEdgeChild(Ut.query.getParentElement(t,"FIGURE"),"FIGCAPTION",!1);e&&(e.style.marginTop="")}#Us(){this.#X.component.__removeDragEvent(),this.#Is(),this._displayResizeHandles(!0),this.#X.ui.offCurrentController(),this.#X.ui.disableBackWrapper()}#Is(){this.#X.eventManager.removeGlobalEvent(this.__onContainerEvent),this.#X.eventManager.removeGlobalEvent(this.__offContainerEvent),this.#X.eventManager.removeGlobalEvent(this.#xs)}#zs(t){const e=this.#X.frameContext.get("wrapper").querySelector(".se-drag-handle");Ut.utils.removeClass(e,"se-drag-handle-full"),e.style.opacity="",e.style.width="",e.style.height="",ys.set("__dragHandler",e),ys.set("__dragContainer",this._container),ys.set("__dragCover",this._cover),ys.set("__dragMove",this.#Zs.bind(this,e,t)),ys.get("__dragMove")(),e.style.display="block"}#Zs(t,e){t.style.display="block",t.style.left=e.offsetLeft+(this.#X.options.get("_rtl")?t.offsetWidth:e.offsetWidth-1.5*t.offsetWidth)+"px",t.style.top=e.offsetTop-t.offsetHeight+.5+"px"}#As(t){t.stopPropagation(),t.preventDefault();const e=ys.get("__figureInst");if(!e)return;const s=Ut.query.getEventTarget(t),i=e._resize_direction=s.classList[0];e._resizeClientX=t.clientX,e._resizeClientY=t.clientY,this.#X.frameContext.get("_figure").main.style.float=/l/.test(i)?"right":/r/.test(i)?"left":"none",this.#X.ui.enableBackWrapper(As[i]);const{w:n,h:o,dw:l,dh:r}=this.getSize(e._element);if(Is=Vs=!1,Os=Rs=0,!this.isVertical){const t=!n||/auto|%$/.test(n),s=!o||/auto|%$/.test(o);if("tl|bl|tr|br".includes(i)&&t&&s?Is=!0:"lw|rw".includes(i)&&t&&(Vs=!0),Is||Vs){const t=e._cover||e._element;Rs=t.offsetWidth,Os=Wt.getWidthInPercentage(t,this.#X.frameContext.get("wysiwygFrame"))/100}}e.__onContainerEvent=this.#X.eventManager.addGlobalEvent("mousemove",e.__containerResizing),e.__offContainerEvent=this.#X.eventManager.addGlobalEvent("mouseup",e.__containerResizingOff),e._displayResizeHandles(!1);const a=this.#X.frameContext.get("_figure").display;a.style.display="block",Ut.utils.changeTxt(a,l+" * "+r)}#Ts(t){const e=this._resize_direction,s=t.clientX,i=t.clientY,n=this.isVertical;let o=n?this.#ys:this.#bs,l=n?this.#bs:this.#ys;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.#X.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.#gs:Math.round(o),u=!n&&/w$/.test(e)?this.#ms:Math.round(l),p=Os?d/Rs*Os*100:d;Ut.utils.changeTxt(this.#X.frameContext.get("_figure").display,Os?Zt.get(p>100?100:p,2).toFixed(2)+"%":p+" * "+u),this.#fs=d,this.#vs=u}#Es(){this.#Us();let t=this.isVertical?this.#vs:this.#fs,e=this.isVertical?this.#fs:this.#vs;if(t=Math.round(t)||t,e=Math.round(e)||e,!this.isVertical&&!/%$/.test(t+"")){const s=this.#X.frameContext.get("wysiwygFrame").clientWidth-Zt.get(this.#X.frameContext.get("wwComputedStyle").getPropertyValue("padding-left"))+Zt.get(this.#X.frameContext.get("wwComputedStyle").getPropertyValue("padding-right"))-2;Zt.get(t,0)>s&&(e=Math.round(e/t*s),t=s)}if(Is||Vs){t=t/(this._cover||this._element).offsetWidth*Os*100;const e=Zt.get(t>100?100:t,2)+"%";this._setPercentSize(e,Vs?this.getSize(this._element).h:"")}else this._applySize(t,e,this._resize_direction),this.isVertical&&this.setTransform(this._element,t,e,0);this.#X.history.push(!1),this.#X.component.select(this._element,this.kind)}#Hs(t){Gt.isEsc(t.code)&&(this.#Us(),this.#X.component.select(this._element,this.kind))}#$s(t){this.setAlign(this._element,t),this.selectMenu_align.close(),this.#X.component.select(this._element,this.kind)}#ks(t){this.convertAsFormat(this._element,t),this.selectMenu_as.close()}#Ss(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!==Zt.get(e,0)&&/%$/.test(e)?e:"")}this.selectMenu_resize.close(),this.#X.component.select(this._element,this.kind)}#Ms(){const t=this.#X.frameContext.get("_figure");t.main.style.display="none",this.#X.ui.setFigureContainer(null),this.#X.ui.opendControllers=this.#X.ui.opendControllers.filter((e=>e.form!==t.main))}#Ls(){this.selectMenu_align.open("",'[data-command="'+this.align+'"]')}#Ns(){this.selectMenu_as.open("",'[data-command="'+this.as+'"]')}#Bs(){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=Zt.get(e);i=100===t?"auto":"resize_percent"+t}}else"auto"===s&&("auto"===e?i="auto":/%$/.test(e)&&(i="resize_percent"+Zt.get(e)));this.selectMenu_resize.open("",'[data-command="'+i+'"]')}}function Fs(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 Ps(t){return/^(90|270)$/.test(Math.abs(Zt.is(t)?t:Fs(t).r).toString())}function Ds(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:Zt.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 qs=zs,{_w:Ws,ON_OVER_COMPONENT:Us,isMobile:Zs}=Dt,Gs=/^Arrow(Left|Up|Right|Down)$/,js=/^Arrow(Left|Up)$/;function Ks(t,e,s){t.preventDefault(),t.stopPropagation(),Ys(e),s.setData("text/html",e.outerHTML)}function Ys(t){Ut.utils.removeClass(t,"se-component-selected"),Ut.utils.removeClass(t.querySelectorAll(".se-figure-selected"),"se-figure-selected"),Ut.utils.removeClass(t.querySelectorAll(".se-selected-table-cell"),"se-selected-table-cell"),Ut.utils.removeClass(t.querySelector(".se-selected-cell-focus"),"se-selected-cell-focus")}const Xs=class{#F;#X;#t;#Gs;#st;#it;#K;#js;#Ks;#Ys=null;#Xs=null;#Js=null;#Ye=null;constructor(t){this.#F=t,this.#X=t.$,this.#t=t.store,this.#Gs=this.#X.contextProvider,this.#st=this.#Gs.carrierWrapper,this.#it=this.#X.options,this.#K=this.#X.frameContext,this.#js=this.#X.eventManager,this.info=null,this.isSelected=!1,this.currentTarget=null,this.currentPlugin=null,this.currentPluginName="",this.currentInfo=null,this.#Ks={copy:this.#Qs.bind(this),cut:this.#ti.bind(this),keydown:this.#ei.bind(this),mousedown:this.#Me.bind(this)},this.__selectionSelected=!1,this.__prevent=!1}_init(){this.#Gs.applyToRoots((t=>{const e=Ut.utils.createElement("DIV",{class:"se-drag-handle",draggable:"true"},this.#Gs.icons.selection);t.get("wrapper").appendChild(e),this.#js.addEvent(e,"mouseenter",this.#si.bind(this)),this.#js.addEvent(e,"mouseleave",this.#ii.bind(this)),this.#js.addEvent(e,"dragstart",this.#ni.bind(this)),this.#js.addEvent(e,"dragend",this.#oi.bind(this)),this.#js.addEvent(e,"click",this.#li.bind(this))}))}insert(t,{skipCharCount:e=!1,skipHistory:s=!1,scrollTo:i=!0,insertBehavior:n}={}){if(this.#K.get("isReadOnly")||!e&&!this.#X.char.check(t))return null;void 0===n&&(n=this.#it.get("componentInsertBehavior"));const o=this.#X.html.remove(),l=this.isInline(t);this.#X.selection.getRangeAndAddLine(this.#X.selection.getRange(),o.container);const r=this.#X.selection.getNode();let a=null,h=this.#X.format.getLine(r,null);try{if(Ut.check.isListCell(h))this.#X.html.insertNode(t,{afterNode:l?null:Ut.check.isZeroWidth(r)?(r||o.container||{}).nextSibling:null,skipCharCount:!0}),l||t.nextSibling||t.parentNode.appendChild(Ut.utils.createElement("BR"));else{if(!l&&this.#X.selection.getRange().collapsed&&(3===o.container?.nodeType||Ut.check.isBreak(o.container))){const t=Ut.query.getParentElement(o.container,this.#X.format.isBlock.bind(this.#X.format));a=this.#X.nodeTransform.split(o.container,o.offset,t?Ut.query.getNodeDepth(t)+1:0),a&&(h=a.previousSibling)}this.#X.html.insertNode(t,{afterNode:l||this.#X.format.isBlock(h)?null:h,skipCharCount:!0}),!l&&h&&Ut.check.isZeroWidth(h)&&Ut.utils.removeItem(h)}if(l){const e=Ut.utils.createTextNode(qt.zeroWidthSpace);t.parentNode.insertBefore(e,t.nextSibling)}}catch(t){console.error("Component insert error:",t)}s||this.#X.history.push(!1),this.#K.has("documentType_use_header")&&this.#K.get("documentType").reHeader();const c=a||t;return i&&this.#X.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.#X.selection.getNearRange(t);e?this.#X.selection.setRange(e.container,e.offset,e.container,e.offset):this.select(i.target,i.pluginName)}else switch(s){case"auto":this.#ri(t)||this.select(i.target,i.pluginName);break;case"select":this.#X.selection.setRange(t,0,t,0),i?this.select(i.target,i.pluginName):e&&(e=Ut.query.getEdgeChildNodes(e,null).sc||e,this.#X.selection.setRange(e,0,e,0));break;case"line":if(!this.#ri(t)){const e=this.#X.format.addLine(t,null);e&&this.#X.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(Ut.check.isComponentContainer(t)&&!Ut.utils.hasClass(t,"se-inline-component")&&(t=t.firstElementChild||t),/^FIGURE$/i.test(t.nodeName)&&(t=t.firstElementChild),!t)return null;const n=this.#X.pluginManager.findComponentInfo(t);if(!n)return null;e=n.target,s=n.pluginName,i=n.options,o=n.launcher}if(!e&&t.nodeName){this.#ai(t)&&(n=!0);const l=this.#X.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=qs.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:Ut.utils.hasClass(r,"se-input-component")}}select(t,e,{isInput:s=!1}={}){const i=this.get(t);if(!i||Ut.check.isUneditable(Ut.query.getParentElement(t,this.is.bind(this)))||Ut.check.isUneditable(t))return!1;const n=i.launcher||this.#X.plugins[e];if(!n)return;const o=ws.get("__overInfo")!==Us;if(!s&&o){if(this.#t.get("_mousedown"))return;this.#t.set("_preventBlur",!0),this.__selectionSelected=!0,this.isInline(i.container)&&this.#X.selection.setRange(i.container,0,i.container,0),this.#X.focusManager.blur(),Ws.setTimeout((()=>{this.__selectionSelected=!1}))}let l;this.isSelected=!0,this.__prevent=!0,"function"==typeof n.componentSelect&&(l=n.componentSelect(t));const r=Ut.utils.hasClass(i.target,"se-component-line-break");(r||!l&&!Ut.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,ws.set("__dragInst",this);const a=ws.get("__overInfo");if(Ws.setTimeout((()=>{ws.set("__overInfo",a===Us&&void 0),a!==Us&&this.#Be(),i.isFile||this.#hi(),Ut.utils.addClass(i.container,"se-component-selected")}),0),!o||this.#t.get("hasFocus")||this.#t.get("_preventFocus")||(this.#F._eventOrchestrator.__postFocusEvent(this.#K,null),this.#t.set("_preventFocus",!0)),r||a===Us){if(r||!Ut.utils.hasClass(i.container,"se-input-component")){const t=this.#K.get("wrapper").querySelector(".se-drag-handle");Ut.utils.addClass(t,"se-drag-handle-full"),this.#X.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.#X.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",ws.set("__dragHandler",t),ws.set("__dragContainer",i.container),ws.set("__dragCover",i.cover),t.style.display="block"}}else{if(!this.isInline(i.container))return;const t=i.container;let e=null;t.previousSibling&&!Ut.check.isBreak(t.previousSibling)||(e=Ut.utils.createTextNode(qt.zeroWidthSpace),t.parentNode.insertBefore(e,t)),t.nextSibling&&!Ut.check.isBreak(t.nextSibling)||(e=Ut.utils.createTextNode(qt.zeroWidthSpace),t.parentNode.insertBefore(e,t.nextSibling)),this.#t.set("controlActive",!0)}}deselect(){Ws.setTimeout((()=>{this.#t.set("controlActive",!1)}),0),this.__deselect(),this.#X.ui.setControllerOnDisabledButtons(!1),!this.#t.get("_preventFocus")||this.#t.get("hasFocus")||this.__prevent||(this.#F._eventOrchestrator.__postBlurEvent(this.#K,null),this.#t.set("_preventFocus",!1))}is(t){return!!t&&(!(!/^FIGURE$/i.test(t.nodeName)&&!Ut.check.isComponentContainer(t))||!!this.#X.pluginManager.findComponentInfo(t))}isInline(t){if(!t)return!1;if(/^FIGURE$/i.test(t.nodeName)&&(t=t.parentElement),Ut.utils.hasClass(t,"se-inline-component"))return!0;return!(!this.#X.pluginManager.findComponentInfo(t)||!Ut.utils.hasClass(t,"se-inline-component")&&!Ut.utils.hasClass(t.parentElement,"se-inline-component"))}isBasic(t){return this.is(t)&&!this.isInline(t)}async copy(t){const e=Ut.utils.clone(t,!0);Ys(e),!1!==await this.#X.html.copy(e)&&Ut.utils.flashClass(t,"se-copy")}hoverSelect(t){const e=Ut.query.getParentElement(t,Ut.check.isFigure);let s=this.get(t);s||e?(s||=this.get(e),s&&!Ut.utils.hasClass(s.container,"se-component-selected")&&(this.#X.ui.offCurrentController(),ws.set("__overInfo",Us),this.select(s.target,s.pluginName))):null===ws.get("__overInfo")||Ut.utils.hasClass(t,"se-drag-handle")||(this.__deselect(),ws.set("__overInfo",null))}__deselect(){if(this.#t.set("_preventBlur",!1),ws.set("__overInfo",null),this.__removeDragEvent(),this.currentInfo){const t=this.currentInfo.container,e=this.currentInfo.cover;Ws.setTimeout((()=>{Ys(t),Ut.utils.removeClass(e,"se-figure-over-selected")}),0)}this.#K.get("lineBreaker_t")&&(this.#K.get("lineBreaker_t").style.display=this.#K.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.#X.ui._offControllers()}_setComponentLineBreaker(t){const e=ws.get("__overInfo")===Us;this.#F._eventOrchestrator._lineBreakComp=null;const s=this.get(t);if(!s)return;const i=this.#K,n=s.container,o=Ut.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.#X.ui.getVisibleFigure()||c,u=Ut.check.isListCell(n.parentNode);let p,g;const m=this.#it.get("_rtl"),f=m?["right","left"]:["left","right"],{top:v,left:b,right:y,scrollX:w,scrollY:C}=this.#X.offset.getLocal(c),_=m?y:b;if(u?!Ut.check.isBreak(n.previousElementSibling)&&!n.previousSibling?.textContent?.trim()||this.is(n.previousElementSibling):!this.#X.format.isLine(n.previousElementSibling)){const t=Ws.getComputedStyle(l),s=Zt.get(t.height,1),i=Zt.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",C+","+w),e?Ut.utils.removeClass(l,"se-on-selected"):Ut.utils.addClass(l,"se-on-selected"),a.display="block",a.visibility=""}else a.display="none";if(u?!Ut.check.isBreak(n.nextElementSibling)&&!n.nextSibling?.textContent?.trim()||this.is(n.nextElementSibling):!this.#X.format.isLine(n.nextElementSibling)){const t=Ws.getComputedStyle(r),s=Zt.get(t.height,1),i=Zt.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",C+","+f[0]+","+w),e?Ut.utils.removeClass(r,"se-on-selected"):Ut.utils.addClass(r,"se-on-selected"),h.display="block",h.visibility=""}else h.display="none"}__removeGlobalEvent(){this.#ci(),this.#Ys&&=this.#js.removeGlobalEvent(this.#Ys),this.#Xs&&=this.#js.removeGlobalEvent(this.#Xs),this.#Js&&=this.#js.removeGlobalEvent(this.#Js)}__removeDragEvent(){this.#st.querySelector(".se-drag-cursor").style.left="-10000px",ws.get("__dragHandler")&&(ws.get("__dragHandler").style.display="none"),Ut.utils.removeClass([ws.get("__dragHandler"),ws.get("__dragContainer")],"se-dragging"),Ut.utils.removeClass([ws.get("__dragCover"),ws.get("__dragContainer")],"se-drag-over"),ws.set("__figureInst",null),ws.set("__dragInst",null),ws.set("__dragHandler",null),ws.set("__dragContainer",null),ws.set("__dragCover",null),ws.set("__dragMove",null),ws.set("__overInfo",null)}#Be(){this.__removeGlobalEvent(),this.#Ys=this.#js.addGlobalEvent("copy",this.#Ks.copy),this.#Xs=this.#js.addGlobalEvent("cut",this.#Ks.cut),this.#Js=this.#js.addGlobalEvent("keydown",this.#Ks.keydown)}#hi(){this.#ci(),this.#Ye=this.#js.addGlobalEvent(Zs?"click":"mousedown",this.#Ks.mousedown,!0)}#ci(){this.#Ye&&=this.#js.removeGlobalEvent(this.#Ye)}#ri(t){const e=t.nextElementSibling;if(!e){const e=this.#X.format.addLine(t,null);return e&&this.#X.selection.setRange(e,0,e,0),!0}return!!this.#X.format.isLine(e)&&(this.#X.selection.setRange(e,0,e,0),!0)}#ai(t){const e=t.nodeName.toLowerCase();return this.#X.pluginManager.fileInfo.regExp.test(e)&&(!this.#X.pluginManager.fileInfo.tagAttrs[e]||this.#X.pluginManager.fileInfo.tagAttrs[e]?.every((e=>t.hasAttribute(e))))}#si(){this.#t.set("_preventBlur",!0),this.#X.ui._visibleControllers(!1,Ut.utils.hasClass(ws.get("__dragHandler"),"se-drag-handle-full")),Ut.utils.addClass(ws.get("__dragCover")||ws.get("__dragContainer"),"se-drag-over")}#ii(){this.#t.set("_preventBlur",!1),Ut.utils.hasClass(ws.get("__dragHandler"),"se-drag-handle-full")||this.#X.ui._visibleControllers(!0,!0),Ut.utils.removeClass([ws.get("__dragCover"),ws.get("__dragContainer")],"se-drag-over")}#ni(t){const e=ws.get("__dragCover")||ws.get("__dragContainer");e?(this.#t.set("_preventBlur",!1),Ut.utils.addClass(ws.get("__dragHandler"),"se-dragging"),Ut.utils.addClass(ws.get("__dragContainer"),"se-dragging"),t.dataTransfer.setDragImage(e,this.#it.get("_rtl")?e.offsetWidth:-5,-5)):t.preventDefault()}#oi(){this.#t.set("_preventBlur",!1),Ut.utils.removeClass([ws.get("__dragHandler"),ws.get("__dragContainer")],"se-dragging"),this.__removeDragEvent()}#li(t){const e=Ut.query.getEventTarget(t);if(!Ut.utils.hasClass(e,"se-drag-handle-full"))return;const s=ws.get("__dragInst");s&&(this.__removeDragEvent(),this.select(s.currentTarget,s.currentPluginName))}#Me(t){const e=Ut.query.getEventTarget(t);this.currentTarget?.contains(e)||Ut.query.getParentElement(e,".se-controller")||Ut.utils.hasClass(e,"se-drag-handle")||this.currentPluginName===this.#X.ui.currentControllerName&&this.#X.ui.opendControllers.some((({form:t})=>t.contains(e)))||this.deselect()}#Qs(t){const e=Ut.query.getEventTarget(t);if(Ut.check.isInputElement(e)&&Ut.query.getParentElement(e,".se-modal"))return;const s=this.info;if(!s)return;const i=s.container.cloneNode(!0);"function"==typeof this.#X.plugins[s.pluginName]?.componentCopy&&!1!==this.#X.plugins[s.pluginName].componentCopy({event:t,cloneContainer:i,info:s})||Ks(t,i,t.clipboardData),Ut.utils.flashClass(s.container,"se-copy")}#ti(t){const e=this.info;if(!e)return;const s=e.container.cloneNode(!0);Ut.utils.removeClass(s,"se-component-selected"),Ks(t,s,t.clipboardData),this.deselect(),Ut.utils.removeItem(e.container)}async#ei(t){if(this.#X.ui.selectMenuOn)return;const e=t.code;if(Gt.isCtrl(t)){if("ControlRight"!==e&&"ControlLeft"!==e){const s=this.#X.shortcuts.keyMap.get(e+(t.shiftKey?"1000":""));/^(redo|undo)$/.test(s?.command)&&(t.preventDefault(),t.stopPropagation(),this.#X.commandDispatcher.run(s.command,s.type,s.button))}}else if(!Gt.isRemoveKey(e)||(t.preventDefault(),t.stopPropagation(),"function"!=typeof this.currentPlugin?.componentDestroy||this.info.isInputType&&this.#t.get("hasFocus"))){if(Gt.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=Ut.check.isListCell(s.parentNode)?Ut.utils.createElement("BR"):Ut.utils.createElement(this.#X.format.isLine(i)?i.nodeName:this.#it.get("defaultLine"),null,"<br>");const o=this.currentPluginName;return this.deselect(),s.parentNode.insertBefore(n,s),!1===this.select(e.target,o)&&this.#X.focusManager.blur(),void this.#X.history.push(!1)}if(Gs.lastIndex=0,Gs.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.#X.format.getLine(s,null);i=t?.previousElementSibling,n=0;break}case"ArrowDown":{const t=this.#X.format.getLine(s,null);i=t?.nextElementSibling;break}}else js.lastIndex=0,js.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.#X.selection.setRange(i,n,i,n)}finally{this.#t.set("_preventBlur",!1)}}else Gt.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.#X.selection.setRange(t,e,t,e)}else this.#X.focusManager.focus()}}_destroy(){this.__removeGlobalEvent(),this.__removeDragEvent()}};const Js=class{#F;#X;#di;#Gs;#it;#ui;#pi;#gi=[];#mi=[];#fi={tags:null,regExp:null,pluginRegExp:null,pluginMap:null};#vi=[];#bi=new Map;#yi=new Map([["onMouseMove",[]],["onMouseLeave",[]],["onMouseDown",[]],["onMouseUp",[]],["onScroll",[]],["onClick",[]],["onBeforeInput",[]],["onInput",[]],["onKeyDown",[]],["onKeyUp",[]],["onFocus",[]],["onBlur",[]],["onPaste",[]],["onFilePasteAndDrop",[]]]);constructor(t,e){this.#F=t,this.#X=t.$,this.#di=e.plugins||{},this.#Gs=this.#X.contextProvider,this.#it=this.#X.options,this.#ui=e.pluginCallButtons,this.#pi=e.pluginCallButtons_sub}get plugins(){return this.#di}get fileInfo(){return this.#fi}findComponentInfo(t){for(const e of this.#vi){const s=e(t);if(s)return s}return null}applyRetainFormat(t){let e;(e=this.#it.get("__pluginRetainFilter"))&&this.#bi.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.#yi.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.#yi.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.#gi.length;e<s;e++)this.#gi[e](t)}resetFileInfo(){for(let t=0,e=this.#mi.length;t<e;t++)this.#mi[t]()}register(t,e,s){let i=this.#di[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.#di[t]&&(i=this.#di[t]=new this.#di[t](this.#F,s||{})),e){const{icons:s,lang:n}=this.#Gs;for(let t=0,o=e.length;t<o;t++)ve(e[t],i,s,n);this.#X.commandDispatcher.activeCommands.includes(t)||"function"!=typeof this.#di[t].active||this.#X.commandDispatcher.activeCommands.push(t)}}init(t){this.#fi.tags=[],this.#fi.pluginMap={},this.#fi.tagAttrs={};const e=this.#di,s=[];let i;for(const n in e){if(this.register(n,this.#ui[n],t[n]),this.register(n,this.#pi[n],t[n]),i=this.#di[n],"object"==typeof i.__fileManagement){const t=i.__fileManagement;if(this.#gi.push(t._checkInfo.bind(t)),this.#mi.push(t._resetInfo.bind(t)),Array.isArray(t.tagNames)){const e=t.tagNames;this.#fi.tags=this.#fi.tags.concat(e),s.push(n);for(let s,i=0,o=e.length;i<o;i++)s=e[i].toLowerCase(),this.#fi.pluginMap[s]=n,t.tagAttrs&&(this.#fi.tagAttrs[s]=t.tagAttrs)}}"function"==typeof i.constructor.component&&this.#vi.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.#yi.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.#bi.set(t.query,{key:i.constructor.key,method:t.method})}}for(const t of this.#yi.values())t.sort(((t,e)=>t.index-e.index));(this.#it.get("buttons").has("pageBreak")||this.#it.get("buttons_sub")?.has("pageBreak"))&&this.#vi.push(function(t,e,s){return s&&Ut.utils.hasClass(s,"se-page-break")?{target:s,launcher:{destroy:s=>{const i=s.previousElementSibling||s.nextElementSibling;Ut.utils.removeItem(s),t.focusEdge(i),e.push(!1)}}}:null}.bind(null,this.#X.focusManager,this.#X.history)),this.#fi.regExp=new RegExp(`^(${this.#fi.tags.join("|")||"\\^"})$`,"i"),this.#fi.pluginRegExp=new RegExp(`^(${0===s.length?"\\^":s.join("|")})$`,"i"),this.#ui=null,this.#pi=null}get(t){return this.#di[t]}_destroy(){for(const t in this.#di){const e=this.#di[t];e._destroy?.(),e.editor=null}this.#di=null,this.#fi=null,this.#vi=null,this.#yi?.clear(),this.#bi?.clear()}};class Qs{#F;#X;#t;#it;#K;#J;constructor(t){this.#F=t,this.#X=t.$,this.#t=t.store,this.#it=this.#X.options,this.#K=this.#X.frameContext,this.#J=this.#X.frameOptions}focus(t){if(t&&this.#X.facade.changeFrameContext(t),"none"!==this.#K.get("wysiwygFrame").style.display){if(this.#t.set("_preventBlur",!1),this.#J.get("iframe")||!this.#K.get("wysiwyg").contains(this.#X.selection.getNode()))this.nativeFocus();else try{const t=this.#X.selection.getRange();if(t.startContainer===t.endContainer&&Ut.check.isWysiwygFrame(t.startContainer)){const e=t.commonAncestorContainer.children[t.startOffset];if(!this.#X.format.isLine(e)&&!this.#X.component.is(e)){const t=Ut.utils.createElement("BR"),s=Ut.utils.createElement(this.#it.get("defaultLine"),null,t);return this.#K.get("wysiwyg").insertBefore(s,e),void this.#X.selection.setRange(t,0,t,0)}}this.#X.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.#K.get("wysiwyg").lastElementChild;const e=this.#X.component.get(t);e?this.#X.component.select(e.target,e.pluginName):t?(3!==t.nodeType&&(t=Ut.query.getEdgeChild(t,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!0)),t?this.#X.selection.setRange(t,t.textContent.length,t,t.textContent.length):this.nativeFocus()):this.focus()}nativeFocus(){this.#X.selection.__focus(),this.#X.selection.init()}blur(){this.#J.get("iframe")?this.#K.get("wysiwygFrame").blur():this.#K.get("wysiwyg").blur()}}const{NO_EVENT:ti}=Dt,ei={bold:["font-weight"],underline:["text-decoration"],italic:["font-style"],strike:["text-decoration"]};class si{#F;#X;#t;#K;#it;#js;#wi=null;#Ci=null;#_i=null;#xi=null;constructor(t){this.#F=t,this.#X=t.$,this.#t=t.store,this.#K=this.#X.frameContext,this.#it=this.#X.options,this.#js=this.#X.eventManager}async execute(t,e){if(!this.#K.get("isReadOnly")||/copy|cut|selectAll|codeView|markdownView|fullScreen|print|preview|showBlocks|finder/.test(t))switch(t){case"selectAll":this.#$i();break;case"copy":{const t=this.#X.selection.getRange();if(t.collapsed)break;const e=Ut.utils.createElement("div",null,t.cloneContents());await this.#X.html.copy(e.innerHTML);break}case"newDocument":this.#X.html.set(`<${this.#it.get("defaultLine")}><br></${this.#it.get("defaultLine")}>`),this.#X.focusManager.focus(),this.#X.history.push(!1),this.#K.has("documentType_use_header")&&this.#K.get("documentType").reHeader();break;case"finder":this.#X.finder.open(!0);break;case"codeView":this.#X.viewer.codeView(!this.#K.get("isCodeView"));break;case"markdownView":this.#X.viewer.markdownView(!this.#K.get("isMarkdownView"));break;case"fullScreen":this.#X.viewer.fullScreen(!this.#K.get("isFullScreen"));break;case"indent":this.#X.format.indent();break;case"outdent":this.#X.format.outdent();break;case"undo":this.#X.history.undo();break;case"redo":this.#X.history.redo();break;case"removeFormat":this.#X.inline.remove(),this.#X.focusManager.focus();break;case"print":this.#X.viewer.print();break;case"preview":this.#X.viewer.preview();break;case"showBlocks":this.#X.viewer.showBlocks(!this.#K.get("isShowBlocks"));break;case"dir":this.#X.ui.setDir(this.#it.get("_rtl")?"ltr":"rtl");break;case"dir_ltr":this.#X.ui.setDir("ltr");break;case"dir_rtl":this.#X.ui.setDir("rtl");break;case"save":await this.#ki();break;case"copyFormat":this.#Si(e);break;case"pageBreak":this.#Ei();break;case"pageUp":this.#K.get("documentType").pageUp();break;case"pageDown":this.#K.get("documentType").pageDown();break;default:this.#Ti(t)}}copyFormat(){if(this.#_i?.length)try{const t=[...this.#_i],e=t.pop();if(this.#X.inline.remove(),e){const s=this.#X.inline.apply(e,{stylesToModify:null,nodesToRemove:[e.nodeName],strictRemove:!1}),{parent:i,inner:n}=this.#X.nodeTransform.createNestedNode(t);s.parentNode.insertBefore(i,s),n.appendChild(s),this.#X.selection.setRange(s,Ut.check.isZeroWidth(s)?1:0,s,1)}if(this.#it.get("copyFormatKeepOn"))return;this.#xi()}catch(t){console.warn("[SUNEDITOR.copyFormat.error] ",t),this.#xi?.()||(this.#_i=null,this.#xi=null)}}#$i(){this.#X.ui.offCurrentController(),this.#X.menu.containerOff();const t=this.#K.get("wysiwyg");let e=null,s="";const i=this.#it.get("scopeSelectionTags"),n=this.#X.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;(Ut.check.isList(t)||Ut.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)||Ut.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=Ut.query.getParentElement(e||this.#X.selection.getNode(),(t=>o.includes(t.nodeName?.toLowerCase())))||t,{first:r,last:a}=ii(l);if(!r||!a)return;const h=Ut.check.isZeroWidth;for(;h(r)&&h(a)&&l!==t;)l=l.parentElement,({first:r,last:a}=ii(Ut.query.getParentElement(l,(t=>o.includes(t.nodeName?.toLowerCase())))||t));if(!r||!a)return;let c=null;if(Ut.check.isMedia(r)||(c=this.#X.component.get(r))||Ut.check.isTableElements(r)){c||=this.#X.component.get(r);const t=Ut.utils.createElement("BR"),e=Ut.utils.createElement(this.#it.get("defaultLine"),null,t);r=c?c.container||c.cover:r,r.parentElement.insertBefore(e,r),r=t}if(Ut.check.isMedia(a)||(c=this.#X.component.get(a))||Ut.check.isTableElements(a)){c||=this.#X.component.get(a);const t=Ut.utils.createElement("BR"),e=Ut.utils.createElement(this.#it.get("defaultLine"),null,t);a=c?c.container||c.cover:a,a.parentElement.appendChild(e),a=t}this.#X.toolbar._showBalloon(this.#X.selection.setRange(r,0,a,a.textContent.length))}async#ki(){const t=this.#K;if(!t.get("isChanged"))return;const e=this.#X.html.get(),s=await this.#js.triggerEvent("onSave",{frameContext:t,data:e});if(s===ti){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.#X.history.getRootStack()[this.#t.get("rootKey")].index),this.#X.commandDispatcher.applyTargets("save",(t=>{t.disabled=!0}))}#Si(t){if("function"==typeof this.#xi)return void this.#xi();const e=this.#K.get("wysiwyg");this.#_i=[...this.#F._eventOrchestrator.__cacheStyleNodes],this.#xi=this.#Mi.bind(this,this.#js,e,t),Ut.utils.addClass(e,"se-copy-format-cursor"),Ut.utils.addClass(t,"on"),this.#wi=this.#js.addGlobalEvent("keydown",(t=>{Gt.isEsc(t.code)&&this.#xi?.()})),this.#Ci=this.#js.addGlobalEvent("mousedown",(s=>{e.contains(s.target)||s.target===t||this.#xi?.()}))}#Mi(t,e,s){return this.#wi=t.removeGlobalEvent(this.#wi),this.#Ci=t.removeGlobalEvent(this.#Ci),this.#_i=null,this.#xi=null,Ut.utils.removeClass(e,"se-copy-format-cursor"),Ut.utils.removeClass(s,"on"),!0}#Ti(t){t=this.#it.get("_defaultTagCommand")[t.toLowerCase()]||t;let e=this.#it.get("convertTextTags")[t]||t;const s=this.#t.get("currentNodesMap"),i=s.includes(this.#it.get("_styleCommandMap")[e])?null:Ut.utils.createElement(e);/^sub$/i.test(e)&&s.includes("superscript")?e="sup":/^sup$/i.test(e)&&s.includes("subscript")&&(e="sub"),this.#X.inline.apply(i,{stylesToModify:ei[t]||null,nodesToRemove:[e],strictRemove:!1}),this.#X.focusManager.focus()}#Ei(){const t=Ut.utils.createElement("DIV",{class:"se-component se-component-line-break se-page-break"});this.#X.component.insert(t,{skipCharCount:!0,insertBehavior:"line"});const e=t.nextElementSibling||this.#X.format.addLine(t);this.#X.selection.setRange(e,1,e,1),this.#X.history.push(!1)}}const ii=function(t){const e=Ut.check.isContentLess;return{first:Ut.query.getEdgeChild(Ut.query.getEdgeChild(t,(t=>!e(t)),!1),(t=>0===t.childNodes.length||3===t.nodeType||Z(t)||U(t)),!1)||t.firstChild,last:Ut.query.getEdgeChild(t.lastChild,(t=>0===t.childNodes.length||3===t.nodeType||Z(t)||U(t)),!0)||t.lastChild}},ni=".se-menu-list .se-toolbar-btn[data-command]",oi=["bold","underline","italic","strike","subscript","superscript","indent","outdent"],li=oi.concat(["undo","redo","save","fullScreen","showBlocks","codeView","markdownView","finder","dir","dir_ltr","dir_rtl"]);class ri{#X;#e;#it;#Hi;#Li=new Map;#Ni=oi;constructor(t){this.#X=t.$,this.#e=this.#X.context,this.#it=this.#X.options,this.#Hi=new si(t),this.allCommandButtons=new Map,this.subAllCommandButtons=new Map}get targets(){return this.#Li}get activeCommands(){return this.#Ni}run(t,e,s){if(e){if(/more/i.test(e)){const e=Ut.query.getParentElement(s,".se-toolbar"),i=Ut.utils.hasClass(e,"se-toolbar-sub")?this.#X.subToolbar:this.#X.toolbar;if(s!==i.currentMoreLayerActiveButton){const n=e.querySelector("."+t);n&&(i._moreLayerOn(s,n),i._showBalloon(),i._showInline()),Ut.utils.addClass(s,"on")}else i.currentMoreLayerActiveButton&&(i._moreLayerOff(),i._showBalloon(),i._showInline());return void this.#X.viewer._resetFullScreenHeight()}if(/container/.test(e)&&(null===this.#X.menu.targetMap[t]||s!==this.#X.menu.currentContainerActiveButton))return void this.#X.menu.containerOn(s);if(this.#X.ui.isButtonDisabled(s))return;if(/dropdown/.test(e)&&(null===this.#X.menu.targetMap[t]||s!==this.#X.menu.currentDropdownActiveButton))return void this.#X.menu.dropdownOn(s);if(/modal/.test(e))return void this.#X.plugins[t].open(s);/command/.test(e)?this.#X.plugins[t].action(s):/browser/.test(e)?this.#X.plugins[t].open(null):/popup/.test(e)&&this.#X.plugins[t].show()}else t&&this.#Hi.execute(t,s);/dropdown/.test(e)?this.#X.menu.dropdownOff():/command/.test(e)||(this.#X.menu.dropdownOff(),this.#X.menu.containerOff())}runFromTarget(t){if(Ut.check.isInputElement(t))return;const e=Ut.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.#Li.has(t)&&this.#Li.get(t).forEach(e)}registerTargets(t,e){if(!t||!e)return;(li.includes(t)||this.#X.plugins[t])&&(this.#Li.get(t)?this.#Li.get(t).includes(e)||this.#Li.get(t).push(e):this.#Li.set(t,[e]))}resetTargets(){this.#Li=new Map,this._initCommandButtons()}_initCommandButtons(){const t=this.#e;this.#Bi(this.allCommandButtons,t.get("toolbar_buttonTray")),this.#Bi(this.subAllCommandButtons,t.get("toolbar_sub_buttonTray"))}_copyFormat(){this.#Hi.copyFormat()}#Bi(t,e){if(!e)return;const s=e.querySelectorAll(ni),i=this.#it.get("shortcuts"),n=this.#it.get("_reverseCommandArray"),o=this.#X.shortcuts.keyMap,l=this.#X.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),re(r,e,i[r],o,n,l)}_destroy(){this.#Li.clear(),this.allCommandButtons.clear(),this.subAllCommandButtons.clear(),this.#Ni=null}}const ai=`${ni}:not([class~="se-code-view-enabled"]):not([data-type="MORE"])`,hi=`${ni}:not([class~="se-component-enabled"]):not([data-type="MORE"])`,{_w:ci}=Dt;const di=class{#F;#X;#t;#Gs;#st;#it;#e;#A;#K;#js;#Ai;#Ii;#Vi;#Oi;#Ri=null;#zi;#Fi=!1;#Pi=null;#Di=null;#qi=[];#Wi=[];#Ui=!1;#Zi=null;#Gi=null;constructor(t){this.#F=t,this.#X=t.$,this.#t=t.store,this.#Gs=this.#X.contextProvider,this.#st=this.#Gs.carrierWrapper,this.#it=this.#X.options,this.#e=this.#X.context,this.#A=this.#X.frameRoots,this.#K=this.#X.frameContext,this.#js=this.#X.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 Ut.utils.createElement("DIV",{class:"se-alert-content"},s)}(this.#Gs);this.alertModal=e,this.alertMessage=e.querySelector("span");const s=function(){const t='<div class="se-toast-container"><span></span></div>';return Ut.utils.createElement("DIV",{class:"se-toast"},t)}();this.toastPopup=s,this.toastContainer=s.querySelector(".se-toast-container"),this.toastMessage=s.querySelector("span"),this.#st.appendChild(s),this.#Ai=this.#st.querySelector(".se-alert"),this.#Ii=this.#st.querySelector(".se-alert .se-modal-inner"),this.#Ii.appendChild(e),this.#Vi=[this.#ji.bind(this),this.#Ki.bind(this)],this.#Oi=!1,this.#zi=this.#st.querySelector(".se-back-wrapper"),this.selectMenuOn=!1,this.opendControllers=[],this.controllerTargetContext=null,this._figureContainer=null}setEditorStyle(t,e){e||=this.#K;const s=e.get("options");s.set("editorStyle",t);const i=Wt._setDefaultOptionStyle(s,t);s.set("_defaultStyles",i),e.get("topArea").style.cssText=i.top;const n=e.get("code");if(this.#it.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.#it,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&&Ut.utils.removeClass(e,s),t&&Ut.utils.addClass(e,t))};i(this.#st),this.#Gs.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.#it.get("_rtl")!==e){try{this.#it.set("_rtl",e),this.offCurrentController();const s=this.#K,i=this.#X.pluginManager.plugins;for(const e in i)i[e].setDir?.(t);const n=this.#e.get("toolbar_wrapper"),o=this.#e.get("statusbar_wrapper");e?(this.#Gs.applyToRoots((t=>{Ut.utils.addClass([t.get("topArea"),t.get("wysiwyg"),t.get("documentTypePageMirror")],"se-rtl")})),Ut.utils.addClass([this.#st,n,o],"se-rtl")):(this.#Gs.applyToRoots((t=>{Ut.utils.removeClass([t.get("topArea"),t.get("wysiwyg"),t.get("documentTypePageMirror")],"se-rtl")})),Ut.utils.removeClass([this.#st,n,o],"se-rtl"));const l=Ut.query.getListChildren(s.get("wysiwyg"),(t=>this.#X.format.isLine(t)&&!!(t.style.marginRight||t.style.marginLeft||t.style.textAlign)),null);for(let t,e,s,i=0;t=l[i];i++)t=l[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.#Yi(e),s.has("documentType_use_header")&&(e?s.get("wrapper").appendChild(s.get("documentTypeInner")):s.get("wrapper").insertBefore(s.get("documentTypeInner"),s.get("wysiwygFrame"))),s.has("documentType_use_page")&&(e?s.get("wrapper").insertBefore(s.get("documentTypePage"),s.get("wysiwygFrame")):s.get("wrapper").appendChild(s.get("documentTypePage"))),this.#t.mode.isBalloon?this.#X.toolbar._showBalloon():this.#t.mode.isSubBalloon&&this.#X.subToolbar._showBalloon()}catch(t){this.#it.set("_rtl",!e),console.warn(`[SUNEDITOR.ui.setDir.fail] ${t.toString()}`)}this.#t.set("_lastSelectionNode",null),this.#F._eventOrchestrator.applyTagEffect()}}readOnly(t,e){const s=e?this.#A.get(e):this.#K;s.set("isReadOnly",!!t),this._toggleControllerButtons(!!t),t?(this.offCurrentController(),this.offCurrentModal(),this.#X.toolbar?.currentMoreLayerActiveButton?.disabled&&this.#X.toolbar._moreLayerOff(),this.#X.subToolbar?.currentMoreLayerActiveButton?.disabled&&this.#X.subToolbar._moreLayerOff(),this.#X.menu?.currentDropdownActiveButton?.disabled&&this.#X.menu.dropdownOff(),this.#X.menu?.currentContainerActiveButton?.disabled&&this.#X.menu.containerOff(),s.get("code").setAttribute("readOnly","true"),Ut.utils.addClass(s.get("wysiwyg"),"se-read-only")):(s.get("code").removeAttribute("readOnly"),Ut.utils.removeClass(s.get("wysiwyg"),"se-read-only")),this.#it.get("hasCodeMirror")&&this.#X.viewer._codeMirrorEditor("readonly",!!t,e)}disable(t){const e=t?this.#A.get(t):this.#K;this.#X.toolbar.disable(),this.offCurrentController(),this.offCurrentModal(),e.get("wysiwyg").setAttribute("contenteditable","false"),e.set("isDisabled",!0),this.#it.get("hasCodeMirror")?this.#X.viewer._codeMirrorEditor("readonly",!0,t):e.get("code").disabled=!0}enable(t){const e=t?this.#A.get(t):this.#K;this.#X.toolbar.enable(),e.get("wysiwyg").setAttribute("contenteditable","true"),e.set("isDisabled",!1),this.#it.get("hasCodeMirror")?this.#X.viewer._codeMirrorEditor("readonly",!1,t):e.get("code").disabled=!1}show(t){const e=(t?this.#A.get(t):this.#K).get("topArea").style;"none"===e.display&&(e.display="block")}hide(t){(t?this.#A.get(t):this.#K).get("topArea").style.display="none"}showLoading(t){(t?this.#A.get(t).get("container"):this.#st).querySelector(".se-loading-box").style.display="block"}hideLoading(t){(t?this.#A.get(t).get("container"):this.#st).querySelector(".se-loading-box").style.display="none"}alertOpen(t,e){this.alertMessage.textContent=t,Ut.utils.removeClass(this.alertModal,"se-alert-error|se-alert-success"),e&&Ut.utils.addClass(this.alertModal,`se-alert-${e}`),this.#Oi&&(this.#Ri=this.#js.addEvent(this.#Ii,"click",this.#Vi[1])),this.#Pi&&=this.#js.removeGlobalEvent(this.#Pi),this.#Pi=this.#js.addGlobalEvent("keydown",this.#Vi[0]),this.#Ai.style.display="block",Ut.utils.addClass(this.alertModal,"se-modal-show")}alertClose(){Ut.utils.removeClass(this.alertModal,"se-modal-show"),Ut.utils.removeClass(this.alertModal,"se-alert-*"),this.#Ai.style.display="none",this.#Ri&&=this.#js.removeEvent(this.#Ri),this.#Pi&&=this.#js.removeGlobalEvent(this.#Pi)}showToast(t,e=1e3,s){Ut.utils.hasClass(this.toastContainer,"se-toast-show")&&this.closeToast(),Ut.utils.removeClass(this.toastPopup,"se-toast-error|se-toast-success"),s&&Ut.utils.addClass(this.toastPopup,`se-toast-${s}`),this.toastPopup.style.display="block",this.toastMessage.textContent=t,Ut.utils.addClass(this.toastContainer,"se-toast-show"),this.#Di=ci.setTimeout((()=>{this.closeToast()}),e)}closeToast(){this.#Di&&ci.clearTimeout(this.#Di),this.#Di=null,Ut.utils.removeClass(this.toastContainer,"se-toast-show"),this.toastPopup.style.display="none"}setControllerOnDisabledButtons(t){return t&&!this.#Fi?(this._toggleControllerButtons(!0),this.#Fi=!0):!t&&this.#Fi&&(this._toggleControllerButtons(!1),this.#Fi=!1),this.#Fi}onControllerContext(){this.controllerTargetContext=this.#K.get("topArea")}offControllerContext(){this.controllerTargetContext=null}enableBackWrapper(t){this.#zi.style.cursor=t,this.#zi.style.display="block"}disableBackWrapper(){this.#zi.style.display="none",this.#zi.style.cursor="default"}offCurrentController(){this.#X.component.__deselect()}offCurrentModal(){this.opendModal?.close()}getVisibleFigure(){return"block"===this._figureContainer?.style.display?this._figureContainer:null}setFigureContainer(t){this._figureContainer=t}preventToolbarHide(t){this.#Ui=t}get isPreventToolbarHide(){return this.#Ui}reset(t){t.set("_editorHeight",t.get("wysiwygFrame").offsetHeight),this.#Zi=t.get("lineBreaker_t"),this.#Gi=t.get("lineBreaker_b")}_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.#X.toolbar.balloonOffset.top-e+"px",this.#e.get("toolbar_main").style.left=this.#X.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.#X.subToolbar.balloonOffset.top-e+"px",this.#e.get("toolbar_sub_main").style.left=this.#X.subToolbar.balloonOffset.left-s+"px"),this.controllerTargetContext!==this.#K.get("topArea")&&this.offCurrentController(),this.#Xi(s,e)}_repositionControllers(){const t=this.opendControllers;if(0!==t.length){ws.get("__dragMove")&&ws.get("__dragMove")();for(let e=0;e<t.length;e++)t[e].notInCarrier||t[e].inst?._scrollReposition()}}#Xi(t,e){if(this.#Zi){const s=this.#Zi.style;if("none"!==s.display){const i=(this.#Zi.getAttribute("data-offset")||",").split(",");s.top=Zt.get(s.top,0)-(e-Zt.get(i[0],0))+"px",s.left=Zt.get(s.left,0)-(t-Zt.get(i[1],0))+"px",this.#Zi.setAttribute("data-offset",e+","+t)}}if(this.#Gi){const s=this.#Gi.style;if("none"!==s.display){const i=(this.#Gi.getAttribute("data-offset")||",").split(",");s.top=Zt.get(s.top,0)-(e-Zt.get(i[0],0))+"px",s[i[1]]=Zt.get(s[i[1]],0)-(t-Zt.get(i[2],0))+"px",this.#Gi.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.#Zi.style.visibility=i,this.#Gi.style.visibility=i}setCurrentControllerContext;#Yi(t){const e=this.#Gs.icons,s=this.#X.commandDispatcher?.targets;if(!s)return;const i=this.#X.shortcuts?.keyMap;this.#X.shortcuts?.reverseKeys?.forEach((t=>{const e=i?.get(t);e&&([e.command,e.r]=[e.r,e.command])})),this.#X.commandDispatcher.applyTargets("dir",(s=>{Ut.utils.changeTxt(s.querySelector(".se-tooltip-text"),this.#Gs.lang[t?"dir_ltr":"dir_rtl"]),Ut.utils.changeElement(s.firstElementChild,e[t?"dir_ltr":"dir_rtl"])})),t?(Ut.utils.addClass(s.get("dir_rtl"),"active"),Ut.utils.removeClass(s.get("dir_ltr"),"active")):(Ut.utils.addClass(s.get("dir_ltr"),"active"),Ut.utils.removeClass(s.get("dir_rtl"),"active"))}_initToggleButtons(){const t=this.#e;this.#Wi=Wt.nodeListToArray(t.get("toolbar_buttonTray").querySelectorAll(ai)),this.#qi=Wt.nodeListToArray(t.get("toolbar_buttonTray").querySelectorAll(hi)),this.#it.has("_subMode")&&(this.#Wi=this.#Wi.concat(Wt.nodeListToArray(t.get("toolbar_sub_buttonTray").querySelectorAll(ai))),this.#qi=this.#qi.concat(Wt.nodeListToArray(t.get("toolbar_sub_buttonTray").querySelectorAll(hi))))}_toggleCodeViewButtons(t){Ut.utils.setDisabled(this.#Wi,t)}_toggleControllerButtons(t){Ut.utils.setDisabled(this.#qi,t)}isButtonDisabled(t){return!(!this.#K.get("isReadOnly")||!Ut.utils.arrayIncludes(this.#qi,t))}_updatePlaceholder(t){t||=this.#K;const e=t.get("placeholder");if(e){if(t.get("isCodeView"))return void(e.style.display="none");this.#X.facade.isEmpty(t)?e.style.display="block":e.style.display="none"}}_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)ci.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>Zt.get(t)?"auto":"no")}Dt.isResizeObserverSupported||this._emitResizeEvent(t,s,null)}),0);else if(!Dt.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+Zt.get(t.get("wwComputedStyle").getPropertyValue("padding-left"))+Zt.get(t.get("wwComputedStyle").getPropertyValue("padding-right")):e,t.get("_editorHeight")!==e&&(this.#js.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.#Oi=!this.#js.addEvent(this.alertModal.querySelector('[data-command="close"]'),"click",this.alertClose.bind(this)),this._initToggleButtons()}#Ki(t){const e=Ut.query.getEventTarget(t);(/close/.test(e.getAttribute("data-command"))||e===this.#Ii)&&this.alertClose()}#ji(t){Gt.isEsc(t.code)&&this.alertClose()}_destroy(){this.#Di&&ci.clearTimeout(this.#Di),this.#Pi&&=this.#js.removeGlobalEvent(this.#Pi),this.#Ri&&=this.#js.removeEvent(this.#Ri),this.opendModal=null,this.opendBrowser=null,this.#Zi=null,this.#Gi=null,this.#qi=null,this.#Wi=null}};function ui(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(ct(c.s.path,c.frame),c.s.offset,ct(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 w(t,e,s,i){let n,o;e?(n={path:ht(e.startContainer,null,null),offset:e.startOffset},o={path:ht(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 C(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])||C(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),w(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){w(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++)C(t[e])},resetButtons(t,s){const i=!Zt.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:pi}=Dt;const gi=class{#F;#X;#t;#Ji;#Qi;#e;#K;#it;#js;#tn;#en;#sn;#in="default";#nn=null;#on=null;#ln=!1;#rn=!1;constructor(t,{keyName:e,balloon:s,inline:i,balloonAlways:n,res:o}){this.#F=t,this.#X=t.$,this.#t=t.store,this.#Ji=this.#X.icons,this.#Qi=this.#X.lang,this.#e=this.#X.context,this.#K=this.#X.frameContext,this.#it=this.#X.options,this.#js=this.#X.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.#tn=o,this.#en=o,this.#sn="visualViewport"in pi;const l=!this.isSub&&!s&&!i,r=this.#it.get("toolbar_sticky");if(this.#ln=l&&r>=0&&!this.#it.get("toolbar_container")&&"undefined"!=typeof CSS&&CSS.supports("position","sticky"),this.isBottomMode=this.#t.mode.isBottom,this.#ln){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&&Ut.utils.addClass(this.#e.get(this.keyName.main),"se-toolbar-relative");this._setResponsive()}get isSticky(){if(this.isSub)return!1;const t=this.#it.get("toolbar_sticky");if(t<0)return!1;if(this.#ln){const e=this.#e.get(this.keyName.main);return!(!e||0===e.offsetWidth||"none"===e.style.display)&&(this.isBottomMode?e.getBoundingClientRect().bottom>=pi.innerHeight-t-1:e.getBoundingClientRect().top<=t+1)}return this.#rn}get isCSSSticky(){return this.#ln}disable(){this._moreLayerOff(),this.#X.menu.dropdownOff(),this.#X.menu.containerOff(),Ut.utils.setDisabled(this.#e.get(this.keyName.buttonTray).querySelectorAll(".se-menu-list .se-toolbar-btn[data-type]"),!0)}enable(){Ut.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.#K.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.#K.get("_stickyDummy").style.display="none"),this.isBalloonMode&&(this.balloonOffset={top:0,left:0}))}resetResponsiveToolbar(){this.#X.menu.containerOff();const t=this.#on;if(t){let e=0;e=(this.isBalloonMode||this.isInlineMode)&&"auto"===this.#it.get("toolbar_width")||this.#t.mode.isSubBalloon&&"auto"===this.#it.get("toolbar_sub_width")?this.#K.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.#in!==s&&(this.#in=s,this.setButtons(this.#nn[s]))}}setButtons(t){this._moreLayerOff(),this.#X.menu.dropdownOff(),this.#X.menu.containerOff();const e=be(t,this.#X.plugins,this.#it,this.#Ji,this.#Qi,!0);e.updateButtons.forEach((t=>ve(t.button,t.plugin,this.#Ji,this.#Qi))),this.#e.get(this.keyName.main).replaceChild(e.buttonTray,this.#e.get(this.keyName.buttonTray)),this.#e.set(this.keyName.buttonTray,e.buttonTray),this.#an(),this.#js.triggerEvent("onSetToolbarButtons",{buttonTray:e.buttonTray,frameContext:this.#K})}_resetSticky(){if(this.#ln)return;const t=this.#K.get("wrapper");if(!t)return;const e=this.#e.get(this.keyName.main),s=this.#it.get("toolbar_sticky");if(this.#K.get("isFullScreen")||0===e.offsetWidth||s<0)return;const i=this.#sn?pi.visualViewport.pageTop:pi.scrollY,n=this.#K.get("_minHeight"),o=t.offsetHeight,l=this.#X.offset.getGlobal(this.#K.get("topArea"));if(this.isBottomMode){const t=i+pi.innerHeight,r=l.top+o,a=t-s-(this.isInlineMode?e.offsetHeight:0),h=this.#it.get("toolbar_container")?t-s-l.top-n-e.offsetHeight:a-l.top-n;a>r?this.#hn():h<0?(this.isSticky||this.#cn(1),e.style.bottom=1+h+this.#dn()+"px",e.style.top="auto"):this.#cn(1)}else{const t=i+s,r=(this.isBalloonMode||this.isInlineMode?l.top:this.#X.offset.getGlobal(this.#it.get("toolbar_container")).top)-(this.isInlineMode?e.offsetHeight:0),a=this.#it.get("toolbar_container")?l.top-i+o-n-s-e.offsetHeight:o+r+s-t-n;t<r?this.#hn():a<0?(this.isSticky||this.#cn(1),e.style.top=1+a+this.#dn()+"px"):this.#cn(1)}}#an(){this.#X.shortcuts._registerShortcuts(),this.#X.commandDispatcher.resetTargets(),this.#X.ui._initToggleButtons(),this.#X.history.resetButtons(this.#K.get("key"),null),this._resetSticky(),this.#t.set("_lastSelectionNode",null),this.#X.viewer._setButtonsActive(),this.#t.get("hasFocus")&&this.#F._eventOrchestrator.applyTagEffect(),this.#K.get("isReadOnly")&&this.#X.ui.setControllerOnDisabledButtons(!0)}_setResponsive(){if(0===this.#en?.length)return void(this.#en=null);this.#in="default";const t=this.#on=[],e=this.#tn,s=this.#nn={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.#X.selection.getRange(),s=this.#e.get(this.keyName.main),i=this.#X.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=Ut.query.getListChildNodes(e.commonAncestorContainer,null,null);n=Ut.utils.getArrayIndex(t,i.focusNode)<Ut.utils.getArrayIndex(t,i.anchorNode)}this._setBalloonOffset(n,e),this.#js.triggerEvent("onShowToolbar",{toolbar:s,mode:"balloon",frameContext:this.#K})}_setBalloonOffset(t,e){const s=this.#e.get(this.keyName.main),i=this.#K.get("topArea"),n=this.#X.offset.getGlobal(i).top;if(!this.#X.offset.setRangePosition(s,e,{position:t?"top":"bottom",addTop:n}))return void this.hide();if(this.#it.get("toolbar_container")){const t=i.parentElement;let e=this.#it.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.#X.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.#hn(),t.style.top="0px",this.inlineToolbarAttr.width=t.style.width=this.#it.get(this.keyName.width),this.isBottomMode){const e=this.#K.get("topArea");this.inlineToolbarAttr.top=t.style.top=this.#X.offset.getGlobal(e).top+e.offsetHeight-this.#X.offset.getGlobal(t).top+"px"}else this.inlineToolbarAttr.top=t.style.top=this.#X.offset.getGlobal(this.#K.get("topArea")).top-this.#X.offset.getGlobal(t).top-t.offsetHeight-1+"px";this._resetSticky(),this.inlineToolbarAttr.isShow=!0,this.#js.triggerEvent("onShowToolbar",{toolbar:t,mode:"inline",frameContext:this.#K}),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",Ut.utils.removeClass(this.currentMoreLayerActiveButton,"on"),this.currentMoreLayerActiveButton=null}}#cn(t){const e=this.#e.get(this.keyName.main);if(!this.isInlineMode){const t=this.#it.get("toolbar_container")?this.#e.get("_stickyDummy"):this.#K.get("_stickyDummy");t.style.height=e.offsetHeight+"px",t.style.display="block"}if(this.isBottomMode){const t=this.#it.get("toolbar_sticky")+this.#dn();e.style.bottom=`${t}px`,e.style.top="auto"}else{const s=this.#it.get("toolbar_sticky")+t+this.#dn();e.style.top=`${s}px`}e.style.width=this.isInlineMode?this.inlineToolbarAttr.width:e.offsetWidth+"px",Ut.utils.addClass(e,"se-toolbar-sticky"),this.#rn=!0}#dn(){return this.#sn?pi.visualViewport.offsetTop:0}#hn(){(this.#it.get("toolbar_container")?this.#e.get("_stickyDummy"):this.#K.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.#K.get("wrapper").style.marginBottom=""):(t.style.top=this.isInlineMode?this.inlineToolbarAttr.top:"",this.#K.get("wrapper").style.marginTop=""),t.style.width=this.isInlineMode?this.inlineToolbarAttr.width:"",Ut.utils.removeClass(t,"se-toolbar-sticky"),this.#rn=!1}_destroy(){this._moreLayerOff()}};function mi(t){return/free$/.test(t)}const fi=class{#X;#t;#Gs;#e;#js;#un;#pn=[];#gn=null;#mn=null;#fn=null;#vn=null;#bn=null;#yn=null;#wn=null;constructor(t){this.#X=t.$,this.#t=t.store,this.#Gs=this.#X.contextProvider,this.#e=this.#X.context,this.#js=this.#X.eventManager,this.targetMap={},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.#un={mousedown:this.#Cn.bind(this),containerDown:this.containerOff.bind(this),keydown:this.#_n.bind(this),mousemove:this.#xn.bind(this),mouseout:this.#$n.bind(this)},this.#gn=null,this.#mn=null,this.#fn=null,this.#yn=null,this.#wn=null}initDropdownTarget({key:t,type:e},s){if(!t)throw Error("[SUNEDITOR.init.fail] The plugin's key is not added.");mi(e)||(s.setAttribute("data-key",t),this.#pn.push(t)),this.#e.get("menuTray").appendChild(s),this.targetMap[t]=s}dropdownOn(t){this.#Oe();const e=this.#kn(t);if(e){const s=Ut.query.getParentElement(e,".se-btn-tray").querySelector('[data-command="'+e.getAttribute("data-ref")+'"]');if(s)return this.#X.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,this.#Sn(s,n),this.#gn=this.#js.addGlobalEvent("mousedown",this.#un.mousedown,!1),this.#pn.includes(i)&&(this.menus=Wt.nodeListToArray(n.querySelectorAll("[data-command]")),this.menus.length>0&&(this.#mn=this.#js.addGlobalEvent("keydown",this.#un.keydown,!1),this.#vn=this.#js.addEvent(n,"mousemove",this.#un.mousemove,!1),this.#bn=this.#js.addEvent(n,"mouseout",this.#un.mouseout,!1))),this.currentDropdownPlugin=this.#X.plugins[i],this.currentDropdownPlugin?.on(s),this.#t.set("_preventBlur",!0)}dropdownOff(){this.#Oe(),mi(this.currentDropdownType)&&this.currentDropdownPlugin?.off?.(),this.index=-1,this.menus=[],this.#yn=null,this.#wn=null,this.currentButton=null,this.currentDropdown&&(this.currentDropdownName="",this.currentDropdownType="",this.currentDropdown.style.display="none",this.currentDropdown=null,this.currentDropdownActiveButton&&Ut.utils.removeClass(this.currentDropdownActiveButton.parentElement.children,"on"),this.currentDropdownActiveButton=null,this.#X.ui.preventToolbarHide(!1)),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.#Oe(),this.currentContainerActiveButton=t;const e=this.currentContainerName=this.currentContainerActiveButton.getAttribute("data-command");this.#Sn(t,this.currentContainer=this.targetMap[e]),this.#fn=this.#js.addGlobalEvent("mousedown",this.#un.containerDown,!1),this.#X.plugins[e].on&&this.#X.plugins[e].on(t),this.#t.set("_preventBlur",!0)}containerOff(){this.#Oe(),this.currentContainer&&(this.currentContainerName="",this.currentContainer.style.display="none",this.currentContainer=null,Ut.utils.removeClass(this.currentContainerActiveButton,"on"),this.currentContainerActiveButton=null,this.#X.ui.preventToolbarHide(!1)),this.#t.set("_preventBlur",!1)}__resetMenuPosition(t,e){this.#X.offset.setRelPosition(e,this.#Gs.carrierWrapper,t.parentElement,Ut.query.getParentElement(t,".se-toolbar"),{preferUp:this.#t.mode.isBottom})}__restoreMenuPosition(){this.#yn&&this.#wn&&this.#Sn(this.#yn,this.#wn)}#Sn(t,e){e.style.visibility="hidden",e.style.display="block",e.style.height="",Ut.utils.addClass(t.parentElement.children,"on"),this.#X.offset.setRelPosition(e,this.#Gs.carrierWrapper,t.parentElement,Ut.query.getParentElement(t,".se-toolbar"),{preferUp:this.#t.mode.isBottom}),e.style.visibility="",this.#yn=t,this.#wn=e}#kn(t){const e=Ut.query.getParentElement(t,".se-more-layer");return e&&"block"!==e.style.display&&e.getAttribute("data-ref")?e:null}#cs(t){Ut.utils.removeClass(this.currentDropdown,"se-select-menu-mouse-move"),Ut.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?Ut.utils.addClass(this.menus[t],"on"):Ut.utils.removeClass(this.menus[t],"on")}#Oe(){this.#gn&&=this.#js.removeGlobalEvent(this.#gn),this.#fn&&=this.#js.removeGlobalEvent(this.#fn),this.#mn&&(this.#mn=this.#js.removeGlobalEvent(this.#mn),this.#vn&&=this.#js.removeEvent(this.#vn),this.#bn&&=this.#js.removeEvent(this.#bn),Ut.utils.removeClass(this.menus,"on"),Ut.utils.removeClass(this.currentDropdown,"se-select-menu-key-action|se-select-menu-mouse-move"))}#Cn(t){const e=Ut.query.getEventTarget(t);Ut.query.getParentElement(e,".se-dropdown")||this.dropdownOff()}#$n(){this.index=-1}#_n(t){switch(t.code){case"ArrowUp":case"ArrowLeft":t.preventDefault(),t.stopPropagation(),this.#cs(-1);break;case"ArrowDown":case"ArrowRight":t.preventDefault(),t.stopPropagation(),this.#cs(1);break;case"Enter":case"Space":{if(this.index<0)break;const e=this.menus[this.index];if(!e||"function"!=typeof this.#X.plugins[this.currentDropdownName].action)return;t.preventDefault(),t.stopPropagation(),this.#X.plugins[this.currentDropdownName].action(e),this.dropdownOff();break}}}#xn(t){Ut.utils.addClass(this.currentDropdown,"se-select-menu-mouse-move"),Ut.utils.removeClass(this.currentDropdown,"se-select-menu-key-action");const e=this.menus.indexOf(t.target);-1!==e&&(this.index=1*e)}_destroy(){this.#Oe()}},{_w:vi,_d:bi}=Dt;function yi(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=vi.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 wi=class{#F;#X;#t;#Ji;#Qi;#A;#e;#K;#it;#J;#js;#Xt;#En="";#Tn="";#Mn="";#Hn="";#Ln="";#Nn="";#Bn="";#An="";#In="";#Vn="";#On="";#Rn=0;#zn=!1;#Fn=!1;#Pn=!1;#Dn=null;#qn="";constructor(t){this.#F=t,this.#X=t.$,this.#t=t.store,this.#Ji=this.#X.icons,this.#Qi=this.#X.lang,this.#A=this.#X.frameRoots,this.#e=this.#X.context,this.#K=this.#X.frameContext,this.#it=this.#X.options,this.#J=this.#X.frameOptions,this.#js=this.#X.eventManager,this.#Xt=new RegExp(`^(${this.#it.get("_disallowedExtraTag")})$`,"i")}codeView(t){const e=this.#K;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.#X.ui.offCurrentController(),this.#X.ui.offCurrentModal();const s=e.get("codeWrapper"),i=e.get("code"),n=e.get("wysiwygFrame"),o=e.get("wrapper");t?(this.#X.finder.close(),this.#Wn(),s.style.setProperty("display","flex","important"),n.style.display="none",e.get("isFullScreen")?i.style.height="100%":"auto"!==this.#J.get("height")||this.#it.get("hasCodeMirror")||(i.style.height=i.scrollHeight>0?i.scrollHeight+"px":"auto"),this.#it.get("hasCodeMirror")&&this._codeMirrorEditor("refresh",null,null),e.get("isFullScreen")||(this.#X.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.#X.toolbar.isInlineMode=!0,this.#t.mode.isBalloon=this.#X.toolbar.isBalloonMode=!1,this.#X.toolbar._showInline())),this.#t.mode.isBalloon&&this.#X.subToolbar.hide(),yi(e),this.#t.set("_range",null),i.focus(),Ut.utils.addClass(this.#X.commandDispatcher.targets.get("codeView"),"active"),Ut.utils.addClass(o,"se-source-view-status")):(Ut.check.isNonEditable(n)||this.#Un(),n.scrollTop=0,s.style.setProperty("display","none","important"),n.style.display="block","auto"!==this.#J.get("height")||this.#it.get("hasCodeMirror")||(e.get("code").style.height="0px"),e.get("isFullScreen")||(this.#X.ui.preventToolbarHide(!1),/balloon/.test(this.#it.get("mode"))&&(this.#e.get("toolbar_arrow").style.display="",this.#t.mode.isInline=this.#X.toolbar.isInlineMode=!1,this.#t.mode.isBalloon=this.#X.toolbar.isBalloonMode=!0,this.#F._eventOrchestrator._hideToolbar())),this.#X.focusManager.nativeFocus(),Ut.utils.removeClass(this.#X.commandDispatcher.targets.get("codeView"),"active"),Ut.check.isNonEditable(n)||(this.#X.history.push(!1),this.#X.history.resetButtons(e.get("key"),null)),Ut.utils.removeClass(o,"se-source-view-status")),this.#X.ui._updatePlaceholder(e),this.#X.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.#js.triggerEvent("onToggleCodeView",{frameContext:e,is:e.get("isCodeView")})}markdownView(t){const e=this.#K;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.#X.ui.offCurrentController(),this.#X.ui.offCurrentModal();const s=e.get("markdownWrapper"),i=e.get("markdown"),n=e.get("wysiwygFrame"),o=e.get("wrapper");t?(this.#X.finder.close(),this.#Zn(),s.style.setProperty("display","flex","important"),n.style.display="none",e.get("isFullScreen")?i.style.height="100%":"auto"===this.#J.get("height")&&(i.style.height=i.scrollHeight>0?i.scrollHeight+"px":"auto"),e.get("isFullScreen")||(this.#X.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.#X.toolbar.isInlineMode=!0,this.#t.mode.isBalloon=this.#X.toolbar.isBalloonMode=!1,this.#X.toolbar._showInline())),this.#t.mode.isBalloon&&this.#X.subToolbar.hide(),yi(e,"markdown"),this.#t.set("_range",null),i.focus(),Ut.utils.addClass(this.#X.commandDispatcher.targets.get("markdownView"),"active"),Ut.utils.addClass(o,"se-source-view-status")):(Ut.check.isNonEditable(n)||this.#Gn(),n.scrollTop=0,s.style.setProperty("display","none","important"),n.style.display="block","auto"===this.#J.get("height")&&(i.style.height="0px"),e.get("isFullScreen")||(this.#X.ui.preventToolbarHide(!1),/balloon/.test(this.#it.get("mode"))&&(this.#e.get("toolbar_arrow").style.display="",this.#t.mode.isInline=this.#X.toolbar.isInlineMode=!1,this.#t.mode.isBalloon=this.#X.toolbar.isBalloonMode=!0,this.#F._eventOrchestrator._hideToolbar())),this.#X.focusManager.nativeFocus(),Ut.utils.removeClass(this.#X.commandDispatcher.targets.get("markdownView"),"active"),Ut.check.isNonEditable(n)||(this.#X.history.push(!1),this.#X.history.resetButtons(e.get("key"),null)),Ut.utils.removeClass(o,"se-source-view-status")),this.#X.ui._updatePlaceholder(e),this.#X.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.#js.triggerEvent("onToggleMarkdownView",{frameContext:e,is:e.get("isMarkdownView")})}fullScreen(t){const e=this.#K;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.#K.get("isCodeView"),p=this.#K.get("isMarkdownView"),g=this.#e.get("toolbar_arrow");this.#X.ui.offCurrentController();const m="none"===i.style.display||this.#t.mode.isInline&&!this.#X.toolbar.inlineToolbarAttr.isShow;if(t){this.#qn=s.style.cssText,this.#Tn=n.style.cssText,this.#Mn=o.style.cssText,this.#Hn=l.style.cssText,this.#Ln=r.style.cssText,this.#Nn=a?.style.cssText,this.#Bn=h?.style.cssText,this.#An=c?.style.cssText,this.#In=d?.style.cssText,this.#Vn=i.style.cssText,g&&(this.#On=g.style.cssText),(this.#t.mode.isBalloon||this.#t.mode.isInline)&&(g&&(g.style.display="none"),this.#Pn=this.#t.mode.isInline,this.#Fn=this.#t.mode.isBalloon,this.#t.mode.isInline=this.#X.toolbar.isInlineMode=!1,this.#t.mode.isBalloon=this.#X.toolbar.isBalloonMode=!1),this.#it.get("toolbar_container")&&(this.#Dn=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.#zn=!0,e.get("_stickyDummy").style.display="none",Ut.utils.removeClass(i,"se-toolbar-sticky")),this.#En=bi.body.style.overflow,bi.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.#J.get("_defaultStyles").editor+(u||p?"display: none;":""),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.#Rn=vi.innerHeight-i.offsetHeight,n.style.height=this.#Rn-(e.has("statusbar")?e.get("statusbar").offsetHeight:0)-this.#it.get("fullScreenOffset")+"px",this.#J.get("iframe")&&"auto"===this.#J.get("height")&&(n.style.overflow="auto",this.#X.ui._iframeAutoHeight(e)),e.get("topArea").style.marginTop=this.#it.get("fullScreenOffset")+"px";const t=this.#Ji.reduction;this.#X.commandDispatcher.applyTargets("fullScreen",(e=>{Ut.utils.changeElement(e.firstElementChild,t),Ut.utils.addClass(e,"active")}))}else{o.style.cssText=this.#Mn.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+(u||p?"display: none;":""),l.style.cssText=this.#Hn.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+`display: ${u?"flex":"none"} !important;`,r.style.cssText=this.#Ln,a&&(a.style.cssText=this.#Nn),h&&(h.style.cssText=this.#Bn.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+`display: ${p?"flex":"none"} !important;`),c&&(c.style.cssText=this.#An),d&&(d.style.cssText=this.#In),i.style.cssText=this.#Vn,n.style.cssText=this.#Tn,s.style.cssText=this.#qn,g&&(g.style.cssText=this.#On),bi.body.style.overflow=this.#En,"auto"!==this.#J.get("height")||this.#it.get("hasCodeMirror")||this._codeViewAutoHeight(e.get("code"),e.get("codeNumbers"),!0),this.#Dn&&(this.#Dn.appendChild(i),this.#Dn=null),this.#it.get("toolbar_sticky")>-1&&Ut.utils.removeClass(i,"se-toolbar-sticky"),this.#zn&&!this.#it.get("toolbar_container")&&(this.#zn=!1,e.get("_stickyDummy").style.display="block",Ut.utils.addClass(i,"se-toolbar-sticky")),this.#t.mode.isInline=this.#X.toolbar.isInlineMode=this.#Pn,this.#t.mode.isBalloon=this.#X.toolbar.isBalloonMode=this.#Fn,e.get("isCodeView")||(this.#t.mode.isInline?this.#X.toolbar._showInline():this.#t.mode.isBalloon&&this.#X.toolbar._showBalloon()),this.#X.toolbar._resetSticky(),e.get("topArea").style.marginTop="";const t=this.#Ji.expansion;this.#X.commandDispatcher.applyTargets("fullScreen",(e=>{Ut.utils.changeElement(e.firstElementChild,t),Ut.utils.removeClass(e,"active")}))}!m||e.get("isCodeView")||e.get("isMarkdownView")||this.#X.toolbar.hide(),this.#js.triggerEvent("onToggleFullScreen",{frameContext:e,is:e.get("isFullScreen")})}showBlocks(t){const e=this.#K;void 0===t&&(t=!e.get("isShowBlocks")),e.set("isShowBlocks",!!t),t?(Ut.utils.addClass(e.get("wysiwyg"),"se-show-block"),Ut.utils.addClass(this.#X.commandDispatcher.targets.get("showBlocks"),"active")):(Ut.utils.removeClass(e.get("wysiwyg"),"se-show-block"),Ut.utils.removeClass(this.#X.commandDispatcher.targets.get("showBlocks"),"active")),this.#X.ui._syncFrameState(e)}_setButtonsActive(){const t=this.#K;if(t.get("isCodeView")?Ut.utils.addClass(this.#X.commandDispatcher.targets.get("codeView"),"active"):Ut.utils.removeClass(this.#X.commandDispatcher.targets.get("codeView"),"active"),t.get("isFullScreen")){const t=this.#Ji.reduction;this.#X.commandDispatcher.applyTargets("fullScreen",(e=>{Ut.utils.changeElement(e.firstElementChild,t),Ut.utils.addClass(e,"active")}))}else{const t=this.#Ji.expansion;this.#X.commandDispatcher.applyTargets("fullScreen",(e=>{Ut.utils.changeElement(e.firstElementChild,t),Ut.utils.removeClass(e,"active")}))}t.get("isMarkdownView")?Ut.utils.addClass(this.#X.commandDispatcher.targets.get("markdownView"),"active"):Ut.utils.removeClass(this.#X.commandDispatcher.targets.get("markdownView"),"active"),t.get("isShowBlocks")?Ut.utils.addClass(this.#X.commandDispatcher.targets.get("showBlocks"),"active"):Ut.utils.removeClass(this.#X.commandDispatcher.targets.get("showBlocks"),"active")}print(){const t=Ut.utils.createElement("IFRAME",{style:"display: none;"});bi.body.appendChild(t);const e=vi.getComputedStyle(this.#K.get("wysiwyg")).padding,s=this.#it.get("printTemplate")?this.#it.get("printTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.#X.html.get()):this.#X.html.get(),i=Ut.query.getIframeDocument(t),n=this.#K.get("_wd"),o=this.#it.get("_rtl")?" se-rtl":"",l=`\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.#J.get("iframe")){const t=this.#it.get("printClass")?'class="'+this.#it.get("printClass")+o+'"':this.#J.get("iframe_fullPage")?Ut.utils.getAttributesToString(n.body,["contenteditable"]):'class="'+this.#it.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${l}\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=bi.head.getElementsByTagName("link"),e=bi.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${l}\n\t\t\t\t\t</head>\n\t\t\t\t\t<body class="${(this.#it.get("printClass")||this.#it.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.#X.ui.showLoading(),vi.setTimeout((()=>{try{if(t.focus(),Dt.isEdge||Dt.isChromium||"StyleMedia"in Dt._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.#X.ui.hideLoading(),Ut.utils.removeItem(t)}}),1e3)}preview(){this.#X.menu.dropdownOff(),this.#X.menu.containerOff(),this.#X.ui.offCurrentController(),this.#X.ui.offCurrentModal();const t=this.#it.get("previewTemplate")?this.#it.get("previewTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.#X.html.get({withFrame:!0})):this.#X.html.get({withFrame:!0}),e=vi.open("","_blank"),s=this.#K.get("_wd"),i=this.#it.get("_rtl")?" se-rtl":"";if(this.#J.get("iframe")){const n=this.#it.get("printClass")?'class="'+this.#it.get("printClass")+i+'"':this.#J.get("iframe_fullPage")?Ut.utils.getAttributesToString(s.body,["contenteditable"]):'class="'+this.#it.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=bi.head.getElementsByTagName("link"),n=bi.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.#Qi.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.#it.get("printClass")?this.#it.get("printClass"):this.#it.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.#K.get("isFullScreen"))return this.#Rn+=vi.innerHeight-this.#e.get("toolbar_main").offsetHeight-(this.#K.has("statusbar")?this.#K.get("statusbar").offsetHeight:0)-this.#Rn,this.#K.get("wrapper").style.height=this.#Rn+"px",!0}_codeMirrorEditor(t,e,s){const i=s?this.#A.get(s).get("options"):this.#J;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.#it.get("hasCodeMirror")?this._codeMirrorEditor("set",t,null):this.#K.get("code").value=t}_getCodeView(){return this.#it.get("hasCodeMirror")?this._codeMirrorEditor("get",null,null):this.#K.get("code").value}_codeViewAutoHeight(t,e,s){s&&(t.style.height=t.scrollHeight+"px"),this.#jn(e,t)}_scrollLineNumbers(t){t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft}_markdownViewAutoHeight(t,e,s){s&&(t.style.height=t.scrollHeight+"px"),this.#jn(e,t)}_scrollMarkdownLineNumbers(t){t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft}#Un(){const t=this._getCodeView();if(this.#J.get("iframe_fullPage")){const e=this.#K.get("_wd"),s=(new DOMParser).parseFromString(t,"text/html");if(!this.#Xt.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.#J.get("height")||s.head.querySelector("style"))||(i+=Wt._setIframeStyleLinks(this.#J.get("iframe_cssFileName"))+Wt._setAutoHeightStyle(this.#J.get("height"))),e.head.innerHTML=i,e.body.innerHTML=this.#X.html.clean(s.body.innerHTML,{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.#it.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(!Ut.utils.hasClass(e.body,"sun-editor-editable")){const t=this.#it.get("_editableClass").split(" ");for(let s=0;s<t.length;s++)Ut.utils.addClass(e.body,t[s])}}else this.#K.get("wysiwyg").innerHTML=t.length>0?this.#X.html.clean(t,{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.#it.get("freeCodeViewMode")}):"<"+this.#it.get("defaultLine")+"><br></"+this.#it.get("defaultLine")+">"}#Wn(){const t=this.#X.html._convertToCode(this.#K.get("wysiwyg"),!1);let e="";if(this.#J.get("iframe_fullPage")){const s=Ut.utils.getAttributesToString(this.#K.get("_wd").body,null);e="<!DOCTYPE html>\n<html>\n"+this.#K.get("_wd").head.outerHTML.replace(/>(?!\n)/g,">\n")+"<body "+s+">\n"+t+"</body>\n</html>"}else e=t;this._setCodeView(e)}#Zn(){const t=Wt.htmlToJson(this.#K.get("wysiwyg").innerHTML),e=Kt.jsonToMarkdown(t);this.#K.get("markdown").value=e}#Gn(){const t=this.#K.get("markdown").value,e=Kt.markdownToHtml(t,this.#it.get("defaultLine"));this.#K.get("wysiwyg").innerHTML=e.length>0?this.#X.html.clean(e,{forceFormat:!0,whitelist:null,blacklist:null}):"<"+this.#it.get("defaultLine")+"><br></"+this.#it.get("defaultLine")+">"}#jn(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:Ci,_w:_i}=Dt;class xi{#X;#t;#Kn;#Yn;#Xn;#Jn;#Qn;#to;#eo;#so;#io;#no;#oo;#lo;#ro=!1;#ao=!0;#ho=[];#co=-1;#do="";#uo={matchCase:!1,wholeWord:!1,regex:!1};#po;#go=[];#mo=null;#fo=null;#vo=null;#bo=null;#yo=null;#wo=!1;static#Co=!1;static#_o(){if(xi.#Co)return;xi.#Co=!0;const t=Ci.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}",Ci.head.appendChild(t)}constructor(t){if(this.#X=t.$,this.#t=t.store,this.#po=!!_i.Highlight&&!!CSS?.highlights,this.#X.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(${Dt.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=Ut.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.#X);this.#Kn=t.panel,this.#Yn=t.findInput,this.#Xn=t.replaceInput,this.#Jn=t.countDisplay,this.#Qn=t.replaceRow,this.#to=t.btnCase,this.#eo=t.btnWord,this.#so=t.btnRegex,this.#io=t.btnPrev,this.#no=t.btnNext,this.#oo=t.btnReplace,this.#lo=t.btnReplaceAll,this.#xo();const e=this.#X.frameRoots.values().next().value.get("container");if(this.#t.mode.isBottom){const t=this.#X.context.get("toolbar_main");e.insertBefore(this.#Kn,t)}else{const t=e.querySelector(".se-wrapper");e.insertBefore(this.#Kn,t)}Dt.isResizeObserverSupported&&(this.#vo=new ResizeObserver((()=>this.#$o())).observe(this.#X.context.get("toolbar_main")))}}get isOpen(){return this.#ro}open(t=!0){const e=this.#X.frameContext;if(!e.get("isCodeView")&&!e.get("isMarkdownView")&&(this.#ro=!0,this.#ko(),this.#Kn)){this.#io.disabled=!0,this.#no.disabled=!0,this.#oo.disabled=!0,this.#lo.disabled=!0,this.#$o();const e=this.#X.selection.get(),s=e&&!e.isCollapsed?e.toString().trim():"";Ut.utils.addClass(this.#Kn,"se-find-replace-open"),this.#t.set("_preventBlur",!0),this.#So(),t&&this.#Eo(t),s&&(this.#Yn.value=s),this.#Yn.focus(),this.#Yn.select(),this.#Yn.value&&this.#To()}}#$o(){if(!this.#ro||!this.#Kn)return;const t=this.#X.options.get("toolbar_sticky");this.#t.mode.isBottom?(this.#Kn.style.top="auto",this.#Kn.style.bottom=t>=0?t+this.#X.context.get("toolbar_main").offsetHeight+"px":"0px"):this.#Kn.style.top=t>=0?t+this.#X.context.get("toolbar_main").offsetHeight+"px":"0px"}close(){this.#ro&&(this.#ro=!1,this.#Mo(),this.#ho=[],this.#co=-1,this.#Ho(),this.#Lo(),this.#Kn&&(Ut.utils.removeClass(this.#Kn,"se-find-replace-open"),this.#No(),this.#t.set("_preventBlur",!1),this.#X.focusManager.nativeFocus()))}findNext(){this.#ro&&0!==this.#ho.length&&(this.#co=(this.#co+1)%this.#ho.length,this.#Bo())}findPrev(){this.#ro&&0!==this.#ho.length&&(this.#co=(this.#co-1+this.#ho.length)%this.#ho.length,this.#Bo())}search(t,{matchCase:e,wholeWord:s,regex:i}={}){return this.#ro||this.open(),void 0!==e&&(this.#uo.matchCase=e),void 0!==s&&(this.#uo.wholeWord=s),void 0!==i&&(this.#uo.regex=i),this.#do=t||"",this.#Yn&&(this.#Yn.value=this.#do),this.#To(),this.#ho.length}replace(t){this.#Ao(t)}replaceAll(t){this.#Io(t)}get matchInfo(){return{current:this.#co+1,total:this.#ho.length}}refresh(){this.#ro&&this.#do&&!this.#wo&&(this.#wo=!0,this.#Vo(),this.#go=[],this.#wo=!1,clearTimeout(this.#fo),this.#fo=setTimeout((()=>this.#To()),300))}#So(){this.#No(),this.#bo=this.#X.eventManager.addGlobalEvent("keydown",(t=>{"Escape"===t.key&&(t.preventDefault(),t.stopPropagation(),this.close())}),!0)}#No(){this.#bo&&=this.#X.eventManager.removeGlobalEvent(this.#bo)}#ko(){this.#Lo();const t=this.#X.frameContext.get("wysiwyg");this.#yo=new MutationObserver((()=>this.refresh())),this.#yo.observe(t,{childList:!0,subtree:!0,characterData:!0})}#Lo(){this.#yo&&(this.#yo.disconnect(),this.#yo=null)}#xo(){const t=this.#X.eventManager;t.addEvent(this.#Yn,"input",this.#Oo.bind(this)),t.addEvent(this.#Yn,"keydown",this.#Ro.bind(this)),t.addEvent(this.#Xn,"keydown",this.#zo.bind(this)),t.addEvent(this.#Kn,"click",this.#Fo.bind(this)),Dt.isGecko&&t.addEvent(this.#Kn,"mousedown",(t=>{if("BUTTON"===t.target.tagName){t.preventDefault();const e=Ut.query.getCommandTarget(t.target);e&&this.#X.eventManager._injectActiveEvent(e)}this.#t.set("_preventBlur",!0)}))}#Oo(){this.#X.options.get("finder_liveSearch")&&(clearTimeout(this.#fo),this.#fo=setTimeout((()=>this.#To()),120))}#Ro(t){"Escape"===t.key?(t.preventDefault(),this.close()):"Enter"===t.key&&(t.preventDefault(),this.#X.options.get("finder_liveSearch")||this.#Yn.value===this.#do?t.shiftKey?this.findPrev():this.findNext():this.#To())}#zo(t){"Escape"===t.key?(t.preventDefault(),this.close()):"Enter"===t.key&&(t.preventDefault(),this.#Ao())}#Fo(t){const e=Ut.query.getEventTarget(t),s=Ut.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.#Eo(!this.#ao);break;case"close":this.close();break;case"replace":this.#Ao();break;case"replace-all":this.#Io();break;case"opt-case":this.#uo.matchCase=!this.#uo.matchCase,Ut.utils.toggleClass(this.#to,"on",this.#uo.matchCase),this.#To();break;case"opt-word":this.#uo.wholeWord=!this.#uo.wholeWord,Ut.utils.toggleClass(this.#eo,"on",this.#uo.wholeWord),this.#To();break;case"opt-regex":this.#uo.regex=!this.#uo.regex,Ut.utils.toggleClass(this.#so,"on",this.#uo.regex),this.#To()}}#Eo(t){this.#ao=t,this.#Qn.style.display=t?"":"none",Ut.utils.toggleClass(this.#Kn.querySelector(".se-find-toggle-replace"),"on",t),t&&this.#Xn.focus()}#To(){const t=this.#Yn?this.#Yn.value:this.#do;if(this.#wo=!0,this.#Mo(),this.#ho=[],this.#co=-1,!t)return this.#do="",this.#Ho(),void Ut.utils.removeClass(this.#Yn,"se-find-no-match");this.#do=t;const e=this.#X.frameContext.get("wysiwyg");this.#mo=this.#Po(),this.#ho=this.#Do(t,e),this.#ho.length>0?(this.#co=0,this.#qo(),this.#Bo(),Ut.utils.removeClass(this.#Yn,"se-find-no-match")):this.#Yn&&Ut.utils.toggleClass(this.#Yn,"se-find-no-match",t.length>0),this.#Ho(),this.#wo=!1}#Do(t,e){const s=[];if(!t||!e)return s;const i=this.#uo.matchCase?"g":"gi";let n;if(this.#uo.regex)try{n=new RegExp(t,i)}catch{return s}else{const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=this.#uo.wholeWord?new RegExp(`\\b${e}\\b`,i):new RegExp(e,i)}const o=this.#mo,l=this.#X.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}#qo(){if(0===this.#ho.length)return;const t=this.#X.frameContext.get("options").get("iframe");this.#po&&!t?this.#Wo():this.#Uo()}#Wo(){xi.#_o();const t=new Highlight(...this.#ho);CSS.highlights.set("se-find-match",t),this.#Zo()}#Zo(){if(this.#co>=0&&this.#co<this.#ho.length){const t=new Highlight(this.#ho[this.#co]);CSS.highlights.set("se-find-current",t)}else CSS.highlights.delete("se-find-current")}#Uo(){this.#Vo();const t=this.#mo;for(let e=this.#ho.length-1;e>=0;e--){const s=this.#ho[e],i=this.#Go(t,s,e);for(let t=0;t<i.length;t++)this.#go.push(i[t])}this.#go.reverse(),this.#jo()}#Go(t,e,s){const i=e.startContainer,n=e.endContainer,o=[];if(i===n)o.push(this.#Ko(t,i,e.startOffset,e.endOffset,s));else{const l=[i];let r=i;for(;r&&r!==n;)r=this.#Yo(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.#Ko(t,a,h,c,s))}}return o}#Ko(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}#Yo(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}#jo(){for(const t of this.#go)Ut.utils.removeClass(t,"se-find-current");if(this.#co>=0)for(const t of this.#go)t.getAttribute("data-se-find-idx")===String(this.#co)&&Ut.utils.addClass(t,"se-find-current")}#Mo(){const t=this.#X.frameContext.get("options").get("iframe");this.#po&&!t&&(CSS.highlights.delete("se-find-match"),CSS.highlights.delete("se-find-current")),this.#Vo()}#Vo(){const t=this.#X.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.#go=[]}}#Bo(){if(this.#co<0||this.#co>=this.#ho.length)return;const t=this.#X.frameContext.get("options").get("iframe");if(this.#po&&!t){this.#Zo();const t=this.#ho[this.#co];this.#X.selection.scrollTo(t,{behavior:"auto"})}else{this.#jo();const t=this.#go.find((t=>t.getAttribute("data-se-find-idx")===String(this.#co)));t&&this.#X.selection.scrollTo(t,{behavior:"auto",noFocus:!0})}this.#Ho()}#Ao(t){if(this.#co<0||0===this.#ho.length)return;this.#Mo();const e=this.#X.frameContext.get("wysiwyg"),s=this.#Do(this.#do,e);this.#co>=s.length||(this.#Xo(s[this.#co],t??(this.#Xn?this.#Xn.value:"")),this.#X.history.push(!1),this.#To(),this.#co>=this.#ho.length&&this.#ho.length>0&&(this.#co=0,this.#Bo()))}#Io(t){if(0===this.#ho.length)return;this.#Mo();const e=this.#X.frameContext.get("wysiwyg"),s=this.#Do(this.#do,e);if(0!==s.length){t=t??(this.#Xn?this.#Xn.value:"");for(let e=s.length-1;e>=0;e--)this.#Xo(s[e],t);e.normalize(),this.#X.history.push(!1),this.#To()}}#Xo(t,e){const s=t.startContainer,i=this.#mo.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())}#Ho(){if(!this.#Kn)return;const t=this.#ho.length>0;this.#Jn.textContent=t?`${this.#co+1}/${this.#ho.length}`:this.#do?"0":"",this.#io.disabled=!t,this.#no.disabled=!t,this.#oo.disabled=!t,this.#lo.disabled=!t}#Po(){const t=this.#X.frameContext;return t.get("options").get("iframe")?t.get("_wd"):Ci}_destroy(){this.#No(),this.#Lo(),this.#vo&&=this.#vo.disconnect(),clearTimeout(this.#fo)}}const $i=xi;const ki=class{$;constructor(t){this.$=t.$}},{isMobile:Si,_w:Ei}=Dt;function Ti(t){const e=Ut.query.getEventTarget(t);let s=e;this.$.store.mode.isBalloon&&!this.$.context.get("toolbar_sub_main")?.contains(s)&&this._hideToolbar_sub();const i=Ut.check.isInputElement(s);if(i?this.$.store.set("_preventBlur",!1):this.$.frameContext.get("wysiwyg").contains(this.$.selection.getNode())||this.$.focusManager.focus(),Ut.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(),!Ut.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{Ei.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")||(Si?this.$.store.set("_preventBlur",!0):(t.preventDefault(),Dt.isGecko&&n&&this.$.eventManager._injectActiveEvent(s)))}n!==this.$.menu.currentDropdownName&&n!==this.$.menu.currentContainerName||t.stopPropagation()}}function Mi(t){const e=Ut.query.getEventTarget(t),s=Ut.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 Hi(t){const e=Ut.query.getEventTarget(t);this.$.commandDispatcher.runFromTarget(e)}const{_w:Li}=Dt;async function Ni(t,e){const s=Ut.query.getEventTarget(e);this.$.store.set("_mousedown",!0),this.__onDownEv&&Bi.call(this),this.__onDownEv=this.$.eventManager.addGlobalEvent("mouseup",Bi.bind(this)),t.get("isReadOnly")||Ut.check.isNonEditable(t.get("wysiwyg"))||(this.$.format._isExcludeSelectionElement(s)?e.preventDefault():(this._setSelectionSync(),Li.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 Bi(){this.$.store.set("_mousedown",!1),this.__onDownEv=this.$.eventManager.removeGlobalEvent(this.__onDownEv)}async function Ai(t,e){!1!==await this.$.eventManager.triggerEvent("onMouseUp",{frameContext:t,event:e})&&await this._callPluginEventAsync("onMouseUp",{frameContext:t,event:e})}async function Ii(t,e){const s=Ut.query.getEventTarget(e);if(t.get("isReadOnly"))return e.preventDefault(),Ut.check.isAnchor(s)&&Li.open(s.href,s.target),!1;if(Ut.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&&!Ut.check.isNonEditable(s)&&!Ut.check.isList(l)){const t=this.$.selection.getRange();if(this.$.format.getLine(t.startContainer)===this.$.format.getLine(t.endContainer))if(Ut.check.isList(l)){e.preventDefault();const t=n.nextElementSibling,s=Ut.utils.createElement("LI",null,n);l.insertBefore(s,t),this.$.focusManager.focus()}else Ut.check.isWysiwygFrame(n)||this.$.component.is(n)||Ut.check.isTableElements(n)&&!Ut.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)&&Li.setTimeout(this._toggleToolbarBalloon.bind(this),0)}function Vi(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return!1;const s=Ut.query.getEventTarget(e);!1!==ws.get("__overInfo")&&this.$.component.hoverSelect(s),this._callPluginEvent("onMouseMove",{frameContext:t,event:e})}async function Oi(t,e){!1!==await this.$.eventManager.triggerEvent("onMouseLeave",{frameContext:t,event:e})&&await this._callPluginEventAsync("onMouseLeave",{frameContext:t,event:e})}async function Ri(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;const s=(null===e.data?"":void 0===e.data?" ":e.data)||"";if(Gt.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 zi(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)&&!Ut.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 Fi={"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})=>Ut.utils.removeItem(e),"select.component.fallback":({ports:t},{cmponentInfo:e})=>{!1===t.component.select(e.target,e.pluginName)&&t.focusManager.blur()}},Pi={"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(Ut.check.isZeroWidth(s))return Ut.utils.removeItem(s),e;const i=s.childNodes;for(;i[0];)t.appendChild(i[0]);return Ut.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(Ut.check.isZeroWidth(s))return Ut.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 Ut.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=Ut.utils.createElement(i);for(;s.firstChild&&!Ut.check.isBreak(s.firstChild);)o.appendChild(s.firstChild);s.firstChild&&Ut.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(Ut.utils.createElement(t.options.get("defaultLine"),null,"<br>"),e)},"backspace.component.select":({ports:t},{selectionNode:e,range:s,fileComponentInfo:i})=>{let n=null;Ut.check.isBreak(e)?Ut.utils.removeItem(e):Ut.check.isBreak(n=s.startContainer.childNodes?.[s.startOffset])&&Ut.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&&Ut.utils.removeItem(s),0===i.textContent.length&&Ut.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=Ut.utils.createTextNode(qt.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;Ut.utils.removeItem(s),0===i.children.length&&Ut.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)},"delete.component.select":({ports:t},{formatEl:e,fileComponentInfo:s})=>{if(Ut.check.isListCell(e)){const t=s.container.previousSibling;Ut.check.isZeroWidth(t)&&Ut.utils.removeItem(t)}else Ut.check.isZeroWidth(e)&&Ut.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(Ut.check.isZeroWidth(s)&&(Ut.utils.removeItem(s),Ut.check.isTable(i))){let e=Ut.query.getEdgeChild(i,Ut.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(),Ut.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=Ut.utils.arrayFind(i.children,Ut.check.isList)||i.nextElementSibling||n.parentElement.nextElementSibling;if(o&&(Ut.check.isList(o)||Ut.utils.arrayFind(o.children,Ut.check.isList))){let s,n;if(e.e.preventDefault(),Ut.check.isList(o)){const t=o.firstElementChild;for(n=t.childNodes,s=n[0];n[0];)i.insertBefore(n[0],o);Ut.utils.removeItem(t)}else{for(s=o.firstChild,n=o.childNodes;n[0];)i.appendChild(n[0]);Ut.utils.removeItem(o)}t.selection.setRange(s,0,s,0),t.history.push(!0)}},"tab.format.indent":({ports:t,ctx:e},{range:s,formatEl:i,shift:n})=>{const o=t.format.getLines(null),l=[],r=[],a=Ut.check.isListCell(o[0]),h=Ut.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],Ut.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(!Ut.check.isZeroWidth(t)){/^\s{1,4}$/.test(t.textContent)?Ut.utils.removeItem(t):/^\s{1,4}/.test(t.textContent)&&(t.textContent=t.textContent.replace(/^\s{1,4}/,""));break}}const e=Ut.query.getEdgeChild(r[0],"text",!1),s=Ut.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=Ut.query.findTextIndexOnLine(i,s.startContainer,s.startOffset,(e=>t.component.is(e))),o=t.format.isLine(i.previousElementSibling)?Ut.query.findTabEndIndex(i.previousElementSibling,e,2):0;o>e&&(n=o-e)}const o=Ut.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=Ut.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&&(Ut.check.isBreak(e)?r[i].insertBefore(t.cloneNode(!1),e):e.textContent=t.textContent+e.textContent);const i=Ut.query.getEdgeChild(r[0],"text",!1),n=Ut.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,ctx:e},{formatEl:s})=>{const i=t.format.addLine(s,e.options.get("defaultLine")).firstChild;if(Ut.check.isBreak(i)){const e=Ut.utils.createTextNode(qt.zeroWidthSpace);i.parentNode.insertBefore(e,i),t.selection.setRange(e,1,e,1)}else t.selection.setRange(i,0,i,0)},"enter.list.addItem":({ports:t},{formatEl:e,selectionNode:s})=>{const i=Ut.utils.createElement("BR"),n=Ut.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(Ut.check.isListCell(i.parentElement)){const t=s.parentNode.parentElement;i=t.parentElement;const o=Ut.utils.createElement("LI");o.innerHTML="<br>",Ut.utils.copyTagAttributes(o,s,e.options.get("lineAttrReset")),n=o,i.insertBefore(n,t.nextElementSibling)}else{let o;o=Ut.check.isTableCell(i.parentElement)?"DIV":Ut.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=Ut.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?Ut.utils.removeItem(n[o-1]):Ut.utils.removeItem(e);const l=i.nextElementSibling,r=t.format.addLine(i,t.format.isLine(l)?l:null);Ut.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&&Ut.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.format.insertBrNode":({ports:t},{wSelection:e})=>{const s=e.focusNode.nextSibling,i=Ut.utils.createElement("BR");t.html.insertNode(i,{afterNode:null,skipCharCount:!0});const n=i.previousSibling,o=i.nextSibling;Ut.check.isBreak(s)||Ut.check.isBreak(n)||o&&!Ut.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})=>{const l=Ut.utils.createElement("BR"),r=Ut.utils.createElement(s.nodeName,null,l);Ut.utils.copyTagAttributes(r,s,e.options.get("lineAttrReset"));let a=l,h=i;do{if(!Ut.check.isBreak(h)&&1===h.nodeType){const t=h.cloneNode(!1);t.appendChild(a),a=t}h=h.parentElement}while(s!==h&&s.contains(h));if(r.appendChild(a),s.parentNode.insertBefore(r,n&&!o?s:s.nextElementSibling),o)t.selection.setRange(l,1,l,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&&Ut.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(Ut.check.isWysiwygFrame(h.container)&&(t.enterPrevent(e.e),e.fc.get("wysiwyg").appendChild(r),c=r,Ut.utils.copyTagAttributes(c,s,e.options.get("lineAttrReset")),t.selection.setRange(c,d,c,d)));const u=t.format.getBlock(h.container);if(c=c.contains(u)?Ut.query.getEdgeChild(u,(e=>Boolean(t.format.getLine(e))),!1):c,l){if(o&&!n)c.parentNode.insertBefore(r,h.prevContainer&&h.container!==h.prevContainer?c:c.nextElementSibling),c=r,d=0;else if(d=h.offset,n){const t=c.parentNode.insertBefore(r,c);o&&(c=t,d=0)}}else o&&n?(c.parentNode.insertBefore(r,h.prevContainer&&h.container===h.prevContainer?c.nextElementSibling:c),c=r,d=0):o?(c=c.parentNode.insertBefore(r,c.nextElementSibling),c=r,d=0):c=t.nodeTransform.split(h.container,h.offset,Ut.query.getNodeDepth(s));t.enterPrevent(e.e),Ut.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=Ut.check.isZeroWidth(s)?t.format.addLine(s,s.cloneNode(!1)):t.nodeTransform.split(i.endContainer,i.endOffset,Ut.query.getNodeDepth(s)),t.enterPrevent(e.e),Ut.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(Ut.utils.createTextNode(" "),{afterNode:null,skipCharCount:!0});e&&t.selection.setRange(e,e.length,e,e.length)},"keydown.input.insertZWS":({ports:t})=>{const e=Ut.utils.createTextNode(qt.zeroWidthSpace);t.html.insertNode(e,{afterNode:null,skipCharCount:!0}),t.selection.setRange(e,1,e,1)}};function Di(t){const e=t.selection.getRange(),s=e.startContainer,i=e.endContainer,n=t.format.getBlock(s),o=t.format.getBlock(i),l=Ut.check.isTableCell(n),r=Ut.check.isTableCell(o);if((l&&!n.previousElementSibling&&!n.parentElement.previousElementSibling||r&&!o.nextElementSibling&&!o.parentElement.nextElementSibling)&&n!==o){const s=Ut.query.getParentElement(e.commonAncestorContainer,Ut.check.isFigure)?.parentElement||e.commonAncestorContainer;if(l){if(r)return Ut.utils.removeItem(Ut.query.getParentElement(n,(t=>s===t.parentNode))),t.focusManager.nativeFocus(),!0;Ut.utils.removeItem(Ut.query.getParentElement(n,(t=>s===t.parentNode)))}else Ut.utils.removeItem(Ut.query.getParentElement(o,(t=>s===t.parentNode)))}const a=1===s.nodeType?Ut.query.getParentElement(s,".se-component"):null,h=1===i.nodeType?Ut.query.getParentElement(i,".se-component"):null;return a&&Ut.utils.removeItem(a),h&&Ut.utils.removeItem(h),!1}function qi(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=Wi(t,i.childNodes[n],o,i),Ut.check.isComponentContainer(l)||Ut.check.isNonEditable(l)?l:null):(l=Wi(t,i,o,i),Ut.check.isEdgePoint(i,n,s?"front":"end")&&(Ut.check.isComponentContainer(l)||Ut.check.isNonEditable(l))?l:null)}function Wi(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}const Ui=()=>({t:"event.prevent"}),Zi=()=>({t:"event.prevent.stop"}),Gi=()=>({t:"cache.styleNode"}),ji=t=>({t:"cache.formatAttrsTemp",p:{attrs:t}}),Ki=()=>({t:"component.deselect"}),Yi=()=>({t:"focusManager.nativeFocus"}),Xi=t=>({t:"history.push",p:t}),Ji=()=>({t:"documentType.refreshHeader"}),Qi=(t,e,s,i,n)=>({t:"format.removeBlock",p:{rangeEl:t,selectedFormats:e,newBlockElement:s,shouldDelete:i,skipHistory:n}}),tn=t=>({t:"dom.utils.removeItem",p:{item:t}}),en=t=>({t:"select.component.fallback",p:{cmponentInfo:t}}),sn=(t,e)=>({t:"del.format.removeAndMove",p:{container:t,formatEl:e}}),nn=t=>({t:"backspace.format.maintain",p:{formatEl:t}}),on=t=>({t:"backspace.brline.strip",p:{formatEl:t}}),ln=(t,e,s)=>({t:"backspace.component.select",p:{selectionNode:t,range:e,fileComponentInfo:s}}),rn=(t,e,s,i)=>({t:"backspace.component.remove",p:{isList:t,sel:e,formatEl:s,fileComponentInfo:i}}),an=(t,e,s)=>({t:"backspace.list.mergePrev",p:{prev:t,formatEl:e,rangeEl:s}}),hn=t=>({t:"backspace.list.removeNested",p:{range:t}}),cn=(t,e)=>({t:"delete.component.select",p:{formatEl:t,fileComponentInfo:e}}),dn=(t,e)=>({t:"delete.component.selectNext",p:{formatEl:t,nextEl:e}}),un=(t,e,s)=>({t:"delete.list.removeNested",p:{range:t,formatEl:e,rangeEl:s}}),pn=(t,e,s)=>({t:"tab.format.indent",p:{range:t,formatEl:e,shift:s}}),gn=t=>({t:"enter.scrollTo",p:{range:t}}),mn=t=>({t:"enter.line.addDefault",p:{formatEl:t}}),fn=(t,e)=>({t:"enter.list.addItem",p:{formatEl:t,selectionNode:e}}),vn=(t,e)=>({t:"enter.format.exitEmpty",p:{formatEl:t,rangeEl:e}}),bn=(t,e,s,i,n)=>({t:"enter.format.cleanBrAndZWS",p:{selectionNode:t,selectionFormat:e,brBlock:s,children:i,offset:n}}),yn=(t,e,s,i)=>({t:"enter.format.insertBrHtml",p:{brBlock:t,range:e,wSelection:s,offset:i}}),wn=t=>({t:"enter.format.insertBrNode",p:{wSelection:t}}),Cn=(t,e,s,i)=>({t:"enter.format.breakAtEdge",p:{formatEl:t,selectionNode:e,formatStartEdge:s,formatEndEdge:i}}),_n=(t,e,s,i)=>({t:"enter.format.breakWithSelection",p:{formatEl:t,range:e,formatStartEdge:s,formatEndEdge:i}}),xn=(t,e)=>({t:"enter.format.breakAtCursor",p:{formatEl:t,range:e}}),$n=t=>({t:"enter.figcaption.exitInList",p:{formatEl:t}}),kn=()=>({t:"keydown.input.insertNbsp"}),Sn=()=>({t:"keydown.input.insertZWS"});function En(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;if(t.push(Ki()),t.push(Gi()),c&&Di(e))return t.push(Zi()),!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(Zi()),!1;if(i.isLine(h)&&c&&Ut.check.isEdgePoint(r.startContainer,r.startOffset,"front")&&(!r.startContainer.previousSibling||Ut.check.isZeroWidth(r.startContainer.previousSibling))&&i.getLine(r.startContainer)!==i.getLine(r.endContainer)&&(i.isLine(h.previousElementSibling)||Ut.check.isListCell(h)))return t.push(Zi()),t.push(sn(r.startContainer,h)),t.push(Xi(!0)),!1;if(!c&&!h.previousElementSibling&&0===r.startOffset&&!a.previousSibling&&!Ut.check.isListCell(h)&&i.isLine(h)&&(!i.isBrLine(h)||i.isClosureBrLine(h)||Ut.check.isWysiwygFrame(h.parentNode)))return i.isClosureBlock(h.parentNode)?(t.push(Zi()),!1):i.isBrLine(h)&&Ut.check.isWysiwygFrame(h.parentNode)?(t.push(Zi()),t.push(on(h)),t.push(Xi(!0)),!1):(Ut.check.isWysiwygFrame(h.parentNode)&&h.childNodes.length<=1&&(!h.firstChild||Ut.check.isZeroWidth(h.textContent))&&(t.push(Zi()),t.push(nn(h))),t.push(Yi()),!1);const d=r.startContainer;if(h&&!h.previousElementSibling&&0===r.startOffset&&3===d.nodeType&&Ut.check.isZeroWidth(d)&&!0===function(t,e,s){let i=e.parentNode.previousSibling;const n=e.parentNode.nextSibling;i||(n?i=n:(i=Ut.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,d,h))return!0;if(!c&&h&&(0===r.startOffset||a===h)){const s=a===h?qi(e,r,!0):Ut.check.isElement(a.previousSibling)?a.previousSibling:Ut.check.isEdgePoint(r.startContainer,r.startOffset)?Ut.query.getPreviousDeepestNode(r.startContainer):null;if(n.is(s)){const e=n.get(s);if(e)return t.push(Zi()),t.push(ln(a,r,e)),!0}}if(qi(e,r,!0))return t.push(Zi()),!0;!c&&i.isEdgeLine(r.startContainer,r.startOffset,"front")&&i.isLine(h.previousElementSibling)&&t.push(ji(h.previousElementSibling.attributes)),h=i.getLine(r.startContainer,null);const u=i.getBlock(h,null),p=r.commonAncestorContainer;if(u&&h&&!Ut.check.isTableCell(u)&&!/^FIGCAPTION$/i.test(u.nodeName)){if(Ut.check.isListCell(h)&&Ut.check.isList(u)&&(Ut.check.isListCell(u.parentElement)||h.previousElementSibling)&&(a===h||3===a.nodeType&&(!a.previousSibling||Ut.check.isList(a.previousSibling)))&&(i.getLine(r.startContainer,null)!==i.getLine(r.endContainer,null)?u.contains(r.startContainer):0===r.startOffset&&r.collapsed)){if(r.startContainer!==r.endContainer)t.push(Ui()),t.push(hn(r)),t.push(Xi(!0));else{let e=h.previousElementSibling||u.parentElement;if(Ut.check.isListCell(e)){t.push(Ui());let s=e;if(!e.contains(h)&&Ut.check.isListCell(s)&&Ut.check.isList(s.lastElementChild)){for(s=s.lastElementChild.lastElementChild;Ut.check.isListCell(s)&&Ut.check.isList(s.lastElementChild);)s=s.lastElementChild&&s.lastElementChild.lastElementChild;e=s}t.push(an(e,h,u)),t.push(Xi(!0))}}return!0}if(!c&&0===r.startOffset){let e=!0,s=p;for(;s&&s!==u&&!Ut.check.isWysiwygFrame(s);){if(s.previousSibling&&(1===s.previousSibling.nodeType||!Ut.check.isZeroWidth(s.previousSibling.textContent.trim()))){e=!1;break}s=s.parentNode}if(e&&u.parentNode)return t.push(Ui()),t.push(Qi(u,Ut.check.isListCell(h)?[h]:null,null,!1,!1)),t.push(Xi(!0)),!0}}if(!c&&h&&(0===r.startOffset||a===h&&h.childNodes[r.startOffset])){const e=Ut.check.isListCell(h),s=a===h?h.childNodes[r.startOffset]:a,i=(e?s:h).previousSibling,o=e||(3===p.nodeType||Ut.check.isBreak(p))&&!p.previousSibling&&0===r.startOffset;if(s&&(e||!s.previousSibling)&&(p&&n.is(p.previousSibling)||o&&n.is(i))){const o=n.get(i);return o?(t.push(Zi()),t.push(rn(e,s,h,o))):n.is(i)&&(t.push(Zi()),t.push(tn(i))),!0}if(s&&Ut.check.isNonEditable(s.previousSibling))return t.push(Zi()),t.push(tn(s.previousSibling)),!0}return!0}const{isOSX_IOS:Tn}=Dt;async function Mn(t,e){const s=[];switch(e.keyCode){case"Backspace":if(!1===En(s,t,e))return s;break;case"Delete":if(!1===function(t,e,s){const{format:i,component:n}=e,{range:o,selectionNode:l}=s;let{formatEl:r}=s;const a=!o.collapsed||o.startContainer!==o.endContainer;if(t.push(Ki()),t.push(Gi()),a&&Di(e))return t.push(Zi()),!0;if(!a&&i.isEdgeLine(o.endContainer,o.endOffset,"end")&&!r.nextSibling)return t.push(Zi()),!1;if(i.isLine(r)&&a&&Ut.check.isEdgePoint(o.endContainer,o.endOffset,"end")&&(!o.endContainer.nextSibling||Ut.check.isZeroWidth(o.endContainer.nextSibling))&&i.getLine(o.startContainer)!==i.getLine(o.endContainer)&&(i.isLine(r.nextElementSibling)||Ut.check.isListCell(r)))return t.push(Zi()),t.push(sn(o.endContainer,r)),t.push(Xi(!0)),!1;if(!a&&r&&(o.endOffset===o.endContainer.textContent.length||l===r)){const s=l===r?qi(e,o,!1):Ut.check.isElement(l.nextSibling)?l.nextSibling:Ut.check.isEdgePoint(o.endContainer,o.endOffset)?Ut.query.getNextDeepestNode(o.endContainer,null):null;if(n.is(s)){const e=n.get(s);if(e)return t.push(Zi()),t.push(cn(r,e)),!0}}if(qi(e,o,!1))return t.push(Zi()),!0;if((i.isLine(l)||null===l.nextSibling||Ut.check.isZeroWidth(l.nextSibling)&&null===l.nextSibling.nextSibling)&&o.startOffset===l.textContent.length){const e=r.nextElementSibling;if(!e)return!0;if(n.is(e))return t.push(Ui()),t.push(dn(r,e)),!0}if(!a&&(Ut.check.isEdgePoint(o.endContainer,o.endOffset)||l===r&&r.childNodes[o.startOffset])){const e=l===r&&r.childNodes[o.startOffset]||l;if(e&&Ut.check.isNonEditable(e.nextSibling))return t.push(Zi()),t.push(tn(e.nextSibling)),!0;if(n.is(e))return t.push(Zi()),t.push(tn(e)),!0}!a&&i.isEdgeLine(o.endContainer,o.endOffset,"end")&&i.isLine(r.nextElementSibling)&&t.push(ji(r.attributes)),r=i.getLine(o.startContainer,null);const h=i.getBlock(r,null);return!(Ut.check.isListCell(r)&&Ut.check.isList(h)&&(l===r||3===l.nodeType&&(!l.nextSibling||Ut.check.isList(l.nextSibling))&&(i.getLine(o.startContainer,null)!==i.getLine(o.endContainer,null)?h.contains(o.endContainer):o.endOffset===l.textContent.length&&o.collapsed))&&(t.push(un(o,r,h)),0))}(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(Ui()),r||a||Ut.check.isWysiwygFrame(n)||(t.push(pn(o,l,h)),t.push(Xi(!1))),!0)}(s,0,e))return s;break;case"Enter":if(!1===function(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(Ki());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(Ui()),!1}if(!c){const s=!r.endContainer.nextSibling&&i.isEdgeLine(r.endContainer,r.endOffset,"end"),n=!r.startContainer.previousSibling&&i.isEdgeLine(r.startContainer,r.startOffset,"front");if(s&&(/^H[1-6]$/i.test(a.nodeName)||/^HR$/i.test(a.nodeName)))return e.enterPrevent(d),t.push(mn(a)),t.push(gn(r)),!0;if(g&&a&&!Ut.check.isTableCell(g)&&!/^FIGCAPTION$/i.test(g.nodeName)){const s=o.getRange();if(Ut.check.isEdgePoint(s.endContainer,s.endOffset)&&Ut.check.isList(h.nextSibling))return e.enterPrevent(d),t.push(fn(a,h)),t.push(gn(r)),!0;if((3!==s.commonAncestorContainer.nodeType||!s.commonAncestorContainer.nextElementSibling)&&Ut.check.isZeroWidth(a.innerText.trim())&&!Ut.check.isListCell(a.nextElementSibling))return e.enterPrevent(d),t.push(vn(a,g)),!0}if(p||g===a&&i.isClosureBlock(g)&&i.isLine(a)){e.enterPrevent(d);const s=h===p,n=o.get(),l=h.childNodes,a=n.focusOffset,c=h.previousElementSibling,u=h.nextSibling;return!i.isClosureBrLine(p)&&l&&(s&&r.collapsed&&l.length-1<=a+1&&Ut.check.isBreak(l[a])&&(!l[a+1]||(!l[a+2]||Ut.check.isZeroWidth(l[a+2].textContent))&&3===l[a+1].nodeType&&Ut.check.isZeroWidth(l[a+1].textContent))&&a>0&&Ut.check.isBreak(l[a-1])||!s&&Ut.check.isZeroWidth(h.textContent)&&Ut.check.isBreak(c)&&(Ut.check.isBreak(c.previousSibling)||!Ut.check.isZeroWidth(c.previousSibling?.textContent))&&(!u||!Ut.check.isBreak(u)&&Ut.check.isZeroWidth(u.textContent)))?(t.push(bn(h,s,p,l,a)),t.push(gn(r)),!0):(s?t.push(yn(p,r,n,a)):t.push(wn(n)),t.push(gn(r)),!0)}if(r.collapsed&&(n||s))return e.enterPrevent(d),t.push(Cn(a,h,n,s)),t.push(gn(r)),!0;if(a)return t.push(Ui()),u?t.push(_n(a,r,n,s)):t.push(xn(a,r)),t.push(gn(r)),!0}return u?(t.push(gn(r)),!0):(g&&Ut.query.getParentElement(g,"FIGCAPTION")&&Ut.query.getParentElement(g,Ut.check.isList)&&(e.enterPrevent(d),t.push($n(a)),t.push(gn(r))),!0)}(s,t,e))return s}const{fc:i,keyCode:n,shift:o,alt:l,ctrl:r,range:a}=e;if(o&&(Tn?l:r)&&Gt.isSpace(n))return s.push(Zi()),s.push(kn()),s;const h=!a.collapsed||a.startContainer!==a.endContainer;return r||l||h||Gt.isNonTextKey(n)||!Ut.check.isBreak(a.commonAncestorContainer)?!i.has("documentType_use_header")||!h||r||l||o||Gt.isDirectionKey(n)?(function(t,e,s){const{component:i}=e,{formatEl:n,range:o,selectionNode:l,keyCode:r}=s;let a=null;switch(r){case"ArrowUp":i.is(n.previousElementSibling)&&(a=i.get(n.previousElementSibling));break;case"ArrowLeft":if(Ut.check.isEdgePoint(l,o.startOffset,"front")){const t=l.previousElementSibling||Ut.query.getPreviousDeepestNode(l);t?i.is(t)&&(a=i.get(t)):i.is(n.previousElementSibling)&&(a=i.get(n.previousElementSibling))}break;case"ArrowDown":i.is(n.nextElementSibling)&&(a=i.get(n.nextElementSibling));break;case"ArrowRight":if(Ut.check.isEdgePoint(l,o.endOffset,"end")){const t=l.nextElementSibling||Ut.query.getNextDeepestNode(l);t?i.is(t)&&(a=i.get(t)):i.is(n.nextElementSibling)&&(a=i.get(n.nextElementSibling))}}a&&!a.options?.isInputComponent&&(t.push(Ui()),t.push(en(a)))}(s,t,e),s):(s.push(Ji()),s):(s.push(Sn()),s)}const{_w:Hn}=Dt,Ln=new RegExp(qt.zeroWidthSpace+"+",""),Nn={ctrl:!1,alt:!1},Bn=Object.preventExtensions({value:[]});async function An(t,e){if(this.isComposing=Gt.isComposing(e))return!0;if(this.$.ui.selectMenuOn||!e.isTrusted)return;let s=this.$.selection.getNode();if(Ut.check.isInputElement(s))return;if(this.$.menu.currentDropdownName)return;const i=e.code,n=Gt.isShift(e),o=Nn.ctrl=Gt.isCtrl(e),l=Nn.alt=Gt.isAlt(e);if(!o&&t.get("isReadOnly")&&!Gt.isDirectionKey(i))return e.preventDefault(),!1;if(this.$.menu.dropdownOff(),this.$.store.mode.isBalloon?this._hideToolbar():this.$.store.mode.isSubBalloon&&this._hideToolbar_sub(),!1===await this.$.eventManager.triggerEvent("onKeyDown",{frameContext:t,event:e}))return;Gt.isEnter(i)&&this.$.format.isLine(this.$.selection.getRange()?.startContainer)&&(this.$.selection.resetRangeToTextNode(),s=this.$.selection.getNode());const r=this.$.selection.getRange(),a=this.$.format.getLine(s,null)||s;if(o&&!Gt.isNonTextKey(i)&&this.$.shortcuts.command(e,o,n,i,"",!1,null,null))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1;if(!o&&!Gt.isNonTextKey(i)&&this.$.format.isLine(a)&&r.collapsed&&Ut.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);if(!1===await this._callPluginEventAsync("onKeyDown",{frameContext:t,event:e,range:r,line:a}))return;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=function(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)},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(e){i._iframeAutoHeight(s),b&&t.scrollparents.length>0||o.scrollTo(e,{behavior:"auto",block:"nearest",inline:"nearest"})},enterPrevent(e){e.preventDefault(),b&&(t.__focusTemp.focus({preventScroll:!0}),s.get("wysiwyg").focus({preventScroll:!0}))}}}(this,{_styleNodes:Bn}),d=await Mn(c,h);await async function(t,e){const s={...Fi,...Pi};for(const i of t){if("action.stop"===i.t)return!1;const t=s[i.t];if(t&&!1===await t(e,i.p))return!1}}(d,{ports:c,ctx:h})}async function In(t,e){if(this._onShortcutKey||this.$.menu.currentDropdownName)return;const s=e.code,i=Gt.isCtrl(e),n=Gt.isAlt(e);if(i&&(Nn.ctrl=!1),n&&(Nn.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)&&!Gt.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());Gt.isEsc(s)||this._showToolbarBalloonDelay()}if(Gt.isBackspace(s)&&Ut.check.isWysiwygFrame(l)&&""===l.textContent&&0===l.children.length){e.preventDefault(),e.stopPropagation(),l.innerHTML="";const i=this.$.store.get("currentNodes")[0],n=Ut.utils.createElement(this.$.format.isLine(i)&&!Ut.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")&&Gt.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++)Gt.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)||Ut.check.isList(l)||null===this._setDefaultLine(this.$.format.isBlock(a)?"DIV":this.$.options.get("defaultLine"))||(l=this.$.selection.getNode());if(!Nn.ctrl&&!Nn.alt&&!Gt.isNonTextKey(s)&&3===l.nodeType&&qt.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(Ln)||"").length;t=o.startOffset-s,e=o.endOffset-s,l.textContent=l.textContent.replace(qt.zeroWidthRegExp,""),this.$.selection.setRange(l,t<0?0:t,l,e<0?0:e)}if(Gt.isRemoveKey(s)&&Ut.check.isZeroWidth(r?.textContent)&&!r.previousElementSibling&&!Ut.check.isListCell(r)){const t=this.$.options.get("retainStyleMode");"none"!==t&&Bn.value?.length>0?"repeat"===t?this.__retainTimer?(this.__retainTimer=Hn.clearTimeout(this.__retainTimer),this._clearRetainStyleNodes(r)):(this.__retainTimer=Hn.setTimeout((()=>{this.__retainTimer=null}),0),this._retainStyleNodes(r,Bn.value)):(this.__retainTimer=null,this._retainStyleNodes(r,Bn.value)):this._clearRetainStyleNodes(r)}if(t.has("documentType_use_header"))if(Gt.isDocumentTypeObserverKey(s)){t.get("documentType").reHeader();const e=Ut.query.getParentElement(this.$.selection.selectionNode,this.$.format.isLine.bind(this.$.format));t.get("documentType").on(e)}else{const e=Ut.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})&&Gt.isHistoryRelevantKey(s)&&this.$.history.push(!0)}const{_w:Vn}=Dt;function On(t,e){const s=e.clipboardData;return!s||this._dataTransferAction("paste",e,s,t)}async function Rn(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 zn(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(),Vn.setTimeout((()=>{this.$.history.push(!1)}),0)}const{_w:Fn}=Dt;function Pn(t,e,s,i,n){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-Fn.scrollY,c.x=t.left-Fn.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+Fn.scrollX+c.x+i}px`,e.style.top=`${d.top+Fn.scrollY+c.y-5+n}px`,e.style.height=`${d.height+10}px`,e.style.display="block"}else e.style.display="none"}function Dn(t){t.style.display="none"}function qn(t,e,s){try{if(t.get("isReadOnly"))return s.preventDefault(),s.stopPropagation(),!1;const e=s.dataTransfer;if(!e)return!0;const{sc:i,so:n,ec:o,eo:l}=this.$.selection.getDragEventLocationRange(s);if(!i)return;if(Ut.query.getParentElement(i,".se-disable-pointer"))return void s.preventDefault();if(ws.get("__dragContainer")){if(s.preventDefault(),ws.get("__dragContainer").contains(s.target))return void this.$.component.deselect();const e=ws.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{e.style.display="none"}}class Wn{#X;constructor({$:t}){this.#X=t}execute(t){if(!this.#X.options.get("__lineFormatFilter"))return null;if(this.#X.pluginManager.fileInfo.pluginRegExp.test(this.#X.ui.currentControllerName))return;const e=this.#X.selection.getRange(),s=e.commonAncestorContainer,i=e.startContainer,n=e.endOffset,o=this.#X.format.getBlock(s,null);let l,r,a;if(o)return a=Ut.utils.createElement(t||this.#X.options.get("defaultLine")),a.innerHTML=o.innerHTML,0===a.childNodes.length&&(a.innerHTML=qt.zeroWidthSpace),o.innerHTML=a.outerHTML,a=o.firstChild,l=a.childNodes[n]||Ut.query.getEdgeChildNodes(a,null).sc,l||(l=Ut.utils.createTextNode(qt.zeroWidthSpace),a.insertBefore(l,a.firstChild)),r=l.textContent.length,void this.#X.selection.setRange(l,r,l,r);if(3===s.nodeType&&this.#X.component.is(s.parentElement)){const t=this.#X.component.get(s.parentElement);if(!t)return;const e=t.container;if(s.parentElement===e){const t=s.nextElementSibling?e:e.nextElementSibling,i=Ut.utils.createElement(this.#X.options.get("defaultLine"),null,s);return e.parentElement.insertBefore(i,t),void this.#X.focusManager.focusEdge(i)}return this.#X.component.select(t.target,t.pluginName),null}if(1===s.nodeType&&"true"===s.getAttribute("data-se-embed")){let t=s.nextElementSibling;return this.#X.format.isLine(t)||(t=this.#X.format.addLine(s,this.#X.options.get("defaultLine"))),void this.#X.selection.setRange(t.firstChild,0,t.firstChild,0)}if(!this.#X.format.isBlock(i)&&!Ut.check.isWysiwygFrame(i)||!this.#X.component.is(i.children[e.startOffset])&&!this.#X.component.is(i.children[e.startOffset-1])){if(Ut.query.getParentElement(s,Ut.check.isExcludeFormat))return null;if(this.#X.format.isBlock(s)&&s.childNodes.length<=1){let t=null;return 1===s.childNodes.length&&Ut.check.isBreak(s.firstChild)?t=s.firstChild:(t=Ut.utils.createTextNode(qt.zeroWidthSpace),s.appendChild(t)),void this.#X.selection.setRange(t,1,t,1)}try{if(3===s.nodeType&&(a=Ut.utils.createElement(t||this.#X.options.get("defaultLine")),s.parentNode.insertBefore(a,s),a.appendChild(s)),Ut.check.isBreak(a.nextSibling)&&Ut.utils.removeItem(a.nextSibling),Ut.check.isBreak(a.previousSibling)&&Ut.utils.removeItem(a.previousSibling),Ut.check.isBreak(l)){const t=Ut.utils.createTextNode(qt.zeroWidthSpace);l.parentNode.insertBefore(t,l),l=t}}catch{return this.#X.frameContext.get("_wd").execCommand("formatBlock",!1,`<${t||this.#X.options.get("defaultLine")}>`),this.#X.store.set("_lastSelectionNode",null),void this.#X.selection.init()}if(a&&(Ut.check.isBreak(a.nextSibling)&&Ut.utils.removeItem(a.nextSibling),Ut.check.isBreak(a.previousSibling)&&Ut.utils.removeItem(a.previousSibling),Ut.check.isBreak(l))){const t=Ut.utils.createTextNode(qt.zeroWidthSpace);l.parentNode.insertBefore(t,l),l=t}this.#X.store.set("_lastSelectionNode",null),i?this.#X.selection.setRange(i,1,i,1):this.#X.focusManager.nativeFocus()}}}class Un{#Jo;#X;#Qo;constructor(t){this.#Jo=t,this.#X=t.$,this.#Qo=new RegExp(`^(${Object.keys(this.#X.options.get("_defaultStyleTagMap")).join("|")})$`,"i")}update(t){if(t||=this.#X.selection.getNode(),t===this.#X.store.get("_lastSelectionNode"))return;this.#X.store.set("_lastSelectionNode",t);const e=this.#X.options.get("_rtl")?"marginRight":"marginLeft",s=this.#X.plugins,i=this.#X.commandDispatcher.targets,n=this.#Qo,o=this.#X.options.get("_styleCommandMap"),l=[],r=[],a=this.#X.options.get("_textStyleTags"),h=[],c=[],d=this.#X.commandDispatcher.activeCommands,u=d.length;let p="";if(this.#X.component.is(t)&&!this.#X.component.__selectionSelected){const e=this.#X.component.get(t);if(!e)return;return this.#X.store.set("_lastSelectionNode",null),void this.#X.component.select(e.target,e.pluginName)}for(;t.firstChild;)t=t.firstChild;const g=this.#X.frameContext,m=!g.get("isReadOnly");for(let g=t;!Ut.check.isWysiwygFrame(g)&&g;g=g.parentElement)if(1===g.nodeType&&!Ut.check.isBreak(g)){if(this.#tl(g))return void this.#X.focusManager.blur();if(p=g.nodeName.toLowerCase(),r.push(p),a.includes(p)&&!this.#X.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.#X.format.isLine(g)){if(!l.includes("outdent")&&i.has("outdent")&&(Ut.check.isListCell(g)||g.style[e]&&Zt.get(g.style[e],0)>0)&&i.get("outdent").filter((t=>!Ut.check.isImportantDisabled(t)&&(t.disabled=!1,!0))).length>0&&l.push("outdent"),!l.includes("indent")&&i.has("indent")){const t=Ut.check.isListCell(g)&&!g.previousElementSibling;i.get("indent").filter((e=>!Ut.check.isImportantDisabled(e)&&(e.disabled=t,!0))).length>0&&l.push("indent")}}else n.test(p)&&(p=o[p]||p,l.push(p),Ut.utils.addClass(i.get(p),"active"))}return this.#el(l),this.#Jo.__cacheStyleNodes=h.reverse(),this.#X.store.set("currentNodes",r.reverse()),this.#X.store.set("currentNodesMap",l),this.#X.frameOptions.get("statusbar_showPathLabel")&&g.get("navigation")&&(g.get("navigation").textContent=this.#X.options.get("_rtl")?this.#X.store.get("currentNodes").reverse().join(" < "):this.#X.store.get("currentNodes").join(" > ")),t}reset(){this.#el([])}#el(t){const e=this.#X.commandDispatcher.activeCommands,s=this.#X.commandDispatcher.targets,i=this.#X.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)?Ut.check.isImportantDisabled(t)||(t.disabled=!0):/^indent$/i.test(n)?Ut.check.isImportantDisabled(t)||(t.disabled=!1):Ut.utils.removeClass(t,"active"))}}#tl(t){return Ut.check.isElement(t)&&"true"===t.getAttribute("data-se-non-focus")}}const{_w:Zn,isMobile:Gn,isTouchDevice:jn}=Dt;function Kn(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 Yn=class extends ki{#t;#Gs;#e;#it;#js;#o;#sl;#il;#nl=null;#ol=null;#ll=null;#rl=null;constructor(t){super(t),this.#t=this.$.store,this.#Gs=this.$.contextProvider,this.#e=this.$.context,this.#it=this.$.options,this.#js=this.$.eventManager,this.#o=this.$.toolbar,this.#sl=this.$.ui,this.#il=this.$.menu,this.isComposing=!1,this.scrollparents=[],this.defaultLineManager=new Wn(this),this.selectionState=new Un(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.#Gs.carrierWrapper.querySelector(".__se__focus__temp__")}applyTagEffect(t){return this.selectionState.update(t)}_showToolbarBalloonDelay(){this.#nl&&Zn.clearTimeout(this.#nl),this.#nl=Zn.setTimeout((()=>{Zn.clearTimeout(this.#nl),this.#nl=null,this.#t.mode.isSubBalloon?this.$.subToolbar._showBalloon():this.#o._showBalloon()}),250)}_toggleToolbarBalloon(){this.$.selection.init();const t=this.$.selection.getRange(),e=this.#it.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.#sl.isPreventToolbarHide||this.$.frameContext.get("isFullScreen")||this.#o.hide()}_hideToolbar_sub(){this.$.subToolbar&&!this.#sl.isPreventToolbarHide&&this.$.subToolbar.hide()}_setDefaultLine(t){return this.defaultLineManager.execute(t)}async _dataTransferAction(t,e,s,i){try{return this.#sl.showLoading(),await this.#al(t,e,s,i),e.preventDefault(),e.stopPropagation(),!1}catch(t){console.warn("[SUNEDITOR.paste.error]",t)}finally{this.#sl.hideLoading()}}async#al(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=Wt.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," "))),!r){if(this.#it.get("autoLinkify")){const t=(new DOMParser).parseFromString(o,"text/html");Ut.query.getListChildNodes(t.body,Wt.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.#js.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.#js.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=Ti.bind(this),e=Hi.bind(this);this.#js.addEvent(this.#e.get("menuTray"),"mousedown",t,!1),this.#js.addEvent(this.#e.get("menuTray"),"click",Mi.bind(this),!0),this.#js.addEvent(this.#e.get("toolbar_main"),"mousedown",t,!1),this.#js.addEvent(this.#e.get("toolbar_main"),"click",e,!1),this.#it.has("_subMode")&&(this.#js.addEvent(this.#e.get("toolbar_sub_main"),"mousedown",t,!1),this.#js.addEvent(this.#e.get("toolbar_sub_main"),"click",e,!1)),this.#o._setResponsive(),Dt.isResizeObserverSupported&&(this._toolbarObserver=new ResizeObserver((()=>{Zn.setTimeout((()=>{this.#o.resetResponsiveToolbar()}),0)})),this._wwFrameObserver=new ResizeObserver((t=>{Zn.setTimeout((()=>{t.forEach((t=>{this.#sl._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.#it.get("closeModalOutsideClick")&&this.#js.addEvent(this.#Gs.carrierWrapper.querySelector(".se-modal .se-modal-inner"),"click",(t=>{t.target===this.#Gs.carrierWrapper.querySelector(".se-modal .se-modal-inner")&&this.#sl.offCurrentModal()}),!1),this.#js.addEvent(Zn,"resize",this.#hl.bind(this),!1),this.#js.addEvent(Zn.visualViewport,"resize",this.#cl.bind(this),!1),this.#js.addEvent(Zn,"scroll",this.#dl.bind(this),!1),jn&&this.#js.addEvent(Zn.visualViewport,"scroll",this.#ul.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.#Gs.carrierWrapper.querySelector(".se-drag-cursor"),o=Vi.bind(this,t);this.#js.addEvent(s,"mousemove",o,!1),this.#js.addEvent(s,"mouseleave",Oi.bind(this,t),!1),this.#js.addEvent(s,"mousedown",Ni.bind(this,t),!1),this.#js.addEvent(s,"mouseup",Ai.bind(this,t),!1),this.#js.addEvent(s,"click",Ii.bind(this,t),!1),this.#js.addEvent(s,"beforeinput",Ri.bind(this,t),!1),this.#js.addEvent(s,"input",zi.bind(this,t),!1),this.#js.addEvent(s,"keydown",An.bind(this,t),!1),this.#js.addEvent(s,"keyup",In.bind(this,t),!1),this.#js.addEvent(s,"paste",On.bind(this,t),!1),this.#js.addEvent(s,"copy",Rn.bind(this,t),!1),this.#js.addEvent(s,"cut",zn.bind(this,t),!1),this.#js.addEvent(s,"dragover",Pn.bind(this,t,n,e?this.$.frameContext.get("topArea"):null,!this.#it.get("toolbar_container")&&!this.#t.mode.isBalloon&&!this.#t.mode.isInline),!1),this.#js.addEvent(s,"dragend",Dn.bind(this,n),!1),this.#js.addEvent(s,"drop",qn.bind(this,t,n),!1),this.#js.addEvent(s,"scroll",this.#pl.bind(this,t,s),{passive:!0,capture:!1}),this.#js.addEvent(s,"focus",this.#gl.bind(this,t),!1),this.#js.addEvent(s,"blur",this.#ml.bind(this,t),!1),this.#js.addEvent(i,"mousedown",this.#fl.bind(this,t),!1);const l=t.get("wrapper").querySelector(".se-drag-handle");if(this.#js.addEvent(l,"wheel",(t=>{t.preventDefault(),this.$.component.deselect()}),!1),this.#js.addEvent(t.get("lineBreaker_t"),"pointerdown",this.#vl.bind(this,"t"),!1),this.#js.addEvent(t.get("lineBreaker_b"),"pointerdown",this.#vl.bind(this,"b"),!1),jn&&this.#js.addEvent(s,"touchstart",o,{passive:!0,capture:!1}),!this.#it.get("hasCodeMirror")){const e=t.get("codeNumbers"),s=this.$.viewer._codeViewAutoHeight.bind(this.$.viewer,t.get("code"),e,"auto"===this.$.frameOptions.get("height"));this.#js.addEvent(i,"keydown",s,!1),this.#js.addEvent(i,"keyup",s,!1),this.#js.addEvent(i,"paste",s,!1),this.#it.get("tabDisable")||this.#js.addEvent(i,"keydown",Kn,!1),e&&this.#js.addEvent(i,"scroll",this.$.viewer._scrollLineNumbers.bind(i,e),!1)}const r=t.get("markdown");if(r){this.#js.addEvent(r,"mousedown",this.#bl.bind(this,t),!1);const e=t.get("markdownNumbers"),s=this.$.viewer._markdownViewAutoHeight.bind(this.$.viewer,r,e,"auto"===this.$.frameOptions.get("height"));this.#js.addEvent(r,"keydown",s,!1),this.#js.addEvent(r,"keyup",s,!1),this.#js.addEvent(r,"paste",s,!1),this.#it.get("tabDisable")||this.#js.addEvent(r,"keydown",Kn,!1),e&&this.#js.addEvent(r,"scroll",this.$.viewer._scrollMarkdownLineNumbers.bind(r,e),!1)}t.has("statusbar")&&this.__addStatusbarEvent(t,t.get("options"));const a=this.#yl.bind(this),h=Ut.query.getScrollParents(t.get("originElement"));for(const t of h)this.scrollparents.push(t),this.#js.addEvent(t,"scroll",a,!1);this.#js.addEvent(this.__focusTemp,"focus",(t=>t.preventDefault()),!1),this.__eventDoc!==t.get("_wd")&&(this.__eventDoc=t.get("_wd"),this.#js.addEvent(this.__eventDoc,"selectionchange",this.#wl.bind(this,this.__eventDoc),!1))}__addStatusbarEvent(t,e){/\d+/.test(e.get("height"))&&e.get("statusbar_resizeEnable")?e.set("__statusbarEvent",this.#js.addEvent(t.get("statusbar"),"mousedown",this.#Cl.bind(this),!1)):Ut.utils.addClass(t.get("statusbar"),"se-resizing-none")}_removeAllEvents(){this.#js._init(),this._wwFrameObserver&&(this._wwFrameObserver.disconnect(),this._wwFrameObserver=null),this._toolbarObserver&&(this._toolbarObserver.disconnect(),this._toolbarObserver=null),this.#nl&&(Zn.clearTimeout(this.#nl),this.#nl=null),this.__retainTimer&&(Zn.clearTimeout(this.__retainTimer),this.__retainTimer=null),this.#ll&&=this.#js.removeGlobalEvent(this.#ll),this.#rl&&=this.#js.removeGlobalEvent(this.#rl),this.#ol&&=this.#js.removeGlobalEvent(this.#ol),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.#js.removeGlobalEvent(this.#ll),this.#ll=this.#js.addGlobalEvent("mouseup",(()=>{this.$.selection.init(),this.#js.removeGlobalEvent(this.#ll)}))}_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=Ut.utils.createTextNode(qt.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.#js.removeEvent(this.__inputBlurEvent),this.__inputKeyEvent=this.#js.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.#js.triggerEvent("onFocus",{frameContext:t,event:e}),this._callPluginEvent("onFocus",{frameContext:t,event:e})}__postBlurEvent(t,e){this.#t.mode.isInline?Zn.setTimeout((()=>{this.#t.get("hasFocus")||this._hideToolbar()}),0):this.#t.mode.isBalloon&&this._hideToolbar(),this.#t.mode.isSubBalloon&&this._hideToolbar_sub(),this.#js.triggerEvent("onBlur",{frameContext:t,event:e}),this._callPluginEvent("onBlur",{frameContext:t,event:e})}__setViewportSize(){this.#t.set("currentViewportHeight",Zt.get(Zn.visualViewport.height,0))}#_l(){this.#il.currentDropdownActiveButton&&this.#il.currentDropdown&&this.#il.__resetMenuPosition(this.#il.currentDropdownActiveButton,this.#il.currentDropdown),this.#sl._repositionControllers()}#xl(){Dt.isResizeObserverSupported||(this.#o.resetResponsiveToolbar(),this.#it.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.#sl.opendBrowser;if(s&&"block"===s.area.style.display&&(s.body.style.maxHeight=Ut.utils.getClientSize().h-s.header.offsetHeight-50+"px"),this.#il.currentDropdownActiveButton&&this.#il.currentDropdown&&this.#il.__resetMenuPosition(this.#il.currentDropdownActiveButton,this.#il.currentDropdown),this.$.viewer._resetFullScreenHeight())return;const i=this.$.frameContext;i.get("isCodeView")&&this.#t.mode.isInline?this.#o._showInline():(this.#sl._iframeAutoHeight(i),this.#o.isSticky&&(this.#o.isCSSSticky||(this.#e.get("toolbar_main").style.width=i.get("topArea").offsetWidth-2+"px"),this.#o._resetSticky()))}#pl(t,e,s){this.#sl._syncScrollPosition(e),this.#_l(),this._callPluginEvent("onScroll",{frameContext:t,event:s}),t.has("documentType_use_page")&&t.get("documentType").scrollPage(),this.#js.triggerEvent("onScroll",{frameContext:t,event:s})}#gl(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.#js.triggerEvent("onNativeFocus",{frameContext:t,event:e});const s=t.get("key");this._inputFocus?this.#t.mode.isInline&&Zn.setTimeout((()=>{this.#o._showInline()}),0):this.#t.get("rootKey")===s&&this.#t.get("_preventBlur")||this.#t.get("_preventFocus")||(this.#t.set("_preventFocus",!0),Ut.utils.removeClass(this.$.commandDispatcher.targets.get("codeView"),"active"),this.#sl._toggleCodeViewButtons(!1),this.$.facade.changeFrameContext(s),this.$.history.resetButtons(s,null),Zn.setTimeout((()=>{this.__postFocusEvent(t,e)}),0))}#ml(t,e){t.get("isCodeView")||t.get("isReadOnly")||t.get("isDisabled")||(this.#t.set("hasFocus",!1),this.#t.set("_lastSelectionNode",null),this.#js.triggerEvent("onNativeBlur",{frameContext:t,event:e}),this._inputFocus||this.#t.get("_preventBlur")||(this.#t.set("_preventFocus",!1),this.selectionState.reset(),this.#t.set("currentNodes",[]),this.#t.set("currentNodesMap",[]),this.#sl.offCurrentController(),this.#Gs.applyToRoots((t=>{t.get("navigation")&&(t.get("navigation").textContent="")})),this.$.history.check(t.get("key"),this.#t.get("_range")),this.__postBlurEvent(t,e)))}#Cl(t){t.stopPropagation(),this._resizeClientY=t.clientY,this.#sl.enableBackWrapper("ns-resize"),this.#rl=this.#js.addGlobalEvent("mousemove",this.#$l.bind(this)),this.#ol=this.#js.addGlobalEvent("mouseup",this.#kl.bind(this))}#$l(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,Dt.isResizeObserverSupported||this.#sl._emitResizeEvent(e,i,null)}#kl(){this.#sl.disableBackWrapper(),this.#rl&&=this.#js.removeGlobalEvent(this.#rl),this.#ol&&=this.#js.removeGlobalEvent(this.#ol)}#vl(t,e){e.preventDefault();const s=this._lineBreakComp;if(!s)return;const i=Ut.check.isListCell(s.parentElement),n=Ut.utils.createElement(i?"BR":Ut.check.isTableCell(s.parentElement)?"DIV":this.#it.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)}}}#hl(){this.#t.set("initViewportHeight",Zn.visualViewport.height),Gn||this.#sl.offCurrentController(),this.#t.mode.isBalloon?this.#o.hide():this.#t.mode.isSubBalloon&&this.$.subToolbar.hide(),this.#xl()}#cl(){Gn&&this.#it.get("toolbar_sticky")>-1&&(this.#o._resetSticky(),this.#il.__restoreMenuPosition()),this.#_l(),this.__setViewportSize()}#dl(){this.#it.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.#_l(),this.$.frameContext.has("documentType_use_page")&&this.$.frameContext.get("documentType").scrollWindow()}#ul(){this.#it.get("toolbar_sticky")>-1&&(this.#o._resetSticky(),this.#il.__restoreMenuPosition())}#wl(t){let e=t.getSelection().anchorNode;this.#Gs.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(),t.has("documentType_use_header")){const e=Ut.query.getParentElement(this.$.selection.selectionNode,this.$.format.isLine.bind(this.$.format));t.get("documentType").on(e)}}}))}#yl(){this.#il.dropdownOff(),this.#_l()}#fl(t){this.$.facade.changeFrameContext(t.get("key")),Ut.utils.addClass(this.$.commandDispatcher.targets.get("codeView"),"active"),this.#sl._toggleCodeViewButtons(!0)}#bl(t){this.$.facade.changeFrameContext(t.get("key")),Ut.utils.addClass(this.$.commandDispatcher.targets.get("markdownView"),"active"),this.#sl._toggleCodeViewButtons(!0)}};const Xn=class{#Sl=new Map;#El=new Map;$=null;constructor(t,e){const{product:s,options:i}=e;this.store=new xe(s),this.$={facade:t,store:this.store},this.#Tl(s,i),this.#Ml(),this.#Hl(s),this.#Ll(),this.#Nl(),this._eventOrchestrator=new Yn(this)}#Tl(t,e){const s=new Se(t),i=new Ee(this,t,e);this.#Sl.set("contextProvider",s),this.#Sl.set("optionProvider",i),this.#Sl.set("instanceCheck",new Te(s.frameContext)),this.#Sl.set("eventManager",new Ne(s,i,this.$))}#Ml(){const t=this.#Sl.get("contextProvider"),e=this.#Sl.get("optionProvider");Object.assign(this.$,{contextProvider:t,optionProvider:e,instanceCheck:this.#Sl.get("instanceCheck"),eventManager:this.#Sl.get("eventManager"),frameRoots:t.frameRoots,context:t.context,options:e.options,icons:t.icons,lang:t.lang,frameContext:t.frameContext,frameOptions:e.frameOptions})}#Hl(t){this.#El.set("offset",new Be(this)),this.#El.set("selection",new Ie(this)),this.#El.set("html",new gs(this)),this.#El.set("nodeTransform",new ms(this)),this.#El.set("format",new Oe(this)),this.#El.set("inline",new ze(this)),this.#El.set("listFormat",new Pe(this)),this.#El.set("char",new vs(this)),this.#El.set("shortcuts",new bs(this)),this.#El.set("component",new Xs(this)),this.#El.set("pluginManager",new Js(this,t)),this.#El.set("focusManager",new Qs(this)),this.#El.set("ui",new di(this)),this.#El.set("commandDispatcher",new ri(this)),this.#El.set("toolbar",new gi(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.#El.set("subToolbar",new gi(this,{keyName:"toolbar_sub",balloon:this.store.mode.isSubBalloon,balloonAlways:this.store.mode.isSubBalloonAlways,inline:!1,res:t.responsiveButtons_sub})),this.#El.set("menu",new fi(this)),this.#El.set("viewer",new wi(this)),this.#El.set("finder",new $i(this)),this.#El.set("history",ui(this))}#Nl(){for(const[,t]of this.#El)"function"==typeof t?._init&&t._init()}#Ll(){const t=this.#El.get("pluginManager");Object.assign(this.$,{offset:this.#El.get("offset"),selection:this.#El.get("selection"),format:this.#El.get("format"),inline:this.#El.get("inline"),listFormat:this.#El.get("listFormat"),html:this.#El.get("html"),nodeTransform:this.#El.get("nodeTransform"),char:this.#El.get("char"),component:this.#El.get("component"),focusManager:this.#El.get("focusManager"),pluginManager:t,plugins:t.plugins,ui:this.#El.get("ui"),commandDispatcher:this.#El.get("commandDispatcher"),history:this.#El.get("history"),shortcuts:this.#El.get("shortcuts"),toolbar:this.#El.get("toolbar"),subToolbar:this.#El.get("subToolbar"),menu:this.#El.get("menu"),viewer:this.#El.get("viewer"),finder:this.#El.get("finder")})}_destroy(){if(null===this.$)return;const t=[];for(const[e,s]of this.#El)try{s?._destroy?.()}catch(s){t.push(`[Logic:${e}] ${s.message}`)}this.#El.clear();try{this._eventOrchestrator?._removeAllEvents()}catch(e){t.push(`[EventOrchestrator] ${e.message}`)}this._eventOrchestrator=null;for(const[e,s]of this.#Sl)try{s?._destroy?.()}catch(s){t.push(`[Config:${e}] ${s.message}`)}this.#Sl.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 Jn=class{#F;$;constructor(t,e){const s=ye(t,e),i=new Xn(this,{product:s,options:e});this.#F=i,this.$=i.$,this.#Bl(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 Ut.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.#Al(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.#Al(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()})),Ut.utils.removeItem(this.$.context.get("toolbar_wrapper")),Ut.utils.removeItem(this.$.context.get("toolbar_sub_wrapper")),Ut.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}#Al(t){this.$.contextProvider.reset(t),this.$.optionProvider.resetFrame(t.get("options")),this.$.ui.reset(t)}#Il(t){this.$.store.set("initViewportHeight",Dt._w.visualViewport.height),this.#F._eventOrchestrator.__setViewportSize(),this.$.contextProvider.init(),this.#Al(this.$.frameRoots.get(this.$.store.get("rootKey"))),this.#rs(t),this.$.contextProvider.applyToRoots((t=>{this.#F._eventOrchestrator._addFrameEvents(t),this.#Vl(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(),Dt._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)}#Vl(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())),"document"===this.$.options.get("type")&&(t.set("documentType",new _e(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))}#rs(t){this.$.pluginManager.init(t),this.$.shortcuts._registerShortcuts(),this.$.commandDispatcher._initCommandButtons(),this.$.ui.init()}#Ol(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">'+Wt._setIframeStyleLinks(s.get("iframe_cssFileName"))+Wt._setAutoHeightStyle(s.get("height")),t.contentDocument.body.className=e.get("_editableClass"),t.contentDocument.body.setAttribute("contenteditable","true")}async#Bl(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=>{this.$.eventManager.addEvent(t.get("wysiwygFrame"),"load",(({target:s})=>{this.#Ol(s,this.$.optionProvider.options,t.get("options")),e()}))}));e.push(s)}})),this.$.contextProvider.applyToRoots((t=>{t.get("wrapper").appendChild(t.get("wysiwygFrame")),t.get("documentTypeInner")&&(this.$.options.get("_rtl")?t.get("wrapper").appendChild(t.get("documentTypeInner")):t.get("wrapper").insertBefore(t.get("documentTypeInner"),t.get("wysiwygFrame"))),t.get("documentTypePage")&&(this.$.options.get("_rtl")?t.get("wrapper").insertBefore(t.get("documentTypePage"),t.get("wysiwygFrame")):t.get("wrapper").appendChild(t.get("documentTypePage")),t.get("wrapper").appendChild(t.get("documentTypePageMirror")))})),e.length>0&&await Promise.all(e),this.#Il(t)}};function Qn(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 to=class{#X;#Rl;constructor(t,e,s){this.#X=e,this.kind=t.constructor.key||t.constructor.name,this.#Rl=Dt.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.#zl(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.#Rl;if(l&&(r.responseType=l),r.onreadystatechange=this.#Fl.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.#zl(e||this.url),s||=this.headers,i||=this.data,n||=this.responseType;const o=this.#Rl;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.#X.ui.hideLoading()}else{console.error(`[SUNEDITOR.ApiManager[${this.kind}].upload.serverException]`,o);try{l(Qn(o))}finally{this.#X.ui.hideLoading()}}},o.onerror=()=>{this.#X.ui.hideLoading(),l(new Error("Network error"))},o.send(i)}))}cancel(){this.#Rl&&(this.#Rl.onreadystatechange=null,this.#Rl.onload=null,this.#Rl.onerror=null,this.#Rl.abort())}#zl(t){return t.replace(/([^:])\/+/g,"$1/").replace(/\/(\?|#|$)/,"$1")}async#Fl(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.#X.ui.hideLoading()}else{console.error(`[SUNEDITOR.ApiManager[${this.kind}].upload.serverException]`,t);try{const e=Qn(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.#X.ui.alertOpen(n,"error")}catch(t){throw Error(`[SUNEDITOR.ApiManager[${this.kind}].upload.errorCallBack.fail] ${t.message}`)}finally{this.#X.ui.hideLoading()}}}};function eo(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 so=class{#X;#Pl;#un;#Oi=!1;#Pi=null;constructor(t,e,s){this.#X=e,this.useSearch=s.useSearch??!0;const i=Ut.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<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<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=Ut.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.#X,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.#Pl=n._loading,this.title=s.title,this.listClass=s.listClass||"se-preview-list",this.directData=s.data,this.url=s.url,this.urlHeader=s.headers,this.searchUrl=s.searchUrl,this.searchUrlHeader=s.searchUrlHeader,this.drawItemHandler=(s.drawItemHandler||eo).bind({thumbnail:s.thumbnail,props:s.props||[]}),this.selectorHandler=s.selectorHandler,this.columnSize=s.columnSize||4,this.folderDefaultPath="",this.closeArrow=this.#X.icons.menu_arrow_right,this.openArrow=this.#X.icons.menu_arrow_down,this.icon_folder=this.#X.icons.side_menu_folder_item,this.icon_folder_item=this.#X.icons.side_menu_folder,this.icon_item=this.#X.icons.side_menu_item,this.items=[],this.folders={},this.tree={},this.data={},this.selectedTags=[],this.keyword="",this.sideInner=null,this.apiManager=new to(this,e,{method:"GET"}),this.#un=t=>{Gt.isEsc(t.code)&&this.close()},i.appendChild(Ut.utils.createElement("DIV",{class:"se-browser-back"})),i.appendChild(o),this.#X.contextProvider.carrierWrapper.appendChild(i),this.#X.eventManager.addEvent(this.tagArea,"click",this.#Dl.bind(this)),this.#X.eventManager.addEvent(this.list,"click",this.#ql.bind(this)),this.#X.eventManager.addEvent(this.side,"click",this.#Wl.bind(this)),this.#X.eventManager.addEvent(o,"mousedown",this.#Ul.bind(this)),this.#X.eventManager.addEvent(o,"click",this.#Zl.bind(this)),this.#X.eventManager.addEvent(i.querySelector("form.se-browser-search-form"),"submit",this.#Gl.bind(this)),this.#X.eventManager.addEvent(this.sideOpenBtn=i.querySelector(".se-side-open-btn"),"click",this.#jl.bind(this)),this.#X.eventManager.addEvent([this.header,i.querySelector(".se-browser-main")],"mousedown",this.#Kl.bind(this))}open(t={}){this.#Be();const e=t.listClass||this.listClass;Ut.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.#X.ui.opendBrowser=this,this.closeArrow=this.#X.options.get("_rtl")?this.#X.icons.menu_arrow_left:this.#X.icons.menu_arrow_right,this.directData?this.#Yl(this.directData):this.#Xl(t.url||this.url,t.urlHeader||this.urlHeader,!1),this.body.style.maxHeight=Ut.utils.getClientSize().h-(this.#X.offset.getGlobal(this.body).top-o.scrollY)-20+"px"}close(){this.#Oe(),this.apiManager.cancel(),this.area.style.display="none",this.selectedTags=[],this.items=[],this.folders={},this.tree={},this.data={},this.keyword="",this.list.innerHTML=this.tagArea.innerHTML=this.titleArea.textContent="",this.#X.ui.opendBrowser=null,this.sideInner=null,this.host.browserInit?.()}search(t){this.searchUrl?(this.keyword=t,this.#Xl(this.searchUrl+"?keyword="+t,this.searchUrlHeader,!1)):(this.keyword=t.toLowerCase(),this.#Jl(this.items,!1))}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.#Pl.style.display="block"}closeBrowserLoading(){this.#Pl.style.display="none"}#Xl(t,e,s){this.apiManager.call({method:"GET",url:t,headers:e,callBack:this.#Ql.bind(this),errorCallBack:this.#tr.bind(this)}),s||(this.sideOpenBtn.style.display="none",this.showBrowserLoading())}#Jl(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,e&&(this.items=t,this.tagArea.innerHTML=a)}#Be(){this.#Oe(),this.#Pi=this.#X.eventManager.addGlobalEvent("keydown",this.#un,!0)}#Oe(){this.#Pi&&=this.#X.eventManager.removeGlobalEvent(this.#Pi)}#Yl(t){if(Array.isArray(t))return t.length>0&&this.#Jl(t,!0),!0;if("object"==typeof t){this.sideOpenBtn.style.display="",this.#er(t),this.side.innerHTML="";const e=this.sideInner=Ut.utils.createElement("div",null);if(this.#sr(this.tree,e),this.side.appendChild(e),this.folderDefaultPath){const t=e.querySelector(`[data-command="${this.folderDefaultPath}"]`);t.click(),this.folderDefaultPath.includes("/")&&(Ut.utils.removeClass(t.parentElement,"se-menu-hidden"),t.parentElement.previousElementSibling.querySelector("button").innerHTML=this.openArrow)}return!0}return!1}#er(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.#er(i,n)}))}#sr(t,e){for(const s in t){const i=t[s];if(i)if(Object.keys(i.children).length>0){const t=Ut.utils.createElement("div",i.key?{"data-command":i.key,"aria-label":i.name}:null,`<span class="se-menu-icon">${i.key?this.icon_folder:this.icon_folder_item}</span><span>${i.name}</span>`),s=Ut.utils.createElement("div",{class:"se-menu-folder"},t);t.insertBefore(Ut.utils.createElement("button",null,this.closeArrow),t.firstElementChild);const n=document.createElement("div");Ut.utils.addClass(n,"se-menu-child|se-menu-hidden"),this.#sr(i.children,n),s.appendChild(n),e.appendChild(s)}else{const t=Ut.utils.createElement("div",{"data-command":i.key,"aria-label":i.name,class:"se-menu-folder-item"},`<span class="se-menu-icon">${this.icon_item}</span><span>${i.name}</span>`);if(e===this.sideInner){const s=Ut.utils.createElement("div",{class:"se-menu-folder"},t);e.appendChild(s)}else e.appendChild(t)}}}#Ql(t){try{const e=JSON.parse(t.responseText),s=e.result;if(this.#Yl(s))return;e.nullMessage&&(this.list.innerHTML=e.nullMessage)}catch(t){throw Error(`[SUNEDITOR.browser.drawList.fail] cause: "${t.message}"`)}finally{this.closeBrowserLoading()}}#tr(t,e){throw this.closeBrowserLoading(),Error(`[SUNEDITOR.browser.get.serverException] status: ${e.status}, response: ${t.errorMessage||e.responseText}`)}#Dl(t){const e=Ut.query.getEventTarget(t);if(!Ut.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),Ut.utils.removeClass(i,"on")):(this.selectedTags.push(s),Ut.utils.addClass(i,"on")),this.#Jl(this.items,!1)}#ql(t){const e=Ut.query.getEventTarget(t);if(t.preventDefault(),t.stopPropagation(),e===this.list)return;const s=Ut.query.getCommandTarget(e);s&&(this.close(),this.selectorHandler(s))}#Wl(t){const e=Ut.query.getEventTarget(t);if(t.stopPropagation(),/^button$/i.test(e.nodeName)){const t=e.parentElement.parentElement.querySelector(".se-menu-child");return void(Ut.utils.hasClass(t,"se-menu-hidden")?(Ut.utils.removeClass(t,"se-menu-hidden"),e.innerHTML=this.openArrow):(Ut.utils.addClass(t,"se-menu-hidden"),e.innerHTML=this.closeArrow))}const s=Ut.query.getCommandTarget(e);if(!s||Ut.utils.hasClass(s,"active"))return;const i=this.data[s.getAttribute("data-command")];Ut.utils.removeClass(this.side.querySelectorAll(".active"),"active"),Ut.utils.addClass([s,Ut.query.getParentElement(s,".se-menu-folder")],"active"),this.tagArea.innerHTML="","string"==typeof i?this.#Xl(i,this.urlHeader,!0):this.#Jl(i,!1)}#Ul(t){const e=Ut.query.getEventTarget(t);/se-browser-inner/.test(e.className)?this.#Oi=!0:this.#Oi=!1}#Zl(t){const e=Ut.query.getEventTarget(t);t.stopPropagation(),(/close/.test(e.getAttribute("data-command"))||this.#Oi)&&this.close()}#Gl(t){const e=t.currentTarget;t.preventDefault(),this.search(e.querySelector('input[type="text"]').value)}#jl(t){const e=Ut.query.getEventTarget(t);Ut.utils.hasClass(e,"active")?(Ut.utils.removeClass(this.side,"se-side-show"),Ut.utils.removeClass(e,"active")):(Ut.utils.addClass(this.side,"se-side-show"),Ut.utils.addClass(e,"active"))}#Kl({target:t}){t!==this.sideOpenBtn&&Ut.utils.hasClass(this.sideOpenBtn,"active")&&(Ut.utils.removeClass(this.side,"se-side-show"),Ut.utils.removeClass(this.sideOpenBtn,"active"))}},{isTouchDevice:io}=Dt,no=240,oo=120,lo={hex:"#FFFFFF",r:255,g:255,b:255,h:0,s:1,l:1};let ro,ao=0,ho=!1,co=!1,uo=120,po=120,go=lo,mo=!1;const{slider:fo,offscreenCanvas:vo,offscreenCtx:bo,wheel:yo,wheelCtx:wo,wheelPointer:Co,gradientBar:_o,gradientPointer:xo,fanalColorHex:$o,fanalColorBackground:ko}=function(){const t=document.createElement("canvas");t.width=no,t.height=no;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;">${lo.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=Ut.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 So(t){const{target:e,touches:s}=t,i=s[0].clientX,n=s[0].clientY;e===yo?(t.preventDefault(),co=!1,ho=!0,Ho(i,n)):e===_o&&(t.preventDefault(),co=!0,ho=!1,Lo(i))}function Eo(t){t.preventDefault();const{touches:e}=t,s=e[0].clientX,i=e[0].clientY;ho?Ho(s,i):co&&Lo(s)}function To({target:t,clientX:e,clientY:s}){t===yo?(co=!1,ho=!0,Ho(e,s)):t===_o&&(co=!0,ho=!1,Lo(e))}function Mo({clientX:t,clientY:e}){ho?Ho(t,e):co&&Lo(t)}function Ho(t,e){const s=yo.getBoundingClientRect();t=t-s.left-oo,e=e-s.top-oo;const i=180*Math.atan2(e,t)/Math.PI,n=Math.min(Math.sqrt(t*t+e*e),oo),o=oo+n*Math.cos(i*Math.PI/180),l=oo+n*Math.sin(i*Math.PI/180);Co.style.left=`${o}px`,Co.style.top=`${l}px`,function(t,e){uo=t,po=e,No(Bo())}(o,l),Ao()}function Lo(t){const e=_o.getBoundingClientRect();let s=t-e.left;s=Math.max(14,Math.min(s,e.width-14)),xo.style.left=`${s}px`,function(t){const e=_o.getBoundingClientRect();let s=t-e.left;s<0&&(s=0);s>e.width&&(s=e.width);const i=14;s>=_o.width-i?s=_o.width:s<=i&&(s=0);const n=1-s/e.width;ao=n,Oo()}(t),Ao()}function No(t){const e=_o.getContext("2d"),s=e.createLinearGradient(0,0,_o.width,0);s.addColorStop(0,"black"),s.addColorStop(1,t.hex),e.fillStyle=s,e.fillRect(0,0,_o.width,_o.height)}function Bo(){return Vo(bo)}function Ao(){ro.color=go=Vo(wo),Io(go.hex)}function Io(t){ko.style.backgroundColor=$o.textContent=t}function Vo(t){const e=t.getImageData(uo,po,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[zo(o),zo(l),zo(r)]}(e);const o=uo-oo,l=po-oo;Math.sqrt(o*o+l*l)<3&&(n=1-ao),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:zo(n)}}function Oo(){wo.clearRect(0,0,no,no),wo.drawImage(vo,0,0),wo.globalAlpha=ao,wo.fillStyle="black",wo.beginPath(),wo.arc(oo,oo,oo,0,2*Math.PI),wo.fill(),wo.globalAlpha=1}function Ro(t){return t*Math.PI/180}function zo(t){const e=Math.pow(10,10);return Math.round(t*e)/e}function Fo(){!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<=oo;s+=1){t.beginPath();const i=50+(oo-s)/oo*50;t.fillStyle=`hsl(${e}, 100%, ${i}%)`;const n=oo+Math.cos(Ro(e))*s,o=oo-Math.sin(Ro(e))*s;t.arc(n,o,1.5,0,2*Math.PI),t.fill()}mo=!0}(bo),mo&&Oo()}Fo();const Po=class{#X;#ir;#nr;#or;#lr;#rr;#ar;constructor(t,e,s={},i=""){if(this.#X=e,this.inst=t,this.ctx={wheelX:uo,wheelY:po,lightness:ao,wheelPointerX:"50%",wheelPointerY:"50%",gradientPointerX:"calc(100% - 14px)",color:lo},this.isOpen=!1,this.controlle=null,this.#ir=null,this.#nr=null,this.#or=null,this.#lr=null,this.#rr=null,this.#ar=null,!s.isNewForm){const n=function({lang:t,icons:e},s){const i=Ut.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 Ms(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 go}open(t){this.attach(),this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null})}close(){this.ctx={gradientPointerX:xo.style.left,wheelPointerX:Co.style.left,wheelPointerY:Co.style.top,wheelX:uo,wheelY:po,lightness:ao,color:ro?.color||""},this.controller.close()}attach(t){mo||Fo(),this.init(),(t||this.circle).appendChild(fo),ro=this.ctx,ro&&(uo=ro.wheelX,po=ro.wheelY,ao=ro.lightness,Co.style.left=ro.wheelPointerX,Co.style.top=ro.wheelPointerY,xo.style.left=ro.gradientPointerX,Io(ro.color.hex),Oo(),No(Bo())),io&&(this.#rr=this.#X.eventManager.addGlobalEvent("touchstart",So,{passive:!1,capture:!0}),this.#nr=this.#X.eventManager.addGlobalEvent("touchmove",Eo,!0),this.#ar=this.#X.eventManager.addGlobalEvent("touchend",(()=>{ho=!1,co=!1}),!0)),this.#ir=this.#X.eventManager.addGlobalEvent("mousedown",To,{passive:!1,capture:!0}),this.#lr=this.#X.eventManager.addGlobalEvent("mousemove",Mo,!0),this.#or=this.#X.eventManager.addGlobalEvent("mouseup",(()=>{ho=!1,co=!1}),!0),this.isOpen=!0}init(){this.isOpen=!1,ho=!1,co=!1,this.#ir&&=this.#X.eventManager.removeGlobalEvent(this.#ir),this.#lr&&=this.#X.eventManager.removeGlobalEvent(this.#lr),this.#or&&=this.#X.eventManager.removeGlobalEvent(this.#or),this.#rr&&=this.#X.eventManager.removeGlobalEvent(this.#rr),this.#nr&&=this.#X.eventManager.removeGlobalEvent(this.#nr),this.#ar&&=this.#X.eventManager.removeGlobalEvent(this.#ar)}},Do=["#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 qo(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 Wo=class{#X;constructor(t,e,s,i){this.#X=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||=Do,o=s===Do?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">${qo(n,o)}</div>`,n=[]),"object"==typeof t&&(l+=`<div class="se-selector-color">${qo(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>`,Ut.utils.createElement("DIV",{class:"se-list-inner"},l)}(this.#X,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.#X.icons.color_checked,"image/svg+xml");this.checkedIcon=n.documentElement,i.disableHEXInput||(this.hueSlider=new Po(this,e,i.hueSliderOptions,"se-dropdown"),this.#X.eventManager.addEvent(this.target.querySelector(".__se_hue"),"click",this.#hr.bind(this)),this.#X.eventManager.addEvent(this.inputElement,"input",this.#cr.bind(this)),this.#X.eventManager.addEvent(this.target.querySelector("form"),"submit",this.#dr.bind(this))),i.disableRemove||this.#X.eventManager.addEvent(this.target.querySelector(".__se_remove"),"click",this.#ur.bind(this)),this.#X.eventManager.addEvent(this.target,"click",this.#pr.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.#gr(t,s))||this.defaultColor;i=Wt.isHexColor(i)?i:Wt.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),Ut.utils.addClass(t,"active")):(Ut.utils.removeClass(t,"active"),t.contains(this.checkedIcon)&&Ut.utils.removeItem(this.checkedIcon));this.#mr(this.#fr(i))}setHexColor(t){this.currentColor=t,this.inputElement.style.borderColor=t}hueSliderClose(){this.hueSlider.close()}hueSliderAction(t){this.#mr(t.hex)}hueSliderCancelAction(){this.form.style.display="block",this.host.colorPickerHueSliderClose?.()}#mr(t){t=!t||/^#/.test(t)?t:"#"+t,this.inputElement.value=t,this.setHexColor.call(this,t)}#gr(t,e){let s="";const i=this.styleProperties;for(;t&&!e(t)&&!Ut.check.isWysiwygFrame(t)&&0===s.length;)W(t)&&t.style[i]&&(s=t.style[i]),t=t.parentNode;return s}#fr(t){if(!t||/^#/.test(t))return t;const e=Ut.utils.createElement("div",{style:"display: none; color: "+t}),s=Dt._w.getComputedStyle(Dt._d.body.appendChild(e)).color.match(/\d+/g).map((function(t){return parseInt(t,10)}));return Ut.utils.removeItem(e),s.length>=3?"#"+((1<<24)+(s[0]<<16)+(s[1]<<8)+s[2]).toString(16).substring(1):""}#hr(){this.hueSlider.open(this.targetButton),this.host.colorPickerHueSliderOpen?.()}#dr(t){t.preventDefault(),this.host.colorPickerAction?.(this.currentColor)}#pr(t){const e=Ut.query.getEventTarget(t).getAttribute("data-value");e&&this.host.colorPickerAction?.(e)}#ur(){this.host.colorPickerAction?.(null)}#cr(t){const e=Ut.query.getEventTarget(t);this.setHexColor(e.value)}},{_w:Uo}=Dt,Zo={w:"ns-resize",h:"ew-resize",c:"nwse-resize",wRTL:"ns-resize",hRTL:"ew-resize",cRTL:"nesw-resize"};const Go=class{#X;#vr;#br;#yr;#Vi;#ye;#Pi=null;#wr=!1;#Cr=null;#_r=null;#xr="";#$r=0;#kr=0;#Sr=null;#Er=null;constructor(t,e,s){this.#X=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.#vr=this.#X.contextProvider.carrierWrapper.querySelector(".se-modal"),this.#br=this.#X.contextProvider.carrierWrapper.querySelector(".se-modal .se-modal-inner"),this.#Vi=[this.#Tr.bind(this),this.#Mr.bind(this)],this.#br.appendChild(s),this.#X.eventManager.addEvent(s.querySelector("form"),"submit",this.#He.bind(this)),this.#wr=!this.#X.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.#yr=s.querySelector(".se-modal-resize-form"))&&(this.#yr=s.querySelector(".se-modal-body"))&&(this.#X.eventManager.addEvent(s.querySelector(".se-modal-resize-handle-w"),"mousedown",this.#Hr.bind(this,"w")),this.#X.eventManager.addEvent(s.querySelector(".se-modal-resize-handle-h"),"mousedown",this.#Hr.bind(this,"h")),this.#X.eventManager.addEvent(s.querySelector(".se-modal-resize-handle-c"),"mousedown",this.#Hr.bind(this,"c")),this.#ye={mousemove:this.#Lr.bind(this),mouseup:this.#Nr.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${Ut.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.#X.ui.offCurrentModal(),this.#Br(!0),this.#wr&&(this.#Cr&&this.#X.eventManager.removeEvent(this.#Cr),this.#Cr=this.#X.eventManager.addEvent(this.#br,"click",this.#Vi[1])),this.#Pi&&=this.#X.eventManager.removeGlobalEvent(this.#Pi),this.#Pi=this.#X.eventManager.addGlobalEvent("keydown",this.#Vi[0]),this.isUpdate=this.kind===this.#X.ui.currentControllerName,this.#X.ui.opendModal=this,this.isUpdate||this.inst.modalInit?.(),this.inst.modalOn?.(this.isUpdate),Ut.utils.addClass(this.#vr,"se-backdrop-show"),Ut.utils.addClass(this.form,"se-modal-show"),this.#yr){const t=this.#Ar(),{maxWidth:e,maxHeight:s}=Uo.getComputedStyle(this.form),i=this.form.offsetWidth-t.width+"px",n=`${this.form.offsetTop+(this.form.offsetHeight-this.#yr.offsetHeight)}px`;e&&"string"==typeof this.#xr&&Ut.utils.setStyle(this.#yr,"max-width",`calc(${e} - ${i})`),s&&Ut.utils.setStyle(this.#yr,"max-height",`calc(${s} - ${n})`)}this.focusElement&&this.focusElement.focus()}close(){this.#Oe(),this.#Br(!1),Uo.setTimeout((()=>{this.#X.ui.opendModal=null}),0),this.#wr&&this.#Cr&&(this.#X.eventManager.removeEvent(this.#Cr),this.#Cr=null),this.#Pi&&=this.#X.eventManager.removeGlobalEvent(this.#Pi),Ut.utils.removeClass(this.#vr,"se-backdrop-show"),Ut.utils.removeClass(this.form,"se-modal-show"),this.inst.modalInit?.(),this.inst.modalOff?.(this.isUpdate),this.isUpdate||this.#X.focusManager.focus()}#Br(t){const e=this.#X.ui.opendControllers;for(let s=0;s<e.length;s++)e[s].fixed=t,e[s].form.style.display=t?"none":"block"}#Ar(){const t=this.#X.offset.getGlobal(this.#yr);return this.#$r=t.top,this.#kr=t.left,t}#Be(t){this.#Oe(),this.#X.ui.enableBackWrapper(Zo[t]),this.#Sr=this.#X.eventManager.addGlobalEvent("mousemove",this.#ye.mousemove,!0),this.#Er=this.#X.eventManager.addGlobalEvent("mouseup",this.#ye.mouseup,!0)}#Oe(){this.#X.ui.disableBackWrapper(),this.#Sr&&=this.#X.eventManager.removeGlobalEvent(this.#Sr),this.#Er&&=this.#X.eventManager.removeGlobalEvent(this.#Er)}async#He(t){t.preventDefault(),t.stopPropagation(),this.#X.ui.showLoading();try{const t=await this.inst.modalAction();!1===t?this.#X.ui.hideLoading():void 0===t?this.close():(this.close(),this.#X.ui.hideLoading())}catch(t){throw this.close(),this.#X.ui.hideLoading(),Error(`[SUNEDITOR.Modal[${this.kind}].warn] ${t.message}`)}}#Mr(t){const e=Ut.query.getEventTarget(t);(/close/.test(e.getAttribute("data-command"))||e===this.#br)&&this.close()}#Tr(t){Gt.isEsc(t.code)&&this.close()}#Hr(t,e){this.#_r=Ut.query.getEventTarget(e),Ut.utils.addClass(this.#_r,"active"),this.#Be(this.#xr=t+(this.#X.options.get("_rtl")?"RTL":""))}#Lr(t){switch(this.#xr){case"w":case"wRTL":{const e=t.clientY-this.#$r-this.#yr.offsetHeight;this.#yr.style.height=this.#yr.offsetHeight+e+"px";break}case"h":{const e=t.clientX-this.#kr-this.#yr.offsetWidth;this.#yr.style.width=this.#yr.offsetWidth+e+"px";break}case"hRTL":{const e=this.#kr-t.clientX;this.#yr.style.width=this.#yr.offsetWidth+e+"px";break}case"c":{const e=t.clientX-this.#kr-this.#yr.offsetWidth,s=t.clientY-this.#$r-this.#yr.offsetHeight;this.#yr.style.width=this.#yr.offsetWidth+e+"px",this.#yr.style.height=this.#yr.offsetHeight+s+"px";break}case"cRTL":{const e=this.#kr-t.clientX,s=t.clientY-this.#$r-this.#yr.offsetHeight;this.#yr.style.width=this.#yr.offsetWidth+e+"px",this.#yr.style.height=this.#yr.offsetHeight+s+"px";break}}this.#Ar(),this.inst.modalResize?.()}#Nr(){Ut.utils.removeClass(this.#_r,"active"),this.#_r=null,this.#Oe()}};function jo(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 Ko=class{#X;constructor(t,e,s){this.#X=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 to(this,e),this._resetInfo,this._checkInfo}upload(t,e,s,i,n){this.#X.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.#X.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.#X.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()===jo(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();jo(t,"index")&&n.includes(Number(jo(t,"index")))?i.push(Number(jo(t,"index"))):(i.push(this.infoIndex),t.removeAttribute("data-se-index"),this.#Ir(t,null))}if(t&&this.loadEventName)this.#X.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.#X.eventManager.triggerEvent(this.actionEventName,n),this.#X.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.#X.eventManager.triggerEvent(this.actionEventName,{...t,index:this.infoList[e].index,pluginName:this.kind}),this.#X.eventManager.triggerEvent("onFileManagerAction",{...t,index:this.infoList[e].index,pluginName:this.kind});this.infoList=[],this.infoIndex=0}#Vr(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.#X.eventManager.triggerEvent(this.actionEventName,{element:null,index:t,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind}))}#Ir(t,e){let s=Number(jo(t,"index")),i=null,n="";if(e||={name:jo(t,"file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:Number(jo(t,"file-size"))||0},s&&this.#X.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=jo(t,"file-name"),i.size=Number(jo(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(jo(e,"index")))}.bind(this,this.#Vr.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.#X.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.#X.eventManager.triggerEvent(this.actionEventName,o),this.#X.eventManager.triggerEvent("onFileManagerAction",{...o,pluginName:this.kind})}},{_w:Yo,NO_EVENT:Xo}=Dt;const Jo=class{#X;#Or;#Rr;#zr;#Fr;constructor(t,e,s){this.#X=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=Zt.get(s.uploadSizeLimit,0)||null,this.uploadSingleSizeLimit=Zt.get(s.uploadSingleSizeLimit,0)||null,this.input=Ut.utils.createElement("input",{type:"file",accept:s.acceptedFormats||"*"}),this.#X.eventManager.addEvent(this.input,"change",this.#Pr.bind(this)),this.fileManager=new Ko(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${Ut.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${Ut.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${Ut.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>",Ut.utils.createElement("DIV",null,r)}(t,s,this.relList);if(this.host=(Yo.location.origin+Yo.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.#Rr=this.relList.length>0,this.#Rr){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(Ut.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.#X.icons.checked+"</span>"));this.#zr=new Ls(t,{checkList:!0,position:"right-middle",dir:"ltr"}),this.#zr.on(this.relButton,this.#Dr.bind(this)),this.#zr.create(n),this.#X.eventManager.addEvent(this.relButton,"click",this.#qr.bind(this))}this.#Or=e,this.#Or.querySelector(".se-anchor-editor").appendChild(i),this.#Fr=new Ls(t,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.#Fr.on(this.urlInput,this.#Wr.bind(this)),this.#X.eventManager.addEvent(this.newWindowCheck,"change",this.#Ur.bind(this)),this.#X.eventManager.addEvent(this.downloadCheck,"change",this.#Zr.bind(this)),this.#X.eventManager.addEvent(this.urlInput,"input",this.#Gr.bind(this)),this.#X.eventManager.addEvent(this.urlInput,"focus",this.#jr.bind(this)),this.#X.eventManager.addEvent(this.bookmarkButton,"click",this.#Kr.bind(this)),this.#X.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.#Yr(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.#X.selection.get().toString().trim(),this.newWindowCheck.checked=this.openNewWindow,this.titleInput.value="";this.#Xr(t&&this.currentTarget?this.currentTarget.rel:this.defaultRel.default||""),this.#Jr(this.linkValue)}create(t){if(0===this.linkValue.length)return null;const e=this.linkValue,s=0===this.displayInput.value.length?e:this.displayInput.value,i=this.currentTarget||Ut.utils.createElement("A");return this.#Qr(i,e,s,this.titleInput.value,t),this.linkValue=this.preview.textContent=this.urlInput.value=this.displayInput.value="",i}init(){this.currentTarget=null,this.linkValue=this.preview.textContent=this.urlInput.value="",this.displayInput.value="",this.newWindowCheck.checked=!1,this.downloadCheck.checked=!1,this.#Xr(this.defaultRel.default||"")}#Qr(t,e,s,i,n){!this.#Yr(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}#Yr(t){const e=Yo.location.href.replace(/\/$/,"");return 0===t.indexOf("#")||0===t.indexOf(e)&&t.indexOf("#")===(e.includes("#")?e.substring(0,e.indexOf("#")).length:e.length)}#Xr(t){if(!this.#Rr)return;const e=this.currentRel=t?t.split(" "):[],s=this.#zr.form.querySelectorAll("button");for(let t,i=0,n=s.length;i<n;i++)t=s[i].getAttribute("data-command"),e.includes(t)?Ut.utils.addClass(s[i],"se-checked"):Ut.utils.removeClass(s[i],"se-checked");this.relPreview.title=this.relPreview.textContent=e.join(" "),e.length>0?Ut.utils.addClass(this.relButton,"on"):Ut.utils.removeClass(this.relButton,"on")}#ta(t){const e=Ut.query.getListChildren(this.#X.frameContext.get("wysiwyg"),(t=>/h[1-6]/i.test(t.nodeName)||Ut.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(Ut.check.isAnchor(t)?`<div><span class="se-text-prefix-icon">${this.#X.icons.bookmark_anchor}</span>${t.id}</div>`:`<div style="${t.style.cssText}">${t.textContent}</div>`));0===i.length?this.#Fr.close():(this.#Fr.create(i,n),this.#Fr.open(this.#X.options.get("_rtl")?"bottom-right":""))}#Jr(t){const e=this.preview,s=this.#X.options.get("defaultUrlProtocol"),i=this.noAutoPrefix,n=/^(mailto:|tel:|sms:|https*:\/\/|#)/.test(t)||0===t.indexOf(s),o=!!s&&RegExp("^"+qt.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.#Yr(t)?(this.bookmark.style.display="block",Ut.utils.addClass(this.bookmarkButton,"active")):(this.bookmark.style.display="none",Ut.utils.removeClass(this.bookmarkButton,"active")),!this.#Yr(t)&&this.downloadCheck.checked?this.download.style.display="block":this.download.style.display="none"}#ea(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(" ")}#sa(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}#ia(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#na(t){const e=await this.#X.eventManager.triggerEvent("onFileUploadError",{error:t});if(!1===e)return;const s=e===Xo?t.errorMessage:e||t.errorMessage;this.#X.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.fileUpload.error]",s)}#oa(t){const e=JSON.parse(t.responseText);e.errorMessage?this.#na(e):this.#ia(e)}async#Pr(t){const e=Ut.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.#oa.bind(this),s),n=await this.#X.eventManager.triggerEvent("onFileUploadBefore",{info:s,handler:i});return void 0===n||!1!==n&&(null!==n&&"object"==typeof n&&i(n),void(!0!==n&&n!==Xo||i(null)))}#qr(){this.#zr.open(this.#X.options.get("_rtl")?"left-middle":"")}#Wr(t){const e=t.id||"h_"+Math.random().toString().replace(/.+\./,"");t.id=e,this.urlInput.value="#"+e,this.#Jr(this.urlInput.value),this.#Fr.close(),this.urlInput.focus()}#Dr(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(", ")}#Gr(t){const e=Ut.query.getEventTarget(t).value.trim();this.#Jr(e),this.#Yr(e)?this.#ta(e):this.#Fr.close()}#jr(){const t=this.urlInput.value;this.#Yr(t)&&this.#ta(t)}#Kr(){let t=this.urlInput.value;this.#Yr(t)?(t=t.substring(1),this.bookmark.style.display="none",Ut.utils.removeClass(this.bookmarkButton,"active")):(t="#"+t,this.bookmark.style.display="block",Ut.utils.addClass(this.bookmarkButton,"active"),this.downloadCheck.checked=!1,this.download.style.display="none",this.#ta(t)),this.urlInput.value=t,this.#Jr(t),this.urlInput.focus()}#Ur(t){if("string"!=typeof this.defaultRel.check_new_window)return;Ut.query.getEventTarget(t).checked?this.#Xr(this.#ea(this.defaultRel.check_new_window)):this.#Xr(this.#sa(this.defaultRel.check_new_window))}#Zr(t){Ut.query.getEventTarget(t).checked?(this.download.style.display="block",this.bookmark.style.display="none",Ut.utils.removeClass(this.bookmarkButton,"active"),this.linkValue=this.preview.textContent=this.urlInput.value=this.urlInput.value.replace(/^#+/,""),"string"==typeof this.defaultRel.check_bookmark&&this.#Xr(this.#ea(this.defaultRel.check_bookmark))):(this.download.style.display="none","string"==typeof this.defaultRel.check_bookmark&&this.#Xr(this.#sa(this.defaultRel.check_bookmark)))}},Qo={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 Jn(i,e)}};class tl extends ki{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 el extends tl{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 sl extends tl{static type="command";action(t){throw new Error(`[${this.constructor.name}] Abstract method 'action()' must be implemented`)}}class il extends tl{static type="dropdown";on(t){}action(t){throw new Error(`[${this.constructor.name}] Abstract method 'action()' must be implemented`)}}class nl extends tl{static type="dropdown-free";on(t){}off(){}}class ol extends tl{static type="field"}class ll extends tl{static type="input";toolbarInputKeyDown(t){}toolbarInputChange(t){}}class rl extends tl{static type="modal";open(t){throw new Error(`[${this.constructor.name}] Abstract method 'open()' must be implemented`)}}class al extends tl{static type="popup";show(){throw new Error(`[${this.constructor.name}] Abstract method 'show()' must be implemented`)}}const hl=class extends sl{static key="blockquote";static className="";constructor(t){super(t),this.title=this.$.lang.tag_blockquote,this.icon="blockquote",this.quoteTag=Ut.utils.createElement("BLOCKQUOTE")}active(t,e){return/blockquote/i.test(t?.nodeName)?(Ut.utils.addClass(e,"active"),!0):(Ut.utils.removeClass(e,"active"),!1)}action(){const t=Ut.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))}},cl=["javascript","typescript","html","css","json","python","java","c","cpp","csharp","go","rust","ruby","php","swift","kotlin","sql","bash","markdown","xml","yaml"];class dl extends sl{static key="codeBlock";static className="";#la;#ra;#aa;#ha;#ca;#da;#ua;#pa;#ga;constructor(t,e){if(super(t),this.title=this.$.lang.codeBlock||"Code Block",this.icon="code_block",this.#la=Ut.utils.createElement("PRE"),this.#aa=e?.langs??cl,!this.#aa.length)return;this.afterItem=Ut.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":dl.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>",Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-code-block"},i)}(this.$,this.#aa);this.#ra=s.querySelectorAll("li button"),this.$.menu.initDropdownTarget({key:dl.key,type:"dropdown"},s);const i=Ut.utils.createElement("DIV",{class:"se-controller se-code-lang"});this.#ha=Ut.utils.createElement("DIV",{class:"se-code-lang-button"}),this.#ma(""),i.appendChild(this.#ha),this.#da=new Ms(this,this.$,i,{position:"top",isWWTarget:!0}),this.#ga=Wt.debounce((t=>{this.#pa=this.$.eventManager.removeEvent(this.#pa),t&&i.contains(t.relatedTarget)?this.#fa():this.#va()}),0),this.#ca=new Ls(this.$,{position:"bottom-right",dir:this.$.options.get("_rtl")?"rtl":"ltr",maxHeight:"214px",minWidth:"132px",closeMethod:this.#ga}),this.#ca.on(this.#ha,this.#ba.bind(this)),this.#ya(""),this.$.eventManager.addEvent(this.#ha,"click",(t=>{if(t.preventDefault(),t.stopPropagation(),this.#ca.isOpen)this.#ca.close();else{const t=this.#wa(this.#ua);this.#ya(t);const e=this.#ca.items,s=t?e.indexOf(t):0;this.#ca.open(null,s>=0?`[data-index="${s}"]`:null)}}))}onMouseMove({event:t}){if(!this.#da)return;const e=Ut.query.getEventTarget(t).closest("pre");e&&!this.#Ca()&&0===this.$.ui.opendControllers.length&&this.#_a(e)}active(t,e){return/^PRE$/i.test(t?.nodeName)?(Ut.utils.addClass(e,"active"),!0):(Ut.utils.removeClass(e,"active"),!1)}action(t){const e=t?.getAttribute("data-value")||"",s=this.$.selection.getNode(),i=Ut.query.getParentElement(s,(t=>/^PRE$/i.test(t.nodeName)));if(i&&!e)this.$.format.setLine(Ut.utils.createElement(this.$.options.get("defaultLine")));else if(i||this.$.format.setBrLine(this.#la.cloneNode(!1)),e){const t=Ut.query.getParentElement(this.$.selection.getNode(),(t=>/^PRE$/i.test(t.nodeName)));t&&this.#xa(t,e)}this.$.menu.dropdownOff(),this.$.focusManager.focus(),this.$.history.push(!1)}on(){if(!this.#ra)return;const t=this.#wa(this.$.selection.getNode());for(let e=0,s=this.#ra.length;e<s;e++){const s=this.#ra[e];Ut.utils.toggleClass(s,"active",s.getAttribute("data-value")===t)}}#_a(t){this.#ua===t&&this.#da.isOpen||(this.#ua&&this.#ua!==t&&Ut.utils.removeClass(this.#ua,"se-pre-code-focus"),this.#ua=t,Ut.utils.addClass(t,"se-pre-code-focus"),this.#da.open(t,null,{passive:!0,addOffset:{right:t.offsetWidth}}),this.#ma(this.#wa(t)),this.#$a())}#va(){this.#ca?.isOpen||this.#ka()}#ka(){this.#ca?.isOpen&&this.#ca.close(),Ut.utils.removeClass(this.#ua,"se-pre-code-focus"),this.#da.close(!0)}controllerClose(){this.#ua&&(Ut.utils.removeClass(this.#ua,"se-pre-code-focus"),this.#ua=null)}#ba(t){this.#ua&&(this.#xa(this.#ua,t),this.#ma(t),this.#ca.close(),this.#va(),this.$.focusManager.focus(),this.$.history.push(!1))}#$a(){this.#pa??=this.$.eventManager.addEvent(this.#ua,"mouseleave",this.#ga)}#fa(){this.#pa??=this.$.eventManager.addEvent(this.#da.form,"mouseleave",this.#ga)}#ya(t){const e=this.$.lang.codeLanguage_none||"None",s=t&&!this.#aa.includes(t),i=s?["",t,...this.#aa]:["",...this.#aa],n=s?[e,t,...this.#aa]:[e,...this.#aa];this.#ca.create(i,n)}#ma(t){this.#ha.innerHTML=`<span class="se-code-lang-icon">&lt;/&gt;</span><span class="se-code-lang-text">${t||this.$.lang.codeLanguage||"Language"}</span>`}#Ca(){return this.#ca?.isOpen||this.#da?.isOpen}#wa(t){const e="PRE"===t?.nodeName?t:Ut.query.getParentElement(t,(t=>/^PRE$/i.test(t.nodeName)));return e&&e.className.match(/language-(\S+)/)?.[1]||""}#xa(t,e){t.className=t.className.replace(/\s*language-\S+/g,"").trim(),e?(Ut.utils.addClass(t,"language-"+e),t.setAttribute("data-se-lang",e)):t.removeAttribute("data-se-lang")}destroy(){this.#ua&&Ut.utils.removeClass(this.#ua,"se-pre-code-focus"),this.#da?.form?.parentNode?.removeChild(this.#da.form),this.#ua=null}}const ul=dl,{_w:pl,_d:gl}=Dt;const ml=class extends sl{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 to(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=Ut.utils.createElement("div",{class:i},e.innerHTML);t=Ut.utils.createElement("div",{style:"position: absolute; top: -10000px; left: -10000px; width: 21cm; columns: 21cm; height: auto;"},n);const o=pl.getComputedStyle(e).padding,l=Ut.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}`,gl.body.appendChild(t),!1===await this.$.eventManager.triggerEvent("onExportPDFBefore",{target:t}))return;return void await this.#Sa(t)}catch(t){console.error("[SUNEDITOR.plugins.exportPDF.error]",t.message)}finally{Ut.utils.removeItem(t),this.$.ui.hideLoading()}}async#Sa(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=Ut.utils.createElement("A",{href:o,download:l,style:"display: none;"},null);try{gl.body.appendChild(r),r.click()}finally{pl.setTimeout((()=>{Ut.utils.removeItem(r),URL.revokeObjectURL(o)}),100)}}},{NO_EVENT:fl}=Dt;class vl extends sl{static key="fileUpload";static className="";static options={eventIndex:1e4};static component(t){return Ut.check.isAnchor(t)&&t.hasAttribute("data-se-file-download")?t:null}#Ea;#Ta=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=Zt.get(e.uploadSizeLimit,0),this.uploadSingleSizeLimit=Zt.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=Ut.utils.createElement("input",{type:"file",accept:this.acceptedFormats}),this.allowMultiple&&this.input.setAttribute("multiple","multiple"),this.#Ea=this.acceptedFormats.split(", ");const s={"custom-download":{command:"download",title:this.$.lang.download,icon:"download",action:t=>{const e=t.getAttribute("href");e&&Ut.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 qs(this,this.$,i,{}),this.fileManager=new Ko(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 Ut.utils.createElement("DIV",{class:"se-controller se-controller-simple-input"},s)}(this.$);this.controller=new Ms(this,this.$,t,{position:"bottom",disabled:!0},vl.key),this.editInput=t.querySelector("input")}this.$.eventManager.addEvent(this.input,"change",this.#Pr.bind(this))}action(){this.$.store.set("_preventBlur",!0),this.input.click()}onFilePasteAndDrop({file:t}){const e=t.type;this.#Ea.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.#Ta.textContent=this.editInput.value}this.controller.close(),this.$.component.select(this.#Ta,vl.key)}}componentSelect(t){this.#Ta=t;const e=this.figure.controller.form.querySelector('[data-command="__c__as"]');if(e)return Ut.check.isFigure(t.parentElement)?(e.innerHTML=this.$.icons.reduction+Ut.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+Ut.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:!Ut.check.isFigure(t.parentElement),initMethod:null,addOffset:null}),this.editInput.focus()}async componentDestroy(t){if(!t)return;const e=qs.GetContainer(t),s=Ut.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;Ut.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===fl?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===fl?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.#oa.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!==fl||r(null)))}convertFormat(t,e){if("link"===e){this.figure.close();const{container:e}=qs.GetContainer(t),s=e.nextElementSibling,i=e.parentElement;t.removeAttribute("data-se-non-focus"),t.setAttribute("contenteditable","false"),Ut.utils.addClass(t,"se-component|se-inline-component");const n=Ut.utils.createElement(this.$.options.get("defaultLine"),null,t);i.insertBefore(n,s),Ut.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&&Ut.check.isZeroWidth(s.previousElementSibling)&&Ut.utils.removeItem(s.previousElementSibling),t.setAttribute("data-se-non-focus","true"),t.removeAttribute("contenteditable"),Ut.utils.removeClass(t,"se-component|se-component-selected|se-inline-component");const i=qs.CreateContainer(t,"se-file-figure se-flex-component");(s||e.container).parentElement.insertBefore(i.container,s)}this.$.history.push(!1),this.$.component.select(t,vl.key)}create(t,e,s){const i=e.name||t,n=Ut.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=qs.CreateContainer(n);if(Ut.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,vl.key);else{const t=this.$.format.addLine(o.container,null);t&&this.$.selection.setRange(t,0,t,0)}}else this.$.focusManager.focus()}#ia(t){t.result.forEach(((t,e,s)=>{this.create(t.url,{name:t.name,size:t.size},e===s.length-1)}))}async#na(t){const e=await this.$.eventManager.triggerEvent("onFileUploadError",{error:t});if(!1===e)return;const s=e===fl?t.errorMessage:e||t.errorMessage;this.$.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.fileUpload.error]",s)}#oa(t){const e=JSON.parse(t.responseText);e.errorMessage?this.#na(e):this.#ia(e)}async#Pr(t){const e=Ut.query.getEventTarget(t);await this.submitFile(e.files)}}const bl=vl;class yl extends sl{static key="list_bulleted";static className="se-icon-flip-rtl";#Ma;constructor(t){super(t),this.title=this.$.lang.bulletedList,this.icon="list_bulleted",this.afterItem=Ut.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":yl.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 Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.#Ma=e.querySelectorAll("li button ul"),this.$.menu.initDropdownTarget({key:yl.key,type:"dropdown"},e)}active(t,e){return Ut.check.isListCell(t)&&/^UL$/i.test(t.parentElement.nodeName)?(Ut.utils.addClass(e,"active"),!0):(Ut.utils.removeClass(e,"active"),!1)}action(t){const e=this.$.format.getBlock(this.$.selection.getNode()),s=t?.querySelector("ul")?.style.listStyleType;Ut.check.isList(e)&&s?e.style.listStyleType=s:this.submit(s),this.$.menu.dropdownOff()}on(){const t=this.#Ma,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?Ut.utils.addClass(e.parentElement,"active"):Ut.utils.removeClass(e.parentElement,"active")}shortcut({range:t,info:e}){const{startContainer:s}=t;if(Ut.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 wl=yl;class Cl extends sl{static key="list_numbered";static className="se-icon-flip-rtl";#Ma;constructor(t){super(t),this.title=this.$.lang.numberedList,this.icon="list_numbered",this.afterItem=Ut.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":Cl.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${_l(["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${_l(["lower-latin","upper-latin","lower-greek"])}\n\t\t</ul>\n\t</div>`;return Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.#Ma=e.querySelectorAll("li button ol"),this.$.menu.initDropdownTarget({key:Cl.key,type:"dropdown"},e)}active(t,e){return Ut.check.isListCell(t)&&/^OL$/i.test(t.parentElement.nodeName)?(Ut.utils.addClass(e,"active"),!0):(Ut.utils.removeClass(e,"active"),!1)}action(t){const e=this.$.format.getBlock(this.$.selection.getNode()),s=t?.querySelector("ol")?.style.listStyleType;Ut.check.isList(e)&&s?e.style.listStyleType=s:this.submit(s),this.$.menu.dropdownOff()}on(){const t=this.#Ma,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?Ut.utils.addClass(e.parentElement,"active"):Ut.utils.removeClass(e.parentElement,"active")}shortcut({range:t,info:e}){const{startContainer:s}=t;if(Ut.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 _l(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 xl=Cl,{debounce:$l}=Wt;const kl=class extends ol{static key="mention";static className="";#Ha=0;#La=0;#Na=null;constructor(t,e){super(t),this.title=this.$.lang.mention,this.icon="mention",this.triggerText=e.triggerText||"@",this.limitSize=e.limitSize||5,this.searchStartLength=e.searchStartLength||0,this.delayTime="number"==typeof e.delayTime?e.delayTime:200,this.directData=e.data,this.apiUrl=e.apiUrl?.replace(/\s/g,"").replace(/\{limitSize\}/i,String(this.limitSize))||"",this.apiManager=new to(this,this.$,{headers:e.apiHeaders}),this.cachingData=e.useCachingData??1?new Map:null,this.cachingFieldData=e.useCachingFieldData??1?[]:null;const s=Ut.utils.createElement("DIV",{class:"se-controller se-empty-controller"},"<div></div>");this.selectMenu=new Ls(this.$,{position:"right-bottom",dir:"ltr",closeMethod:()=>this.controller.close()}),this.controller=new Ms(this,this.$,s,{position:"bottom",initMethod:()=>{this.apiManager.cancel(),this.selectMenu.close()}},null),this.selectMenu.on(s.firstElementChild,this.#Ba.bind(this)),this.onInput=$l(this.onInput.bind(this),this.delayTime)}async onInput(){this.directData||this.apiManager.cancel();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),n=i.lastIndexOf(this.triggerText);if(n>-1){const t=i.substring(n+1,s),o=i[n-1]?.trim();if(!/\s/.test(t)&&(!o||Ut.check.isZeroWidth(o))){if(t.length<this.searchStartLength)return;const i=e.parentNode;if(Ut.check.isAnchor(i)&&!i.getAttribute("data-se-mention"))return;try{return await this.#Aa(t,e),this.#Ha=n,this.#Na=e,void(this.#La=s)}catch(t){console.warn("[SUNEDITOR.mention.api.file] ",t)}}}this.selectMenu.close()}async#Aa(t,e){const s=this.limitSize,i=t.toLowerCase();let n=null;if(this.cachingData&&(n=this.cachingData.get(t)),!n)if(this.directData)n=this.directData.filter((t=>t.key.toLowerCase().startsWith(i))).slice(0,s);else{const e=await this.apiManager.asyncCall({method:"GET",url:this.#Ia(t)});n=JSON.parse(e.responseText)}if(this.cachingFieldData){const t=new Set;n=this.cachingFieldData.concat(n).filter((({key:e})=>!t.has(e)&&(t.add(e),e.toLowerCase().startsWith(i)))).slice(0,s)}if(!n?.length)return this.selectMenu.close(),!1;const o=[],l=[];for(let t,e=0,s=n.length;e<s;e++)t=n[e],o.push(t),l.push(`<div class="se-mention-item"><span>${t.key}</span><span>${t.name}</span></div>`);return 0===o.length?(this.selectMenu.close(),!1):(this.controller.open(e,null,{isWWTarget:!0,initMethod:null,addOffset:null}),this.selectMenu.create(o,l),this.selectMenu.open(),this.selectMenu.setItem(0),this.cachingData&&this.cachingData.set(t,o),!0)}#Ia(t){return this.apiUrl.replace(/\{key\}/i,t)}#Ba(t){if(!t)return!1;let e=null;const{key:s,name:i,url:n}=t,o=this.#Na.parentNode;if(Ut.check.isAnchor(o))e=o,e.setAttribute("data-se-mention",s),e.setAttribute("href",n),e.setAttribute("title",i),e.textContent=this.triggerText+s;else if(this.$.selection.setRange(this.#Na,this.#Ha,this.#Na,this.#La),e=Ut.utils.createElement("A",{"data-se-mention":s,href:n,title:i,target:"_blank"},this.triggerText+s),!this.$.html.insertNode(e,{afterNode:null,skipCharCount:!1}))return!1;this.selectMenu.close();const l=Ut.utils.createTextNode(" ");e.parentNode.insertBefore(l,e.nextSibling),this.$.selection.setRange(l,1,l,1),this.cachingFieldData&&!this.cachingFieldData.some((e=>e.key===t.key))&&this.cachingFieldData.push(t)}};class Sl extends il{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";const s=function({lang:t,icons:e,options:s},i){const n=Array.isArray(i)?i:s.get("_rtl")?["right","center","left","justify"]:["left","center","right","justify"];let o="";for(let s,i,l=0;l<n.length;l++)s=n[l],i=t["align"+s.charAt(0).toUpperCase()+s.slice(1)],o+=`\n\t\t<li>\n\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${s}" title="${i}" aria-label="${i}">\n\t\t\t\t<span class="se-list-icon">${e["align_"+s]}</span>${i}\n\t\t\t</button>\n\t\t</li>`;return Ut.utils.createElement("div",{class:"se-dropdown se-list-layer se-list-align"},`\n\t\t<div class="se-list-inner">\n\t\t\t<ul class="se-list-basic">${o}</ul>\n\t\t</div>`)}(this.$,e.items),i=this._itemMenu=s.querySelector("ul");this.defaultDir="",this.alignIcons={justify:this.$.icons.align_justify,left:this.$.icons.align_left,right:this.$.icons.align_right,center:this.$.icons.align_center},this.alignList=i.querySelectorAll("li button"),this.$.menu.initDropdownTarget(Sl,s)}active(t,e){const s=e.firstElementChild;if(t){if(this.$.format.isLine(t)){const i=t.style.textAlign;return i?(Ut.utils.changeElement(s,this.alignIcons[i]||this.alignIcons[this.defaultDir]),e.setAttribute("data-focus",i),!0):void 0}}else Ut.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")?Ut.utils.addClass(s[t],"active"):Ut.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++)Ut.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.#Va();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.#Va()}#Va(){const t=this.$.frameContext.get("wwComputedStyle").getPropertyValue("text-align");return["left","center","right","justify"].includes(t)?t:this.$.options.get("_rtl")?"right":"left"}}const El=Sl;class Tl extends il{static key="font";static className="se-btn-select se-btn-tool-font";#Oa;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=function({lang:t},e){let s=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list default_value" data-command="" title="${t.default}" aria-label="${t.default}">\n\t\t\t\t\t${t.default}\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t\t<li class="se-btn-list se-sub-list"><span></span></li>`;for(let t,i,n=0,o=e.length;n<o;n++)t=e[n],i=t.split(",")[0],s+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${t}" data-txt="${i}" title="${i}" aria-label="${i}" style="font-family:${t};">${i}</button>\n\t\t\t</li>`;return s+="\n\t\t</ul>\n\t</div>",Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-font-family"},s)}(this.$,s);this.currentFont="",this.fontList=i.querySelectorAll("ul li button"),this.fontArray=s,this.#Oa=i.querySelector(".se-sub-list span"),this.$.menu.initDropdownTarget(Tl,i)}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=Ut.utils.getStyle(t,"fontFamily")){const t=n.replace(/["']/g,"");return Ut.utils.changeTxt(s,t),Ut.utils.changeTxt(i,this.$.lang.font+" ("+t+")"),!0}}else{const t=this.$.store.get("hasFocus")?this.$.frameContext.get("wwComputedStyle").fontFamily:this.$.lang.font;Ut.utils.changeTxt(s,t),Ut.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,"")?(Ut.utils.addClass(e[i],"active"),t=!0):Ut.utils.removeClass(e[i],"active");this.currentFont=s,t?this.#Oa.style.display="none":(this.#Oa.textContent=s,this.#Oa.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=Ut.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 Ml=Tl;class Hl extends nl{static key="fontColor";static className="";constructor(t,e){super(t),this.title=this.$.lang.fontColor,this.icon="font_color";const s=Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new Wo(this,this.$,"color",{form:s,colorList:e.items,splitNum:e.splitNum,disableHEXInput:e.disableHEXInput,hueSliderOptions:{controllerOptions:{isOutsideForm:!0}}}),this.$.menu.initDropdownTarget(Hl,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=Ut.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=Ut.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 Ll=Hl;class Nl extends nl{static key="backgroundColor";static className="";constructor(t,e){super(t),this.title=this.$.lang.backgroundColor,this.icon="background_color";const s=Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new Wo(this,this.$,"backgroundColor",{form:s,colorList:e.items,splitNum:e.splitNum,disableHEXInput:e.disableHEXInput,hueSliderOptions:{controllerOptions:{isOutsideForm:!0}}}),this.$.menu.initDropdownTarget(Nl,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=Ut.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=Ut.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 Bl=Nl;class Al extends il{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=function({lang:t},e){const s=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}];let i="";for(let t=0,e=s.length;t<e;t++)i+=`\n\t\t<li>\n\t\t\t<button type="button" class="se-btn se-btn-list" data-command="hr" title="${s[t].name}" aria-label="${s[t].name}">\n\t\t\t\t<hr${s[t].class?` class="${s[t].class}"`:""}${s[t].style?` style="${s[t].style}"`:""}/>\n\t\t\t</button>\n\t\t</li>`;return Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-line"},`\n\t\t<div class="se-list-inner">\n\t\t\t<ul class="se-list-basic">${i}</ul>\n\t\t</div>`)}(this.$,e.items);this.list=s.querySelectorAll("button"),this.$.menu.initDropdownTarget(Al,s)}componentSelect(t){Ut.utils.addClass(t,"on")}componentDeselect(t){Ut.utils.removeClass(t,"on")}componentDestroy(t){if(!t)return;const e=t.previousElementSibling||t.nextElementSibling;Ut.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"),Ut.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=Ut.utils.createElement("hr",{class:t});return this.$.focusManager.focus(),this.$.component.insert(e,{insertBehavior:"line"}),e}}const Il=Al;class Vl extends il{static key="list";static className="se-icon-flip-rtl";#Ma;#Ra;constructor(t){super(t),this.title=this.$.lang.list,this.icon="list_numbered";const e=function({lang:t,icons:e}){const s=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-tooltip se-icon-flip-rtl" data-command="ol" title="${t.numberedList}" aria-label="${t.numberedList}">\n\t\t\t\t\t${e.list_numbered}\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-tooltip se-icon-flip-rtl" data-command="ul" title="${t.bulletedList}" aria-label="${t.bulletedList}">\n\t\t\t\t\t${e.list_bulleted}\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t</ul>\n\t</div>`;return Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},s)}(this.$);this.#Ma=e.querySelectorAll("li button"),this.#Ra={bulleted:this.$.icons.list_bulleted,numbered:this.$.icons.list_numbered},this.$.menu.initDropdownTarget(Vl,e)}active(t,e){const s=e.firstElementChild;if(Ut.check.isList(t)){const i=t.nodeName.toLowerCase();return e.setAttribute("data-focus",i),Ut.utils.addClass(e,"active"),/^ul$/.test(i)?Ut.utils.changeElement(s,this.#Ra.bulleted):Ut.utils.changeElement(s,this.#Ra.numbered),!0}return e.removeAttribute("data-focus"),Ut.utils.changeElement(s,this.#Ra.numbered),Ut.utils.removeClass(e,"active"),!1}on(t){const e=t.getAttribute("data-focus")||"",s=this.#Ma;for(let t=0,i=s.length;t<i;t++)e===s[t].getAttribute("data-command")?Ut.utils.addClass(s[t],"active"):Ut.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 Ol=Vl,Rl=".se-table-resize-line",zl=".se-table-resize-line-prev",Fl=".se-table-resize-row",Pl=".se-table-resize-row-prev",Dl=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],ql={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"},Wl=["all","inside","horizon","vertical"],Ul="borderLeft",Zl="borderTop",Gl="borderRight",jl="borderBottom",Kl=["#bbf7d0","#fde68a","#fecaca","#e9d5ff","#bfdbfe","#22c55e","#eab308","#ef4444","#a855f7","#3b82f6","#15803d","#ca8a04","#b91c1c","#7e22ce","#1d4ed8","#e5e7eb","#9ca3af","#6b7280","#374151","#000000"],Yl={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:Xl}=Dt,Jl=new WeakMap,Ql=new WeakMap;function tr(t){return/^(TD|TH|TR)$/i.test(t?.nodeName)}function er(t){return/^CAPTION$/i.test(t.nodeName)}function sr(t,e){const s=t.clientX,i=Zt.get(Xl.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 ir(t,e){const s=t.clientY,i=Zt.get(Xl.getComputedStyle(e).height,0),n=e.getBoundingClientRect();return{is:Math.ceil(i+n.top-s)<=6,startY:s}}function nr(t,e){return`<${t=t.toLowerCase()}><div><br></div></${t}>`.repeat(e)}function or(t){return t=t.toLowerCase(),Ut.utils.createElement(t,null,"<div><br></div>")}function lr(t,e,s){let i=Ql.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),Ql.set(t,i)),i[e]?.[s]??0}function rr(t,e){const s=Ut.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 ar(t){t&&(Jl.delete(t),Ql.delete(t))}function hr(t,e,s){const i=[];let n="";for(const o in ql){if(s.includes(o))continue;const l=ql[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:Ut.utils.createElement("DIV",null,n).querySelectorAll("button")}}const cr=class{#za;#X;#L;constructor(t,{mergeButton:e,unmergeButton:s,splitButton:i,openCellMenuFunc:n,closeCellMenuFunc:o}){this.#za=t,this.#X=t.$,this.#L=t.state,this.mergeButton=e,this.unmergeButton=s,this.splitButton=i;const l=(r=this.#X.lang,{items:["vertical","horizontal"],menus:Ut.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 Ls(this.#X,{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#Fa(){return this.#za.selectionService}openSplitMenu(){this.selectMenu_split.open()}mergeCells(t,e=!1){const s=t[0].closest("table");ar(s);const{clonedTable:i,clonedSelectedCells:n}=e?{clonedTable:s,clonedSelectedCells:t}:rr(s,t);this.#za.setTableInfo(i),t=n,this.#za.setState("ref",null),this.#Fa.setMultiCells(t[0],Ut.query.findVisualLastCell(t));const o=this.#L.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.#X.format.isLine(s[t])&&Ut.check.isZeroWidth(s[t].textContent)&&Ut.utils.removeItem(s[t]);d+=e.innerHTML,Ut.utils.removeItem(e),0===u.cells.length&&(r?a=u:r=u,c-=1)}if(r){const t=this.#L.trElements,e=Ut.utils.getArrayIndex(t,r),s=Ut.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-=Zt.getOverlapRangeAtIndex(e,s,o,o+i));else i.push(t[o]);for(let t=0,e=i.length;t<e;t++)Ut.utils.removeItem(i[t])}l.innerHTML+=d,l.colSpan=h,l.rowSpan=c,e||(s.replaceWith(i),this.#za._closeTableSelectInfo(),this.#za._setController(l),this.#Fa.focusCellEdge(l),this.#Fa.initCellSelection(l),this.#za.setState("ref",null),this.#za.setState("selectedCells",[l]),this.#za.setCellInfo(l,!0),this.setUnMergeButton(),this.setMergeSplitButton(),this.#za.historyPush())}unmergeCells(t,e=!1){if(!t?.length)return;const s=t[0].closest("table");ar(s);const{clonedTable:i,clonedSelectedCells:n}=e?{clonedTable:s,clonedSelectedCells:t}:rr(s,t);this.#za.setState("ref",null),this.#za.setTableInfo(i);let o=(t=n)[0],l=Ut.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.#za.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=or("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.#za.setState("selectedCells",null),e||(s.replaceWith(i),this.#za._closeTableSelectInfo(),this.#za.setTableInfo(i),o!==l?(l=!r||l.closest("tr").rowIndex>r.closest("tr").rowIndex||l.cellIndex>r.cellIndex?l:r,this.#Fa.setMultiCells(o,l),this.#za.setState("selectedCells",Array.from(a.querySelectorAll(".se-selected-table-cell")))):this.#za.setCellInfo(l,!0),this.#Fa.initCellSelection(o),this.#za.setState("selectedCell",l),this.setUnMergeButton(),this.#za.controller_cell.resetPosition(l),this.#za.historyPush())}findMergedCells(t){const e=[];return t?.forEach((t=>{t&&(t.rowSpan>1||t.colSpan>1)&&e.push(t)})),e}setMergeSplitButton(){this.#L.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.#L.selectedCells?.length?this.#L.selectedCells:[this.#L.fixedCell]).length>0?this.unmergeButton.disabled=!1:this.unmergeButton.disabled=!0}_OnSplitCells(t){ar(this.#za._element);const e="vertical"===t,s=this.#L.tdElement,i=this.#L.trElements,n=this.#L.trElement,o=this.#L.logical_cellIndex,l=this.#L.rowIndex,r=or(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.#L.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=Ut.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=Ut.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.#L.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.#Fa.focusCellEdge(s),this.#Fa.deleteStyleSelectedCells(),this.#X.history.push(!1),this.#za._setController(s),this.#za.setState("selectedCell",s),this.#za.setState("fixedCell",s),this.#L.selectedCells?.length||this.#za.setState("selectedCells",[s])}};const dr=class{#za;#L;constructor(t){this.#za=t,this.#L=t.state}get#Fa(){return this.#za.selectionService}get#Pa(){return this.#za.gridService}get#Da(){return this.#za.cellService}copySelectedTableCells(t,e,s){t.preventDefault(),t.stopPropagation();const i=s[0].closest("table"),n=i.cloneNode(!1),o=Ut.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=lr(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=Ut.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=Ut.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;ar(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.#Fa.deleteStyleSelectedCells();const r=e.closest("table"),{clonedTable:a,clonedSelectedCells:h}=rr(r,[e]),c=a;e=h[0];let d=c.rows;this.#za.setTableInfo(c),this.#za.setCellInfo(e,!0);const u={physicalCellCnt:this.#L.physical_cellCnt,logicalCellCnt:this.#L.logical_cellCnt,rowCnt:this.#L.rowCnt,rowIndex:this.#L.rowIndex,physicalCellIndex:this.#L.physical_cellIndex,logicalCellIndex:this.#L.logical_cellIndex,currentColSpan:this.#L.current_colSpan,currentRowSpan:this.#L.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.#Pa.editRow("down",e);for(let t=0;t<g;t++)this.#Pa.editColumn("right",e);this.#za.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.#Da.unmergeCells(b,!0),this.#za.setState("trElements",d=c.rows));const w=[],C=[],_=[];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(;C[t]?.[i];)i++;for(let e=1;e<l;e++){const s=t+e;C[s]||=[];for(let t=0;t<o;t++)C[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&&w.push(h),i+=o}}if(w.length>0){for(const t of w)this.#za.setState("ref",null),this.#za.setState("trElements",c.rows),this.#Da.mergeCells(t,!0);this.#za.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.#za._closeTableSelectInfo(),this.#za.setTableInfo(c),this.#Da.setMergeSplitButton(),this.#Da.setUnMergeButton(),this.#Fa.focusCellEdge(x[0]),this.#za.historyPush(),x}};const ur=class{#za;#X;#L;constructor(t,{columnButton:e,rowButton:s,openCellMenuFunc:i,closeCellMenuFunc:n}){this.#za=t,this.#X=t.$,this.#L=t.state;const o=(l=this.#X.lang,r=this.#X.icons,{items:["insert-left","insert-right","delete"],menus:Ut.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 Ls(this.#X,{checkList:!1,position:"bottom-center",openMethod:i,closeMethod:n}),this.selectMenu_column.on(e,this.#qa.bind(this)),this.selectMenu_column.create(o.items,o.menus);const a=function(t,e){return{items:["insert-above","insert-below","delete"],menus:Ut.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.#X.lang,this.#X.icons);this.selectMenu_row=new Ls(this.#X,{checkList:!1,position:"bottom-center",openMethod:i,closeMethod:n}),this.selectMenu_row.on(s,this.#Wa.bind(this)),this.selectMenu_row.create(a.items,a.menus)}get#Fa(){return this.#za.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.#L.tdElement?.nodeName)?"none":"",this.selectMenu_row.open()}editTable(t,e){const s=this.#za._element,i="row"===t;if(i){const t=this.#L.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>"+nr("td",this.#L.logical_cellCnt)+"</tr></tbody>":(Ut.utils.removeItem(this.#L.figureElement),this.#za._closeTableSelectInfo()))}}if(this.#L.ref){const t=this.#L.tdElement,s=this.#L.selectedCells;if(i)if(e)this.#za.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.#za.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.#za.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.#za.setCellInfo(t[s],!0),this.editColumn(e)}}e||this.#za.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&&(Ut.utils.removeItem(t[e]),e--);0===s.children.length&&Ut.utils.removeItem(s)}}editColumn(t,e,s){e&&this.#za.setCellInfo(e,!0);const i=!t,n="left"===t,o=this.#L.current_colSpan,l=this.#L.logical_cellIndex+(i||n?0:o+1),r=this.#L.trElements;let a,h=[],c=[],d=0;const u=[],p=[];for(let t,e,s,n,g,m=0,f=this.#L.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-=Zt.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=or(e[0].nodeName),s=t.insertBefore(s,e[a]))}}const g=this.#za._element.querySelector("colgroup");if(g){const t=g.querySelectorAll("col");if(i)Ut.utils.removeItem(t[a]);else{if(!(!Ut.utils.hasClass(this.#za._element,"se-table-layout-fixed")&&"fixed"!==this.#za._element.style.tableLayout)&&Array.prototype.some.call(t,(t=>Zt.get(t.style.width)>0))){let e=0;for(let s,i=0,n=t.length;i<n;i++)s=Zt.get(t[i].style.width),s-=Math.round(s*n*.1/2),e+=s,t[i].style.width=`${s}%`;const s=Ut.utils.createElement("col",{style:`width:${100-e}%`});g.insertBefore(s,t[a])}else g.insertBefore(Ut.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,Ut.utils.removeItem(u[i]),0===s.cells.length&&(t||=Ut.utils.getArrayIndex(r,s),e=Ut.utils.getArrayIndex(r,s),Ut.utils.removeItem(s));for(let s,i=0,n=p.length;i<n;i++)s=p[i],s.cell.rowSpan=Zt.getOverlapRangeAtIndex(t,e,s.i,s.rs);this.#za._closeController()}else this.#za._setCellControllerPosition(s||this.#L.tdElement,!0);return s||this.#L.tdElement}editRow(t,e,s){this.#Fa.deleteStyleSelectedCells(),e&&this.#za.setCellInfo(e,!0);const i=!t,n="up"===t,o=this.#L.rowIndex,l=i||n?o:o+this.#L.current_rowSpan+1,r=i?-1:1,a=this.#L.trElements;let h=this.#L.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.#za._element.deleteRow(l)}else this.insertBodyRow(this.#za._element,l,h);i?this.#za._closeController():this.#za._setCellControllerPosition(s||this.#L.tdElement,!0)}insertBodyRow(t,e,s){const i=t.insertRow(e);return i.innerHTML=nr("td",s),i}#qa(t){switch(ar(this.#za._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.#za.historyPush()}#Wa(t){switch(ar(this.#za._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.#za.historyPush()}},{_w:pr}=Dt;const gr=class{#za;#X;#L;#Ks;#Ua=!1;#Za=null;#Ga=null;constructor(t){this.#za=t,this.#X=t.$,this.#L=t.state,this.#Ks={resize:null,resizeStop:null,resizeKeyDown:null}}get#Fa(){return this.#za.selectionService}isResizing(){return this.#Ua}onResizeGuide(t,e){const s=sr(t,e);if(s.is)return this.#za._element&&(this.#za._element.style.cursor=""),this.#Is(),"block"===this.#Za?.style.display&&(this.#Za.style.display="none"),this.#Za=this.#X.frameContext.get("wrapper").querySelector(Rl),this.#ja(Ut.query.getParentElement(e,Ut.check.isTable),e,this.#Za,s.isLeft),this.#Za.style.display="block",!1;return ir(t,e).is?(this.#Is(),this.#za._element=Ut.query.getParentElement(e,Ut.check.isTable),this.#za._element.style.cursor="ns-resize","block"===this.#Za?.style.display&&(this.#Za.style.display="none"),this.#Za=this.#X.frameContext.get("wrapper").querySelector(Fl),this.#Ka(Ut.query.getParentElement(e,Ut.check.isTable),e,this.#Za),this.#Za.style.display="block",!1):void 0}offResizeGuide(){this.#Ya()}readyResizeFromEdge(t,e){const s=sr(t,e);if(s.is){try{this.#Fa.deleteStyleSelectedCells(),this.#za.setCellInfo(e,!0);const t=this.#L.logical_cellIndex+this.#L.current_colSpan-(s.isLeft?1:0);if(this.#X.ui.enableBackWrapper("ew-resize"),this.#Za||=this.#X.frameContext.get("wrapper").querySelector(Rl),this.#Ga=this.#X.frameContext.get("wrapper").querySelector(zl),t<0||t===this.#L.logical_cellCnt-1)return this._startFigureResizing(s.startX,t<0),this.#za._editorEnable(!1),!1;const i=this.#za._element.querySelector("colgroup").querySelectorAll("col")[t<0?0:t];this._startCellResizing(i,s.startX,Zt.get(pr.getComputedStyle(i).width,0),s.isLeft),this.#za._editorEnable(!1)}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.#za._editorEnable(!0),this.#Is()}finally{this.#za.setState("fixedCell",null),this.#za.setState("selectedCell",null),this.#za.controller_table.hide(),this.#za.controller_cell.hide()}return!1}const i=ir(t,e);if(i.is){try{let t=Ut.query.getParentElement(e,Ut.check.isTableRow),s=e.rowSpan;if(s>1)for(;Ut.check.isTableRow(t)&&s>1;)t=t.nextElementSibling,--s;this.#Fa.deleteStyleSelectedCells(),this.#za.setRowInfo(t),this.#X.ui.enableBackWrapper("ns-resize"),this.#Za||=this.#X.frameContext.get("wrapper").querySelector(Fl),this.#Ga=this.#X.frameContext.get("wrapper").querySelector(Pl),this._startRowResizing(t,i.startY,Zt.get(pr.getComputedStyle(t).height,0)),this.#za._editorEnable(!1)}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.#za._editorEnable(!0),this.#Is()}finally{this.#za.setState("fixedCell",null),this.#za.setState("selectedCell",null),this.#za.controller_table.hide(),this.#za.controller_cell.hide()}return!1}}#Xa(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||Zt.get(e,0))/s*100;t.style.width=i+"%"}}))}_startCellResizing(t,e,s,i){const n=this.#L.figureElement;Ut.utils.removeClass(n,"se-component-selected"),this.#Xa(this.#za._element),this.#ja(n,this.#L.tdElement,this.#Ga,i),this.#Ga.style.display="block";const o=t.style.width,l=t.nextElementSibling,r=l.style.width,a=Ut.utils.hasClass(this.#za._element,"se-table-layout-fixed")?r:Wt.getWidthInPercentage(l||t);ws.get("__dragHandler")&&(ws.get("__dragHandler").style.display="none"),this.#Ja(this.#Qa.bind(this,t,l,n,this.#L.tdElement,this.#Za,i,e,s,Zt.get(o,0),Zt.get(a,0),this.#za._element.offsetWidth),(()=>{this.#Is(),this.#Xa(this.#za._element),this.#X.history.push(!0),this.#X.component.hoverSelect(this.#za._element),this.#za._editorEnable(!0)}),(e=>{this._stopResize(t,o,"width",e),this._stopResize(l,r,"width",e)}))}#Qa(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.#ja(s,i,n,o)}}_startRowResizing(t,e,s){const i=this.#L.figureElement;Ut.utils.removeClass(i,"se-component-selected"),this.#Ka(i,t,this.#Ga),this.#Ga.style.display="block";const n=t.style.height;ws.get("__dragHandler")&&(ws.get("__dragHandler").style.display="none"),this.#Ja(this.#th.bind(this,t,i,this.#Za,e,s),(()=>{this.#Is(),this.#X.history.push(!0),this.#X.component.hoverSelect(this.#za._element),this.#za._editorEnable(!0)}),this._stopResize.bind(this,t,n,"height"))}#th(t,e,s,i,n,o){const l=n+(o.clientY-i);t.style.height=`${l}px`,this.#Ka(e,t,s)}_startFigureResizing(t,e){const s=this.#L.figureElement;Ut.utils.removeClass(s,"se-component-selected"),this.#ja(s,s,this.#Ga,e),this.#Ga.style.display="block";const i=Wt.getWidthInPercentage(s);ws.get("__dragHandler")&&(ws.get("__dragHandler").style.display="none"),this.#Ja(this.#eh.bind(this,s,this.#Za,e,t,s.offsetWidth,Zt.get(i,0)),(()=>{this.#Is(),Zt.get(s.style.width,0)>100&&(s.style.width="100%"),this.#X.history.push(!0),this.#X.component.hoverSelect(this.#za._element),this.#za._editorEnable(!0)}),this._stopResize.bind(this,s,s.style.width,"width"))}#eh(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.#ja(t,t,e,s))}#ja(t,e,s,i){const n=this.#X.offset.getLocal(e),o=this.#X.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`}#Ka(t,e,s){const i=this.#X.offset.getLocal(e),n=this.#X.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){Gt.isEsc(i.code)&&(this.#Is(),this.#X.component.hoverSelect(this.#za._element),this.#za._editorEnable(!0),t.style[s]=e,"width"===s&&this.#X.component.select(this.#za._element,this.#za.constructor.key,{isInput:!0}))}#Ja(t,e,s){this.#Ks.resize=this.#X.eventManager.addGlobalEvent("mousemove",t,!1),this.#Ks.resizeStop=this.#X.eventManager.addGlobalEvent("mouseup",e,!1),this.#Ks.resizeKeyDown=this.#X.eventManager.addGlobalEvent("keydown",s,!1),this.#Ua=!0}#Is(){this.#Ua=!1,this.#X.ui.disableBackWrapper(),this.#Ya(),this.#Ga&&(this.#Ga.style.display="none",this.#Ga=null);const t=this.#Ks;for(const e in t)t[e]&&=this.#X.eventManager.removeGlobalEvent(t[e]);this.#Ua=!1,this.#Za=null}#Ya(){this.#Za&&(this.#Za.style.display="none",this.#Za=null),this.#za._element&&(this.#za._element.style.cursor="")}init(){this.#Is()}};const mr=class{#za;#X;#L;#sh;#ih;#nh;#oh;#Ks;#lh=null;constructor(t){this.#za=t,this.#X=t.$,this.#L=t.state,this.#sh=this.#rh.bind(this),this.#ih=this.#ah.bind(this),this.#nh=this.#hh.bind(this),this.#oh=this.#ch.bind(this),this.#Ks={on:null,off:null,shiftOff:null,touchOff:null,resize:null,resizeStop:null,resizeKeyDown:null}}get#Da(){return this.#za.cellService}selectCells(t){const e=t[0],s=Ut.query.findVisualLastCell(t);return this.#lh=e.nodeName,this.setMultiCells(e,s),{fixedCell:e,selectedCell:s}}setMultiCells(t,e){const s=this.#L.selectedTable,i=s.rows;if(this.deleteStyleSelectedCells(),Ut.utils.addClass(t,"se-selected-table-cell"),t===e&&!this.#L.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=Jl.get(s);const l=o?.get(n);if(l)return this.#za.setState("ref",l),void this.#dh(i,l);const r=this.#uh(i,t,e);this.#za.setState("ref",r),o||(o=new Map,Jl.set(s,o)),o.set(n,r),this.#dh(i,r)}#uh(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(Zt.getOverlapRangeAtIndex(l.cs,l.ce,c,c+d)&&Zt.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}#dh(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--)));Zt.getOverlapRangeAtIndex(e.cs,e.ce,r,r+a)&&Zt.getOverlapRangeAtIndex(e.rs,e.re,l,l+h)&&Ut.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.#za.setState("fixedCell",t),this.#L.selectedCells?.length||this.#za.setState("selectedCells",[t]),this.#lh=t.nodeName,this.#za.setState("selectedTable",Ut.query.getParentElement(t,"TABLE")),this.deleteStyleSelectedCells(),Ut.utils.addClass(t,"se-selected-cell-focus")}startCellSelection(t,e){this.#L.isShiftPressed||this.#L.ref||this.#Is(),this.#za.setState("isShiftPressed",e),this.initCellSelection(t),e?(this.#Ks.shiftOff=this.#X.eventManager.addGlobalEvent("keyup",this.#nh,!1),this.#Ks.on=this.#X.eventManager.addGlobalEvent("mousedown",this.#sh,!1)):this.#Ks.on=this.#X.eventManager.addGlobalEvent("mousemove",this.#sh,!1),this.#Ks.off=this.#X.eventManager.addGlobalEvent("mouseup",this.#ih,!1),this.#Ks.touchOff=this.#X.eventManager.addGlobalEvent("touchmove",this.#oh,!1)}deleteStyleSelectedCells(){Ut.utils.removeClass([this.#L.fixedCell,this.#L.selectedCell],"se-selected-cell-focus");const t=this.#L.fixedCell?.closest("table");if(t){const e=t.querySelectorAll(".se-selected-table-cell");for(let t=0,s=e.length;t<s;t++)Ut.utils.removeClass(e[t],"se-selected-table-cell")}}recallStyleSelectedCells(){if(this.#L.selectedCells){const t=this.#L.selectedCells;for(let e=0,s=t.length;e<s;e++)Ut.utils.addClass(t[e],"se-selected-table-cell")}}focusCellEdge(t){Dt.isMobile||this.#X.focusManager.focusEdge(t)}#rh(t){this.#X.store.set("_preventBlur",!0);const e=Ut.query.getParentElement(Ut.query.getEventTarget(t),Ut.check.isTableCell);if(this.#L.isShiftPressed){if(e===this.#L.fixedCell)return this.#za.setState("isShiftPressed",!1),this.deleteStyleSelectedCells(),this.#za._editorEnable(!0),void this.#Is();this.#za._editorEnable(!1)}else if(!this.#L.ref){if(e===this.#L.fixedCell)return;this.#za._editorEnable(!1)}e&&e!==this.#L.selectedCell&&this.#lh===e.nodeName&&this.#L.selectedTable===Ut.query.getParentElement(e,"TABLE")&&(this.#za.setState("selectedCell",e),this.setMultiCells(this.#L.fixedCell,this.#L.selectedCell))}#ah(t){t.stopPropagation(),this.#L.isShiftPressed?this.#Ks.touchOff&&=this.#X.eventManager.removeGlobalEvent(this.#Ks.touchOff):(this.#za._editorEnable(!0),this.#Is());const e=this.#L.fixedCell;if(!e||!this.#L.selectedTable)return;if(this.#Da.setMergeSplitButton(),this.#za.setState("selectedCells",Array.from(this.#L.selectedTable.querySelectorAll(".se-selected-table-cell"))),this.#L.isShiftPressed)return;e&&this.#L.selectedCell&&(this.focusCellEdge(e),e===this.#L.selectedCell&&Ut.utils.removeClass(e,"se-selected-table-cell"));const s=this.#L.selectedCells?.length>0?this.#L.selectedCell:e;this.#za._setController(s)}#hh(){if(this.#L.ref){this.#Is(),this.#za._editorEnable(!0),this.focusCellEdge(this.#L.fixedCell);const t=this.#L.selectedCells?.length>0?this.#L.selectedCell:this.#L.fixedCell;this.#za._setController(t)}else this.#za._closeController()}#ch(){this.#za.resetInfo()}#Is(){this.#X.ui.disableBackWrapper();const t=this.#Ks;for(const e in t)t[e]&&=this.#X.eventManager.removeGlobalEvent(t[e])}init(){this.#Is()}},{_w:fr}=Dt;const vr=class{#za;#L;#X;constructor(t,{pluginOptions:e,controller_table:s}){this.#za=t,this.#L=t.state,this.#X=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[ql.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=Ut.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.#X),n=[this.#za.controller_table,this.#za.controller_cell];this.controller_props=new Ms(this,this.#X,i.html,{position:"bottom",parents:n,isInsideForm:!0}),this.controller_props_title=i.controller_props_title;const o=Ut.utils.createElement("DIV",{class:"se-controller se-list-layer"},null);this.controller_colorPicker=new Ms(this,this.#X,o,{position:"bottom",parents:[this.controller_props].concat(n),isInsideForm:!0,isWWTarget:!1,initMethod:()=>{this.colorPicker.hueSlider.close(),Ut.utils.removeClass(this.controller_colorPicker.currentTarget,"on")}}),this.colorPicker=new Wo(this,this.#X,"",{form:o,colorList:e.colorList||Kl,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=Dl.length;s<i;s++)e=Dl[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=Ut.utils.createElement("DIV",null,t);return{items:Dl,menus:e.querySelectorAll("div")}}(),r=i.borderButton;this.selectMenu_props_border=new Ls(this.#X,{checkList:!1,position:"bottom-center"}),this.selectMenu_props_border.on(r,this.#ph.bind(this)),this.selectMenu_props_border.create(l.items,l.menus);const a=hr(this.#X.lang,this.#X.icons,[]),h=i.borderFormatButton;this.selectMenu_props_border_format=new Ls(this.#X,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:5}),this.selectMenu_props_border_format.on(h,this.#gh.bind(this,"all")),this.selectMenu_props_border_format.create(a.items,a.menus);const c=hr(this.#X.lang,this.#X.icons,Wl);this.selectMenu_props_border_format_oneCell=new Ls(this.#X,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:6}),this.selectMenu_props_border_format_oneCell.on(h,this.#gh.bind(this,"outside")),this.selectMenu_props_border_format_oneCell.create(c.items,c.menus),this.maxText=this.#X.lang.maxSize,this.minText=this.#X.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#Fa(){return this.#za.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.#X.lang.tableProperties,this.#mh("table"),this.controller_props.open(t,this.#za.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.#X.lang.cellProperties,this.#mh("cell"),this.controller_props.open(t,this.#za.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,Ut.utils.addClass(t,"on"),this.colorPicker.init(o?.value||"",t),this.controller_colorPicker.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null}))}toggleFontStyle(t){Ut.utils.toggleClass(this.propTargets[`font_${t}`],"on")}toggleHeader(){const t=this.headerButton,e=Ut.utils.hasClass(t,"active"),s=this.#za._element;if(ar(s),e)Ut.utils.removeItem(s.querySelector("thead"));else{const t=Ut.utils.createElement("THEAD");t.innerHTML="<tr>"+nr("th",this.#L.logical_cellCnt)+"</tr>",s.insertBefore(t,s.querySelector("tbody"))}Ut.utils.toggleClass(t,"active"),/TH/i.test(this.#L.tdElement.nodeName)?this.#za._closeController():this.#za._setCellControllerPosition(this.#L.tdElement,!1)}toggleCaption(){const t=this.captionButton,e=Ut.utils.hasClass(t,"active"),s=this.#za._element;if(e)Ut.utils.removeItem(s.querySelector("caption"));else{const t=Ut.utils.createElement("CAPTION",{class:`se-table-caption-${this.#za.captionPosition}`});t.innerHTML="<div><br></div>",s.insertBefore(t,s.firstElementChild)}Ut.utils.toggleClass(t,"active"),this.#za._setCellControllerPosition(this.#L.tdElement,!1)}resetHeaderButton(t){t.querySelector("thead")?Ut.utils.addClass(this.headerButton,"active"):Ut.utils.removeClass(this.headerButton,"active")}resetCaptionButton(t){t.querySelector("caption")?Ut.utils.addClass(this.captionButton,"active"):Ut.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.#fh(this.propTargets.cell_alignment,this._propsAlignCache,!0),this.#fh(this.propTargets.cell_alignment_vertical,this._propsVerticalAlignCache,!0),Ut.check.isTable(t[0][0])&&this.#L.figureElement&&(this.#L.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.#fh(this.propTargets.cell_alignment,t,!1)}setVerticalAlignProps(t){this.#fh(this.propTargets.cell_alignment_vertical,t,!1)}setTableLayout(t,e,s,i){if(t.includes("width")){const t=this.#L.figureElement;if(!t)return;let s,n;e?(s=this.#X.icons.reduction,n=this.minText,i||(t.style.width="100%")):(s=this.#X.icons.expansion,n=this.maxText,i||(t.style.width="max-content")),Ut.utils.changeElement(this.resizeButton.firstElementChild,s),Ut.utils.changeTxt(this.resizeText,n)}t.includes("column")&&(s?(Ut.utils.removeClass(this.#za._element,"se-table-layout-auto"),Ut.utils.addClass(this.#za._element,"se-table-layout-fixed"),Ut.utils.addClass(this.columnFixedButton,"active")):(Ut.utils.removeClass(this.#za._element,"se-table-layout-fixed"),Ut.utils.addClass(this.#za._element,"se-table-layout-auto"),Ut.utils.removeClass(this.columnFixedButton,"active")))}submitProps(t){try{t.disabled=!0;const e=this.#za.controller_table.form.contains(this.controller_props.currentTarget),s=e?[this.#za._element]:this.#L.selectedCells,i=s[0],n=fr.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 w=f?"":a.value.trim()||n.borderWidth;w+=Zt.is(w)?"px":"";const C=h.value.trim(),_=c.value.trim(),x=g&&!f&&w,$=`${w} ${m} ${y}`,k={left:[],top:[],right:[],bottom:[],middle:[],all:null};if(e){const t=i.style;this.#L.figureElement&&(this.#L.figureElement.style.float=v,this.#L.figureElement.style.verticalAlign=b),t.backgroundColor=C,t.color=_,this.#vh(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.#L.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 w=y+u-1===n;y===e&&k.top.push(t),(y===n||w)&&k.bottom.push(t),c===o&&k.left.push(t),c!==l&&c+d-1!==l||k.right.push(t),w||y===e||y===n||c===o||c===l||k.middle.push(t),i=t.style,i.textAlign=v,i.verticalAlign=b,i.backgroundColor=C,i.color=_,this.#vh(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.#bh(k,p,$),this.#za.historyPush(),this.controller_props.close(),this.#L.tdElement&&(this.#Fa.recallStyleSelectedCells(),this.#za.setCellInfo(this.#L.tdElement,!0),Ut.utils.addClass(this.#L.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()}#mh(t){this._typeCache=t;const e="table"===t,s=e?[this.#za._element]:this.#L.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:w,fontWeight:C,textDecoration:_,fontStyle:x}=fr.getComputedStyle(s[0]),$=this.#yh(f);h.querySelector('[data-value="justify"]').style.display=e?"none":"",d.style.display=e?"":"none",c.style.display=e?"none":"";let k=Wt.rgb2hex($.c),S=$.s,E=$.w,T=Wt.rgb2hex(v),M=Wt.rgb2hex(b),H=/.+/.test(C),L=/underline/i.test(_),N=/line-through/i.test(_),B=/italic/i.test(x),A=e?this.#L.figureElement?.style.float:y,I=w;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.#yh(n);let m=o,f=l;if(m||f){const e=fr.getComputedStyle(t);m&&(m=e.backgroundColor),f&&(f=e.color)}k&&$.c!==u&&(k=""),S&&$.s!==p&&(S=""),E&&$.w!==g&&(E=""),T!==Wt.rgb2hex(m)&&(T=""),M!==Wt.rgb2hex(f)&&(M=""),A!==(e?this.#L.figureElement?.style.float:r)&&(A=""),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),B&&B!==/italic/i.test(d)&&(B=!1),k&&S&&E&&T&&M||(i=!0)}i.firstElementChild.innerHTML=this.#X.icons[ql[1===s.length?"outside":"all"]],i.setAttribute("se-border-format","all"),Ut.utils.removeClass(i,"active"),S||=Dl[0],o.textContent=S,n.style.borderColor=n.value=k,l.value=E,this.#wh(S===Dl[0]),r.value=r.style.borderColor=T,a.value=a.style.borderColor=M,H&&Ut.utils.addClass(u,"on"),L&&Ut.utils.addClass(p,"on"),N&&Ut.utils.addClass(m,"on"),B&&Ut.utils.addClass(g,"on"),this.#fh(h,this._propsAlignCache=A,!0),this.#fh(c,this._propsVerticalAlignCache=I,!0)}#vh(t){const{font_bold:e,font_italic:s,font_strike:i,font_underline:n}=this.propTargets;t.fontWeight=Ut.utils.hasClass(e,"on")?"bold":"",t.fontStyle=Ut.utils.hasClass(s,"on")?"italic":"",t.textDecoration=((Ut.utils.hasClass(i,"on")?"line-through ":"")+(Ut.utils.hasClass(n,"on")?"underline":"")).trim()}#yh(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:Wt.rgb2hex(n)}}#bh(t,e,s){const{left:i,top:n,right:o,bottom:l,all:r}=t;switch(e){case"inside":if(1===r.length)return;Ut.utils.setStyle(r.filter((t=>!l.includes(t))),jl,s),Ut.utils.setStyle(r.filter((t=>!o.includes(t))),Gl,s);break;case"horizon":if(1===r.length)return;Ut.utils.setStyle(r.filter((t=>!l.includes(t))),jl,s);break;case"vertical":if(1===r.length)return;Ut.utils.setStyle(r.filter((t=>!o.includes(t))),Gl,s);break;case"outside":Ut.utils.setStyle(i,Ul,s),Ut.utils.setStyle(n,Zl,s),Ut.utils.setStyle(o,Gl,s),Ut.utils.setStyle(l,jl,s);break;case"left":Ut.utils.setStyle(i,Ul,s);break;case"top":Ut.utils.setStyle(n,Zl,s);break;case"right":Ut.utils.setStyle(o,Gl,s);break;case"bottom":Ut.utils.setStyle(l,jl,s)}}#wh(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)}#fh(t,e,s){Ut.utils.removeClass(t.querySelectorAll("button"),"on"),s||t.getAttribute("se-cell-align")!==e?(Ut.utils.addClass(t.querySelector(`[data-value="${e}"]`),"on"),t.setAttribute("se-cell-align",e)):t.setAttribute("se-cell-align","")}#ph(t){this.propTargets.border_style.textContent=t,this.#wh(t===Dl[0]),this.selectMenu_props_border.close()}#gh(t,e){const{border_format:s}=this.propTargets;s.setAttribute("se-border-format",e),s.firstElementChild.innerHTML=this.#X.icons[ql[e]],e!==t?Ut.utils.addClass(s,"active"):Ut.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;Ut.utils.removeClass([t,e,s,i,n,o,l,r,a,h,c,d],"on")}},{_w:br,ON_OVER_COMPONENT:yr}=Dt;class wr extends nl{static key="table";static className="";static options={isInputComponent:!0};static component(t){return Ut.check.isTable(t)?t:null}#Ch;#_h;#xh;#$h;#kh;#Sh=[];#Eh=!0;#Th=!1;#Mh=!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=Ut.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 Ut.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=Ut.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(Ut.utils.createElement("DIV",{class:Rl.replace(/^\./,"")})),t.get("wrapper").appendChild(Ut.utils.createElement("DIV",{class:zl.replace(/^\./,"")})),t.get("wrapper").appendChild(Ut.utils.createElement("DIV",{class:Fl.replace(/^\./,"")})),t.get("wrapper").appendChild(Ut.utils.createElement("DIV",{class:Pl.replace(/^\./,"")}))})),this.cellControllerTop?(this.controller_cell=new Ms(this,this.$,o.html,{position:"top"}),this.controller_table=new Ms(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 Ms(this,this.$,n,{position:"top"}),this.controller_cell=new Ms(this,this.$,o.html,{position:"bottom"})),this.figure=new qs(this,this.$,null,{}),this._element=null,this.state=Yl,this.#Ch=s,this.#_h=s.querySelector(".se-table-size-highlighted"),this.#xh=s.querySelector(".se-table-size-unhighlighted"),this.#$h=s.querySelector(".se-table-size-display");const l=Cr.bind(this,!0),r=Cr.bind(this,!1),a={...o,openCellMenuFunc:l,closeCellMenuFunc:r};this.cellService=new cr(this,a),this.clipboardService=new dr(this),this.gridService=new ur(this,a),this.resizeService=new gr(this),this.selectionService=new mr(this),this.styleService=new vr(this,{pluginOptions:e,controller_table:n}),this.$.menu.initDropdownTarget(wr,s),this.$.eventManager.addEvent(i,"mousemove",this.#Hh.bind(this)),this.$.eventManager.addEvent(i,"click",this.#Lh.bind(this))}setState(t,e){this.state[t]=e}#Nh(){Object.assign(this.state,Yl)}off(){this.#Bh()}componentSelect(t){if(this.#Ah(t),this.state.figureElement||this.setTableInfo(t),this.#Eh="100%"===this.state.figureElement?.style.width,this.#Th=Ut.utils.hasClass(t,"se-table-layout-fixed")||"fixed"===t.style.tableLayout,this.styleService.setTableLayout(this.#Eh?"width|column":"width",this.#Eh,this.#Th,!0),ws.get("__overInfo")===yr)return;if(!this.state.tdElement)return;this.setCellInfo(this.state.tdElement,!0);const e=this.state.selectedCells?.length>1,s=Ut.query.getParentElement(t,Ut.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;Ut.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");Ut.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=Ut.query.getParentElement(Ut.query.getEventTarget(t),Ut.check.isTableCell);if(!s)return;const i=e.body;if(1!==i.childElementCount)return;const n=this.$.component.get(i.firstElementChild);if(n.pluginName!==wr.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",Ut.query.getParentElement(r,"TABLE")),!1}retainFormat(){return{query:"table",method:t=>{const e=t.querySelector("colgroup");let s=Ut.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=Ut.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++)Ut.utils.setStyle(s[t],"width","")}}s?Ut.utils.addClass(s,"se-flex-component|se-input-component"):(s=Ut.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,Ut.utils.setStyle(t,"width","")),this.figureScroll){const t=`se-scroll-figure-${this.figureScroll}`;Ut.utils.addClass(s,t),Ut.utils.removeClass(s,this.figureScrollList.filter((e=>e!==t)).join("|"))}else Ut.utils.removeClass(s,this.figureScrollList.join("|"))}}}setDir(){this.#Bh(),this.styleService.resetPropsAlign()}onMouseMove({event:t}){if(this.resizeService.isResizing())return;const e=Ut.query.getEventTarget(t),s=Ut.query.getParentElement(e,tr);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=Ut.query.getEventTarget(t);if(this._element&&Ut.query.getParentElement(e,er))return void this._closeController();const s=Ut.query.getParentElement(e,tr);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.#Mh=!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=Gt.isTab(i);if(this.$.ui.selectMenuOn||this.resizeService.isResizing()||!n&&this.#Mh||Gt.isCtrl(t))return;if(this.cellControllerTop||this.controller_cell.hide(),this.#Mh=Gt.isShift(t),n){this.selectionService.deleteStyleSelectedCells();const i=Ut.query.getParentElement(s,Ut.check.isTableCell);if(i&&e.collapsed&&Ut.check.isEdgePoint(e.startContainer,e.startOffset)){this._closeController();const e=this.#Mh;this.setState("isShiftPressed",this.#Mh=!1);const s=Ut.query.getParentElement(i,"table"),n=Ut.query.getListChildren(s,Ut.check.isTableCell,null),o=e?Ut.utils.prevIndex(n,i):Ut.utils.nextIndex(n,i);if(o===n.length&&!e){if(!Ut.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(!Gt.isShift(t)){if(o=Ut.query.getParentElement(s,Ut.check.isTableCell),!Ut.utils.hasClass(o,"se-selected-cell-focus"))return;return this.selectionService.deleteStyleSelectedCells(),this._editorEnable(!0),this.#Ih(),void this._closeController()}return this.state.isShiftPressed||this.state.ref?void 0:(o||=Ut.query.getParentElement(s,Ut.check.isTableCell),o?(this.#Mh=t.shiftKey,this.setState("fixedCell",o),this._closeController(),this.selectionService.startCellSelection(o,this.#Mh),!1):void 0)}onKeyUp({line:t}){this.#Mh=!1,this.state.isShiftPressed&&Ut.query.getParentElement(t,Ut.check.isTableCell)===this.state.fixedCell&&(this.selectionService.deleteStyleSelectedCells(),this._editorEnable(!0),this.#Ih()),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.#Eh=!this.#Eh,this.styleService.setTableLayout("width",this.#Eh,this.#Th,!1),this.historyPush(),br.setTimeout((()=>{this.$.component.select(this._element,wr.key,{isInput:!0})}),0);break;case"layout":this.#Th=!this.#Th,this.styleService.setTableLayout("column",this.#Eh,this.#Th,!1),this.historyPush(),br.setTimeout((()=>{this.$.component.select(this._element,wr.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=lr(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=Ut.query.getParentElement(t,"TABLE");return this.setState("selectedTable",e),this.setState("figureElement",Ut.query.getParentElement(e,Ut.check.isFigure)||e),e}resetInfo(){this.#Ih(),this.selectionService.deleteStyleSelectedCells(),this._editorEnable(!0),this._element=null,this.#Nh(),this.#Sh=[],this.#Eh=!1,this.#Th=!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&&Ut.utils.addClass(t,"se-selected-cell-focus"),this.state.selectedCells?.length||this.setState("selectedCells",[t]);const e=this.state.selectedTable||this._element||Ut.query.getParentElement(t,"TABLE");this.$.component.select(e,wr.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?Ut.utils.removeClass(e,"se-disabled"):Ut.utils.addClass(e,"se-disabled")}_closeController(){this.controller_table.close(!0),this.controller_cell.close(!0)}_closeTableSelectInfo(){this.$.component.deselect(),this._closeController()}#Ah(t){this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,infoOnly:!1})}#Bh(){if(!this.#_h)return;const t=this.#_h.style,e=this.#xh.style;t.width="1em",t.height="1em",e.width="5em",e.height="5em",Ut.utils.changeTxt(this.#$h,"1 x 1")}#Hh(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.#_h.style.width=e+"em",this.#_h.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.#xh.style.width=n+"em",this.#xh.style.height=o+"em",i){const t=n-(this.#kh||5);if(0!==t){const e=Zt.get(this.#Ch.style.left);this.#Ch.style.left=e-18*t+"px",this.#kh=n}}Ut.utils.changeTxt(this.#$h,e+" x "+s),this.#Sh=[e,s]}#Lh(){const t=Ut.utils.createElement("TABLE"),e=this.#Sh[0],s=this.#Sh[1],i=`<tbody>${`<tr>${nr("td",e)}</tr>`.repeat(s)}</tbody>`,n=`<colgroup>${`<col style="width: ${Zt.get(100/e,0)}%;">`.repeat(e)}</colgroup>`;t.innerHTML=n+i;let o="";this.figureScroll&&(o=` se-scroll-figure-${this.figureScroll}`);const l=Ut.utils.createElement("FIGURE",{class:"se-flex-component se-input-component"+o,style:"width: 100%;"});if(l.appendChild(t),this.#Eh=!0,this.$.component.insert(l,{insertBehavior:"none"})){this.#Bh(),this.$.menu.dropdownOff();const e=t.querySelector("td div");this.$.selection.setRange(e,0,e,0)}}#Ih(){this.resizeService.init(),this.selectionService.init(),this.styleService.init()}}function Cr(t){this.controller_cell.bringToTop(t)}const _r=wr;class xr extends il{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=function({lang:t},e){const s=["p","blockquote","h1","h2","h3","h4","h5","h6"],i=e&&0!==e.length?e:s;let n='\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">';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+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${l}" data-value="${o}" data-class="${c}" title="${r}" aria-label="${r}">\n\t\t\t\t\t<${o}${h}>${r}</${o}>\n\t\t\t\t</button>\n\t\t\t</li>`}return n+="\n\t\t</ul>\n\t</div>",Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(this.$,e.items);this.formatList=s.querySelectorAll("li button"),this.currentFormat="",this.$.menu.initDropdownTarget(xr,s)}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 Ut.utils.changeTxt(i,s),i.setAttribute("data-value",n),i.setAttribute("data-class",o),!0}}else Ut.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")?Ut.utils.addClass(t,"active"):Ut.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=Ut.utils.createElement(`H${e}`);this.$.format.setLine(s)}}const $r=xr;class kr extends il{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;const s=function(t){t&&0!==t.length||console.warn('[SUNEDITOR.plugins.layout.warn] To use the "layout" plugin, please define the "layouts" option.');let e='\n\t<div class="se-dropdown se-list-inner">\n\t\t<ul class="se-list-basic">';for(let s,i=0,n=(t||[]).length;i<n;i++)s=t[i],e+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-value="${i}" title="${s.name}" aria-label="${s.name}">\n\t\t\t\t\t${s.name}\n\t\t\t\t</button>\n\t\t\t</li>`;return e+="\n\t\t</ul>\n\t</div>",Ut.utils.createElement("DIV",{class:"se-list-layer"},e)}(this.items);this.$.menu.initDropdownTarget(kr,s)}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 Sr=kr;class Er extends il{static key="lineHeight";static className="";#Oa;constructor(t,e){super(t),this.title=this.$.lang.lineHeight,this.icon="line_height";const s=function({lang:t},e){const s=e||[{text:"1",value:"1em"},{text:"1.2",value:"1.2em"},{text:"1.7",value:"1.7em"},{text:"2",value:"2em"}];let i=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list default_value" data-command="" title="${t.default}" aria-label="${t.default}">\n\t\t\t\t\t${t.default}\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t\t<li class="se-btn-list se-sub-list"><span></span></li>`;for(let t,e=0,n=s.length;e<n;e++)t=s[e],i+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${t.value}" title="${t.text}" aria-label="${t.text}">\n\t\t\t\t\t${t.text}\n\t\t\t\t</button>\n\t\t\t</li>`;return i+="\n\t\t</ul>\n\t</div>",Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},i)}(this.$,e.items);this.sizeList=s.querySelectorAll("li button"),this.currentSize=null,this.#Oa=s.querySelector(".se-sub-list span"),this.$.menu.initDropdownTarget(Er,s)}active(t,e){return this.$.format.isLine(t)&&t.style.lineHeight.length>0?(Ut.utils.addClass(e,"active"),!0):(Ut.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")?(Ut.utils.addClass(s[i],"active"),t=!0):Ut.utils.removeClass(s[i],"active");this.currentSize=e,t?this.#Oa.style.display="none":(this.#Oa.textContent=e,this.#Oa.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 Tr=Er;class Mr extends il{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;const s=function(t){t&&0!==t.length||console.warn('[SUNEDITOR.plugins.template.warn] To use the "template" plugin, please define the "templates" option.');let e='<div class="se-dropdown se-list-inner"><ul class="se-list-basic">';for(let s,i=0,n=(t||[]).length;i<n;i++)s=t[i],e+=`\n\t\t<li>\n\t\t\t<button \n\t\t\t\ttype="button" \n\t\t\t\tclass="se-btn se-btn-list" \n\t\t\t\tdata-value="${i}" \n\t\t\t\ttitle="${s.name}" \n\t\t\t\taria-label="${s.name}"\n\t\t\t>\n\t\t\t\t${s.name}\n\t\t\t</button>\n\t\t</li>`;return e+="</ul></div>",Ut.utils.createElement("DIV",{class:"se-list-layer"},e)}(this.items);this.$.menu.initDropdownTarget(Mr,s)}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 Hr=Mr;class Lr extends il{static key="paragraphStyle";static className="";constructor(t,e){super(t),this.title=this.$.lang.paragraphStyle,this.icon="paragraph_style";const s=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"];let n='\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">';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}e=t.name,o=t.class?` class="${t.class}"`:"",l=t._class,n+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list${l?" "+l:""}" data-command="${t.class}" title="${e}" aria-label="${e}">\n\t\t\t\t\t<div${o}>${e}</div>\n\t\t\t\t</button>\n\t\t\t</li>`}return n+="\n\t\t</ul>\n\t</div>",Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(this.$,e.items);this.classList=s.querySelectorAll("li button"),this.$.menu.initDropdownTarget(Lr,s)}on(){const t=this.classList,e=this.$.format.getLine(this.$.selection.getNode());for(let s=0,i=t.length;s<i;s++)Ut.utils.hasClass(e,t[s].getAttribute("data-command"))?Ut.utils.addClass(t[s],"active"):Ut.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++)Ut.utils.toggleClass(s[t],e);this.$.menu.dropdownOff(),this.$.history.push(!1)}}}const Nr=Lr;class Br extends il{static key="textStyle";static className="";constructor(t,e){super(t),this.title=this.$.lang.textStyle,this.icon="text_style";const s=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);let n='<div class="se-list-inner"><ul class="se-list-basic">';for(let t,e,o,l,r,a,h=0,c=i.length;h<c;h++){if(t=i[h],l="",a="",r=[],"string"==typeof t){const e=s[t.toLowerCase()];if(!e)continue;t=e}o=t.name,e=t.tag||"span",l+=` class="${t.class}"`,a+=`.${t.class.trim().replace(/\s+/g,",.")}`,r.push("class"),a=a.replace(/,$/,""),n+=`\n\t\t<li>\n\t\t\t<button \n\t\t\t\ttype="button" \n\t\t\t\tclass="se-btn se-btn-list" \n\t\t\t\tdata-command="${e}" \n\t\t\t\tdata-value="${a}" \n\t\t\t\ttitle="${o}" \n\t\t\t\taria-label="${o}"\n\t\t\t>\n\t\t\t\t<${e}${l}>${o}</${e}>\n\t\t\t</button>\n\t\t</li>`}return n+="</ul></div>",Ut.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(this.$,e.items);this.styleList=s.querySelectorAll("li button"),this.$.menu.initDropdownTarget(Br,s)}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)?Ut.utils.hasClass(t,o.replace(/^\./,"")):t.style[o])){n=!0;break}t=t.parentNode}if(!n)break}n?Ut.utils.addClass(s,"active"):Ut.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=Ut.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 Ar=Br;const Ir=class extends rl{static key="link";static className="se-icon-flip-rtl";#Vh;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 Ut.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 Ut.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:Zt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Zt.get(e.uploadSingleSizeLimit,0),acceptedFormats:"string"==typeof e.acceptedFormats?e.acceptedFormats.trim():null,enableFileUpload:!!n},this.anchor=new Jo(this.$,s,this.pluginOptions),this.modal=new Go(this,this.$,s),this.controller=new Ms(this,this.$,i,{position:"bottom",disabled:!1}),this.#Vh=this.controller.form.querySelector("a")}active(t){if(Ut.check.isAnchor(t)&&!t.hasAttribute("data-se-non-link")){const e=this.#Vh,s=t.getAttribute("href");return e.href=s,e.textContent=e.title=t.textContent,e.target=s?.startsWith("#")?t.target:"_blank",Ut.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(Ut.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=Ut.query.getEdgeChild(this.controller.currentTarget,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!1),e=Ut.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 Ut.utils.removeItem(this.controller.currentTarget),this.controller.currentTarget=null,this.$.focusManager.focus(),this.$.history.push(!1)}controllerClose(){Ut.utils.removeClass(this.controller.currentTarget,"on")}},Vr="%",Or="px",Rr={BLOCK:"block",INLINE:"inline"},zr="image/*";const Fr=class{#za;#X;#L;#Oh;#Ua;#Rh;#zh;#Fh={w:0,h:0};#Ph=null;#Dh=null;#qh=null;constructor(t,e){if(this.#za=t,this.#X=t.$,this.#L=t.state,this.#Oh=t.pluginOptions,this.#Ua=this.#Oh.canResize,this.#Rh="auto"===this.#Oh.defaultWidth?"":this.#Oh.defaultWidth,this.#zh="auto"===this.#Oh.defaultHeight?"":this.#Oh.defaultHeight,this.#Ua){this.#Ph=e.proportion,this.#Dh=e.inputX,this.#qh=e.inputY,this.#Dh.value=this.#Oh.defaultWidth,this.#qh.value=this.#Oh.defaultHeight;const t=this.#Wh.bind(this);this.#X.eventManager.addEvent(this.#Dh,"keyup",this.#Uh.bind(this,"x")),this.#X.eventManager.addEvent(this.#qh,"keyup",this.#Uh.bind(this,"y")),this.#X.eventManager.addEvent(this.#Dh,"change",t),this.#X.eventManager.addEvent(this.#qh,"change",t),this.#X.eventManager.addEvent(this.#Ph,"change",t),this.#X.eventManager.addEvent(e.revertBtn,"click",this.#Zh.bind(this))}}setInputSize(t,e){this.#Dh.value="auto"===t?"":t,this.#L.onlyPercentage||(this.#qh.value="auto"===e?"":e)}getInputSize(){return{w:this.#Dh?.value||"",h:this.#qh?.value||""}}setOriginSize(t,e){this.#Rh=t,this.#zh=e}applySize(t,e){t||=this.#Dh?.value||this.#Oh.defaultWidth,e||=this.#qh?.value||this.#Oh.defaultHeight,this.#L.onlyPercentage&&(t?/%$/.test(t)||(t+=Vr):t="100%"),this.#za.figure.setSize(t,e)}on(){if(!this.#Ua)return;const t=this.#Oh.defaultWidth,e=this.#Oh.defaultHeight;this.setInputSize(t,e),this.setOriginSize(t,e)}ready(t,e,s){this.setInputSize(e,s);const i=this.#L.onlyPercentage&&this.#za.figure.isVertical;this.#Ph.checked=!0,this.#Dh.disabled=i,this.#qh.disabled=i,this.#Ph.disabled=i,this.#Fh=this.#Ph.checked?t.ratio:{w:0,h:0}}init(){this.#Fh={w:0,h:0},this.#Ua&&(this.setInputSize(this.#Oh.defaultWidth,this.#Oh.defaultHeight),this.#Ph.checked=!0)}#Uh(t,e){if(Gt.isSpace(e.code))return void e.preventDefault();const s=e.target;if("x"===t&&this.#L.onlyPercentage&&Number(s.value)>100)s.value="100";else if(this.#Ph.checked){const e=qs.CalcRatio(this.#Dh.value,this.#qh.value,this.#L.sizeUnit,this.#Fh);"x"===t?this.#qh.value=String(e.h):this.#Dh.value=String(e.w)}}#Wh(){this.#Fh=this.#Ph.checked?qs.GetRatio(this.#Dh.value,this.#qh.value,this.#L.sizeUnit):{w:0,h:0}}#Zh(){this.#L.onlyPercentage?this.#Dh.value=Number(this.#Rh)>100?"100":this.#Rh:(this.#Dh.value=this.#Rh,this.#qh.value=this.#zh)}},{NO_EVENT:Pr}=Dt;const Dr=class{#za;#X;#Oh;#Ua;constructor(t){this.#za=t,this.#X=t.$,this.#Oh=t.pluginOptions,this.#Ua=this.#Oh.canResize,this._base64RenderIndex=0}get#Gh(){return this.#za.sizeService}serverUpload(t){if(!t.files)return;const e=this.#Oh.uploadUrl;"string"==typeof e&&e.length>0?this.#za.fileManager.upload(e,this.#Oh.uploadHeaders,t.files,this.#jh.bind(this,t),this.#na.bind(this)):this.#Kh(t)}urlUpload(t){this.#za.setState("produceIndex",0);const e=t.url;this.#za.modal.isUpdate?this.#Yh(e,t.element,t.files):this.#Xh(e,t.anchor,t.inputWidth,t.inputHeight,t.align,t.files,t.alt,!0)}#Xh(t,e,s,i,n,o,l,r){this.#za.as!==Rr.INLINE?this.#za.create(t,e,s,i,n,o,l,r):this.#za.createInline(t,e,s,i,o,l,r)}#Yh(t,e,s){e.src=t,this.#za.fileManager.setFileData(e,s),this.#X.component.select(e,this.#za.constructor.key)}#ia(t,e){this.#za.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.#Yh(s[i].url,t.element,e);break}this.#Xh(s[i].url,t.anchor,t.inputWidth,t.inputHeight,t.align,e,t.alt,i===n-1)}}#Kh(t){try{const{files:e,element:s,anchor:i,inputWidth:n,inputHeight:o,align:l,alt:r,isUpdate:a}=t,h=this.#za.modal.isUpdate?1:e.length;if(0===h)return this.#X.ui.hideLoading(),void console.warn("[SUNEDITOR.image.base64.fail] cause : No applicable files");this._base64RenderIndex=h;const c=new Array(h);this.#Ua&&this.#Gh.setInputSize(n,o);for(let t,d,u=0,p=this.#Jh.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.#X.ui.hideLoading())}.bind(this,p,t,a,s,d,u),t.readAsDataURL(d)}catch(t){throw this.#X.ui.hideLoading(),Error(`[SUNEDITOR.plugins.image._setBase64.fail] ${t.message}`)}}#Jh(t,e,s,i,n,o,l,r){this.#za.setState("produceIndex",0);for(let a=0,h=e.length;a<h;a++)t?this.#Yh(e[a].result,s,e[a].file):this.#Xh(e[a].result,i,n,o,l,e[a].file,r,a===h-1)}async#na(t){const e=await this.#X.eventManager.triggerEvent("onImageUploadError",{error:t}),s=e===Pr?t.errorMessage:e||t.errorMessage;this.#X.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.image.error]",s)}async#jh(t,e){if(await this.#X.eventManager.triggerEvent("imageUploadHandler",{xmlHttp:e,info:t})===Pr){const s=JSON.parse(e.responseText);s.errorMessage?this.#na(s):this.#ia(t,s)}}},{NO_EVENT:qr}=Dt;const Wr=class extends rl{static key="image";static className="";static component(t){const e=Ut.check.isFigure(t)||/^span$/i.test(t.nodeName)&&Ut.check.isComponentContainer(t)?t.firstElementChild:t;return/^IMG$/i.test(e?.nodeName)?e:Ut.check.isAnchor(e)&&/^IMG$/i.test(e?.firstElementChild?.nodeName)?e?.firstElementChild:null}#Ua;#Qh;#tc=null;#ec="";#sc="none";#ic="30%";#Ta=null;#nc=null;#oc=null;#lc=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?Zt.is(e.defaultWidth)?e.defaultWidth+Or:e.defaultWidth:"auto",defaultHeight:e.defaultHeight?Zt.is(e.defaultHeight)?e.defaultHeight+Or: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:Zt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Zt.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?zr:e.acceptedFormats.trim()||zr,useFormatType:e.useFormatType??!0,defaultFormatType:[Rr.BLOCK,Rr.INLINE].includes(e.defaultFormatType)?e.defaultFormatType:Rr.BLOCK,keepFormatType:e.keepFormatType??!1,insertBehavior:e.insertBehavior};const s=this.pluginOptions.percentageOnlySize?Vr:Or,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${Go.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${Ut.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${Ut.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${Ut.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${Ut.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=Ut.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 Jo(this.$,i.html,{...l,textToDisplay:!1,title:!0}),this.modal=new Go(this,this.$,i.html),this.figure=new qs(this,this.$,o,{sizeUnit:s}),this.fileManager=new Ko(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=Rr.BLOCK,this.#Ua=this.pluginOptions.canResize,this.#Qh=!this.#Ua||!this.pluginOptions.showHeightInput||this.pluginOptions.percentageOnlySize,this.sizeService=new Fr(this,i),this.uploadService=new Dr(this),this.$.eventManager.addEvent(i.tabs,"click",this.#rc.bind(this)),this.imgInputFile&&this.$.eventManager.addEvent(i.fileRemoveBtn,"click",this.#ac.bind(this)),this.imgUrlFile&&this.$.eventManager.addEvent(this.imgUrlFile,"input",this.#hc.bind(this)),this.imgInputFile&&this.imgUrlFile&&this.$.eventManager.addEvent(this.imgInputFile,"change",this.#cc.bind(this));const r=i.galleryButton;r&&this.$.eventManager.addEvent(r,"click",this.#dc.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.#uc.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=qs.GetContainer(t);if(e&&e.container&&(e.cover||e.inlineCover))return;const{w:s,h:i}=this.#pc(t,!0);this.#gc(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.#sc=this.modal.form.querySelector('input[name="suneditor_image_radio"]:checked').value,this.modal.isUpdate&&(this.#mc(),this.$.history.push(!1)),this.imgInputFile&&this.imgInputFile.files.length>0?await this.submitFile(this.imgInputFile.files):!!(this.imgUrlFile&&this.#ec.length>0)&&await this.submitURL(this.#ec)}modalInit(){Go.OnChangeFile(this.fileModalWrapper,[]),this.imgInputFile&&(this.imgInputFile.value=""),this.imgUrlFile&&(this.#ec=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.#Ta=null,this.#rc("init"),this.sizeService.init(),this.pluginOptions.useFormatType&&this.#fc((this.pluginOptions.keepFormatType?this.as:this.pluginOptions.defaultFormatType)===Rr.INLINE),this.anchor.init()}componentSelect(t){this.#pc(t)}componentEdit(){this.modal.open()}async componentDestroy(t){const e=t||this.#Ta,s=Ut.query.getParentElement(e,qs.is)||e,i=s.previousElementSibling||s.nextElementSibling,n=s.parentNode;!1!==await this.$.eventManager.triggerEvent("onImageDeleteBefore",{element:e,container:s,align:this.#sc,alt:this.altText.value,url:this.#ec})&&(Ut.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===qr?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===qr?t:s||t,"error"),!1}const l={files:s,...this.#vc()},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!==qr||r(null)))}async submitURL(t){if(!(t||=this.#ec))return!1;const e={name:t.split("/").pop(),size:0},s={url:t,files:e,...this.#vc()},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!==qr||i(null),!0)}create(t,e,s,i,n,o,l,r){const a=Ut.utils.createElement("IMG");a.src=t,a.alt=l,e=this.#bc(a,e?e.cloneNode(!1):null);const h=qs.CreateContainer(e,"se-image-container"),c=h.cover,d=h.container;this.captionCheckEl.checked&&(this.#lc=qs.CreateCaption(c,this.$.lang.caption)),this.#Ta=a,this.#nc=c,this.#oc=d,this.figure.open(a,{nonResizing:this.#Qh,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.#yc.bind(this,a,this.#ic,d),this.$.component.insert(d,{scrollTo:!!r,insertBehavior:r?null:"line"})}createInline(t,e,s,i,n,o,l){const r=Ut.utils.createElement("IMG");r.src=t,r.alt=o,e=this.#bc(r,e?e.cloneNode(!1):null);const a=qs.CreateInlineContainer(e,"se-image-container").container;this.#Ta=r,this.#oc=a,this.figure.open(r,{nonResizing:this.#Qh,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.#yc.bind(this,r,this.#ic,a),this.$.component.insert(a,{scrollTo:!!l,insertBehavior:l?null:"line"})}#pc(t,e=!1){if(!t)return;const s=this.figure.open(t,{nonResizing:this.#Qh,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:e});this.anchor.set(Ut.check.isAnchor(t.parentNode)?t.parentNode:null),this.#tc=this.anchor.currentTarget,this.#Ta=t,this.#nc=s.cover,this.#oc=s.container,this.#lc=s.caption,this.#sc=s.align,t.style.float="",this.sizeService.setOriginSize(String(s.originWidth||s.w||""),String(s.originHeight||s.h||"")),this.altText.value=this.#Ta.alt,this.imgUrlFile&&(this.#ec=this.previewSrc.textContent=this.imgUrlFile.value=this.#Ta.src);(this.modal.form.querySelector('input[name="suneditor_image_radio"][value="'+this.#sc+'"]')||this.modal.form.querySelector('input[name="suneditor_image_radio"][value="none"]')).checked=!0,this.captionCheckEl.checked=!!this.#lc;const{dw:i,dh:n}=this.figure.getSize(t);return this.#Ua?(this.sizeService.ready(s,i,n),this.pluginOptions.useFormatType&&this.#fc(this.$.component.isInline(s.container)),{w:i,h:n}):{w:i,h:n}}#vc(){const{w:t,h:e}=this.sizeService.getInputSize();return{element:this.#Ta,anchor:this.anchor.create(!0),inputWidth:t,inputHeight:e,align:this.#sc,isUpdate:this.modal.isUpdate,alt:this.altText.value}}#fc(t){t?(Ut.utils.addClass(this.asInline,"on"),Ut.utils.removeClass(this.asBlock,"on"),this.as=Rr.INLINE,this.alignForm&&(this.alignForm.style.display="none"),this.captionEl&&(this.captionEl.style.display="none")):(Ut.utils.addClass(this.asBlock,"on"),Ut.utils.removeClass(this.asInline,"on"),this.as=Rr.BLOCK,this.alignForm&&(this.alignForm.style.display=""),this.captionEl&&(this.captionEl.style.display=""))}#mc(){const{w:t,h:e}=this.sizeService.getInputSize(),s=t||"auto",i=e||"auto";let n=this.#Ta;(this.as===Rr.BLOCK&&!this.#nc||this.as===Rr.INLINE&&this.#nc)&&(n=this.figure.convertAsFormat(n,this.as));const o=this.#nc,l=this.#oc===this.#nc?null:this.#oc;let r;const a=Zt.is(s)?s+this.state.sizeUnit:s,h=Zt.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.#lc||(this.#lc=qs.CreateCaption(o,this.$.lang.caption),c=!0):this.#lc&&(Ut.utils.removeItem(this.#lc),this.#lc=null,c=!0);let d=!1;const u=this.anchor.create(!0);if(u)this.#tc===u&&l.contains(u)||(this.#tc=u.cloneNode(!1),o.insertBefore(this.#bc(n,this.#tc),this.#lc),d=!0);else if(null!==this.#tc&&o.contains(this.#tc)){const t=n.cloneNode(!0);o.removeChild(this.#tc),o.insertBefore(t,this.#lc),n=t}d&&Ut.utils.removeItem(u),this.#Ua&&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.#Ua&&r&&this.figure.isVertical||this.figure.setTransform(n,s,i,0)),this.figure.setAlign(n,this.#sc),n.onload=()=>{this.componentSelect(n)}}#gc(t,e){const{w:s,h:i}=this.sizeService.getInputSize();t||=s||"auto",e||=i||"auto";let n=this.#Ta,o=this.#nc,l=null,r=this.#oc===this.#nc?null:this.#oc,a=!1;if(!o||!r){a=!0,n=this.#Ta.cloneNode(!0);const e=this.pluginOptions.useFormatType&&"auto"!==t&&(/^span$/i.test(this.#Ta.parentElement?.nodeName)||this.$.format.isLine(this.#Ta.parentElement))?qs.CreateInlineContainer(n,"se-image-container"):qs.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.#lc&&!a||(this.#lc=qs.CreateCaption(o,this.$.lang.caption),h=!0):this.#lc&&(Ut.utils.removeItem(this.#lc),this.#lc=null,h=!0));let c=null;const d=this.anchor.create(!0);if(d)(this.#tc!==d||a&&!r.contains(d))&&(this.#tc=d.cloneNode(!1),o.insertBefore(this.#bc(n,this.#tc),this.#lc),c=this.#Ta);else if(null!==this.#tc&&o.contains(this.#tc)){const t=n.cloneNode(!0);o.removeChild(this.#tc),o.insertBefore(t,this.#lc),n=t}a&&(n=this.#Ta,this.figure.retainFigureFormat(r,this.#Ta,c?d:null,this.fileManager),this.#Ta=n=r.querySelector("img"),this.#nc=o,this.#oc=r),n.style.width="",n.style.height="",n.removeAttribute("width"),n.removeAttribute("height"),this.sizeService.applySize(t,e),c&&(a?(Ut.utils.removeItem(c),0===Ut.query.getListChildren(d,(t=>/IMG/i.test(t.tagName)),null).length&&Ut.utils.removeItem(d)):Ut.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.#sc)}#bc(t,e){return e?(e.appendChild(t),e):t}#rc(t){const e=this.modal.form,s="string"==typeof t?e.querySelector("._se_tab_link"):Ut.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++)Ut.utils.removeClass(l[n],"active");return e.querySelector("._se_tab_content_"+i).style.display="block",Ut.utils.addClass(s,"active"),"init"!==t&&("image"===i?this.focusElement.focus():"url"===i&&this.anchor.urlInput.focus()),!1}#ac(){this.imgInputFile.value="",this.imgUrlFile&&(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),Go.OnChangeFile(this.fileModalWrapper,[])}#uc({target:t}){this.#fc("asInline"===t.getAttribute("data-command"))}#hc(t){const e=t.target.value.trim();this.#ec=this.previewSrc.textContent=e?this.$.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.$.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#cc({target:t}){this.imgInputFile.value?(this.imgUrlFile.disabled=!0,this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),Go.OnChangeFile(this.fileModalWrapper,t.files)}#dc(){this.$.plugins.imageGallery.open(this.#wc.bind(this))}#wc(t){this.altText.value=t.getAttribute("data-value")||t.alt,this.#ec=this.previewSrc.textContent=this.imgUrlFile.value=t.getAttribute("data-command")||t.src,this.imgUrlFile.focus()}#yc(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 Ur=class{#za;#X;#L;#Oh;#Ua;#Cc;#_c;#xc;#Rh;#zh;#Fh={w:0,h:0};#Ph=null;#Dh=null;#qh=null;#$c=null;constructor(t,e){if(this.#za=t,this.#X=t.$,this.#L=t.state,this.#Oh=t.pluginOptions,this.#Ua=this.#Oh.canResize,this.#Cc=this.#L.defaultRatio,this.#_c="100%",this.#xc=100*this.#Oh.defaultRatio+"%",this.#Rh="100%"===this.#Oh.defaultWidth?"":this.#Oh.defaultWidth,this.#zh=this.#Oh.defaultHeight===this.#L.defaultRatio?"":this.#Oh.defaultHeight,this.#Ua){this.#Ph=e.proportion,this.frameRatioOption=e.frameRatioOption,this.#Dh=e.inputX,this.#qh=e.inputY,this.#Dh.value=this.#Oh.defaultWidth,this.#qh.value=this.#Oh.defaultHeight;const t=this.#Wh.bind(this);this.#X.eventManager.addEvent(this.#Dh,"keyup",this.#Uh.bind(this,"x")),this.#X.eventManager.addEvent(this.#qh,"keyup",this.#Uh.bind(this,"y")),this.#X.eventManager.addEvent(this.#Dh,"change",t),this.#X.eventManager.addEvent(this.#qh,"change",t),this.#X.eventManager.addEvent(this.#Ph,"change",t),this.#X.eventManager.addEvent(this.frameRatioOption,"change",this.#kc.bind(this)),this.#X.eventManager.addEvent(e.revertBtn,"click",this.#Zh.bind(this))}}setInputSize(t,e){this.#Dh.value=t===this.#_c?"":t,this.#L.onlyPercentage||(this.#qh.value=e===this.#xc?"":e)}getInputSize(){return{w:this.#Dh?.value||"",h:this.#qh?.value||""}}setOriginSize(t,e){this.#Rh=t,this.#zh=e}applySize(t,e){t||=this.#Dh?.value||this.#Oh.defaultWidth,e||=this.#qh?.value||this.#Oh.defaultHeight,this.#L.onlyPercentage&&(t?/%$/.test(t+"")||(t+="%"):t="100%"),this.#za.figure.setSize(t,e)}resolveSize(t,e,s,i){t||=this.#_c,e||=this.#Cc;const n=this.#za.figure.getSize(s),o=n.w!==t||n.h!==e,l=!i||o;return l&&(this.#$c!==this.frameRatioOption?.value&&this.#za.figure.deleteTransform(),this.applySize(t,e)),{width:t,height:e,isChanged:l}}on(t){if(this.#Ua){if(!t){const t=this.#Oh.defaultWidth,e=this.#Oh.defaultHeight;this.setInputSize(t,e),this.setOriginSize(t,e),this.#Ph.disabled=!0}this.#Sc(this.#za.figure.isVertical?"":this.#zh||this.#L.defaultRatio),this.#$c=this.frameRatioOption?.value}}ready(t,e){const{dw:s,dh:i}=this.#za.figure.getSize(e);this.setInputSize(s,i);const n=t.height||t.h||this.#zh||"";this.#Sc(n)||(this.#qh.value=String(this.#L.onlyPercentage?Zt.get(n,2):n));const o=this.#L.onlyPercentage&&this.#za.figure.isVertical;this.#Dh.disabled=o,this.#qh.disabled=o,this.#Ph.checked=!t.isVertical,this.#Ph.disabled=o,this.#Fh=this.#Ph.checked?t.ratio:{w:0,h:0}}init(){this.#Fh={w:0,h:0},this.#Ua&&(this.setInputSize(this.#Oh.defaultWidth,this.#Oh.defaultHeight),this.#Ph.checked=!1,this.#Ph.disabled=!0,this.#Sc(this.#L.defaultRatio))}#Zh(){this.#L.onlyPercentage?this.#Dh.value=Number(this.#Rh)>100?"100":this.#Rh:(this.#Dh.value=this.#Rh,this.#qh.value=this.#zh)}#Sc(t){if(!this.frameRatioOption)return;let e=!1;const s=this.frameRatioOption.options;/%$/.test(t+"")||this.#L.onlyPercentage?t=Zt.get(t,2)/100+"":(!Zt.is(t)||Number(t)>=1)&&(t=""),this.#qh.placeholder="";for(let i=0,n=s.length;i<n;i++)s[i].value===t?(e=s[i].selected=!0,this.#qh.placeholder=t?100*Number(t)+"%":""):s[i].selected=!1;return e}#kc(t){const e=Ut.query.getEventTarget(t),s=e.options[e.selectedIndex].value;this.#xc=this.#za.figure.autoRatio.current=this.#Cc=s?100*Number(s)+"%":this.#xc,this.#qh.placeholder=s?100*Number(s)+"%":"",this.#qh.value=""}#Wh(){this.#Fh=this.#Ph.checked?qs.GetRatio(this.#Dh.value,this.#qh.value,this.#L.sizeUnit):{w:0,h:0}}#Uh(t,e){if(Gt.isSpace(e.code))return void e.preventDefault();const s=Ut.query.getEventTarget(e);if("x"===t&&this.#L.onlyPercentage&&Number(s.value)>100)s.value="100";else if(this.#Ph.checked&&!this.frameRatioOption?.value){const e=qs.CalcRatio(this.#Dh.value,this.#qh.value,this.#L.sizeUnit,this.#Fh);"x"===t?this.#qh.value=String(e.h):this.#Dh.value=String(e.w)}"y"===t&&this.#Sc(s.value||this.#L.defaultRatio)}},{NO_EVENT:Zr}=Dt;const Gr=class{#za;#X;#Oh;constructor(t){this.#za=t,this.#X=t.$,this.#Oh=t.pluginOptions}serverUpload(t,e){if(!e)return;const s=this.#Oh.uploadUrl;"string"==typeof s&&s.length>0&&this.#za.fileManager.upload(s,this.#Oh.uploadHeaders,e,this.#jh.bind(this,t),this.#na.bind(this))}#ia(t,e){const s=e.result,i=this.#za.createVideoTag();for(let e=0,n=s.length;e<n;e++){const o=t.isUpdate?t.element:i.cloneNode(!1);this.#za.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#na(t){const e=await this.#X.eventManager.triggerEvent("onVideoUploadError",{error:t}),s=e===Zr?t.errorMessage:e||t.errorMessage;this.#X.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.video.error]",e)}async#jh(t,e){if(await this.#X.eventManager.triggerEvent("videoUploadHandler",{xmlHttp:e,info:t})===Zr){const s=JSON.parse(e.responseText);s.errorMessage?this.#na(s):this.#ia(t,s)}}};const{_w:jr,NO_EVENT:Kr}=Dt;class Yr extends rl{static key="video";static className="";static component(t){return/^(VIDEO)$/i.test(t?.nodeName)||/^(IFRAME)$/i.test(t?.nodeName)&&this.#Ec(t.src)?t:null}static#Ec(t){return t=t?.toLowerCase()||"",!(!this.#Tc.some((e=>t.endsWith(e)))&&!this.#Mc.some((e=>e.test(t))))}static#Tc=[".mp4",".avi",".mov",".webm",".flv",".mkv",".m4v",".ogv"];static#Mc=[/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\//];#Ua;#Qh;#ec="";#sc="none";#Ta=null;#oc=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&&Zt.get(e.defaultWidth,0)?Zt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight&&Zt.get(e.defaultHeight,0)?Zt.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:Zt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Zt.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?"video/*":e.acceptedFormats.trim()||"video/*",defaultRatio:Zt.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${Go.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${Ut.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=Ut.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 Go(this,this.$,i.html),this.figure=new qs(this,this.$,n,{sizeUnit:s,autoRatio:{current:o,default:o}}),this.fileManager=new Ko(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.#Ua=this.pluginOptions.canResize,this.#Qh=!this.#Ua||!this.pluginOptions.showHeightInput||this.pluginOptions.percentageOnlySize,this.query={youtube:{pattern:/youtu\.?be/i,action:t=>(t=this.convertUrlYoutube(t),Wt.addUrlQuery(t,this.pluginOptions.query_youtube)),tag:"iframe"},vimeo:{pattern:/vimeo\.com/i,action:t=>(t=this.convertUrlVimeo(t),Wt.addUrlQuery(t,this.pluginOptions.query_vimeo)),tag:"iframe"},...e.embedQuery};const l=[];for(const t in this.query)l.push(this.query[t].pattern);Yr.#Tc=Yr.#Tc.concat(this.pluginOptions.extensions||[]),Yr.#Mc=Yr.#Mc.concat(e.urlPatterns||[]),this.state={onlyPercentage:this.pluginOptions.percentageOnlySize,sizeUnit:s,defaultRatio:100*this.pluginOptions.defaultRatio+"%"},this.sizeService=new Ur(this,i),this.uploadService=new Gr(this);const r=i.galleryButton;r&&this.$.eventManager.addEvent(r,"click",this.#dc.bind(this)),this.videoInputFile&&this.$.eventManager.addEvent(i.fileRemoveBtn,"click",this.#ac.bind(this)),this.videoUrlFile&&this.$.eventManager.addEvent(this.videoUrlFile,"input",this.#hc.bind(this)),this.videoInputFile&&this.videoUrlFile&&this.$.eventManager.addEvent(this.videoInputFile,"change",this.#cc.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)&&!Yr.#Ec(t.src))return;const e=qs.GetContainer(t);if(e&&e.container&&e.cover)return;this.#pc(t,!0);const s=this.$.format.getLine(t);s&&(this.#sc=s.style.textAlign||s.style.float),this.#mc(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.#sc=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.#ec.length>0&&(t=await this.submitURL(this.#ec)),t&&jr.setTimeout(this.$.component.select.bind(this.$.component,this.#Ta,Yr.key),0),t}modalInit(){Go.OnChangeFile(this.fileModalWrapper,[]),this.videoInputFile&&(this.videoInputFile.value=""),this.videoUrlFile&&(this.#ec=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.#Qh=!1,this.sizeService.init()}componentSelect(t){this.#pc(t)}componentEdit(){this.modal.open()}async componentDestroy(t){const e=t||this.#Ta,s=Ut.query.getParentElement(e,qs.is)||e,i=s.previousElementSibling||s.nextElementSibling,n=s.parentNode;!1!==await this.$.eventManager.triggerEvent("onVideoDeleteBefore",{element:e,container:s,align:this.#sc,url:this.#ec})&&(Ut.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.#Ta).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.#Ta=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.#Ta=t=s}else t.src=e}a=this.#oc}else{t.src=e,this.#Ta=t;a=qs.CreateContainer(t,"se-video-container").container}this.#Ta=t,this.#oc=a,this.figure.open(t,{nonResizing:this.#Qh,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.#Ua&&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=Ut.utils.createElement("IFRAME");if(t)for(const s in t)e[s]=t[s];return this.#Hc(e),e}createVideoTag(t){const e=Ut.utils.createElement("VIDEO");if(t)for(const s in t)e[s]=t[s];return this.#Lc(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===Kr?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===Kr?t:s||t,"error"),!1}const l={url:null,files:s,...this.#vc()},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!==Kr||r(null)))}async submitURL(t){if(!(t=this.#ec))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.#vc(),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!==Kr||n(null),!0)}#pc(t,e=!1){if(!t)return;const s=this.figure.open(t,{nonResizing:this.#Qh,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:e});this.#Ta=t,this.#oc=s.container,this.#sc=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.#ec=this.previewSrc.textContent=this.videoUrlFile.value=this.#Ta.src||this.#Ta.querySelector("source")?.src||"");(this.modal.form.querySelector('input[name="suneditor_video_radio"][value="'+this.#sc+'"]')||this.modal.form.querySelector('input[name="suneditor_video_radio"][value="none"]')).checked=!0,this.#Ua&&this.sizeService.ready(s,t)}#vc(){const{w:t,h:e}=this.sizeService.getInputSize();return{inputWidth:t,inputHeight:e,align:this.#sc,isUpdate:this.modal.isUpdate,element:this.#Ta}}#mc(t){if(!t)return;/^video$/i.test(t.nodeName)?this.#Lc(t):/^iframe$/i.test(t.nodeName)&&this.#Hc(t);const e=t,s=t.cloneNode(!0),i=qs.CreateContainer(s,"se-video-container"),n=i.container,o=qs.GetContainer(e)?.container?.querySelector("figcaption");let l=null;o&&(l=Ut.utils.createElement("figcaption"),l.innerHTML=o.innerHTML,Ut.utils.removeItem(o),i.cover.appendChild(l)),this.figure.open(s,{nonResizing:this.#Qh,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.#sc=c.style.textAlign||c.style.float),this.figure.setAlign(s,this.#sc),this.figure.retainFigureFormat(n,this.#Ta,null,this.fileManager),s}#Lc(t){t.setAttribute("controls","true");const e=this.pluginOptions.videoTagAttributes;if(e)for(const s in e)t.setAttribute(s,e[s])}#Hc(t){t.frameBorder="0",t.allowFullscreen=!0;const e=this.pluginOptions.iframeTagAttributes;if(e)for(const s in e)t.setAttribute(s,e[s])}#ac(){this.videoInputFile.value="",this.videoUrlFile&&(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),Go.OnChangeFile(this.fileModalWrapper,[])}#hc(t){const e=Ut.query.getEventTarget(t).value.trim();/^<iframe.*\/iframe>$/.test(e)?(this.#ec=e,this.previewSrc.textContent='<IFrame :src=".."></IFrame>'):this.#ec=this.previewSrc.textContent=e?this.$.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.$.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#dc(){this.$.plugins.videoGallery.open(this.#wc.bind(this))}#wc(t){this.#ec=this.previewSrc.textContent=this.videoUrlFile.value=t.getAttribute("data-command")||t.src,this.videoUrlFile.focus()}#cc(t){this.videoInputFile.value?(this.videoUrlFile.disabled=!0,this.previewSrc.style.textDecoration="line-through"):(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration="");const e=Ut.query.getEventTarget(t);Go.OnChangeFile(this.fileModalWrapper,e.files)}}const Xr=Yr,{NO_EVENT:Jr,ON_OVER_COMPONENT:Qr}=Dt;class ta extends rl{static key="audio";static className="";static component(t){return/^AUDIO$/i.test(t?.nodeName)?t:null}#Nc;#Bc;#Ac="";#Ta=null;constructor(t,e){super(t),this.title=this.$.lang.audio,this.icon="audio",this.pluginOptions={defaultWidth:e.defaultWidth?Zt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight?Zt.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:Zt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Zt.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 ${Go.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${Ut.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>`,Ut.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 Ut.utils.createElement("DIV",{class:"se-controller"},s)}(this.$);this.modal=new Go(this,this.$,s),this.controller=new Ms(this,this.$,i,{position:"bottom",disabled:!0}),this.fileManager=new Ko(this,this.$,{query:"audio",loadEventName:"onAudioLoad",actionEventName:"onAudioAction"}),this.figure=new qs(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.#Nc=this.pluginOptions.defaultWidth,this.#Bc=this.pluginOptions.defaultHeight;const n=s.querySelector(".__se__gallery");n&&this.$.eventManager.addEvent(n,"click",this.#dc.bind(this)),this.audioInputFile&&(this.$.eventManager.addEvent(s.querySelector(".se-modal-files-edge-button"),"click",this.#ac.bind(this,this.audioUrlFile,this.preview)),this.audioUrlFile&&this.$.eventManager.addEvent(this.audioInputFile,"change",this.#Ic.bind(this))),this.audioUrlFile&&this.$.eventManager.addEvent(this.audioUrlFile,"input",this.#hc.bind(this))}open(){this.modal.open()}retainFormat(){return{query:"audio",method:t=>{const e=qs.GetContainer(t);if(e&&e.container&&e.cover)return;this.#Lc(t);const s=qs.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.#Ta?(this.#Ac=this.preview.textContent=this.audioUrlFile.value=this.#Ta.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.#Ac.length>0)&&await this.submitURL(this.#Ac)}modalInit(){Go.OnChangeFile(this.fileModalWrapper,[]),this.audioInputFile&&(this.audioInputFile.value=""),this.audioUrlFile&&(this.#Ac=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.#Ac=this.preview.textContent=this.audioUrlFile.value=this.#Ta.src),this.open();break;case"copy":{const t=qs.GetContainer(this.#Ta);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.#pc(t)}async componentDestroy(t){const e=t||this.#Ta,s=qs.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;Ut.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===Jr?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===Jr?t:s||t,"error"),!1}const o={files:s,isUpdate:this.modal.isUpdate,element:this.#Ta},l=function(t,e,s){t(s=e||s,s.files)}.bind(this,this.#Vc.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!==Jr||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.#Oc()},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!==Jr||i(null),!0)}create(t,e,s,i,n){if(i){if(this.#Ta&&(t=this.#Ta),this.fileManager.setFileData(t,s),!t||t.src===e)return void this.$.component.select(t,ta.key);t.src=e,this.$.component.select(t,ta.key)}else{this.fileManager.setFileData(t,s),t.src=e;const i=qs.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)}#pc(t){ws.get("__overInfo")!==Qr&&(this.#Ta=t,this.controller.open(t,null,{isWWTarget:!1,addOffset:null}))}#ia(t,e){const s=e.result;for(let e,i,n=0,o=s.length;n<o;n++)i=t.isUpdate?t.element:this.#Oc(),e={name:s[n].name,size:s[n].size},this.create(i,s[n].url,e,t.isUpdate,n===o-1)}#Oc(){const t=this.#Nc,e=this.#Bc,s=Ut.utils.createElement("AUDIO",{style:(t?"width:"+t+"; ":"")+(e?"height:"+e+";":"")});return this.#Lc(s),s}#Lc(t){t.setAttribute("controls","true");const e=this.pluginOptions.audioTagAttributes;if(e)for(const s in e)t.setAttribute(s,e[s])}#Vc(t,e){if(!e)return;const s=this.modal.isUpdate?[e[0]]:e;this.fileManager.upload(this.pluginOptions.uploadUrl,this.pluginOptions.uploadHeaders,s,this.#jh.bind(this,t),this.#na.bind(this))}async#na(t){const e=await this.$.eventManager.triggerEvent("onAudioUploadError",{error:t}),s=e===Jr?t.errorMessage:e||t.errorMessage;this.$.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.audio.error]",s)}async#jh(t,e){if(await this.$.eventManager.triggerEvent("audioUploadHandler",{xmlHttp:e,info:t})===Jr){const s=JSON.parse(e.responseText);s.errorMessage?this.#na(s):this.#ia(t,s)}}#hc(t){const e=Ut.query.getEventTarget(t).value.trim();this.#Ac=this.preview.textContent=e?this.$.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.$.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#dc(){this.$.plugins.audioGallery.open(this.#wc.bind(this))}#wc(t){this.#Ac=this.preview.textContent=this.audioUrlFile.value=t.getAttribute("data-command")||t.src,this.audioUrlFile.focus()}#ac(t,e){this.audioInputFile.value="",t&&(t.disabled=!1,e.style.textDecoration=""),Go.OnChangeFile(this.fileModalWrapper,[])}#Ic(t){const e=Ut.query.getEventTarget(t);this.audioInputFile.value?(this.audioUrlFile.disabled=!0,this.preview.style.textDecoration="line-through"):(this.audioUrlFile.disabled=!1,this.preview.style.textDecoration=""),Go.OnChangeFile(this.fileModalWrapper,e.files)}}const ea=ta,{_w:sa,NO_EVENT:ia}=Dt;class na extends rl{static key="embed";static className="";static component(t){const e=t.children;let s="",i=null;if(Ut.check.isIFrame(t)&&(i=t,s=t.src),!s&&/^DIV$/i.test(t?.nodeName)&&Ut.check.isIFrame(e[0])&&(i=e[0],s=i.src),!s&&Ut.utils.hasClass(t,"se-embed-container")){i=Ut.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.#Ec(s)?i:null}return s?this.#Ec(s)?i:null:i}static#Ec(t){return t=t?.toLowerCase()||"",!!this.#Mc.some((e=>e.test(t)))}static#Mc=null;#_c;#xc;#Rh;#zh;#Ua;#Rc;#Qh;#ec="";#sc="none";#Ta=null;#nc=null;#oc=null;#Fh={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&&Zt.get(e.defaultWidth,0)?Zt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight&&Zt.get(e.defaultHeight,0)?Zt.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"",percentageOnlySize:!!e.percentageOnlySize,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:Zt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Zt.get(e.uploadSingleSizeLimit,0),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},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=Ut.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 Go(this,this.$,i.html),this.figure=new qs(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.#_c=this.pluginOptions.defaultWidth,this.#xc=this.pluginOptions.defaultHeight,this.#Rh="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.#zh="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.#Ua=this.pluginOptions.canResize,this.#Rc=this.pluginOptions.percentageOnlySize,this.#Qh=!this.#Ua||!this.pluginOptions.showHeightInput||this.#Rc,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);na.#Mc=o.concat(e.urlPatterns||[]),this.$.eventManager.addEvent(this.embedInput,"input",this.#hc.bind(this)),this.#Ua&&(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.#Uh.bind(this,"x")),this.$.eventManager.addEvent(this.inputY,"keyup",this.#Uh.bind(this,"y")),this.$.eventManager.addEvent(i.revertBtn,"click",this.#Zh.bind(this)))}open(){this.modal.open()}retainFormat(){return{query:"iframe",method:async t=>{if(!na.#Ec(t.src))return;const e=qs.GetContainer(t);if(e&&e.container&&e.cover)return;this.#pc(t,!0);const s=this.$.format.getLine(t);s&&(this.#sc=s.style.textAlign||s.style.float),this.#mc(t)}}}modalOn(t){!t&&this.#Ua?(this.inputX.value=this.#Rh="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.inputY.value=this.#zh="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.proportion.disabled=!0):t&&(this.#ec=this.previewSrc.textContent=this.embedInput.value=this.#nc.getAttribute("data-se-origin")||"")}async modalAction(){this.#sc=this.modal.form.querySelector('input[name="suneditor_embed_radio"]:checked').value;let t=!1;return this.#ec.length>0&&(t=await this.submitSRC(this.#ec)),t&&sa.setTimeout(this.$.component.select.bind(this.$.component,this.#Ta,na.key),0),t}modalInit(){Go.OnChangeFile(this.fileModalWrapper,[]),this.#ec=this.previewSrc.textContent=this.embedInput.value="",this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="none"]').checked=!0,this.#Fh={w:0,h:0},this.#Qh=!1,this.#Ua&&(this.inputX.value=this.pluginOptions.defaultWidth===this.#_c?"":this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight===this.#xc?"":this.pluginOptions.defaultHeight,this.proportion.checked=!1,this.proportion.disabled=!0)}componentSelect(t){this.#pc(t)}componentEdit(){this.modal.open()}async componentDestroy(t){const e=t||this.#Ta,s=Ut.query.getParentElement(e,qs.is)||e,i=s.previousElementSibling||s.nextElementSibling,n=s.parentNode;!1!==await this.$.eventManager.triggerEvent("onEmbedDeleteBefore",{element:e,container:s,align:this.#sc,url:this.#ec})&&(Ut.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.#ec))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;e={children:s,...this.#vc(),process:null}}else{const s=this.findProcessUrl(t);if(!s)return!1;t=s.url,e={...this.#vc(),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.#zc.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!==ia||s(null),!0)}#pc(t,e=!1){if(!t)return;const s=this.figure.open(t,{nonResizing:this.#Qh,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:e});if(this.#Ta=t,this.#nc=s.cover,this.#oc=s.container,this._caption=s.caption,this.#sc=s.align,!this.#nc?.getAttribute?.("data-se-origin")){const e=t?.getAttribute?.("src")||t?.querySelector?.("a")?.href;e&&na.#Ec(e)&&this.#nc.setAttribute("data-se-origin",e)}t.style.float="",this.#Rh=String(s.originWidth||s.w||""),this.#zh=String(s.originHeight||s.h||"");if((this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="'+this.#sc+'"]')||this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="none"]')).checked=!0,!this.#Ua)return;const i=this.#Rc&&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.#Fh=this.proportion.checked?s.ratio:{w:0,h:0}}#Fc(){const t=Ut.utils.createElement("IFRAME");return this.#Hc(t),t}#Pc(){return Ut.utils.createElement("BLOCKQUOTE")}#zc(t,e,s,i,n,o,l,r){let a=null,h=null,c=null,d=null;if(r){if(a=this.#Ta,a.src!==s){const t=this.findProcessUrl(s);if(/^iframe$/i.test(t?.tag)&&!/^iframe$/i.test(a.nodeName)){const t=this.#Fc();t.src=s,a.replaceWith(t),a=t}else if(/^blockquote$/i.test(t?.tag)&&!/^blockquote$/i.test(a.nodeName)){const t=this.#Pc();t.setAttribute("src",s),a.replaceWith(t),a=t}else a.src=s}c=this.#oc,h=Ut.query.getParentElement(a,"FIGURE")}else if(e){a=this.#Fc(),a.src=s;const t=qs.CreateContainer(a,"se-embed-container");h=t.cover,c=t.container}else{a=i[0];const t=qs.CreateContainer(a,"se-embed-container");h=t.cover,c=t.container;const e=Array.from(i);for(const t of e)/^script$/i.test(t.nodeName)?d=Ut.utils.createElement("script",{src:t.getAttribute("src"),async:"true"},null):h.appendChild(t)}this.#Ta=a,this.#nc=h,this.#oc=c,this.figure.open(a,{nonResizing:this.#Qh,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0}),n||=this.#_c,o||=this.#xc;const u=this.figure.getSize(a),p=u.w!==n||u.h!==o,g=!r||p;if(g&&this.#Dc(n,o),this.figure.setAlign(a,l),h.setAttribute("data-se-origin",t),r)this.#Ua&&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=()=>{Ut.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)}}}#mc(t){if(!t)return;this.#Hc(t);const e=t;t=t.cloneNode(!0);const s=qs.CreateContainer(t,"se-embed-container").container;this.figure.open(t,{nonResizing:this.#Qh,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.#Dc(n,o);const l=this.$.format.getLine(e);return l&&(this.#sc=l.style.textAlign||l.style.float),this.figure.setAlign(t,this.#sc),this.figure.retainFigureFormat(s,this.#Ta,null,null),t}#Dc(t,e){t||=this.inputX?.value||this.pluginOptions.defaultWidth,e||=this.inputY?.value||this.pluginOptions.defaultHeight,this.#Rc&&(t?/%$/.test(t+"")||(t+="%"):t="100%"),this.figure.setSize(t,e)}#vc(){return{inputWidth:this.inputX?.value||"",inputHeight:this.inputY?.value||"",align:this.#sc,isUpdate:this.modal.isUpdate,element:this.#Ta}}#Hc(t){t.frameBorder="0",t.allowFullscreen=!0;const e=this.pluginOptions.iframeTagAttributes;if(e)for(const s in e)t.setAttribute(s,e[s])}#hc(t){const e=Ut.query.getEventTarget(t).value.trim();/^<iframe.*\/iframe>$/.test(e)?(this.#ec=e,this.previewSrc.textContent='<IFrame :src=".."></IFrame>'):this.#ec=this.previewSrc.textContent=e?this.$.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.$.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#Zh(){this.#Rc?this.inputX.value=Number(this.#Rh)>100?"100":this.#Rh:(this.inputX.value=this.#Rh,this.inputY.value=this.#zh)}#Uh(t,e){if(Gt.isSpace(e.code))return void e.preventDefault();const s=Ut.query.getEventTarget(e);if("x"===t&&this.#Rc&&Number(s.value)>100)s.value="100";else if(this.proportion.checked){const e=qs.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this.#Fh);"x"===t?this.inputY.value=String(e.h):this.inputX.value=String(e.w)}}}const oa=na,{_w:la,_d:ra}=Dt;class aa extends rl{static key="math";static className="";static component(t){return Ut.utils.hasClass(t,"se-math|katex")&&Ut.check.isComponentContainer(t)?t:null}#Ta=null;constructor(t,e){super(t),this.title=this.$.lang.math,this.icon="math",this.katex=null,this.mathjax=null,(this.katex=this.#qc())||(this.mathjax=this.#Wc())||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="${Dt.KATEX_WEBSITE}" target="_blank">KaTeX</a>)`:`(<a href="${Dt.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,Ut.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 Ut.utils.createElement("DIV",{class:"se-controller se-controller-link"},s)}(this.$);this.modal=new Go(this,this.$,s),this.controller=new Ms(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.#Uc.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=ha(t);if(!e)return;const s=ra.createRange().createContextualFragment(this.#Zc(Wt.entityToHTML(this.#Gc(e,!0))));t.innerHTML=s.querySelector(".se-math, .katex").innerHTML,t.setAttribute("contenteditable","false"),Ut.utils.addClass(t,"se-component|se-inline-component|se-disable-pointer|se-math"),this.katex?Ut.utils.addClass(t,"katex"):Ut.utils.removeClass(t,"katex"),this.mathjax&&this.#jc(this.mathjax)}}}modalOn(t){if(this.isUpdateState=t,t){if(this.controller.currentTarget){const t=this.controller.currentTarget,e=Wt.entityToHTML(this.#Gc(ha(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.#Zc(e),this.previewElement.style.fontSize=s}}else this.modalInit()}async modalAction(){if(0===this.textArea.value.trim().length||Ut.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(Ut.utils.addClass(e,"se-component|se-inline-component|se-disable-pointer|se-math"),e.setAttribute("contenteditable","false"),e.setAttribute("data-se-value",Wt.htmlToEntity(this.#Gc(t,!1))),e.setAttribute("data-se-type",this.fontSizeElement.value),e.style.fontSize=this.fontSizeElement.value,this.katex?(Ut.utils.addClass(e,"katex"),Ut.utils.removeClass(e,"MathJax")):Ut.utils.removeClass(e,"katex"),this.isUpdateState){Ut.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=Ut.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.#jc(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,aa.key),!0}modalInit(){this.textArea.value="",this.previewElement.innerHTML="",Ut.utils.removeClass(this.textArea,"se-error")}controllerAction(t){switch(t.getAttribute("data-command")){case"update":this.modal.open();break;case"copy":this.#Kc(this.#Ta);break;case"delete":this.componentDestroy(this.controller.currentTarget)}}controllerClose(){this.#Ta=null}componentSelect(t){if(Ut.utils.hasClass(t,"se-math|katex")&&ha(t))return this.#Ta=t,void this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null})}async componentDestroy(t){Ut.utils.removeItem(t),this.controller.close(),this.$.focusManager.focus(),this.$.history.push(!1)}#Zc(t){let e="";try{if(Ut.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)?(Ut.utils.addClass(this.textArea,"se-error"),e=`<span class="se-math-error">${e}</span>`):e=`<span class="se-math">${e}</span>`}}catch(t){Ut.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="${Dt.KATEX_WEBSITE}" target="_blank">KaTeX</a>`:`<a href="${Dt.MATHJAX_WEBSITE}" target="_blank">MathJax</a>`})</span>`,console.warn("[SUNEDITOR.math.error] ",t.message)}return e}#Gc(t,e){return t.replace(/\\{2}/g,e?"\\":"\\\\")}async#Kc(t){if(navigator.clipboard&&t)try{const e=ha(t);await this.$.html.copy(e),Ut.utils.addClass(t,"se-copy"),la.setTimeout((()=>{Ut.utils.removeClass(t,"se-copy")}),120)}catch(t){console.error("[SUNEDITOR.math.copy.fail]",t)}}#Uc(t){const e=Ut.query.getEventTarget(t);this.pluginOptions.autoHeight&&(e.style.height="5px",e.style.height=e.scrollHeight+5+"px"),this.previewElement.innerHTML=this.#Zc(e.value),this.mathjax&&this.#jc(this.mathjax)}#jc(t){t.clear(),t.updateDocument()}#qc(){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}#Wc(){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 ha(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 ca=aa,{_w:da}=Dt;const ua=class extends rl{static key="drawing";static className="";#tt;#Yc;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${Ut.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${Ut.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${Ut.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 Ut.utils.createElement("DIV",{class:"se-modal-content se-modal-responsive",style:`max-width: ${o}; max-height: ${l};`},h)}(this.$,this.pluginOptions);this.modal=new Go(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.#uc.bind(this))),this.canvas=null,this.ctx=null,this.isDrawing=!1,this.points=[],this.paths=[],this.resizeObserver=null,this.#tt={touchstart:this.#Xc.bind(this),touchmove:this.#Jc.bind(this),mousedown:this.#Qc.bind(this),mousemove:this.#td.bind(this),mouseup:this.#ed.bind(this),mouseleave:this.#sd.bind(this),mouseenter:this.#id.bind(this)},this.#Yc={touchstart:null,touchmove:null,mousedown:null,mousemove:null,mouseup:null,mouseleave:null,mouseenter:null},this.$.eventManager.addEvent(s.querySelector('[data-command="remove"]'),"click",this.#nd.bind(this))}open(){this.pluginOptions.useFormatType&&this.#fc("inline"===(this.pluginOptions.keepFormatType?this.as:this.pluginOptions.defaultFormatType)),this.modal.open(),this.#od()}modalOff(){this.#ld()}async modalAction(){if("svg"===this.pluginOptions.outputFormat){const t=this.#rd();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}#od(){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.#ad(),this.#Yc.touchstart=this.$.eventManager.addEvent(t,"touchstart",this.#tt.touchstart,{passive:!1,capture:!0}),this.#Yc.touchmove=this.$.eventManager.addEvent(t,"touchmove",this.#tt.touchmove,!0),this.#Yc.mousedown=this.$.eventManager.addEvent(t,"mousedown",this.#tt.mousedown,{passive:!1,capture:!0}),this.#Yc.mousemove=this.$.eventManager.addEvent(t,"mousemove",this.#tt.mousemove,!0),this.#Yc.mouseup=this.$.eventManager.addEvent(t,"mouseup",this.#tt.mouseup,!0),this.#Yc.mouseleave=this.$.eventManager.addEvent(t,"mouseleave",this.#tt.mouseleave),this.#Yc.mouseenter=this.$.eventManager.addEvent(t,"mouseenter",this.#tt.mouseenter),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),Dt.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.#hd(e,s,i,n),this.#cd())})),this.resizeObserver.observe(t))}#ld(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.canvas&&(this.$.eventManager.removeEvent(this.#Yc.mousedown),this.$.eventManager.removeEvent(this.#Yc.mousemove),this.$.eventManager.removeEvent(this.#Yc.mouseup),this.$.eventManager.removeEvent(this.#Yc.mouseleave),this.$.eventManager.removeEvent(this.#Yc.mouseenter)),this.canvas=null,this.ctx=null,this.points=[],this.paths=[],this.isDrawing=!1}#ad(){this.ctx.lineWidth=this.pluginOptions.lineWidth,this.ctx.lineCap=this.pluginOptions.lineCap,this.ctx.strokeStyle=this.pluginOptions.lineColor||da.getComputedStyle(this.$.contextProvider.carrierWrapper).color}#dd(){this.#ad(),this.ctx.beginPath(),this.points.forEach((([t,e],s)=>{0===s?this.ctx.moveTo(t,e):this.ctx.lineTo(t,e)})),this.ctx.stroke()}#cd(){this.#ad(),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.paths.forEach((t=>{this.points=t,this.#dd()})),this.points=[]}#hd(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]))))}#ud(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.points=[],this.paths=[]}#pd(){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}#rd(){const t=this.#pd(),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}#gd(t){const{touches:e}=t,s=this.canvas.getBoundingClientRect();return{x:e[0].clientX-s.left,y:e[0].clientY-s.top}}#fc(t){t?(Ut.utils.addClass(this.asInline,"on"),Ut.utils.removeClass(this.asBlock,"on"),this.as="inline"):(Ut.utils.addClass(this.asBlock,"on"),Ut.utils.removeClass(this.asInline,"on"),this.as="block")}#Qc(t){t.preventDefault(),this.isDrawing=!0,this.points.push([t.offsetX,t.offsetY]),this.#dd()}#td(t){t.preventDefault(),this.isDrawing&&(this.points.push([t.offsetX,t.offsetY]),this.#dd())}#Xc(t){t.preventDefault();const{x:e,y:s}=this.#gd(t);this.isDrawing=!0,this.points.push([e,s]),this.#dd()}#Jc(t){t.preventDefault();const{x:e,y:s}=this.#gd(t);this.isDrawing&&(this.points.push([e,s]),this.#dd())}#ed(){this.isDrawing=!1,this.points.length>0&&(this.paths.push([...this.points]),this.points=[])}#sd(){this.isDrawing&&(this.paths.push([...this.points]),this.pluginOptions.lineReconnect||(this.points=[],this.isDrawing=!1))}#id(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.#dd()}}#nd(){this.#ud()}#uc(t){this.#fc("asInline"===Ut.query.getEventTarget(t).getAttribute("data-command"))}};const pa=class extends el{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 so(this,this.$,{title:this.$.lang.imageGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#md.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()}#md(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 ga=class extends el{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 so(this,this.$,{title:this.$.lang.videoGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#md.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()}#md(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 ma=class extends el{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 so(this,this.$,{title:this.$.lang.audioGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#md.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()}#md(t){this.onSelectfunction?this.onSelectfunction(t):(this.$.plugins.audio.modalInit(),this.$.plugins.audio.submitURL(t.getAttribute("data-command")))}};const fa=class extends el{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 so(this,this.$,{title:this.$.lang.fileGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#md.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()}#md(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 va=class extends el{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 so(this,this.$,{title:this.$.lang.fileBrowser,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#md.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"]))]})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#md(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)}}}},ba={text:{default:"13px",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 ya extends ll{static key="fontSize";static className="se-btn-select se-btn-input se-btn-tool-font-size";#fd;constructor(t,e){super(t),this.unitMap={...ba,...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>",Ut.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=Ut.utils.createElement("button",{class:"se-btn se-tooltip se-sub-btn","data-command":ya.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=Ut.utils.createElement("button",{class:"se-btn se-tooltip se-sub-btn","data-command":ya.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=Ut.utils.createElement("button",{class:"se-btn se-tooltip se-btn-select se-btn-tool-font-size","data-command":ya.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:ya.key,type:"dropdown"},i)):(this.afterItem=Ut.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":ya.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:ya.key,type:"dropdown"},i)),this.currentSize="",this.sizeList=i.querySelectorAll("li button"),this.hasInputFocus=!1,this.isInputActive=!1,this.#fd=o,this.$.menu.initDropdownTarget(ya,i)}active(t,e){if(!Ut.utils.hasClass(e,"__se__font_size"))return!1;let s="";if(t){if(this.$.format.isLine(t))return;if(s=Ut.utils.getStyle(t,"fontSize"))return this.#vd(e,s),!0}else this.#vd(e,this.#bd());return!1}toolbarInputKeyDown({target:t,event:e}){const s=e.code;if(this.#fd||Gt.isSpace(s))return void e.preventDefault();if(!/^(ArrowUp|ArrowDown|Enter)$/.test(s))return;const{value:i,unit:n}=this.#yd(t);if(!i)return;const o=Zt.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.#vd(t,r+n);if(this.#fd)return;const i=Ut.utils.createElement("SPAN",{style:"font-size: "+e+";"});this.$.inline.apply(i,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null}),Gt.isEnter(s)||t.focus()}finally{this.isInputActive=!1}}toolbarInputChange({target:t,value:e,event:s}){if(!this.#fd)try{this.isInputActive=!0;let{value:s,unit:i}=this.#yd(e);const{max:n,min:o}=this.unitMap[i];s=s>n?n:s<o?o:s;const l=Ut.utils.createElement("SPAN",{style:"font-size: "+this.#vd(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.#yd(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")?Ut.utils.addClass(n[t],"active"):Ut.utils.removeClass(n[t],"active");this.currentSize=i}action(t){const e=t.getAttribute("data-command");if(e===ya.key){const{value:e,unit:s}=this.#yd(t);let i=Zt.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=Ut.utils.createElement("SPAN",{style:"font-size: "+i+s+";"});this.$.inline.apply(l,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}else if(e){const t=Ut.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()}#bd(){return this.$.frameContext.get("wwComputedStyle").fontSize}#yd(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:Ut.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}}#vd(t,e){return(t=t.parentElement.querySelector(".__se__font_size"))?Ut.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 wa=ya;const Ca=class extends ll{static key="pageNavigator";static className="se-btn-input se-btn-tool-pageNavigator";constructor(t){super(t),this.title=this.$.lang.pageNumber,this.inner=Ut.utils.createElement("input",{type:"number",class:"se-not-arrow-text",placeholder:"1",value:"1",min:"1"},null),this.afterItem=Ut.utils.createElement("span",{class:"se-btn se-sub-btn"},""),this.pageNum=1,this.totalPages=1,this.$.eventManager.addEvent(this.inner,"change",this.#wd.bind(this))}display(t,e){this.pageNum=t,this.totalPages=e,this.inner.value=String(t),this.afterItem.textContent=this.inner.max=String(e)}#wd(t){if(!this.$.frameContext.has("documentType_use_page"))return;const e=Ut.query.getEventTarget(t),s=Number(e.value)||1;this.$.frameContext.get("documentType").pageGo(s)}},{_w:_a}=Dt;class xa extends al{static key="anchor";static className="";static component(t){return Ut.check.isAnchor(t)&&t.hasAttribute("id")&&t.hasAttribute("data-se-anchor")?t:null}#Ta=null;#Cd=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 Ut.utils.createElement("DIV",{class:"se-controller se-controller-link"},s)}(this.$);this.displayId=s.querySelector(".se-controller-display"),this.controllerSelect=new Ms(this,this.$,s,{position:"bottom",disabled:!0},xa.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 Ut.utils.createElement("DIV",{class:"se-controller se-controller-simple-input"},s)}(this.$);this.inputEl=i.querySelector("input"),this.controller=new Ms(this,this.$,i,{position:"bottom",disabled:!0,parents:[this.controllerSelect.form],parentsHide:!0},xa.key)}show(){this.controller.open(this.#Cd=this.$.selection.getRange()),_a.setTimeout((()=>{this.inputEl.focus()}),0)}componentSelect(t){this.#Ta=t,this.displayId.textContent=t.getAttribute("id"),this.controllerSelect.open(t)}componentDeselect(){this.#rs()}controllerAction(t){const e=t.getAttribute("data-command");if(!e)return;const s=this.#Ta;switch(e){case"submit":if(this.controller.close(),s)s.id=this.inputEl.value,this.$.component.select(s,xa.key);else{const t=this.inputEl.value.trim();if(!t)return void this.inputEl.focus();const e=Ut.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,xa.key),this.#rs()}break;case"cancel":this.controller.close(!s),this.#Cd&&this.$.selection.setRange(this.#Cd),this.#rs(),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);Ut.utils.removeItem(s),this.controllerSelect.close(!0),t&&this.$.selection.setRange(t.container,t.offset,t.container,t.offset),this.#rs();break}}}#rs(){this.#Ta=null,this.#Cd=null,this.inputEl.value="",this.displayId.textContent=""}}const $a={blockquote:hl,codeBlock:ul,exportPDF:ml,fileUpload:bl,list_bulleted:wl,list_numbered:xl,mention:kl,align:El,font:Ml,fontColor:Ll,backgroundColor:Bl,list:Ol,table:_r,blockStyle:$r,hr:Il,layout:Sr,lineHeight:Tr,template:Hr,paragraphStyle:Nr,textStyle:Ar,link:Ir,image:Wr,video:Xr,audio:ea,embed:oa,math:ca,drawing:ua,imageGallery:pa,videoGallery:ga,audioGallery:ma,fileGallery:fa,fileBrowser:va,fontSize:wa,pageNavigator:Ca,anchor:xa};class ka{async modalAction(){return!0}modalOn(t){}modalInit(){}modalOff(t){}modalResize(){}}class Sa{controllerAction(t){}controllerOn(t,e){}controllerClose(){}}class Ea{browserInit(){}}class Ta{colorPickerAction(t){}colorPickerHueSliderOpen(){}colorPickerHueSliderClose(){}}class Ma{hueSliderAction(){}hueSliderCancelAction(){}}class Ha{componentSelect(t){}componentDeselect(t){}componentEdit(t){}async componentDestroy(t){}componentCopy(t){}}const La={contract:t,manager:e,ui:i};Object.defineProperty(window,"SUNEDITOR",{enumerable:!0,writable:!1,configurable:!1,value:{...Qo,plugins:$a,modules:La,helper:Yt,interfaces:n}})})()})();