suneditor 3.0.0-beta.32 → 3.0.0-beta.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/suneditor.min.js +1 -1
- package/package.json +1 -1
- package/src/assets/suneditor.css +0 -0
- package/src/core/class/offset.js +1 -2
- package/src/core/config/options.js +9 -9
- package/src/core/editor.js +0 -0
- package/src/core/section/constructor.js +3 -3
- package/src/hooks/params.js +4 -4
- package/src/interfaces/plugins.js +2 -8
- package/src/modules/contracts/ColorPicker.js +0 -0
- package/src/modules/contracts/HueSlider.js +0 -0
- package/src/plugins/command/fileUpload.js +2 -2
- package/src/plugins/dropdown/backgroundColor.js +0 -0
- package/src/plugins/dropdown/fontColor.js +0 -0
- package/src/plugins/dropdown/lineHeight.js +1 -1
- package/src/plugins/modal/math.js +4 -2
- package/src/typedef.js +6 -4
- package/types/core/config/options.d.ts +18 -18
- package/types/core/section/constructor.d.ts +4 -4
- package/types/hooks/params.d.ts +2 -2
- package/types/index.d.ts +9 -14
- package/types/interfaces/plugins.d.ts +4 -10
- package/types/plugins/command/fileUpload.d.ts +4 -4
- package/types/plugins/dropdown/lineHeight.d.ts +2 -2
- package/types/plugins/modal/math.d.ts +2 -2
- package/types/typedef.d.ts +4 -4
package/dist/suneditor.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var t={cfbI:function(t){var e,i;e="undefined"!=typeof window?window:this,i=function(t,e){const i={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",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",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",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:i})),i},"object"==typeof t.exports?t.exports=e.document?i(e,!0):function(t){if(!t.document)throw new Error("SUNEDITOR_LANG a window with a document");return i(t)}:i(e)}},e={};function i(s){var n=e[s];if(void 0!==n)return n.exports;var o=e[s]={exports:{}};return t[s].call(o.exports,o,o.exports,i),o.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";var t={};i.r(t),i.d(t,{Browser:()=>$n,ColorPicker:()=>Ho,Controller:()=>as,Figure:()=>ws,HueSlider:()=>Eo,Modal:()=>No});var e={};i.r(e),i.d(e,{ApiManager:()=>Fn,FileManager:()=>Bo,ModalAnchorEditor:()=>Oo,SelectMenu:()=>cs,_DragHandle:()=>he});var s={};i.r(s),i.d(s,{EditorComponent:()=>qr,ModuleBrowser:()=>$r,ModuleColorPicker:()=>Pr,ModuleController:()=>zr,ModuleHueSlider:()=>Dr,ModuleModal:()=>Fr,PluginBrowser:()=>$o,PluginCommand:()=>Po,PluginDropdown:()=>Do,PluginDropdownFree:()=>qo,PluginField:()=>Wo,PluginInput:()=>Uo,PluginModal:()=>Zo,PluginPopup:()=>Go});const n=window,o=document,l=Symbol("noEventHandler"),r=Symbol("onOverComponent"),a=navigator.userAgent.toLowerCase();const h="function"==typeof ResizeObserver,c="function"==typeof navigator.clipboard?.write,d=/Edg/.test(navigator.userAgent),u=/(Mac|iPhone|iPod|iPad)/.test(navigator.userAgent),p=a.includes("chrome/")&&!a.includes("edge/"),g=!!a.match(/gecko\/\d+/),m=!!n.chrome,f=a.includes("applewebkit/")&&!a.includes("chrome"),b=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(a),y=navigator.maxTouchPoints>0&&"ontouchstart"in n,v=a.includes("android"),_=u?"⌘":"CTRL",C=u?"⇧":"+SHIFT",w=n.devicePixelRatio,x={_w:n,_d:o,NO_EVENT:l,ON_OVER_COMPONENT:r,getXMLHttpRequest:function(){return new XMLHttpRequest},getPageStyle:function(t){let e="";const i=(t||o).styleSheets;for(let t,s=0,n=i.length;s<n;s++){try{t=i[s].cssRules}catch{continue}if(t)for(let i=0,s=t.length;i<s;i++)e+=t[i].cssText}return e},getIncludePath:function(t,e){let i="";const s=[],n="js"===e?"script":"link",l="js"===e?"src":"href";let r="(?:";for(let e=0,i=t.length;e<i;e++)r+=t[e]+(e<i-1?"|":")");const a=new RegExp(`(^|.*[\\/])${r}(\\.[^\\/]+)?.${e}(?:\\?.*|;.*)?$`,"i"),h=new RegExp(`.+\\.${e}(?:\\?.*|;.*)?$`,"i");for(let t=o.getElementsByTagName(n),e=0;e<t.length;e++)h.test(t[e][l])&&s.push(t[e]);for(let t=0;t<s.length;t++){const e=s[t][l].match(a);if(e){i=e[0];break}}if(""===i&&(i=s.length>0?s[0][l]:""),i.includes(":/")||"//"===i.slice(0,2)||(i=!1===i.includes("/")?location.href.match(/^.*?:\/\/[^/]*/)[0]+i:location.href.match(/^[^?]*\/(?:)/)[0]+i),!i)throw"[SUNEDITOR.helper.env.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (path: +"+i+", extension: "+e+")";return i},isResizeObserverSupported:h,isClipboardSupported:c,isEdge:d,isBlink:p,isGecko:g,isChromium:m,isSafari:f,isOSX_IOS:u,isAndroid:v,isMobile:b,isTouchDevice:y,cmdIcon:_,shiftIcon:C,DPI:w,KATEX_WEBSITE:"https://katex.org/docs/supported.html",MATHJAX_WEBSITE:"https://www.mathjax.org/"},k=8203,E=String.fromCharCode(k),S=new RegExp(String.fromCharCode(k),"g"),T=new RegExp("^"+String.fromCharCode(k)+"+$");const H={zeroWidthSpace:E,zeroWidthRegExp:S,onlyZeroWidthRegExp:T,escapeStringRegexp:function(t){if("string"!=typeof t)throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}},L={"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 M(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 i of t.attributes)e.attributes[i.name]=i.value;for(const i of t.childNodes){const t=M(i);t&&e.children.push(t)}return e}return null}function N(t){const e={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"};return t.replace(/&|\u00A0|'|"|<|>/g,(t=>"string"==typeof e[t]?e[t]:t))}function A(t){return"string"==typeof t?t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase())):t.map((function(t){return A(t)}))}function B(t){return/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(t)}const V={htmlToJson:function(t){return M((new DOMParser).parseFromString(t,"text/html").body)},jsonToHtml:function t(e){if(!e)return"";if("text"===e.type)return N(e.content||"");if("element"===e.type){const{tag:i,attributes:s={},children:n=[]}=e,o=Object.entries(s).map((([t,e])=>`${t}="${N(e)}"`)).join(" "),l=`</${i}>`;return`${o?`<${i} ${o}>`:`<${i}>`}${n.map(t).join("")}${l}`}return""},htmlToEntity:N,entityToHTML:function(t){const e={"&":"&"," ":" ","'":"'",""":'"',"<":"<",">":">"};return t.replace(/&| |'|"|\$lt;|\$gt;/g,(t=>"string"==typeof e[t]?e[t]:t))},debounce:function(t,e){let i;return function(...s){n.clearTimeout(i),i=n.setTimeout((()=>{n.clearTimeout(i),t(...s)}),e)}},syncMaps:function(t,e){e.forEach(((e,i)=>{t.set(i,e)})),t.forEach(((i,s)=>{e.has(s)||t.delete(s)}))},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:A,kebabToCamelCase:function(t){return"string"==typeof t?t.replace(/-[a-zA-Z]/g,(t=>t.replace("-","").toUpperCase())):t.map((function(t){return A(t)}))},toFontUnit:function(t,e){const i=e.match(/(\d+(?:\.\d+)?)(.+)/),s=i?Number(i[1]):L[e],n=i?i[2]:"rem";let o=s;switch(/em/.test(n)?o=Math.round(s/.0625):"pt"===n?o=Math.round(1.333*s):"%"===n&&(o=s/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={},i=Object.prototype.hasOwnProperty;for(const s in t)i.call(t,s)&&(e[t[s]]=s);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:B,rgb2hex:function(t){if(B(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 i=("0"+parseInt(e[1],10).toString(16)).slice(-2),s=("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+]?/i);e&&(o=("0"+Math.round(255*parseFloat(e[1])).toString(16)).slice(-2))}return`#${i}${s}${n}${o}`}return t},getWidthInPercentage:function(t,e){const i=e||t.parentElement,s=n.getComputedStyle(i),o=parseFloat(s.paddingLeft),l=parseFloat(s.paddingRight),r=i.offsetWidth-i.clientWidth,a=i.offsetWidth-o-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 i=t.textContent,s=o.createDocumentFragment();let n=0;return i.replace(e,((t,e)=>{e>0&&s.appendChild(o.createTextNode(i.slice(0,e)));const l=o.createElement("a");return l.href=t,l.target="_blank",l.textContent=t,s.appendChild(l),n=e+t.length,n<i.length&&s.appendChild(o.createTextNode(i.slice(n))),t})),t.parentNode.replaceChild(s,t),!0}return!1},spanToStyleNode:function(t,e){if(1===e.nodeType&&/^SPAN$/i.test(e.nodeName)&&e.hasAttribute("style")){const i=e.getAttribute("style"),s=[];if(Object.keys(t).forEach((e=>{if(t[e].regex.test(i)){const i=o.createElement(t[e].tag);s.push(i)}})),s.length>0){const t=o.createElement("span");let i=e.firstChild;s.forEach(((e,i)=>{0===i?t.appendChild(e):s[i-1].appendChild(e)}));const n=s[s.length-1];for(;i;){const t=i.nextSibling;n.appendChild(i),i=t}for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(t)}}},addUrlQuery:function(t,e){if(e.length>0)if(/\?/.test(t)){const i=t.split("?");t=i[0]+"?"+e+"&"+i[1]}else t+="?"+e;return t},_setDefaultOptionStyle:function(t,e){let i="";t.get("height")&&(i+="height:"+t.get("height")+";"),t.get("minHeight")&&(i+="min-height:"+t.get("minHeight")+";"),t.get("maxHeight")&&(i+="max-height:"+t.get("maxHeight")+";"),t.get("width")&&(i+="width:"+t.get("width")+";"),t.get("minWidth")&&(i+="min-width:"+t.get("minWidth")+";"),t.get("maxWidth")&&(i+="max-width:"+t.get("maxWidth")+";");let s="",n="",o="";const l=(e=i+e).split(";");for(let e,i=0,r=l.length;i<r;i++)e=l[i].trim(),e&&(/^(min-|max-)?width\s*:/.test(e)||/^(z-index|position|display)\s*:/.test(e)?s+=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:s,frame:n,editor:o}},_setIframeStyleLinks:function(t){let e="";if(t){const i=o.getElementsByTagName("link");for(let s,n=0,o=t.length;n<o;n++){s=[];const o=t[n];if("*"===o)for(let t=0,e=i.length;t<e;t++)"stylesheet"===i[t].rel&&i[t].href&&s.push(i[t].href);else if(/(^https?:\/\/)|(^data:text\/css,)/.test(o))s.push(o);else{const t=new RegExp(`(^|.*[\\/])${o}(\\..+)?.css((\\??.+?)|\\b)$`,"i");for(let e,n=0,o=i.length;n<o;n++)e=i[n].href.match(t),e&&s.push(e[0])}if(!s||0===s.length)throw'[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,i=s.length;t<i;t++)e+='<link href="'+s[t]+'" rel="stylesheet">'}}return e},_setAutoHeightStyle:function(t){return"auto"===t?"<style>\n/** Iframe height auto */\nbody{height: min-content; overflow: hidden;}\n</style>":""}},I=V;function O(t){if(null==t)return!1;if("string"!=typeof t){if(R(t)){const e=t.children;for(let t=0,i=e.length;t<i;t++){if(!P(e[t]))return!1}}t=t.textContent}return""===t||T.test(t)}function R(t){return 1===t?.nodeType}function F(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 $(t){return/^BR$/i.test("string"==typeof t?t:t?.nodeName)}function P(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 D(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 q(t){return t?.hasAttribute("data-important-disabled")}const W={isZeroWidth:O,isEdgePoint:function(t,e,i){return"end"!==i&&0===e||(!i||"front"!==i)&&!t.nodeValue&&e<=1||(!i||"end"===i)&&t.nodeValue&&e>=t.nodeValue.length},isText:function(t){return 3===t?.nodeType},isElement:R,isInputElement:function(t){return R(t)&&/^(INPUT|TEXTAREA|SELECT|OPTION)$/i.test(t.nodeName)},isButtonElement:function(t){return R(t)&&/^(BUTTON)$/i.test(t.nodeName)},isList:F,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:$,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:P,isEmptyLine:function(t){if(!t?.parentNode)return!0;const e=t;return!e.querySelector("IMG, IFRAME, AUDIO, VIDEO, CANVAS, TABLE")&&(e.children.length<=1||$(e.firstElementChild))&&O(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:D,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 i=t,s=e,n=i.style,o=s.style;let l=0;for(let t=0,e=n.length;t<e;t++)n[n[t]]===o[n[t]]&&l++;const r=i.classList,a=s.classList,h=RegExp;let c=0;for(let t=0,e=r.length;t<e;t++)h("(s|^)"+r[t]+"(s|$)").test(a.value)&&c++;return l===o.length&&l===n.length&&c===a.length&&c===r.length},isExcludeFormat:function(t){return/(\s|^)(katex|MathJax|se-exclude-format)(\s|$)/.test(t?.className)},isUneditable:function(t){return t?.classList.contains("__se__uneditable")},isImportantDisabled:q},U=W;function Z(t){const e=Object.prototype.toString.call(t);return"[object HTMLCollection]"===e||"[object NodeList]"===e||"[object Array]"===e}function G(t,e,i){const s=o.createElement(t);if(e)for(const t in e)void 0!==e[t]&&null!==e[t]&&s.setAttribute(t,e[t]);return i&&("string"==typeof i?s.innerHTML=i:"object"==typeof i&&s.appendChild(i)),s}function Y(t,e){let i=-1;for(let s=0,n=t.length;s<n;s++)if(t[s]===e){i=s;break}return i}function j(t,e,i){const s=t,n=e;if(n.style.length>0){const t=n.style;for(let e=0,i=t.length;e<i;e++)s.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(),i?.includes(t)||!o[e].value?s.removeAttribute(t):"style"!==t&&s.setAttribute(o[e].name,o[e].value)}function X(t,e){if(!t||1!==t.nodeType)return;return new RegExp(`(\\s|^)${e}(\\s|$)`).test(t.className)}function K(t,e){if(!t)return;const i=Z(t)?t:[t],s=e.split("|");for(let t=0,e=i.length;t<e;t++){const e=i[t];if(e&&1===e.nodeType)for(const t of s)t&&e.classList.add(t)}}function J(t,e){if(!t)return;const i=Z(t)?t:[t],s=e.split("|");for(let t=0,e=i.length;t<e;t++){const e=i[t];if(e&&1===e.nodeType)for(const t of s)t&&e.classList.remove(t)}}function Q(t=o){return{w:t.documentElement.clientWidth,h:t.documentElement.clientHeight}}const tt={clone:function(t,e=!1){return t.cloneNode(e)},createElement:G,createTextNode:function(t){return o.createTextNode(t||"")},getAttributesToString:function(t,e){const i=t.attributes;if(!i)return"";let s="";for(let t=0,n=i.length;t<n;t++)e?.includes(i[t].name)||(s+=i[t].name+'="'+i[t].value+'" ');return s},arrayFilter:function(t,e){if(!t||0===t.length)return null;e||=()=>!0;const i=[];for(let s,n=0,o=t.length;n<o;n++)s=t[n],e(s)&&i.push(s);return i},arrayFind:function(t,e){if(!t||0===t.length)return null;e||=()=>!0;for(let i,s=0,n=t.length;s<n;s++)if(i=t[s],e(i))return i;return null},arrayIncludes:function(t,e){for(let i=0;i<t.length;i++)if(t[i]===e)return!0;return!1},getArrayIndex:Y,nextIndex:function(t,e){const i=Y(t,e);return-1===i?-1:i+1},prevIndex:function(t,e){const i=Y(t,e);return-1===i?-1:i-1},copyTagAttributes:j,copyFormatAttributes:function(t,e){const i=e.cloneNode(!1);i.className=i.className.replace(/(\s|^)__se__format__[^\s]+/g,""),j(t,i)},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 i=G("DIV");i.innerHTML=e,t.parentNode.replaceChild(i.firstChild,t)}else 1===e?.nodeType&&t.parentNode.replaceChild(e,t)},changeTxt:function(t,e){t&&e&&(t.textContent=e)},setStyle:function(t,e,i){for(let s,n=0,o=(t=Array.isArray(t)?t:[t]).length;n<o;n++)s=t[n],s.style[e]=i,0===s.style.length&&s.removeAttribute("style")},getStyle:function(t,e){if(1===t?.nodeType)return t.style[e]},setDisabled:function(t,e,i){for(let s=0,n=t.length;s<n;s++){const n=t[s];!i&&q(n)||(n.disabled=e),i&&(e?n.setAttribute("data-important-disabled",""):n.removeAttribute("data-important-disabled"))}},hasClass:X,addClass:K,removeClass:J,toggleClass:function(t,e){if(!t||1!==t.nodeType)return;const i=t;let s=!1;const n=new RegExp(`(\\s|^)${e}(\\s|$)`);return n.test(i.className)?i.className=i.className.replace(n," ").trim():(i.className+=" "+e,s=!0),i.className.trim()||i.removeAttribute("class"),s},flashClass:function(t,e,i=120){K(t,e),n.setTimeout((()=>{J(t,e)}),i)},getClientSize:Q,getViewportSize:function(){return"visualViewport"in n?{top:n.visualViewport.pageTop,left:n.visualViewport.pageLeft,scale:n.visualViewport.scale}:{top:0,left:0,scale:1}},applyInlineStylesAll:function(t,e,i){if(!t)return console.warn('"parentTarget" is not exist'),null;let s=t;const l=o.createElement("DIV");if(l.style.display="none",/body/i.test(s.nodeName)){const t=o.createElement("DIV"),e=s.attributes;for(let i=0,s=e.length;i<s;i++)t.setAttribute(e[i].name,e[i].value);t.innerHTML=s.innerHTML,s=t}else s=s.cloneNode(!0);l.appendChild(s),o.body.appendChild(l);const r=Array.from(s.querySelectorAll("*")),a=e?[s].concat(r):r;for(let t,e=0;t=a[e];e++){if(1!==t.nodeType)continue;const e=n.getComputedStyle(t),s=t.style;for(const t of i)s.setProperty(t,e.getPropertyValue(t)||"")}return o.body.removeChild(l),s},waitForMediaLoad:function(t,e=5e3){const i=t||o;return new Promise((t=>{const s=["img","video","audio","iframe"].flatMap((t=>Array.from(i.querySelectorAll(t))));if(0===s.length)return void t();const o=s.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(o),new Promise((t=>n.setTimeout(t,e)))]).then((()=>{t()}))}))},getRootCssVar:function(t){return o.documentElement.style.getPropertyValue(t)},setRootCssVar:function(t,e){o.documentElement.style.setProperty(t,e)},createTooltipInner:function(t){return`<span class="se-tooltip-inner"><span class="se-tooltip-text">${t}</span></span>`}};function et(t){let e=0;for(;t=t.previousSibling;)e+=1;return e}function it(t,e,i){const s=[];let n=!0;return lt(t,(t=>{if(t===e&&(n=!1),n&&!U.isWysiwygFrame(t)){if(i&&3===t.nodeType){let e=null,s=null;i.s=i.e=0;let n=t.previousSibling;for(;3===n?.nodeType;)s=n.textContent.replace(S,""),i.s+=s.length,t.textContent=s+t.textContent,e=n,n=n.previousSibling,tt.removeItem(e);let o=t.nextSibling;for(;3===o?.nodeType;)s=o.textContent.replace(S,""),i.e+=s.length,t.textContent+=s,e=o,o=o.nextSibling,tt.removeItem(e)}s.push(t)}return!1})),s.map(et).reverse()}function st(t,e){let i,s=e;for(let e=0,n=t.length;e<n&&(i=s.childNodes,0!==i.length);e++)s=i.length<=t[e]?i[i.length-1]:i[t[e]];return s}function nt(t,e,i){const s=[];return i??=1/0,!t||i<=0||0===t.childNodes.length||(e||=()=>!0,function t(n,o){if(o>i)return;if(o>0&&e(n)&&s.push(n),o===i)return;const l=n.childNodes;for(let e=0,i=l.length;e<i;e++)t(l[e],o+1)}(t,0)),s}function ot(t){if(!t||U.isWysiwygFrame(t))return-1;let e=0;for(t=t.parentNode;t&&!U.isWysiwygFrame(t);)e+=1,t=t.parentNode;return e}function lt(t,e,i){let s;if("function"==typeof e)s=e;else if("object"==typeof e)s=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 i=new RegExp(e,"i");s=e=>i.test(e[t])}i||=1/0;let n=0;for(;t&&!s(t);){if(n>=i||U.isWysiwygFrame(t))return null;t=t.parentElement,n++}return t}const rt={getPositionIndex:et,getNodePath:it,getNodeFromPath:st,getChildNode:function(t,e){let i=null;if(!t)return i;const s=t;return s.children&&0!==s.children.length?(e||=()=>!0,function t(n){if(s!==n&&e(n))return i=n,!0;if(n.children)for(let e=0,i=n.children.length;e<i;e++)t(n.children[e])}(s),i):i},getListChildren:function(t,e,i){const s=[];if(i??=1/0,!t||i<=0)return s;const n=t;return n.children&&0!==n.children.length?(e||=()=>!0,function t(o,l){if(!(l>i)&&(l>0&&n!==o&&e(o)&&s.push(o),l!==i&&o.children))for(let e=0,i=o.children.length;e<i;e++)t(o.children[e],l+1)}(n,0),s):s},getListChildNodes:nt,getNodeDepth:ot,sortNodeByDepth:function(t,e){const i=e?1:-1,s=-1*i;t.sort((function(t,e){if(!U.isListCell(t)||!U.isListCell(e))return 0;const n=ot(t),o=ot(e);return n>o?i:n<o?s:0}))},compareElements:function(t,e){let i=t,s=e;for(;i&&s&&i.parentElement!==s.parentElement;)i=i.parentElement,s=s.parentElement;if(!i?.parentNode||!s?.parentNode)return{ancestor:null,a:t,b:e,result:0};const n=i.parentNode.childNodes,o=tt.getArrayIndex(n,i),l=tt.getArrayIndex(n,s);return{ancestor:i.parentElement,a:i,b:s,result:o>l?1:o<l?-1:0}},getParentElement:lt,getParentElements:function(t,e,i){let s;if("function"==typeof e)s=e;else if("object"==typeof e)s=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 i=new RegExp(e,"i");s=e=>i.test(e[t])}const n=[];i||=1/0;let o=0;for(;o<=i&&t&&!U.isWysiwygFrame(t);)s(t)&&n.push(t),t=t.parentElement,o++;return n},getCommandTarget:function(t){let e=t;for(;e&&!/^(UL)$/i.test(e.nodeName)&&!tt.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,i){let s;if("function"==typeof e)s=e;else if("object"==typeof e)s=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 i=new RegExp(e,"i");s=function(e){return i.test(e[t])}}const n=nt(t,(t=>s(t)),null);return n[i?n.length-1:0]},getEdgeChildNodes:function(t,e){if(t){for(e||=t;t&&1===t.nodeType&&t.childNodes.length>0&&!U.isBreak(t);)t=t.firstChild;for(;e&&1===e.nodeType&&e.childNodes.length>0&&!U.isBreak(e);)e=e.lastChild;return{sc:t,ec:e||t}}},getPreviousDeepestNode:function(t,e){let i=t.previousSibling;if(!i){for(let s=t.parentNode;s;s=s.parentNode){if(s===e)return null;if(s.previousSibling){i=s.previousSibling;break}}if(!i)return null}if(U.isNonEditable(i))return i;for(;i.lastChild;)i=i.lastChild;return i},getNextDeepestNode:function(t,e){let i=t.nextSibling;if(!i){for(let s=t.parentNode;s;s=s.parentNode){if(s===e)return null;if(s.nextSibling){i=s.nextSibling;break}}if(!i)return null}if(U.isNonEditable(i))return i;for(;i.firstChild;)i=i.firstChild;return i},findTextIndexOnLine:function(t,e,i,s){if(!t)return 0;s||=()=>!0;let n=0,o=!1;return function t(l){if(!o&&8!==l.nodeType&&!s(l))if(3===l.nodeType){if(l===e)return n+=i,void(o=!0);n+=l.textContent.length}else if(1===l.nodeType){const e=l.childNodes;for(let i=0,s=e.length;i<s;i++)if(t(e[i]),o)return}}(t),n},findTabEndIndex:function(t,e,i){if(!t)return 0;const s=t.textContent,n=new RegExp(`((\\u00A0|\\s){${i},})`,"g");let o;for(n.lastIndex=e;null!==(o=n.exec(s));)if(o.index>=e){const t=o.index+o[0].length-1;return t+(s.slice(0,t+1).match(/[^\u00A0\s]/g)||[]).length+i}return 0},findVisualLastCell:function(t){if(!t||0===t.length)return null;const e={};let i=null,s=-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 i=1;i<l;i++){const s=t+i;e[s]||=[];for(let t=0;t<r;t++)e[s][a+t]=!0}const c=t+l-1,d=a+r-1;(c>s||c===s&&d>n)&&(s=c,n=d,i=o)}return i},getScrollParents:function(t){const e=[];let i=t?.parentElement;for(;i&&!/^(body|html)$/i.test(i.nodeName);){const t=n.getComputedStyle(i),{overflow:s,overflowX:o,overflowY:l}=t;[s,o,l].some((t=>["auto","scroll","overlay"].includes(t)))&&e.push(i),i=i.parentElement}return e},getIframeDocument:function(t){return t.contentWindow?.document||t.contentDocument}},at={query:rt,check:U,utils:tt};function ht(t,e=0){if(!t)return 0;const i=(t+"").match(/-?\d+(\.\d+)?/);if(!i||!i[0])return 0;const s=Number(i[0]);return e<0?s:0===e?Math.round(s):Number(s.toFixed(e))}const ct={is:function(t){return/^-?\d+(\.\d+)?$/.test(t+"")},get:ht,getOverlapRangeAtIndex:function(t,e,i,s){if(t<=s?e<i:e>i)return 0;const n=(t>i?t:i)-(e<s?e:s);return(n<0?-1*n:n)+1},isEven:function(t){return!(1&t)},isOdd:function(t){return!(1&~t)}},dt="ArrowLeft|ArrowUp|ArrowRight|ArrowDown",ut="F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12",pt=dt.split("|"),gt="Backspace|Delete".split("|"),mt=`Backspace|Tab|Enter|ShiftLeft|ShiftRight|ControlLeft|ControlRight|AltLeft|AltRight|Pause|CapsLock|Escape|PageUp|PageDown|End|Home|${dt}|Insert|Delete|${ut}|NumLock|ScrollLock`.split("|"),ft="Backspace|Enter|Delete".split("|"),bt="Backspace|Enter|Delete".split("|"),yt=`ControlLeft|ControlRight|AltLeft|AltRight|Pause|CapsLock|Escape|Insert|${ut}|NumLock|ScrollLock`.split("|");const vt={write:async function(t){if(!c)return console.error("Clipboard is not supported in this browser."),!1;let e="",i="";"string"==typeof t?(e=t,i=t):R(t)?(t.querySelectorAll("iframe").forEach((t=>{const e=document.createElement("div"),i={};for(const e of Array.from(t.attributes))i[e.name]=e.value;e.setAttribute("data-se-iframe-holder","1"),e.setAttribute("data-se-iframe-holder-attrs",JSON.stringify(i)),e.innerText=`[iframe: ${t.src}]`,t.replaceWith(e)})),e=t.outerHTML,i=t.textContent):(e=t.textContent,i=t.textContent);try{await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([e],{type:"text/html"}),"text/plain":new Blob([i],{type:"text/plain"})})])}catch{console.warn("[SUNEDITOR.copy.warn] This browser is not supported Clipboard API");try{await navigator.clipboard.writeText(i||function(t){const e=document.createElement("div");return e.innerHTML=t,e.textContent||e.innerText||""}(e))}catch(t){console.error("[SUNEDITOR.copy.fail] "+t)}}}},_t=x,Ct=H,wt=I,xt=at,kt=ct,Et={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 pt.includes(t)},isRemoveKey:function(t){return gt.includes(t)},isNonTextKey:function(t){return mt.includes(t)},isHistoryRelevantKey:function(t){return ft.includes(t)},isDocumentTypeObserverKey:function(t){return bt.includes(t)},isNonResponseKey:function(t){return yt.includes(t)}},St=vt,Tt={env:_t,unicode:Ct,converter:wt,dom:xt,numbers:kt,keyCodeMap:Et,clipboard:St},Ht={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_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>',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 xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,11A4,4 0 0,1 6,7A4,4 0 0,1 10,3H18V5H16V21H14V5H12V21H10V11Z" /></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 xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 3C3.9 3 3 3.9 3 5S2.1 7 1 7V9C2.1 9 3 9.9 3 11S3.9 13 5 13H7V11H5V10C5 8.9 4.1 8 3 8C4.1 8 5 7.1 5 6V5H7V3M11 3C12.1 3 13 3.9 13 5S13.9 7 15 7V9C13.9 9 13 9.9 13 11S12.1 13 11 13H9V11H11V10C11 8.9 11.9 8 13 8C11.9 8 11 7.1 11 6V5H9V3H11M22 6V18C22 19.11 21.11 20 20 20H4C2.9 20 2 19.11 2 18V15H4V18H20V6H17.03V4H20C21.11 4 22 4.89 22 6Z" /></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>',find_replace:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,6C12.38,6 13.63,6.56 14.54,7.46L12,10H18V4L15.95,6.05C14.68,4.78 12.93,4 11,4C7.47,4 4.57,6.61 4.08,10H6.1C6.56,7.72 8.58,6 11,6M16.64,15.14C17.3,14.24 17.76,13.17 17.92,12H15.9C15.44,14.28 13.42,16 11,16C9.62,16 8.37,15.44 7.46,14.54L10,12H4V18L6.05,15.95C7.32,17.22 9.07,18 11,18C12.55,18 14,17.5 15.14,16.64L20,21.5L21.5,20L16.64,15.14Z" /></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>',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>',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 Lt=i("cfbI"),Mt=i.n(Lt);function Nt(t,e,i,s,n){const o=new Map([["menuTray",i],["toolbar_main",t],["toolbar_buttonTray",t.querySelector(".se-btn-tray")],["toolbar_arrow",t.querySelector(".se-arrow")]]);return s&&(o.set("toolbar_sub_main",s),o.set("toolbar_sub_buttonTray",s.querySelector(".se-btn-tray")),o.set("toolbar_sub_arrow",s.querySelector(".se-arrow")),o.set("toolbar_sub_wrapper",s.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 At(t,e,i,s,n,o,l,r){const a=new Map([["key",r],["options",t.options],["originElement",t.target],["topArea",e],["container",e.querySelector(".se-container")],["wrapper",e.querySelector(".se-wrapper")],["wysiwygFrame",i],["wysiwyg",i],["codeWrapper",s],["code",n],["codeNumbers",s?.querySelector(".se-code-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",ht(i.style.minHeight||"65",0)],["isCodeView",!1],["isFullScreen",!1],["isReadOnly",!1],["isDisabled",!1],["isChanged",-1],["historyIndex",-1],["savedIndex",-1],["documentTypeInner",l.inner],["documentTypePage",l.page],["documentTypePageMirror",l.pageMirror]]);o&&Bt(o,a);const h=e.querySelector(".se-placeholder");return h&&a.set("placeholder",h),a}function Bt(t,e){t?e.set("statusbar",t):e.delete("statusbar");const i=t?t.querySelector(".se-navigation"):null,s=t?t.querySelector(".se-char-counter-wrapper"):null,n=t?t.querySelector(".se-char-counter-wrapper .se-char-counter"):null;i?e.set("navigation",i):e.delete("navigation"),s?e.set("charWrapper",s):e.delete("charWrapper"),n?e.set("charCounter",n):e.delete("charCounter")}const Vt={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",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"]},It={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},Ot={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,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,__lineFormatFilter:!0,__pluginRetainFilter:!0,__listCommonStyle:"fixed",externalLibs:"fixed"};const Rt=_t._d;function Ft(t,e,i,s,n,o){if(!i||i.length<2)return;const l=e?.querySelector(".se-tooltip-text");for(let h,c,d,u,p,g,m,f,b,y,v,_,C,w,x=0;x<i.length;x+=2+w){if(w=0,h=i[x].split("+"),b=null,y=h.at(-1).trim?.(),y.startsWith("~"))b=t,y=h.pop().trim().substring(1);else if(y.startsWith("$~")){const t=h.pop().trim().substring(2).split(".");b=t[0],y=t[1]}else y.startsWith("$")?(w=1,y=i[x+2]):y="";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 i=0,l=c.length;i<l;i++)_=d?c[i]+(u?"1000":""):c[i],s.has(_)||(C=n.indexOf(t),C=-1===C?"":kt.isOdd(C)?n[C+1]:n[C-1],C&&o.add(_),s.set(_,{c:d,s:u,edge:p,space:g,enter:m,textTrigger:f,plugin:b,command:t,method:y,r:C,type:e?.getAttribute("data-type"),button:e,key:_}));(v=i[x+1])&&(l&&(r=u,a=v,l.appendChild(xt.utils.createElement("SPAN",{class:"se-shortcut"},_t.cmdIcon+(r?_t.shiftIcon:"")+'+<span class="se-shortcut-key">'+a+"</span>"))))}var r,a}function zt(t,e){return[t,e].reduce(((t,e)=>{for(const i in e)t[i]=(e[i]||"").toLowerCase();return t}),{})}function $t(t,e,i){const s=t.buttonList||Vt.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(s.toString().split(",")));const o=!1!==t.strictMode;n.set("strictMode",{tagFilter:o,formatFilter:o,classFilter:o,textStyleTagFilter:o,attrFilter:o,styleFilter:o,..."boolean"==typeof t.strictMode?{}:t.strictMode}),n.set("freeCodeViewMode",!!t.freeCodeViewMode),n.set("__lineFormatFilter",t.__lineFormatFilter??!0),n.set("__pluginRetainFilter",t.__pluginRetainFilter??!0),n.set("mode",t.mode||"classic"),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())):Vt.SIZE_UNITS),n.set("allowedClassName",new RegExp(`${t.allowedClassName&&"string"==typeof t.allowedClassName?t.allowedClassName+"|":""}${Vt.CLASS_NAME}`)),n.set("closeModalOutsideClick",!!t.closeModalOutsideClick),n.set("copyFormatKeepOn",!!t.copyFormatKeepOn),n.set("syncTabIndent",t.syncTabIndent??!0),n.set("autoLinkify",t.autoLinkify??!!i.link),n.set("autoStyleify",Array.isArray(t.autoStyleify)?t.autoStyleify:["bold","underline","italic","strike"]);let l=t.retainStyleMode;"string"!=typeof l||Vt.RETAIN_STYLE_MODE.includes(l)||(console.error(`Invalid retainStyleMode: ${l}. Valid options are ${Vt.RETAIN_STYLE_MODE.join(", ")}. Using default 'once'.`),l="repeat"),n.set("retainStyleMode",l);const r={...Vt.EXTRA_TAG_MAP,...t.allowedExtraTags,"-":!0},a=Object.keys(r),h=a.filter((t=>r[t])).join("|"),c=a.filter((t=>!r[t])).join("|");n.set("_allowedExtraTag",h),n.set("_disallowedExtraTag",c),n.set("events",t.events||{}),n.set("textStyleTags",("string"==typeof t.__textStyleTags?t.__textStyleTags:Vt.TEXT_STYLE_TAGS)+(t.textStyleTags?"|"+t.textStyleTags:""));const d=zt({bold:"strong",underline:"u",italic:"em",strike:"del",subscript:"sub",superscript:"sup"},t.convertTextTags||{});n.set("convertTextTags",d),n.set("_textStyleTags",Object.values(d).concat(["span","li"])),n.set("tagStyles",[{...Vt.TAG_STYLES,...t.__tagStyles||{}},t.tagStyles||{}].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{})),n.set("_textStylesRegExp",new RegExp(`\\s*[^-a-zA-Z](${Vt.SPAN_STYLES}${t.spanStyles?"|"+t.spanStyles:""})\\s*:[^;]+(?!;)*`,"gi")),n.set("_lineStylesRegExp",new RegExp(`\\s*[^-a-zA-Z](${Vt.LINE_STYLES}${t.lineStyles?"|"+t.lineStyles:""})\\s*:[^;]+(?!;)*`,"gi")),n.set("_defaultStyleTagMap",{strong:d.bold,b:d.bold,u:d.underline,ins:d.underline,em:d.italic,i:d.italic,del:d.strike,strike:d.strike,s:d.strike,sub:d.subscript,sup:d.superscript}),n.set("_styleCommandMap",zt(wt.swapKeyValue(d),{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:d.bold,underline:d.underline,italic:d.italic,strike:d.strike,subscript:d.sub,superscript:d.sup}),n.set("textDirection","string"!=typeof t.textDirection?"ltr":t.textDirection),n.set("_rtl","rtl"===n.get("textDirection")),n.set("reverseCommands",["indent-outdent"].concat(t.reverseButtons||[])),n.set("_reverseCommandArray",("-"+n.get("reverseCommands").join("-")).split("-")),kt.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("_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||Vt.SCOPE_SELECTION_TAGS);const u=("string"==typeof t.elementWhitelist?t.elementWhitelist:"").toLowerCase(),p=n.get("externalLibs").mathjax?Vt.CLASS_MJX+"|":"";n.set("elementWhitelist",u+(u?"|":"")+p+n.get("_allowedExtraTag"));const g=(m=("string"==typeof t.elementBlacklist?t.elementBlacklist:"").toLowerCase(),f=(f=n.get("defaultLine")).toLowerCase(),m.split("|").filter((function(t){return t!==f||(console.warn(`[SUNEDITOR.constructor.createBlacklist.warn] defaultLine("<${f}>") cannot be included in the blacklist and will be removed.`),!1)})).join("|"));var m,f;if(n.set("elementBlacklist",g+(g?"|":"")+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",Ut(t.formatClosureBrLine,(t.__defaultFormatClosureBrLine="string"==typeof t.__defaultFormatClosureBrLine?t.__defaultFormatClosureBrLine:Vt.FORMAT_CLOSURE_BR_LINE).toLowerCase(),n.get("elementBlacklist"))),n.set("formatBrLine",Ut((t.formatBrLine||"")+"|"+n.get("formatClosureBrLine").str,(t.__defaultFormatBrLine="string"==typeof t.__defaultFormatBrLine?t.__defaultFormatBrLine:Vt.FORMAT_BR_LINE).toLowerCase(),n.get("elementBlacklist"))),n.set("formatLine",Ut(Vt.REQUIRED_FORMAT_LINE+"|"+(t.formatLine||"")+"|"+n.get("formatBrLine").str,(t.__defaultFormatLine="string"==typeof t.__defaultFormatLine?t.__defaultFormatLine:Vt.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",Ut(t.formatClosureBlock,(t.__defaultFormatClosureBlock="string"==typeof t.__defaultFormatClosureBlock?t.__defaultFormatClosureBlock:Vt.FORMAT_CLOSURE_BLOCK).toLowerCase(),n.get("elementBlacklist"))),n.set("formatBlock",Ut((t.formatBlock||"")+"|"+n.get("formatClosureBlock").str,(t.__defaultFormatBlock="string"==typeof t.__defaultFormatBlock?t.__defaultFormatBlock:Vt.FORMAT_BLOCK).toLowerCase(),n.get("elementBlacklist"))),n.set("allowedEmptyTags",Vt.ALLOWED_EMPTY_NODE_LIST+(t.allowedEmptyTags?", "+t.allowedEmptyTags:"")),n.set("__defaultElementWhitelist",Vt.REQUIRED_ELEMENT_WHITELIST+"|"+("string"==typeof t.__defaultElementWhitelist?t.__defaultElementWhitelist:Vt.ELEMENT_WHITELIST).toLowerCase()),n.set("__defaultAttributeWhitelist",("string"==typeof t.__defaultAttributeWhitelist?t.__defaultAttributeWhitelist:Vt.ATTRIBUTE_WHITELIST).toLowerCase()),n.set("_editorElementWhitelist","*"===n.get("elementWhitelist")?"*":function(t){const e=t.get("elementBlacklist").split("|"),i=(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,i,s)=>t&&s.indexOf(t)===i&&!e.includes(t)));return i.join("|")}(n)),n.set("toolbar_width",t.toolbar_width?kt.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?Rt.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:kt.is(t.toolbar_sticky)?kt.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?kt.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 v=new Map;for(let i=0,s=e.length;i<s;i++)v.set(e[i].key,Dt(e[i].options||{},t));n.set("tabDisable",!!t.tabDisable),n.set("shortcutsHint",void 0===t.shortcutsHint||!!t.shortcutsHint);const _=void 0===t.shortcutsDisable||t.shortcutsDisable?[{selectAll:["c+KeyA","A"],bold:["c+KeyB","B"],strike:["c+s+KeyS","S"],underline:["c+KeyU","U"],italic:["c+KeyI","I"],redo:["c+KeyY","Y","c+s+KeyZ","Z"],undo:["c+KeyZ","Z"],indent:["c+BracketRight","]"],outdent:["c+BracketLeft","["],save:["c+KeyS","S"],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 i in e)t[i]=e[i];return t}),{}):{};n.set("shortcuts",_),n.set("fullScreenOffset",void 0===t.fullScreenOffset?0:kt.is(t.fullScreenOffset)?kt.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 C=n.get("externalLibs").codeMirror;C&&(n.set("codeMirror",C),C.EditorView?n.set("codeMirror6Editor",!0):C.src?n.set("codeMirror5Editor",!0):(console.warn("[SUNEDITOR.options.externalLibs.codeMirror.fail] The codeMirror option is set incorrectly."),n.set("codeMirror",null))),n.set("__listCommonStyle",t.__listCommonStyle||["fontSize","color","fontFamily","fontWeight","fontStyle"]);const w=t.icons&&"object"==typeof t.icons?[Ht,t.icons].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{}):Ht;n.set("icons",w);const x=new Set(Vt.CONTENT_STYLES.split("|")),k=t.spanStyles?.split("|")||[],E=n.get("__listCommonStyle"),S=Vt.SPAN_STYLES.split("|");for(let t=0,e=S.length;t<e;t++)x.add(S[t]);for(const t of Object.values(n.get("tagStyles"))){const e=t.split("|");for(let t=0,i=e.length;t<i;t++)x.add(e[t])}for(let t=0,e=k.length;t<e;t++)x.add(k[t]);for(let t=0,e=E.length;t<e;t++)x.add(E[t]);const T=("string"==typeof t.allUsedStyles?t.allUsedStyles.split("|"):t.allUsedStyles)||[];for(let t=0,e=T.length;t<e;t++)x.add(T[t]);return n.set("allUsedStyles",x),n.set("toastMessageTime",{copy:1500,...t.toastMessageTime}),{o:n,i:w,l:t.lang||Mt(),v:t.value="string"==typeof t.value?t.value:null,buttons:n.get("_rtl")?s.reverse():s,subButtons:b,statusbarContainer:"string"==typeof t.statusbar_container?Rt.querySelector(t.statusbar_container):t.statusbar_container,frameMap:v}}function Pt(t,e){let i=null,s=null,n=null;if(t.get("statusbar")&&(e||=xt.utils.createElement("DIV",{class:"se-status-bar sun-editor-common"}),i=e.querySelector(".se-navigation")||xt.utils.createElement("DIV",{class:"se-navigation sun-editor-common"}),e.appendChild(i),t.get("charCounter"))){if(s=e.querySelector(".se-char-counter-wrapper")||xt.utils.createElement("DIV",{class:"se-char-counter-wrapper"}),t.get("charCounter_label")){const e=s.querySelector(".se-char-label")||xt.utils.createElement("SPAN",{class:"se-char-label"});e.textContent=t.get("charCounter_label"),s.appendChild(e)}if(n=s.querySelector(".se-char-counter")||xt.utils.createElement("SPAN",{class:"se-char-counter"}),n.textContent="0",s.appendChild(n),t.get("charCounter_max")>0){const e=s.querySelector(".se-char-max")||xt.utils.createElement("SPAN",{class:"se-char-max"});e.textContent=" / "+t.get("charCounter_max"),s.appendChild(e)}e.appendChild(s)}return{statusbar:e,navigation:i,charWrapper:s,charCounter:n}}function Dt(t,e){const i=new Map;i.set("_origin",t);const s=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,b=void 0===t.iframe_cssFileName?e.iframe_cssFileName:t.iframe_cssFileName,y=s||void 0===t.statusbar?e.statusbar:t.statusbar,v=s||void 0===t.statusbar_showPathLabel?e.statusbar_showPathLabel:t.statusbar_showPathLabel,_=!s&&(void 0===t.statusbar_resizeEnable?e.statusbar_resizeEnable:t.statusbar_resizeEnable),C=s||void 0===t.charCounter?e.charCounter:t.charCounter,w=s||void 0===t.charCounter_max?e.charCounter_max:t.charCounter_max,x=s||void 0===t.charCounter_label?e.charCounter_label:t.charCounter_label,k=s||void 0===t.charCounter_type?e.charCounter_type:t.charCounter_type;i.set("value",n),i.set("placeholder",o),i.set("editableFrameAttributes",{spellcheck:"false",...l}),i.set("width",r?kt.is(r)?r+"px":r:"100%"),i.set("minWidth",(kt.is(a)?a+"px":a)||""),i.set("maxWidth",(kt.is(h)?h+"px":h)||""),i.set("height",c?kt.is(c)?c+"px":c:"auto"),i.set("minHeight",(kt.is(d)?d+"px":d)||""),i.set("maxHeight",(kt.is(u)?u+"px":u)||""),i.set("editorStyle",p),i.set("_defaultStyles",wt._setDefaultOptionStyle(i,"string"==typeof p?p:"")),i.set("iframe",!(!m&&!g)),i.set("iframe_fullPage",!!m),i.set("iframe_attributes",f||{}),i.set("iframe_cssFileName",g?("string"==typeof b?[b]:b)||["suneditor"]:null);const E=void 0===y||!!y;return i.set("statusbar",E),i.set("statusbar_showPathLabel",!!E&&("boolean"!=typeof v||v)),i.set("statusbar_resizeEnable",!!E&&(void 0===_||!!_)),i.set("charCounter",w>0||"boolean"==typeof C&&C),i.set("charCounter_max",kt.is(w)&&w>-1?1*w:null),i.set("charCounter_label","string"==typeof x?x.trim():null),i.set("charCounter_type","string"==typeof k?k:"char"),i}function qt(t,e,i,s){const n=s.get("_defaultStyles");i.style.cssText=n.top;const o=xt.utils.createElement(s.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(s.get("iframe")){const t=o,e=s.get("iframe_attributes");let i=e.sandbox;if(i){const t=["allow-same-origin"],e=i.split(/\s+/),s=t.filter((t=>!e.includes(t)));s.length>0&&(i=e.concat(s).join(" "))}else i="allow-same-origin";t.setAttribute("sandbox",i),t.setAttribute("frameBorder","0");for(const i in e)"sandbox"!==i&&t.setAttribute(i,e[i]);t.allowFullscreen=!0,t.setAttribute("scrolling","auto"===s.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=xt.utils.createElement("TEXTAREA",{class:"se-wrapper-inner se-code-viewer",style:n.frame}),r=xt.utils.createElement("SPAN",{class:"se-placeholder"});return s.get("placeholder")&&(r.textContent=s.get("placeholder")),{bottomBar:Pt(s,null),wysiwygFrame:o,codeView:l,placeholder:r}}function Wt(t,e,i){let s=null,n=!1;if(t.get("codeMirror6Editor")){const o=t.get("codeMirror"),l=i.style.cssText,r=new o.EditorView({parent:i.parentElement,extensions:o.extensions,state:o.state});e.set("codeMirror6Editor",r),s=r.dom,s.style.cssText=l,n=!0}else if(t.get("codeMirror5Editor")){const o=t.get("codeMirror"),l=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!0},o.options||{}].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{});"auto"===e.get("height")&&(l.viewportMargin=1/0,l.height="auto");const r=i.style.cssText,a=o.src.fromTextArea(i,l);e.set("codeMirror5Editor",a),s=a.display.wrapper,s.style.cssText=r,n=!0}return t.set("hasCodeMirror",n),s?(xt.utils.removeItem(i),s.className+=" se-code-viewer-mirror",s):i}function Ut(t,e,i){const s=i.split("|"),n=(e+"|"+("string"==typeof t?t.toLowerCase():"")).replace(/^\||\|$/g,"").split("|").filter((t=>t&&!s.includes(t))).join("|");return{reg:new RegExp(`^(${n})$`,"i"),str:n}}function Zt(){const t=xt.utils.createElement("UL",{class:"se-menu-list"});return{div:xt.utils.createElement("DIV",{class:"se-btn-module se-btn-module-border"},t),ul:t}}function Gt(t,e,i,s,n,o,l){n||="";const r=xt.utils.createElement("LI"),a=e||"",h=/^INPUT|FIELD$/i.test(s),c="se-toolbar-separator-vertical"===t?xt.utils.createElement("DIV",{class:t,tabindex:"-1"},null):xt.utils.createElement(h?"DIV":"BUTTON",{class:"se-toolbar-btn se-btn se-tooltip"+(t?" "+t:""),"data-command":i,"data-type":s,"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(s)&&xt.utils.addClass(r,"se-toolbar-hidden-btn"),a&&(n+=xt.utils.createTooltipInner(a)),n&&(c.innerHTML=n),r.appendChild(c),{li:r,button:c}}function Yt(t,e,i,s){if(!t)return;const n=!1===e.inner;if(1===e.inner?.nodeType?t.appendChild(e.inner):t.innerHTML=n?"":(e.inner||i[e.icon]||e.icon||'<span class="se-icon-text">!</span>')+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+(s[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&&(xt.utils.addClass(e.afterItem,"se-toolbar-btn"),t.parentElement.appendChild(e.afterItem),xt.utils.addClass(t,"se-side-btn-a"),xt.utils.addClass(e.afterItem,"se-side-btn-after")),e.beforeItem&&(xt.utils.addClass(e.beforeItem,"se-toolbar-btn"),t.parentElement.insertBefore(e.beforeItem,t),e.afterItem?(xt.utils.addClass(t,"se-side-btn"),xt.utils.removeClass(t,"se-side-btn-a")):xt.utils.addClass(t,"se-side-btn-b"),xt.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&&(xt.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 jt(t,e,i,s,n,o){t=JSON.parse(JSON.stringify(t));const l=function(t,e,i){const s=t.get("_rtl");return{bold:["",i.bold,"bold","",e.bold],underline:["",i.underline,"underline","",e.underline],italic:["",i.italic,"italic","",e.italic],strike:["",i.strike,"strike","",e.strike],subscript:["",i.subscript,"subscript","",e.subscript],superscript:["",i.superscript,"superscript","",e.superscript],removeFormat:["",i.removeFormat,"removeFormat","",e.remove_format],copyFormat:["",i.copyFormat,"copyFormat","",e.format_paint],indent:["se-icon-flip-rtl",i.indent,"indent","",s?e.outdent:e.indent],outdent:["se-icon-flip-rtl",i.outdent,"outdent","",s?e.indent:e.outdent],fullScreen:["se-code-view-enabled se-component-enabled",i.fullScreen,"fullScreen","",e.expansion],showBlocks:["",i.showBlocks,"showBlocks","",e.show_blocks],codeView:["se-code-view-enabled se-component-enabled",i.codeView,"codeView","",e.code_view],undo:["se-component-enabled",i.undo,"undo","",e.undo],redo:["se-component-enabled",i.redo,"redo","",e.redo],preview:["se-component-enabled",i.preview,"preview","",e.preview],print:["se-component-enabled",i.print,"print","",e.print],copy:["",i.copy,"copy","",e.copy],dir:["",i[s?"dir_ltr":"dir_rtl"],"dir","",e[s?"dir_ltr":"dir_rtl"]],dir_ltr:["",i.dir_ltr,"dir_ltr","",e.dir_ltr],dir_rtl:["",i.dir_rtl,"dir_rtl","",e.dir_rtl],save:["se-component-enabled",i.save,"save","",e.save],newDocument:["se-component-enabled",i.newDocument,"newDocument","",e.new_document],selectAll:["se-component-enabled",i.selectAll,"selectAll","",e.select_all],pageBreak:["se-component-enabled",i.pageBreak,"pageBreak","",e.page_break],pageUp:["se-component-enabled",i.pageUp,"pageUp","",e.page_up],pageDown:["se-component-enabled",i.pageDown,"pageDown","",e.page_down],pageNavigator:["se-component-enabled","","pageNavigator","input",""]}}(i,s,n),r={},a=[],h=[];let c=null,d=null,u=null,p=null,g=null;const m=xt.utils.createElement("DIV",{class:"se-toolbar-more-layer"}),f=xt.utils.createElement("DIV",{class:"se-btn-tray"}),b=xt.utils.createElement("DIV",{class:"se-toolbar-separator-vertical"});t:for(let i,y,v,_,C,w=0;w<t.length;w++)if(i=!1,C="",_=t[w],p=Zt(),"object"==typeof _){for(let f,b=0;b<_.length;b++){if(d=_[b],f=!1,u=e[d],/^%\d+/.test(d)&&0===b){_[0]=d.replace(/[^\d]/g,""),a.push(_),t.splice(w--,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(/^:([^-]+)-([^-]+)/);v="__se__more_"+w;const e=t[1].trim(),i=t[2].trim();c=["se-btn-more",/^lang\./i.test(e)?n[e.replace(/^lang\./i,"")]:e,v,"MORE",i]}else"|"===d?c=["se-toolbar-separator-vertical","","","separator",""]:("copy"!==d||_t.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=Gt(c[0],c[1],c[2],c[3],c[4],c[5],s),(i?y: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&&(i=!0,y=xt.utils.createElement("DIV"),y.className="se-more-layer "+v,y.setAttribute("data-ref",v),y.innerHTML='<div class="se-more-form"><ul class="se-menu-list"'+(C?' style="float: '+C+';"':"")+"></ul></div>",m.appendChild(y),y=y.firstElementChild.firstElementChild)}f.appendChild(p.div)}else{if("|"===_){const t=b.cloneNode(!1);f.appendChild(t);continue}if(/^\/$/.test(_)){const t=xt.utils.createElement("DIV",{class:"se-btn-module-enter"});f.appendChild(t)}}switch(f.children.length){case 0:f.style.display="none";break;case 1:xt.utils.removeClass(f.firstElementChild,"se-btn-module-border")}m.children.length>0&&f.appendChild(m),a.length>0&&a.unshift(t);const y=xt.utils.createElement("DIV",{class:"se-toolbar sun-editor-common"+(i.get("shortcutsHint")?"":" se-shortcut-hide")},f);return i.get("toolbar_hide")&&(y.style.display="none"),{element:y,pluginCallButtons:r,responsiveButtons:a,buttonTray:f,updateButtons:h}}const Xt=function(t,e){"object"!=typeof e&&(e={});const i={};if(e.plugins){const t=e.excludedPlugins||[],s=e.plugins,n=(Array.isArray(s)?s:Object.keys(s)).filter((e=>!t.includes(e))).map((t=>s[t]));for(let t,e=0,s=n.length;e<s;e++)t=n[e].default||n[e],i[t.key]=t}const s=$t(e,t,i),n=s.o,o=s.i,l=s.l,r=xt.utils.createElement("DIV",{class:"se-loading-box sun-editor-common"},'<div class="se-loading-effect"></div>'),a=xt.utils.createElement("DIV",{class:"sun-editor sun-editor-carrier-wrapper sun-editor-common"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),h=xt.utils.createElement("DIV",{class:"se-menu-tray"});a.appendChild(h);const c=xt.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=xt.utils.createElement("DIV",{class:"se-modal se-modal-area sun-editor-common"}),u=xt.utils.createElement("DIV",{class:"se-modal-back"}),p=xt.utils.createElement("DIV",{class:"se-modal-inner"});d.appendChild(u),d.appendChild(p),a.appendChild(d);const g=xt.utils.createElement("DIV",{class:"se-alert se-modal-area sun-editor-common",style:"display: none;"}),m=xt.utils.createElement("DIV",{class:"se-modal-back"}),f=xt.utils.createElement("DIV",{class:"se-modal-inner"});g.appendChild(m),g.appendChild(f),a.appendChild(g),a.appendChild(xt.utils.createElement("DIV",{class:"se-back-wrapper"})),a.appendChild(r.cloneNode(!0));const b=xt.utils.createElement("DIV",{class:"se-drag-cursor"});a.appendChild(b),Rt.body.appendChild(a);let y=null,v=null;const _=jt(s.buttons,i,n,o,l,!1),C=_.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(xt.utils.createElement("DIV",{class:"se-arrow"}))),s.subButtons&&(v=jt(s.subButtons,i,n,o,l,!1),y=v.element,y.style.visibility="hidden",y.className+=" se-toolbar-balloon se-toolbar-sub",y.style.width=n.get("toolbar_sub_width"),y.appendChild(xt.utils.createElement("DIV",{class:"se-arrow"})));const w=t[0].key||null,x=[],k=new Map,E=s.statusbarContainer;let S=null;for(let e=0,i=t.length;e<i;e++){const i=t[e],a=s.frameMap.get(i.key),h=xt.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),c=xt.utils.createElement("DIV",{class:"se-container"}),d=xt.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(xt.utils.createElement("DIV",{class:"se-toolbar-shadow"}));const u=qt(i.key,n,h,a),p=u.bottomBar.statusbar,g=u.wysiwygFrame,m=u.placeholder;let f=u.codeView;const b=xt.utils.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-t",title:l.insertLine},o.line_break),y=xt.utils.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-b",title:l.insertLine},o.line_break);d.appendChild(b),d.appendChild(y),m&&d.appendChild(m),c.appendChild(xt.utils.createElement("DIV",{class:"se-toolbar-sticky-dummy"})),c.appendChild(d),p&&(E?S||(E.appendChild(xt.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")},p)),S=p):c.appendChild(p)),c.appendChild(r.cloneNode(!0));const v=i.key||null,_=xt.utils.createElement("DIV",{class:"se-code-wrapper"},f);_.style.setProperty("display","none","important"),d.appendChild(_);const C=Wt(n,a,f);if(f===C){const t=xt.utils.createElement("TEXTAREA",{class:"se-code-view-line",readonly:"true"},null);_.insertBefore(t,f)}else f=C;const w={inner:null,page:null,pageMirror:null};n.get("_type_options").includes("header")&&(w.inner=xt.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")&&(w.page=xt.utils.createElement("DIV",{class:"se-document-page"},null),w.pageMirror=xt.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(v),k.set(v,At({target:i.target,key:i.key,options:a},h,g,_,f,S||p,w,v))}const T=n.get("toolbar_container");if(T){const t=xt.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),e=xt.utils.createElement("DIV",{class:"se-container"});e.appendChild(C),y&&e.appendChild(y),t.appendChild(e),T.appendChild(t),T.appendChild(xt.utils.createElement("DIV",{class:"se-toolbar-sticky-dummy"}))}else{const t=k.get(w).get("container");t.insertBefore(C,t.firstElementChild),y&&t.insertBefore(y,t.firstElementChild)}return{context:Nt(C,T,h,y,E),carrierWrapper:a,options:n,plugins:i,icons:o,lang:l,value:s.v,rootId:w,rootKeys:x,frameRoots:k,pluginCallButtons:_.pluginCallButtons,responsiveButtons:_.responsiveButtons,pluginCallButtons_sub:v?v.pluginCallButtons:[],responsiveButtons_sub:v?v.responsiveButtons:[]}},{NO_EVENT:Kt}=_t,Jt={bold:["font-weight"],underline:["text-decoration"],italic:["font-style"],strike:["text-decoration"]};let Qt=null,te=null;const ee=function(t,e){return Qt=this.eventManager.removeGlobalEvent("keydown",Qt),te=this.eventManager.removeGlobalEvent("mousedown",te),this._onCopyFormatInfo=null,this._onCopyFormatInitMethod=null,xt.utils.removeClass(t,"se-copy-format-cursor"),xt.utils.removeClass(e,"on"),!0},ie=function(t){const e=xt.check.isContentLess;return{first:xt.query.getEdgeChild(xt.query.getEdgeChild(t,(t=>!e(t)),!1),(t=>0===t.childNodes.length||3===t.nodeType||z(t)||F(t)),!1)||t.firstChild,last:xt.query.getEdgeChild(t.lastChild,(t=>0===t.childNodes.length||3===t.nodeType||z(t)||F(t)),!0)||t.lastChild}},se=["bold","underline","italic","strike","subscript","superscript","indent","outdent"],ne=se.concat(["undo","redo","save","fullScreen","showBlocks","codeView","dir","dir_ltr","dir_rtl"]);function oe(t,e){if("function"==typeof t._onCopyFormatInitMethod)return void t._onCopyFormatInitMethod();const i=t.frameContext.get("wysiwyg");t._onCopyFormatInfo=[...t.eventManager.__cacheStyleNodes],t._onCopyFormatInitMethod=ee.bind(t,i,e),xt.utils.addClass(i,"se-copy-format-cursor"),xt.utils.addClass(e,"on"),Qt=t.eventManager.addGlobalEvent("keydown",(e=>{Et.isEsc(e.code)&&t._onCopyFormatInitMethod?.()})),te=t.eventManager.addGlobalEvent("mousedown",(s=>{i.contains(s.target)||s.target===e||t._onCopyFormatInitMethod?.()}))}function le(t){const e=t.frameRoots;let i,s,o,l,r=t.options.get("historyStackDelayTime"),a=null,h=!1,c=null;function d(e,i,s){s&&t.status.hasFocus&&t.eventManager.applyTagEffect(),t.history.resetButtons(e.get("key"),i),t.triggerEvent("onChange",{frameContext:e,data:e.get("wysiwyg").innerHTML}),"block"===t.context.get("toolbar_main").style.display?t.toolbar._showBalloon():t.isSubBalloon&&"block"===t.context.get("toolbar_sub_main").style.display&&t.subToolbar._showBalloon()}function u(n){const l=s[i],r=o[l],a=t.frameContext;i+=n;const h=n<0&&l!==s[i]&&r.index>0?l:s[i],c=o[h];c.index+=n;const u=c.value[c.index];e.get(h).get("wysiwyg").innerHTML=u.content,l!==h&&n<0&&1===i?i=0:l!==h&&n>0&&1===c.index?i++:(n<0&&c.index<1||n>0&&c.index>c.value.length)&&(i+=n);let p=h,g=u;if(n<0&&i>0&&0===c.index){const t=s[i+n];if(t!==h){const e=o[t];p=t,g=e.value[e.index]}}t.changeFrameContext(p),t.selection.setRange(st(g.s.path,g.frame),g.s.offset,st(g.e.path,g.frame),g.e.offset),t.focus(),i<0?i=0:i>=s.length&&(i=s.length-1),t.ui._offCurrentController(),t._checkComponents(!1),t.char.display(),t._resourcesStateChange(a),a.has("documentType_use_header")&&a.get("documentType").reHeader(),d(a,c.index,!0)}function p(t,n,l,r){let a,h;n?(a={path:it(n.startContainer,null,null),offset:n.startOffset},h={path:it(n.endContainer,null,null),offset:n.endOffset}):(a={path:[0,0],offset:[0,0]},h={path:0,offset:0}),i+=r,s[i]=l;const c=o[l];c.index+=r,c.value[c.index]={content:t,s:a,e:h,frame:e.get(l).get("wysiwyg")}}function g(t){o[t]={value:[],index:-1},l[t]=e.get(t).get("wysiwyg").innerHTML}function m(n,r){t._checkComponents(!1);const a=e.get(n),h=a.get("wysiwyg").innerHTML,c=o[n];!h||c.value[c.index]&&h===c.value[c.index].content||(s.length>i+1&&function(e){const n=[];for(let t=i+1,e=s.length;t<e;t++)n.includes(s[t])||n.push(s[t]);s=s.slice(0,i+1),e.value.splice(i+1),t.applyCommandTargets("redo",(t=>{t.disabled=!0}));for(let t=0,e=n.length;t<e;t++)s.includes(n[t])||g(n[t])}(c),0===c.value.length&&function(t){i++,s[i]=t;const n=o[t];n.index=0,n.value[0]={content:l[t],s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0},frame:e.get(t).get("wysiwyg")}}(n),p(h,r,n,1),1===i&&t.applyCommandTargets("undo",(t=>{t.disabled=!1})),t.char.display(),d(a,c.index,!1))}return{push(i,s){if(h)return;s=s||null===s?s:t.status.rootKey;const o=t.status._range;n.setTimeout(t._resourcesStateChange.bind(t,e.get(s)),0);const l="number"==typeof i?i>0?i:0:i?r:0;l&&!a||(n.clearTimeout(a),l)?a=n.setTimeout((()=>{n.clearTimeout(a),a=null,m(s,o)}),l):m(s,o)},check(t,e){a&&(n.clearTimeout(a),a=null,m(t,e))},undo(){i>0&&u(-1)},redo(){s.length-1>i&&u(1)},overwrite(i){p(e.get(i||t.status.rootKey).get("wysiwyg").innerHTML,null,t.status.rootKey,0)},pause(){h=!0,c&&(n.clearTimeout(c),c=null),c=n.setTimeout((()=>{h=!1}),5e3)},resume(){c&&(n.clearTimeout(c),c=null),h=!1},reset(){t.applyCommandTargets("undo",(t=>t.disabled=!0)),t.applyCommandTargets("redo",(t=>t.disabled=!0)),t.applyCommandTargets("save",(t=>t.disabled=!0)),t.applyFrameRoots((t=>t.set("historyIndex",-1))),t.applyFrameRoots((t=>t.set("isChanged",!1))),i=-1,s=[],o={},l={},h=!1;const e=t.rootKeys;for(let t=0,i=e.length;t<i;t++)g(e[t])},resetButtons(e,n){const l=!kt.is(n),r=o[void 0===e?s[i]:e];n=l?r.index:n;const a=t.frameRoots.get(e),h=r.value.length-1;t.applyCommandTargets("undo",(t=>{t.disabled=!(n>0&&n<=h)})),t.applyCommandTargets("redo",(t=>{t.disabled=!(n>-1&&n<h)}));const c=a.get("savedIndex"),d=a.get("historyIndex"),u=c>-1?c!==n:l?r.index>0:n>0&&d!==n;a.set("historyIndex",n),a.set("isChanged",u),t.applyCommandTargets("save",(t=>{t.disabled=!u})),t.triggerEvent("onResetButtons",{rootKey:e})},getRootStack:()=>o,resetDelayTime(t){r=t},destroy(){a&&n.clearTimeout(a),i=s=o=l=null}}}function re(t){this.editor=t,this.eventManager=t.eventManager,this.instanceCheck=t.instanceCheck,this.history=t.history,this.events=t.events,this.triggerEvent=t.triggerEvent,this.carrierWrapper=t.carrierWrapper,this.plugins=t.plugins,this.status=t.status,this.frameContext=t.frameContext,this.frameOptions=t.frameOptions,this.context=t.context,this.options=t.options,this.icons=t.icons,this.lang=t.lang,this.frameRoots=t.frameRoots,this._w=t._w,this._d=t._d}const ae=new Map([["__figureInst",null],["__dragInst",null],["__dragHandler",null],["__dragContainer",null],["__dragCover",null],["__dragMove",null],["__overInfo",null]]),he=ae,{isMobile:ce}=_t;function de(t){const e=xt.query.getEventTarget(t);let i=e;this.editor.isSubBalloon&&!this.context.get("toolbar_sub_main")?.contains(i)&&this._hideToolbar_sub();const s=xt.check.isInputElement(i);if(s?this.editor._preventBlur=!1:this.frameContext.get("wysiwyg").contains(this.selection.getNode())||this.editor.focus(),xt.query.getParentElement(i,".se-dropdown"))t.stopPropagation(),this.editor._notHideToolbar=!0;else{let n=i.getAttribute("data-command"),o=i.className;for(;i&&!n&&!/(se-menu-list|sun-editor-common|se-menu-tray)/.test(o);)i=i.parentElement,n=i.getAttribute("data-command"),o=i.className;if(s&&/^INPUT$/i.test(i?.getAttribute("data-type"))){if(this.editor._preventBlur=this._inputFocus=!0,this.status.hasFocus||this.applyTagEffect(),!xt.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.addEvent(e,"blur",(i=>{if(!t.isInputActive)try{const s=e.value.trim();"function"==typeof t.toolbarInputChange&&s!==this.__inputPlugin.value&&t.toolbarInputChange({target:e,value:s,event:i})}finally{this._w.setTimeout((()=>this._inputFocus=!1),0),this.__removeInput()}})),!t)return;"function"==typeof t.toolbarInputKeyDown&&(this.__inputKeyEvent=this.addEvent(e,"keydown",(i=>{t.toolbarInputKeyDown({target:e,event:i})})))}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")||(ce?this.editor._preventBlur=!0:(t.preventDefault(),_t.isGecko&&n&&this._injectActiveEvent(i)))}n!==this.menu.currentDropdownName&&n!==this.menu.currentContainerName||t.stopPropagation()}}function ue(t){const e=xt.query.getEventTarget(t),i=xt.query.getCommandTarget(e);if(!i)return;let s=i,n="";for(;s&&!/se-menu-tray/.test(s.className)&&!n;)s=s.parentElement,n=s?.getAttribute("data-key");if(!n)return;const o=this.plugins[n];o&&"function"==typeof o.action&&(t.stopPropagation(),o.action(i))}function pe(t){const e=xt.query.getEventTarget(t);this.editor.runFromTarget(e)}const{_w:ge}=_t;let me=null;function fe(){this.editor.status._onMousedown=!1,me=this.removeGlobalEvent(me)}async function be(t,e){const i=xt.query.getEventTarget(e);this.editor.status._onMousedown=!0,me&&fe.call(this),me=this.addGlobalEvent("mouseup",fe.bind(this)),t.get("isReadOnly")||xt.check.isNonEditable(t.get("wysiwyg"))||(this.format._isExcludeSelectionElement(i)?e.preventDefault():(this._setSelectionSync(),this._w.setTimeout(this.selection._init.bind(this.selection),0),!1!==await this.triggerEvent("onMouseDown",{frameContext:t,event:e})&&!1!==await this._callPluginEventAsync("onMouseDown",{frameContext:t,event:e})&&(this.editor.isBalloon?this._hideToolbar():this.editor.isSubBalloon&&this._hideToolbar_sub(),/FIGURE/i.test(i?.nodeName)&&e.preventDefault())))}async function ye(t,e){!1!==await this.triggerEvent("onMouseUp",{frameContext:t,event:e})&&await this._callPluginEventAsync("onMouseUp",{frameContext:t,event:e})}async function ve(t,e){const i=xt.query.getEventTarget(e);if(t.get("isReadOnly"))return e.preventDefault(),xt.check.isAnchor(i)&&ge.open(i.href,i.target),!1;if(xt.check.isNonEditable(t.get("wysiwyg")))return;if(!1===await this.triggerEvent("onClick",{frameContext:t,event:e}))return;if(!1===await this._callPluginEventAsync("onClick",{frameContext:t,event:e}))return;const s=this.component.get(i);if(s)return e.preventDefault(),void this.component.select(s.target,s.pluginName);if(this.selection._init(),3===e.detail){let t=this.selection.getRange();this.format.isLine(t.endContainer)&&0===t.endOffset&&(t=this.selection.setRange(t.startContainer,t.startOffset,t.startContainer,t.startContainer.textContent.length),this.selection._rangeInfo(t,this.selection.get()))}const n=this.selection.getNode(),o=this.format.getLine(n,null),l=this.format.getBlock(n,null);if(!o&&!xt.check.isNonEditable(i)&&!xt.check.isList(l)){const t=this.selection.getRange();if(this.format.getLine(t.startContainer)===this.format.getLine(t.endContainer))if(xt.check.isList(l)){e.preventDefault();const t=n.nextElementSibling,i=xt.utils.createElement("LI",null,n);l.insertBefore(i,t),this.editor.focus()}else xt.check.isWysiwygFrame(n)||this.component.is(n)||xt.check.isTableElements(n)&&!xt.check.isTableCell(n)||null===this._setDefaultLine(this.format.isBlock(l)?"DIV":this.options.get("defaultLine"))||(e.preventDefault(),this.editor.focus())}if(this.editor._onCopyFormatInfo)try{const t=[...this.editor._onCopyFormatInfo],e=t.pop();if(this.inline.remove(),e){const i=this.inline.apply(e,{stylesToModify:null,nodesToRemove:[e.nodeName],strictRemove:!1}),{parent:s,inner:n}=this.nodeTransform.createNestedNode(t);i.parentNode.insertBefore(s,i),n.appendChild(i),this.selection.setRange(i,xt.check.isZeroWidth(i)?1:0,i,1)}if(this.options.get("copyFormatKeepOn"))return;this.editor._onCopyFormatInitMethod()}catch(t){console.warn("[SUNEDITOR.copyFormat.error] ",t),this.editor._onCopyFormatInitMethod?.()||(this.editor._onCopyFormatInfo=null,this.editor._onCopyFormatInitMethod=null)}(this.editor.isBalloon||this.editor.isSubBalloon)&&this._w.setTimeout(this._toggleToolbarBalloon.bind(this),0)}function _e(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return!1;const i=xt.query.getEventTarget(e);!1!==he.get("__overInfo")&&this.component.hoverSelect(i),this._callPluginEvent("onMouseMove",{frameContext:t,event:e})}async function Ce(t,e){!1!==await this.triggerEvent("onMouseLeave",{frameContext:t,event:e})&&await this._callPluginEventAsync("onMouseLeave",{frameContext:t,event:e})}async function we(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;const i=(null===e.data?"":void 0===e.data?" ":e.data)||"";if(Et.isComposing(e))this._handledInBefore=!1;else{if(!this.char.test(i,!1))return e.preventDefault(),e.stopPropagation(),!1;this._handledInBefore=!0}!1!==await this.triggerEvent("onBeforeInput",{frameContext:t,event:e,data:i})&&await this._callPluginEventAsync("onBeforeInput",{frameContext:t,event:e,data:i})}async function xe(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;const i=this.selection.getRange(),s=this.selection.getNode(),n=this.format.getLine(s,null);if(!this.format.isNormalLine(n)&&!this.format.isBrLine(n)&&i.collapsed&&!this.component.is(s)&&!xt.check.isList(s)){const t=this.format.getBlock(s,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.triggerEvent("onInput",{frameContext:t,event:e,data:o})&&(await this._callPluginEventAsync("onInput",{frameContext:t,event:e,data:o}),this.history.push(!0))}const ke={"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),"editor._nativeFocus":({ports:t})=>t.editor._nativeFocus(),"history.push":({ports:t},e)=>t.history.push(e),"documentType.refreshHeader":({ctx:t})=>{n.setTimeout((()=>{t.fc.get("documentType").reHeader()}),0)},"component.deselect":({ports:t})=>t.component.deselect(),"selection.setRange":({ports:t},{sc:e,so:i,ec:s,eo:n})=>t.selection.setRange(e,i,s,n),"format.removeBlock":({ports:t},{rangeEl:e,selectedFormats:i,newBlockElement:s,shouldDelete:n,skipHistory:o})=>t.format.removeBlock(e,{selectedFormats:i,newBlockElement:s,shouldDelete:n,skipHistory:o}),"dom.utils.removeItem":(t,{item:e})=>xt.utils.removeItem(e),"select.component.fallback":({ports:t},{cmponentInfo:e})=>{!1===t.component.select(e.target,e.pluginName)&&t.editor.blur()}},Ee={"del.format.removeAndMove":({ports:t},{container:e,formatEl:i})=>{const s=t.html.remove();if(s.commonCon!==s.container&&i.parentElement)if(i.contains(e)){const e=function(t){const e=t.lastChild,i=t.nextElementSibling;if(!i)return e;if(xt.check.isZeroWidth(i))return xt.utils.removeItem(i),e;const s=i.childNodes;for(;s[0];)t.appendChild(s[0]);return xt.utils.removeItem(i),e}(i);t.selection.setRange(e,e.textContent.length,e,e.textContent.length)}else{const{focusNode:e,focusOffset:s}=function(t){const e=t.childNodes,i=t.previousElementSibling;let s=e[0],n=0;if(!i)return{focusNode:s,focusOffset:n};if(xt.check.isZeroWidth(i))return xt.utils.removeItem(i),{focusNode:s,focusOffset:n};if(e.length>1||e[0]?.textContent.length>0)for(;e[0];)i.appendChild(e[0]);else s=i.lastChild,n=s.textContent.length;return xt.utils.removeItem(t),{focusNode:s,focusOffset:n}}(i);t.selection.setRange(e,s,e,s)}},"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(xt.utils.createElement(t.options.get("defaultLine"),null,"<br>"),e)},"backspace.component.select":({ports:t},{selectionNode:e,range:i,fileComponentInfo:s})=>{let n=null;xt.check.isBreak(e)?xt.utils.removeItem(e):xt.check.isBreak(n=i.startContainer.childNodes?.[i.startOffset])&&xt.utils.removeItem(n),!1===t.component.select(s.target,s.pluginName)&&t.editor.blur()},"backspace.component.remove":({ports:t},{isList:e,sel:i,formatEl:s,fileComponentInfo:n})=>{e&&xt.utils.removeItem(i),0===s.textContent.length&&xt.utils.removeItem(s),!1===t.component.select(n.target,n.pluginName)&&t.editor.blur()},"backspace.list.mergePrev":({ports:t},{prev:e,formatEl:i,rangeEl:s})=>{let n=e===s.parentNode?s.previousSibling:e.lastChild;n||(n=xt.utils.createTextNode(Ct.zeroWidthSpace),s.parentNode.insertBefore(n,s.parentNode.firstChild));const o=3===n.nodeType?n.textContent.length:1,l=i.childNodes;let r=n,a=l[0];for(;a=l[0];)e.insertBefore(a,r.nextSibling),r=a;xt.utils.removeItem(i),0===s.children.length&&xt.utils.removeItem(s),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:i})=>{if(xt.check.isListCell(e)){const t=i.container.previousSibling;xt.check.isZeroWidth(t)&&xt.utils.removeItem(t)}else xt.check.isZeroWidth(e)&&xt.utils.removeItem(e);!1===t.component.select(i.target,i.pluginName)&&t.editor.blur()},"delete.component.selectNext":({ports:t,ctx:e},{formatEl:i,nextEl:s})=>{if(xt.check.isZeroWidth(i)&&(xt.utils.removeItem(i),xt.check.isTable(s))){let e=xt.query.getEdgeChild(s,xt.check.isTableCell,!1);return e=e.firstElementChild||e,void t.selection.setRange(e,0,e,0)}const n=t.component.get(s);n?(e.e.stopPropagation(),!1===t.component.select(n.target,n.pluginName)&&t.editor.blur()):t.component.is(s)&&(e.e.stopPropagation(),xt.utils.removeItem(s))},"delete.list.removeNested":({ports:t,ctx:e},{range:i,formatEl:s,rangeEl:n})=>{i.startContainer!==i.endContainer&&t.html.remove();const o=xt.utils.arrayFind(s.children,xt.check.isList)||s.nextElementSibling||n.parentElement.nextElementSibling;if(o&&(xt.check.isList(o)||xt.utils.arrayFind(o.children,xt.check.isList))){let i,n;if(e.e.preventDefault(),xt.check.isList(o)){const t=o.firstElementChild;for(n=t.childNodes,i=n[0];n[0];)s.insertBefore(n[0],o);xt.utils.removeItem(t)}else{for(i=o.firstChild,n=o.childNodes;n[0];)s.appendChild(n[0]);xt.utils.removeItem(o)}t.selection.setRange(i,0,i,0),t.history.push(!0)}},"tab.format.indent":({ports:t,ctx:e},{range:i,formatEl:s,shift:n})=>{const o=t.format.getLines(null),l=[],r=[],a=xt.check.isListCell(o[0]),h=xt.check.isListCell(o.at(-1));let c={sc:i.startContainer,so:i.startOffset,ec:i.endContainer,eo:i.endOffset};for(let t,e=0,i=o.length;e<i;e++)if(t=o[e],xt.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,i=0;i<=t;i++){e=r[i].childNodes;for(let t,i=0,s=e.length;i<s&&(t=e[i],t);i++)if(!xt.check.isZeroWidth(t)){/^\s{1,4}$/.test(t.textContent)?xt.utils.removeItem(t):/^\s{1,4}/.test(t.textContent)&&(t.textContent=t.textContent.replace(/^\s{1,4}/,""));break}}const e=xt.query.getEdgeChild(r[0],"text",!1),i=xt.query.getEdgeChild(r[t],"text",!0);!a&&e&&(c.sc=e,c.so=0),!h&&i&&(c.ec=i,c.eo=i.textContent.length)}else if(1===r.length){let n=e.status.tabSize+1;if(e.options.get("syncTabIndent")){const e=xt.query.findTextIndexOnLine(s,i.startContainer,i.startOffset,(e=>t.component.is(e))),o=t.format.isLine(s.previousElementSibling)?xt.query.findTabEndIndex(s.previousElementSibling,e,2):0;o>e&&(n=o-e)}const o=xt.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=xt.utils.createTextNode(new Array(e.status.tabSize+1).join(" ")),i=r.length-1;for(let e,s=0;s<=i;s++)e=r[s].firstChild,e&&(xt.check.isBreak(e)?r[s].insertBefore(t.cloneNode(!1),e):e.textContent=t.textContent+e.textContent);const s=xt.query.getEdgeChild(r[0],"text",!1),n=xt.query.getEdgeChild(r[i],"text",!0);!a&&s&&(c.sc=s,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:i})=>{const s=t.format.addLine(i,e.options.get("defaultLine")).firstChild;if(xt.check.isBreak(s)){const e=xt.utils.createTextNode(Ct.zeroWidthSpace);s.parentNode.insertBefore(e,s),t.selection.setRange(e,1,e,1)}else t.selection.setRange(s,0,s,0)},"enter.list.addItem":({ports:t},{formatEl:e,selectionNode:i})=>{const s=xt.utils.createElement("BR"),n=xt.utils.createElement("LI",null,s);e.parentNode.insertBefore(n,e.nextElementSibling),n.appendChild(i.nextSibling),t.selection.setRange(s,1,s,1)},"enter.format.exitEmpty":({ports:t,ctx:e},{formatEl:i,rangeEl:s})=>{let n=null;if(xt.check.isListCell(s.parentElement)){const t=i.parentNode.parentElement;s=t.parentElement;const o=xt.utils.createElement("LI");o.innerHTML="<br>",xt.utils.copyTagAttributes(o,i,e.options.get("lineAttrReset")),n=o,s.insertBefore(n,t.nextElementSibling)}else{let o;o=xt.check.isTableCell(s.parentElement)?"DIV":xt.check.isList(s.parentElement)?"LI":t.format.isLine(s.nextElementSibling)?s.nextElementSibling.nodeName:t.format.isLine(s.previousElementSibling)?s.previousElementSibling.nodeName:e.options.get("defaultLine"),n=xt.utils.createElement(o);const l=t.format.removeBlock(s,{selectedFormats:[i],newBlockElement:null,shouldDelete:!0,skipHistory:!0});l.cc.insertBefore(n,l.ec)}n.innerHTML="<br>",t.nodeTransform.removeAllParents(i,null,null),t.selection.setRange(n,1,n,1)},"enter.format.cleanBrAndZWS":({ports:t},{selectionNode:e,selectionFormat:i,brBlock:s,children:n,offset:o})=>{i?xt.utils.removeItem(n[o-1]):xt.utils.removeItem(e);const l=s.nextElementSibling,r=t.format.addLine(s,t.format.isLine(l)?l:null);xt.utils.copyFormatAttributes(r,s),t.selection.setRange(r,1,r,1)},"enter.format.insertBrHtml":({ports:t},{brBlock:e,range:i,wSelection:s,offset:n})=>{t.html.insert(i.collapsed&&xt.check.isBreak(i.startContainer.childNodes[i.startOffset-1])?"<br>":"<br><br>",{selectInserted:!1,skipCharCount:!0,skipCleaning:!0});let o=s.focusNode;const l=s.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 i=e.focusNode.nextSibling,s=xt.utils.createElement("BR");t.html.insertNode(s,{afterNode:null,skipCharCount:!0});const n=s.previousSibling,o=s.nextSibling;xt.check.isBreak(i)||xt.check.isBreak(n)||o&&!xt.check.isZeroWidth(o)?t.selection.setRange(o,0,o,0):(s.parentNode.insertBefore(s.cloneNode(!1),s),t.selection.setRange(s,1,s,1)),t.setOnShortcutKey(!0)},"enter.format.breakAtEdge":({ports:t,ctx:e},{formatEl:i,selectionNode:s,formatStartEdge:n,formatEndEdge:o})=>{const l=xt.utils.createElement("BR"),r=xt.utils.createElement(i.nodeName,null,l);xt.utils.copyTagAttributes(r,i,e.options.get("lineAttrReset"));let a=l,h=s;do{if(!xt.check.isBreak(h)&&1===h.nodeType){const t=h.cloneNode(!1);t.appendChild(a),a=t}h=h.parentElement}while(i!==h&&i.contains(h));if(r.appendChild(a),i.parentNode.insertBefore(r,n&&!o?i:i.nextElementSibling),o)t.selection.setRange(l,1,l,1);else{const e=i.firstChild||i;t.selection.setRange(e,0,e,0)}},"enter.format.breakWithSelection":({ports:t,ctx:e},{formatEl:i,range:s,formatStartEdge:n,formatEndEdge:o})=>{const l=t.format.getLine(s.startContainer,null)!==t.format.getLine(s.endContainer,null),r=i.cloneNode(!1);r.innerHTML="<br>";const a=s.commonAncestorContainer,h=a===s.startContainer&&a===s.endContainer&&xt.check.isZeroWidth(a)?{container:a,offset:s.endOffset,prevContainer:a.previousElementSibling,commonCon:a}:t.html.remove();let c=t.format.getLine(h.container,null),d=0;if(!c)return void(xt.check.isWysiwygFrame(h.container)&&(t.enterPrevent(e.e),e.fc.get("wysiwyg").appendChild(r),c=r,xt.utils.copyTagAttributes(c,i,e.options.get("lineAttrReset")),t.selection.setRange(c,d,c,d)));const u=t.format.getBlock(h.container);if(c=c.contains(u)?xt.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,xt.query.getNodeDepth(i));t.enterPrevent(e.e),xt.utils.copyTagAttributes(c,i,e.options.get("lineAttrReset")),t.selection.setRange(c,d,c,d)},"enter.format.breakAtCursor":({ports:t,ctx:e},{formatEl:i,range:s})=>{let n=null;n=xt.check.isZeroWidth(i)?t.format.addLine(i,i.cloneNode(!1)):t.nodeTransform.split(s.endContainer,s.endOffset,xt.query.getNodeDepth(i)),t.enterPrevent(e.e),xt.utils.copyTagAttributes(n,i,e.options.get("lineAttrReset")),t.selection.setRange(n,0,n,0)},"enter.figcaption.exitInList":({ports:t},{formatEl:e})=>{const i=t.format.addLine(e,null);t.selection.setRange(i,0,i,0)},"keydown.input.insertNbsp":({ports:t})=>{const e=t.html.insertNode(xt.utils.createTextNode(" "),{afterNode:null,skipCharCount:!0});e&&t.selection.setRange(e,e.length,e,e.length)},"keydown.input.insertZWS":({ports:t})=>{const e=xt.utils.createTextNode(Ct.zeroWidthSpace);t.html.insertNode(e,{afterNode:null,skipCharCount:!0}),t.selection.setRange(e,1,e,1)}};function Se(t){const e=t.selection.getRange(),i=e.startContainer,s=e.endContainer,n=t.format.getBlock(i),o=t.format.getBlock(s),l=xt.check.isTableCell(n),r=xt.check.isTableCell(o);if((l&&!n.previousElementSibling&&!n.parentElement.previousElementSibling||r&&!o.nextElementSibling&&!o.parentElement.nextElementSibling)&&n!==o){const i=xt.query.getParentElement(e.commonAncestorContainer,xt.check.isFigure)?.parentElement||e.commonAncestorContainer;if(l){if(r)return xt.utils.removeItem(xt.query.getParentElement(n,(t=>i===t.parentNode))),t.editor._nativeFocus(),!0;xt.utils.removeItem(xt.query.getParentElement(n,(t=>i===t.parentNode)))}else xt.utils.removeItem(xt.query.getParentElement(o,(t=>i===t.parentNode)))}const a=1===i.nodeType?xt.query.getParentElement(i,".se-component"):null,h=1===s.nodeType?xt.query.getParentElement(s,".se-component"):null;return a&&xt.utils.removeItem(a),h&&xt.utils.removeItem(h),!1}function Te(t,e,i){const s=i?e.startContainer:e.endContainer,n=i?e.startOffset:e.endOffset,o=i?"previousSibling":"nextSibling";let l;return 1===s.nodeType?(l=He(t,s.childNodes[n],o,s),xt.check.isComponentContainer(l)||xt.check.isNonEditable(l)?l:null):(l=He(t,s,o,s),xt.check.isEdgePoint(s,n,i?"front":"end")&&(xt.check.isComponentContainer(l)||xt.check.isNonEditable(l))?l:null)}function He(t,e,i,s){if(!e)return null;let n=e[i];if(!n){if(n=t.format.getLine(s),n=n?n[i]:null,!n||t.component.is(n))return null;n="previousSibling"===i?n.firstChild:n.lastChild}return n}const Le=()=>({t:"event.prevent"}),Me=()=>({t:"event.prevent.stop"}),Ne=()=>({t:"cache.styleNode"}),Ae=t=>({t:"cache.formatAttrsTemp",p:{attrs:t}}),Be=()=>({t:"component.deselect"}),Ve=()=>({t:"editor._nativeFocus"}),Ie=t=>({t:"history.push",p:t}),Oe=()=>({t:"documentType.refreshHeader"}),Re=(t,e,i,s,n)=>({t:"format.removeBlock",p:{rangeEl:t,selectedFormats:e,newBlockElement:i,shouldDelete:s,skipHistory:n}}),Fe=t=>({t:"dom.utils.removeItem",p:{item:t}}),ze=t=>({t:"select.component.fallback",p:{cmponentInfo:t}}),$e=(t,e)=>({t:"del.format.removeAndMove",p:{container:t,formatEl:e}}),Pe=t=>({t:"backspace.format.maintain",p:{formatEl:t}}),De=(t,e,i)=>({t:"backspace.component.select",p:{selectionNode:t,range:e,fileComponentInfo:i}}),qe=(t,e,i,s)=>({t:"backspace.component.remove",p:{isList:t,sel:e,formatEl:i,fileComponentInfo:s}}),We=(t,e,i)=>({t:"backspace.list.mergePrev",p:{prev:t,formatEl:e,rangeEl:i}}),Ue=t=>({t:"backspace.list.removeNested",p:{range:t}}),Ze=(t,e)=>({t:"delete.component.select",p:{formatEl:t,fileComponentInfo:e}}),Ge=(t,e)=>({t:"delete.component.selectNext",p:{formatEl:t,nextEl:e}}),Ye=(t,e,i)=>({t:"delete.list.removeNested",p:{range:t,formatEl:e,rangeEl:i}}),je=(t,e,i)=>({t:"tab.format.indent",p:{range:t,formatEl:e,shift:i}}),Xe=t=>({t:"enter.scrollTo",p:{range:t}}),Ke=t=>({t:"enter.line.addDefault",p:{formatEl:t}}),Je=(t,e)=>({t:"enter.list.addItem",p:{formatEl:t,selectionNode:e}}),Qe=(t,e)=>({t:"enter.format.exitEmpty",p:{formatEl:t,rangeEl:e}}),ti=(t,e,i,s,n)=>({t:"enter.format.cleanBrAndZWS",p:{selectionNode:t,selectionFormat:e,brBlock:i,children:s,offset:n}}),ei=(t,e,i,s)=>({t:"enter.format.insertBrHtml",p:{brBlock:t,range:e,wSelection:i,offset:s}}),ii=t=>({t:"enter.format.insertBrNode",p:{wSelection:t}}),si=(t,e,i,s)=>({t:"enter.format.breakAtEdge",p:{formatEl:t,selectionNode:e,formatStartEdge:i,formatEndEdge:s}}),ni=(t,e,i,s)=>({t:"enter.format.breakWithSelection",p:{formatEl:t,range:e,formatStartEdge:i,formatEndEdge:s}}),oi=(t,e)=>({t:"enter.format.breakAtCursor",p:{formatEl:t,range:e}}),li=t=>({t:"enter.figcaption.exitInList",p:{formatEl:t}}),ri=()=>({t:"keydown.input.insertNbsp"}),ai=()=>({t:"keydown.input.insertZWS"});function hi(t,e,i){const{format:s,component:n}=e,{fc:o,options:l,range:r,selectionNode:a}=i;let{formatEl:h}=i;const c=!r.collapsed||r.startContainer!==r.endContainer;if(t.push(Be()),t.push(Ne()),c&&Se(e))return t.push(Me()),!0;if(!(s.isNormalLine(h)||s.isBrLine(h)||o.get("wysiwyg").firstElementChild||n.is(a)||null===function(t,e){return t.setDefaultLine(e)}(e,l.get("defaultLine"))))return t.push(Me()),!1;if(s.isLine(h)&&c&&xt.check.isEdgePoint(r.startContainer,r.startOffset,"front")&&(!r.startContainer.previousSibling||xt.check.isZeroWidth(r.startContainer.previousSibling))&&s.getLine(r.startContainer)!==s.getLine(r.endContainer)&&(s.isLine(h.previousElementSibling)||xt.check.isListCell(h)))return t.push(Me()),t.push($e(r.startContainer,h)),t.push(Ie(!0)),!1;if(!c&&!h.previousElementSibling&&0===r.startOffset&&!a.previousSibling&&!xt.check.isListCell(h)&&s.isLine(h)&&(!s.isBrLine(h)||s.isClosureBrLine(h)))return s.isClosureBlock(h.parentNode)?(t.push(Me()),!1):(xt.check.isWysiwygFrame(h.parentNode)&&h.childNodes.length<=1&&(!h.firstChild||xt.check.isZeroWidth(h.textContent))&&(t.push(Me()),t.push(Pe(h))),t.push(Ve()),!1);const d=r.startContainer;if(h&&!h.previousElementSibling&&0===r.startOffset&&3===d.nodeType&&xt.check.isZeroWidth(d)&&!0===function(t,e,i){let s=e.parentNode.previousSibling;const n=e.parentNode.nextSibling;s||(n?s=n:(s=xt.utils.createElement("BR"),i.appendChild(s)));let o=e;for(;i.contains(o)&&!o.previousSibling;)o=o.parentNode;if(!i.contains(o))return e.textContent="",t.nodeTransform.removeAllParents(e,null,i),!0}(e,d,h))return!0;if(!c&&h&&(0===r.startOffset||a===h)){const i=a===h?Te(e,r,!0):xt.check.isElement(a.previousSibling)?a.previousSibling:xt.check.isEdgePoint(r.startContainer,r.startOffset)?xt.query.getPreviousDeepestNode(r.startContainer):null;if(n.is(i)){const e=n.get(i);if(e)return t.push(Me()),t.push(De(a,r,e)),!0}}if(Te(e,r,!0))return t.push(Me()),!0;!c&&s.isEdgeLine(r.startContainer,r.startOffset,"front")&&s.isLine(h.previousElementSibling)&&t.push(Ae(h.previousElementSibling.attributes)),h=s.getLine(r.startContainer,null);const u=s.getBlock(h,null),p=r.commonAncestorContainer;if(u&&h&&!xt.check.isTableCell(u)&&!/^FIGCAPTION$/i.test(u.nodeName)){if(xt.check.isListCell(h)&&xt.check.isList(u)&&(xt.check.isListCell(u.parentElement)||h.previousElementSibling)&&(a===h||3===a.nodeType&&(!a.previousSibling||xt.check.isList(a.previousSibling)))&&(s.getLine(r.startContainer,null)!==s.getLine(r.endContainer,null)?u.contains(r.startContainer):0===r.startOffset&&r.collapsed)){if(r.startContainer!==r.endContainer)t.push(Le()),t.push(Ue(r)),t.push(Ie(!0));else{let e=h.previousElementSibling||u.parentElement;if(xt.check.isListCell(e)){t.push(Le());let i=e;if(!e.contains(h)&&xt.check.isListCell(i)&&xt.check.isList(i.lastElementChild)){for(i=i.lastElementChild.lastElementChild;xt.check.isListCell(i)&&xt.check.isList(i.lastElementChild);)i=i.lastElementChild&&i.lastElementChild.lastElementChild;e=i}t.push(We(e,h,u)),t.push(Ie(!0))}}return!0}if(!c&&0===r.startOffset){let e=!0,i=p;for(;i&&i!==u&&!xt.check.isWysiwygFrame(i);){if(i.previousSibling&&(1===i.previousSibling.nodeType||!xt.check.isZeroWidth(i.previousSibling.textContent.trim()))){e=!1;break}i=i.parentNode}if(e&&u.parentNode)return t.push(Le()),t.push(Re(u,xt.check.isListCell(h)?[h]:null,null,!1,!1)),t.push(Ie(!0)),!0}}if(!c&&h&&(0===r.startOffset||a===h&&h.childNodes[r.startOffset])){const e=xt.check.isListCell(h),i=a===h?h.childNodes[r.startOffset]:a,s=(e?i:h).previousSibling,o=e||(3===p.nodeType||xt.check.isBreak(p))&&!p.previousSibling&&0===r.startOffset;if(i&&(e||!i.previousSibling)&&(p&&n.is(p.previousSibling)||o&&n.is(s))){const o=n.get(s);return o?(t.push(Me()),t.push(qe(e,i,h,o))):n.is(s)&&(t.push(Me()),t.push(Fe(s))),!0}if(i&&xt.check.isNonEditable(i.previousSibling))return t.push(Me()),t.push(Fe(i.previousSibling)),!0}return!0}const{isOSX_IOS:ci}=_t;async function di(t,e){const i=[];switch(e.keyCode){case"Backspace":if(!1===hi(i,t,e))return i;break;case"Delete":if(!1===function(t,e,i){const{format:s,component:n}=e,{range:o,selectionNode:l}=i;let{formatEl:r}=i;const a=!o.collapsed||o.startContainer!==o.endContainer;if(t.push(Be()),t.push(Ne()),a&&Se(e))return t.push(Me()),!0;if(!a&&s.isEdgeLine(o.endContainer,o.endOffset,"end")&&!r.nextSibling)return t.push(Me()),!1;if(s.isLine(r)&&a&&xt.check.isEdgePoint(o.endContainer,o.endOffset,"end")&&(!o.endContainer.nextSibling||xt.check.isZeroWidth(o.endContainer.nextSibling))&&s.getLine(o.startContainer)!==s.getLine(o.endContainer)&&(s.isLine(r.nextElementSibling)||xt.check.isListCell(r)))return t.push(Me()),t.push($e(o.endContainer,r)),t.push(Ie(!0)),!1;if(!a&&r&&(o.endOffset===o.endContainer.textContent.length||l===r)){const i=l===r?Te(e,o,!1):xt.check.isElement(l.nextSibling)?l.nextSibling:xt.check.isEdgePoint(o.endContainer,o.endOffset)?xt.query.getNextDeepestNode(o.endContainer,null):null;if(n.is(i)){const e=n.get(i);if(e)return t.push(Me()),t.push(Ze(r,e)),!0}}if(Te(e,o,!1))return t.push(Me()),!0;if((s.isLine(l)||null===l.nextSibling||xt.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(Le()),t.push(Ge(r,e)),!0}if(!a&&(xt.check.isEdgePoint(o.endContainer,o.endOffset)||l===r&&r.childNodes[o.startOffset])){const e=l===r&&r.childNodes[o.startOffset]||l;if(e&&xt.check.isNonEditable(e.nextSibling))return t.push(Me()),t.push(Fe(e.nextSibling)),!0;if(n.is(e))return t.push(Me()),t.push(Fe(e)),!0}!a&&s.isEdgeLine(o.endContainer,o.endOffset,"end")&&s.isLine(r.nextElementSibling)&&t.push(Ae(r.attributes)),r=s.getLine(o.startContainer,null);const h=s.getBlock(r,null);return!(xt.check.isListCell(r)&&xt.check.isList(h)&&(l===r||3===l.nodeType&&(!l.nextSibling||xt.check.isList(l.nextSibling))&&(s.getLine(o.startContainer,null)!==s.getLine(o.endContainer,null)?h.contains(o.endContainer):o.endOffset===l.textContent.length&&o.collapsed))&&(t.push(Ye(o,r,h)),0))}(i,t,e))return i;break;case"Tab":if(!1===function(t,e,i){const{options:s,selectionNode:n,range:o,formatEl:l,ctrl:r,alt:a,shift:h}=i;return!!s.get("tabDisable")||(t.push(Le()),r||a||xt.check.isWysiwygFrame(n)||(t.push(je(o,l,h)),t.push(Ie(!1))),!0)}(i,0,e))return i;break;case"Enter":if(!1===function(t,e,i){const{format:s,char:n,selection:o}=e,{frameOptions:l,range:r,formatEl:a,selectionNode:h,shift:c,e:d}=i,u=!r.collapsed||r.startContainer!==r.endContainer;t.push(Be());const p=s.getBrLine(h,null),g=s.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(Le()),!1}if(!c){const i=!r.endContainer.nextSibling&&s.isEdgeLine(r.endContainer,r.endOffset,"end"),n=!r.startContainer.previousSibling&&s.isEdgeLine(r.startContainer,r.startOffset,"front");if(i&&(/^H[1-6]$/i.test(a.nodeName)||/^HR$/i.test(a.nodeName)))return e.enterPrevent(d),t.push(Ke(a)),t.push(Xe(r)),!0;if(g&&a&&!xt.check.isTableCell(g)&&!/^FIGCAPTION$/i.test(g.nodeName)){const i=o.getRange();if(xt.check.isEdgePoint(i.endContainer,i.endOffset)&&xt.check.isList(h.nextSibling))return e.enterPrevent(d),t.push(Je(a,h)),t.push(Xe(r)),!0;if((3!==i.commonAncestorContainer.nodeType||!i.commonAncestorContainer.nextElementSibling)&&xt.check.isZeroWidth(a.innerText.trim())&&!xt.check.isListCell(a.nextElementSibling))return e.enterPrevent(d),t.push(Qe(a,g)),!0}if(p||g===a&&s.isClosureBlock(g)&&s.isLine(a)){e.enterPrevent(d);const i=h===p,n=o.get(),l=h.childNodes,a=n.focusOffset,c=h.previousElementSibling,u=h.nextSibling;return!s.isClosureBrLine(p)&&l&&(i&&r.collapsed&&l.length-1<=a+1&&xt.check.isBreak(l[a])&&(!l[a+1]||(!l[a+2]||xt.check.isZeroWidth(l[a+2].textContent))&&3===l[a+1].nodeType&&xt.check.isZeroWidth(l[a+1].textContent))&&a>0&&xt.check.isBreak(l[a-1])||!i&&xt.check.isZeroWidth(h.textContent)&&xt.check.isBreak(c)&&(xt.check.isBreak(c.previousSibling)||!xt.check.isZeroWidth(c.previousSibling?.textContent))&&(!u||!xt.check.isBreak(u)&&xt.check.isZeroWidth(u.textContent)))?(t.push(ti(h,i,p,l,a)),t.push(Xe(r)),!0):(i?t.push(ei(p,r,n,a)):t.push(ii(n)),t.push(Xe(r)),!0)}if(r.collapsed&&(n||i))return e.enterPrevent(d),t.push(si(a,h,n,i)),t.push(Xe(r)),!0;if(a)return t.push(Le()),u?t.push(ni(a,r,n,i)):t.push(oi(a,r)),t.push(Xe(r)),!0}return u?(t.push(Xe(r)),!0):(g&&xt.query.getParentElement(g,"FIGCAPTION")&&xt.query.getParentElement(g,xt.check.isList)&&(e.enterPrevent(d),t.push(li(a)),t.push(Xe(r))),!0)}(i,t,e))return i}const{fc:s,keyCode:n,shift:o,alt:l,ctrl:r,range:a}=e;if(o&&(ci?l:r)&&Et.isSpace(n))return i.push(Me()),i.push(ri()),i;const h=!a.collapsed||a.startContainer!==a.endContainer;return r||l||h||Et.isNonTextKey(n)||!xt.check.isBreak(a.commonAncestorContainer)?!s.has("documentType_use_header")||!h||r||l||o||Et.isDirectionKey(n)?(function(t,e,i){const{component:s}=e,{formatEl:n,range:o,selectionNode:l,keyCode:r}=i;let a=null;switch(r){case"ArrowUp":s.is(n.previousElementSibling)&&(a=s.get(n.previousElementSibling));break;case"ArrowLeft":if(xt.check.isEdgePoint(l,o.startOffset,"front")){const t=l.previousElementSibling||xt.query.getPreviousDeepestNode(l);t?s.is(t)&&(a=s.get(t)):s.is(n.previousElementSibling)&&(a=s.get(n.previousElementSibling))}break;case"ArrowDown":s.is(n.nextElementSibling)&&(a=s.get(n.nextElementSibling));break;case"ArrowRight":if(xt.check.isEdgePoint(l,o.endOffset,"end")){const t=l.nextElementSibling||xt.query.getNextDeepestNode(l);t?s.is(t)&&(a=s.get(t)):s.is(n.nextElementSibling)&&(a=s.get(n.nextElementSibling))}}a&&!a.options?.isInputComponent&&(t.push(Le()),t.push(ze(a)))}(i,t,e),i):(i.push(Oe()),i):(i.push(ai()),i)}const{_w:ui}=_t,pi=new RegExp(Ct.zeroWidthSpace+"+",""),gi={ctrl:!1,alt:!1},mi=Object.preventExtensions({value:[]});async function fi(t,e){if(this.isComposing=Et.isComposing(e))return!0;if(this.editor.selectMenuOn||!e.isTrusted)return;let i=this.selection.getNode();if(xt.check.isInputElement(i))return;if(this.menu.currentDropdownName)return;const s=e.code,n=Et.isShift(e),o=gi.ctrl=Et.isCtrl(e),l=gi.alt=Et.isAlt(e);if(!o&&t.get("isReadOnly")&&!Et.isDirectionKey(s))return e.preventDefault(),!1;if(this.menu.dropdownOff(),this.editor.isBalloon?this._hideToolbar():this.editor.isSubBalloon&&this._hideToolbar_sub(),!1===await this.triggerEvent("onKeyDown",{frameContext:t,event:e}))return;Et.isEnter(s)&&this.format.isLine(this.selection.getRange()?.startContainer)&&(this.selection._resetRangeToTextNode(),i=this.selection.getNode());const r=this.selection.getRange(),a=this.format.getLine(i,null)||i;if(o&&!Et.isNonTextKey(s)&&this.shortcuts.command(e,o,n,s,"",!1,null,null))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1;if(!o&&!Et.isNonTextKey(s)&&this.format.isLine(a)&&r.collapsed&&xt.check.isEdgePoint(r.startContainer,0,"front")){const t=r.startContainer.substringData?.(0,r.startOffset);if(t&&this.shortcuts.command(e,!1,n,s,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,status:this.status,options:this.options,frameOptions:this.frameOptions,range:r,selectionNode:i,formatEl:a,keyCode:s,ctrl:o,alt:l,shift:n},c=function(t,{_styleNodes:e}){const{selection:i,format:s,listFormat:n,component:o,html:l,nodeTransform:r,history:a,char:h,menu:c}=t;return{editor:{_nativeFocus:()=>t.editor._nativeFocus(),blur:()=>t.editor.blur()},selection:{getRange:()=>i.getRange(),getNode:()=>i.getNode(),setRange:(t,e,s,n)=>i.setRange(t,e,s,n),get:()=>i.get()},format:{isLine:t=>s.isLine(t),getLine:(t,e)=>s.getLine(t,e),getLines:t=>s.getLines(t),getBrLine:(t,e)=>s.getBrLine(t,e),getBlock:(t,e)=>s.getBlock(t,e),isNormalLine:t=>s.isNormalLine(t),isBrLine:t=>s.isBrLine(t),isClosureBrLine:t=>s.isClosureBrLine(t),isClosureBlock:t=>s.isClosureBlock(t),isEdgeLine:(t,e,i)=>s.isEdgeLine(t,e,i),removeBlock:(t,e)=>s.removeBlock(t,e),addLine:(t,e)=>s.addLine(t,e)},listFormat:{applyNested:(t,e)=>n.applyNested(t,e)},component:{deselect:()=>o.deselect(),is:t=>o.is(t),get:t=>o.get(t),select:(t,e)=>o.select(t,e)},html:{remove:()=>l.remove(),insert:(t,e)=>l.insert(t,e),insertNode:(t,e)=>l.insertNode(t,e)},history:{push:t=>a.push(!!t)},nodeTransform:{removeAllParents:(t,e,i)=>r.removeAllParents(t,e,i),split:(t,e,i)=>r.split(t,e,i)},char:{check:t=>h.check(t)},menu:{dropdownOff:()=>c.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){t.editor._iframeAutoHeight(t.frameContext),b&&t.scrollparents.length>0||t.selection.scrollTo(e,{behavior:"auto",block:"nearest",inline:"nearest"})},enterPrevent(e){e.preventDefault(),b&&(t.__focusTemp.focus({preventScroll:!0}),t.frameContext.get("wysiwyg").focus({preventScroll:!0}))}}}(this,{_styleNodes:mi}),d=await di(c,h);await async function(t,e){const i={...ke,...Ee};for(const s of t){if("action.stop"===s.t)return!1;const t=i[s.t];if(t&&!1===await t(e,s.p))return!1}}(d,{ports:c,ctx:h})}async function bi(t,e){if(this._onShortcutKey||this.menu.currentDropdownName)return;const i=e.code,s=Et.isCtrl(e),n=Et.isAlt(e);if(s&&(gi.ctrl=!1),n&&(gi.alt=!1),t.get("isReadOnly"))return;const o=this.selection.getRange();let l=this.selection.getNode();if((this.editor.isBalloon||this.editor.isSubBalloon)&&((this.editor.isBalloonAlways||this.editor.isSubBalloonAlways)&&!Et.isEsc(i)||!o.collapsed)){if(!this.editor.isBalloonAlways&&!this.editor.isSubBalloonAlways)return void(this.editor.isSubBalloon?this.subToolbar._showBalloon():this.toolbar._showBalloon());Et.isEsc(i)||this._showToolbarBalloonDelay()}if(Et.isBackspace(i)&&xt.check.isWysiwygFrame(l)&&""===l.textContent&&0===l.children.length){e.preventDefault(),e.stopPropagation(),l.innerHTML="";const s=xt.utils.createElement(this.format.isLine(this.status.currentNodes[0])&&!xt.check.isListCell(this.status.currentNodes[0])?this.status.currentNodes[0]:this.options.get("defaultLine"),null,"<br>");return l.appendChild(s),this.selection.setRange(s,0,s,0),this.applyTagEffect(),this.history.push(!1),void(t.has("documentType_use_header")&&Et.isDocumentTypeObserverKey(i)&&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++)Et.isEnter(i)&&/^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)||xt.check.isList(l)||null===this._setDefaultLine(this.format.isBlock(a)?"DIV":this.options.get("defaultLine"))||(l=this.selection.getNode());if(!gi.ctrl&&!gi.alt&&!Et.isNonTextKey(i)&&3===l.nodeType&&Ct.zeroWidthRegExp.test(l.textContent)&&!(void 0!==e.isComposing?e.isComposing:this.isComposing)){let t=o.startOffset,e=o.endOffset;const i=(l.textContent.substring(0,e).match(pi)||"").length;t=o.startOffset-i,e=o.endOffset-i,l.textContent=l.textContent.replace(Ct.zeroWidthRegExp,""),this.selection.setRange(l,t<0?0:t,l,e<0?0:e)}if(Et.isRemoveKey(i)&&xt.check.isZeroWidth(r?.textContent)&&!r.previousElementSibling&&!xt.check.isListCell(r)){const t=this.options.get("retainStyleMode");"none"!==t&&mi.value?.length>0?"repeat"===t?this.__retainTimer?(this.__retainTimer=ui.clearTimeout(this.__retainTimer),this._clearRetainStyleNodes(r)):(this.__retainTimer=ui.setTimeout((()=>{this.__retainTimer=null}),0),this._retainStyleNodes(r,mi.value)):(this.__retainTimer=null,this._retainStyleNodes(r,mi.value)):this._clearRetainStyleNodes(r)}if(t.has("documentType_use_header"))if(Et.isDocumentTypeObserverKey(i)){t.get("documentType").reHeader();const e=xt.query.getParentElement(this.selection.selectionNode,this.format.isLine.bind(this.format));t.get("documentType").on(e)}else{const e=xt.query.getParentElement(l,(t=>1===t.nodeType));t.get("documentType").onChangeText(e)}!1!==await this.triggerEvent("onKeyUp",{frameContext:t,event:e})&&!1!==await this._callPluginEventAsync("onKeyUp",{frameContext:t,event:e,range:o,line:r})&&Et.isHistoryRelevantKey(i)&&this.history.push(!0)}function yi(t,e){const i=e.clipboardData;return!i||this._dataTransferAction("paste",e,i,t)}async function vi(t,e){const i=e.clipboardData;if(!1===await this.triggerEvent("onCopy",{frameContext:t,event:e,clipboardData:i}))return e.preventDefault(),e.stopPropagation(),!1;const s=t.get("_ww").getSelection();this.__secopy=s.toString()}async function _i(t,e){const i=e.clipboardData;if(!1===await this.triggerEvent("onCut",{frameContext:t,event:e,clipboardData:i}))return e.preventDefault(),e.stopPropagation(),!1;const s=t.get("_ww").getSelection();this.__secopy=s.toString(),this._w.setTimeout((()=>{this.history.push(!1)}),0)}function Ci(t,e,i,s,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(i){const t=this.offset.getGlobal(i),e=s?this.context.get("toolbar_main").offsetHeight:0;c.y=t.top+e-this._w.scrollY,c.x=t.left-this._w.scrollX}const d=h.getBoundingClientRect();if(d.height>0){const i=t.get("wysiwygFrame");let s=0,n=0;/^iframe$/i.test(i.nodeName)&&(s=i.offsetLeft,n=i.offsetTop),e.style.left=`${d.right+this._w.scrollX+c.x+s}px`,e.style.top=`${d.top+this._w.scrollY+c.y-5+n}px`,e.style.height=`${d.height+10}px`,e.style.display="block"}else e.style.display="none"}function wi(t){t.style.display="none"}function xi(t,e,i){try{if(t.get("isReadOnly"))return i.preventDefault(),i.stopPropagation(),!1;const e=i.dataTransfer;if(!e)return!0;const{sc:s,so:n,ec:o,eo:l}=this.selection.getDragEventLocationRange(i);if(!s)return;if(xt.query.getParentElement(s,".se-disable-pointer"))return void i.preventDefault();if(he.get("__dragContainer")){if(i.preventDefault(),he.get("__dragContainer").contains(i.target))return void this.component.deselect();const e=he.get("__dragContainer");return this.component.deselect(),this.selection.setRange(s,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(s,n,o,l),this._dataTransferAction("drop",i,e,t)}finally{e.style.display="none"}}const{_w:ki,_d:Ei,isMobile:Si,isTouchDevice:Ti}=_t;function Hi(t){re.call(this,t),this.isComposing=!1,this.scrollparents=[],this._events=[],this._onButtonsCheck=new RegExp(`^(${Object.keys(t.options.get("_defaultStyleTagMap")).join("|")})$`,"i"),this._onShortcutKey=!1,this._handledInBefore=!1,this._balloonDelay=null,this._wwFrameObserver=null,this._toolbarObserver=null,this._lineBreakComp=null,this._formatAttrsTemp=null,this._resizeClientY=0,this.__resize_editor=null,this.__close_move=null,this.__geckoActiveEvent=null,this.__cacheStyleNodes=[],this.__selectionSyncEvent=null,this._inputFocus=!1,this.__inputPlugin=null,this.__inputBlurEvent=null,this.__inputKeyEvent=null,this.__focusTemp=this.carrierWrapper.querySelector(".__se__focus__temp__"),this.__retainTimer=null,this.__eventDoc=null,this.__secopy=null}function Li(t,e,i){this._moveContainer(e),this._scrollContainer(),this._callPluginEvent("onScroll",{frameContext:t,event:i}),t.has("documentType_use_page")&&t.get("documentType").scrollPage(),this.triggerEvent("onScroll",{frameContext:t,event:i})}function Mi(t,e){if(this.selection.__iframeFocus||t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),!1;this.status.hasFocus=!0,this.component.__prevent=!1,this.triggerEvent("onNativeFocus",{frameContext:t,event:e});const i=t.get("key");this._inputFocus?this.editor.isInline&&ki.setTimeout((()=>{this.toolbar._showInline()}),0):this.status.rootKey===i&&this.editor._preventBlur||this.editor._preventFocus||(this.editor._preventFocus=!0,xt.utils.removeClass(this.editor.commandTargets.get("codeView"),"active"),xt.utils.setDisabled(this.editor._codeViewDisabledButtons,!1),this.editor.changeFrameContext(i),this.history.resetButtons(i,null),ki.setTimeout((()=>{this.__postFocusEvent(t,e)}),0))}function Ni(t,e){t.get("isCodeView")||t.get("isReadOnly")||t.get("isDisabled")||(this.status.hasFocus=!1,this.editor.effectNode=null,this.triggerEvent("onNativeBlur",{frameContext:t,event:e}),this._inputFocus||this.editor._preventBlur||(this.editor._preventFocus=!1,this._setKeyEffect([]),this.status.currentNodes=[],this.status.currentNodesMap=[],this.ui._offCurrentController(),this.editor.applyFrameRoots((t=>{t.get("navigation")&&(t.get("navigation").textContent="")})),this.history.check(t.get("key"),this.status._range),this.__postBlurEvent(t,e)))}function Ai(t){t.stopPropagation(),this._resizeClientY=t.clientY,this.ui.enableBackWrapper("ns-resize"),this.__resize_editor=this.addGlobalEvent("mousemove",Bi.bind(this)),this.__close_move=this.addGlobalEvent("mouseup",Vi.bind(this))}function Bi(t){const e=this.frameContext,i=e.get("wrapper").offsetHeight+(t.clientY-this._resizeClientY),s=i<e.get("_minHeight")?e.get("_minHeight"):i;e.get("wysiwygFrame").style.height=e.get("code").style.height=s+"px",this._resizeClientY=t.clientY,_t.isResizeObserverSupported||this.editor.__callResizeFunction(e,s,null)}function Vi(){this.ui.disableBackWrapper(),this.__resize_editor&&=this.removeGlobalEvent(this.__resize_editor),this.__close_move&&=this.removeGlobalEvent(this.__close_move)}function Ii(t,e){e.preventDefault();const i=this._lineBreakComp;if(!i)return;const s=xt.check.isListCell(i.parentElement),n=xt.utils.createElement(s?"BR":xt.check.isTableCell(i.parentElement)?"DIV":this.options.get("defaultLine"));if(s||(n.innerHTML="<br>"),"byte-html"!==this.frameOptions.get("charCounter_type")||this.char.check(n.outerHTML)){i.parentNode.insertBefore(n,"t"===t?i:i.nextSibling),this.component.deselect();try{const t=s?n:n.firstChild;this.selection.setRange(t,1,t,1),this.history.push(!1)}catch(t){console.warn("[SUNEDITOR.lineBreaker.error]",t)}}}function Oi(){this.status.initViewportHeight=ki.visualViewport.height,Si||this.ui._offCurrentController(),this.editor.isBalloon?this.toolbar.hide():this.editor.isSubBalloon&&this.subToolbar.hide(),this._resetFrameStatus()}function Ri(){Si&&this.options.get("toolbar_sticky")>-1&&(this.toolbar._resetSticky(),this.editor.menu._restoreMenuPosition()),this._scrollContainer(),this.__setViewportSize()}function Fi(){this.options.get("toolbar_sticky")>-1&&this.toolbar._resetSticky(),this.editor.isBalloon&&"block"===this.context.get("toolbar_main").style.display?this.toolbar._setBalloonOffset("top"===this.toolbar._balloonOffset.position):this.editor.isSubBalloon&&"block"===this.context.get("toolbar_sub_main").style.display&&this.subToolbar._setBalloonOffset("top"===this.subToolbar._balloonOffset.position),this._scrollContainer(),this.frameContext.has("documentType_use_page")&&this.frameContext.get("documentType").scrollWindow()}function zi(){this.options.get("toolbar_sticky")>-1&&(this.toolbar._resetSticky(),this.editor.menu._restoreMenuPosition())}function $i(t){if(this.editor._preventSelection)return;let e=t.getSelection().anchorNode;this.editor.applyFrameRoots((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=xt.query.getParentElement(this.selection.selectionNode,this.format.isLine.bind(this.format));t.get("documentType").on(e)}}}))}function Pi(){this.menu.dropdownOff(),this._scrollContainer()}function Di(t){this.editor.changeFrameContext(t.get("key")),xt.utils.addClass(this.editor.commandTargets.get("codeView"),"active"),xt.utils.setDisabled(this.editor._codeViewDisabledButtons,!0)}Hi.prototype={addEvent(t,e,i,s){if(!t)return null;if((t===ki||t===Ei||"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,i,s),this._events.push({target:t[o],type:e,listener:i,useCapture:s});return{target:n>1?t:t[0],type:e,listener:i,useCapture:s}},removeEvent(t){if(!t)return;let e=t.target;const i=t.type,s=t.listener,n=t.useCapture;if(e&&((!kt.is(e.length)||e.nodeName||!Array.isArray(e)&&e.length<1)&&(e=[e]),0!==e.length)){for(let t=0,o=e.length;t<o;t++)e[t].removeEventListener(i,s,n);return null}},addGlobalEvent(t,e,i){return this.frameOptions.get("iframe")&&this.frameContext.get("_ww").addEventListener(t,e,i),ki.addEventListener(t,e,i),{type:t,listener:e,useCapture:i}},removeGlobalEvent(t,e,i){if(t)return"object"==typeof t&&(e=t.listener,i=t.useCapture,t=t.type),this.frameOptions.get("iframe")&&this.frameContext.get("_ww").removeEventListener(t,e,i),ki.removeEventListener(t,e,i),null},applyTagEffect(t){if(t||=this.selection.getNode(),t===this.editor.effectNode)return;this.editor.effectNode=t;const e=this.options.get("_rtl")?"marginRight":"marginLeft",i=this.plugins,s=this.editor.commandTargets,n=this._onButtonsCheck,o=this.options.get("_styleCommandMap"),l=[],r=[],a=this.options.get("_textStyleTags"),h=[],c=[],d=this.editor.activeCommands,u=d.length;let p="";if(this.component.is(t)&&!this.component.__selectionSelected){const e=this.component.get(t);if(!e)return;return this.editor.effectNode=null,void this.component.select(e.target,e.pluginName)}for(;t.firstChild;)t=t.firstChild;const g=this.frameContext,m=!g.get("isReadOnly");for(let g=t;!xt.check.isWysiwygFrame(g)&&g;g=g.parentElement)if(1===g.nodeType&&!xt.check.isBreak(g)){if(this._isNonFocusNode(g))return void this.editor.blur();if(p=g.nodeName.toLowerCase(),r.push(p),a.includes(p)&&!this.format.isLine(p)&&h.push(g),m)for(let t,e=0;e<u;e++)t=d[e],!l.includes(t)&&!c.includes(t)&&s.get(t)&&s.get(t).filter((e=>{const s=i[t]?.active(g,e);return void 0===s&&c.push(t),s})).length>0&&l.push(t);if(this.format.isLine(g)){if(!l.includes("outdent")&&s.has("outdent")&&(xt.check.isListCell(g)||g.style[e]&&kt.get(g.style[e],0)>0)&&s.get("outdent").filter((t=>!xt.check.isImportantDisabled(t)&&(t.disabled=!1,!0))).length>0&&l.push("outdent"),!l.includes("indent")&&s.has("indent")){const t=xt.check.isListCell(g)&&!g.previousElementSibling;s.get("indent").filter((e=>!xt.check.isImportantDisabled(e)&&(e.disabled=t,!0))).length>0&&l.push("indent")}}else n.test(p)&&(p=o[p]||p,l.push(p),xt.utils.addClass(s.get(p),"active"))}return this._setKeyEffect(l),this.__cacheStyleNodes=h.reverse(),this.status.currentNodes=r.reverse(),this.status.currentNodesMap=l,this.frameOptions.get("statusbar_showPathLabel")&&g.get("navigation")&&(g.get("navigation").textContent=this.options.get("_rtl")?this.status.currentNodes.reverse().join(" < "):this.status.currentNodes.join(" > ")),t},_injectActiveEvent(t){xt.utils.addClass(t,"__se__active"),this.__geckoActiveEvent=this.addGlobalEvent("mouseup",(()=>{xt.utils.removeClass(t,"__se__active"),this.__geckoActiveEvent=this.removeGlobalEvent(this.__geckoActiveEvent)}))},_setKeyEffect(t){const e=this.editor.activeCommands,i=this.editor.commandTargets,s=this.plugins;for(let n,o,l,r=0,a=e.length;r<a;r++)if(n=e[r],!t.includes(n)&&(o=i.get(n))){l=s[n];for(let t,e=0,i=o.length;e<i;e++)t=o[e],t&&(l?l.active(null,t):/^outdent$/i.test(n)?xt.check.isImportantDisabled(t)||(t.disabled=!0):/^indent$/i.test(n)?xt.check.isImportantDisabled(t)||(t.disabled=!1):xt.utils.removeClass(t,"active"))}},_showToolbarBalloonDelay(){this._balloonDelay&&ki.clearTimeout(this._balloonDelay),this._balloonDelay=ki.setTimeout((()=>{ki.clearTimeout(this._balloonDelay),this._balloonDelay=null,this.editor.isSubBalloon?this.subToolbar._showBalloon():this.toolbar._showBalloon()}),250)},_toggleToolbarBalloon(){this.selection._init();const t=this.selection.getRange(),e=this.options.has("_subMode");!(e?this.editor.isSubBalloonAlways:this.editor.isBalloonAlways)&&t.collapsed?e?this._hideToolbar_sub():this._hideToolbar():e?this.subToolbar._showBalloon(t):this.toolbar._showBalloon(t)},_hideToolbar(){this.editor._notHideToolbar||this.frameContext.get("isFullScreen")||this.toolbar.hide()},_hideToolbar_sub(){this.subToolbar&&!this.editor._notHideToolbar&&this.subToolbar.hide()},_isNonFocusNode:t=>xt.check.isElement(t)&&"true"===t.getAttribute("data-se-non-focus"),_setDefaultLine(t){if(!this.options.get("__lineFormatFilter"))return null;if(this.editor._fileManager.pluginRegExp.test(this.editor.currentControllerName))return;const e=this.selection.getRange(),i=e.commonAncestorContainer,s=e.startContainer,n=e.endOffset,o=this.format.getBlock(i,null);let l,r,a;if(o)return a=xt.utils.createElement(t||this.options.get("defaultLine")),a.innerHTML=o.innerHTML,0===a.childNodes.length&&(a.innerHTML=Ct.zeroWidthSpace),o.innerHTML=a.outerHTML,a=o.firstChild,l=a.childNodes[n]||xt.query.getEdgeChildNodes(a,null).sc,l||(l=xt.utils.createTextNode(Ct.zeroWidthSpace),a.insertBefore(l,a.firstChild)),r=l.textContent.length,void this.selection.setRange(l,r,l,r);if(3===i.nodeType&&this.component.is(i.parentElement)){const t=this.component.get(i.parentElement);if(!t)return;const e=t.container;if(i.parentElement===e){const t=i.nextElementSibling?e:e.nextElementSibling,s=xt.utils.createElement(this.options.get("defaultLine"),null,i);return e.parentElement.insertBefore(s,t),void this.editor.focusEdge(s)}return this.component.select(t.target,t.pluginName),null}if(1===i.nodeType&&"true"===i.getAttribute("data-se-embed")){let t=i.nextElementSibling;return this.format.isLine(t)||(t=this.format.addLine(i,this.options.get("defaultLine"))),void this.selection.setRange(t.firstChild,0,t.firstChild,0)}if(!this.format.isBlock(s)&&!xt.check.isWysiwygFrame(s)||!this.component.is(s.children[e.startOffset])&&!this.component.is(s.children[e.startOffset-1])){if(xt.query.getParentElement(i,xt.check.isExcludeFormat))return null;if(this.format.isBlock(i)&&i.childNodes.length<=1){let t=null;return 1===i.childNodes.length&&xt.check.isBreak(i.firstChild)?t=i.firstChild:(t=xt.utils.createTextNode(Ct.zeroWidthSpace),i.appendChild(t)),void this.selection.setRange(t,1,t,1)}try{if(3===i.nodeType&&(a=xt.utils.createElement(t||this.options.get("defaultLine")),i.parentNode.insertBefore(a,i),a.appendChild(i)),xt.check.isBreak(a.nextSibling)&&xt.utils.removeItem(a.nextSibling),xt.check.isBreak(a.previousSibling)&&xt.utils.removeItem(a.previousSibling),xt.check.isBreak(l)){const t=xt.utils.createTextNode(Ct.zeroWidthSpace);l.parentNode.insertBefore(t,l),l=t}}catch{return this.editor.execCommand("formatBlock",!1,t||this.options.get("defaultLine")),this.editor.effectNode=null,void this.selection._init()}if(a&&(xt.check.isBreak(a.nextSibling)&&xt.utils.removeItem(a.nextSibling),xt.check.isBreak(a.previousSibling)&&xt.utils.removeItem(a.previousSibling),xt.check.isBreak(l))){const t=xt.utils.createTextNode(Ct.zeroWidthSpace);l.parentNode.insertBefore(t,l),l=t}this.editor.effectNode=null,s?this.selection.setRange(s,1,s,1):this.editor._nativeFocus()}},async _dataTransferAction(t,e,i,s){try{return this.ui.showLoading(),await this._setClipboardData(t,e,i,s),e.preventDefault(),e.stopPropagation(),!1}catch(t){console.warn("[SUNEDITOR.paste.error]",t)}finally{this.ui.hideLoading()}},async _setClipboardData(t,e,i,s){e.preventDefault(),e.stopPropagation();let n=i.getData("text/plain"),o=i.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.options.get("autoLinkify")){const t=(new DOMParser).parseFromString(o,"text/html");xt.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.triggerEvent("onPaste",{frameContext:s,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.triggerEvent("onDrop",{frameContext:s,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=i.files;if(d.length>0&&!a){for(let t=0,i=d.length;t<i;t++)await this._callPluginEventAsync("onFilePasteAndDrop",{frameContext:s,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:s,event:e,data:o,doc:t})&&this.html.insert(o,{selectInserted:!1,skipCharCount:!0,skipCleaning:!0}),s.has("documentType_use_header")&&s.get("documentType").reHeader(),!1}},_addCommonEvents(){const t=de.bind(this),e=pe.bind(this);this.addEvent(this.context.get("menuTray"),"mousedown",t,!1),this.addEvent(this.context.get("menuTray"),"click",ue.bind(this),!0),this.addEvent(this.context.get("toolbar_main"),"mousedown",t,!1),this.addEvent(this.context.get("toolbar_main"),"click",e,!1),this.options.has("_subMode")&&(this.addEvent(this.context.get("toolbar_sub_main"),"mousedown",t,!1),this.addEvent(this.context.get("toolbar_sub_main"),"click",e,!1)),this.toolbar._setResponsive(),_t.isResizeObserverSupported&&(this._toolbarObserver=new ResizeObserver((()=>{ki.setTimeout((()=>{this.toolbar.resetResponsiveToolbar()}),0)})),this._wwFrameObserver=new ResizeObserver((t=>{ki.setTimeout((()=>{t.forEach((t=>{this.editor.__callResizeFunction(this.frameRoots.get(t.target.getAttribute("data-root-key")),-1,t)}))}),0)}))),this.options.get("closeModalOutsideClick")&&this.addEvent(this.carrierWrapper.querySelector(".se-modal .se-modal-inner"),"click",(t=>{t.target===this.carrierWrapper.querySelector(".se-modal .se-modal-inner")&&this.ui._offCurrentModal()}),!1),this.addEvent(ki,"resize",Oi.bind(this),!1),this.addEvent(ki.visualViewport,"resize",Ri.bind(this),!1),this.addEvent(ki,"scroll",Fi.bind(this),!1),Ti&&this.addEvent(ki.visualViewport,"scroll",zi.bind(this),!1)},_addFrameEvents(t){const e=t.get("options").get("iframe"),i=e?t.get("_ww"):t.get("wysiwyg");t.set("eventWysiwyg",i);const s=t.get("code"),n=this.editor.carrierWrapper.querySelector(".se-drag-cursor"),o=_e.bind(this,t);this.addEvent(i,"mousemove",o,!1),this.addEvent(i,"mouseleave",Ce.bind(this,t),!1),this.addEvent(i,"mousedown",be.bind(this,t),!1),this.addEvent(i,"mouseup",ye.bind(this,t),!1),this.addEvent(i,"click",ve.bind(this,t),!1),this.addEvent(i,"beforeinput",we.bind(this,t),!1),this.addEvent(i,"input",xe.bind(this,t),!1),this.addEvent(i,"keydown",fi.bind(this,t),!1),this.addEvent(i,"keyup",bi.bind(this,t),!1),this.addEvent(i,"paste",yi.bind(this,t),!1),this.addEvent(i,"copy",vi.bind(this,t),!1),this.addEvent(i,"cut",_i.bind(this,t),!1),this.addEvent(i,"dragover",Ci.bind(this,t,n,e?this.frameContext.get("topArea"):null,!this.options.get("toolbar_container")&&!this.editor.isBalloon&&!this.editor.isInline),!1),this.addEvent(i,"dragend",wi.bind(this,n),!1),this.addEvent(i,"drop",xi.bind(this,t,n),!1),this.addEvent(i,"scroll",Li.bind(this,t,i),{passive:!0,capture:!1}),this.addEvent(i,"focus",Mi.bind(this,t),!1),this.addEvent(i,"blur",Ni.bind(this,t),!1),this.addEvent(s,"mousedown",Di.bind(this,t),!1);const l=t.get("wrapper").querySelector(".se-drag-handle");if(this.addEvent(l,"wheel",(t=>{t.preventDefault(),this.component.deselect()}),!1),this.addEvent(t.get("lineBreaker_t"),"pointerdown",Ii.bind(this,"t"),!1),this.addEvent(t.get("lineBreaker_b"),"pointerdown",Ii.bind(this,"b"),!1),Ti&&this.addEvent(i,"touchstart",o,{passive:!0,capture:!1}),!this.options.get("hasCodeMirror")){const e=t.get("codeNumbers"),i=this.viewer._codeViewAutoHeight.bind(this.viewer,t.get("code"),e,"auto"===this.frameOptions.get("height"));this.addEvent(s,"keydown",i,!1),this.addEvent(s,"keyup",i,!1),this.addEvent(s,"paste",i,!1),e&&this.addEvent(s,"scroll",this.viewer._scrollLineNumbers.bind(s,e),!1)}t.has("statusbar")&&this.__addStatusbarEvent(t,t.get("options"));const r=Pi.bind(this),a=xt.query.getScrollParents(t.get("originElement"));for(const t of a)this.scrollparents.push(t),this.addEvent(t,"scroll",r,!1);this.addEvent(this.__focusTemp,"focus",(t=>t.preventDefault()),!1),this.__eventDoc!==t.get("_wd")&&(this.__eventDoc=t.get("_wd"),this.addEvent(this.__eventDoc,"selectionchange",$i.bind(this,this.__eventDoc),!1))},__addStatusbarEvent(t,e){/\d+/.test(e.get("height"))&&e.get("statusbar_resizeEnable")?e.set("__statusbarEvent",this.addEvent(t.get("statusbar"),"mousedown",Ai.bind(this),!1)):xt.utils.addClass(t.get("statusbar"),"se-resizing-none")},_removeAllEvents(){for(let t,e=0,i=this._events.length;e<i;e++)t=this._events[e],t.target.removeEventListener(t.type,t.listener,t.useCapture);this._events=[],this._wwFrameObserver&&(this._wwFrameObserver.disconnect(),this._wwFrameObserver=null),this._toolbarObserver&&(this._toolbarObserver.disconnect(),this._toolbarObserver=null)},_moveContainer(t){const e=t.scrollTop||t.scrollY||0,i=t.scrollLeft||t.scrollX||0;if(this.editor.isBalloon?(this.context.get("toolbar_main").style.top=this.toolbar._balloonOffset.top-e+"px",this.context.get("toolbar_main").style.left=this.toolbar._balloonOffset.left-i+"px"):this.editor.isSubBalloon&&(this.context.get("toolbar_sub_main").style.top=this.subToolbar._balloonOffset.top-e+"px",this.context.get("toolbar_sub_main").style.left=this.subToolbar._balloonOffset.left-i+"px"),this.editor._controllerTargetContext!==this.frameContext.get("topArea")&&this.ui._offCurrentController(),this.editor._lineBreaker_t){const t=this.editor._lineBreaker_t.style;if("none"!==t.display){const s=(this.editor._lineBreaker_t.getAttribute("data-offset")||",").split(",");t.top=kt.get(t.top,0)-(e-kt.get(s[0],0))+"px",t.left=kt.get(t.left,0)-(i-kt.get(s[1],0))+"px",this.editor._lineBreaker_t.setAttribute("data-offset",e+","+i)}}if(this.editor._lineBreaker_b){const t=this.editor._lineBreaker_b.style;if("none"!==t.display){const s=(this.editor._lineBreaker_b.getAttribute("data-offset")||",").split(",");t.top=kt.get(t.top,0)-(e-kt.get(s[0],0))+"px",t[s[1]]=kt.get(t[s[1]],0)-(i-kt.get(s[2],0))+"px",this.editor._lineBreaker_b.setAttribute("data-offset",e+","+s[1]+","+i)}}const s=this.editor.opendControllers;for(let t=0;t<s.length;t++)s[t].notInCarrier&&(s[t].form.style.top=s[t].inst.__offset.top-e+"px",s[t].form.style.left=s[t].inst.__offset.left-i+"px")},_scrollContainer(){this.menu.currentDropdownActiveButton&&this.menu.currentDropdown&&this.menu._resetMenuPosition(this.menu.currentDropdownActiveButton,this.menu.currentDropdown);const t=this.editor.opendControllers;0!==t.length&&this.__rePositionController(t)},__rePositionController(t){he.get("__dragMove")&&he.get("__dragMove")();for(let e=0;e<t.length;e++)t[e].notInCarrier||t[e].inst?._scrollReposition()},_resetFrameStatus(){_t.isResizeObserverSupported||(this.toolbar.resetResponsiveToolbar(),this.options.get("_subMode")&&this.subToolbar.resetResponsiveToolbar());const t=this.context.get("toolbar_main"),e="none"===t.style.display||this.editor.isInline&&!this.toolbar._inlineToolbarAttr.isShow;if(0===t.offsetWidth&&!e)return;const i=this.editor.opendBrowser;if(i&&"block"===i.area.style.display&&(i.body.style.maxHeight=xt.utils.getClientSize().h-i.header.offsetHeight-50+"px"),this.menu.currentDropdownActiveButton&&this.menu.currentDropdown&&this.menu._resetMenuPosition(this.menu.currentDropdownActiveButton,this.menu.currentDropdown),this.viewer._resetFullScreenHeight())return;const s=this.frameContext;s.get("isCodeView")&&this.editor.isInline?this.toolbar._showInline():(this.editor._iframeAutoHeight(s),this.toolbar.isSticky&&(this.context.get("toolbar_main").style.width=s.get("topArea").offsetWidth-2+"px",this.toolbar._resetSticky()))},_setSelectionSync(){this.removeGlobalEvent(this.__selectionSyncEvent),this.__selectionSyncEvent=this.addGlobalEvent("mouseup",(()=>{this.selection._init(),this.removeGlobalEvent(this.__selectionSyncEvent)}))},_retainStyleNodes(t,e){let i=e[0].cloneNode(!1);for(let t,s=1,n=e.length;s<n;s++)t=e[s].cloneNode(!1),i.appendChild(t),i=t;const{parent:s,inner:n}=this.nodeTransform.createNestedNode(e,null),o=xt.utils.createTextNode(Ct.zeroWidthSpace);n.appendChild(o),t.innerHTML="",t.appendChild(s),this.selection.setRange(o,1,o,1)},_clearRetainStyleNodes(t){t.innerHTML="<br>",this.selection.setRange(t,0,t,0)},_callPluginEvent(t,e){const i=this.editor._onPluginEvents.get(t);for(let t,s=0;s<i.length;s++)if(t=i[s](e),"boolean"==typeof t)return t},async _callPluginEventAsync(t,e){const i=this.editor._onPluginEvents.get(t);for(let t,s=0;s<i.length;s++)if(t=await i[s](e),"boolean"==typeof t)return t},__removeInput(){this._inputFocus=this.editor._preventBlur=!1,this.__inputBlurEvent=this.removeEvent(this.__inputBlurEvent),this.__inputKeyEvent=this.removeEvent(this.__inputKeyEvent),this.__inputPlugin=null},__postFocusEvent(t,e){(this.editor.isInline||this.editor.isBalloonAlways)&&this.toolbar.show(),this.editor.isSubBalloonAlways&&this.subToolbar.show(),this.triggerEvent("onFocus",{frameContext:t,event:e}),this._callPluginEvent("onFocus",{frameContext:t,event:e})},__postBlurEvent(t,e){(this.editor.isInline||this.editor.isBalloon)&&this._hideToolbar(),this.editor.isSubBalloon&&this._hideToolbar_sub(),this.triggerEvent("onBlur",{frameContext:t,event:e}),this._callPluginEvent("onBlur",{frameContext:t,event:e})},__setViewportSize(){this.status.currentViewportHeight=kt.get(ki.visualViewport.height,0)},constructor:Hi};const qi=Hi,{_w:Wi}=_t,Ui=Math.floor(96/72*841.89105);function Zi(t,e){this.editor=t,this.status=t.status,this.context=t.context,this.selection=t.selection,this.offset=t.offset,this.fc=e,this.ww=e.get("wysiwyg"),this.wwFrame=e.get("wysiwygFrame"),this.wwWidth=-1,this.wwHeight=-1,this.innerHeaders=[],this._wwHeaders=[],this.documentTypeInner=e.get("documentTypeInner"),this.inner=null,this.page=null,this.totalPages=0,this.pageNum=0,this.pageHeight=-1,this.pageBreaksCnt=0,this.pages=[],this.pages_line=[],this.prevScrollTop=0,this.useHeader=t.options.get("_type_options").includes("header"),this.usePage=t.options.get("_type_options").includes("page"),this.navigatorButtons=[],this.pageNavigator=null,this._mirror=e.get("documentTypePageMirror"),this._mirrorCache=0,this._positionCache=new Map,this._rePageTimeout=null;const i=Wi.getComputedStyle(this._mirror);if(this._paddingTop=kt.get(i.paddingTop),this._paddingBottom=kt.get(i.paddingBottom),this.useHeader){const t=this._getHeaders(),e=this.inner=this.documentTypeInner.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${kt.get(e.nodeName)}" title="${e.textContent}">${e.textContent}</div>`;e.innerHTML=i,this.innerHeaders=e.querySelectorAll("div"),this.editor.eventManager.addEvent(e,"click",Gi.bind(this,this.ww))}this.usePage&&(this.page=e.get("documentTypePage"),this.pageNavigator=t.plugins.pageNavigator)}function Gi(t,e){e.preventDefault();try{this.editor._preventBlur=!0;const t=xt.query.getEventTarget(e);if(xt.utils.hasClass(t,"se-doc-item")){const e=Array.prototype.indexOf.call(this.innerHeaders,t);if(-1===e)return;const i=this._wwHeaders[e];i&&this.selection.scrollTo(i)}}finally{this.editor._preventBlur=!1}}Zi.prototype={reHeader(){if(!this.useHeader)return;const t=this._getHeaders(),e=this.inner,i=this.innerHeaders;for(let s,n,o,l=0,r=t.length;l<r;l++)if(s=t[l],n=`se-doc-h${kt.get(s.nodeName)}`,o=i[l],l<i.length)o.classList.contains(n)&&o.textContent===s.textContent||(o.textContent=o.title=s.textContent,o.className=`se-doc-item ${n}`);else{const t=document.createElement("div");t.className=`se-doc-item ${n}`,t.textContent=t.title=s.textContent,e.appendChild(t)}if(i.length>t.length)for(let s=t.length;s<i.length;s++)e.removeChild(i[s]);this.innerHeaders=e.querySelectorAll("div")},async rePage(t){this.page&&(this._rePageTimeout&&Wi.clearTimeout(this._rePageTimeout),this._rePageTimeout=Wi.setTimeout((async()=>{await xt.utils.waitForMediaLoad(this._mirror,1500);const e=this.ww.scrollHeight>this._mirror.scrollHeight?this.ww.scrollHeight-this._mirror.scrollHeight:0,i=this._mirror.scrollHeight+e,s=this.ww.querySelectorAll(".se-page-break");if(!t&&this.pageHeight===i&&this.pageBreaksCnt===s.length)return;this.pageHeight=i,this.pageBreaksCnt=s.length;let n=0,o=0,l=0;if(s.length>0){n=s[0].offsetHeight;for(let t=0;t<s.length;t++){const e=s[t].offsetTop;(e-o)%Ui!=0&&l++,o=e}const t=i-o;t>0&&t%Ui!=0&&l++}const r=this.status.isScrollable(this.fc)?this._getWWScrollTop():0,a=Math.ceil(i/Ui)+l,h=this.wwFrame.offsetWidth+1,c=[];for(let t=0;t<s.length;t++)c.push({number:t,top:s[t].offsetTop+n/2-r});this._mirrorCache=0;const d=this.ww.children,u=this._mirror.children;this._initializeCache(u),c.push({number:0,top:0});for(let t=1,e=0;t<a;t++)if(e+=Ui+(1===t?this._paddingTop+this._paddingBottom:this._paddingTop),!c.some((t=>Math.abs(t.top-e)<3))){const i=this._calcPageBreakTop(e,d,u);if(null===i)break;c.push({number:t,top:i})}if(0===c.length)return this.pages_line=[],this.totalPages=1,void this._displayCurrentPage();c.sort(((t,e)=>t.top-e.top)),this.page.innerHTML="",this.pages=[];for(let t,e=0;e<a;e++){if(!c[e])continue;if(t=c[e].top,i<t)break;const s=xt.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.page.appendChild(s),this.pages.push(s)}this.pages_line=this.page.querySelectorAll(".se-document-page-line"),this.totalPages=this.pages.length,this._displayCurrentPage()}),400))},_getDisplayPage(){return this.status.isScrollable(this.fc)?this.fc.get("wysiwyg"):Wi},_calcPageBreakTop(t,e,i){const{ci:s}=this._getElementAtPosition(t,i),n=i[s],o=e[s];if(!n||!o)return null;const l=t+(o.offsetTop-n.offsetTop)+(o.offsetHeight-n.offsetHeight)/2;return Math.round(l)},_initializeCache(t){this._positionCache.clear();for(let e=0,i=t.length;e<i;e++){const i=t[e],s=i.offsetTop,n=i.offsetHeight,o=s+n;this._positionCache.set(e,{top:s,height:n,bottom:o})}},_getElementAtPosition(t,e){let i=this._mirrorCache,s=e.length-1;for(;i<=s;){const e=Math.floor((i+s)/2),{top:n,height:o,bottom:l}=this._positionCache.get(e);if(t>=n&&t<=l)return this._mirrorCache=e,{ci:e,cm:t-l,ch:o};t<n?s=e-1:i=e+1}const n=e[i]?i:s;this._mirrorCache=n;const o=this._positionCache.get(n);return{ci:n,cm:t-o.bottom,ch:o.height}},resizePage(){const t=this.wwFrame.offsetWidth+1,e=this.wwFrame.offsetHeight+1;let i=!1;if(t===this.wwWidth&&(i=e===this.wwHeight))return;t>800?xt.utils.removeClass(this.documentTypeInner,"se-document-responsible"):xt.utils.addClass(this.documentTypeInner,"se-document-responsible"),this.wwWidth=t,this.wwHeight=e;const s=this.pages_line;for(let e=0,i=s.length;e<i;e++)s[e].style.width=`${t}px`;i||this.rePage(!0),this._displayCurrentPage()},scrollPage(){const t=this.prevScrollTop,e=this._getWWScrollTop();if(t===e)return;const i=this.pages;for(let s=0,n=i.length;s<n;s++)i[s].style.top=kt.get(i[s].style.top)-(e-t)+"px";this.prevScrollTop=e,this._displayCurrentPage()},scrollWindow(){this.status.isScrollable(this.fc)||this._displayCurrentPage()},getCurrentPageNumber(){if(this.totalPages<=1)return 1;let t=0;if(this.status.isScrollable(this.fc))t=this.wwHeight/2;else{const e=this._getGlobalTop();if(t=Wi.scrollY-e+Ui/2,t<=0)return 1}const e=this.pages;for(let i=0,s=e.length;i<s;i++)if(e[i].offsetTop>=t)return this.pageNum=i;return this.pageNum=this.totalPages},pageUp(){const t=this.pageNum-1<=1?1:this.pageNum-1;this._movePage(t,!1)},pageDown(){const t=this.pageNum+1>this.pages.length?this.pages.length:this.pageNum+1;this._movePage(t,!1)},pageGo(t){t<1?t=1:t>this.pages.length&&(t=this.pages.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&&(xt.utils.removeClass(this.innerHeaders,"active"),xt.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.pageNavigator?.display(t,this.totalPages)},_getWWScrollTop(){const t=this._getDisplayPage();return t.scrollTop||t.scrollY||0},_movePage(t,e){const i=this._getGlobalTop(),s=this.status.isScrollable(this.fc),n=wt.nodeListToArray(this.ww.children),o=this.page.offsetTop+kt.get(this.pages[t-1].style.top)+(s?this._getWWScrollTop():0);for(let l,r=0,a=n.length;r<a;r++)if(l=n[r],l.offsetTop>=o){e||this.selection.setRange(l,0,l,0);const n=0===r&&s?0:l.offsetTop-this.page.offsetTop-l.offsetHeight+i;this._applyPageScroll(n,(()=>{this.editor.toolbar.isSticky&&this._getDisplayPage().scrollTo({top:n-this.context.get("toolbar_main").offsetHeight,behavior:"smooth"})})),this.pageNum=t;break}},_applyPageScroll(t,e){const i=this._getDisplayPage();i.scrollTo({top:t,behavior:"smooth"});const s=()=>{Math.abs((i.scrollY??i.scrollTop)-t)<1?e():Wi.requestAnimationFrame(s)};Wi.requestAnimationFrame(s)},_getGlobalTop(){return this.status.isScrollable(this.fc)?0:this.offset.getGlobal(this.wwFrame).top},_findItem(t){const e=this._wwHeaders,i=Array.prototype.indexOf.call(e,t);return-1!==i&&this.innerHeaders[i]?this.innerHeaders[i]:null},_findLinesHeader(t){for(;t&&t!==this.ww;){if(this._is(t))return t;t=t.previousElementSibling||t.parentElement}return null},_is:t=>/^h[1-6]$/i.test(t?.nodeName),_getHeaders(){return this._wwHeaders=this.ww.querySelectorAll("h1, h2, h3, h4, h5, h6")},constructor:Zi};const Yi=Zi;function ji(t){this.editor=t}ji.prototype={isNode(t){return t&&"number"==typeof t.nodeType||t instanceof this._getFrameWindow().Node},isElement(t){return t&&1===t.nodeType||t instanceof this._getFrameWindow().Element},isRange(t){return t&&"Range"===t.constructor?.name||t instanceof this._getFrameWindow().Range},isSelection(t){return t&&"Selection"===t.constructor?.name||t instanceof this._getFrameWindow().Selection},_getFrameWindow(){return this.editor.frameContext.get("_ww")},constructor:ji};const Xi=ji;const Ki=function(t){this.toolbar=t.toolbar,this.subToolbar=null,t.subToolbar&&(this.subToolbar=t.subToolbar),this.char=t.char,this.component=t.component,this.format=t.format,this.html=t.html,this.inline=t.inline,this.listFormat=t.listFormat,this.menu=t.menu,this.nodeTransform=t.nodeTransform,this.offset=t.offset,this.selection=t.selection,this.shortcuts=t.shortcuts,this.ui=t.ui,this.viewer=t.viewer};function Ji(t){re.call(this,t)}function Qi(t){t&&!X(t,"se-blink")&&(K(t,"se-blink"),n.setTimeout((()=>{J(t,"se-blink")}),600))}Ji.prototype={check(t){const e=this.frameOptions.get("charCounter_max");if(e){const i=this.getLength("string"==typeof t?t:"byte-html"===this.frameOptions.get("charCounter_type")&&1===t.nodeType?t.outerHTML:t.textContent);if(i>0&&i+this.getLength()>e)return Qi(this.frameContext.get("charWrapper")),!1}return!0},getLength(t){return"string"!=typeof t&&(t="byte-html"===this.frameOptions.get("charCounter_type")?this.frameContext.get("wysiwyg").innerHTML:this.frameContext.get("wysiwyg").textContent),/byte/.test(this.frameOptions.get("charCounter_type"))?this.getByteLength(t):t.length},getByteLength(t){if(!t||!t.toString)return 0;let e,i;return t=t.toString(),d?(i=decodeURIComponent(encodeURIComponent(t)).length,e=0,null!==encodeURIComponent(t).match(/(%0A|%0D)/gi)&&(e=encodeURIComponent(t).match(/(%0A|%0D)/gi).length),i+e):(i=(new TextEncoder).encode(t).length,e=0,null!==encodeURIComponent(t).match(/(%0A|%0D)/gi)&&(e=encodeURIComponent(t).match(/(%0A|%0D)/gi).length),i+e)},display(t){const e=(t||this.frameContext).get("charCounter");e&&n.setTimeout((()=>{e.textContent=this.getLength()}),0)},test(t,e){let i=0;t&&(i=this.getLength(t)),this.display();const s=this.frameOptions.get("charCounter_max");if(s>0){let t=!1;const n=this.getLength();if(n>s){if(t=!0,i>0&&e){this.selection._init();const t=this.selection.getRange(),e=t.endOffset-1,i=this.selection.getNode().textContent,s=t.endOffset-1;this.selection.getNode().textContent=i.slice(0,s<0?0:s)+i.slice(t.endOffset,i.length),this.selection.setRange(t.endContainer,e,t.endContainer,e)}}else n+i>s&&(t=!0);if(t&&(Qi(this.frameContext.get("charWrapper")),i>0))return!1}return!0},constructor:Ji};const ts=Ji,{_w:es,isMobile:is,ON_OVER_COMPONENT:ss}=_t,ns="2147483646",os="2147483645",ls="2147483642",rs="2147483641";const as=class extends re{#t;#e;#i;#s;#n;#o;#l;#r;#a;#h;#c;constructor(t,e,i,s){super(t.editor),this.toolbar=this.editor.toolbar,this.subToolbar=this.editor.subToolbar,this.component=this.editor.component,this.ui=this.editor.ui,this.selection=this.editor.selection,this.offset=this.editor.offset,this.kind=s||t.constructor.key||t.constructor.name,this.inst=t,this.form=e,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.#t=!1,this.#e="function"==typeof i.initMethod?i.initMethod:null,this.#i={keydown:this.#d.bind(this),mousedown:this.#u.bind(this)},this.#s=null,this.#n=null,this.#o={left:0,top:0},this.#l=null,this.#r=null,this.#a=!1,this.#h=[],this.#c=new Map;for(const t of this.parents)xt.check.isElement(t)?this.parentsForm.push(t):(t.#h.push(this),this.parentsForm.push(t.form));this.carrierWrapper.appendChild(e),this.eventManager.addEvent(e,"click",this.#p.bind(this)),this.eventManager.addEvent(e,"mouseenter",this.#g.bind(this)),this.eventManager.addEvent(e,"mouseleave",this.#m.bind(this))}open(t,e,{isWWTarget:i,initMethod:s,disabled:n,addOffset:o}={}){if(ae.get("__overInfo")===ss)return;if(!t)return void console.warn("[SUNEDITOR.Controller.open.fail] The target element is required.");this.form.removeAttribute("data-se-hidden-by-parent"),this.form.removeAttribute("data-se-hidden-by-children"),this.#c.clear(),this.editor.isBalloon?this.toolbar.hide():this.editor.isSubBalloon&&this.subToolbar.hide(),this.status.hasFocus||(n??this.disabled?this.ui.setControllerOnDisabledButtons(!0):this.ui.setControllerOnDisabledButtons(!1)),this.currentPositionTarget=e||t,this.isWWTarget=i??this.isWWTarget,"function"==typeof s&&(this.#e=s),this.editor.currentControllerName=this.kind,this.#o={left:0,top:0},o&&(this.#o={...this.#o,...o});const l=this.isOutsideForm?this.parentsForm:[];this.editor.opendControllers?.forEach((t=>{l.includes(t.form)||(t.form.style.zIndex=rs)})),this.parentsHide&&this.parentsForm.forEach((t=>{t.style.display="none",t.setAttribute("data-se-hidden-by-children","1")})),this.#f(),this.#b(this.form,this.currentPositionTarget,!1);const r=this.instanceCheck.isRange(t);this.currentTarget=r?null:t,this.#y(this.form,t,r),es.setTimeout((()=>ae.set("__overInfo",!1)),0)}close(t){(t||this.isOpen&&!this.#a)&&(this.form.removeAttribute("data-se-hidden-by-parent"),this.form.removeAttribute("data-se-hidden-by-children"),this.#c.clear(),this.#v("close"),this.toTop=!1,this.isOpen=!1,this.#a=!1,this.__offset={},this.#o={left:0,top:0},this.#_(),this.#e?.(),this.#C(),this.parentsHide&&!t&&this.parentsForm.forEach((t=>{t.style.display="block",t.removeAttribute("data-se-hidden-by-children")})),this.inst.controllerClose?.(),this.parentsForm.length>0||this.component.deselect())}hide(){this.#v("hide"),this.form.style.display="none"}show(){this.#b(this.form,this.currentPositionTarget,!1)}bringToTop(t){this.toTop=t,this.form.style.zIndex=t?ns:os}resetPosition(t){this.#b(this.form,t||this.currentPositionTarget,!0)}_scrollReposition(){this.form.hasAttribute("data-se-hidden-by-parent")||this.form.hasAttribute("data-se-hidden-by-children")||this.#b(this.form,this.currentPositionTarget,!1)&&es.setTimeout((()=>{this.#v("show")}),0)}#v(t){for(const e of this.#h)if("hide"===t&&"none"!==e.form.style.display){const t=this.#w(e);e.#c.set(this,!0);const i=this.#w(e);!t&&i&&(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.#v("show");continue}const t=this.#w(e);e.#c.set(this,!1);const i=this.#w(e);t&&!i&&(e.form.removeAttribute("data-se-hidden-by-parent"),e.show())}else e[t]?.(!0)}#w(t){for(const e of t.#c.values())if(!0===e)return!0;return!1}async#y(t,e,i){const s={position:this.position,inst:this,form:t,target:e,isRangeTarget:i,notInCarrier:!this.carrierWrapper.contains(t)};!1!==await this.triggerEvent("onBeforeShowController",{caller:this.kind,frameContext:this.frameContext,info:s})&&(t.style.display="block",this.editor._shadowRoot&&(this.#l=t,this.#r=t=>t.stopPropagation(),t.addEventListener("mousedown",this.#r)),this.editor._controllerTargetContext=this.frameContext.get("topArea"),this.isOpen||this.editor.opendControllers.push(s),this.isOpen=!0,this.editor._preventBlur=!0,this.editor.status.onSelected=!0,this.inst.controllerOn?.(t,e),this.triggerEvent("onShowController",{caller:this.kind,frameContext:this.frameContext,info:s}))}#C(){this.form.style.display="none",this.editor.opendControllers=this.editor.opendControllers.filter((t=>t.form!==this.form)),this.editor.currentControllerName!==this.kind&&this.editor.opendControllers.length>0||(this.ui.setControllerOnDisabledButtons(!1),this.frameContext.get("lineBreaker_t").style.display=this.frameContext.get("lineBreaker_b").style.display="none",this.editor.effectNode=null,this.editor.currentControllerName="",this.editor._preventBlur=!1,this.editor._controllerTargetContext=null,es.setTimeout((()=>{this.editor.status.onSelected=!1}),0),this.#l&&(this.#l.removeEventListener("mousedown",this.#r),this.#l=this.#r=null))}#b(t,e,i){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.selection.isRange(e)){if(!this.offset.setRangePosition(this.form,e,{position:"bottom"}))return this.hide(),!1}else{const s=this.offset.setAbsPosition(t,e,{addOffset:this.#o,position:this.position,isWWTarget:this.isWWTarget,inst:this,sibling:this.sibling});if(!s)return this.hide(),!1;if(i||!this.sibling||this.siblingMain)this.#t=!1;else{const e=t.offsetTop-this.#o.top;"bottom"===s.position?(this.#t=!0,t.style.top=e+this.sibling.offsetHeight-1+"px"):(this.#t=!1,t.style.top=e-this.sibling.offsetHeight+2+"px")}}return t.style.zIndex=this.toTop?os:this.#t?ls:rs,t.style.visibility="",!0}#f(){this.#_(),this.#s=this.eventManager.addGlobalEvent("keydown",this.#i.keydown,!0),this.#n=this.eventManager.addGlobalEvent(is?"click":"mousedown",this.#i.mousedown,!0)}#_(){this.component.__removeGlobalEvent(),this.#s&&=this.eventManager.removeGlobalEvent(this.#s),this.#n&&=this.eventManager.removeGlobalEvent(this.#n)}#x(){if(this.editor.selectMenuOn)return!0;const t=this.editor.opendControllers;for(let e=0;e<t.length;e++)if(t[e].inst===this&&t[e].fixed)return!0;return!1}#k(t){if(xt.check.isWysiwygFrame(t)||t.contains(this.form))return!1;if(xt.utils.hasClass(t,"se-drag-handle"))return!0;let e=!1;this.isInsideForm&&this.parentsForm?.length>0&&this.parentsForm.some((i=>{if(i.contains(t))return e=!0,!0}));const i=this.inst._element;return!e&&(!!xt.query.getParentElement(t,".se-controller")||(this.component.isInline(i)?t===i:t?.contains(i)))}#p(t){const e=xt.query.getEventTarget(t),i=xt.query.getCommandTarget(e);i&&(t.stopPropagation(),t.preventDefault(),this.inst.controllerAction(i))}#g(t){if(this.editor.currentControllerName=this.kind,this.parentsForm.length>0&&this.isInsideForm)return;xt.query.getEventTarget(t).style.zIndex=this.toTop?ns:os}#m(t){if(this.parentsForm.length>0&&this.isInsideForm)return;xt.query.getEventTarget(t).style.zIndex=this.toTop?os:this.#t?ls:rs}#d(t){if(this.#x())return;const e=t.code;if(Et.isCtrl(t)||!Et.isNonResponseKey(e))return;const i=xt.query.getEventTarget(t);if(Et.isEsc(e)){if(this.#h.some((({isOpen:t})=>t)))return}else{if(this.form.contains(i)||this.#k(i))return;if(this.editor._fileManager.pluginRegExp.test(this.kind))return}this.#E(i),this.close()}#u(t){const e=xt.query.getEventTarget(t);this.inst?._element?.contains(e)?this.#a=!0:(this.#a=!1,e===this.inst._element||e===this.currentTarget||this.#x()||this.form.contains(e)||this.#k(e)||xt.query.getParentElement(e,".se-line-breaker-component")||(this.#E(e),this.close(!0)))}#E(t){this.frameContext.get("wysiwyg").contains(t)||(this.component.__prevent=!1)}},{_w:hs}=_t;const cs=class extends re{#S;#T;#H;#L;#M;#N;#s;#A;#B;#V;#I;#i;constructor(t,e){super(t.editor),this.offset=this.editor.offset,this.kink=t.constructor.key||t.constructor.name,this.inst=t;const i=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=i[0],this.subPosition=i[1],this.splitNum=e.splitNum||0,this.horizontal=!!this.splitNum,this.openMethod=e.openMethod,this.closeMethod=e.closeMethod,this.#S=/^(left|right)$/.test(this.position)?"left"===this.position?"right":"left":this.position,this.#T=/^(left|right)$/.test(this.subPosition)?"left"===this.subPosition?"right":"left":this.subPosition,this.#H="ltr"!==e.dir&&("rtl"===e.dir||null),this.#L=null,this.#M=null,this.#N=null,this.#s=null,this.#A=null,this.#B=null,this.#V=null,this.#I={mousedown:this.#O.bind(this),mousemove:this.#R.bind(this),click:this.#F.bind(this),keydown:this.#z.bind(this)},this.#i={keydown:this.#$.bind(this),mousedown:this.#u.bind(this),click:this.#P.bind(this)}}create(t,e){this.form.firstElementChild.innerHTML="",e||=t;let i="";for(let t=0,s=e.length;t<s;t++)t>0&&t%this.splitNum==0&&(this.#D(i),i=""),i+=`<li class="se-select-item" data-index="${t}">${"string"==typeof e[t]?e[t]:e[t].outerHTML}</li>`;this.#D(i),this.items=t,this.menus=Array.from(this.form.querySelectorAll("li")),this.menuLen=this.menus.length}on(t,e,i={}){this.#L=t,this.#M=xt.check.isInputElement(t)?t:this.frameContext.get("_ww"),this.#N=e,this.form=xt.utils.createElement("DIV",{class:"se-select-menu"+(i.class?" "+i.class:""),style:i.style||""},'<div class="se-list-inner"></div>'),t.parentNode.insertBefore(this.form,t)}open(t,e){this.editor.selectMenuOn=!0,this.openMethod?.(),this.#q(),this.#f();const i=t?t.split("-"):[],s=i[0]||(null!==this.#H&&this.#H!==this.options.get("_rtl")?this.#S:this.position),n=i[1]||(null!==this.#H&&this.#H!==this.options.get("_rtl")?this.#T:this.subPosition);this.#W(s,n,e),this.isOpen=!0}close(){this.editor.selectMenuOn=!1,xt.utils.removeClass(this.#L,"on"),this.#U(),this.form?.removeAttribute("style"),this.isOpen=!1,this.closeMethod?.()}getItem(t){return this.items[t]}setItem(t){this.#Z(t)}#D(t){this.form.firstElementChild.innerHTML+=`<ul class="se-list-basic se-list-checked${this.horizontal?" se-list-horizontal":""}">${t}</ul>`}#U(){this.#G(),this.#_(),this.index=-1,this.item=null,this._onItem&&(xt.utils.removeClass(this._onItem,"se-select-on"),this._onItem=null)}#Y(t){t=this.index+t;const e=this.menuLen,i=this.index=t>=e?0:t<0?e-1:t;this.#Z(i)}#Z(t){xt.utils.removeClass(this.form,"se-select-menu-mouse-move");const e=this.menuLen;for(let i=0;i<e;i++)i===t?xt.utils.addClass(this.menus[i],"active"):xt.utils.removeClass(this.menus[i],"active");this.index=t,this.item=this.items[t]}#W(t,e,i,s){const n=t,o=this.form,l=this.#L;o.style.visibility="hidden",o.style.display="block",xt.utils.removeClass(o,"se-select-menu-scroll"),xt.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.offset.get(l),g=l.offsetTop,m=p.top,f=l.offsetHeight,b=xt.utils.getClientSize().h-(m-hs.scrollY+f),y=c?f:0;let v=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 i=this.offset.getGlobal(o).top;const s=t-(m-i)-b-f;s>0&&(u-=s+4,o.style.top=u+"px"),i=this.offset.getGlobal(o).top,i<0&&(t+=i-4,u-=i-4),o.style.height=t+"px";break}case"top":if(m<o.offsetHeight-y){if(!s){v=0;break}v=m-4+y,v>=38&&(o.style.height=v+"px")}u=g-o.offsetHeight+y;break;case"bottom":if(b<o.offsetHeight+y){if(!s){v=0;break}v=b-4+y,v>=38&&(o.style.height=v+"px")}u=g+(c?0:f)}if(v<38&&!s&&"middle"!==t)return void this.#W("top"===t?"bottpm":"top",e,i,!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 _=this.offset.getGlobal(o).left;let C=0;switch(c+"-"+(c?n:e)){case"true-left":C=p.left-hs.scrollX+_,C<0&&(d=d=h+a+1);break;case"true-right":C=hs.innerWidth-(_+r),C<0&&(d=h-r-1);break;case"false-center":{C=hs.innerWidth-(_+r),C<0&&(d+=C-4),o.style.left=d+"px";const t=this.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":_<0&&(d-=_-4)}if(i){const t=o.firstElementChild.querySelector(i);t&&(this._onItem=t,xt.utils.addClass(t,"se-select-on"))}o.style.left=d+"px",o.style.top=u+"px",o.style.visibility=""}#j(t){this.checkList&&xt.utils.toggleClass(this.menus[t],"se-checked"),this.#N(this.getItem(t))}#q(){this.#G(),this.#V=this.#I,this.form.addEventListener("mousedown",this.#V.mousedown),this.form.addEventListener("mousemove",this.#V.mousemove),this.form.addEventListener("click",this.#V.click),this.#M.addEventListener("keydown",this.#V.keydown)}#G(){this.#V&&(this.form.removeEventListener("mousedown",this.#V.mousedown),this.form.removeEventListener("mousemove",this.#V.mousemove),this.form.removeEventListener("click",this.#V.click),this.#M.removeEventListener("keydown",this.#V.keydown),this.#V=null)}#f(){this.#_(),this.#s=this.eventManager.addGlobalEvent("keydown",this.#i.keydown,!0),this.#A=this.eventManager.addGlobalEvent("mousedown",this.#i.mousedown,!0)}#_(){this.#s&&=this.eventManager.removeGlobalEvent(this.#s),this.#A&&=this.eventManager.removeGlobalEvent(this.#A),this.#B&&=this.eventManager.removeGlobalEvent(this.#B)}#z(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.#j(this.index)):this.close()}e&&this.#Y(e)}#O(t){if(_t.isGecko){const e=xt.query.getEventTarget(t),i=xt.query.getParentElement(e,".se-select-item");i&&this.eventManager._injectActiveEvent(i)}}#R(t){const e=xt.query.getEventTarget(t);xt.utils.addClass(this.form,"se-select-menu-mouse-move");const i=e.getAttribute("data-index");i&&(this.index=Number(i))}#F(t){let e=xt.query.getEventTarget(t),i=null;for(;!i&&!/UL/i.test(e.tagName)&&!xt.utils.hasClass(e,"se-select-menu");)i=e.getAttribute("data-index"),e=e.parentElement;i&&this.#j(Number(i))}#$(t){Et.isEsc(t.code)&&this.close()}#u(t){const e=xt.query.getEventTarget(t);this.form.contains(e)||(t.target!==this.#L?this.close():xt.check.isInputElement(e)||(this.#B=this.eventManager.addGlobalEvent("click",this.#i.click,!0)))}#P(t){this.#B=this.eventManager.removeGlobalEvent(this.#B),t.target===this.#L&&(t.stopPropagation(),this.close())}},{_w:ds,ON_OVER_COMPONENT:us}=_t,ps={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 gs=!1,ms=!1,fs=0,bs=0;class ys extends re{#X;#K;#J;#Q;#tt;#et;#it;#st;#nt;#ot;#lt;#rt;constructor(t,e,i){super(t.editor),this.kind=t.constructor.key||t.constructor.name,this._alignIcons={none:this.icons.format_float_none,left:this.icons.format_float_left,right:this.icons.format_float_right,center:this.icons.format_float_center},this.component=this.editor.component,this.ui=this.editor.ui,this.offset=this.editor.offset,this.selection=this.editor.selection,this.html=this.editor.html,this.format=this.editor.format,this.nodeTransform=this.editor.nodeTransform,this._action={};const s=function(t,e){let i=null;if(e?.length>0){const{lang:s,icons:n}=t;i='<div class="se-arrow se-arrow-up"></div>';for(let o,l=0;l<e.length;l++){o=e[l],i+='<div class="se-btn-group">';for(let e,l=0,r=o.length;l<r;l++){if(e=o[l],"function"==typeof e?.action){const i=e;e={c:`__c__${i.command}`,v:i.value||"",l:i.title,i:i.icon},t._action[e.c]=i.action}else if(e=Cs(e),!e)continue;i+=`\n\t\t\t\t\t<button type="button" data-command="${e.c}" data-value="${e.v}" class="se-btn se-tooltip">\n\t\t\t\t\t\t${n[e.i]||e.i}\n\t\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${s[e.l]||e.l}</span></span>\n\t\t\t\t\t</button>`}i+="</div>"}}return i?xt.utils.createElement("DIV",{class:"se-controller se-controller-resizing"},i):null}(this,e||[]);if(this.controller=s?new as(this,s,{position:"bottom",disabled:!0},this.kind):null,s){this.alignButton=s.querySelector('[data-command="onalign"]');const t=function(t,e){if(!e)return null;const i=[t._alignIcons.none,t._alignIcons.left,t._alignIcons.center,t._alignIcons.right],s=[t.lang.basic,t.lang.left,t.lang.center,t.lang.right],n=["none","left","center","right"],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${i[t]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${s[t]}</span>\n\t\t\t</span>\n\t\t</button>`),l.push(n[t]);return{html:o,items:l}}(this,this.alignButton);t&&(this.selectMenu_align=new cs(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_align.on(this.alignButton,this.#at.bind(this),{class:"se-figure-select-list"}),this.selectMenu_align.create(t.items,t.html)),this.asButton=s.querySelector('[data-command="onas"]');const e=function(t,e){if(!e)return null;const i=[t.icons.as_block,t.icons.as_inline],s=[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${i[t]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${s[t]}</span>\n\t\t\t</span>\n\t\t</button>`),l.push(n[t]);return{html:o,items:l}}(this,this.asButton);e&&(this.selectMenu_as=new cs(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_as.on(this.asButton,this.#ht.bind(this),{class:"se-figure-select-list"}),this.selectMenu_as.create(e.items,e.html)),this.resizeButton=s.querySelector('[data-command="onresize"]');const i=function(t,e){if(!e)return null;const i=e.getAttribute("data-value").split(","),s=[];for(let e,n,o,l,r=0;r<i.length;r++)o=i[r],e=kt.is(o),n=e?"resize_percent"+o:"auto",l=e?o+"%":t.lang.autoSize,s.push('<button type="button" class="se-btn-list" data-command="'+n+'" data-value="'+o+'"><span>'+l+"</span></button>");return{html:s,items:i}}(this,this.resizeButton);i&&(this.selectMenu_resize=new cs(this,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.selectMenu_resize.on(this.resizeButton,this.#ct.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=s?.querySelectorAll('[data-command="resize_percent"]')||[],this.captionButton=s?.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.#dt.bind(this),this.__containerResizing=this.#ut.bind(this),this.__onContainerEvent=null,this.__offContainerEvent=null,this.#X="",this.#K="",this.#J=0,this.#Q=0,this.#tt=0,this.#et=0,this.#it="__se__float-none|__se__float-left|__se__float-center|__se__float-right",this.#st=!1,this.#nt={w:"",h:""},this.#ot=this.#pt.bind(this),this.#lt=this.#gt.bind(this),this.#rt=null,this.eventManager.addEvent(this.alignButton,"click",this.#mt.bind(this)),this.eventManager.addEvent(this.asButton,"click",this.#ft.bind(this)),this.eventManager.addEvent(this.resizeButton,"click",this.#bt.bind(this)),this.editor.applyFrameRoots((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 xt.utils.createElement("DIV",{class:"se-controller se-resizing-container",style:"display: none;"},t)}(),i=e.querySelectorAll(".se-resize-dot > span");t.set("_figure",{main:e,border:e.querySelector(".se-resize-dot"),display:e.querySelector(".se-resize-display"),handles:i}),t.get("wrapper").appendChild(e),this.eventManager.addEvent(i,"mousedown",this.#yt.bind(this))}}))}static CreateContainer(t,e){return xt.utils.createElement("DIV",{class:"se-component"+(e?" "+e:"")},xt.utils.createElement("FIGURE",null,t)),ys.GetContainer(t)}static CreateInlineContainer(t,e){return xt.utils.createElement("SPAN",{class:"se-component se-inline-component"+(e?" "+e:"")},t),ys.GetContainer(t)}static CreateCaption(t,e){const i=xt.utils.createElement("FIGCAPTION",null,"<div>"+e+"</div>");return t.appendChild(i),i}static GetContainer(t){const e=xt.query.getParentElement(t,"FIGURE",2),i=xt.query.getParentElement(t,"SPAN",2),s=e||i,n=xt.query.getParentElement(t,(t=>t.parentElement===s),0)||t;return{target:n,container:xt.query.getParentElement(n,ys.is,3)||e,cover:e,inlineCover:xt.utils.hasClass(i,"se-inline-component")?i:null,caption:xt.query.getEdgeChild(n.parentElement,"FIGCAPTION",!1),isVertical:_s(n)}}static GetRatio(t,e,i){let s=0,n=0;if(/\d+/.test(t+"")&&/\d+/.test(e+"")){if((!kt.is(t)&&String(t).replace(/\d+|\./g,"")||i||"px")===(!kt.is(e)&&String(e).replace(/\d+|\./g,"")||i||"px")){const i=kt.get(t,4),o=kt.get(e,4);s=i/o,n=o/i}}return{w:kt.get(s,4),h:kt.get(n,4)}}static CalcRatio(t,e,i,s){if(s?.w&&s?.h&&/\d+/.test(t+"")&&/\d+/.test(e+"")){const n=!kt.is(t)&&String(t).replace(/\d+|\./g,"")||i||"px",o=!kt.is(e)&&String(e).replace(/\d+|\./g,"")||i||"px";if(n===o){const i="%"===n?2:0,l=t,r=e;e=kt.get(s.h*kt.get(l,i),i)+o,t=kt.get(s.w*kt.get(r,i),i)+n}}return{w:t,h:e}}static is(t){return xt.check.isComponentContainer(t)||/^(HR)$/.test(t?.nodeName)}close(){this.editor._preventBlur=!1,xt.utils.removeClass(this._cover,"se-figure-selected"),this.component._removeDragEvent(),this.#vt(),this.controller?.close()}open(t,{nonResizing:e,nonSizeInfo:i,nonBorder:s,figureTarget:n,infoOnly:o}){if(!t)return void console.warn('[SUNEDITOR.modules.Figure.open] The "targetNode" is null.');ae.get("__overInfo")===us&&(s=!0);const l=ys.GetContainer(t),r=l.target;let a=!1;if(!l.container){if(this.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}ae.set("__figureInst",this),this.#_t(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.offset.getLocal(h),f=(r.getAttribute("data-se-size")||"").split(",");let b=kt.get(r.style.width,2)||c,y=kt.get(r.style.height,2)||d;this.isVertical&&([b,y]=[y,b]);const v=ys.GetRatio(b,y,this.sizeUnit),_={container:l.container,cover:l.cover,caption:l.caption,align:this.align,ratio:v,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.#X=_.width,this.#K=_.height,o)return _;const C=this.frameContext.get("_figure");this.editor._figureContainer=C.main,this.editor.opendControllers=this.editor.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.editor.opendControllers.push({position:"none",form:C.main,target:h,inst:this,notInCarrier:!0});const w=/%$/.test(r.style.width)&&/%$/.test(l.container.style.width)?kt.get(l.container.style.width,0)/100+"":"";for(let t=0,e=this.percentageButtons.length;t<e;t++)this.percentageButtons[t].getAttribute("data-value")===w?xt.utils.addClass(this.percentageButtons[t],"active"):xt.utils.removeClass(this.percentageButtons[t],"active");if(this.captionButton&&(l.caption?xt.utils.addClass(this.captionButton,"active"):xt.utils.removeClass(this.captionButton,"active")),C.display.style.display=i||this._inlineCover?"none":"",C.border.style.display=s?"none":"",C.main.style.display="block",ae.get("__overInfo")!==us){const t=e?"none":"flex",i=C.handles;for(let e=0,s=i.length;e<s;e++)i[e].style.display=t;if(this.controller){const t=this.getSize(r);xt.utils.changeTxt(C.display,this.lang["none"===this.align?"basic":this.align]+" ("+t.dw+", "+t.dh+")"),this.#Ct(),this.#wt(),this.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"]'),i=this._inlineCover||a?"none":"";e?.forEach((t=>{t.style.display=i}));const s=this.controller.form.querySelector('[data-command="onas"]');s&&(s.style.display=a?"none":"")}xt.utils.removeClass(this._cover,"se-figure-over-selected"),this.controller?.open(C.main,null,{initMethod:this.#ot,isWWTarget:!1,addOffset:null}),ds.setTimeout((()=>ae.set("__overInfo",!1)),0)}else xt.utils.addClass(this._cover,"se-figure-over-selected");return xt.utils.addClass(this._cover,"se-figure-selected"),this.#tt=this.#J=c,this.#et=this.#Q=d,this._inlineCover||ae.get("__overInfo")===us&&!xt.utils.hasClass(l.container,"se-input-component")||this.#xt(C.main),_}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 i=this.isVertical;i&&([t,e]=[e,t]),this.setFigureSize(t,e),i&&this.setTransform(this._element,t,e,0)}getSize(t){t||=this._element;const e=_s(t);let i="",s="",n="",o="";if(!t)return{w:i,h:s,dw:n,dh:o};const l=ys.GetContainer(t),r=l.target;return l.container?(i=/%$/.test(r.style.width)?(l.container&&kt.get(l.container.style.width,2)||100)+"%":r.style.width,s=l.inlineCover?l.inlineCover.style.height||t.style.height||String(t.height||""):kt.get(l.cover?.style.paddingBottom,0)>0&&!e?l.cover?.style.height:/%$/.test(r.style.height)&&/%$/.test(r.style.width)?(l.container&&kt.get(l.container.style.height,2)||100)+"%":r.style.height,i||="auto",s||="auto"):this.options.get("strictMode").formatFilter?(i="",s=r.style.height):(i=r.style.width||"auto",s=r.style.height||"auto"),n=e?s:i,o=e?i:s,{w:i,h:s,dw:n,dh:o}}setAlign(t,e){t||=this._element,this.align=e||="none";const i=ys.GetContainer(t);if(!i.cover)return;const s=i.target,n=i.container,o=i.cover;if(/%$/.test(s.style.width)&&"center"===e&&!this.component.isInline(n)?(n.style.minWidth="100%",o.style.width=n.style.width):(n.style.minWidth="",o.style.width=this.isVertical?s.style.height||s.offsetHeight+"px":s.style.width&&"auto"!==s.style.width?s.style.width||"100%":""),xt.utils.hasClass(n,"__se__float-"+e)||(xt.utils.removeClass(n,this.#it),xt.utils.addClass(n,"__se__float-"+e)),this.autoRatio){const{w:t,h:e}=this.getSize(this._element);this.__setCoverPaddingBottom(t,e)}this.#Ct()}convertAsFormat(t,e){t||=this._element,this.as=e||"block";const{container:i,inlineCover:s,target:n}=ys.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(s)break;this.component.deselect();const t=i.nextElementSibling,e=i.parentElement,n=ys.CreateInlineContainer(r);xt.utils.addClass(n.container,i.className.split(" ").filter((t=>"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this.#kt(n,o,l);const a=xt.utils.createElement(this.options.get("defaultLine"),null,n.container);e.insertBefore(a,t),xt.utils.removeItem(i);break}case"block":{if(!s)break;this.component.deselect(),this.selection.setRange(i,0,i,1);const t=this.html.remove(),e=this.nodeTransform.split(t.container,t.offset,0);e?.previousElementSibling&&xt.check.isZeroWidth(e.previousElementSibling)&&xt.utils.removeItem(e.previousElementSibling);const n=ys.CreateContainer(r);xt.utils.addClass(n.container,i.className.split(" ").filter((t=>"se-inline-component"!==t&&"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this.#kt(n,o,l),(e||t.container).parentElement.insertBefore(n.container,e);break}}return r}controllerAction(t){const e=t.getAttribute("data-command"),i=t.getAttribute("data-value"),s=t.getAttribute("data-type"),n=this._element;if(!/^on.+/.test(e)&&"selectMenu"!==s){switch(e){case"mirror":{const t=vs(n);let e=t.x,s=t.y;"h"===i&&!this.isVertical||"v"===i&&this.isVertical?s=s?"":"180":e=e?"":"180",this._setRotate(n,t.r,e,s);break}case"rotate":this.setTransform(n,null,null,Number(i));break;case"caption":if(this._caption)xt.utils.removeItem(this._caption),ds.setTimeout(this.component.select.bind(this.component,n,this.kind),0);else{const t=ys.CreateCaption(this._cover,this.lang.caption),e=xt.query.getEdgeChild(t,(t=>3===t.nodeType),!1);e?this.selection.setRange(e,0,e,e.textContent.length):t.focus(),this.controller.close()}this._caption=!this._caption,(/\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.component.copy(this._container);break;case"remove":this.inst.componentDestroy(n),this.controller.close()}/^__c__/.test(e)?this._action[e](n,i,t):"edit"!==e&&(this.history.push(!1),/^remove|caption$/.test(e)||this.component.select(n,this.kind))}}retainFigureFormat(t,e,i,s){const n=this.component.isInline(t),o=e.parentNode;let l=this.format.isBlock(o)||xt.check.isWysiwygFrame(o)?e:ys.GetContainer(e)?.container||o||e;if(xt.query.getParentElement(e,xt.check.isExcludeFormat))l=i&&i!==e?i:e,l.parentNode.replaceChild(t,l);else if(n&&this.format.isLine(l)){const i=n&&/^SPAN$/i.test(e.parentElement.nodeName)?e.parentElement:e;i.parentElement.replaceChild(t,i)}else if(xt.check.isListCell(l)){const i=xt.query.getParentElement(e,(t=>t.parentNode===l));l.insertBefore(t,i),xt.utils.removeItem(e),this.nodeTransform.removeEmptyNode(i,null,!0)}else if(this.format.isLine(l)){const i=xt.query.getParentElement(e,(t=>t.parentNode===l));l=this.nodeTransform.split(l,i),l.parentNode.insertBefore(t,l),xt.utils.removeItem(e),this.nodeTransform.removeEmptyNode(l,null,!0)}else if(this.format.isLine(l.parentNode)){const e=l.parentNode;e.parentNode.insertBefore(t,l.previousSibling?e.nextElementSibling:e),(0===s?.__updateTags.map((t=>l.contains(t))).length||xt.check.isZeroWidth(l))&&xt.utils.removeItem(l)}else l=xt.check.isFigure(l.parentNode)?xt.query.getParentElement(l.parentNode,ys.is):l,l.parentNode.replaceChild(t,l)}deleteTransform(t){t||=this._element;const e=t,i=(e.getAttribute("data-se-size")||"").split(",");this.isVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",this.#Et(e),this._applySize(i[0]||"auto",i[1]||"","")}setTransform(t,e,i,s){try{this.#st=!0;const n=vs(t),o=n.r+1*(s||0);s=Math.abs(o)>=360?0:o;const l=this.isVertical=_s(s);e=kt.get(e,0),i=kt.get(i,0);const r=t,a=(r.getAttribute("data-se-size")||"auto,auto").split(",");l&&this._setRotate(r,s,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=ys.GetContainer(r),n=t.cover||t.inlineCover,o=e||r.offsetWidth,a=i||r.offsetHeight,c=(l?a:o)+"px",d=(l?o:a)+"px";if(this.#St(),this._applySize(o+"px",a+"px",""),n&&(n.style.width=c,n.style.height=t.caption||t.inlineCover?"":d),l){h=90===s||-270===s?a/2+"px "+a/2+"px 0":o/2+"px "+o/2+"px 0"}}r.style.transformOrigin=h,l||this._setRotate(r,s,n.x,n.y),r.style.maxWidth=l?"none":"",this.#Tt(r)}finally{this.#st=!1}}_displayResizeHandles(t){const e=t?"flex":"none";this.controller&&(this.controller.form.style.display=e);const i=this.frameContext.get("_figure"),s=i.handles;for(let t=0,i=s.length;t<i;t++)s[t].style.display=e;"none"===e?(xt.utils.addClass(i.main,"se-resize-ing"),this.#rt=this.eventManager.addGlobalEvent("keydown",this.#lt)):xt.utils.removeClass(i.main,"se-resize-ing")}#kt(t,e,i){const s=this.kind;t.target.onload=()=>this.component.select(t.target,s),this.#_t(t),t.inlineCover&&(this.setAlign(t.target,"none"),this.deleteTransform()),this.setFigureSize(e,i)}#_t(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=_s(t.target)}_setRotate(t,e,i,s){let n=(t.offsetWidth-t.offsetHeight)*(/^-/.test(e+"")?1:-1),o="";if(/[1-9]/.test(e+"")&&(i||s))switch(o=i?"Y":"X",e+""){case"90":o=i&&s?"X":s?o:"";break;case"270":n*=-1,o=i&&s?"Y":i?o:"";break;case"-90":o=i&&s?"Y":i?o:"";break;case"-270":n*=-1,o=i&&s?"X":s?o:"";break;default:o=""}e%180==0&&(t.style.maxWidth=""),t.style.transform="rotate("+e+"deg)"+(i?" rotateX("+i+"deg)":"")+(s?" rotateY("+s+"deg)":"")+(o?" translate"+o+"("+n+"px)":"")}_applySize(t,e,i){const s=/^(rw|lw)$/.test(i)&&/\d+/.test(this._element.style.height),n=/^(th|bh)$/.test(i)&&/\d+/.test(this._element.style.width);e=e||(this.autoRatio?this.autoRatio.current||this.autoRatio.default:e),t=kt.is(t)?t+this.sizeUnit:t,/%$/.test(t)||/%$/.test(e)||s||n||this.#St();const o=this._cover||this._element;this.autoRatio&&this._cover&&(this._cover.style.width=t),n||(o.style.width=this._element.style.width=t),s||(e=kt.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.#Ht()}__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)?kt.get(kt.get(e,2)/100*kt.get(t,2),2)+"%":e:this._cover.style.paddingBottom=e)}_setAutoSize(){this._caption&&(this._caption.style.marginTop=""),this.deleteTransform(),this.#St(),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.#Ht()}_setPercentSize(t,e){e||=this.autoRatio?/%$/.test(this.autoRatio.current)?this.autoRatio.current:this.autoRatio.default:e,e=!e||/%$/.test(e+"")||kt.get(e,0)?kt.is(e)?e+this.sizeUnit:e||(this.autoRatio?this.autoRatio.default:""):kt.is(e)?e+"%":e;const i=/%$/.test(e+"");this._container.style.width=String(kt.is(t)?t+"%":t),this._container.style.height="",this._element!==this._cover||this.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%":i?"":e),"center"===this.align&&this.setAlign(this._element,this.align),this.autoRatio&&this.__setCoverPaddingBottom(String(t),String(e)),this.#Tt(this._element),this.#Ht()):this.#Ht()}#St(){this._cover&&(this._cover.style.width="",this._cover.style.height=""),this._container.style.width="",this._container.style.height="",xt.utils.removeClass(this._container,this.#it),xt.utils.addClass(this._container,"__se__float-"+this.align),"center"===this.align&&this.setAlign(this._element,this.align)}_setRevert(){this.setFigureSize(this.#nt.w,this.#nt.h)}#Ct(){this.alignButton&&xt.utils.changeElement(this.alignButton.firstElementChild,this._alignIcons[this.align])}#wt(){this.asButton&&xt.utils.changeElement(this.asButton.firstElementChild,this.icons[`as_${this.as}`])}#Ht(){if(this.#st)return;const t=(this._element.getAttribute("data-se-size")||",").split(",");this.#nt.w=t[0],this.#nt.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:"")}#Tt(t){const e=xt.query.getEdgeChild(xt.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="")}#Et(t){const e=xt.query.getEdgeChild(xt.query.getParentElement(t,"FIGURE"),"FIGCAPTION",!1);e&&(e.style.marginTop="")}#Lt(){this.component._removeDragEvent(),this.#vt(),this._displayResizeHandles(!0),this.ui._offCurrentController(),this.ui.disableBackWrapper()}#vt(){this.eventManager.removeGlobalEvent(this.__onContainerEvent),this.eventManager.removeGlobalEvent(this.__offContainerEvent),this.eventManager.removeGlobalEvent(this.#rt)}#xt(t){const e=this.frameContext.get("wrapper").querySelector(".se-drag-handle");xt.utils.removeClass(e,"se-drag-handle-full"),e.style.opacity="",e.style.width="",e.style.height="",ae.set("__dragHandler",e),ae.set("__dragContainer",this._container),ae.set("__dragCover",this._cover),ae.set("__dragMove",this.#Mt.bind(this,e,t)),ae.get("__dragMove")(),e.style.display="block"}#Mt(t,e){t.style.display="block",t.style.left=e.offsetLeft+(this.options.get("_rtl")?t.offsetWidth:e.offsetWidth-1.5*t.offsetWidth)+"px",t.style.top=e.offsetTop-t.offsetHeight+.5+"px"}#yt(t){t.stopPropagation(),t.preventDefault();const e=ae.get("__figureInst");if(!e)return;const i=xt.query.getEventTarget(t),s=e._resize_direction=i.classList[0];e._resizeClientX=t.clientX,e._resizeClientY=t.clientY,e.frameContext.get("_figure").main.style.float=/l/.test(s)?"right":/r/.test(s)?"left":"none",this.ui.enableBackWrapper(ps[s]);const{w:n,h:o,dw:l,dh:r}=this.getSize(e._element);if(gs=ms=!1,fs=bs=0,!this.isVertical){const t=!n||/auto|%$/.test(n),i=!o||/auto|%$/.test(o);if("tl|bl|tr|br".includes(s)&&t&&i?gs=!0:"lw|rw".includes(s)&&t&&(ms=!0),gs||ms){const t=e._cover||e._element;bs=t.offsetWidth,fs=wt.getWidthInPercentage(t,this.frameContext.get("wysiwygFrame"))/100}}e.__onContainerEvent=e.eventManager.addGlobalEvent("mousemove",e.__containerResizing),e.__offContainerEvent=e.eventManager.addGlobalEvent("mouseup",e.__containerResizingOff),e._displayResizeHandles(!1);const a=this.frameContext.get("_figure").display;a.style.display="block",xt.utils.changeTxt(a,l+" * "+r)}#ut(t){const e=this._resize_direction,i=t.clientX,s=t.clientY,n=this.isVertical;let o=n?this.#et:this.#tt,l=n?this.#tt:this.#et;const r=o+(/r/.test(e)?i-this._resizeClientX:this._resizeClientX-i),a=l+(/b/.test(e)?s-this._resizeClientY:this._resizeClientY-s),h=l/o*r,c=this.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.#X:Math.round(o),u=!n&&/w$/.test(e)?this.#K:Math.round(l),p=fs?d/bs*fs*100:d;xt.utils.changeTxt(this.frameContext.get("_figure").display,fs?kt.get(p>100?100:p,2).toFixed(2)+"%":p+" * "+u),this.#J=d,this.#Q=u}#dt(){this.#Lt();let t=this.isVertical?this.#Q:this.#J,e=this.isVertical?this.#J:this.#Q;if(t=Math.round(t)||t,e=Math.round(e)||e,!this.isVertical&&!/%$/.test(t+"")){const i=this.frameContext.get("wysiwygFrame").clientWidth-kt.get(this.frameContext.get("wwComputedStyle").getPropertyValue("padding-left"))+kt.get(this.frameContext.get("wwComputedStyle").getPropertyValue("padding-right"))-2;kt.get(t,0)>i&&(e=Math.round(e/t*i),t=i)}if(gs||ms){t=t/(this._cover||this._element).offsetWidth*fs*100;const e=kt.get(t>100?100:t,2)+"%";this._setPercentSize(e,ms?this.getSize(this._element).h:"")}else this._applySize(t,e,this._resize_direction),this.isVertical&&this.setTransform(this._element,t,e,0);this.history.push(!1),this.component.select(this._element,this.kind)}#gt(t){Et.isEsc(t.code)&&(this.#Lt(),this.component.select(this._element,this.kind))}#at(t){this.setAlign(this._element,t),this.selectMenu_align.close(),this.component.select(this._element,this.kind)}#ht(t){this.convertAsFormat(this._element,t),this.selectMenu_as.close()}#ct(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!==kt.get(e,0)&&/%$/.test(e)?e:"")}this.selectMenu_resize.close(),this.component.select(this._element,this.kind)}#pt(){const t=this.frameContext.get("_figure");t.main.style.display="none",this.editor._figureContainer=null,this.editor.opendControllers=this.editor.opendControllers.filter((e=>e.form!==t.main))}#mt(){this.selectMenu_align.open("",'[data-command="'+this.align+'"]')}#ft(){this.selectMenu_as.open("",'[data-command="'+this.as+'"]')}#bt(){const t=this.getSize(this._element),e=t.w,i=t.h;let s="";if(this.autoRatio){if(i===this.autoRatio.default&&/%$/.test(e)){const t=kt.get(e);s=100===t?"auto":"resize_percent"+t}}else"auto"===i&&("auto"===e?s="auto":/%$/.test(e)&&(s="resize_percent"+kt.get(e)));this.selectMenu_resize.open("",'[data-command="'+s+'"]')}}function vs(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 _s(t){return/^(90|270)$/.test(Math.abs(kt.is(t)?t:vs(t).r).toString())}function Cs(t){const e=t.split("_"),i=e[0],s=e[1];let n,o,l,r;switch(i){case"resize":n="onresize",o=s,l="resize",r="resize";break;case"auto":n="auto",l="autoSize",r="auto_size";break;case"rotate":n="rotate",o="l"===s?-90:"r"===s?90:kt.get(s),l=o<0?"rotateLeft":"rotateRight",r=o<0?"rotate_left":"rotate_right";break;case"mirror":n="mirror",o=s,l="h"===s?"mirrorHorizontal":"mirrorVertical",r="h"===s?"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 ws=ys,{_w:xs,ON_OVER_COMPONENT:ks,isMobile:Es}=_t,Ss=/^Arrow(Left|Up|Right|Down)$/,Ts=/^Arrow(Left|Up)$/;function Hs(t){re.call(this,t),this.info=null,this.isSelected=!1,this.currentTarget=null,this.currentPlugin=null,this.currentPluginName="",this.currentInfo=null,this.__globalEvents={copy:Is.bind(this),cut:Os.bind(this),keydown:Rs.bind(this),mousedown:Vs.bind(this)},this._bindClose_copy=null,this._bindClose_cut=null,this._bindClose_keydown=null,this._bindClose_mousedown=null,this.__selectionSelected=!1,this.__prevent=!1,this.editor.applyFrameRoots((t=>{const e=xt.utils.createElement("DIV",{class:"se-drag-handle",draggable:"true"},this.icons.selection);t.get("wrapper").appendChild(e),this.eventManager.addEvent(e,"mouseenter",Ls.bind(this)),this.eventManager.addEvent(e,"mouseleave",Ms.bind(this)),this.eventManager.addEvent(e,"dragstart",Ns.bind(this)),this.eventManager.addEvent(e,"dragend",As.bind(this)),this.eventManager.addEvent(e,"click",Bs.bind(this))}))}function Ls(){this.editor._preventBlur=!0,this.ui._visibleControllers(!1,xt.utils.hasClass(he.get("__dragHandler"),"se-drag-handle-full")),xt.utils.addClass(he.get("__dragCover")||he.get("__dragContainer"),"se-drag-over")}function Ms(){this.editor._preventBlur=!1,xt.utils.hasClass(he.get("__dragHandler"),"se-drag-handle-full")||this.ui._visibleControllers(!0,!0),xt.utils.removeClass([he.get("__dragCover"),he.get("__dragContainer")],"se-drag-over")}function Ns(t){const e=he.get("__dragCover")||he.get("__dragContainer");e?(this.editor._preventBlur=!1,xt.utils.addClass(he.get("__dragHandler"),"se-dragging"),xt.utils.addClass(he.get("__dragContainer"),"se-dragging"),t.dataTransfer.setDragImage(e,this.options.get("_rtl")?e.offsetWidth:-5,-5)):t.preventDefault()}function As(){this.editor._preventBlur=!1,xt.utils.removeClass([he.get("__dragHandler"),he.get("__dragContainer")],"se-dragging"),this._removeDragEvent()}function Bs(t){const e=xt.query.getEventTarget(t);if(!xt.utils.hasClass(e,"se-drag-handle-full"))return;const i=he.get("__dragInst");i&&(this._removeDragEvent(),this.select(i.currentTarget,i.currentPluginName))}function Vs(t){const e=xt.query.getEventTarget(t);this.currentTarget?.contains(e)||xt.query.getParentElement(e,".se-controller")||xt.utils.hasClass(e,"se-drag-handle")||this.currentPluginName===this.editor.currentControllerName&&this.editor.opendControllers.some((({form:t})=>t.contains(e)))||this.deselect()}function Is(t){const e=xt.query.getEventTarget(t);if(xt.check.isInputElement(e)&&xt.query.getParentElement(e,".se-modal"))return;const i=this.info;if(!i)return;const s=i.container.cloneNode(!0);xt.utils.removeClass(s,"se-component-selected"),"function"==typeof this.plugins[i.pluginName]?.componentCopy&&!1!==this.plugins[i.pluginName].componentCopy({event:t,cloneContainer:s,info:i})||Fs(t,s,t.clipboardData),xt.utils.flashClass(i.container,"se-copy")}function Os(t){const e=this.info;if(!e)return;const i=e.container.cloneNode(!0);xt.utils.removeClass(i,"se-component-selected"),Fs(t,i,t.clipboardData),this.deselect(),xt.utils.removeItem(e.container)}async function Rs(t){if(this.editor.selectMenuOn)return;const e=t.code;if(Et.isCtrl(t)){if("ControlRight"!==e&&"ControlLeft"!==e){const i=this.editor.shortcutsKeyMap.get(e+(t.shiftKey?"1000":""));/^(redo|undo)$/.test(i?.command)&&(t.preventDefault(),t.stopPropagation(),this.editor.run(i.command,i.type,i.button))}}else if(!Et.isRemoveKey(e)||(t.preventDefault(),t.stopPropagation(),"function"!=typeof this.currentPlugin?.componentDestroy||this.info.isInputType&&this.status.hasFocus)){if(Et.isEnter(e)){t.preventDefault();const e=this.currentInfo||this.get(this.currentTarget),i=e.container||e.target,s=i.previousElementSibling||i.nextElementSibling;let n=null;n=xt.check.isListCell(i.parentNode)?xt.utils.createElement("BR"):xt.utils.createElement(this.format.isLine(s)?s.nodeName:this.options.get("defaultLine"),null,"<br>");const o=this.currentPluginName;return this.deselect(),i.parentNode.insertBefore(n,i),!1===this.select(e.target,o)&&this.editor.blur(),void this.history.push(!1)}if(Ss.lastIndex=0,Ss.test(e)){const{container:i}=this.get(this.currentTarget);let s=null,n=1;if(this.isInline(i||this.currentTarget))switch(e){case"ArrowLeft":s=i.previousSibling,n=3===s?.nodeType?s.textContent.length:1;break;case"ArrowRight":s=i.nextSibling,n=0;break;case"ArrowUp":{const t=this.format.getLine(i,null);s=t?.previousElementSibling,n=0;break}case"ArrowDown":{const t=this.format.getLine(i,null);s=t?.nextElementSibling;break}}else Ts.lastIndex=0,Ts.test(e)?s=i.previousElementSibling:(s=i.nextElementSibling,n=0);if(!s)return;this.deselect();const o=this.get(s);if(o?.container)t.stopPropagation(),t.preventDefault(),this.select(o.target,o.pluginName);else try{this.editor._preventBlur=!0,t.stopPropagation(),t.preventDefault(),this.selection.setRange(s,n,s,n)}finally{this.editor._preventBlur=!1}}else Et.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.selection.setRange(t,e,t,e)}else this.editor.focus()}}function Fs(t,e,i){t.preventDefault(),t.stopPropagation(),e.querySelectorAll(".se-figure-selected").forEach((t=>xt.utils.removeClass(t,"se-figure-selected"))),i.setData("text/html",e.outerHTML)}Hs.prototype={insert(t,{skipCharCount:e=!1,skipHistory:i=!1,scrollTo:s=!0,insertBehavior:n}={}){if(this.frameContext.get("isReadOnly")||!e&&!this.char.check(t))return null;void 0===n&&(n=this.options.get("componentInsertBehavior"));const o=this.html.remove(),l=this.isInline(t);this.selection.getRangeAndAddLine(this.selection.getRange(),o.container);const r=this.selection.getNode();let a=null,h=this.format.getLine(r,null);try{if(xt.check.isListCell(h))this.html.insertNode(t,{afterNode:l?null:xt.check.isZeroWidth(r)?(r||o.container||{}).nextSibling:null,skipCharCount:!0}),l||t.nextSibling||t.parentNode.appendChild(xt.utils.createElement("BR"));else{if(!l&&this.selection.getRange().collapsed&&(3===o.container?.nodeType||xt.check.isBreak(o.container))){const t=xt.query.getParentElement(o.container,this.format.isBlock.bind(this.format));a=this.nodeTransform.split(o.container,o.offset,t?xt.query.getNodeDepth(t)+1:0),a&&(h=a.previousSibling)}this.html.insertNode(t,{afterNode:l||this.format.isBlock(h)?null:h,skipCharCount:!0}),!l&&h&&xt.check.isZeroWidth(h)&&xt.utils.removeItem(h)}if(l){const e=xt.utils.createTextNode(Ct.zeroWidthSpace);t.parentNode.insertBefore(e,t.nextSibling)}}catch(t){console.error("Component insert error:",t)}i||this.history.push(!1),this.frameContext.has("documentType_use_header")&&this.frameContext.get("documentType").reHeader();const c=a||t;return s&&this.selection.scrollTo(c,{behavior:"auto"}),null!==n&&this.applyInsertBehavior(t,a,n),c},applyInsertBehavior(t,e,i){const s=this.get(t);if(this.isInline(t)){const e=this.selection.getNearRange(t);e?this.selection.setRange(e.container,e.offset,e.container,e.offset):this.select(s.target,s.pluginName)}else switch(i){case"auto":this.__moveToNextLineOrAdd(t)||this.select(s.target,s.pluginName);break;case"select":this.selection.setRange(t,0,t,0),s?this.select(s.target,s.pluginName):e&&(e=xt.query.getEdgeChildNodes(e,null).sc||e,this.selection.setRange(e,0,e,0));break;case"line":if(!this.__moveToNextLineOrAdd(t)){const e=this.format.addLine(t,null);e&&this.selection.setRange(e,0,e,0)}}},get(t){if(!t)return null;let e,i="",s={},n=!1,o=null;if(this.is(t)){if(xt.check.isComponentContainer(t)&&!xt.utils.hasClass(t,"se-inline-component")&&(t=t.firstElementChild||t),/^FIGURE$/i.test(t.nodeName)&&(t=t.firstElementChild),!t)return null;const n=this.editor._componentManager.map((e=>e(t))).find((t=>t));if(!n)return null;e=n.target,i=n.pluginName,s=n.options,o=n.launcher}if(!e&&t.nodeName){this.__isFiles(t)&&(n=!0);const l=this.editor._componentManager.map((e=>e(t))).find((t=>t));if(!l)return null;e=l.target,i=l.pluginName,s=l.options,o=l.launcher}if(!e)return null;const l=ws.GetContainer(e),r=l.container||l.cover||e;return this.info={target:l.target,pluginName:i,options:s,container:r,cover:l.cover,inlineCover:l.inlineCover,caption:l.caption,isFile:n,launcher:o,isInputType:xt.utils.hasClass(r,"se-input-component")}},select(t,e,{isInput:i=!1}={}){const s=this.get(t);if(!s||xt.check.isUneditable(xt.query.getParentElement(t,this.is.bind(this)))||xt.check.isUneditable(t))return!1;const n=s.launcher||this.plugins[e];if(!n)return;const o=he.get("__overInfo")!==ks;if(!i&&o){if(this.status._onMousedown)return;this.editor._preventBlur=!0,this.__selectionSelected=!0,this.isInline(s.container)&&this.selection.setRange(s.container,0,s.container,0),this.editor.blur(),xs.setTimeout((()=>{this.__selectionSelected=!1}))}let l;this.isSelected=!0,this.__prevent=!0,"function"==typeof n.componentSelect&&(l=n.componentSelect(t));const r=xt.utils.hasClass(s.target,"se-component-line-break");(r||!l&&!xt.utils.hasClass(s.container,"se-inline-component"))&&this._setComponentLineBreaker(s.container||s.cover||t),this.currentTarget=t,this.currentPlugin=n,this.currentPluginName=e,this.currentInfo=s,he.set("__dragInst",this);const a=he.get("__overInfo");if(xs.setTimeout((()=>{he.set("__overInfo",a===ks&&void 0),a!==ks&&this.__addGlobalEvent(),s.isFile||this.__addNotFileGlobalEvent()}),0),wt.debounce((()=>{xt.utils.addClass(s.container,"se-component-selected")}),0)(),!o||this.status.hasFocus||this.editor._preventFocus||(this.eventManager.__postFocusEvent(this.frameContext,null),this.editor._preventFocus=!0),r||a===ks){if(r||!xt.utils.hasClass(s.container,"se-input-component")){const t=this.frameContext.get("wrapper").querySelector(".se-drag-handle");xt.utils.addClass(t,"se-drag-handle-full"),this.ui._visibleControllers(!1,!1);const e=s.caption?s.target:s.cover||s.container||s.target,i=e.offsetWidth,n=e.offsetHeight,{top:o,left:l}=this.offset.getLocal(e);t.style.opacity=0,t.style.width=i+"px",t.style.height=n+"px",t.style.top=o+"px",t.style.left=l+"px",he.set("__dragHandler",t),he.set("__dragContainer",s.container),he.set("__dragCover",s.cover),t.style.display="block"}}else{if(!this.isInline(s.container))return;const t=s.container;let e=null;t.previousSibling&&!xt.check.isBreak(t.previousSibling)||(e=xt.utils.createTextNode(Ct.zeroWidthSpace),t.parentNode.insertBefore(e,t)),t.nextSibling&&!xt.check.isBreak(t.nextSibling)||(e=xt.utils.createTextNode(Ct.zeroWidthSpace),t.parentNode.insertBefore(e,t.nextSibling)),this.status.onSelected=!0}},deselect(){xs.setTimeout((()=>{this.status.onSelected=!1}),0),this.__deselect(),this.ui.setControllerOnDisabledButtons(!1),!this.editor._preventFocus||this.status.hasFocus||this.__prevent||(this.eventManager.__postBlurEvent(this.frameContext,null),this.editor._preventFocus=!1)},is(t){return!!t&&(!(!/^FIGURE$/i.test(t.nodeName)&&!xt.check.isComponentContainer(t))||!!this.editor._componentManager.find((e=>e(t))))},isInline(t){if(!t)return!1;if(/^FIGURE$/i.test(t.nodeName)&&(t=t.parentElement),xt.utils.hasClass(t,"se-inline-component"))return!0;return!(!this.editor._componentManager.find((e=>e(t)))||!xt.utils.hasClass(t,"se-inline-component")&&!xt.utils.hasClass(t.parentElement,"se-inline-component"))},isBasic(t){return this.is(t)&&!this.isInline(t)},async copy(t){const e=xt.utils.clone(t,!0);xt.utils.removeClass(e,"se-component-selected"),xt.utils.removeClass(e.querySelectorAll(".se-figure-selected"),"se-figure-selected"),xt.utils.removeClass(e.querySelectorAll(".se-selected-table-cell"),"se-selected-table-cell"),xt.utils.removeClass(e.querySelector(".se-selected-cell-focus"),"se-selected-cell-focus"),!1!==await this.html.copy(e)&&xt.utils.flashClass(t,"se-copy")},hoverSelect(t){const e=xt.query.getParentElement(t,xt.check.isFigure);let i=this.get(t);i||e?(i||=this.get(e),i&&!xt.utils.hasClass(i.container,"se-component-selected")&&(this.ui._offCurrentController(),he.set("__overInfo",ks),this.select(i.target,i.pluginName))):null===he.get("__overInfo")||xt.utils.hasClass(t,"se-drag-handle")||(this.__deselect(),he.set("__overInfo",null))},__isFiles(t){const e=t.nodeName.toLowerCase();return this.editor._fileManager.regExp.test(e)&&(!this.editor._fileManager.tagAttrs[e]||this.editor._fileManager.tagAttrs[e]?.every((e=>t.hasAttribute(e))))},__deselect(){if(this.editor._preventBlur=!1,he.set("__overInfo",null),this._removeDragEvent(),this.currentInfo){const t=this.currentInfo.container,e=this.currentInfo.cover;wt.debounce((()=>{xt.utils.removeClass(t,"se-component-selected"),xt.utils.removeClass(e,"se-figure-over-selected")}),0)()}const{frameContext:t}=this.editor;t.get("lineBreaker_t")&&(t.get("lineBreaker_t").style.display=t.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.ui.__offControllers()},__moveToNextLineOrAdd(t){const e=t.nextElementSibling;if(!e){const e=this.format.addLine(t,null);return e&&this.selection.setRange(e,0,e,0),!0}return!!this.format.isLine(e)&&(this.selection.setRange(e,0,e,0),!0)},_setComponentLineBreaker(t){const e=he.get("__overInfo")===ks;this.eventManager._lineBreakComp=null;const i=this.get(t);if(!i)return;const s=this.frameContext,n=i.container,o=xt.utils.hasClass(n,"se-flex-component"),l=s.get("lineBreaker_t"),r=s.get("lineBreaker_b"),a=l.style,h=r.style,c=n.offsetWidth<t.offsetWidth?n:t,d="block"===this.editor._figureContainer?.style.display?this.editor._figureContainer:c,u=xt.check.isListCell(n.parentNode);let p,g;const m=this.options.get("_rtl"),f=m?["right","left"]:["left","right"],{top:b,left:y,right:v,scrollX:_,scrollY:C}=this.offset.getLocal(c),w=m?v:y;if(u?!xt.check.isBreak(n.previousElementSibling)&&!n.previousSibling?.textContent?.trim()||this.is(n.previousElementSibling):!this.format.isLine(n.previousElementSibling)){const t=xs.getComputedStyle(l),i=kt.get(t.height,1),s=kt.get(t.width,1);this.eventManager._lineBreakComp=n,p=b,g=d.offsetWidth/2/2,a.top=p-i/2+"px",a[f[0]]=(o?w-s/2:w+g)+"px",a[f[1]]="",l.setAttribute("data-offset",C+","+_),e?xt.utils.removeClass(l,"se-on-selected"):xt.utils.addClass(l,"se-on-selected"),a.display="block",a.visibility=""}else a.display="none";if(u?!xt.check.isBreak(n.nextElementSibling)&&!n.nextSibling?.textContent?.trim()||this.is(n.nextElementSibling):!this.format.isLine(n.nextElementSibling)){const t=xs.getComputedStyle(r),i=kt.get(t.height,1),s=kt.get(t.width,1);p||(this.eventManager._lineBreakComp=n,p=b,g=d.offsetWidth/2/2),h.top=p+d.offsetHeight-i/2+"px",h[f[0]]=w+d.offsetWidth-(o?0:g)-(o?s/2:s)+"px",h[f[1]]="",r.setAttribute("data-offset",C+","+f[0]+","+_),e?xt.utils.removeClass(r,"se-on-selected"):xt.utils.addClass(r,"se-on-selected"),h.display="block",h.visibility=""}else h.display="none"},__addGlobalEvent(){this.__removeGlobalEvent(),this._bindClose_copy=this.eventManager.addGlobalEvent("copy",this.__globalEvents.copy),this._bindClose_cut=this.eventManager.addGlobalEvent("cut",this.__globalEvents.cut),this._bindClose_keydown=this.eventManager.addGlobalEvent("keydown",this.__globalEvents.keydown)},__removeGlobalEvent(){this.__removeNotFileGlobalEvent(),this._bindClose_copy&&=this.eventManager.removeGlobalEvent(this._bindClose_copy),this._bindClose_cut&&=this.eventManager.removeGlobalEvent(this._bindClose_cut),this._bindClose_keydown&&=this.eventManager.removeGlobalEvent(this._bindClose_keydown)},__addNotFileGlobalEvent(){this.__removeNotFileGlobalEvent(),this._bindClose_mousedown=this.eventManager.addGlobalEvent(Es?"click":"mousedown",this.__globalEvents.mousedown,!0)},__removeNotFileGlobalEvent(){this._bindClose_mousedown&&=this.eventManager.removeGlobalEvent(this._bindClose_mousedown)},_removeDragEvent(){this.carrierWrapper.querySelector(".se-drag-cursor").style.left="-10000px",he.get("__dragHandler")&&(he.get("__dragHandler").style.display="none"),xt.utils.removeClass([he.get("__dragHandler"),he.get("__dragContainer")],"se-dragging"),xt.utils.removeClass([he.get("__dragCover"),he.get("__dragContainer")],"se-drag-over"),he.set("__figureInst",null),he.set("__dragInst",null),he.set("__dragHandler",null),he.set("__dragContainer",null),he.set("__dragCover",null),he.set("__dragMove",null),he.set("__overInfo",null)},constructor:Hs};const zs=Hs;function $s(t){re.call(this,t),this._formatLineCheck=this.options.get("formatLine").reg,this._formatBrLineCheck=this.options.get("formatBrLine").reg,this._formatBlockCheck=this.options.get("formatBlock").reg,this._formatClosureBlockCheck=this.options.get("formatClosureBlock").reg,this._formatClosureBrLineCheck=this.options.get("formatClosureBrLine").reg,this._textStyleTagsCheck=new RegExp("^("+this.options.get("textStyleTags")+")$","i"),this._brLineBreak=null,this.__resetBrLineBreak(this.options.get("defaultLineBreakFormat"))}function Ps(t,e,i){const s=[];for(let n,o,l=0,r=t.length;l<r;l++)n=t[l],xt.check.isListCell(n)?(e<0||n.previousElementSibling)&&s.push(n):(o=/\d+/.test(n.style[i])?kt.get(n.style[i],0):0,o+=e,xt.utils.setStyle(n,i,o<=0?"":o+"px"));return s}$s.prototype={setLine(t){if(!this.isLine(t))throw new Error('[SUNEDITOR.format.setLine.fail] The "element" must satisfy "format.isLine()".');const e=this._lineWork(),i=e.lines,s=t.className,n=t.nodeName;let o=e.firstNode,l=e.lastNode;for(let e,r,a=0,h=i.length;a<h;a++)e=i[a],e.nodeName===n&&(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim()===s||this.component.is(e)||(r=t.cloneNode(!1),xt.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.selection.setRange(xt.query.getNodeFromPath(e.firstPath,o),e.startOffset,xt.query.getNodeFromPath(e.lastPath,l),e.endOffset),this.history.push(!1),this.frameContext.has("documentType_use_header")&&this.frameContext.get("documentType").reHeader()},getLine(t,e){if(!t)return null;for(e||=()=>!0;t;){if(xt.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._lineWork().lines,i=e.length-1;let s=e[i].parentNode,n=t.cloneNode(!1);const o=n;for(let o,l,r,a,h,c,d=i,u=!0;d>=0;d--)if(o=e[d],o!==(e[d+1]?e[d+1].parentNode:null)){if(c=this.component.is(o),l=c?"":o.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),r=xt.query.getParentElement(o,(t=>t.parentNode===s)),(s!==o.parentNode||c)&&(this.isLine(s)?(s.parentNode.insertBefore(n,s.nextSibling),s=s.parentNode):(s.insertBefore(n,r?r.nextSibling:null),s=o.parentNode),a=n.nextSibling,a&&n.nodeName===a.nodeName&&xt.check.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,xt.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){s.insertBefore(n,o),a=o.nextSibling,a&&n.nodeName===a.nodeName&&xt.check.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,xt.utils.removeItem(a));const t=n.previousSibling;t&&n.nodeName===t.nodeName&&xt.check.isSameAttributes(n,t)&&(t.innerHTML+="<BR>"+n.innerHTML,xt.utils.removeItem(n))}c||xt.utils.removeItem(o),l&&(u=!1)}this.selection.setRange(o,0,o,0),this.history.push(!1)},getBrLine(t,e){if(!t)return null;for(e||=()=>!0;t;){if(xt.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 i=this.getLine(this.selection.getNode(),null);let s=null;if(this.isBrLine(t)||!this.isBrLine(i||t.parentNode)||this.component.is(t)){const t=e?"string"==typeof e?e:e.nodeName:this.isNormalLine(i)?i.nodeName:this.options.get("defaultLine");s=xt.utils.createElement(t,null,"<br>"),(e&&"string"!=typeof e||!e&&this.isLine(i))&&xt.utils.copyTagAttributes(s,e||i,["id"])}else s=xt.utils.createElement("BR");return xt.check.isTableCell(t)?t.insertBefore(s,t.nextElementSibling):t.parentNode.insertBefore(s,t.nextElementSibling),s},getBlock(t,e){if(!t)return null;for(e||=()=>!0;t;){if(xt.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.selection.getRangeAndAddLine(this.selection.getRange(),null);const e=this.getLinesAndComponents(!1);if(!e||0===e.length)return;t:for(let t,i,s,n,o,l,r=0,a=e.length;r<a;r++)if(t=e[r],xt.check.isListCell(t))if(i=t.lastElementChild,i&&xt.check.isListCell(t.nextElementSibling)&&e.includes(t.nextElementSibling)&&(n=i.lastElementChild,e.includes(n))){let t=null;for(;t=n.lastElementChild;)if(xt.check.isList(t)){if(!e.includes(t.lastElementChild))continue t;n=t.lastElementChild}s=i.firstElementChild,o=e.indexOf(s),l=e.indexOf(n),e.splice(o,l-o+1),a=e.length}else;const i=e.at(-1);let s,n,o;s=this.isBlock(i)||this.isLine(i)?i:this.getBlock(i,null)||this.getLine(i,null),xt.check.isTableCell(s)?(n=null,o=s):(n=s.nextSibling,o=s.parentNode);const l=t.cloneNode(!1);let r=xt.query.getNodeDepth(s),a=null;const h=[],c=(t,e,i)=>{let s=null;if(t!==e&&!xt.check.isTableElements(e)){if(e&&xt.query.getNodeDepth(t)===xt.query.getNodeDepth(e))return i;s=this.nodeTransform.removeAllParents(e,null,t)}return s?s.ec:i};for(let t,i,s,d,u,p,g,m=0,f=e.length;m<f;m++)if(t=e[m],i=t.parentNode,i&&!l.contains(i))if(s=xt.query.getNodeDepth(t),xt.check.isList(i)){if(null===a&&(p?(a=p,g=!0,p=null):a=i.cloneNode(!1)),h.push(t),u=e[m+1],m===f-1||u?.parentNode!==i){t.contains(u?.parentNode)&&(p=u.parentNode.cloneNode(!1));let e,m=i.parentNode;for(;xt.check.isList(m);)e=xt.utils.createElement(m.nodeName),e.appendChild(a),a=e,m=m.parentNode;const f=this.removeBlock(i,{selectedFormats:h,newBlockElement:null,shouldDelete:!0,skipHistory:!0});r>=s?(r=s,o=f.cc,n=c(o,i,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>=s&&(r=s,o=i,n=t.nextSibling),l.appendChild(t),o!==i&&(d=c(o,i),void 0!==d&&(n=d));if(this.editor.effectNode=null,this.nodeTransform.mergeSameTags(l,null,!1),this.nodeTransform.mergeNestedTags(l,(t=>xt.check.isList(t))),n&&xt.query.getNodeDepth(n)>0&&(xt.check.isList(n.parentNode)||xt.check.isList(n.parentNode.parentNode))){const t=xt.query.getParentElement(n,(t=>this.isBlock(t)&&!xt.check.isList(t))),e=this.nodeTransform.split(n,null,t?xt.query.getNodeDepth(t)+1:0);e.parentNode.insertBefore(l,e)}else o.insertBefore(l,n),c(l,n);const d=xt.query.getEdgeChildNodes(l.firstElementChild,l.lastElementChild);e.length>1?this.selection.setRange(d.sc,0,d.ec,d.ec.textContent.length):this.selection.setRange(d.ec,d.ec.textContent.length,d.ec,d.ec.textContent.length),this.history.push(!1)},removeBlock(t,{selectedFormats:e,newBlockElement:i,shouldDelete:s,skipHistory:n}={}){const o=this.selection.getRange();let l=o.startOffset,r=o.endOffset,a=xt.query.getListChildNodes(t,null,1),h=t.parentNode,c=null,d=null,u=t.cloneNode(!1);const p=[],g=xt.check.isList(i);let m=!1,f=!1,b=!1;const y=(e,i,s,n)=>{if(1===i.childNodes.length&&xt.check.isZeroWidth(i)&&(i.innerHTML=Ct.zeroWidthSpace,l=r=1),3===i.nodeType)return e.insertBefore(i,s),i;const o=(b?i:n).childNodes;let a=i.cloneNode(!1),h=null,c=null;for(;o[0];)c=o[0],!this._notTextNode(c)||xt.check.isBreak(c)||xt.check.isListCell(a)?a.appendChild(c):(a.childNodes.length>0&&(h||=a,e.insertBefore(a,s),a=i.cloneNode(!1)),e.insertBefore(c,s),h||=c);if(a.childNodes.length>0){if(xt.check.isListCell(e)&&xt.check.isListCell(a)&&xt.check.isList(s))if(g){for(h=s;s;)a.appendChild(s),s=s.nextSibling;e.parentNode.insertBefore(a,e.nextElementSibling)}else{const e=n.nextElementSibling,i=this.listFormat.removeNested(n,!1);if(t!==i||e!==n.nextElementSibling){const e=a.childNodes;for(;e[0];)n.appendChild(e[0]);t=i,f=!0}}else e.insertBefore(a,s);h||=a}return h};for(let n,o,l,r=0,v=a.length;r<v;r++)if(n=a[r],3!==n.nodeType||!xt.check.isList(u))if(b=!1,s&&0===r&&(c=e&&e.length!==v&&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&&xt.check.isListCell(n))if(l&&xt.query.getNodeDepth(n)!==xt.query.getNodeDepth(l)&&(xt.check.isListCell(h)||xt.utils.arrayFind(n.children,xt.check.isList))){const e=n.nextElementSibling,i=this.listFormat.removeNested(n,!1);t===i&&e===n.nextElementSibling||(t=i,f=!0)}else{const e=n;n=xt.utils.createElement(s?e.nodeName:xt.check.isList(t.parentNode)||xt.check.isListCell(t.parentNode)?"LI":xt.check.isTableCell(t.parentNode)?"DIV":this.options.get("defaultLine"));const i=xt.check.isListCell(n),o=e.childNodes;for(;o[0]&&(!xt.check.isList(o[0])||i);)n.appendChild(o[0]);xt.utils.copyFormatAttributes(n,e),b=!0}else n=n.cloneNode(!1);if(!f&&(s?(p.push(n),xt.utils.removeItem(a[r])):(i?(m||(h.insertBefore(i,t),m=!0),n=y(i,n,null,a[r])):n=y(h,n,t,a[r]),f||(e?(d=n,c||=n):c||(c=d=n))),f)){f=b=!1,a=xt.query.getListChildNodes(t,null,1),u=t.cloneNode(!1),h=t.parentNode,r=-1,v=a.length;continue}}const v=t.parentNode;let _=t.nextSibling;u?.children.length>0&&v.insertBefore(u,_),i?c=i.previousSibling:c||=t.previousSibling,_=t.nextSibling!==u?t.nextSibling:u?u.nextSibling:null,0===t.children.length||0===t.textContent.length?xt.utils.removeItem(t):this.nodeTransform.removeEmptyNode(t,null,!1);let C=null;if(this.editor.effectNode=null,s)C={cc:v,sc:c,so:l,ec:_,eo:r,removeArray:p};else{c||=d,d||=c;const t=xt.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.editor.focus()}if(n)return C;!s&&C&&(e?this.selection.setRange(C.sc,l,C.ec,r):this.selection.setRange(C.sc,0,C.sc,0)),this.history.push(!1)},indent(){const t=this.selection.getRange(),e=t.startContainer,i=t.endContainer,s=t.startOffset,n=t.endOffset,o=Ps(this.getLines(null),this.status.indentSize,this.options.get("_rtl")?"marginRight":"marginLeft");o.length>0&&this.listFormat.applyNested(o,!1),this.editor.effectNode=null,this.selection.setRange(e,s,i,n),this.history.push(!1)},outdent(){const t=this.selection.getRange(),e=t.startContainer,i=t.endContainer,s=t.startOffset,n=t.endOffset,o=Ps(this.getLines(null),-1*this.status.indentSize,this.options.get("_rtl")?"marginRight":"marginLeft");o.length>0&&this.listFormat.applyNested(o,!0),this.editor.effectNode=null,this.selection.setRange(e,s,i,n),this.history.push(!1)},isEdgeLine(t,e,i){if(!xt.check.isEdgePoint(t,e,i))return!1;let s=!1;const n="front"===i?"previousSibling":"nextSibling";for(;t&&!this.isLine(t)&&!xt.check.isWysiwygFrame(t);){if(t[n]&&(!xt.check.isBreak(t[n])||t[n][n]))return!1;s=!0,t=t.parentNode}return s},isTextStyleNode(t){return"string"==typeof t?this._textStyleTagsCheck.test(t):1===t?.nodeType&&this._textStyleTagsCheck.test(t.nodeName)},isLine(t){return"string"==typeof t?this._formatLineCheck.test(t):1===t?.nodeType&&(this._formatLineCheck.test(t.nodeName)||xt.utils.hasClass(t,"__se__format__line_.+|__se__format__br_line_.+"))&&!this._nonFormat(t)},isNormalLine(t){return this.isLine(t)&&(this._brLineBreak||!this.isBrLine(t))&&!this.isBlock(t)},isBrLine(t){return this._brLineBreak&&this.isLine(t)||("string"==typeof t?this._formatBrLineCheck.test(t):1===t?.nodeType&&(this._formatBrLineCheck.test(t.nodeName)||xt.utils.hasClass(t,"__se__format__br_line_.+"))&&!this._nonFormat(t))},isBlock(t){return"string"==typeof t?this._formatBlockCheck.test(t):1===t?.nodeType&&(this._formatBlockCheck.test(t.nodeName)||xt.utils.hasClass(t,"__se__format__block_.+"))&&!this._nonFormat(t)},isClosureBlock(t){return"string"==typeof t?this._formatClosureBlockCheck.test(t):1===t?.nodeType&&(this._formatClosureBlockCheck.test(t.nodeName)||xt.utils.hasClass(t,"__se__format__block_closure_.+"))&&!this._nonFormat(t)},isClosureBrLine(t){return"string"==typeof t?this._formatClosureBrLineCheck.test(t):1===t?.nodeType&&(this._formatClosureBrLineCheck.test(t.nodeName)||xt.utils.hasClass(t,"__se__format__br_line__closure_.+"))&&!this._nonFormat(t)},getLines(t){if(!this.selection._resetRangeToTextNode())return[];let e=this.selection.getRange();if(xt.check.isWysiwygFrame(e.startContainer)){const t=this.frameContext.get("wysiwyg").children;if(0===t.length)return[];this.selection.setRange(t[0],0,t.at(-1),t.at(-1).textContent.trim().length),e=this.selection.getRange()}const i=e.startContainer,s=e.endContainer,n=e.commonAncestorContainer;t||=this.isLine.bind(this);const o=xt.query.getListChildren(n,(e=>t(e)),null);if(3!==n.nodeType&&(xt.check.isWysiwygFrame(n)||this.isBlock(n))||o.unshift(this.getLine(n,null)),i===s||1===o.length)return o;const l=this.getLine(i,null),r=this.getLine(s,null);let a=null,h=null;const c=function(t){return!xt.check.isTableElements(t)||/^TABLE$/i.test(t.nodeName)};let d=this.getBlock(l,c),u=this.getBlock(r,c);xt.check.isTableElements(d)&&xt.check.isListCell(d.parentNode)&&(d=d.parentNode),xt.check.isTableElements(u)&&xt.check.isListCell(u.parentNode)&&(u=u.parentNode);const p=d===u;for(let t,e=0,i=o.length;e<i;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.selection.getRange().commonAncestorContainer,i=xt.query.getParentElement(e,this.component.is.bind(this.component)),s=xt.check.isTableElements(e)?this.getLines(null):this.getLines((t=>{const e=xt.query.getParentElement(t,this.component.is.bind(this.component));return this.isLine(t)&&(!e||e===i)||xt.check.isComponentContainer(t)&&!this.getLine(t)}));if(t)for(let t=0,e=s.length;t<e;t++)for(let i=t-1;i>=0;i--)if(s[i].contains(s[t])){s.splice(t,1),t--,e--;break}return s},_isExcludeSelectionElement(t){return!/FIGCAPTION/i.test(t.nodeName)&&(this.component.is(t)||/FIGURE/i.test(t.nodeName))},_nonFormat(t){return xt.check.isExcludeFormat(t)||this.component.is(t)||xt.check.isWysiwygFrame(t)},_notTextNode(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.component.is(t)||e.test(t.nodeName))},_lineWork(){let t=this.selection.getRange(),e=this.getLinesAndComponents(!1);if(0===e.length&&(t=this.selection.getRangeAndAddLine(t,null),e=this.getLinesAndComponents(!1),0===e.length))return;const i=t.startOffset,s=t.endOffset;let n=e[0],o=e.at(-1);const l=xt.query.getNodePath(t.startContainer,n,null),r=xt.query.getNodePath(t.endContainer,o,null),a=this.listFormat.remove(e,!1);return a.sc&&(n=a.sc),a.ec&&(o=a.ec),this.selection.setRange(xt.query.getNodeFromPath(l,n),i,xt.query.getNodeFromPath(r,o),s),{lines:this.getLinesAndComponents(!1),firstNode:n,lastNode:o,firstPath:l,lastPath:r,startOffset:i,endOffset:s}},__resetBrLineBreak(t){this._brLineBreak="br"===t},constructor:$s};const Ds=$s;function qs(t){re.call(this,t);const e=this.options;this.fontSizeUnitRegExp=null,this._isAllowedClassName=function(t){return this.test(t)?t:""}.bind(e.get("allowedClassName")),this._allowHTMLComment=null,this._disallowedStyleNodesRegExp=null,this._htmlCheckWhitelistRegExp=null,this._htmlCheckBlacklistRegExp=null,this._elementWhitelistRegExp=null,this._elementBlacklistRegExp=null,this._attributeWhitelist=null,this._attributeBlacklist=null,this._attributeWhitelistRegExp=null,this._attributeBlacklistRegExp=null,this._cleanStyleTagKeyRegExp=null,this._cleanStyleRegExpMap=null,this._textStyleTags=e.get("_textStyleTags"),this._autoStyleify=null,this.__disallowedTagsRegExp=null,this.__disallowedTagNameRegExp=null,this.__allowedTagNameRegExp=null;const i=e.get("tagStyles"),s={};for(const t in i){const e=t.split("|");for(let n,o=0,l=e.length;o<l;o++)n=e[o],s[n]?s[n]+="|":s[n]="",s[n]+=i[t]}for(const t in s)s[t]=new RegExp(`\\s*[^-a-zA-Z](${s[t]})\\s*:[^;]+(?!;)*`,"gi");const n=new Map,o={...s,line:e.get("_lineStylesRegExp")};this._textStyleTags.forEach((t=>{o[t]=e.get("_textStylesRegExp")}));for(const t in o)n.set(new RegExp(`^(${t})$`),o[t]);this._cleanStyleTagKeyRegExp=new RegExp(`^(${Object.keys(o).join("|")})$`,"i"),this._cleanStyleRegExpMap=n,this.fontSizeUnitRegExp=new RegExp("\\d+("+e.get("fontSizeUnits").join("|")+")$","i");const l=e.get("_allowedExtraTag"),r=e.get("_disallowedExtraTag");this.__disallowedTagsRegExp=new RegExp(`<(${r})[^>]*>([\\s\\S]*?)<\\/\\1>|<(${r})[^>]*\\/?>`,"gi"),this.__disallowedTagNameRegExp=new RegExp(`^(${r})$`,"i"),this.__allowedTagNameRegExp=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._disallowedStyleNodesRegExp=0===a.length?null:new RegExp("(<\\/?)("+a.join("|")+")\\b\\s*([^>^<]+)?\\s*(?=>)","gi");const c=e.get("__defaultAttributeWhitelist");this._allowHTMLComment=e.get("_editorElementWhitelist").includes("//")||"*"===e.get("_editorElementWhitelist"),this._htmlCheckWhitelistRegExp=new RegExp("^("+Us(e.get("_editorElementWhitelist").replace("|//",""),"")+")$","i"),this._htmlCheckBlacklistRegExp=new RegExp("^("+(e.get("elementBlacklist")||"^")+")$","i"),this._elementWhitelistRegExp=wt.createElementWhitelist(Us(e.get("_editorElementWhitelist").replace("|//","|\x3c!--|--\x3e"),"")),this._elementBlacklistRegExp=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=Us(u[t],c):p[t]=new RegExp("\\s(?:"+Us(u[t],c)+")"+d,"ig"));this._attributeWhitelistRegExp=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._attributeWhitelist=p;const m=e.get("attributeBlacklist");if(p={},g="",m)for(const t in m)"*"===t?g=Us(m[t],""):p[t]=new RegExp("\\s(?:"+Us(m[t],"")+")"+d,"ig");this._attributeBlacklistRegExp=new RegExp("\\s(?:"+(g||"^")+")"+d,"ig"),this._attributeBlacklist=p,this.__resetAutoStyleify(e.get("autoStyleify"))}function Ws(t,e,i,s){if(/^<[a-z0-9]+:[a-z0-9]+/i.test(i))return i;let n=null;const o=s.match(/(?!<)[a-zA-Z0-9-]+/)[0].toLowerCase();if(t){const t=this._attributeBlacklist[o];i=i.replace(/\s(?:on[a-z]+)\s*=\s*(")[^"]*\1/gi,""),i=t?i.replace(t,""):i.replace(this._attributeBlacklistRegExp,"");const e=this._attributeWhitelist[o];n=e?i.match(e):i.match(this._attributeWhitelistRegExp)}if(!e)return i;if("a"===o){const t=i.match(/(?:(?:id|name)\s*=\s*(?:"|')[^"']*(?:"|'))/g);t&&(n||=[],n.push(t[0]))}else n&&/style=/i.test(n.toString())||(this._textStyleTags.includes(o)?n=this._cleanStyle(i,n,o):this.format.isLine(o)?n=this._cleanStyle(i,n,"line"):this._cleanStyleTagKeyRegExp.test(o)&&(n=this._cleanStyle(i,n,o)));if(xt.check.isMedia(o)||xt.check.isFigure(o)){const t=i.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/);n||=[],t&&n.push(t[0])}if(n)for(let t,e=0,i=n.length;e<i;e++)t=/^(?:href|src)\s*=\s*('|"|\s)*javascript\s*:/i.test(n[e].trim())?"":n[e],s+=(/^\s/.test(t)?"":" ")+t;return s}function Us(t,e){return t?"*"===t?"[a-z-]+":e?t+"|"+e:t:"^"}qs.prototype={filter(t,{tagWhitelist:e,tagBlacklist:i,validate:s,validateAll:n}){if(e&&(t=t.replace(wt.createElementWhitelist(e),"")),i&&(t=t.replace(wt.createElementBlacklist(i),"")),s){const e=(new DOMParser).parseFromString(t,"text/html");e.body.querySelectorAll("*").forEach((t=>{if(!t.closest(".se-component")&&!t.closest(".se-flex-component")){const e=s(t);null===e?t.remove():this.instanceCheck.isNode(e)?t.replaceWith(e):"string"==typeof e&&(t.outerHTML=e)}})),t=e.body.innerHTML}else if(n){const e=(new DOMParser).parseFromString(t,"text/html"),i=[".se-component",".se-flex-component"],n=t=>i.some((e=>t.closest(e)));e.body.querySelectorAll("*").forEach((t=>{if(!n(t)){const e=s(t);null===e?t.remove():this.instanceCheck.isNode(e)?t.replaceWith(e):"string"==typeof e&&(t.outerHTML=e)}})),t=e.body.innerHTML}return t},clean(t,{forceFormat:e,whitelist:i,blacklist:s,_freeCodeViewMode:n}={}){const{tagFilter:o,formatFilter:l,classFilter:r,textStyleTagFilter:a,attrFilter:h,styleFilter:c}=this.options.get("strictMode");let d="";if(t=this.compress(t),o&&(t=t.replace(this.__disallowedTagsRegExp,""),t=this._deleteDisallowedTags(t,this._elementWhitelistRegExp,this._elementBlacklistRegExp).replace(/<br\/?>$/i,"")),this._autoStyleify){const e=(new DOMParser).parseFromString(t,"text/html");xt.query.getListChildNodes(e.body,wt.spanToStyleNode.bind(null,this._autoStyleify),null),t=e.body.innerHTML}(h||c)&&(t=t.replace(/(<[a-zA-Z0-9-]+)[^>]*(?=>)/g,Ws.bind(this,h,c)));const u=this._d.createRange().createContextualFragment(t);if(o)try{this._consistencyCheckOfHTML(u,this._htmlCheckWhitelistRegExp,this._htmlCheckBlacklistRegExp,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=xt.utils.createElement("iframe"),i=JSON.parse(p[t].getAttribute("data-se-iframe-holder-attrs"));for(const[t,s]of Object.entries(i))e.setAttribute(t,s);p[t].replaceWith(e)}let g;if((g=this.options.get("__pluginRetainFilter"))&&this.editor._MELInfo.forEach(((t,e)=>{const i=u.querySelectorAll(e);for(let e=0,s=i.length;e<s;e++)!0!==g&&!1===g[t.key]||t.method(i[e])})),l){let t=u.childNodes;e||=this._isFormatData(t),e&&(t=this._editFormat(u).childNodes);for(let i,s=0,n=t.length;s<n;s++)i=t[s],this.__allowedTagNameRegExp.test(i.nodeName)?d+=i.outerHTML:d+=this._makeLine(i,e)}return d||=t,o&&(i&&(d=d.replace("string"==typeof i?wt.createElementWhitelist(i):i,"")),s&&(d=d.replace("string"==typeof s?wt.createElementBlacklist(s):s,""))),a&&(d=this._styleNodeConvertor(d)),d},insert(t,{selectInserted:e,skipCharCount:i,skipCleaning:s}={}){this.frameContext.get("wysiwyg").contains(this.selection.get().focusNode)||this.editor.focus(),this.remove(),this.editor.focus();let n=null;if("string"==typeof t){s||(t=this.clean(t,{forceFormat:!1,whitelist:null,blacklist:null}));try{if(xt.check.isListCell(this.format.getLine(this.selection.getNode(),null))){const e=this._d.createRange().createContextualFragment(t).childNodes;this._isFormatData(e)&&(t=this._convertListCell(e))}const s=this._d.createRange().createContextualFragment(t).childNodes;if(!i){const t="byte-html"===this.frameOptions.get("charCounter_type")?"outerHTML":"textContent";let e="";for(let i=0,n=s.length;i<n;i++)e+=s[i][t];if(!this.char.check(e))return}let o,l,r,a,h;for(;o=s[0];)3===a?.nodeType&&1===l?.nodeType&&xt.check.isBreak(o)?(a=o,xt.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.selection.setRange(h.container||h,h.startOffset||0,l,c):this.component.is(l)||this.selection.setRange(l,c,l,c)}catch(t){if(this.frameContext.get("isReadOnly")||this.frameContext.get("isDisabled"))return;throw Error(`[SUNEDITOR.html.insert.error] ${t.message}`)}}else if(this.component.is(t))this.component.insert(t,{skipCharCount:i,insertBehavior:"none"});else{let e=null;(this.format.isLine(t)||xt.check.isMedia(t))&&(e=this.format.getLine(this.selection.getNode(),null)),this.insertNode(t,{afterNode:e,skipCharCount:i})}if(this.editor.effectNode=null,n){const t=xt.query.getListChildNodes(n,null,null);if(t.length>0){n=t.at(-1);const e=3===n?.nodeType?n.textContent.length:1;this.selection.setRange(n,e,n,e)}else this.editor.focus()}else this.editor.focus();this.history.push(!1)},insertNode(t,{afterNode:e,skipCharCount:i}={}){let s=null;if(this.frameContext.get("isReadOnly")||!i&&!this.char.check(t))return s;let n=null,o=null;if(e){const t=this.format.isLine(e)||this.format.isBlock(e)||this.component.is(e)?this.format.addLine(e,null):e;o=this.selection.setRange(t,1,t,1)}else o=this.selection.getRange();let l,r,a,h=xt.check.isListCell(o.commonAncestorContainer)?o.commonAncestorContainer:this.format.getLine(this.selection.getNode(),null),c=xt.check.isListCell(h)&&(xt.check.isListCell(t)||xt.check.isList(t)),d=null;const u=this.format.isBrLine(h),p=this.format.isLine(t)||this.format.isBlock(t)||this.component.isBasic(t);if(c&&(a=e||xt.check.isList(t)?h.lastChild:h.nextElementSibling,d=xt.check.isList(t)?h:(a||h).parentNode),!e&&(p||this.component.isBasic(t)||xt.check.isMedia(t))){const t=xt.check.isEdgePoint(o.endContainer,o.endOffset,"end"),i=this.remove(),s=i.container,n=s===i.prevContainer&&o.collapsed?null:i.prevContainer;if(c&&n)if(d=3===n.nodeType?n.parentNode:n,d.contains(s)){let t=!0;for(a=s;a.parentNode&&a.parentNode!==d;)a=a.parentNode,t=!1;t&&s===n&&(a=a.nextSibling)}else a=null;else if(c&&xt.check.isListCell(s)&&!h.parentElement)h=xt.utils.createElement("LI"),d.appendChild(h),s.appendChild(d),a=null;else if(3===s.nodeType||xt.check.isBreak(s)||c){const n=xt.query.getParentElement(s,(t=>this.format.isBlock(t)||xt.check.isListCell(t)));if(e=this.nodeTransform.split(s,i.offset,n?xt.query.getNodeDepth(n)+1:0))if(c){if(h.contains(s)){const i=xt.check.isList(h.lastElementChild);let s=null;t||(s=h.cloneNode(!1),s.appendChild(e.textContent.trim()?e:xt.utils.createTextNode(Ct.zeroWidthSpace))),i&&(s||(s=h.cloneNode(!1),s.appendChild(xt.utils.createTextNode(Ct.zeroWidthSpace))),s.appendChild(h.lastElementChild)),s&&(h.parentNode.insertBefore(s,h.nextElementSibling),a=e=s)}}else e=e.previousSibling;else xt.check.isListCell(h)||(a=e=h)}}o=e||p?this.selection.getRange():this.selection.getRangeAndAddLine(this.selection.getRange(),null);const g=o.commonAncestorContainer,m=o.startOffset,f=o.endOffset,b=o.startContainer===g&&this.format.isLine(g),y=b&&(g.childNodes[m]||g.childNodes[0])||o.startContainer,v=b&&(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=y,3===y.nodeType&&(l=y.parentNode),o.collapsed)if(3===g.nodeType)e=g.textContent.length>f?g.splitText(f):g.nextSibling;else if(xt.check.isBreak(l))e=l,l=l.parentNode;else{const i=l.childNodes[m],s=3===i?.nodeType&&xt.check.isZeroWidth(i)&&xt.check.isBreak(i.nextSibling)?i.nextSibling:i;s?!s.nextSibling&&xt.check.isBreak(s)?(l.removeChild(s),e=null):e=xt.check.isBreak(s)&&!xt.check.isBreak(t)?s:s.nextSibling:e=null}else{if(y===v){e=xt.check.isEdgePoint(v,f)?v.nextSibling:v.splitText(f);let t=y;xt.check.isEdgePoint(y,m)||(t=y.splitText(m)),l.removeChild(t),0===l.childNodes.length&&p&&(l.innerHTML="<br>")}else{const i=this.remove(),s=i.container,n=i.prevContainer;if(0===s?.childNodes.length&&p&&(this.format.isLine(s)?s.innerHTML="<br>":this.format.isBlock(s)&&(s.innerHTML="<"+this.options.get("defaultLine")+"><br></"+this.options.get("defaultLine")+">")),xt.check.isListCell(s)&&3===t.nodeType)l=s,e=null;else if(!p&&n)if(l=3===n.nodeType?n.parentNode:n,l.contains(s)){let t=!0;for(e=s;e.parentNode&&e.parentNode!==l;)e=e.parentNode,t=!1;t&&s===n&&(e=e.nextSibling)}else e=null;else xt.check.isWysiwygFrame(s)&&!this.format.isLine(t)?(l=s.appendChild(xt.utils.createElement(this.options.get("defaultLine"))),e=null):l=(e=p?v:s===n?s.nextSibling:s)&&e.parentNode?e.parentNode:g;for(;e&&!this.format.isLine(e)&&e.parentNode!==g;)e=e.parentNode}}try{const i=this.frameContext.get("wysiwyg");if(!c){if((xt.check.isWysiwygFrame(e)||l===i.parentNode)&&(l=i,e=null),this.format.isLine(t)||this.format.isBlock(t)||!xt.check.isListCell(l)&&this.component.isBasic(t)){const t=l;if(xt.check.isListCell(e))l=e.previousElementSibling||e;else if(!r&&!e){const t=this.remove(),i=3===t.container.nodeType?xt.check.isListCell(this.format.getLine(t.container,null))?t.container:this.format.getLine(t.container,null)||t.container.parentNode:t.container,s=xt.check.isWysiwygFrame(i)||this.format.isBlock(i);l=s?i:i.parentNode,e=s?null:i.nextSibling}0===t.childNodes.length&&l!==t&&xt.utils.removeItem(t)}if(!p||u||this.format.isBlock(l)||xt.check.isListCell(l)||xt.check.isWysiwygFrame(l)||(e=l.nextElementSibling,l=l.parentNode),xt.check.isWysiwygFrame(l)&&(3===t.nodeType||xt.check.isBreak(t))){const e=xt.utils.createElement(this.options.get("defaultLine"),null,t);n=t,t=e}}if(c?d.parentNode?(l=d,e=a):(l=i,e=null):e=l===e?l.lastChild:e,xt.check.isListCell(t)&&!xt.check.isList(l)){if(xt.check.isListCell(l))e=l.nextElementSibling,l=l.parentNode;else{const t=xt.utils.createElement("ol");l.insertBefore(t,e),l=t,e=null}c=!0}if(this._checkDuplicateNode(t,l),l.insertBefore(t,e),c)if(xt.check.isZeroWidth(h.textContent.trim()))xt.utils.removeItem(h),t=t.lastChild;else{const e=xt.utils.arrayFind(h.children,xt.check.isList);e&&(t!==e?(t.appendChild(e),t=e.previousSibling):(l.appendChild(t),t=l),xt.check.isZeroWidth(h.textContent.trim())&&xt.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 i,s,n,o,l=0,r=e.length;l<r;l++){for(i=e[l],n=i.childNodes,o=i.parentNode;n[0];)s=n[0],o.insertBefore(s,i);i===t&&(t=s),xt.utils.removeItem(i)}if((this.format.isLine(t)||this.component.isBasic(t))&&y===v){const t=this.format.getLine(g,null);1===t?.nodeType&&xt.check.isEmptyLine(t)&&xt.utils.removeItem(t)}if(u&&!xt.check.isList(t)&&(this.format.isLine(t)||this.format.isBlock(t))&&(t=this._setIntoFreeFormat(t)),!this.component.isBasic(t)){let e=1;if(3===t.nodeType)e=t.textContent.length,this.selection.setRange(t,e,t,e);else if(!xt.check.isBreak(t)&&!xt.check.isListCell(t)&&this.format.isLine(l)){let i=null;t.previousSibling&&!xt.check.isBreak(t.previousSibling)||(i=xt.utils.createTextNode(Ct.zeroWidthSpace),t.parentNode.insertBefore(i,t)),t.nextSibling&&!xt.check.isBreak(t.nextSibling)||(i=xt.utils.createTextNode(Ct.zeroWidthSpace),t.parentNode.insertBefore(i,t.nextSibling)),this.inline._isIgnoreNodeChange(t)&&(t=t.nextSibling,e=0),this.selection.setRange(t,e,t,e)}}s=t}return s},remove(){this.selection._resetRangeToTextNode();const t=this.selection.getRange(),e=0===t.startOffset,i=xt.check.isEdgePoint(t.endContainer,t.endOffset,"end");let s=null,n=null,o=null;e&&(n=this.format.getLine(t.startContainer),s=n?n.previousElementSibling:null,n=n?s:n),i&&(o=this.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(xt.check.isWysiwygFrame(a)&&xt.check.isWysiwygFrame(h)){this.set("");return{container:this.selection.getNode(),offset:0,commonCon:u}}if(u===a&&u===h){if(this.component.isBasic(u)){const t=this.component.get(u).container,e=t.parentElement,i=t.nextSibling||t.previousSibling,s=i===t.previousSibling?i?.textContent?.length||1:0,n=e.nextElementSibling||e.previousElementSibling,o=n===e.previousElementSibling?n?.textContent?.length||1:0;return xt.utils.removeItem(t),this.format.isLine(e)?0===e.childNodes.length?(xt.utils.removeItem(e),{container:n,offset:o,commonCon:u}):{container:i,offset:s,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=xt.query.getNextDeepestNode(u,this.frameContext.get("wysiwyg")),e=xt.query.getPreviousDeepestNode(u,this.frameContext.get("wysiwyg")),i=this.format.getLine(u);xt.utils.removeItem(u);let s=t||e,n=t?0:3===s?.nodeType?s.textContent.length:1;const o=this.format.getLine(s)||this.component.get(s);return i!==o&&(s=o,n=0===n?0:1),xt.check.isZeroWidth(i)&&!i.contains(s)&&xt.utils.removeItem(i),{container:s,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&&xt.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=xt.query.getListChildNodes(u,null,null);let f=xt.utils.getArrayIndex(m,a),b=xt.utils.getArrayIndex(m,h);if(m.length>0&&f>-1&&b>-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=b-1,e=h;t>f;t--)m[t]===e.parentNode&&1===m[t].nodeType&&(m.splice(t,1),e=e.parentNode,--b)}else{if(0===m.length){if(this.format.isLine(u)||this.format.isBlock(u)||xt.check.isWysiwygFrame(u)||xt.check.isBreak(u)||xt.check.isMedia(u))return{container:u,offset:0,commonCon:u};if(xt.check.isText(u))return{container:u,offset:d,commonCon:u};m.push(u),a=h=u}else if(a=h=m[0],xt.check.isBreak(a)||xt.check.isZeroWidth(a))return{container:xt.check.isMedia(u)?u:a,offset:0,commonCon:u};f=b=0}const y=xt.check.isText,v=xt.check.isElement,_=f===b;let C=null;for(let t=f;t<=b;t++){const e=m[t];if(!y(e)||void 0!==e.data&&0!==e.length)if(e!==a)if(e!==h)C=this._nodeRemoveListItem(e,_);else{if(y(h))g=xt.utils.createTextNode(h.substringData(d,h.length-d));else{if(this.component.is(h))continue;g=xt.utils.createTextNode(h.textContent)}g.length>0?h.data=g.data:C=this._nodeRemoveListItem(h,_)}else{if(v(a)){if(this.component.is(a))continue;p=xt.utils.createTextNode(a.textContent)}else{const t=a,i=h;e===h?(p=xt.utils.createTextNode(t.substringData(0,c)+i.substringData(d,i.length-d)),r=c):p=xt.utils.createTextNode(t.substringData(0,c))}if(p.length>0?a.data=p.data:C=this._nodeRemoveListItem(a,_),e===h)break}else C=this._nodeRemoveListItem(e,_)}const w=xt.query.getParentElement(h,"ul"),x=xt.query.getParentElement(a,"li");if(w&&x&&x.contains(w)?(l=w.previousSibling,r=l.textContent.length):(l=h&&h.parentNode?h:a&&a.parentNode?a:t.endContainer||t.startContainer,(e||i)&&(i?1===l.nodeType&&0===l.childNodes.length?(l.appendChild(xt.utils.createElement("BR")),r=1):r=l.textContent.length:r=0)),this.format.getLine(l)||a&&a.parentNode||(o?(l=o,r=0):n&&(l=n,r=1)),!xt.check.isWysiwygFrame(l)&&0===l.childNodes.length){const t=this.nodeTransform.removeAllParents(l,null,null);t&&(l=t.sc||t.ec||this.frameContext.get("wysiwyg"))}return l&&(1!==l.nodeType||this.format.isLine(l)||xt.check.isBreak(l))||(l=C?.sc||C?.ec,r=3===l?.nodeType?l.textContent.length:1),this.selection.setRange(l,r,l,r),{container:l,offset:r,prevContainer:s,commonCon:u?.parentElement?u:null}},get({withFrame:t,includeFullPage:e,rootKey:i}={}){i?Array.isArray(i)||(i=[i]):i=[this.status.rootKey];const s=this.status.rootKey,n={};for(let s,o=0,l=i.length;o<l;o++){this.editor.changeFrameContext(i[o]);const l=this.frameContext,r=xt.utils.createElement("DIV",null,this._convertToCode(l.get("wysiwyg"),!0)),a=xt.check.isTableCell,h=xt.check.isEmptyLine,c=[],d=[];xt.query.getListChildren(r,(t=>{t.hasAttribute("contenteditable")&&c.push(t);const e=t.parentElement;return a(e)&&e.children.length<=1&&h(t)&&d.push(e),!1}),null);for(let t=0,e=c.length;t<e;t++)c[t].removeAttribute("contenteditable");for(let t=0,e=d.length;t<e;t++)d[t].innerHTML="<br>";const u=r.innerHTML;if(this.frameOptions.get("iframe_fullPage"))if(e){const t=xt.utils.getAttributesToString(l.get("_wd").body,["contenteditable"]);s=`<!DOCTYPE html><html>${l.get("_wd").head.outerHTML}<body ${t}>${u}</body></html>`}else s=u;else s=t?`<div class="${this.options.get("_editableClass")+""+(this.options.get("_rtl")?" se-rtl":"")}">${u}</div>`:r.innerHTML;n[i[o]]=s}return this.editor.changeFrameContext(s),i.length>1?n:n[i[0]]},set(t,{rootKey:e}={}){this.ui._offCurrentController(),this.selection.removeRange();const i=null==t?"":this.clean(t,{forceFormat:!0,whitelist:null,blacklist:null});e?Array.isArray(e)||(e=[e]):e=[this.status.rootKey];for(let t=0;t<e.length;t++)if(this.editor.changeFrameContext(e[t]),this.frameContext.get("isCodeView")){const t=this._convertToCode(i,!1);this.viewer._setCodeView(t)}else this.frameContext.get("wysiwyg").innerHTML=i,this.editor._resetComponents(),this.history.push(!1,e[t])},add(t,{rootKey:e}={}){this.ui._offCurrentController(),e?Array.isArray(e)||(e=[e]):e=[this.status.rootKey];for(let i=0;i<e.length;i++){this.editor.changeFrameContext(e[i]);const s=this.clean(t,{forceFormat:!0,whitelist:null,blacklist:null});if(this.frameContext.get("isCodeView"))this.viewer._setCodeView(this.viewer._getCodeView()+"\n"+this._convertToCode(s,!1));else{const t=xt.utils.createElement("DIV",null,s).children,n=t.length;for(let e=0;e<n;e++)t[e]&&this.frameContext.get("wysiwyg").appendChild(t[e]);this.history.push(!1,e[i]),this.selection.scrollTo(t[n-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&&!xt.check.isElement(t)&&!xt.check.isText(t))&&(!1===await St.write(t)?(this.ui.showToast(this.lang.message_copy_fail,this.options.get("toastMessageTime").copy,"error"),!1):(this.ui.showToast(this.lang.message_copy_success,this.options.get("toastMessageTime").copy),!0))}catch(t){return console.error("[SUNEDITOR.html.copy.fail] :",t),this.ui.showToast(this.lang.message_copy_fail,this.options.get("toastMessageTime").copy,"error"),!1}},setFullPage(t,{rootKey:e}={}){if(!this.frameOptions.get("iframe"))return!1;e?Array.isArray(e)||(e=[e]):e=[this.status.rootKey];for(let i=0;i<e.length;i++)this.editor.changeFrameContext(e[i]),t.head&&(this.frameContext.get("_wd").head.innerHTML=t.head.replace(this.__disallowedTagsRegExp,"")),t.body&&(this.frameContext.get("_wd").body.innerHTML=this.clean(t.body,{forceFormat:!0,whitelist:null,blacklist:null})),this.editor._resetComponents()},compress:t=>t.replace(/>\s+</g,"> <").replace(/\n/g,"").trim(),_convertToCode(t,e){let i="";const s=RegExp,n=new s("^(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?this._d.createRange().createContextualFragment(t):t,l=t=>this.format.isLine(t)||this.component.is(t),r=e?"":"\n",a=e?0:1*this.status.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,b,y=0,v=a.length;y<v;y++)u=a[y],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(),b=d||m?o:"",i+=(g||(c?"":p))+b+u.outerHTML.match(s("<"+f+"[^>]*>","i"))[0]+p,t(u,o+h+""),i+=(/\n$/.test(i)?b:"")+"</"+f+">"+(g||p||c||/^(TH|TD)$/i.test(u.nodeName)?r:"")):i+=(new XMLSerializer).serializeToString(u):i+=(/^HR$/i.test(u.nodeName)?r:"")+(/^PRE$/i.test(u.parentElement.nodeName)&&/^BR$/i.test(u.nodeName)?"":d)+u.outerHTML+p:xt.check.isList(u.parentElement)||(i+=wt.htmlToEntity(/^\n+$/.test(u.data)?"":u.data)):i+="\n\x3c!-- "+u.textContent.trim()+" --\x3e"+p}(o,""),i.trim()+r},_nodeRemoveListItem(t,e){const i=this.format.getLine(t,null);if(xt.utils.removeItem(t),!xt.check.isListCell(i)||e)return;const s=this.nodeTransform.removeAllParents(i,null,null);return xt.check.isList(i?.firstChild)&&i.insertBefore(xt.utils.createTextNode(Ct.zeroWidthSpace),i.firstChild),s?{sc:s.sc,ec:s.ec}:null},_setIntoFreeFormat(t){const e=t.parentNode;let i,s;for(;this.format.isLine(t)||this.format.isBlock(t);){for(i=t.childNodes,s=null;i[0];)if(s=i[0],this.format.isLine(s)||this.format.isBlock(s)){if(this._setIntoFreeFormat(s),!t.parentNode)break;i=t.childNodes}else e.insertBefore(s,t);0===t.childNodes.length&&xt.utils.removeItem(t),t=xt.utils.createElement("BR"),e.insertBefore(t,s.nextSibling)}return t},_makeLine(t,e){const i=this.options.get("defaultLine");if(1===t.nodeType){if(this.__disallowedTagNameRegExp.test(t.nodeName))return"";if(xt.check.isExcludeFormat(t))return t.outerHTML;const s=xt.query.getListChildNodes(t,(t=>xt.check.isSpanWithoutAttr(t)&&!xt.query.getParentElement(t,xt.check.isExcludeFormat)),null)||[];for(let t,e=s.length-1;e>=0;e--)t=s[e],t.outerHTML=t.innerHTML;if(!e||this.format.isLine(t)||this.format.isBlock(t)||this.component.is(t)||xt.check.isMedia(t)||xt.check.isFigure(t)||xt.check.isAnchor(t)&&xt.check.isMedia(t.firstElementChild)){const e=t;return xt.check.isSpanWithoutAttr(t)?e.innerHTML:e.outerHTML}{const e=t;return"<"+i+">"+(xt.check.isSpanWithoutAttr(t)?e.innerHTML:e.outerHTML)+"</"+i+">"}}if(3===t.nodeType){if(!e)return wt.htmlToEntity(t.textContent);const s=t.textContent.split(/\n/g);let n="";for(let t,e=0,o=s.length;e<o;e++)t=s[e].trim(),t.length>0&&(n+="<"+i+">"+wt.htmlToEntity(t)+"</"+i+">");return n}return 8===t.nodeType&&this._allowHTMLComment?"\x3c!--"+t.textContent.trim()+"--\x3e":""},_consistencyCheckOfHTML(t,e,i,s,n,o,l){const r=[],a=[],h=[],c=[],d=xt.query.getListChildNodes(t,(d=>{if(1!==d.nodeType)return n&&xt.check.isList(d.parentElement)&&r.push(d),3!==d.nodeType||d.textContent.trim()||r.push(d),!1;if(s&&(i.test(d.nodeName)||!e.test(d.nodeName)&&0===d.childNodes.length&&xt.check.isExcludeFormat(d)))return r.push(d),!1;const u=!xt.query.getParentElement(d,xt.check.isExcludeFormat);if(n){if(!xt.check.isTableElements(d)&&!xt.check.isListCell(d)&&!xt.check.isAnchor(d)&&(this.format.isLine(d)||this.format.isBlock(d)||this.format.isTextStyleNode(d))&&0===d.childNodes.length&&u)return a.push(d),!1;if(xt.check.isList(d.parentNode)&&!xt.check.isList(d)&&!xt.check.isListCell(d))return h.push(d),!1;if(xt.check.isTableCell(d)){const t=d.firstElementChild;if(!this.format.isLine(t)&&!this.format.isBlock(t)&&!this.component.is(t))return c.push(d),!1}}if(o&&u&&d.className){const t=new Array(d.classList).map(this._isAllowedClassName).join(" ").trim();t?d.className=t:d.removeAttribute("class")}if(!n)return!1;return!l&&d.parentNode!==t&&u&&(xt.check.isListCell(d)&&!xt.check.isList(d.parentNode)||(this.format.isLine(d)||this.component.is(d))&&!this.format.isBlock(d.parentNode)&&!xt.query.getParentElement(d,this.component.is.bind(this.component)))}),null);for(let t=0,e=r.length;t<e;t++)xt.utils.removeItem(r[t]);const u=[];for(let t,e,i=0,s=d.length;i<s;i++)if(t=d[i],e=t.parentNode,e&&e.parentNode)if(xt.query.getParentElement(t,xt.check.isListCell)){const i=t.childNodes;for(let n=i.length-1;s>=0;n--)e.insertBefore(t,i[n]);u.push(t)}else e.parentNode.insertBefore(t,e),u.push(e);for(let t,e=0,i=u.length;e<i;e++)t=u[e],xt.check.isZeroWidth(t.textContent.trim())&&xt.utils.removeItem(t);for(let t=0,e=a.length;t<e;t++)xt.utils.removeItem(a[t]);for(let t,e,i,s,n=0,o=h.length;n<o;n++)if(t=h[n],s=t.parentNode,s)if(e=xt.utils.createElement("LI"),this.format.isLine(t)){for(i=t.childNodes;i[0];)e.appendChild(i[0]);s.insertBefore(e,t),xt.utils.removeItem(t)}else t=t.nextSibling,e.appendChild(h[n]),s.insertBefore(e,t);for(let t,e,i=0,s=c.length;i<s;i++)t=c[i],e=xt.utils.createElement("DIV"),e.innerHTML=0===t.textContent.trim().length&&0===t.children.length?"<br>":t.innerHTML,t.innerHTML=e.outerHTML},_styleNodeConvertor(t){if(!this._disallowedStyleNodesRegExp)return t;const e=this.options.get("_defaultStyleTagMap");return t.replace(this._disallowedStyleNodesRegExp,((t,i,s,n)=>i+("string"==typeof e[s]?e[s]:s)+(n?" "+n:"")))},_editFormat(t){let e,i="";const s=t.childNodes;for(let t,n=0,o=s.length;n<o;n++)t=s[n],this.__allowedTagNameRegExp.test(t.nodeName)?i+=t.outerHTML:8===t.nodeType?i+="\x3c!-- "+t.textContent+" --\x3e":/meta/i.test(t.nodeName)||this.format.isLine(t)||this.format.isBlock(t)||this.component.is(t)||xt.check.isExcludeFormat(t)?(e&&(i+=e.outerHTML,e=null),i+=t.outerHTML):(e||=xt.utils.createElement(this.options.get("defaultLine")),this.format.isTextStyleNode(t)&&t.removeAttribute("style"),e.appendChild(t),n--,o--);return e&&(i+=e.outerHTML),this._d.createRange().createContextualFragment(i)},_convertListCell(t){let e="";for(let i,s=0,n=t.length;s<n;s++)i=t[s],1===i.nodeType?xt.check.isList(i)?e+=i.innerHTML:xt.check.isListCell(i)?e+=i.outerHTML:this.format.isLine(i)?e+="<li>"+(i.innerHTML.trim()||"<br>")+"</li>":this.format.isBlock(i)&&!xt.check.isTableElements(i)?e+=this._convertListCell(i.children):e+="<li>"+i.outerHTML+"</li>":e+="<li>"+(i.textContent||"<br>")+"</li>";return e},_isFormatData(t){let e=!1;for(let i,s=0,n=t.length;s<n;s++)if(i=t[s],1===i.nodeType&&!this.format.isTextStyleNode(i)&&!xt.check.isBreak(i)&&!this.__disallowedTagNameRegExp.test(i.nodeName)){e=!0;break}return e},_cleanStyle(t,e,i){let s=(t.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/)||[])[0];if(this._textStyleTags.includes(i)&&!s&&(t.match(/<[^\s]+\s(.+)/)||[])[1]){const e=(t.match(/\ssize="([^"]+)"/i)||[])[1],i=(t.match(/\sface="([^"]+)"/i)||[])[1],n=(t.match(/\scolor="([^"]+)"/i)||[])[1];(e||i||n)&&(s='style="'+(e?"font-size:"+kt.get(Number(e)/3.333,1)+"rem;":"")+(i?"font-family:"+i+";":"")+(n?"color:"+n+";":"")+'"')}if(s){let t;e||=[];for(const[e,s]of this._cleanStyleRegExpMap)if(e.test(i)){t=s;break}if(!t)return e;const n=s.replace(/"/g,"").match(t);if(!n)return e;const o=[];for(let t,e=0,i=n.length;e<i;e++)if(t=n[e].match(/([a-zA-Z0-9-]+)(:)([^"']+)/),t&&!/inherit|initial|revert|unset/i.test(t[3])){const e=wt.kebabToCamelCase(t[1].trim()),i=this.frameContext.get("wwComputedStyle")[e]?.replace(/"/g,""),s=t[3].trim();switch(e){case"fontFamily":if(!this.plugins.font||!this.plugins.font.fontArray.includes(s))continue;break;case"fontSize":if(!this.plugins.fontSize)continue;this.fontSizeUnitRegExp.test(t[0])||(t[0]=t[0].replace((t[0].match(/:\s*([^;]+)/)||[])[1],wt.toFontUnit.bind(null,this.options.get("fontSizeUnits")[0])));break;case"color":if(!this.plugins.fontColor||/rgba\(([0-9]+\s*,\s*){3}0\)|windowtext/i.test(s))continue;break;case"backgroundColor":if(!this.plugins.backgroundColor||/rgba\(([0-9]+\s*,\s*){3}0\)|windowtext/i.test(s))continue}i!==s&&o.push(t[0])}o.length>0&&e.push('style="'+o.join(";")+'"')}return e},_deleteDisallowedTags:(t,e,i)=>(e.test("<font>")&&(t=t.replace(/(<\/?)font(\s?)/gi,"$1span$2")),t.replace(e,"").replace(i,"")),_checkDuplicateNode(t,e){const i=this;!function t(s){i._dupleCheck(s,e);const n=s.childNodes;for(let e=0,i=n.length;e<i;e++)t(n[e])}(t)},_dupleCheck(t,e){if(!this.format.isTextStyleNode(t))return;const i=(t.style.cssText.match(/[^;]+;/g)||[]).map((function(t){return t.trim()})),s=t.nodeName;if(/^span$/i.test(s)&&0===i.length)return t;const n=this.format;let o=!1;return function e(l){if(!xt.check.isWysiwygFrame(l)&&n.isTextStyleNode(l)){if(l.nodeName===s){o=!0;const e=l.style.cssText.match(/[^;]+;/g)||[];for(let t,s=0,n=e.length;s<n;s++)(t=i.indexOf(e[s].trim()))>-1&&i.splice(t,1);for(let e=0,i=l.classList.length;e<i;e++)t.classList.remove(l.classList[e])}e(l.parentElement)}}(e),o&&((t.style.cssText=i.join(" "))||(t.setAttribute("style",""),t.removeAttribute("style")),0===t.attributes.length&&t.setAttribute("data-duple","true")),t},__resetAutoStyleify(t){if(t.length>0){const e=this.options.get("convertTextTags"),i={};t.forEach((t=>{switch(t){case"bold":i.bold={regex:/font-weight\s*:\s*bold/i,tag:e.bold};break;case"italic":i.italic={regex:/font-style\s*:\s*italic/i,tag:e.italic};break;case"underline":i.underline={regex:/text-decoration\s*:\s*underline/i,tag:e.underline};break;case"strike":i.strike={regex:/text-decoration\s*:\s*line-through/i,tag:e.strike}}})),this._autoStyleify=i}else this._autoStyleify=null},constructor:qs};const Zs=qs;function Gs(t){re.call(this,t),this._listCamel=this.options.get("__listCommonStyle"),this._listKebab=wt.camelToKebabCase(this.options.get("__listCommonStyle"))}function Ys(t){const e=t.parentNode;if(!t||3===t.nodeType||!e)return;const i=t.childNodes;for(;i[0];)e.insertBefore(i[0],t);e.removeChild(t)}Gs.prototype={apply(t,{stylesToModify:e,nodesToRemove:i,strictRemove:s}={}){if(xt.query.getParentElement(this.selection.getNode(),xt.check.isNonEditable))return;this.selection._resetRangeToTextNode();let n=this.selection.getRangeAndAddLine(this.selection.getRange(),null);e=e?.length>0?e:null,i=i?.length>0?i:null;const o=!t,l=o&&!i&&!e;let r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset;if(l&&n.collapsed&&this.format.isLine(r.parentNode)&&this.format.isLine(h.parentNode)||r===h&&1===r.nodeType&&xt.check.isNonEditable(r)){const t=r.parentNode;if(!xt.check.isListCell(t)||!wt.getValues(t.style).some((t=>this._listKebab.includes(t))))return}if(n.collapsed&&!l&&1===r.nodeType&&!xt.check.isBreak(r)&&!this.component.is(r)){let t=null;const e=r.childNodes[a];e&&(t=e.nextSibling?xt.check.isBreak(e)?e:e.nextSibling:null);const i=xt.utils.createTextNode(Ct.zeroWidthSpace);r.insertBefore(i,t),this.selection.setRange(i,1,i,1),n=this.selection.getRange(),r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset}this.format.isLine(r)&&(r=r.childNodes[a]||r.firstChild,a=0),this.format.isLine(h)&&(h=h.childNodes[c]||h.lastChild,c=h.textContent.length),o&&(t=xt.utils.createElement("DIV"));const d=RegExp,u=t.nodeName;if(!l&&r===h&&!i&&t){let e=r,i=0;const s=[],n=t.style;for(let t=0,e=n.length;t<e;t++)s.push(n[t]);const l=t.className,a=t.classList;for(let t=0,e=a.length;t<e;t++)s.push("."+a[t]);if(s.length>0){for(;!this.format.isLine(e)&&!xt.check.isWysiwygFrame(e);){for(let t=0;t<s.length;t++)if(1===e.nodeType){const r=s[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)&&i++}e=e.parentNode}if(i>=s.length)return}}let p,g,m={},f={},b="",y="";if(e){for(let t,i=0,s=e.length;i<s;i++)t=e[i],/^\./.test(t)?y+=(y?"|":"\\s*(?:")+t.replace(/^\./,""):b+=(b?"|":"(?:;|^|\\s)(?:")+t;b&&(b+=")\\s*:[^;]*\\s*(?:;|$)",b=new d(b,"ig")),y&&(y+=")(?=\\s+|$)",y=new d(y,"ig"))}if(i){g="^(?:"+i[0];for(let t=1;t<i.length;t++)g+="|"+i[t];g+=")$",g=new d(g,"i")}const v={v:!1},_=function(t){const e=t.cloneNode(!1);if(3===e.nodeType||xt.check.isBreak(e))return e;if(l)return null;const i=!g&&o||g?.test(e.nodeName);if(i&&!s)return v.v=!0,null;const n=e.style.cssText;let r="";b&&n.length>0&&(r=n.replace(b,"").trim(),r!==n&&(v.v=!0));const a=e.className;let h="";return y&&a.length>0&&(h=a.replace(y,"").trim(),h!==a&&(v.v=!0)),(!o||!y&&a||!b&&n||r||h||!i)&&(r||h||e.nodeName!==u||Boolean(b)!==Boolean(n)||Boolean(y)!==Boolean(a))?(b&&n.length>0&&(e.style.cssText=r),e.style.cssText||e.removeAttribute("style"),y&&a.length>0&&(e.className=h.trim()),e.className.trim()||e.removeAttribute("class"),e.style.cssText||e.className||e.nodeName!==u&&!i?e:(v.v=!0,null)):(v.v=!0,null)},C=this.format.getLines(null);if(0===C.length)return void console.warn("[SUNEDITOR.inline.apply.warn] There is no line to apply.");n=this.selection.getRange(),r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset,this.format.getLine(r,null)||(r=xt.query.getEdgeChild(C[0],(function(t){return 3===t.nodeType}),!1),a=0),this.format.getLine(h,null)||(h=xt.query.getEdgeChild(C.at(-1),(function(t){return 3===t.nodeType}),!1),c=h.textContent.length);const w=this.format.getLine(r,null)===this.format.getLine(h,null),x=C.length-(w?0:1);p=t.cloneNode(!1);const k=l||o&&function(t,e){for(let i=0,s=e.length;i<s;i++)if(t._isNonSplitNode(e[i]))return!0;return!1}(this,i),E=o||this._sn_isSizeNode(p),S=this._sn_getMaintainedNode.bind(this,k,E),T=this._sn_isMaintainedNode.bind(this,k,E);if(w){this._sn_resetCommonListCell(C[0],e)&&(n=this.selection.setRange(r,a,h,c));const t=this._setNode_oneLine(C[0],p,_,r,a,h,c,l,o,n.collapsed,v,S,T);m.container=t.startContainer,m.offset=t.startOffset,f.container=t.endContainer,f.offset=t.endOffset,m.container===f.container&&xt.check.isZeroWidth(m.container)&&(m.offset=f.offset=1),this._sn_setCommonListStyle(t.ancestor,null)}else{let i=!1;x>0&&this._sn_resetCommonListCell(C[x],e)&&(i=!0),this._sn_resetCommonListCell(C[0],e)&&(i=!0),i&&this.selection.setRange(r,a,h,c),x>0&&(p=t.cloneNode(!1),f=this._setNode_endLine(C[x],p,_,h,c,l,o,v,S,T));for(let i,s=x-1;s>0;s--)this._sn_resetCommonListCell(C[s],e),p=t.cloneNode(!1),i=this._setNode_middleLine(C[s],p,_,l,o,v,f.container),i.endContainer&&i.ancestor.contains(i.endContainer)&&(f.ancestor=null,f.container=i.endContainer),this._sn_setCommonListStyle(i.ancestor,null);p=t.cloneNode(!1),m=this._setNode_startLine(C[0],p,_,r,a,l,o,v,S,T,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._sn_setCommonListStyle(m.ancestor,null),this._sn_setCommonListStyle(f.ancestor||this.format.getLine(f.container),null)}return this.ui._offCurrentController(),this.selection.setRange(m.container,m.offset,f.container,f.offset),this.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&&(xt.check.isNonEditable(t)||!this.format.isTextStyleNode(t)||this.component.is(t))},_setNode_oneLine(t,e,i,s,n,o,l,r,a,h,c,d,u){let p=s.parentNode;for(;!(p.nextSibling||p.previousSibling||this.format.isLine(p.parentNode)||xt.check.isWysiwygFrame(p.parentNode))&&p.nodeName!==e.nodeName;)p=p.parentNode;if(!a&&p===o.parentNode&&p.nodeName===e.nodeName&&xt.check.isZeroWidth(s.textContent.slice(0,n))&&xt.check.isZeroWidth(o.textContent.slice(l))){const i=p.childNodes;let r=!1;for(let t,e,n,l,a=0,h=i.length;a<h;a++)if(t=i[a],l=!xt.check.isZeroWidth(t),t!==s)if(t!==o){if(!e&&l||e&&n&&l){r=!1;break}}else n=!0;else e=!0;if(r)return xt.utils.copyTagAttributes(p,e),{ancestor:t,startContainer:s,startOffset:n,endContainer:o,endOffset:l}}c.v=!1;const g=this,m=t,f=[e],b=t.cloneNode(!1),y=s===o;let v,_,C,w,x,k=s,E=n,S=o,T=l,H=!1,L=!1;const M=RegExp;function N(t){const e=new M("(?:;|^|\\s)(?:"+w+"null)\\s*:[^;]*\\s*(?:;|$)","ig");let i=!1;return e&&t.style.cssText.length>0&&(i=e.test(t.style.cssText)),!i}if(function t(s,n){const o=s.childNodes;for(let s,l=0,a=o.length;l<a;l++){const a=o[l];if(!a)continue;let c,p=n;if(!H&&a===k){let t=b;x=d(a);let o="",l="";if(3===k.nodeType){const t=k;o=t.substringData(0,E),l=t.substringData(E,y&&T>=E?T-E:t.data.length-E)}const r=xt.utils.createTextNode(o),h=xt.utils.createTextNode(l);if(x){const e=d(n);if(e.parentNode!==t){let i=e,s=null;for(;i.parentNode!==t;){for(n=s=i.parentNode.cloneNode(!1);i.childNodes[0];)s.appendChild(i.childNodes[0]);i.appendChild(s),i=i.parentNode}i.parentNode.appendChild(e)}x=x.cloneNode(!1)}xt.check.isZeroWidth(r)||n.appendChild(r);const c=d(n);for(c&&(x=c),x&&(t=x),_=a,v=[],w="";_!==t&&_!==m&&null!==_;)s=u(_)?null:i(_),s&&1===_.nodeType&&N(_)&&(v.push(s),w+=_.style.cssText.substring(0,_.style.cssText.indexOf(":"))+"|"),_=_.parentElement;const p=v.pop()||h;for(C=_=p;v.length>0;)_=v.pop(),C.appendChild(_),C=_;if(e.appendChild(p),t.appendChild(e),x&&!d(S)&&(e=e.cloneNode(!1),b.appendChild(e),f.push(e)),k=h,E=0,H=!0,_!==h&&_.appendChild(k),!y)continue}if(L||a!==S){if(H){if(1===a.nodeType&&!xt.check.isBreak(a)){g._isIgnoreNodeChange(a)?(b.appendChild(a.cloneNode(!0)),h||(e=e.cloneNode(!1),b.appendChild(e),f.push(e))):t(a,a);continue}_=a,v=[],w="";const o=[];for(;null!==_.parentNode&&_!==m&&_!==e;)s=L?_.cloneNode(!1):i(_),1===_.nodeType&&!xt.check.isBreak(a)&&s&&N(_)&&(u(_)?x||o.push(s):v.push(s),w+=_.style.cssText.substring(0,_.style.cssText.indexOf(":"))+"|"),_=_.parentElement;v=v.concat(o);const l=v.pop()||a;for(C=_=l;v.length>0;)_=v.pop(),C.appendChild(_),C=_;if(!u(e.parentNode)||u(l)||xt.check.isZeroWidth(e)||(e=e.cloneNode(!1),b.appendChild(e),f.push(e)),L||x||!u(l))l===a?n=L?b:e:L?(b.appendChild(l),n=_):(e.appendChild(l),n=_);else{e=e.cloneNode(!1);const t=l.childNodes;for(let i=0,s=t.length;i<s;i++)e.appendChild(t[i]);l.appendChild(e),b.appendChild(l),f.push(e),n=e.children.length>0?_:e}if(x&&3===a.nodeType)if(d(a)){const t=xt.query.getParentElement(n,(t=>g._isNonSplitNode(t.parentNode)||t.parentNode===b));x.appendChild(t),e=t.cloneNode(!1),f.push(e),b.appendChild(e)}else x=null}c=a.cloneNode(!1),n.appendChild(c),1!==a.nodeType||xt.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(T,e.length-T),n=y?"":e.substringData(0,T)}const o=xt.utils.createTextNode(t),l=xt.utils.createTextNode(n);if(x?x=x.cloneNode(!1):u(e.parentNode)&&!x&&(e=e.cloneNode(!1),b.appendChild(e),f.push(e)),!xt.check.isZeroWidth(o)){_=a,w="",v=[];const t=[];for(;_!==b&&_!==m&&null!==_;)1===_.nodeType&&N(_)&&(u(_)?t.push(_.cloneNode(!1)):v.push(_.cloneNode(!1)),w+=_.style.cssText.substring(0,_.style.cssText.indexOf(":"))+"|"),_=_.parentElement;for(v=v.concat(t),c=C=_=v.pop()||o;v.length>0;)_=v.pop(),C.appendChild(_),C=_;b.appendChild(c),_.textContent=o.data}if(x&&c){const t=d(c);t&&(x=t)}for(_=a,v=[],w="";_!==b&&_!==m&&null!==_;)s=u(_)?null:i(_),s&&1===_.nodeType&&N(_)&&(v.push(s),w+=_.style.cssText.substring(0,_.style.cssText.indexOf(":"))+"|"),_=_.parentElement;const p=v.pop()||l;for(C=_=p;v.length>0;)_=v.pop(),C.appendChild(_),C=_;x?((e=e.cloneNode(!1)).appendChild(p),x.insertBefore(e,x.firstChild),b.appendChild(x),f.push(e),x=null):e.appendChild(p),S=l,T=l.data.length,L=!0,!r&&h&&(e=l,l.textContent=Ct.zeroWidthSpace),_!==l&&_.appendChild(S)}}}(t,b),a&&!r&&!c.v)return{ancestor:t,startContainer:s,startOffset:n,endContainer:o,endOffset:l};if(r&&=a,r)for(let t=0;t<f.length;t++){const e=f[t];let i,s,n;if(h)i=xt.utils.createTextNode(Ct.zeroWidthSpace),b.replaceChild(i,e);else{const t=e.childNodes;for(s=t[0];t[0];)n=t[0],b.insertBefore(n,e);xt.utils.removeItem(e)}0===t&&(h?k=S=i:(k=s,S=n))}else{if(a)for(let t=0;t<f.length;t++)Ys(f[t]);h&&(k=S=e)}this.nodeTransform.removeEmptyNode(b,e,!1),h&&(E=k.textContent.length,T=S.textContent.length);const A=r||0===S.textContent.length;xt.check.isBreak(S)||0!==S.textContent.length||(xt.utils.removeItem(S),S=k),T=A?S.textContent.length:T;const B={s:0,e:0},V=xt.query.getNodePath(k,b,B),I=!S.parentNode;I&&(S=k);const O={s:0,e:0},R=xt.query.getNodePath(S,b,I||A?null:O);E+=B.s,T=h?E:I?k.textContent.length:A?T+B.s:T+O.s;const F=this.nodeTransform.mergeSameTags(b,[V,R],!0);return t.parentNode.replaceChild(b,t),k=xt.query.getNodeFromPath(V,b),S=xt.query.getNodeFromPath(R,b),{ancestor:b,startContainer:k,startOffset:E+F[0],endContainer:S,endOffset:T+F[1]}},_setNode_startLine(t,e,i,s,n,o,l,r,a,h,c){let d=s.parentNode;for(;!(d.nextSibling||d.previousSibling||this.format.isLine(d.parentNode)||xt.check.isWysiwygFrame(d.parentNode))&&d.nodeName!==e.nodeName;)d=d.parentNode;if(!l&&d.nodeName===e.nodeName&&!this.format.isLine(d)&&!d.nextSibling&&xt.check.isZeroWidth(s.textContent.slice(0,n))){let i=!1,o=s.previousSibling;for(;o;){if(!xt.check.isZeroWidth(o)){i=!1;break}o=o.previousSibling}if(i)return xt.utils.copyTagAttributes(d,e),{ancestor:t,container:s,offset:n}}r.v=!1;const u=this,p=t,g=[e],m=t.cloneNode(!1);let f,b,y,v,_=s,C=n,w=!1;if(function t(s,n){const o=s.childNodes;for(let s,l,r=0,d=o.length;r<d;r++){const d=o[r];if(!d)continue;let x=n;if(w&&!xt.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=xt.query.getNodePath(c,d);c=xt.query.getNodeFromPath(t,l)}}else t(d,d);continue}b=d,f=[];const o=[];for(;null!==b.parentNode&&b!==p&&b!==e;)s=i(b),1===b.nodeType&&s&&(h(b)?v||o.push(s):f.push(s)),b=b.parentNode;f=f.concat(o);const r=f.length>0,_=f.pop()||d;for(y=b=_;f.length>0;)b=f.pop(),y.appendChild(b),y=b;if(h(e.parentNode)&&!h(_)&&(e=e.cloneNode(!1),m.appendChild(e),g.push(e)),!v&&h(_)){e=e.cloneNode(!1);const t=_.childNodes;for(let i=0,s=t.length;i<s;i++)e.appendChild(t[i]);_.appendChild(e),m.appendChild(_),n=h(b)?e:b,g.push(e)}else r?(e.appendChild(_),n=b):n=e;if(v&&3===d.nodeType)if(a(d)){const t=xt.query.getParentElement(n,(t=>u._isNonSplitNode(t.parentNode)||t.parentNode===m));v.appendChild(t),e=t.cloneNode(!1),g.push(e),m.appendChild(e)}else v=null}if(w||d!==_)s=w?i(d):d.cloneNode(!1),s&&(n.appendChild(s),1!==d.nodeType||xt.check.isBreak(d)||(x=s)),t(d,x);else{let t=m;v=a(d);let o="",l="";if(3===_.nodeType){const t=_;o=t.substringData(0,C),l=t.substringData(C,t.length-C)}const r=xt.utils.createTextNode(o),h=xt.utils.createTextNode(l);if(v){const e=a(n);if(e&&e.parentNode!==t){let i=e,s=null;for(;i.parentNode!==t;){for(n=s=i.parentNode.cloneNode(!1);i.childNodes[0];)s.appendChild(i.childNodes[0]);i.appendChild(s),i=i.parentNode}i.parentNode.appendChild(e)}v=v.cloneNode(!1)}xt.check.isZeroWidth(r)||n.appendChild(r);const c=a(n);for(c&&(v=c),v&&(t=v),b=n,f=[];b!==t&&null!==b;)s=i(b),1===b.nodeType&&s&&f.push(s),b=b.parentNode;const u=f.pop()||n;for(y=b=u;f.length>0;)b=f.pop(),y.appendChild(b),y=b;u!==n?(e.appendChild(u),n=b):n=e,xt.check.isBreak(d)&&e.appendChild(d.cloneNode(!1)),t.appendChild(e),_=h,C=0,w=!0,n.appendChild(_)}}}(t,m),l&&!o&&!r.v)return{ancestor:t,container:s,offset:n,endContainer:c};if(o&&=l,o)for(let t=0;t<g.length;t++){const e=g[t],i=e.childNodes,s=i[0];for(;i[0];)m.insertBefore(i[0],e);xt.utils.removeItem(e),0===t&&(_=s)}else if(l){e=e.firstChild;for(let t=0;t<g.length;t++)Ys(g[t])}if(o||0!==m.childNodes.length){this.nodeTransform.removeEmptyNode(m,e,!1),xt.check.isZeroWidth(m.textContent)&&(_=m.firstChild,C=0);const i={s:0,e:0},s=xt.query.getNodePath(_,m,i);C+=i.s;const n=this.nodeTransform.mergeSameTags(m,[s],!0);t.parentNode.replaceChild(m,t),_=xt.query.getNodeFromPath(s,m),C+=n[0]}else t.childNodes?_=t.childNodes[0]:(_=xt.utils.createTextNode(Ct.zeroWidthSpace),t.appendChild(_));return{ancestor:m,container:_,offset:C,endContainer:c}},_setNode_middleLine(t,e,i,s,n,o,l){if(!n){let i=null;l&&t.contains(l)&&(i=xt.query.getNodePath(l,t));const s=t.cloneNode(!0),n=e.nodeName,o=e.style.cssText,r=e.className;let a=s.childNodes,h=0,c=a.length;for(let t;h<c&&(t=a[h],3!==t.nodeType);h++){if(t.nodeName!==n){if(!xt.check.isBreak(t)&&this._isIgnoreNodeChange(t))continue;if(1===c){a=t.childNodes,c=a.length,h=-1;continue}break}t.style.cssText+=o,xt.utils.addClass(t,r)}if(c>0&&h===c)return t.innerHTML=s.innerHTML,{ancestor:t,endContainer:i?xt.query.getNodeFromPath(i,t):null}}o.v=!1;const r=this,a=t.cloneNode(!1),h=[e];let c=!0;if(function t(s,n){const o=s.childNodes;for(let s,d,u=0,p=o.length;u<p;u++){const p=o[u];if(!p)continue;let g=n;if(xt.check.isBreak(p)||!r._isIgnoreNodeChange(p))s=i(p),s&&(c=!1,n.appendChild(s),1===p.nodeType&&(g=s)),xt.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=xt.query.getNodePath(l,p);l=xt.query.getNodeFromPath(t,d)}}}(t,e),c||n&&!s&&!o.v)return{ancestor:t,endContainer:l};if(a.appendChild(e),s&&n)for(let t=0;t<h.length;t++){const e=h[t],i=e.childNodes;for(;i[0];)a.insertBefore(i[0],e);xt.utils.removeItem(e)}else if(n){e=e.firstChild;for(let t=0;t<h.length;t++)Ys(h[t])}return this.nodeTransform.removeEmptyNode(a,e,!1),this.nodeTransform.mergeSameTags(a,null,!0),t.parentNode.replaceChild(a,t),{ancestor:a,endContainer:l}},_setNode_endLine(t,e,i,s,n,o,l,r,a,h){let c=s.parentNode;for(;!(c.nextSibling||c.previousSibling||this.format.isLine(c.parentNode)||xt.check.isWysiwygFrame(c.parentNode))&&c.nodeName!==e.nodeName;)c=c.parentNode;if(!l&&c.nodeName===e.nodeName&&!this.format.isLine(c)&&!c.previousSibling&&xt.check.isZeroWidth(s.textContent.slice(n))){let i=!1,o=s.nextSibling;for(;o;){if(!xt.check.isZeroWidth(o)){i=!1;break}o=o.nextSibling}if(i)return xt.utils.copyTagAttributes(c,e),{ancestor:t,container:s,offset:n}}r.v=!1;const d=this,u=t,p=[e],g=t.cloneNode(!1);let m,f,b,y,v=s,_=n,C=!1;if(function t(s,n){const o=s.childNodes;for(let s,l=o.length-1;0<=l;l--){const r=o[l];if(!r)continue;let c=n;if(C&&!xt.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;)s=i(f),s&&1===f.nodeType&&(h(f)?y||o.push(s):m.push(s)),f=f.parentNode;m=m.concat(o);const l=m.length>0,c=m.pop()||r;for(b=f=c;m.length>0;)f=m.pop(),b.appendChild(f),b=f;if(h(e.parentNode)&&!h(c)&&(e=e.cloneNode(!1),g.insertBefore(e,g.firstChild),p.push(e)),!y&&h(c)){e=e.cloneNode(!1);const t=c.childNodes;for(let i=0,s=t.length;i<s;i++)e.appendChild(t[i]);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(y&&3===r.nodeType)if(a(r)){const t=xt.query.getParentElement(n,(t=>d._isNonSplitNode(t.parentNode)||t.parentNode===g));y.appendChild(t),e=t.cloneNode(!1),p.push(e),g.insertBefore(e,g.firstChild)}else y=null}if(C||r!==v)s=C?i(r):r.cloneNode(!1),s&&(n.insertBefore(s,n.firstChild),1!==r.nodeType||xt.check.isBreak(r)||(c=s)),t(r,c);else{y=a(r);let t="",o="";if(3===v.nodeType){const e=v;t=e.substringData(_,e.length-_),o=e.substringData(0,_)}const l=xt.utils.createTextNode(t),c=xt.utils.createTextNode(o);if(y){y=y.cloneNode(!1);const t=a(n);if(t.parentNode!==g){let e=t,i=null;for(;e.parentNode!==g;){for(n=i=e.parentNode.cloneNode(!1);e.childNodes[0];)i.appendChild(e.childNodes[0]);e.appendChild(i),e=e.parentNode}e.parentNode.insertBefore(t,e.parentNode.firstChild)}y=y.cloneNode(!1)}else h(e.parentNode)&&!y&&(e=e.cloneNode(!1),g.appendChild(e),p.push(e));for(xt.check.isZeroWidth(l)||n.insertBefore(l,n.firstChild),f=n,m=[];f!==g&&null!==f;)s=h(f)?null:i(f),s&&1===f.nodeType&&m.push(s),f=f.parentNode;const d=m.pop()||n;for(b=f=d;m.length>0;)f=m.pop(),b.appendChild(f),b=f;d!==n?(e.insertBefore(d,e.firstChild),n=f):n=e,xt.check.isBreak(r)&&e.appendChild(r.cloneNode(!1)),y?(y.insertBefore(e,y.firstChild),g.insertBefore(y,g.firstChild),y=null):g.insertBefore(e,g.firstChild),v=c,_=c.data.length,C=!0,n.insertBefore(v,n.firstChild)}}}(t,g),l&&!o&&!r.v)return{ancestor:t,container:s,offset:n};if(o&&=l,o)for(let t=0;t<p.length;t++){const e=p[t],i=e.childNodes;let s=null;for(;i[0];)s=i[0],g.insertBefore(s,e);xt.utils.removeItem(e),t===p.length-1&&(v=s,_=s.textContent.length)}else if(l){e=e.firstChild;for(let t=0;t<p.length;t++)Ys(p[t])}if(o||0!==g.childNodes.length){if(!l&&0===e.textContent.length)return this.nodeTransform.removeEmptyNode(g,null,!1),{ancestor:null,container:null,offset:0};this.nodeTransform.removeEmptyNode(g,e,!1),xt.check.isZeroWidth(g.textContent)?(v=g.firstChild,_=v.textContent.length):xt.check.isZeroWidth(v)&&(v=e,_=1);const i={s:0,e:0},s=xt.query.getNodePath(v,g,i);_+=i.s;const n=this.nodeTransform.mergeSameTags(g,[s],!0);t.parentNode.replaceChild(g,t),v=xt.query.getNodeFromPath(s,g),_+=n[0]}else t.childNodes?v=t.childNodes[0]:(v=xt.utils.createTextNode(Ct.zeroWidthSpace),t.appendChild(v));return{ancestor:g,container:v,offset:1===v.nodeType&&1===_?v.childNodes.length:_}},_sn_isSizeNode(t){return t&&"string"!=typeof t&&3!==t.nodeType&&this.format.isTextStyleNode(t)&&!!t.style.fontSize},_sn_getMaintainedNode(t,e,i){return!i||t?null:xt.query.getParentElement(i,this._isNonSplitNode.bind(this))||(e?null:xt.query.getParentElement(i,this._sn_isSizeNode.bind(this)))},_sn_isMaintainedNode(t,e,i){if(!i||t||1!==i.nodeType)return!1;const s=this._isNonSplitNode(i);return xt.query.getParentElement(i,this._isNonSplitNode.bind(this))?s:s||!e&&this._sn_isSizeNode(i)},_sn_setCommonListStyle(t,e){if(!xt.check.isListCell(t))return;const i=xt.utils.arrayFilter((e||t).childNodes,(t=>!xt.check.isBreak(t)));if(e=i[0],!xt.check.isElement(e)||i.length>1)return;const s=e.style,n=t.style,o=e.nodeName.toLowerCase();let l=!1;this.options.get("_defaultStyleTagMap")[o]===this.options.get("_defaultTagCommand").bold.toLowerCase()&&(n.fontWeight="bold"),this.options.get("_defaultStyleTagMap")[o]===this.options.get("_defaultTagCommand").italic.toLowerCase()&&(n.fontStyle="italic");const r=wt.getValues(s);if(r.length>0)for(let t=0,e=this._listCamel.length;t<e;t++)r.includes(this._listKebab[t])&&(n[this._listCamel[t]]=s[this._listCamel[t]],s.removeProperty(this._listKebab[t]),l=!0);if(this._sn_setCommonListStyle(t,e),l&&0===s.length){const t=e.childNodes,i=e.parentNode,s=e.nextSibling;for(;t.length>0;)i.insertBefore(t[0],s);xt.utils.removeItem(e)}},_sn_resetCommonListCell(t,e){if(!xt.check.isListCell(t))return;e||=this._listKebab;const i=xt.utils.arrayFilter(t.childNodes,(t=>!xt.check.isBreak(t))),s=t.style,n=[],o=[],l=wt.getValues(s);for(let t=0,i=this._listKebab.length;t<i;t++)l.includes(this._listKebab[t])&&e.includes(this._listKebab[t])&&(n.push(this._listCamel[t]),o.push(this._listKebab[t]));if(0===n.length)return;const r=xt.utils.createElement("SPAN");for(let t=0,e=n.length;t<e;t++)r.style[n[t]]=s[o[t]],s.removeProperty(o[t]);let a=r.cloneNode(!1),h=null,c=!1;for(let e,s,o=0,l=i.length;o<l;o++)e=i[o],this.options.get("_defaultStyleTagMap")[e.nodeName.toLowerCase()]||(s=wt.getValues(e.style),0===s.length||n.some((function(t){return!s.includes(t)}))&&s.some((function(t){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===s.length&&t.removeAttribute("style"),c},constructor:Gs};const js=Gs;function Xs(t){re.call(this,t)}function Ks(t){const e=t.parentNode;let i,s,n,o,l,r=e.parentNode,a=e;for(;xt.check.isListCell(r);){for(o=xt.query.getPositionIndex(t),i=r.nextElementSibling,s=r.parentNode,n=a;n;){if(a=a.nextSibling,xt.check.isList(n)){for(l=n.childNodes;l[o];)s.insertBefore(l[o],i);0===l.length&&xt.utils.removeItem(n)}else s.appendChild(n);n=a}r=s.parentNode}return 0===e.children.length&&xt.utils.removeItem(e),s}Xs.prototype={apply(t,e,i){const s=(t.split(":")[0]||"ol").toUpperCase(),n=t.split(":")[1]||"";let o=this.selection.getRange(),l=e||this.format.getLinesAndComponents(!1);if(0===l.length){if(e)return;if(o=this.selection.getRangeAndAddLine(o,null),l=this.format.getLinesAndComponents(!1),0===l.length)return}xt.query.sortNodeByDepth(l,!0);const r=l[0],a=l.at(-1);let h=!xt.check.isListCell(r)&&!this.component.is(r)||r.previousElementSibling?r.previousElementSibling:r.parentElement.previousElementSibling,c=!xt.check.isListCell(a)&&!this.component.is(a)||a.nextElementSibling?a.nextElementSibling:a.parentElement.nextElementSibling;const d=o.collapsed,u={sc:o.startContainer,so:o.startContainer===o.endContainer&&xt.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(!xt.check.isList(this.format.getBlock(l[t],(e=>this.format.getBlock(e)&&e!==l[t])))){g=!1;break}if(!g||h&&r.tagName===h.tagName&&s===h.tagName.toUpperCase()||c&&a.tagName===c.tagName&&s===c.tagName.toUpperCase()){const t=h?h.parentNode:h,e=c?c.parentNode:c;h=t&&!xt.check.isWysiwygFrame(t)&&t.nodeName===s?t:h,c=e&&!xt.check.isWysiwygFrame(e)&&e.nodeName===s?e:c;const i=h?.tagName===s,o=c?.tagName===s;let r=i?h:xt.utils.createElement(s,{style:"list-style-type: "+n}),a=null,d=null;const u=t=>!xt.check.isComponentContainer(t)&&!xt.check.isList(t);for(let t,e,o,h,c,p,g,m,f,b=0,y=l.length;b<y;b++)if(e=l[b],0!==e.childNodes.length||this.inline._isIgnoreNodeChange(e)){if(h=l[b+1],c=e.parentNode,p=h?h.parentNode:null,o=xt.check.isListCell(e),f=this.format.isBlock(c)?c:null,g=o&&!xt.check.isWysiwygFrame(c)?c.parentNode:c,m=o&&!xt.check.isWysiwygFrame(c)?!h||xt.check.isListCell(g)?c:c.nextSibling:e.nextSibling,t=xt.utils.createElement("LI"),this.component.is(e)){const i=/^HR$/i.test(e.nodeName);i||(t.innerHTML="<br>"),t.innerHTML+=e.outerHTML,i&&(t.innerHTML+="<br>")}else{xt.utils.copyFormatAttributes(t,e);const i=e.childNodes;for(;i[0];)t.appendChild(i[0])}r.appendChild(t),h&&g===p&&!this.format.isBlock(m)||(a||=r,i&&h&&g===p||h&&xt.check.isList(p)&&p===c||r.parentNode!==g&&g.insertBefore(r,m)),xt.utils.removeItem(e),i&&null===d&&(d=r.children.length-1),h&&(this.format.getBlock(p,u)!==this.format.getBlock(c,u)||xt.check.isList(p)&&xt.check.isList(c)&&xt.query.getNodeDepth(p)!==xt.query.getNodeDepth(c))&&(r=xt.utils.createElement(s,{style:"list-style-type: "+n})),0===f?.children.length&&xt.utils.removeItem(f)}else xt.utils.removeItem(e);d&&(a=a.children[d]),o&&(r.innerHTML+=c.innerHTML,xt.utils.removeItem(c))}else{if(i)for(let t=0,e=l.length;t<e;t++)for(let i=t-1;i>=0;i--)if(l[i].contains(l[t])){l.splice(t,1),t--,e--;break}const t=this.format.getBlock(r),e=t?.tagName===s;let o,a;const h=t=>!xt.check.isComponentContainer(t);e||(a=xt.utils.createElement(s,{style:"list-style-type: "+n}));for(let t,r,c=0,d=l.length;c<d;c++)r=this.format.getBlock(l[c],h),r&&xt.check.isList(r)&&(t?t!==r?(i&&xt.check.isListCell(r.parentNode)?this._detachNested(o.f):p=this.format.removeBlock(o.f[0].parentElement,{selectedFormats:o.f,newBlockElement:a,shouldDelete:!1,skipHistory:!0}),r=l[c].parentNode,e||(a=xt.utils.createElement(s,{style:"list-style-type: "+n})),t=r,o={r:t,f:[xt.query.getParentElement(l[c],"LI")]}):o.f.push(xt.query.getParentElement(l[c],"LI")):(t=r,o={r:t,f:[xt.query.getParentElement(l[c],"LI")]}),c===d-1&&(i&&xt.check.isListCell(r.parentNode)?this._detachNested(o.f):p=this.format.removeBlock(o.f[0].parentElement,{selectedFormats:o.f,newBlockElement:a,shouldDelete:!1,skipHistory:!0})))}return this.editor.effectNode=null,g&&d&&p||u},remove(t,e){let i={},s=!1,n=!1,o=null,l=null;const r=t=>!xt.check.isComponentContainer(t);for(let a,h,c,d,u=0,p=t.length;u<p;u++){if(c=u===p-1,h=this.format.getBlock(t[u],r),d=xt.check.isList(h),!a&&d)a=h,i={r:a,f:[xt.query.getParentElement(t[u],"LI")]},0===u&&(s=!0);else if(a&&d)if(a!==h){const r=this.format.removeBlock(i.f[0].parentNode,{selectedFormats:i.f,newBlockElement:null,shouldDelete:e,skipHistory:!0});h=t[u].parentNode,s&&(o=r.sc,s=!1),c&&(l=r.ec),d?(a=h,i={r:a,f:[xt.query.getParentElement(t[u],"LI")]},c&&(n=!0)):a=null}else i.f.push(xt.query.getParentElement(t[u],"LI")),c&&(n=!0);if(c&&xt.check.isList(a)){const t=this.format.removeBlock(i.f[0].parentNode,{selectedFormats:i.f,newBlockElement:null,shouldDelete:e,skipHistory:!0});(n||1===p)&&(l=t.ec),s&&(o=t.sc||l)}}return{sc:o,ec:l}},applyNested(t,e){const i=(t=t||this.format.getLines().filter((function(t){return xt.check.isListCell(t)}))).length;if(0===i||!e&&!xt.check.isListCell(t[0].previousElementSibling)&&!xt.check.isListCell(t.at(-1).nextElementSibling))return{sc:t[0],so:0,ec:t.at(-1),eo:1};let s=t[0].parentElement,n=t.at(-1),o=null;if(e){if(s!==n.parentElement&&xt.check.isList(n.parentElement.parentElement)&&n.nextElementSibling)for(n=n.nextElementSibling;n;)t.push(n),n=n.nextElementSibling;o=this.apply(s.nodeName+":"+s.style.listStyleType,t,!0)}else{let e=xt.utils.createElement(s.nodeName),l=t[0].previousElementSibling,r=n.nextElementSibling;const a={s:null,e:null,sl:s,el:s},{startContainer:h,startOffset:c,endContainer:d,endOffset:u}=this.selection.getRange();for(let n,o=0,h=i;o<h;o++)n=t[o],n.parentElement!==s&&(this._attachNested(s,e,l,r,a),s=n.parentElement,e=xt.utils.createElement(s.nodeName)),l=n.previousElementSibling,r=n.nextElementSibling,e.appendChild(n);if(this._attachNested(s,e,l,r,a),i>1){const t=xt.query.getNodeFromPath(a.s,a.sl),e=xt.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 i=Ks(t);let s,n,o;if(i){s=i.cloneNode(!1),n=i.childNodes;const e=xt.query.getPositionIndex(t);for(;n[e];)s.appendChild(n[e])}else s=t;if(e)o=xt.query.getListChildren(s,(t=>xt.check.isListCell(t)&&!t.previousElementSibling),null);else{const e=xt.query.getNodeDepth(t)+2;o=xt.query.getListChildren(t,(t=>xt.check.isListCell(t)&&!t.previousElementSibling&&xt.query.getNodeDepth(t)===e),null)}for(let t=0,e=o.length;t<e;t++)Ks(o[t]);return i&&(i.parentNode.insertBefore(s,i.nextSibling),0===n?.length&&xt.utils.removeItem(i)),s===t?s.parentNode:s},_attachNested(t,e,i,s,n){let o=!1;if(e.tagName===i?.tagName){const t=e.children;for(;t[0];)i.appendChild(t[0]);e=i,o=!0}if(e.tagName===s?.tagName){const t=s.children;for(;t[0];)e.appendChild(t[0]);const i=s.nextElementSibling;s.parentNode.removeChild(s),s=i}if(!o){xt.check.isListCell(i)&&(t=i,s=null),t.insertBefore(e,s),n.s||(n.s=xt.query.getNodePath(e.firstElementChild.firstChild,t,null),n.sl=t);const o=t.contains(n.sl)?xt.query.getNodePath(n.sl,t):null;n.e=xt.query.getNodePath(e.lastElementChild.firstChild,t,null),n.el=t,this.nodeTransform.mergeSameTags(t,[n.s,n.e,o],!1),this.nodeTransform.mergeNestedTags(t),o&&(n.sl=xt.query.getNodeFromPath(o,t))}return e},_detachNested(t){const e=t[0],i=t.at(-1),s=i.nextElementSibling,n=e.parentElement,o=n.parentElement.nextElementSibling,l=n.parentElement.parentElement;for(let e=0,i=t.length;e<i;e++)l.insertBefore(t[e],o);if(s&&n.children.length>0){const t=n.cloneNode(!1),e=n.childNodes,o=xt.query.getPositionIndex(s);for(;e[o];)t.appendChild(e[o]);i.appendChild(t)}0===n.children.length&&xt.utils.removeItem(n),this.nodeTransform.mergeSameTags(l);const r=xt.query.getEdgeChildNodes(e,i);return{cc:e.parentNode,sc:r.sc,ec:r.ec}},constructor:Xs};const Js=Xs;function Qs(t){re.call(this,t),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._dropdownCommands=[],this.__globalEventHandler={mousedown:tn.bind(this),containerDown:this.containerOff.bind(this),keydown:sn.bind(this),mousemove:nn.bind(this),mouseout:en.bind(this)},this._bindClose_dropdown_mouse=null,this._bindClose_dropdown_key=null,this._bindClose_cons_mouse=null,this.currentDropdownPlugin=null,this.__menuBtn=null,this.__menuContainer=null}function tn(t){const e=xt.query.getEventTarget(t);xt.query.getParentElement(e,".se-dropdown")||this.dropdownOff()}function en(){this.index=-1}function sn(t){switch(t.code){case"ArrowUp":case"ArrowLeft":t.preventDefault(),t.stopPropagation(),this._moveItem(-1);break;case"ArrowDown":case"ArrowRight":t.preventDefault(),t.stopPropagation(),this._moveItem(1);break;case"Enter":case"Space":{if(this.index<0)break;const e=this.menus[this.index];if(!e||"function"!=typeof this.plugins[this.currentDropdownName].action)return;t.preventDefault(),t.stopPropagation(),this.plugins[this.currentDropdownName].action(e),this.dropdownOff();break}}}function nn(t){xt.utils.addClass(this.currentDropdown,"se-select-menu-mouse-move"),xt.utils.removeClass(this.currentDropdown,"se-select-menu-key-action");const e=this.menus.indexOf(t.target);-1!==e&&(this.index=1*e)}function on(t){return/free$/.test(t)}Qs.prototype={initDropdownTarget({key:t,type:e},i){if(!t)throw Error("[SUNEDITOR.init.fail] The plugin's key is not added.");on(e)||(i.setAttribute("data-key",t),this._dropdownCommands.push(t)),this.context.get("menuTray").appendChild(i),this.targetMap[t]=i},dropdownOn(t){this.__removeGlobalEvent();const e=this._checkMoreLayer(t);if(e){const i=xt.query.getParentElement(e,".se-btn-tray").querySelector('[data-command="'+e.getAttribute("data-ref")+'"]');if(i)return this.editor.runFromTarget(i),void this.dropdownOn(t)}const i=this.currentButton=t,s=this.currentDropdownName=i.getAttribute("data-command");this.currentDropdownType=i.getAttribute("data-type");const n=this.currentDropdown=this.targetMap[s];this.currentDropdownActiveButton=i,this._setMenuPosition(i,n),this._bindClose_dropdown_mouse=this.eventManager.addGlobalEvent("mousedown",this.__globalEventHandler.mousedown,!1),this._dropdownCommands.includes(s)&&(this.menus=wt.nodeListToArray(n.querySelectorAll("[data-command]")),this.menus.length>0&&(this._bindClose_dropdown_key=this.eventManager.addGlobalEvent("keydown",this.__globalEventHandler.keydown,!1),n.addEventListener("mousemove",this.__globalEventHandler.mousemove,!1),n.addEventListener("mouseout",this.__globalEventHandler.mouseout,!1))),this.currentDropdownPlugin=this.plugins[s],this.currentDropdownPlugin?.on(i),this.editor._preventBlur=!0},dropdownOff(){this.__removeGlobalEvent(),on(this.currentDropdownType)&&this.currentDropdownPlugin?.off?.(),this.index=-1,this.menus=[],this.__menuBtn=null,this.__menuContainer=null,this.currentButton=null,this.currentDropdown&&(this.currentDropdownName="",this.currentDropdownType="",this.currentDropdown.style.display="none",this.currentDropdown=null,this.currentDropdownActiveButton&&xt.utils.removeClass(this.currentDropdownActiveButton.parentElement.children,"on"),this.currentDropdownActiveButton=null,this.editor._notHideToolbar=!1),this.editor._preventBlur=!1,this.currentDropdownPlugin=null},dropdownShow(){this.currentButton&&this.dropdownOn(this.currentButton)},dropdownHide(){this.currentDropdown&&(this.currentDropdown.style.display="none")},containerOn(t){this.__removeGlobalEvent(),this.currentContainerActiveButton=t;const e=this.currentContainerName=this.currentContainerActiveButton.getAttribute("data-command");this._setMenuPosition(t,this.currentContainer=this.targetMap[e]),this._bindClose_cons_mouse=this.eventManager.addGlobalEvent("mousedown",this.__globalEventHandler.containerDown,!1),this.plugins[e].on&&this.plugins[e].on(t),this.editor._preventBlur=!0},containerOff(){this.__removeGlobalEvent(),this.currentContainer&&(this.currentContainerName="",this.currentContainer.style.display="none",this.currentContainer=null,xt.utils.removeClass(this.currentContainerActiveButton,"on"),this.currentContainerActiveButton=null,this.editor._notHideToolbar=!1),this.editor._preventBlur=!1},_setMenuPosition(t,e){e.style.visibility="hidden",e.style.display="block",e.style.height="",xt.utils.addClass(t.parentElement.children,"on"),this.offset.setRelPosition(e,this.carrierWrapper,t.parentElement,xt.query.getParentElement(t,".se-toolbar")),e.style.visibility="",this.__menuBtn=t,this.__menuContainer=e},_resetMenuPosition(t,e){this.offset.setRelPosition(e,this.carrierWrapper,t.parentElement,xt.query.getParentElement(t,".se-toolbar"))},_restoreMenuPosition(){this.__menuBtn&&this.__menuContainer&&this._setMenuPosition(this.__menuBtn,this.__menuContainer)},_checkMoreLayer(t){const e=xt.query.getParentElement(t,".se-more-layer");return e&&"block"!==e.style.display&&e.getAttribute("data-ref")?e:null},_moveItem(t){xt.utils.removeClass(this.currentDropdown,"se-select-menu-mouse-move"),xt.utils.addClass(this.currentDropdown,"se-select-menu-key-action"),t=this.index+t;const e=this.menus.length,i=this.index=t>=e?0:t<0?e-1:t;for(let t=0;t<e;t++)t===i?xt.utils.addClass(this.menus[t],"on"):xt.utils.removeClass(this.menus[t],"on")},__removeGlobalEvent(){this._bindClose_dropdown_mouse&&=this.eventManager.removeGlobalEvent(this._bindClose_dropdown_mouse),this._bindClose_cons_mouse&&=this.eventManager.removeGlobalEvent(this._bindClose_cons_mouse),this._bindClose_dropdown_key&&(this._bindClose_dropdown_key=this.eventManager.removeGlobalEvent(this._bindClose_dropdown_key),xt.utils.removeClass(this.menus,"on"),xt.utils.removeClass(this.currentDropdown,"se-select-menu-key-action|se-select-menu-mouse-move"),this.currentDropdown.removeEventListener("mousemove",this.__globalEventHandler.mousemove,!1),this.currentDropdown.removeEventListener("mouseout",this.__globalEventHandler.mouseout,!1))},constructor:Qs};const ln=Qs;function rn(t){re.call(this,t)}rn.prototype={split(t,e,i){if(xt.check.isWysiwygFrame(t)||this.component.is(t)||!t)return t;if(e&&!kt.is(e)){const i=t.childNodes;let s=xt.query.getPositionIndex(e);const n=t.cloneNode(!1),o=t.cloneNode(!1);for(let t=0,e=i.length;t<e;t++){if(t<s)n.appendChild(i[t]);else{if(!(t>s))continue;o.appendChild(i[t])}t--,e--,s--}return n.childNodes.length>0&&t.parentNode.insertBefore(n,t),o.childNodes.length>0&&t.parentNode.insertBefore(o,t.nextElementSibling),t}const s=t.parentNode;let n,o,l,r=0,a=1,h=!0;if((!i||i<0)&&(i=0),xt.check.isText(t)){if(r=xt.query.getPositionIndex(t),(e=Number(e))>=0&&t.length!==e){t.splitText(e);const i=xt.query.getNodeFromPath([r+1],s);xt.check.isZeroWidth(i)&&(i.data=Ct.zeroWidthSpace)}}else if(1===t.nodeType){if(0===e){for(;t.firstChild;)t=t.firstChild;if(3===t.nodeType){const e=xt.utils.createTextNode(Ct.zeroWidthSpace);t.parentNode.insertBefore(e,t),t=e}}t.previousSibling?t=t.previousSibling:xt.query.getNodeDepth(t)===i&&(h=!1)}1===t.nodeType&&(a=0);let c=t;for(;xt.query.getNodeDepth(c)>i;)for(r=xt.query.getPositionIndex(c)+a,c=c.parentNode,l=n,n=c.cloneNode(!1),o=c.childNodes,l&&(xt.check.isListCell(n)&&xt.check.isList(l)&&l.firstElementChild?(n.innerHTML=l.firstElementChild.innerHTML,xt.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,xt.check.isList),n.childNodes.length>0?d.insertBefore(n,c):n=c,xt.check.isListCell(n)&&n.children&&xt.check.isList(n.children[0])&&n.insertBefore(xt.utils.createElement("BR"),n.children[0]),0===s.childNodes.length&&xt.utils.removeItem(s),n):c},mergeSameTags(t,e,i){const s=this,n=e?e.length:0;let o=null;return n&&(o=Array.apply(null,new Array(n)).map(Number.prototype.valueOf,0)),function t(l,r,a){const h=l.childNodes;for(let c,d,u=0,p=h.length;u<p&&(c=h[u],d=h[u+1],c);u++)if(!(xt.check.isBreak(c)||xt.check.isMedia(c)||xt.check.isInputElement(c)))if(i&&s.inline._isIgnoreNodeChange(c)||!i&&(xt.check.isTableElements(c)||xt.check.isListCell(c)||s.format.isLine(c)&&!s.format.isBrLine(c)))(xt.check.isTableElements(c)||xt.check.isListCell(c))&&t(c,r+1,u);else{if(1===p&&l.nodeName===c.nodeName&&l.parentNode){if(n){let t,i,s,o,a;for(let h=0;h<n;h++)if(t=e[h],t&&t[r]===u){for(i=c,s=l,o=r,a=!0;o>=0;){if(xt.utils.getArrayIndex(s.childNodes,i)!==t[o]){a=!1;break}i=c.parentNode,s=i.parentNode,o--}a&&(t.splice(r,1),t[r]=u)}}xt.utils.copyTagAttributes(c,l),l.parentNode.insertBefore(c,l),xt.utils.removeItem(l)}if(!d){1===c.nodeType&&t(c,r+1,u);break}if(c.nodeName===d.nodeName&&xt.check.isSameAttributes(c,d)&&c.getAttribute?.("href")===d.getAttribute?.("href")){const t=c.childNodes;let i=0;for(let e=0,s=t.length;e<s;e++)t[e].textContent.length>0&&i++;const s=c.lastChild,l=d.firstChild;let h=0;if(s&&l){const t=3===s.nodeType&&3===l.nodeType;h=s.textContent.length;let c=s.previousSibling;for(;c&&3===c.nodeType;)h+=c.textContent.length,c=c.previousSibling;if(i>0&&3===s.nodeType&&3===l.nodeType&&(s.textContent.length>0||l.textContent.length>0)&&i--,n){let c=null;for(let d=0;d<n;d++)if(c=e[d],c&&c[r]>u){if(r>0&&c[r-1]!==a)continue;c[r]-=1,c[r+1]>=0&&c[r]===u&&(c[r+1]+=i,t&&s&&3===s.nodeType&&l&&3===l.nodeType&&(o[d]+=h))}}}if(3===c.nodeType){if(h=c.textContent.length,c.textContent+=d.textContent,n){let t=null;for(let s=0;s<n;s++)if(t=e[s],t&&t[r]>u){if(r>0&&t[r-1]!==a)continue;t[r]-=1,t[r+1]>=0&&t[r]===u&&(t[r+1]+=i,o[s]+=h)}}}else c.innerHTML+=d.innerHTML;xt.utils.removeItem(d),u--}else 1===c.nodeType&&t(c,r+1,u)}}(t,0,0),o},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(i){let s=i.children;if(1===s.length&&s[0].nodeName===i.nodeName&&e(i)){const t=s[0];for(s=t.children;s[0];)i.appendChild(s[0]);i.removeChild(t)}for(let e=0,s=i.children.length;e<s;e++)t(i.children[e])}(t)},removeAllParents(t,e,i){if(!t)return null;let s=null;return e||=t=>{if(t===i||this.component.is(t))return!1;const e=t.textContent.trim();return 0===e.length||/^(\n|\u200B)+$/.test(e)},function t(i){if(!xt.check.isWysiwygFrame(i)){const n=i.parentNode;n&&e(i)&&(s={sc:i.previousElementSibling,ec:i.nextElementSibling},xt.utils.removeItem(i),t(n))}}(t),s},removeEmptyNode(t,e,i){const s=this,n=this.options.get("allowedEmptyTags");e&&=xt.query.getParentElement(e,(e=>t===e.parentElement)),function i(o){if(s.format._notTextNode(o)||o===e||xt.check.isNonEditable(o))return 0;if(o===t||!xt.check.isZeroWidth(o.textContent)||o.firstChild&&xt.check.isBreak(o.firstChild)||o.querySelector(n)){const t=o.children;for(let e=0,n=t.length,o=0;e<n;e++)t[e+o]&&!s.component.is(t[e+o])&&(o+=i(t[e+o]))}else if(o.parentNode)return o.parentNode.removeChild(o),-1;return 0}(t),0===t.childNodes.length&&(i?xt.utils.removeItem(t):t.innerHTML="<br>")},createNestedNode(t,e){"function"!=typeof e&&(e=()=>!0);const i=t[0].cloneNode(!1);let s=i;for(let i,n=1,o=t.length;n<o;n++)e(t[n])&&(i=t[n].cloneNode(!1),s.appendChild(i),s=i);return s.innerHTML="",{parent:i,inner:s}},constructor:rn};const an=rn;function hn(t){re.call(this,t)}hn.prototype={get(t){const e=this.frameContext.get("wysiwygFrame"),i=/iframe/i.test(e?.nodeName),s=this.getLocal(t);return{left:s.left+(i?e.parentElement.offsetLeft:0),top:s.top+(i?e.parentElement.offsetTop:0)}},getLocal(t){const e=t;let i=0,s=0,n=0,o=0,l=0,r=3===e.nodeType?e.parentElement:e;const a=e.offsetWidth,h=lt(e,D.bind(this)),c=r;for(;r&&!X(r,"se-wrapper")&&r!==h;)i+=r.offsetLeft-(c!==r?r.scrollLeft:0),s+=r.offsetTop+(c!==r?r.scrollTop:0),r=r.offsetParent;const d=this.frameContext.get("wysiwygFrame");this.frameContext.get("wysiwyg").contains(e)&&(n=d.offsetLeft,o=d.offsetTop,l=d.parentElement.offsetWidth-(d.offsetLeft+d.offsetWidth));const u=this.frameContext.get("eventWysiwyg");return i+=n-(h?h.scrollLeft:0),s+=o-(h?h.scrollTop:0),{left:i,top:s,right:r?.offsetWidth?r.offsetWidth-(i-n+a)+l:0,scrollX:u.scrollLeft||u.scrollX||0,scrollY:u.scrollTop||u.scrollY||0,scrollH:this.frameContext.get("wysiwyg").scrollHeight||0}},getGlobal(t){const e=this.frameContext.get("topArea"),i=this.frameContext.get("wysiwygFrame");if(t||=e,!R(t))return{top:0,left:0,fixedTop:0,fixedLeft:0,width:0,height:0};const s=t,o=s.getBoundingClientRect();let l=o.top,r=o.left;if(/^iframe$/i.test(i.nodeName)&&i.contentDocument.contains(s)){const t=i.getBoundingClientRect();l+=t.top,r+=t.left}let a=0,h=0;return this.frameContext.get("isFullScreen")||(a+=n.scrollY,h+=n.scrollX),{top:l+a,left:r+h,fixedTop:l,fixedLeft:r,width:s.offsetWidth,height:s.offsetHeight}},getGlobalScroll(t){const e=this.frameContext.get("topArea");let i=!1,s=!1;t||=e,t===e&&(i=!0),!i&&R(t)&&(s="absolute"===n.getComputedStyle(t).position);let o=0,l=0,r=0,a=0,h=0,c=0,d=0,u=0,p=null,g=null,m=null,f=null,b=t;for(;b;)o+=b.scrollTop,l+=b.scrollLeft,r+=b.scrollHeight,a+=b.scrollWidth,b.scrollTop>0&&(c+=b.offsetTop),b.scrollHeight>=b.clientHeight&&(d=/^html$/i.test(b.nodeName)?d||b.clientHeight:b.clientHeight+(m?-m.clientTop:0),p=m||p||b,m=b),b.scrollLeft>0&&(h+=b.offsetLeft),b.scrollWidth>=b.clientWidth&&(u=/^html$/i.test(b.nodeName)?u||b.clientWidth:b.clientWidth+(f?-f.clientLeft:0),g=f||g||b,f=b),b=b.parentElement;if(!s&&!i&&/^iframe$/i.test(this.frameContext.get("wysiwygFrame").nodeName))for(b=this.frameContext.get("wrapper"),p=g=e;b;)o+=b.scrollTop,l+=b.scrollLeft,r+=b.scrollHeight,a+=b.scrollWidth,b.scrollTop>0&&(c+=b.offsetTop),b.scrollHeight>=b.clientHeight&&(d=/^html$/i.test(b.nodeName)?d||b.clientHeight:b.clientHeight+(m?-m.clientTop:0),m=b),b.scrollLeft>0&&(h+=b.offsetLeft),b.scrollWidth>=b.clientWidth&&(u=/^html$/i.test(b.nodeName)?u||b.clientWidth:b.clientWidth+(f?-f.clientLeft:0),f=b),b=b.parentElement;for(b=this.editor._shadowRoot?.host,b&&(p=g=e);b;)o+=b.scrollTop,l+=b.scrollLeft,r+=b.scrollHeight,a+=b.scrollWidth,b.scrollTop>0&&(c+=b.offsetTop),b.scrollHeight>=b.clientHeight&&(d=/^html$/i.test(b.nodeName)?d||b.clientHeight:b.clientHeight+(m?-m.clientTop:0),m=b),b.scrollLeft>0&&(h+=b.offsetLeft),b.scrollWidth>=b.clientWidth&&(u=/^html$/i.test(b.nodeName)?u||b.clientWidth:b.clientWidth+(f?-f.clientLeft:0),f=b),b=b.parentElement;const y=e.contains(p),v=e.contains(g);p=y?e:p,g=v?e:g;const _=p?p.getBoundingClientRect().top+(!p.parentElement||/^html$/i.test(p.parentElement.nodeName)?n.scrollY:0):0,C=g?g.getBoundingClientRect().left+(!g.parentElement||/^html$/i.test(g.parentElement.nodeName)?n.scrollX:0):0;d=y?e.clientHeight:d,u=v?e.clientWidth:u;const w=Q(this.frameContext.get("_wd"));return{top:o,left:l,ts:_,ls:C,width:a,height:r,x:h,y:c,ohOffsetEl:s?window:p,owOffsetEl:s?window:g,oh:s?w.h:d,ow:s?w.w:u,heightEditorRefer:y,widthEditorRefer:v}},getWWScroll(){const t=this.frameContext.get("wysiwyg"),e=t.scrollTop||t.scrollY||0,i=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:i,bottom:e+i}},setRelPosition(t,e,i,s){const l=/^fixed$/i.test(n.getComputedStyle(s).position),r=this.getGlobal(i);if(l)t.style.position="fixed",t.style.top=`${r.fixedTop+r.height}px`;else{t.style.position="";const n=s.contains(t)?this.getGlobal(e).top:0,l=t.offsetHeight,a=this.getGlobalScroll().top,h=r.top,c=Q(o).h-(n-a+h+i.offsetHeight);if(c<l){let e=-1*(l-h+3);const s=n-a+e,o=l+(s<0?s:0);o>c?(t.style.height=`${o}px`,e=-1*(o-h+3)):(t.style.height=`${c}px`,e=h+i.offsetHeight),t.style.top=`${e}px`}else t.style.top=`${h+i.offsetHeight}px`}const a=t.offsetWidth,h=i.offsetWidth,c=r.left,d=this.getGlobal(s).left;if(this.options.get("_rtl")){const e=a>h?a-h:0,i=e>0?0:h-a;t.style.left=`${c-e+i}px`,d>this.getGlobal(t).left&&(t.style.left=d+"px")}else{const e=s.offsetWidth+d,i=e<=a?0:e-(c+a);t.style.left=i<0?`${c+i}px`:`${c}px`}},setAbsPosition(t,e,i){const s={left:0,top:0,...i.addOffset},l=i.position||"bottom",r=i.inst,a=!this.options.get("_rtl");a||(s.left*=-1);const h=this.frameOptions.get("iframe"),c=this.frameContext.get("wrapper").contains(e)||i.isWWTarget||!!h&&this.frameContext.get("wysiwyg").contains(e),d=Boolean(lt(e,".se-toolbar")),u=1===e.nodeType,p=c&&!u,g=u&&/inline/.test(n.getComputedStyle(e).display),m=Q(o),f=p?this.getWWScroll():this._getWindowScroll(),b=!c||!h&&u?e.getBoundingClientRect():this.selection.getRects(e,"start").rects,y=this.getGlobal(e),v=X(t.firstElementChild,"se-arrow")?t.firstElementChild:null,_=i.sibling?.offsetHeight||0,C=v?v.offsetHeight:0,w=t.offsetHeight,x=e.offsetHeight,k=b.top,E=m.h-b.bottom,S=this.getGlobal(this.frameContext.get("topArea")).top,T=n.scrollY,H=this.context.get("toolbar_main").offsetHeight,L=this.options.get("toolbar_container"),M=this.editor.isBalloon||this.editor.isInline||L,N=L&&S-T-H>0||!this.toolbar.isSticky&&M?0:H+(this.toolbar.isSticky?this.options.get("toolbar_sticky"):0),A=this.frameContext.get("statusbar")?.offsetHeight||0,{rmt:B,rmb:V,bMargin:I,rt:O}=this._getVMargin(k,E,N,m,b,p,d);if(c&&(V-A+x<=0||B+O+x-(this.toolbar.isSticky&&g?N:0)<=0)||B+x<0)return;const R=this.toolbar.isSticky&&"none"!==this.context.get("toolbar_main").style.display&&(!M||this.frameContext.get("topArea").getBoundingClientRect().top<=H);let F=s.top,z=0,$="";"bottom"===l?($="up",F+=b.bottom+C+T,z=V-(w+C),z-_<0&&($="down",F-=x+w+2*C,z=B-(w+C),z-_<0&&($="",F-=z-_-Math.max(1,z+w+C)))):($="down",F+=b.top-w-C+T,z=(R?b.top-N:B)-w-C,z-_<0&&($="up",F+=x+w+2*C,z=(V>0?I:V)-(w+C)-A,z-_<0&&($="",F+=z-2))),this._setArrow(v,$),t.style.top=`${F}px`;const P=(1===t.nodeType?kt.get(n.getComputedStyle(t).borderRadius):0)||0,D=y.width,q=t.offsetWidth,W=v?v.offsetWidth:0,U=b.left,Z=m.w-b.right;let G,Y;if(this.frameContext.get("isFullScreen")?(G=U,Y=Z):(G=b.left,Y=m.w-b.right),c&&(G+D<=0||Y+D<=0))return;v&&(v.style.left="",v.style.right="");let j=s.left,K=0,J=0,tt=0;return a?(j+=b.left+n.scrollX-(G<0?G:0),K=D+G,K<W&&(tt=W/2-1+(P<=2?0:P-2),J=tt),K=D+Y-q,K<0&&(j+=K,tt=q-1-(W/2+(P<=2?0:P-2)),J=-(K-W/2),J=J>tt?tt:J),v&&J>0&&(v.style.left=J+"px")):(j+=b.right-q+n.scrollX+(Y<0?Y:0),K=D+Y,K<W&&(tt=W/2-1+(P<=2?0:P-2),J=tt),K=D+G-q,K<0&&(j-=K,tt=W/2-1+(P<=2?0:P-2),J=-(K-W/2),J=J<tt?tt:J>q-tt?q-tt:J),v&&J>0&&(v.style.right=J+"px")),t.style.left=`${j}px`,r.__offset={left:t.offsetLeft+f.left,top:t.offsetTop+f.top,addOffset:s},{position:"up"===$?"bottom":"top"}},setRangePosition(t,e,{position:i,addTop:s}={}){t.style.top="-10000px",t.style.visibility="hidden",t.style.display="block";let n="top"===i;e||=this.selection.getRange();const l=this.selection.getRects(e,n?"start":"end");n="start"===l.position;const r=this.frameContext.get("isFullScreen"),a=this.frameContext.get("topArea"),h=l.rects,c=r?0:l.scrollLeft,d=r?0:l.scrollTop,u=a.offsetWidth,p=this.getGlobal(a),g=p.left,m=t.offsetWidth,f=t.offsetHeight;this._setOffsetOnRange(n,h,t,g,u,c,d,s),this.getGlobal(t).top-p.top<0&&(n=!n,this._setOffsetOnRange(n,h,t,g,u,c,d,s)),m===t.offsetWidth&&f===t.offsetHeight||this._setOffsetOnRange(n,h,t,g,u,c,d,s);const b=!this.carrierWrapper.contains(t),y=Q(o),v=h.height,_=h.top,C=y.h-h.bottom,w=this.toolbar.isSticky||!this.editor.isBalloon&&!this.editor.isInline?this.context.get("toolbar_main").offsetHeight:0,{rmt:x,rmb:k,rt:E}=this._getVMargin(_,C,w,y,h,b,!1);if(!(k+v<=0||x+E+v<=0))return t.style.visibility="",!0},_setOffsetOnRange(t,e,i,s,n,l,r,a=0){const h=i.querySelector(".se-arrow "),c=Math.round(h.offsetWidth/2),d=i.offsetWidth,u=e.noText&&!t?0:i.offsetHeight,p=(t?e.left:e.right)-s-d/2+l,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 b=!1;const y=m+(t?this.getGlobal(this.frameContext.get("topArea")).top:i.offsetHeight-this.frameContext.get("wysiwyg").offsetHeight);!t&&y>0&&this._getPageBottomSpace()<y?(t=!0,b=!0):t&&o.documentElement.offsetTop>y&&(t=!1,b=!0),b&&(m=(t?e.top-u-c:e.bottom+c)-(e.noText?0:a)+r),i.style.left=Math.floor(f)+"px",i.style.top=Math.floor(m)+"px",t?(J(h,"se-arrow-up"),K(h,"se-arrow-down")):(J(h,"se-arrow-down"),K(h,"se-arrow-up"));const v=Math.floor(d/2+(p-f));h.style.left=(v+c>i.offsetWidth?i.offsetWidth-c:v<c?c:v)+"px"},_getPageBottomSpace(){const t=this.frameContext.get("topArea");return o.documentElement.scrollHeight-(this.getGlobal(t).top+t.offsetHeight)},_getVMargin(t,e,i,s,o,l,r){const a=this.status.isScrollable(),h=this.selection.getRects(this.frameContext.get("wysiwyg"),"start").rects;let c=0,d=0,u=0,p=0,g=0;if(this.frameContext.get("isFullScreen"))c=t-i,d=e;else{const t=this.frameOptions.get("iframe");p=o.top,g=s.h-o.bottom;const e=this.getGlobal();if(l){u=r||this.toolbar.isSticky||this.options.get("toolbar_container")?0:i;const s=t?0:e.top-n.scrollY+u,l=t?0:this.status.currentViewportHeight-(e.top+e.height-n.scrollY);let a=s;i>s?a=this.toolbar.isSticky?i:s+i:this.options.get("toolbar_container")&&!this.toolbar.isSticky?i=0:a=s+i,c=o.top-h.top-a+i,d=h.bottom-o.bottom-l,c=c>0?c:c-i}else{const t=e.fixedTop>0?e.fixedTop:0,s=n.innerHeight-(e.fixedTop+e.height);u=!r&&(this.toolbar.isSticky||a&&!this.toolbar._isBalloon)?i:0,c=p-(r?0:t)-u,d=g-(s>0?s:0)}}return{rmt:c,rmb:d,rt:u,tMargin:p,bMargin:g}},_setArrow(t,e){"up"===e?(t&&(t.style.visibility=""),K(t,"se-arrow-up"),J(t,"se-arrow-down")):"down"===e?(t&&(t.style.visibility=""),K(t,"se-arrow-down"),J(t,"se-arrow-up")):t&&(t.style.visibility="hidden")},_getWindowScroll(){const t=Q(o);return{top:n.scrollY,left:n.scrollX,width:t.w,height:t.h,bottom:n.scrollY+t.h,rects:{left:0,top:0,right:n.innerWidth,bottom:this.status.currentViewportHeight||n.innerHeight,noText:!0}}},constructor:hn};const cn=hn,{_w:dn}=_t;function un(t){re.call(this,t),this.range=null,this.selectionNode=null,this.__iframeFocus=!1,this.__hasScrollParents=!1,this._scrollMargin=0}un.prototype={get(){let t=null;return t="function"==typeof this.editor._shadowRoot?.getSelection?this.editor._shadowRoot.getSelection():this.frameContext.get("_ww").getSelection(),t?(this.status._range||this.frameContext.get("wysiwyg").contains(t.focusNode)||(t.removeAllRanges(),t.addRange(this._createDefaultRange())),t):null},isRange(t){return this.instanceCheck.isRange(t)},getRange(){const t=this.status._range||this._createDefaultRange(),e=this.get();if(t.collapsed===e.isCollapsed||!this.frameContext.get("wysiwyg").contains(e.focusNode)){if(this.component.is(t.startContainer)){const e=this.component.get(t.startContainer),i=e?.container;return i?this.setRange(i,0,i,1):t}return t}if(e.rangeCount>0)return this.status._range=e.getRangeAt(0),this.status._range;{const t=e.anchorNode,i=e.focusNode,s=e.anchorOffset,n=e.focusOffset,o=xt.query.compareElements(t,i),l=o.ancestor&&(0===o.result?s<=n:o.result>1);return this.setRange(l?t:i,l?s:n,l?i:t,l?n:s)}},setRange(t,e,i,s){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=i,r=s;if(!n||!l)return;(xt.check.isBreak(n)||3===n.nodeType)&&o>n.textContent.length&&(o=n.textContent.length),(xt.check.isBreak(l)||3===l.nodeType)&&r>l.textContent.length&&(r=l.textContent.length),this.format.isLine(n)&&(n=n.childNodes[o>0?n.childNodes.length-1:0]||n,o=o>0?1!==n.nodeType||xt.check.isBreak(n)?n.textContent?n.textContent.length:0:1:0),this.format.isLine(l)&&(l=l.childNodes[r>0?l.childNodes.length-1:0]||l,r=r>0?1!==l.nodeType||xt.check.isBreak(l)?l.textContent?l.textContent.length:0:1:0);const a=this.frameContext.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.status.hasFocus=!0}catch(t){return console.warn("[SUNEDITOR.selection.focus.warn]",t.message),void this.editor._nativeFocus()}const h=this.get();return h.removeAllRanges&&h.removeAllRanges(),h.addRange(a),this.status._range=a,this._rangeInfo(a,this.get()),this.frameOptions.get("iframe")&&this.__focus(),a},removeRange(){this.status._range=null,this.selectionNode=null,this.editor.effectNode=null,this.status.hasFocus&&this.get().removeAllRanges(),this.eventManager._setKeyEffect([])},getNearRange(t){const e=t.nextSibling,i=t.previousSibling;return e?{container:e,offset:0}:i?{container:i,offset:1}:null},getRangeAndAddLine(t,e){if(this._isNone(t)){const i=e?.parentElement||this.frameContext.get("wysiwyg"),s=xt.utils.createElement(this.options.get("defaultLine"),null,"<br>");i.insertBefore(s,e&&e!==i?e.previousElementSibling?e.nextElementSibling:e:i.firstElementChild),this.setRange(s.firstElementChild,0,s.firstElementChild,1),t=this.status._range}return t},getNode(){if(this.frameContext.get("wysiwyg").contains(this.selectionNode)||this._init(),!this.selectionNode){const t=xt.query.getEdgeChild(this.frameContext.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 i=!!xt.check.isElement(t)&&"absolute"===dn.getComputedStyle(t).position;t=!t||xt.check.isText(t)?this.getRange():t;const s=this.offset.getGlobalScroll();let n="start"===e,o=s.left,l=s.top,r=t.getClientRects();if(r=r[n?0:r.length-1],!r){const t=this.getNode();if(this.format.isLine(t)){const t=xt.utils.createTextNode(Ct.zeroWidthSpace);this.html.insertNode(t,{afterNode:null,skipCharCount:!0}),this.setRange(t,1,t,1),this._init(),r=this.getRange().getClientRects(),r=r[n?0:r.length-1]}if(!r){const e=this.offset.get(t);r={left:e.left,top:e.top,right:e.left+t.offsetWidth,bottom:e.top+t.offsetHeight,noText:!0},o=0,l=0}n=!0}const a=/^iframe$/i.test(this.frameContext.get("wysiwygFrame").nodeName)?this.frameContext.get("wysiwygFrame").getClientRects()[0]:null;return!i&&a&&(r={left:r.left+a.left,top:r.top+a.top,right:r.right+a.right-a.width,bottom:r.bottom+a.bottom-a.height}),{rects:r,position:n?"start":"end",scrollLeft:o,scrollTop:l}},getDragEventLocationRange(t){const e=this.frameContext.get("_wd");let i,s,n,o,l;return e.caretPositionFromPoint?(i=e.caretPositionFromPoint(t.clientX,t.clientY),s=i.offsetNode,n=i.offset,o=i.offsetNode,l=i.offset):e.caretRangeFromPoint&&(i=e.caretRangeFromPoint(t.clientX,t.clientY),s=i.startContainer,n=i.startOffset,o=i.endContainer,l=i.endOffset),{sc:s,so:n,ec:o,eo:l}},scrollTo(t,e){this.instanceCheck.isSelection(t)?t=t.getRangeAt(0):this.instanceCheck.isNode(t)?t=this.setRange(t,1,t,1):void 0===t?.startContainer&&console.warn('[SUNEDITOR.html.scrollTo.warn] "selectionRange" must be Selection or Range or Node object.',t),e={behavior:"smooth",block:"nearest",inline:"nearest",...e};const i=xt.query.getParentElement(t.startContainer,(t=>1===t.nodeType)),{frameContext:s,frameOptions:n}=this.editor,o=s.get("_ww"),l=s.get("wysiwygFrame"),r=n.get("iframe"),a=!this.status.isScrollable(),h=this.status.currentViewportHeight,c=a?dn.scrollY:r?o.scrollY:l.scrollTop,d=this.context.get("toolbar_main").offsetHeight,u=this.toolbar.isSticky?d:0,p=this.toolbar.isSticky?u+this.options.get("toolbar_sticky"):u,g=s.get("statusbar")?.offsetHeight||0;if(this.__hasScrollParents)return i?.scrollIntoView(e),void("auto"===e?.behavior&&c!==dn.scrollY&&(p&&c>dn.scrollY?dn.scrollBy(0,-p):a&&dn.scrollBy(0,g)));const m=this._scrollMargin,f=a?h:l.offsetHeight,b=i.offsetHeight||0,y=e?.behavior;if(a)if(r){const e=this.getRects(t,"end").rects,i=e.top+b-p,s=f-m-(e.top+b);if(i>=0&&s>=0)return;const n=c-(i<0?-(i-m):s);dn.scrollTo({top:n<c?n-p:n,behavior:y})}else{const t=f+c-this.offset.getGlobal(i).top-b;if(t-m>0&&f>t+m+p)return;const e=t<=m?c-t+m+g:c-t+(f-b-m);dn.scrollTo({top:e<c?e-p:e,behavior:y})}else{const{rects:t}=this.getRects(i,"start"),{top:e}=this.offset.getLocal(i),s=e<0&&t.top<0?e:t.top,n=s-m>0&&s+m<=f;let a=c+(s-m>0?s+m-f:s-(u+b));const p=dn.scrollY,v=this.offset.getGlobal(),_=p-v.top+d,C=v.top+v.height-(p+h)+d;if(_>0){const t=(n?s:s+c-a)-b-m-_;t<0&&(a+=d,dn.scrollTo({top:p+t,behavior:"smooth"}))}if(C>0){const t=(n?s:s+c-a)+b+m-(v.height-C);t>0&&(a+=g,dn.scrollTo({top:p+t,behavior:"smooth"}))}n||(r?o:l).scrollTo({top:a,behavior:y})}},_isNone(t){const e=t.commonAncestorContainer;return xt.check.isWysiwygFrame(t.startContainer)&&xt.check.isWysiwygFrame(t.endContainer)||/FIGURE/i.test(e.nodeName)||this.editor._fileManager.regExp.test(e.nodeName)&&(!this.editor._fileManager.tagAttrs[e.nodeName]||this.editor._fileManager.tagAttrs[e.nodeName]?.every((t=>e.hasAttribute(t))))||this.component.is(e)},_createDefaultRange(){const t=this.frameContext.get("wysiwyg"),e=this.frameContext.get("_wd").createRange();let i=t.firstElementChild,s=null;return i?(s=i.firstChild,s||(s=xt.utils.createElement("BR"),i.appendChild(s))):(s=xt.utils.createElement("BR"),i=xt.utils.createElement(this.options.get("defaultLine"),null,s),t.appendChild(i)),e.setStart(s,0),e.setEnd(s,0),e},_rangeInfo(t,e){let i=null;this.status._range=t,i=t.collapsed?xt.check.isWysiwygFrame(t.commonAncestorContainer)&&t.commonAncestorContainer.children[t.startOffset]||t.commonAncestorContainer:e.anchorNode,this.selectionNode=i},_init(){const t=this.frameContext.get("_wd").activeElement;if(xt.check.isInputElement(t))return this.selectionNode=t,t;const e=this.get();if(!e)return null;let i=null;i=e.rangeCount>0?e.getRangeAt(0):this._createDefaultRange(),this._rangeInfo(i,e)},__focus(){try{this.__iframeFocus=!0;const t=xt.query.getParentElement(this.getNode(),"figcaption");t?t.focus():this.frameContext.get("wysiwyg").focus()}finally{dn.setTimeout((()=>this.__iframeFocus=!1),0)}},_resetRangeToTextNode(){let t=this.getRange();if(this._isNone(t)){if(!xt.check.isWysiwygFrame(t.startContainer)||!xt.check.isWysiwygFrame(t.endContainer))return!1;const e=t.commonAncestorContainer,i=e.children[t.startOffset],s=e.children[t.endOffset];if(!(t=this.setRange(i,0,s,i===s?0:1)))return!1}const e=t,i=e.collapsed;let s,n,o,l=e.startContainer,r=e.startOffset,a=e.endContainer,h=e.endOffset;if(this.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.format.isLine(a)){for(a=a.childNodes[h]||a.lastChild||a;1===a?.nodeType&&a.lastChild;)a=a.lastChild;i?h=0:h>0&&(h=a.textContent.length)}if(s=xt.check.isWysiwygFrame(l)?this.frameContext.get("wysiwyg").firstChild:l,n=r,xt.check.isBreak(s)||1===s.nodeType&&s.childNodes.length>0){const t=xt.check.isBreak(s);if(!t){const t=s;for(;s&&!xt.check.isBreak(s)&&1===s.nodeType&&(o=s.childNodes,0!==o.length);)s=o[n>0?n-1:n]||!/FIGURE/i.test(o[0].nodeName)?o[0]:s.previousElementSibling||s.previousSibling||l,n=n>0?s.textContent.length:n;let e=this.format.getLine(s,null);e===this.format.getBlock(e,null)&&(s||=t,e=xt.utils.createElement(xt.query.getParentElement(s,xt.check.isTableCell)?"DIV":this.options.get("defaultLine")),s.parentNode.insertBefore(e,s),s!==t&&e.appendChild(s))}if(xt.check.isBreak(s)||this.component.is(s)){const e=xt.utils.createTextNode(Ct.zeroWidthSpace);s.parentNode.insertBefore(e,s),s=e,t&&l===a&&(a=s,h=1)}}if(l=s,r=n,s=xt.check.isWysiwygFrame(a)?this.frameContext.get("wysiwyg").lastChild:a,n=h,xt.check.isBreak(s)||1===s.nodeType&&s.childNodes.length>0){const t=xt.check.isBreak(s);if(!t){for(;s&&!xt.check.isBreak(s)&&1===s.nodeType&&(o=s.childNodes,0!==o.length);)s=o[n>0?n-1:n]||!/FIGURE/i.test(o[0].nodeName)?o[0]:s.previousElementSibling||s.previousSibling||l,n=n>0?s.textContent.length:n;let t=this.format.getLine(s,null);t===this.format.getBlock(t,null)&&(t=xt.utils.createElement(xt.check.isTableCell(t)?"DIV":this.options.get("defaultLine")),s.parentNode.insertBefore(t,s),t.appendChild(s))}if(xt.check.isBreak(s)){const e=xt.utils.createTextNode(Ct.zeroWidthSpace);s.parentNode.insertBefore(e,s),s=e,n=1,t&&!s.previousSibling&&xt.utils.removeItem(a)}}return a=s,h=n,this.setRange(l,r,a,h),!0},__init(){this.__hasScrollParents=this.eventManager?.scrollparents.length>0,this._scrollMargin=this.frameContext?.get("wysiwyg")?(kt.get(dn.getComputedStyle(this.frameContext.get("wysiwyg")).scrollMargin,0)||40)+kt.get(dn.getComputedStyle(this.frameContext.get("wrapper")).paddingBottom,0):40},constructor:un};const pn=un;function gn(t){this.editor=t,this.isDisabled=!1}gn.prototype={command(t,e,i,s,n,o,l,r){if(this.isDisabled)return!1;let a=null;return a=e?this.editor.shortcutsKeyMap.get(s+(i?"1000":"")):this.editor.shortcutsKeyMap.get(n)||this.editor.shortcutsKeyMap.get(n+t.key),!(!a||!i&&a.s||a.space&&!Et.isSpace(s)||a.enter&&!Et.isEnter(s)||a.textTrigger&&!t.key.trim()||a.edge&&!o)&&(a.plugin&&"string"==typeof a.method?this.editor.plugins[a.plugin][a.method]?.({range:r,line:l,info:a,event:t,keyCode:s}):"function"==typeof a.method?a.method({range:r,line:l,info:a,event:t,keyCode:s,editor:this.editor}):this.editor.run(a.command,a.type,a.button),!0)},disable(){this.isDisabled=!0},enable(){this.isDisabled=!1},constructor:gn};const mn=gn,{_w:fn}=_t;function bn(t,{keyName:e,balloon:i,inline:s,balloonAlways:n,res:o}){re.call(this,t),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.isSticky=!1,this._isBalloon=i,this._isInline=s,this._isBalloonAlways=n,this._responsiveCurrentSize="default",this._originRes=o,this._rButtonArray=o,this._rButtonsInfo=null,this._rButtonsize=null,this._isViewPortSize="visualViewport"in fn,this._inlineToolbarAttr={top:"",width:"",isShow:!1},this._balloonOffset={top:0,left:0},this._setResponsive()}bn.prototype={disable(){this._moreLayerOff(),this.menu.dropdownOff(),this.menu.containerOff(),xt.utils.setDisabled(this.context.get(this.keyName.buttonTray).querySelectorAll(".se-menu-list .se-toolbar-btn[data-type]"),!0)},enable(){xt.utils.setDisabled(this.context.get(this.keyName.buttonTray).querySelectorAll(".se-menu-list .se-toolbar-btn[data-type]"),!1)},show(){this._isInline?this._showInline():this._isBalloon?this._showBalloon():(this.context.get(this.keyName.main).style.display="",this.isSub||(this.frameContext.get("_stickyDummy").style.display="")),this.isSub||this.resetResponsiveToolbar()},hide(){this._isInline?(this.context.get(this.keyName.main).style.display="none",this.context.get(this.keyName.main).style.top="0px",this._inlineToolbarAttr.isShow=!1):(this.context.get(this.keyName.main).style.display="none",this.isSub||(this.frameContext.get("_stickyDummy").style.display="none"),this._isBalloon&&(this._balloonOffset={top:0,left:0}))},resetResponsiveToolbar(){this.menu.containerOff();const t=this._rButtonsize;if(t){let e=0;e=(this._isBalloon||this._isInline)&&"auto"===this.options.get("toolbar_width")||this.editor.isSubBalloon&&"auto"===this.options.get("toolbar_sub_width")?this.frameContext.get("topArea").offsetWidth:this.context.get(this.keyName.main).offsetWidth;let i="default";for(let s=1,n=t.length;s<n;s++)if(e<t[s]){i=t[s]+"";break}this._responsiveCurrentSize!==i&&(this._responsiveCurrentSize=i,this.setButtons(this._rButtonsInfo[i]))}},setButtons(t){this._moreLayerOff(),this.menu.dropdownOff(),this.menu.containerOff();const{icons:e,lang:i}=this,s=jt(t,this.plugins,this.editor.__options,e,i,!0);s.updateButtons.forEach((t=>Yt(t.button,t.plugin,this.icons,this.lang))),this.context.get(this.keyName.main).replaceChild(s.buttonTray,this.context.get(this.keyName.buttonTray)),this.context.set(this.keyName.buttonTray,s.buttonTray),this._resetButtonInfo(),this.triggerEvent("onSetToolbarButtons",{buttonTray:s.buttonTray,frameContext:this.frameContext})},_resetButtonInfo(){this.editor.allCommandButtons=new Map,this.editor.subAllCommandButtons=new Map,this.editor.commandTargets=new Map,this.editor.shortcutsKeyMap=new Map,this.editor.__cachingButtons(),this.editor.__cachingShortcuts(),this.history.resetButtons(this.frameContext.get("key"),null),this._resetSticky(),this.editor.effectNode=null,this.viewer._setButtonsActive(),this.status.hasFocus&&this.eventManager.applyTagEffect(),this.frameContext.get("isReadOnly")&&this.ui.setControllerOnDisabledButtons(!0)},_resetSticky(){const t=this.frameContext.get("wrapper");if(!t)return;const e=this.context.get(this.keyName.main),i=this.options.get("toolbar_sticky");if(this.frameContext.get("isFullScreen")||0===e.offsetWidth||i<0)return;const s=this._isViewPortSize?fn.visualViewport.pageTop:fn.scrollY,n=this.frameContext.get("_minHeight"),o=t.offsetHeight,l=this.offset.getGlobal(this.frameContext.get("topArea")),r=s+i,a=(this._isBalloon||this._isInline?l.top:this.offset.getGlobal(this.options.get("toolbar_container")).top)-(this._isInline?e.offsetHeight:0),h=this.options.get("toolbar_container")?l.top-s+o-n-i-e.offsetHeight:o+a+i-r-n;r<a?this._offSticky():h<0?(this.isSticky||this._onSticky(1),e.style.top=1+h+this.__getViewportTop()+"px"):this._onSticky(1)},_onSticky(t){const e=this.context.get(this.keyName.main);if(!this._isInline){const t=this.options.get("toolbar_container")?this.context.get("_stickyDummy"):this.frameContext.get("_stickyDummy");t.style.height=e.offsetHeight+"px",t.style.display="block"}const i=this.options.get("toolbar_sticky")+t+this.__getViewportTop();e.style.top=`${i}px`,e.style.width=this._isInline?this._inlineToolbarAttr.width:e.offsetWidth+"px",xt.utils.addClass(e,"se-toolbar-sticky"),this.isSticky=!0},__getViewportTop(){return this._isViewPortSize?fn.visualViewport.offsetTop:0},_offSticky(){(this.options.get("toolbar_container")?this.context.get("_stickyDummy"):this.frameContext.get("_stickyDummy")).style.display="none";const t=this.context.get(this.keyName.main);t.style.top=this._isInline?this._inlineToolbarAttr.top:"",t.style.width=this._isInline?this._inlineToolbarAttr.width:"",this.frameContext.get("wrapper").style.marginTop="",xt.utils.removeClass(t,"se-toolbar-sticky"),this.isSticky=!1},_setResponsive(){if(0===this._rButtonArray?.length)return void(this._rButtonArray=null);this._responsiveCurrentSize="default";const t=this._rButtonsize=[],e=this._originRes,i=this._rButtonsInfo={default:e[0]};for(let s,n,o=1,l=e.length;o<l;o++)n=e[o],s=1*n[0],t.push(s),i[s]=n[1];t.sort(((t,e)=>t-e)).unshift("default")},_showBalloon(t){if(!this._isBalloon)return;this.isSub&&this.resetResponsiveToolbar();const e=t||this.selection.getRange(),i=this.context.get(this.keyName.main),s=this.selection.get();let n;if(this._isBalloonAlways&&e.collapsed)n=!0;else if(s.focusNode===s.anchorNode)n=s.focusOffset<s.anchorOffset;else{const t=xt.query.getListChildNodes(e.commonAncestorContainer,null,null);n=xt.utils.getArrayIndex(t,s.focusNode)<xt.utils.getArrayIndex(t,s.anchorNode)}this._setBalloonOffset(n,e),this.triggerEvent("onShowToolbar",{toolbar:i,mode:"balloon",frameContext:this.frameContext})},_setBalloonOffset(t,e){const i=this.context.get(this.keyName.main),s=this.frameContext.get("topArea"),n=this.offset.getGlobal(s).top;if(!this.offset.setRangePosition(i,e,{position:t?"top":"bottom",addTop:n}))return void this.hide();if(this.options.get("toolbar_container")){const t=s.parentElement;let e=this.options.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;i.style.left=i.offsetLeft-n+s.offsetLeft+"px",i.style.top=i.offsetTop-o+s.offsetTop+"px"}const o=this.offset.getWWScroll();this._balloonOffset={top:i.offsetTop+o.top,left:i.offsetLeft+o.left,position:t?"top":"bottom"}},_showInline(){if(!this._isInline)return;const t=this.context.get(this.keyName.main);t.style.visibility="hidden",this._offSticky(),t.style.display="block",t.style.top="0px",this._inlineToolbarAttr.width=t.style.width=this.options.get(this.keyName.width),this._inlineToolbarAttr.top=t.style.top=this.offset.getGlobal(this.frameContext.get("topArea")).top-this.offset.getGlobal(t).top-t.offsetHeight-1+"px",this._resetSticky(),this._inlineToolbarAttr.isShow=!0,this.triggerEvent("onShowToolbar",{toolbar:t,mode:"inline",frameContext:this.frameContext}),t.style.visibility=""},_moreLayerOn(t,e){this._moreLayerOff(),this.currentMoreLayerActiveButton=t,e.style.display="block"},_moreLayerOff(){if(this.currentMoreLayerActiveButton){this.context.get(this.keyName.main).querySelector("."+this.currentMoreLayerActiveButton.getAttribute("data-command")).style.display="none",xt.utils.removeClass(this.currentMoreLayerActiveButton,"on"),this.currentMoreLayerActiveButton=null}},constructor:bn};const yn=bn,{_w:vn}=_t;function _n(t){re.call(this,t),this._controllerOnBtnDisabled=!1;const e=function({lang:t,icons:e}){const i='<div><button class="close" data-command="close" title="'+t.close+'">'+e.cancel+"</button></div><div><span></span></div>";return xt.utils.createElement("DIV",{class:"se-alert-content"},i)}(t);this.alertModal=e,this.alertMessage=e.querySelector("span"),this._alertArea=this.carrierWrapper.querySelector(".se-alert"),this._alertInner=this.carrierWrapper.querySelector(".se-alert .se-modal-inner"),this._alertInner.appendChild(e),this._closeListener=[wn.bind(this),Cn.bind(this)],this._closeSignal=!this.eventManager.addEvent(e.querySelector('[data-command="close"]'),"click",this.alertClose.bind(this)),this._bindClose=null,this._backWrapper=this.carrierWrapper.querySelector(".se-back-wrapper");const i=function(){const t='<div class="se-toast-container"><span></span></div>';return xt.utils.createElement("DIV",{class:"se-toast"},t)}();this.toastPopup=i,this.toastContainer=i.querySelector(".se-toast-container"),this.toastMessage=i.querySelector("span"),this.carrierWrapper.appendChild(i),this._toastToggle=null}function Cn(t){const e=xt.query.getEventTarget(t);(/close/.test(e.getAttribute("data-command"))||e===this._alertInner)&&this.alertClose()}function wn(t){Et.isEsc(t.code)&&this.alertClose()}_n.prototype={setEditorStyle(t,e){e||=this.frameContext;const i=e.get("options");i.set("editorStyle",t);const s=wt._setDefaultOptionStyle(i,t);i.set("_defaultStyles",s),e.get("topArea").style.cssText=s.top;const n=e.get("code");n.style.cssText=i.get("_defaultStyles").frame,n.style.display="none",i.get("iframe")?(e.get("wysiwygFrame").style.cssText=s.frame,e.get("wysiwyg").style.cssText=s.editor):e.get("wysiwygFrame").style.cssText=s.frame+s.editor},setTheme(t){if("string"!=typeof t)return;const e=this.options,i=e.get("_themeClass").trim();e.set("theme",t||""),e.set("_themeClass",t?` se-theme-${t}`:""),t=e.get("_themeClass").trim();const s=e=>{e&&(i&&xt.utils.removeClass(e,i),t&&xt.utils.addClass(e,t))};s(this.carrierWrapper),this.editor.applyFrameRoots((t=>{s(t.get("topArea")),s(t.get("wysiwyg"))})),s(this.context.get("statusbar_wrapper")),s(this.context.get("toolbar_wrapper"))},readOnly(t,e){const i=e?this.frameRoots.get(e):this.frameContext;i.set("isReadOnly",!!t),xt.utils.setDisabled(this.editor._controllerOnDisabledButtons,!!t),t?(this._offCurrentController(),this._offCurrentModal(),this.toolbar?.currentMoreLayerActiveButton?.disabled&&this.toolbar._moreLayerOff(),this.subToolbar?.currentMoreLayerActiveButton?.disabled&&this.subToolbar._moreLayerOff(),this.menu?.currentDropdownActiveButton?.disabled&&this.menu.dropdownOff(),this.menu?.currentContainerActiveButton?.disabled&&this.menu.containerOff(),i.get("code").setAttribute("readOnly","true"),xt.utils.addClass(i.get("wysiwyg"),"se-read-only")):(i.get("code").removeAttribute("readOnly"),xt.utils.removeClass(i.get("wysiwyg"),"se-read-only")),this.options.get("hasCodeMirror")&&this.viewer._codeMirrorEditor("readonly",!!t,e)},disable(t){const e=t?this.frameRoots.get(t):this.frameContext;this.toolbar.disable(),this._offCurrentController(),this._offCurrentModal(),e.get("wysiwyg").setAttribute("contenteditable",!1),e.set("isDisabled",!0),this.options.get("hasCodeMirror")?this.viewer._codeMirrorEditor("readonly",!0,t):e.get("code").disabled=!0},enable(t){const e=t?this.frameRoots.get(t):this.frameContext;this.toolbar.enable(),e.get("wysiwyg").setAttribute("contenteditable",!0),e.set("isDisabled",!1),this.options.get("hasCodeMirror")?this.viewer._codeMirrorEditor("readonly",!1,t):e.get("code").disabled=!1},show(t){const e=(t?this.frameRoots.get(t):this.frameContext).get("topArea").style;"none"===e.display&&(e.display="block")},hide(t){(t?this.frameRoots.get(t):this.frameContext).get("topArea").style.display="none"},showLoading(t){(t?this.frameRoots.get(t).get("container"):this.carrierWrapper).querySelector(".se-loading-box").style.display="block"},hideLoading(t){(t?this.frameRoots.get(t).get("container"):this.carrierWrapper).querySelector(".se-loading-box").style.display="none"},setControllerOnDisabledButtons(t){t&&!this._controllerOnBtnDisabled?(xt.utils.setDisabled(this.editor._controllerOnDisabledButtons,!0),this._controllerOnBtnDisabled=!0):!t&&this._controllerOnBtnDisabled&&(xt.utils.setDisabled(this.editor._controllerOnDisabledButtons,!1),this._controllerOnBtnDisabled=!1)},enableBackWrapper(t){this._backWrapper.style.cursor=t,this._backWrapper.style.display="block"},disableBackWrapper(){this._backWrapper.style.display="none",this._backWrapper.style.cursor="default"},alertOpen(t,e){this.alertMessage.textContent=t,xt.utils.removeClass(this.alertModal,"se-alert-error|se-alert-success"),e&&xt.utils.addClass(this.alertModal,`se-alert-${e}`),this._closeSignal&&this._alertInner.addEventListener("click",this._closeListener[1]),this._bindClose&&=this.eventManager.removeGlobalEvent(this._bindClose),this._bindClose=this.eventManager.addGlobalEvent("keydown",this._closeListener[0]),this._alertArea.style.display="block",xt.utils.addClass(this.alertModal,"se-modal-show")},alertClose(){xt.utils.removeClass(this.alertModal,"se-modal-show"),xt.utils.removeClass(this.alertModal,"se-alert-*"),this._alertArea.style.display="none",this._closeSignal&&this._alertInner.removeEventListener("click",this._closeListener[1]),this._bindClose&&=this.eventManager.removeGlobalEvent(this._bindClose)},showToast(t,e=1e3,i){xt.utils.hasClass(this.toastContainer,"se-toast-show")&&this.closeToast(),xt.utils.removeClass(this.toastPopup,"se-toast-error|se-toast-success"),i&&xt.utils.addClass(this.toastPopup,`se-toast-${i}`),this.toastPopup.style.display="block",this.toastMessage.textContent=t,xt.utils.addClass(this.toastContainer,"se-toast-show"),this._toastToggle=vn.setTimeout((()=>{this.closeToast()}),e)},closeToast(){this._toastToggle&&vn.clearTimeout(this._toastToggle),this._toastToggle=null,xt.utils.removeClass(this.toastContainer,"se-toast-show"),this.toastPopup.style.display="none"},_visibleControllers(t,e){const i=t?"":"hidden",s=e??i?"":"hidden",n=this.editor.opendControllers;for(let t,e=0;e<n.length;e++)t=n[e],t.form&&(t.form.style.visibility=i);this.editor._lineBreaker_t.style.visibility=s,this.editor._lineBreaker_b.style.visibility=s},_offCurrentController(){this.component.__deselect()},__offControllers(){const t=this.editor.opendControllers,e=[];for(let i,s=0;s<t.length;s++)i=t[s],i.fixed?e.push(i):(i.inst.controllerClose?.(),i.form&&(i.form.style.display="none"));this.editor.opendControllers=e,this.editor.currentControllerName="",this.editor._preventBlur=!1},_offCurrentModal(){this.editor.opendModal&&this.editor.opendModal.close()},constructor:_n};const xn=_n,{_w:kn,_d:En}=_t;function Sn(t){re.call(this,t),this.bodyOverflow="",this.editorAreaOriginCssText="",this.wysiwygOriginCssText="",this.codeWrapperOriginCssText="",this.codeOriginCssText="",this.codeNumberOriginCssText="",this.toolbarOriginCssText="",this.arrowOriginCssText="",this.fullScreenInnerHeight=0,this.fullScreenSticky=!1,this.fullScreenBalloon=!1,this.fullScreenInline=!1,this.toolbarParent=null}function Tn(t){const e=_t._w.getComputedStyle(t).lineHeight;let i;if(kt.is(e))i=kt.get(e);else{const e=_t._w.getComputedStyle(t).fontSize;i=1.2*kt.get(e)}return i}Sn.prototype={codeView(t){const e=this.frameContext;if(void 0===t&&(t=!e.get("isCodeView")),t===e.get("isCodeView"))return;e.set("isCodeView",t),this.ui._offCurrentController(),this.ui._offCurrentModal();const i=e.get("codeWrapper"),s=e.get("code"),n=e.get("wysiwygFrame"),o=e.get("wrapper");t?(this._setEditorDataToCodeView(),i.style.setProperty("display","flex","important"),n.style.display="none",e.get("isFullScreen")?s.style.height="100%":"auto"!==this.frameOptions.get("height")||this.options.get("hasCodeMirror")||(s.style.height=s.scrollHeight>0?s.scrollHeight+"px":"auto"),this.options.get("hasCodeMirror")&&this._codeMirrorEditor("refresh",null,null),e.get("isFullScreen")||(this.editor._notHideToolbar=!0,this.editor.isBalloon&&(this.context.get("toolbar_arrow").style.display="none",this.context.get("toolbar_main").style.left="",this.editor.isInline=this.toolbar._isInline=!0,this.editor.isBalloon=this.toolbar._isBalloon=!1,this.toolbar._showInline())),this.editor.isSubBalloon&&this.subToolbar.hide(),function(t){const e=t.get("codeNumbers");if(!e)return;const i=Tn(e),s=t.get("code").scrollHeight/i;let n="";for(let t=1;t<=s;t++)n+=`${t}\n`;const{padding:o,margin:l}=_t._w.getComputedStyle(t.get("code"));e.value=n,e.style.padding=o||"",e.style.margin=l||""}(e),this.status._range=null,s.focus(),xt.utils.addClass(this.editor.commandTargets.get("codeView"),"active"),xt.utils.addClass(o,"se-code-view-status")):(xt.check.isNonEditable(n)||this._setCodeDataToEditor(),n.scrollTop=0,i.style.setProperty("display","none","important"),n.style.display="block","auto"!==this.frameOptions.get("height")||this.options.get("hasCodeMirror")||(e.get("code").style.height="0px"),e.get("isFullScreen")||(this.editor._notHideToolbar=!1,/balloon/.test(this.options.get("mode"))&&(this.context.get("toolbar_arrow").style.display="",this.editor.isInline=this.toolbar._isInline=!1,this.editor.isBalloon=this.toolbar._isBalloon=!0,this.eventManager._hideToolbar())),this.editor._nativeFocus(),xt.utils.removeClass(this.editor.commandTargets.get("codeView"),"active"),xt.check.isNonEditable(n)||(this.history.push(!1),this.history.resetButtons(e.get("key"),null)),xt.utils.removeClass(o,"se-code-view-status")),this.editor._checkPlaceholder(e),xt.utils.setDisabled(this.editor._codeViewDisabledButtons,t),e.has("documentType_use_header")&&(t?e.get("documentTypeInner").style.display="none":(e.get("documentTypeInner").style.display="",e.get("documentType").reHeader())),this.triggerEvent("onToggleCodeView",{frameContext:e,is:e.get("isCodeView")})},fullScreen(t){const e=this.frameContext;if(void 0===t&&(t=!e.get("isFullScreen")),t===e.get("isFullScreen"))return;e.set("isFullScreen",t);const i=e.get("topArea"),s=this.context.get("toolbar_main"),n=e.get("wrapper"),o=e.get("wysiwygFrame"),l=e.get("codeWrapper"),r=e.get("code"),a=e.get("codeNumbers"),h=this.frameContext.get("isCodeView"),c=this.context.get("toolbar_arrow");this.ui._offCurrentController();const d="none"===s.style.display||this.editor.isInline&&!this.toolbar._inlineToolbarAttr.isShow;if(t){this._originCssText=i.style.cssText,this.editorAreaOriginCssText=n.style.cssText,this.wysiwygOriginCssText=o.style.cssText,this.codeWrapperOriginCssText=l.style.cssText,this.codeOriginCssText=r.style.cssText,this.codeNumberOriginCssText=a?.style.cssText,this.toolbarOriginCssText=s.style.cssText,c&&(this.arrowOriginCssText=c.style.cssText),(this.editor.isBalloon||this.editor.isInline)&&(c&&(c.style.display="none"),this.fullScreenInline=this.editor.isInline,this.fullScreenBalloon=this.editor.isBalloon,this.editor.isInline=this.toolbar._isInline=!1,this.editor.isBalloon=this.toolbar._isBalloon=!1),this.options.get("toolbar_container")&&(this.toolbarParent=s.parentElement,e.get("container").insertBefore(s,n)),i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.width="100%",i.style.maxWidth="100%",i.style.height="100%",i.style.zIndex="2147483639","none"!==e.get("_stickyDummy").style.display&&""!==e.get("_stickyDummy").style.display&&(this.fullScreenSticky=!0,e.get("_stickyDummy").style.display="none",xt.utils.removeClass(s,"se-toolbar-sticky")),this.bodyOverflow=En.body.style.overflow,En.body.style.overflow="hidden",n.style.cssText=s.style.cssText="",o.style.cssText=(o.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+this.frameOptions.get("_defaultStyles").editor+(h?"display: none;":""),l.style.cssText=(l.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+`display: ${h?"flex":"none"} !important;`,l.style.overflow="auto",l.style.height="100%",r.style.height="",s.style.width=o.style.height="100%",s.style.position="relative",s.style.display="block",this.fullScreenInnerHeight=kn.innerHeight-s.offsetHeight,n.style.height=this.fullScreenInnerHeight-(e.has("statusbar")?e.get("statusbar").offsetHeight:0)-this.options.get("fullScreenOffset")+"px",this.frameOptions.get("iframe")&&"auto"===this.frameOptions.get("height")&&(n.style.overflow="auto",this.editor._iframeAutoHeight(e)),e.get("topArea").style.marginTop=this.options.get("fullScreenOffset")+"px";const t=this.icons.reduction;this.editor.applyCommandTargets("fullScreen",(e=>{xt.utils.changeElement(e.firstElementChild,t),xt.utils.addClass(e,"active")}))}else{o.style.cssText=this.wysiwygOriginCssText.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+(h?"display: none;":""),l.style.cssText=this.codeWrapperOriginCssText.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+`display: ${h?"flex":"none"} !important;`,r.style.cssText=this.codeOriginCssText,a&&(a.style.cssText=this.codeNumberOriginCssText),s.style.cssText=this.toolbarOriginCssText,n.style.cssText=this.editorAreaOriginCssText,i.style.cssText=this._originCssText,c&&(c.style.cssText=this.arrowOriginCssText),En.body.style.overflow=this.bodyOverflow,"auto"!==this.frameOptions.get("height")||this.options.get("hasCodeMirror")||this._codeViewAutoHeight(e.get("code"),e.get("codeNumbers"),!0),this.toolbarParent&&(this.toolbarParent.appendChild(s),this.toolbarParent=null),this.options.get("toolbar_sticky")>-1&&xt.utils.removeClass(s,"se-toolbar-sticky"),this.fullScreenSticky&&!this.options.get("toolbar_container")&&(this.fullScreenSticky=!1,e.get("_stickyDummy").style.display="block",xt.utils.addClass(s,"se-toolbar-sticky")),this.editor.isInline=this.toolbar._isInline=this.fullScreenInline,this.editor.isBalloon=this.toolbar._isBalloon=this.fullScreenBalloon,e.get("isCodeView")||(this.editor.isInline?this.toolbar._showInline():this.editor.isBalloon&&this.toolbar._showBalloon()),this.toolbar._resetSticky(),e.get("topArea").style.marginTop="";const t=this.icons.expansion;this.editor.applyCommandTargets("fullScreen",(e=>{xt.utils.changeElement(e.firstElementChild,t),xt.utils.removeClass(e,"active")}))}d&&!e.get("isCodeView")&&this.toolbar.hide(),this.triggerEvent("onToggleFullScreen",{frameContext:e,is:e.get("isFullScreen")})},showBlocks(t){const e=this.frameContext;void 0===t&&(t=!e.get("isShowBlocks")),e.set("isShowBlocks",!!t),t?(xt.utils.addClass(e.get("wysiwyg"),"se-show-block"),xt.utils.addClass(this.editor.commandTargets.get("showBlocks"),"active")):(xt.utils.removeClass(e.get("wysiwyg"),"se-show-block"),xt.utils.removeClass(this.editor.commandTargets.get("showBlocks"),"active")),this.editor._resourcesStateChange(e)},_setButtonsActive(){const t=this.frameContext;if(t.get("isCodeView")?xt.utils.addClass(this.editor.commandTargets.get("codeView"),"active"):xt.utils.removeClass(this.editor.commandTargets.get("codeView"),"active"),t.get("isFullScreen")){const t=this.icons.reduction;this.editor.applyCommandTargets("fullScreen",(e=>{xt.utils.changeElement(e.firstElementChild,t),xt.utils.addClass(e,"active")}))}else{const t=this.icons.expansion;this.editor.applyCommandTargets("fullScreen",(e=>{xt.utils.changeElement(e.firstElementChild,t),xt.utils.removeClass(e,"active")}))}t.get("isShowBlocks")?xt.utils.addClass(this.editor.commandTargets.get("showBlocks"),"active"):xt.utils.removeClass(this.editor.commandTargets.get("showBlocks"),"active")},print(){const t=xt.utils.createElement("IFRAME",{style:"display: none;"});En.body.appendChild(t);const e=kn.getComputedStyle(this.frameContext.get("wysiwyg")).padding,i=this.options.get("printTemplate")?this.options.get("printTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.html.get()):this.html.get(),s=xt.query.getIframeDocument(t),n=this.frameContext.get("_wd"),o=this.options.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.frameOptions.get("iframe")){const t=this.options.get("printClass")?'class="'+this.options.get("printClass")+o+'"':this.frameOptions.get("iframe_fullPage")?xt.utils.getAttributesToString(n.body,["contenteditable"]):'class="'+this.options.get("_editableClass")+o+'"';s.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${i}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}else{const t=En.head.getElementsByTagName("link"),e=En.head.getElementsByTagName("style");let n="";for(let e=0,i=t.length;e<i;e++)n+=t[e].outerHTML;for(let t=0,i=e.length;t<i;t++)n+=e[t].outerHTML;s.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.options.get("printClass")||this.options.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${i}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}this.ui.showLoading(),kn.setTimeout((()=>{try{if(t.focus(),_t.isEdge||_t.isChromium||"StyleMedia"in _t._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.ui.hideLoading(),xt.utils.removeItem(t)}}),1e3)},preview(){this.menu.dropdownOff(),this.menu.containerOff(),this.ui._offCurrentController(),this.ui._offCurrentModal();const t=this.options.get("previewTemplate")?this.options.get("previewTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.html.get({withFrame:!0})):this.html.get({withFrame:!0}),e=kn.open("","_blank"),i=this.frameContext.get("_wd"),s=this.options.get("_rtl")?" se-rtl":"";if(this.frameOptions.get("iframe")){const n=this.options.get("printClass")?'class="'+this.options.get("printClass")+s+'"':this.frameOptions.get("iframe_fullPage")?xt.utils.getAttributesToString(i.body,["contenteditable"]):'class="'+this.options.get("_editableClass")+s+'"';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${i.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 i=En.head.getElementsByTagName("link"),n=En.head.getElementsByTagName("style");let o="";for(let t=0,e=i.length;t<e;t++)o+=i[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.lang.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.options.get("printClass")?this.options.get("printClass"):this.options.get("_editableClass"))+s}" 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.frameContext.get("isFullScreen"))return this.fullScreenInnerHeight+=kn.innerHeight-this.context.get("toolbar_main").offsetHeight-(this.frameContext.has("statusbar")?this.frameContext.get("statusbar").offsetHeight:0)-this.fullScreenInnerHeight,this.frameContext.get("wrapper").style.height=this.fullScreenInnerHeight+"px",!0},_codeMirrorEditor(t,e,i){const s=i?this.frameRoots.get(i).get("options"):this.frameOptions;switch(t){case"set":s.has("codeMirror5Editor")?s.get("codeMirror5Editor").getDoc().setValue(e):s.has("codeMirror6Editor")&&s.get("codeMirror6Editor").dispatch({changes:{from:0,to:s.get("codeMirror6Editor").state.doc.length,insert:e}});break;case"get":if(s.has("codeMirror5Editor"))return s.get("codeMirror5Editor").getDoc().getValue();if(s.has("codeMirror6Editor"))return s.get("codeMirror6Editor").state.doc.toString();break;case"readonly":s.has("codeMirror5Editor")?s.get("codeMirror5Editor").setOption("readOnly",e):s.has("codeMirror6Editor")&&(e?s.get("codeMirror6Editor").contentDOM.removeAttribute("contenteditable"):s.get("codeMirror6Editor").contentDOM.setAttribute("contenteditable",!0));break;case"refresh":s.has("codeMirror5Editor")&&s.get("codeMirror5Editor").refresh()}},_setCodeView(t){this.options.get("hasCodeMirror")?this._codeMirrorEditor("set",t,null):this.frameContext.get("code").value=t},_getCodeView(){return this.options.get("hasCodeMirror")?this._codeMirrorEditor("get",null,null):this.frameContext.get("code").value},_setCodeDataToEditor(){const t=this._getCodeView();if(this.frameOptions.get("iframe_fullPage")){const e=this.frameContext.get("_wd"),i=(new DOMParser).parseFromString(t,"text/html");if(!this.html.__disallowedTagNameRegExp.test("script")){const t=i.head.children;for(let e=0,s=t.length;e<s;e++)/^script$/i.test(t[e].tagName)&&(i.head.removeChild(t[e]),e--,s--)}let s=i.head.innerHTML;i.head.querySelector('link[rel="stylesheet"]')&&("auto"!==this.frameOptions.get("height")||i.head.querySelector("style"))||(s+=wt._setIframeStyleLinks(this.frameOptions.get("iframe_cssFileName"))+wt._setAutoHeightStyle(this.frameOptions.get("height"))),e.head.innerHTML=s,e.body.innerHTML=this.html.clean(i.body.innerHTML,{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.options.get("freeCodeViewMode")});const n=i.body.attributes;for(let t=0,i=n.length;t<i;t++)"contenteditable"!==n[t].name&&e.body.setAttribute(n[t].name,n[t].value);if(!xt.utils.hasClass(e.body,"sun-editor-editable")){const t=this.options.get("_editableClass").split(" ");for(let i=0;i<t.length;i++)xt.utils.addClass(e.body,this.options.get("_editableClass")[i])}}else this.frameContext.get("wysiwyg").innerHTML=t.length>0?this.html.clean(t,{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.options.get("freeCodeViewMode")}):"<"+this.options.get("defaultLine")+"><br></"+this.options.get("defaultLine")+">"},_setEditorDataToCodeView(){const t=this.html._convertToCode(this.frameContext.get("wysiwyg"),!1);let e="";if(this.frameOptions.get("iframe_fullPage")){const i=xt.utils.getAttributesToString(this.frameContext.get("_wd").body,null);e="<!DOCTYPE html>\n<html>\n"+this.frameContext.get("_wd").head.outerHTML.replace(/>(?!\n)/g,">\n")+"<body "+i+">\n"+t+"</body>\n</html>"}else e=t;this._setCodeView(e)},_codeViewAutoHeight(t,e,i){i&&(t.style.height=t.scrollHeight+"px"),this._updateLineNumbers(e,t)},_updateLineNumbers(t,e){if(!t)return;const i=Tn(t),s=Math.ceil(e.scrollHeight/i),n=(t.value.match(/\n/g)||[]).length;if(s>n){let e="";for(let t=n+1;t<=s;t++)e+=`${t}\n`;t.value+=e}},_scrollLineNumbers(t){t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft},constructor:Sn};const Hn=Sn,Ln=".se-menu-list .se-toolbar-btn[data-command]",Mn=`${Ln}:not([class~="se-code-view-enabled"]):not([data-type="MORE"])`,Nn=`${Ln}:not([class~="se-component-enabled"]):not([data-type="MORE"])`;function An(t,e){const i=t[0].target.ownerDocument||_t._d,s=i.defaultView||_t._w,n=Xt(t,e);this.rootKeys=n.rootKeys,this.frameRoots=n.frameRoots,this._d=i,this._w=s,this.carrierWrapper=n.carrierWrapper,this.__context=n.context,this.context=function(t){const e=t.__context;return{get:t=>e.get(t),set:(t,i)=>e.set(t,i),has:t=>e.has(t),delete:t=>e.delete(t),getAll:()=>Object.fromEntries(e.entries()),clear(){e.clear()}}}(this),this.__frameContext=new Map,this.frameContext=function(t){let e=t.__frameContext;return{get:t=>e.get(t),set:(t,i)=>e.set(t,i),has:t=>e.has(t),delete:t=>e.delete(t),getAll:()=>Object.fromEntries(e.entries()),reset(i){e=t.__options=i},clear(){e.clear()}}}(this),this.__frameOptions=new Map,this.frameOptions=function(t){let e=t.__frameOptions;return{get:t=>e.get(t),set:(t,i)=>e.set(t,i),has:t=>e.has(t),getAll:()=>Object.fromEntries(e.entries()),setMany(t){Object.entries(t).forEach((([t,i])=>e.set(t,i)))},reset(i){e=t.__frameOptions=i},clear(){e.clear()}}}(this),this.__options=n.options,this.options=function(t){let e=t.__options;return{get:t=>e.get(t),set:(t,i)=>e.set(t,i),has:t=>e.has(t),getAll:()=>Object.fromEntries(e.entries()),setMany(t){Object.entries(t).forEach((([t,i])=>e.set(t,i)))},reset(i){e=t.__options=i},clear(){e.clear()}}}(this),this.plugins=n.plugins||{},this.events=null,this.triggerEvent=null,this.icons=n.icons,this.lang=n.lang,this.status={hasFocus:!1,tabSize:4,indentSize:25,codeIndentSize:2,currentNodes:[],currentNodesMap:[],initViewportHeight:0,currentViewportHeight:0,onSelected:!1,rootKey:n.rootId,isScrollable:t=>{t||=this.frameContext;const e=t.get("options"),i=e.get("height"),s=e.get("maxHeight");return"auto"!==i||!!s&&t.get("wysiwyg").offsetHeight>=kt.get(s)},_range:null,_onMousedown:!1},this.isClassic=!1,this.isInline=!1,this.isBalloon=!1,this.isBalloonAlways=!1,this.isSubBalloon=!1,this.isSubBalloonAlways=!1,this.allCommandButtons=new Map,this.subAllCommandButtons=new Map,this.shortcutsKeyMap=new Map,this.reverseKeys=new Set,this.commandTargets=new Map,this.activeCommands=null,this.effectNode=null,this.opendModal=null,this.opendControllers=[],this.currentControllerName="",this.opendBrowser=null,this.selectMenuOn=!1,this.history=null,this.eventManager=null,this.instanceCheck=null,this.toolbar=null,this.subToolbar=null,this.char=null,this.component=null,this.format=null,this.html=null,this.inline=null,this.listFormat=null,this.menu=null,this.nodeTransform=null,this.offset=null,this.selection=null,this.shortcuts=null,this.ui=null,this.viewer=null,this._lineBreaker_t=null,this._lineBreaker_b=null,this._shadowRoot=null,this._onPluginEvents=null,this._onCopyFormatInfo=null,this._onCopyFormatInitMethod=null,this._controllerTargetContext=null,this._controllerOnDisabledButtons=[],this._codeViewDisabledButtons=[],this._pluginCallButtons=n.pluginCallButtons,this._pluginCallButtons_sub=n.pluginCallButtons_sub,this._responsiveButtons=n.responsiveButtons,this._responsiveButtons_sub=n.responsiveButtons_sub,this._notHideToolbar=!1,this._preventBlur=!1,this._preventFocus=!1,this._preventSelection=!1,this._componentsInfoInit=!0,this._componentsInfoReset=!1,this._MELInfo=null,this._fileInfoPluginsCheck=null,this._fileInfoPluginsReset=null,this._fileManager={tags:null,regExp:null,pluginRegExp:null,pluginMap:null},this._componentManager=[],this._figureContainer=null,this._originOptions=e;try{this.__Create(e)}catch(t){throw console.error("[SUNEDITOR:E_CREATE_FAIL] Failed to create editor instance.",t),t}}function Bn(t,e,i,s,n,o){const l=e[t],r=Object.keys(l);if(In(r,null,t+"."),0===r.length)return!1;const a=t||null;s.set(a,new Map);const h=i.get(a).get("options").get("_origin"),c={},d=Object.prototype.hasOwnProperty;for(const t in l){if(!d.call(It,t))continue;const e=l[t];r.includes(t)&&h[t]!==e&&(s.get(a).set(Vn(t),!0),c[t]=e)}const u={...h,...c};n.set(a,new Map(Object.entries(u))),o.push({key:a,options:u})}function Vn(t){return/^statusbar|^charCounter/.test(t)?"statusbar-changed":t}function In(t,e,i){for(let s,n=0,o=t.length;n<o;n++)s=t[n],("fixed"===Ot[s]||"fixed"===It[s]||e&&e[s])&&(console.warn(`[SUNEDITOR.warn.resetOptions] The "[${i+s}]" option cannot be changed after the editor is created.`),t.splice(n--,1),o--)}An.prototype={registerPlugin(t,e,i){let s=this.plugins[t];if(!s)throw Error(`[SUNEDITOR.registerPlugin.fail] The called plugin does not exist or is in an invalid format. (pluginName: "${t}")`);if("function"==typeof this.plugins[t]&&(s=this.plugins[t]=new this.plugins[t](this,i||{})),e){for(let t=0,i=e.length;t<i;t++)Yt(e[t],s,this.icons,this.lang);this.activeCommands.includes(t)||"function"!=typeof this.plugins[t].active||this.activeCommands.push(t)}},run(t,e,i){if(e){if(/more/i.test(e)){const e=xt.query.getParentElement(i,".se-toolbar"),s=xt.utils.hasClass(e,"se-toolbar-sub")?this.subToolbar:this.toolbar;if(i!==s.currentMoreLayerActiveButton){const n=e.querySelector("."+t);n&&(s._moreLayerOn(i,n),s._showBalloon(),s._showInline()),xt.utils.addClass(i,"on")}else s.currentMoreLayerActiveButton&&(s._moreLayerOff(),s._showBalloon(),s._showInline());return void this.viewer._resetFullScreenHeight()}if(/container/.test(e)&&(null===this.menu.targetMap[t]||i!==this.menu.currentContainerActiveButton))return void this.menu.containerOn(i);if(this.frameContext.get("isReadOnly")&&xt.utils.arrayIncludes(this._controllerOnDisabledButtons,i))return;if(/dropdown/.test(e)&&(null===this.menu.targetMap[t]||i!==this.menu.currentDropdownActiveButton))return void this.menu.dropdownOn(i);if(/modal/.test(e))return void this.plugins[t].open(i);/command/.test(e)?this.plugins[t].action(i):/browser/.test(e)?this.plugins[t].open(null):/popup/.test(e)&&this.plugins[t].show()}else t&&this.commandHandler(t,i);/dropdown/.test(e)?this.menu.dropdownOff():/command/.test(e)||(this.menu.dropdownOff(),this.menu.containerOff())},async commandHandler(t,e){if(!this.frameContext.get("isReadOnly")||/copy|cut|selectAll|codeView|fullScreen|print|preview|showBlocks/.test(t))switch(t){case"selectAll":!function(t){t.ui._offCurrentController(),t.menu.containerOff();const e=t.frameContext.get("wysiwyg");let i=null,s="";const n=t.options.get("scopeSelectionTags"),o=t.selection.getRange();if(!o.collapsed){let t=i=o.commonAncestorContainer,l=s=t.nodeName?.toLowerCase();if(0===o.startOffset&&o.endOffset===o.endContainer.textContent?.length){const e=t.parentElement;(xt.check.isList(e)||xt.check.isListCell(e))&&e.firstChild.contains?.(o.startContainer)&&e.lastChild?.contains(o.endContainer)&&(i=t=e.parentElement,s=t.nodeName?.toLowerCase())}for(l=t.nodeName?.toLowerCase();t&&(!t.nextSibling&&!t.previousSibling&&!n.includes(l)||xt.check.isContentLess(l))&&t!==e;)t=t.parentElement,l=t.nodeName?.toLowerCase();n.includes(l)&&(i=t,s=l)}const l=n.filter((t=>t!==s));let r=xt.query.getParentElement(i||t.selection.getNode(),(t=>l.includes(t.nodeName?.toLowerCase())))||e,{first:a,last:h}=ie(r);if(!a||!h)return;const c=xt.check.isZeroWidth;for(;c(a)&&c(h)&&r!==e;)r=r.parentElement,({first:a,last:h}=ie(xt.query.getParentElement(r,(t=>l.includes(t.nodeName?.toLowerCase())))||e));if(!a||!h)return;let d=null;if(xt.check.isMedia(a)||(d=t.component.get(a))||xt.check.isTableElements(a)){d||=t.component.get(a);const e=xt.utils.createElement("BR"),i=xt.utils.createElement(t.options.get("defaultLine"),null,e);a=d?d.container||d.cover:a,a.parentElement.insertBefore(i,a),a=e}if(xt.check.isMedia(h)||(d=t.component.get(h))||xt.check.isTableElements(h)){d||=t.component.get(h);const e=xt.utils.createElement("BR"),i=xt.utils.createElement(t.options.get("defaultLine"),null,e);h=d?d.container||d.cover:h,h.parentElement.appendChild(i),h=e}t.toolbar._showBalloon(t.selection.setRange(a,0,h,h.textContent.length))}(this);break;case"copy":{const t=this.selection.getRange();if(t.collapsed)break;const e=xt.utils.createElement("div",null,t.cloneContents());await this.html.copy(e.innerHTML);break}case"newDocument":this.html.set(`<${this.options.get("defaultLine")}><br></${this.options.get("defaultLine")}>`),this.focus(),this.history.push(!1),this.frameContext.has("documentType_use_header")&&this.frameContext.get("documentType").reHeader();break;case"codeView":this.viewer.codeView(!this.frameContext.get("isCodeView"));break;case"fullScreen":this.viewer.fullScreen(!this.frameContext.get("isFullScreen"));break;case"indent":this.format.indent();break;case"outdent":this.format.outdent();break;case"undo":this.history.undo();break;case"redo":this.history.redo();break;case"removeFormat":this.inline.remove(),this.focus();break;case"print":this.viewer.print();break;case"preview":this.viewer.preview();break;case"showBlocks":this.viewer.showBlocks(!this.frameContext.get("isShowBlocks"));break;case"dir":this.setDir(this.options.get("_rtl")?"ltr":"rtl");break;case"dir_ltr":this.setDir("ltr");break;case"dir_rtl":this.setDir("rtl");break;case"save":await async function(t){const e=t.frameContext;if(!e.get("isChanged"))return;const i=t.html.get(),s=await t.triggerEvent("onSave",{frameContext:e,data:i});if(s===Kt){const t=e.get("originElement");/^TEXTAREA$/i.test(t.nodeName)?t.value=i:t.innerHTML=i}else if(!1===s)return;e.set("isChanged",!1),e.set("savedIndex",t.history.getRootStack()[t.status.rootKey].index),t.applyCommandTargets("save",(t=>{t.disabled=!0}))}(this);break;case"copyFormat":oe(this,e);break;case"pageBreak":!function(t){const e=xt.utils.createElement("DIV",{class:"se-component se-component-line-break se-page-break"});t.component.insert(e,{skipCharCount:!0,insertBehavior:"line"});const i=e.nextElementSibling||t.format.addLine(e);t.selection.setRange(i,1,i,1),t.history.push(!1)}(this);break;case"pageUp":this.frameContext.get("documentType").pageUp();break;case"pageDown":this.frameContext.get("documentType").pageDown();break;default:!function(t,e){e=t.options.get("_defaultTagCommand")[e.toLowerCase()]||e;let i=t.options.get("convertTextTags")[e]||e;const s=t.status.currentNodesMap,n=s.includes(t.options.get("_styleCommandMap")[i])?null:xt.utils.createElement(i);/^sub$/i.test(i)&&s.includes("superscript")?i="sup":/^sup$/i.test(i)&&s.includes("subscript")&&(i="sub"),t.inline.apply(n,{stylesToModify:Jt[e]||null,nodesToRemove:[i],strictRemove:!1}),t.focus()}(this,t)}},runFromTarget(t){if(xt.check.isInputElement(t))return;const e=xt.query.getCommandTarget(t);if(!e)return;const i=e.getAttribute("data-command"),s=e.getAttribute("data-type");(i||s)&&(e.disabled||this.run(i,s,t))},applyCommandTargets(t,e){this.commandTargets.has(t)&&this.commandTargets.get(t).forEach(e)},applyFrameRoots(t){this.frameRoots.forEach(t)},isEmpty(t){const e=(t||this.frameContext).get("wysiwyg");return xt.check.isZeroWidth(e.textContent)&&!e.querySelector(this.options.get("allowedEmptyTags"))&&(e.innerText.match(/\n/g)||"").length<=1},setDir(t){const e="rtl"===t;if(this.options.get("_rtl")!==e){try{this.options.set("_rtl",e),this.ui._offCurrentController();const i=this.frameContext,s=this.plugins;for(const e in s)s[e].setDir?.(t);const n=this.context.get("toolbar_wrapper"),o=this.context.get("statusbar_wrapper");e?(this.applyFrameRoots((t=>{xt.utils.addClass([t.get("topArea"),t.get("wysiwyg"),t.get("documentTypePageMirror")],"se-rtl")})),xt.utils.addClass([this.carrierWrapper,n,o],"se-rtl")):(this.applyFrameRoots((t=>{xt.utils.removeClass([t.get("topArea"),t.get("wysiwyg"),t.get("documentTypePageMirror")],"se-rtl")})),xt.utils.removeClass([this.carrierWrapper,n,o],"se-rtl"));const l=xt.query.getListChildren(i.get("wysiwyg"),(t=>this.format.isLine(t)&&!!(t.style.marginRight||t.style.marginLeft||t.style.textAlign)),null);for(let t,e,i,s=0;t=l[s];s++)t=l[s],i=t.style.marginRight,e=t.style.marginLeft,(i||e)&&(t.style.marginRight=e,t.style.marginLeft=i),i=t.style.textAlign,"left"===i?t.style.textAlign="right":"right"===i&&(t.style.textAlign="left");!function(t,e){const i=t.icons,s=t.commandTargets,n=t.shortcutsKeyMap;t.reverseKeys.forEach((t=>{const e=n.get(t);e&&([e.command,e.r]=[e.r,e.command])})),t.applyCommandTargets("dir",(s=>{xt.utils.changeTxt(s.querySelector(".se-tooltip-text"),t.lang[e?"dir_ltr":"dir_rtl"]),xt.utils.changeElement(s.firstElementChild,i[e?"dir_ltr":"dir_rtl"])})),e?(xt.utils.addClass(s.get("dir_rtl"),"active"),xt.utils.removeClass(s.get("dir_ltr"),"active")):(xt.utils.addClass(s.get("dir_ltr"),"active"),xt.utils.removeClass(s.get("dir_rtl"),"active"))}(this,e),i.has("documentType_use_header")&&(e?i.get("wrapper").appendChild(i.get("documentTypeInner")):i.get("wrapper").insertBefore(i.get("documentTypeInner"),i.get("wysiwygFrame"))),i.has("documentType_use_page")&&(e?i.get("wrapper").insertBefore(i.get("documentTypePage"),i.get("wysiwygFrame")):i.get("wrapper").appendChild(i.get("documentTypePage"))),this.isBalloon?this.toolbar._showBalloon():this.isSubBalloon&&this.subToolbar._showBalloon()}catch(t){this.options.set("_rtl",!e),console.warn(`[SUNEDITOR.setDir.fail] ${t.toString()}`)}this.effectNode=null,this.eventManager.applyTagEffect()}},resetOptions(t){this.viewer.codeView(!1),this.viewer.showBlocks(!1);const e=new Map,i=this.frameRoots,s=[],n=new Map,o={};for(const e in t)void 0!==It[e]&&(o[e]=t[e],delete t[e]);for(const e of i.keys())t[e||""]={...o,...t[e||""]};const l=Object.keys(t);if(In(l,this.plugins,""),0===l.length)return;1===i.size&&l.unshift(null);const r=[this._originOptions,t].reduce(((t,o)=>{for(const l in o)i.has(l||null)?Bn(l,o,i,e,n,s):t[l]=o[l];return t}),{}),a=this.options,h=$t(r,s,this.plugins),c=h.o,d=h.frameMap;for(let t,s=0,o=l.length;s<o;s++)if(t=l[s]||null,n.has(t)){const s=e.get(t),n=i.get(t),o=n.get("options"),l=d.get(t);if(n.set("options",l),s.has("statusbar-changed")){if(xt.utils.removeItem(n.get("statusbar")),l.get("statusbar")){const t=Pt(l,null).statusbar;n.get("container").appendChild(t),Bt(t,n),this.eventManager.__addStatusbarEvent(n,l)}else this.eventManager.removeEvent(o.get("__statusbarEvent")),l.set("__statusbarEvent",null),Bt(null,n);n.get("statusbar")&&this.char.display(n)}if(s.has("iframe_attributes")){const t=n.get("wysiwygFrame"),e=o.get("iframe_attributes"),i=l.get("iframe_attributes");for(const i in e)t.removeAttribute(i,e[i]);for(const e in i)t.setAttribute(e,i[e])}if(s.has("iframe_cssFileName")){const t=n.get("_wd").head,e=t.getElementsByTagName("link");for(;e[0];)t.removeChild(e[0]);const i=(new DOMParser).parseFromString(wt._setIframeStyleLinks(l.get("iframe_cssFileName")),"text/html").head.children,s=t.querySelector("style");for(;i[0];)t.insertBefore(i[0],s)}s.has("placeholder")&&(n.get("placeholder").textContent=l.get("placeholder")),this.ui.setEditorStyle(l.get("editorStyle"),n);const r=n.get("wysiwyg"),a=o.get("editableFrameAttributes"),h=l.get("editableFrameAttributes");for(const t in a)r.removeAttribute(t,a[t]);for(const t in h)r.setAttribute(t,h[t])}else switch(a.set(t,c.get(t)),t){case"theme":this.ui.setTheme(a.get("theme"));break;case"events":{const t=a.get("events");for(const e in t)this.events[e]=t[e];break}case"autoStyleify":this.html.__resetAutoStyleify(a.get("autoStyleify"));break;case"textDirection":this.setDir(a.get("_rtl")?"ltr":"rtl");break;case"historyStackDelayTime":this.history.resetDelayTime(a.get("historyStackDelayTime"));break;case"defaultLineBreakFormat":this.format.__resetBrLineBreak(a.get("defaultLineBreakFormat"))}this._originOptions=r;const u=this.context.get("toolbar_main");/inline|balloon/i.test(a.get("mode"))&&l.includes("toolbar_width")&&(u.style.width=a.get("toolbar_width")),a.get("toolbar_hide")?u.style.display="none":u.style.display="",a.get("shortcutsHint")?xt.utils.removeClass(u,"se-shortcut-hide"):xt.utils.addClass(u,"se-shortcut-hide"),this.effectNode=null,this._setFrameInfo(this.frameRoots.get(this.status.rootKey));for(const t of Object.values(this.plugins))t.init?.()},changeFrameContext(t){t!==this.status.rootKey&&(this.status.rootKey=t,this._setFrameInfo(this.frameRoots.get(t)),this.toolbar._resetSticky())},execCommand(t,e,i){this.frameContext.get("_wd").execCommand(t,e,"formatBlock"===t?"<"+i+">":i),this.history.push(!0)},focus(t){if(t&&this.changeFrameContext(t),"none"!==this.frameContext.get("wysiwygFrame").style.display){if(this._preventBlur=!1,this.frameOptions.get("iframe")||!this.frameContext.get("wysiwyg").contains(this.selection.getNode()))this._nativeFocus();else try{const t=this.selection.getRange();if(t.startContainer===t.endContainer&&xt.check.isWysiwygFrame(t.startContainer)){const e=t.commonAncestorContainer.children[t.startOffset];if(!this.format.isLine(e)&&!this.component.is(e)){const t=xt.utils.createElement("BR"),i=xt.utils.createElement(this.options.get("defaultLine"),null,t);return this.frameContext.get("wysiwyg").insertBefore(i,e),void this.selection.setRange(t,0,t,0)}}this.selection.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}catch(t){console.warn("[SUNEDITOR.focus.warn] ",t),this._nativeFocus()}this.isBalloon&&this.eventManager._toggleToolbarBalloon()}},focusEdge(t){this._preventBlur=!1,t||=this.frameContext.get("wysiwyg").lastElementChild;const e=this.component.get(t);e?this.component.select(e.target,e.pluginName):t?(3!==t.nodeType&&(t=xt.query.getEdgeChild(t,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!0)),t?this.selection.setRange(t,t.textContent.length,t,t.textContent.length):this._nativeFocus()):this.focus()},blur(){this.frameOptions.get("iframe")?this.frameContext.get("wysiwygFrame").blur():this.frameContext.get("wysiwyg").blur()},destroy(){let t=this.plugins;for(const e in t){const i=t[e];i._destroy?.();for(const t in i)delete i[t];delete t[e]}this.history.destroy(),this.eventManager._removeAllEvents(),this.options.get("codeMirror6Editor")&&this.options.get("codeMirror6Editor").destroy(),xt.utils.removeItem(this.carrierWrapper),xt.utils.removeItem(this.context.get("toolbar_wrapper")),xt.utils.removeItem(this.context.get("toolbar_sub_wrapper")),xt.utils.removeItem(this.context.get("statusbar_wrapper")),this.applyFrameRoots((t=>{xt.utils.removeItem(t.get("topArea")),t.get("options").clear(),t.clear()})),this.allCommandButtons.clear(),this.subAllCommandButtons.clear(),this.shortcutsKeyMap.clear(),this.reverseKeys.clear(),this.commandTargets.clear(),this.__frameContext.clear(),this.__frameOptions.clear(),this._MELInfo&&this._MELInfo.clear(),this._onPluginEvents&&this._onPluginEvents.clear(),this.options.clear(),this.context.clear(),this.frameRoots.clear(),t=this.events;for(const e in t)delete t[e];t=["eventManager","instanceCheck","char","component","format","html","inline","listFormat","menu","nodeTransform","offset","selection","shortcuts","ui","viewer","toolbar","subToolbar"];for(let e,i=0,s=t.length;i<s;i++){e=this[t[i]];for(const t in e)delete e[t]}t=null;for(const t in this)delete this[t];return null},_setFrameInfo(t){this.frameContext.reset(t),this.frameOptions.reset(t.get("options")),t.set("_editorHeight",t.get("wysiwygFrame").offsetHeight),this._lineBreaker_t=t.get("lineBreaker_t"),this._lineBreaker_b=t.get("lineBreaker_b")},_nativeFocus(){this.selection.__focus(),this.selection._init()},_checkComponents(t){for(let e=0,i=this._fileInfoPluginsCheck.length;e<i;e++)this._fileInfoPluginsCheck[e](t)},_resetComponents(){for(let t=0,e=this._fileInfoPluginsReset.length;t<e;t++)this._fileInfoPluginsReset[t]()},_initWysiwygArea(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=this.char.getLength()),"document"===this.options.get("type")&&(t.set("documentType",new Yi(this,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))},_resourcesStateChange(t){this._iframeAutoHeight(t),this._checkPlaceholder(t),t.has("documentType_use_page")&&(t.get("documentTypePageMirror").innerHTML=t.get("wysiwyg").innerHTML,t.get("documentType").rePage(!0))},_iframeAutoHeight(t){const e=t.get("_iframeAuto");e?this._w.setTimeout((()=>{const i=e.offsetHeight,s=t.get("wysiwygFrame");s.style.height=i+"px";const n=t.get("options");if(n.get("iframe")){const t=n.get("maxHeight");t&&s.setAttribute("scrolling",i>kt.get(t)?"auto":"no")}_t.isResizeObserverSupported||this.__callResizeFunction(t,i,null)}),0):_t.isResizeObserverSupported||this.__callResizeFunction(t,t.get("wysiwygFrame").offsetHeight,null)},__callResizeFunction(t,e,i){e=-1===e?i?.borderBoxSize&&i.borderBoxSize[0]?i.borderBoxSize[0].blockSize:i.contentRect.height+kt.get(t.get("wwComputedStyle").getPropertyValue("padding-left"))+kt.get(t.get("wwComputedStyle").getPropertyValue("padding-right")):e,t.get("_editorHeight")!==e&&(this.triggerEvent("onResizeEditor",{height:e,prevHeight:t.get("_editorHeight"),frameContext:t,observerEntry:i}),t.set("_editorHeight",e)),t.has("documentType_use_page")&&t.get("documentType").resizePage()},_checkPlaceholder(t){t||=this.frameContext;const e=t.get("placeholder");if(e){if(t.get("isCodeView"))return void(e.style.display="none");this.isEmpty(t)?e.style.display="block":e.style.display="none"}},__editorInit(t){this.status.initViewportHeight=this._w.visualViewport.height,this.eventManager.__setViewportSize(),this.applyFrameRoots((t=>{this.__setEditorParams(t)})),this._setFrameInfo(this.frameRoots.get(this.status.rootKey)),this.__init(t);for(const t of this._onPluginEvents.values())t.sort(((t,e)=>t.index-e.index));this.applyFrameRoots((t=>{this.eventManager._addFrameEvents(t),this._initWysiwygArea(t,t.get("options").get("value")),t.get("options").get("iframe")&&"auto"===t.get("options").get("height")&&this.__callResizeFunction(t,t.get("wysiwygFrame").offsetHeight,null)})),this.eventManager.__eventDoc=null,this._componentsInfoInit=!1,this._componentsInfoReset=!1,this._checkComponents(!0),this._w.setTimeout(function(){if(this.context){this.context.get("toolbar_main").style.visibility="",this.applyFrameRoots((t=>{this.eventManager._wwFrameObserver&&this.eventManager._wwFrameObserver.observe(t.get("wysiwygFrame")),this.eventManager._toolbarObserver&&this.eventManager._toolbarObserver.observe(t.get("_toolbarShadow")),this._resourcesStateChange(t)})),this.history.reset();for(const t of Object.values(this.plugins))t.init?.();this.selection.__init(),this.triggerEvent("onload",{})}else console.warn("[SUNEDITOR:E_INIT_FAIL] Editor instance was destroyed before initialization completed. Check if destroy() was called.")}.bind(this),0)},__init(t){this._fileInfoPluginsCheck=[],this._fileInfoPluginsReset=[],this._MELInfo=new Map,this.activeCommands=se,this._onPluginEvents=new Map([["onMouseMove",[]],["onMouseLeave",[]],["onMouseDown",[]],["onMouseUp",[]],["onScroll",[]],["onClick",[]],["onBeforeInput",[]],["onInput",[]],["onKeyDown",[]],["onKeyUp",[]],["onFocus",[]],["onBlur",[]],["onPaste",[]],["onFilePasteAndDrop",[]]]),this._fileManager.tags=[],this._fileManager.pluginMap={},this._fileManager.tagAttrs={};const e=this.plugins,i=[];let s;for(const n in e){if(this.registerPlugin(n,this._pluginCallButtons[n],t[n]),this.registerPlugin(n,this._pluginCallButtons_sub[n],t[n]),s=this.plugins[n],"object"==typeof s.__fileManagement){const t=s.__fileManagement;if(this._fileInfoPluginsCheck.push(t._checkInfo.bind(t)),this._fileInfoPluginsReset.push(t._resetInfo.bind(t)),Array.isArray(t.tagNames)){const e=t.tagNames;this._fileManager.tags=this._fileManager.tags.concat(e),i.push(n);for(let i,s=0,o=e.length;s<o;s++)i=e[s].toLowerCase(),this._fileManager.pluginMap[i]=n,t.tagAttrs&&(this._fileManager.tagAttrs[i]=t.tagAttrs)}}"function"==typeof s.constructor.component&&this._componentManager.push(function(t,e){return e&&(e=t.component?.call(this,e))?{target:e,pluginName:t.key,options:t.options}:null}.bind(s,s.constructor));const e=s.constructor.options||{};if(this._onPluginEvents.forEach(((t,i)=>{if("function"==typeof s[i]){const n=s[i].bind(s);n.index=e[`eventIndex_${i}`]||e.eventIndex||0,t.push(n)}})),s.retainFormat){const t=s.retainFormat();this._MELInfo.set(t.query,{key:s.constructor.key,method:t.method})}}(this.options.get("buttons").has("pageBreak")||this.options.get("buttons_sub")?.has("pageBreak"))&&this._componentManager.push((t=>t&&xt.utils.hasClass(t,"se-page-break")?{target:t,launcher:{destroy:t=>{const e=t.previousElementSibling||t.nextElementSibling;xt.utils.removeItem(t),this.focusEdge(e),this.history.push(!1)}}}:null)),this._fileManager.regExp=new RegExp(`^(${this._fileManager.tags.join("|")||"\\^"})$`,"i"),this._fileManager.pluginRegExp=new RegExp(`^(${0===i.length?"\\^":i.join("|")})$`,"i"),delete this._pluginCallButtons,delete this._pluginCallButtons_sub,this.__cachingButtons(),this.__cachingShortcuts()},__cachingButtons(){const t=this.context;this.__setDisabledButtons(),this.__saveCommandButtons(this.allCommandButtons,t.get("toolbar_buttonTray")),this.__saveCommandButtons(this.subAllCommandButtons,t.get("toolbar_sub_buttonTray"))},__setDisabledButtons(){const t=this.context;this._codeViewDisabledButtons=wt.nodeListToArray(t.get("toolbar_buttonTray").querySelectorAll(Mn)),this._controllerOnDisabledButtons=wt.nodeListToArray(t.get("toolbar_buttonTray").querySelectorAll(Nn)),this.options.has("_subMode")&&(this._codeViewDisabledButtons=this._codeViewDisabledButtons.concat(wt.nodeListToArray(t.get("toolbar_sub_buttonTray").querySelectorAll(Mn))),this._controllerOnDisabledButtons=this._controllerOnDisabledButtons.concat(wt.nodeListToArray(t.get("toolbar_sub_buttonTray").querySelectorAll(Nn))))},__saveCommandButtons(t,e){if(!e)return;const i=e.querySelectorAll(Ln),s=this.options.get("shortcuts"),n=this.options.get("_reverseCommandArray"),o=this.shortcutsKeyMap,l=this.reverseKeys;for(let e,r,a=0,h=i.length;a<h;a++)e=i[a],r=e.getAttribute("data-command"),t.set(r,e),this.__setCommandTargets(r,e),Ft(r,e,s[r],o,n,l)},__cachingShortcuts(){const t=this.options.get("shortcuts"),e=this.options.get("_reverseCommandArray"),i=this.shortcutsKeyMap,s=this.reverseKeys;for(const n of Object.keys(t))n.startsWith("_")&&Ft("",null,t[n],i,e,s)},__setCommandTargets(t,e){if(!t||!e)return;(ne.includes(t)||this.plugins[t])&&(this.commandTargets.get(t)?this.commandTargets.get(t).includes(e)||this.commandTargets.get(t).push(e):this.commandTargets.set(t,[e]))},__setIframeDocument(t,e,i){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(i.get("iframe_cssFileName"))+wt._setAutoHeightStyle(i.get("height")),t.contentDocument.body.className=e.get("_editableClass"),t.contentDocument.body.setAttribute("contenteditable","true")},__setEditorParams(t){const e=t.get("options"),i=this._w;if(t.set("wwComputedStyle",i.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",i),t.set("_wd",this._d));const s=e.get("editableFrameAttributes");for(const e in s)t.get("wysiwyg").setAttribute(e,s[e])},__registerClass(){this.events=this.options.get("events")||{},this.triggerEvent=async(t,e)=>{if(xt.check.isNonEditable(e?.frameContext?.get("wysiwyg")))return!1;const i=this.events[t];return"function"==typeof i?await i({editor:this,...e}):_t.NO_EVENT},this.history=le(this),this.eventManager=new qi(this),this.instanceCheck=new Xi(this),this.offset=new cn(this),this.shortcuts=new mn(this),this.toolbar=new yn(this,{keyName:"toolbar",balloon:this.isBalloon,balloonAlways:this.isBalloonAlways,inline:this.isInline,res:this._responsiveButtons}),this.options.has("_subMode")&&(this.subToolbar=new yn(this,{keyName:"toolbar_sub",balloon:this.isSubBalloon,balloonAlways:this.isSubBalloonAlways,inline:!1,res:this._responsiveButtons_sub})),this.selection=new pn(this),this.html=new Zs(this),this.nodeTransform=new an(this),this.component=new zs(this),this.format=new Ds(this),this.inline=new js(this),this.listFormat=new Js(this),this.menu=new ln(this),this.char=new ts(this),this.ui=new xn(this),this.viewer=new Hn(this),Ki.call(this.eventManager,this),Ki.call(this.char,this),Ki.call(this.component,this),Ki.call(this.format,this),Ki.call(this.html,this),Ki.call(this.inline,this),Ki.call(this.listFormat,this),Ki.call(this.menu,this),Ki.call(this.nodeTransform,this),Ki.call(this.offset,this),Ki.call(this.selection,this),Ki.call(this.shortcuts,this),Ki.call(this.toolbar,this),Ki.call(this.ui,this),Ki.call(this.viewer,this),this.options.has("_subMode")&&Ki.call(this.subToolbar,this),delete this.eventManager.eventManager,delete this.char.char,delete this.component.component,delete this.format.format,delete this.html.html,delete this.inline.inline,delete this.listFormat.listFormat,delete this.menu.menu,delete this.nodeTransform.nodeTransform,delete this.offset.offset,delete this.selection.selection,delete this.shortcuts.shortcuts,delete this.toolbar.toolbar,delete this.ui.ui,delete this.viewer.viewer,this.subToolbar&&delete this.subToolbar.subToolbar,this._responsiveButtons=this._responsiveButtons_sub=null},async __Create(t){this.isInline=/inline/i.test(this.options.get("mode")),this.isBalloon=/balloon/i.test(this.options.get("mode")),this.isBalloonAlways=/balloon-always/i.test(this.options.get("mode")),this.isClassic=/classic/i.test(this.options.get("mode")),this.isSubBalloon=/balloon/i.test(this.options.get("_subMode")),this.isSubBalloonAlways=/balloon-always/i.test(this.options.get("_subMode")),this.__registerClass(),this.eventManager._addCommonEvents();const e=[];this.applyFrameRoots((t=>{const i=t.get("originElement"),s=t.get("topArea");if(i.style.display="none",s.style.display="block",i.parentNode.insertBefore(s,i.nextElementSibling),t.get("options").get("iframe")){const i=new Promise((e=>{this.eventManager.addEvent(t.get("wysiwygFrame"),"load",(({target:i})=>{this.__setIframeDocument(i,this.__options,t.get("options")),e()}))}));e.push(i)}})),this.applyFrameRoots((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.__editorInit(t)},Constructor:An};const On=An;async function Rn(t,e,i){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.ui.hideLoading()}else{console.error(`[SUNEDITOR.ApiManager[${this.kind}].upload.serverException]`,t);try{const e=t.responseText?JSON.parse(t.responseText):t;let s="";"function"==typeof i&&(s=await i(e,t));const n=`[SUNEDITOR.ApiManager[${this.kind}].upload.serverException] status: ${t.status}, response: ${s||e.errorMessage||t.responseText}`;this.ui.alertOpen(n,"error")}catch(t){throw Error(`[SUNEDITOR.ApiManager[${this.kind}].upload.errorCallBack.fail] ${t.message}`)}finally{this.ui.hideLoading()}}}const Fn=class extends re{#Nt;constructor(t,e){super(t.editor),this.ui=this.editor.ui,this.kind=t.constructor.key||t.constructor.name,this.#Nt=_t.getXMLHttpRequest(),this.method=e?.method,this.url=e?.url,this.headers=e?.headers,this.data=e?.data,this.callBack=e?.callBack,this.errorCallBack=e?.errorCallBack,this.responseType=e?.responseType}call({method:t,url:e,headers:i,data:s,callBack:n,errorCallBack:o,responseType:l}){if(this.cancel(),t||=this.method,e=this.#At(e||this.url),i||=this.headers,s||=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.#Nt;if(l&&(r.responseType=l),r.onreadystatechange=Rn.bind(this,r,n,o),r.open(t,e,!0),null!==i&&"object"==typeof i&&Object.keys(i).length>0)for(const t in i)r.setRequestHeader(t,i[t]);r.send(s)}asyncCall({method:t,url:e,headers:i,data:s,responseType:n}){this.cancel(),t||=this.method,e=this.#At(e||this.url),i||=this.headers,s||=this.data,n||=this.responseType;const o=this.#Nt;return n&&(o.responseType=n),new Promise(((n,l)=>{if(o.open(t,e,!0),null!==i&&"object"==typeof i&&Object.keys(i).length>0)for(const t in i)o.setRequestHeader(t,i[t]);o.onload=()=>{if(200===o.status)try{n(o)}finally{this.ui.hideLoading()}else try{const t=o.responseText?JSON.parse(o.responseText):o;l(t)}finally{this.ui.hideLoading()}},o.onerror=()=>{this.ui.hideLoading(),l(new Error("Network error"))},o.send(s)}))}cancel(){this.#Nt&&this.#Nt.abort()}#At(t){return t.replace(/([^:])\/+/g,"$1/").replace(/\/(\?|#|$)/,"$1")}};function zn(t){const e=t.src.split("/").pop(),i=t.thumbnail||"",s=i||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="${i}" data-extension="${t.src.split(".").pop()}" ${n}`,l=`class="${i||"se-browser-empty-image"}" src="${s}" alt="${t.alt||e}" ${o}`;return`\n\t\t<div class="se-file-item-img">\n\t\t\t${this.thumbnail&&!i&&"image"!==t.type?`<div class="se-browser-empty-thumbnail" ${l}>${this.thumbnail(t)}</div>`:`<img class="${i||"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 $n=class extends re{#Bt;#Vt;#It;#Ot;constructor(t,e){super(t.editor),this.offset=this.editor.offset,this.useSearch=e.useSearch??!0;const i=xt.utils.createElement("DIV",{class:"se-browser sun-editor-common"+(e.className?` ${e.className}`:"")}),s=function(t,e){const i=t.lang,s=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="${i.close}" aria-label="${i.close}">\n\t\t\t\t\t${s.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">${s.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="${i.search}" aria-label="${i.search}">\n\t\t\t\t\t\t\t\t\t\t\t<button type="submit" class="se-btn" title="${i.search}" aria-label="${i.search}">${s.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=xt.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")}}(t.editor,this.useSearch),n=s.html;this.kind=t.constructor.key||t.constructor.name,this.inst=t,this.area=i,this.header=s.header,this.titleArea=s.titleArea,this.tagArea=s.tagArea,this.body=s.body,this.list=s.list,this.side=s.side,this.wrapper=s.wrapper,this.#Bt=s._loading,this.title=e.title,this.listClass=e.listClass||"se-preview-list",this.directData=e.data,this.url=e.url,this.urlHeader=e.headers,this.searchUrl=e.searchUrl,this.searchUrlHeader=e.searchUrlHeader,this.drawItemHandler=(e.drawItemHandler||zn).bind({thumbnail:e.thumbnail,props:e.props||[]}),this.selectorHandler=e.selectorHandler,this.columnSize=e.columnSize||4,this.folderDefaultPath="",this.closeArrow=this.icons.menu_arrow_right,this.openArrow=this.icons.menu_arrow_down,this.icon_folder=this.icons.side_menu_folder_item,this.icon_folder_item=this.icons.side_menu_folder,this.icon_item=this.icons.side_menu_item,this.items=[],this.folders={},this.tree={},this.data={},this.selectedTags=[],this.keyword="",this.sideInner=null,this.apiManager=new Fn(this,{method:"GET"}),this.#Vt=!1,this.#It=null,this.#Ot=t=>{Et.isEsc(t.code)&&this.close()},i.appendChild(xt.utils.createElement("DIV",{class:"se-browser-back"})),i.appendChild(n),this.carrierWrapper.appendChild(i),this.eventManager.addEvent(this.tagArea,"click",this.#Rt.bind(this)),this.eventManager.addEvent(this.list,"click",this.#Ft.bind(this)),this.eventManager.addEvent(this.side,"click",this.#zt.bind(this)),this.eventManager.addEvent(n,"mousedown",this.#$t.bind(this)),this.eventManager.addEvent(n,"click",this.#Pt.bind(this)),this.eventManager.addEvent(i.querySelector("form.se-browser-search-form"),"submit",this.#Dt.bind(this)),this.eventManager.addEvent(this.sideOpenBtn=i.querySelector(".se-side-open-btn"),"click",this.#qt.bind(this)),this.eventManager.addEvent([this.header,i.querySelector(".se-browser-main")],"mousedown",this.#Wt.bind(this))}open(t={}){this.#f();const e=t.listClass||this.listClass;xt.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.editor.opendBrowser=this,this.closeArrow=this.options.get("_rtl")?this.icons.menu_arrow_left:this.icons.menu_arrow_right,this.directData?this.#Ut(this.directData):this.#Zt(t.url||this.url,t.urlHeader||this.urlHeader,!1),this.body.style.maxHeight=xt.utils.getClientSize().h-(this.offset.getGlobal(this.body).top-n.scrollY)-20+"px"}close(){this.#_(),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.editor.opendBrowser=null,this.sideInner=null,this.inst.browserInit?.()}search(t){this.searchUrl?(this.keyword=t,this.#Zt(this.searchUrl+"?keyword="+t,this.searchUrlHeader,!1)):(this.keyword=t.toLowerCase(),this.#Gt(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.#Bt.style.display="block"}closeBrowserLoading(){this.#Bt.style.display="none"}#Zt(t,e,i){this.apiManager.call({method:"GET",url:t,headers:e,callBack:this.#Yt.bind(this),errorCallBack:this.#jt.bind(this)}),i||(this.sideOpenBtn.style.display="none",this.showBrowserLoading())}#Gt(t,e){const i=this.keyword,s=[],n=(t=this.tagfilter(t).filter((t=>t.name.toLowerCase().indexOf(i)>-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 i,d,u=0;u<n;u++)if(i=t[u],d=i.tag?"string"==typeof i.tag?i.tag.split(","):i.tag:[],d=i.tag=d.map((t=>t.trim())),h+=r(i),(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,i=d.length;e<i;e++)t=d[e],t&&!s.includes(t)&&(s.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)}#f(){this.#_(),this.#It=this.eventManager.addGlobalEvent("keydown",this.#Ot,!0)}#_(){this.#It&&=this.eventManager.removeGlobalEvent(this.#It)}#Ut(t){if(Array.isArray(t))return t.length>0&&this.#Gt(t,!0),!0;if("object"==typeof t){this.sideOpenBtn.style.display="",this.#Xt(t),this.side.innerHTML="";const e=this.sideInner=xt.utils.createElement("div",null);if(this.#Kt(this.tree,e),this.side.appendChild(e),this.folderDefaultPath){const t=e.querySelector(`[data-command="${this.folderDefaultPath}"]`);t.click(),this.folderDefaultPath.includes("/")&&(xt.utils.removeClass(t.parentElement,"se-menu-hidden"),t.parentElement.previousElementSibling.querySelector("button").innerHTML=this.openArrow)}return!0}return!1}#Xt(t,e){let i=this.tree;if(t._data){this.data[e]=t._data,this.folderDefaultPath&&!t.default||(this.folderDefaultPath=e);const s=e.split("/"),n=s.length-1;s.forEach(((t,s)=>{i[t]||={children:{}},s===n?(i[t].key=e,i[t].name=this.folders[e].name):i=i[t].children}))}else e&&(i[e]={name:this.folders[e].name,children:{}});Object.entries(t).forEach((([t,i])=>{if("_data"===t||!i||"object"!=typeof i)return;const s=i,n=e?`${e}/${t}`:t;this.folders[n]={name:s.name||t,meta:s.meta||{}},this.#Xt(s,n)}))}#Kt(t,e){for(const i in t){const s=t[i];if(s)if(Object.keys(s.children).length>0){const t=xt.utils.createElement("div",s.key?{"data-command":s.key,"aria-label":s.name}:null,`<span class="se-menu-icon">${s.key?this.icon_folder:this.icon_folder_item}</span><span>${s.name}</span>`),i=xt.utils.createElement("div",{class:"se-menu-folder"},t);t.insertBefore(xt.utils.createElement("button",null,this.closeArrow),t.firstElementChild);const n=document.createElement("div");xt.utils.addClass(n,"se-menu-child|se-menu-hidden"),this.#Kt(s.children,n),i.appendChild(n),e.appendChild(i)}else{const t=xt.utils.createElement("div",{"data-command":s.key,"aria-label":s.name,class:"se-menu-folder-item"},`<span class="se-menu-icon">${this.icon_item}</span><span>${s.name}</span>`);if(e===this.sideInner){const i=xt.utils.createElement("div",{class:"se-menu-folder"},t);e.appendChild(i)}else e.appendChild(t)}}}#Yt(t){try{const e=JSON.parse(t.responseText),i=e.result;if(this.#Ut(i))return;e.nullMessage&&(this.list.innerHTML=e.nullMessage)}catch(t){throw Error(`[SUNEDITOR.browser.drawList.fail] cause: "${t.message}"`)}finally{this.closeBrowserLoading()}}#jt(t,e){throw this.closeBrowserLoading(),Error(`[SUNEDITOR.browser.get.serverException] status: ${e.status}, response: ${t.errorMessage||e.responseText}`)}#Rt(t){const e=xt.query.getEventTarget(t);if(!xt.check.isAnchor(e))return;const i=e.textContent,s=this.tagArea.querySelector('a[title="'+i+'"]'),n=this.selectedTags.indexOf(i);n>-1?(this.selectedTags.splice(n,1),xt.utils.removeClass(s,"on")):(this.selectedTags.push(i),xt.utils.addClass(s,"on")),this.#Gt(this.items,!1)}#Ft(t){const e=xt.query.getEventTarget(t);if(t.preventDefault(),t.stopPropagation(),e===this.list)return;const i=xt.query.getCommandTarget(e);i&&(this.close(),this.selectorHandler(i))}#zt(t){const e=xt.query.getEventTarget(t);if(t.stopPropagation(),/^button$/i.test(e.nodeName)){const t=e.parentElement.parentElement.querySelector(".se-menu-child");return void(xt.utils.hasClass(t,"se-menu-hidden")?(xt.utils.removeClass(t,"se-menu-hidden"),e.innerHTML=this.openArrow):(xt.utils.addClass(t,"se-menu-hidden"),e.innerHTML=this.closeArrow))}const i=xt.query.getCommandTarget(e);if(!i||xt.utils.hasClass(i,"active"))return;const s=this.data[i.getAttribute("data-command")];xt.utils.removeClass(this.side.querySelectorAll(".active"),"active"),xt.utils.addClass([i,xt.query.getParentElement(i,".se-menu-folder")],"active"),this.tagArea.innerHTML="","string"==typeof s?this.#Zt(s,this.urlHeader,!0):this.#Gt(s,!1)}#$t(t){const e=xt.query.getEventTarget(t);/se-browser-inner/.test(e.className)?this.#Vt=!0:this.#Vt=!1}#Pt(t){const e=xt.query.getEventTarget(t);t.stopPropagation(),(/close/.test(e.getAttribute("data-command"))||this.#Vt)&&this.close()}#Dt(t){const e=t.currentTarget;t.preventDefault(),this.search(e.querySelector('input[type="text"]').value)}#qt(t){const e=xt.query.getEventTarget(t);xt.utils.hasClass(e,"active")?(xt.utils.removeClass(this.side,"se-side-show"),xt.utils.removeClass(e,"active")):(xt.utils.addClass(this.side,"se-side-show"),xt.utils.addClass(e,"active"))}#Wt({target:t}){t!==this.sideOpenBtn&&xt.utils.hasClass(this.sideOpenBtn,"active")&&(xt.utils.removeClass(this.side,"se-side-show"),xt.utils.removeClass(this.sideOpenBtn,"active"))}},{isTouchDevice:Pn}=_t,Dn=240,qn=120,Wn={hex:"#FFFFFF",r:255,g:255,b:255,h:0,s:1,l:1};let Un,Zn=0,Gn=!1,Yn=!1,jn=120,Xn=120,Kn=Wn,Jn=!1;const{slider:Qn,offscreenCanvas:to,offscreenCtx:eo,wheel:io,wheelCtx:so,wheelPointer:no,gradientBar:oo,gradientPointer:lo,fanalColorHex:ro,fanalColorBackground:ao}=function(){const t=document.createElement("canvas");t.width=Dn,t.height=Dn;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;">${Wn.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`,i=xt.utils.createElement("DIV",{class:"se-hue-slider"},e),s=i.querySelector(".se-hue-wheel"),n=i.querySelector(".se-hue-gradient"),o=i.querySelector(".se-hue-final-hex").children;return{slider:i,offscreenCanvas:t,offscreenCtx:t.getContext("2d"),wheel:s,wheelCtx:s.getContext("2d"),wheelPointer:i.querySelector(".se-hue-wheel-pointer"),gradientBar:n,gradientPointer:i.querySelector(".se-hue-gradient-pointer"),fanalColorHex:o[0],fanalColorBackground:o[1]}}();function ho(t){const{target:e,touches:i}=t,s=i[0].clientX,n=i[0].clientY;e===io?(t.preventDefault(),Yn=!1,Gn=!0,go(s,n)):e===oo&&(t.preventDefault(),Yn=!0,Gn=!1,mo(s))}function co(t){t.preventDefault();const{touches:e}=t,i=e[0].clientX,s=e[0].clientY;Gn?go(i,s):Yn&&mo(i)}function uo({target:t,clientX:e,clientY:i}){t===io?(Yn=!1,Gn=!0,go(e,i)):t===oo&&(Yn=!0,Gn=!1,mo(e))}function po({clientX:t,clientY:e}){Gn?go(t,e):Yn&&mo(t)}function go(t,e){const i=io.getBoundingClientRect();t=t-i.left-qn,e=e-i.top-qn;const s=180*Math.atan2(e,t)/Math.PI,n=Math.min(Math.sqrt(t*t+e*e),qn),o=qn+n*Math.cos(s*Math.PI/180),l=qn+n*Math.sin(s*Math.PI/180);no.style.left=`${o}px`,no.style.top=`${l}px`,function(t,e){jn=t,Xn=e,fo(bo())}(o,l),yo()}function mo(t){const e=oo.getBoundingClientRect();let i=t-e.left;i=Math.max(14,Math.min(i,e.width-14)),lo.style.left=`${i}px`,function(t){const e=oo.getBoundingClientRect();let i=t-e.left;i<0&&(i=0);i>e.width&&(i=e.width);const s=14;i>=oo.width-s?i=oo.width:i<=s&&(i=0);const n=1-i/e.width;Zn=n,Co()}(t),yo()}function fo(t){const e=oo.getContext("2d"),i=e.createLinearGradient(0,0,oo.width,0);i.addColorStop(0,"black"),i.addColorStop(1,t.hex),e.fillStyle=i,e.fillRect(0,0,oo.width,oo.height)}function bo(){return _o(eo)}function yo(){Un.color=Kn=_o(so),vo(Kn.hex)}function vo(t){ao.style.backgroundColor=ro.textContent=t}function _o(t){const e=t.getImageData(jn,Xn,1,1).data;let[i,s,n]=function([t,e,i]){t/=255,e/=255,i/=255;const s=Math.max(t,e,i),n=Math.min(t,e,i);let o,l;const r=(s+n)/2;if(s===n)o=l=0;else{const a=s-n;switch(l=r>.5?a/(2-s-n):a/(s+n),s){case t:o=(e-i)/a+(e<i?6:0);break;case e:o=(i-t)/a+2;break;case i:o=(t-e)/a+4}o/=6}return[xo(o),xo(l),xo(r)]}(e);const o=jn-qn,l=Xn-qn;Math.sqrt(o*o+l*l)<3&&(n=1-Zn),n>1&&(n=1),n<0&&(n=0);const{r,g:a,b:h}=function([t,e,i]){let s,n,o;if(0===e)s=n=o=i;else{const l=function(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t},r=i<.5?i*(1+e):i+e-i*e,a=2*i-r;s=l(a,r,t+1/3),n=l(a,r,t),o=l(a,r,t-1/3)}return{r:Math.round(255*s),g:Math.round(255*n),b:Math.round(255*o)}}([i,s,n]),c=`#${function({r:t,g:e,b:i}){let s=Math.floor(t).toString(16);t<16&&(s=`0${s}`);let n=Math.floor(e).toString(16);e<16&&(n=`0${n}`);let o=Math.floor(i).toString(16);i<16&&(o=`0${o}`);return`${s}${n}${o}`.toUpperCase()}({r,g:a,b:h})}`;return{hex:c,r,g:a,b:h,h:i,s,l:xo(n)}}function Co(){so.clearRect(0,0,Dn,Dn),so.drawImage(to,0,0),so.globalAlpha=Zn,so.fillStyle="black",so.beginPath(),so.arc(qn,qn,qn,0,2*Math.PI),so.fill(),so.globalAlpha=1}function wo(t){return t*Math.PI/180}function xo(t){const e=Math.pow(10,10);return Math.round(t*e)/e}function ko(){!function(t){if(!t)return void console.warn("[HueSlider.fail] Context not found.");for(let e=0;e<=360;e+=.5)for(let i=0;i<=qn;i+=1){t.beginPath();const s=50+(qn-i)/qn*50;t.fillStyle=`hsl(${e}, 100%, ${s}%)`;const n=qn+Math.cos(wo(e))*i,o=qn-Math.sin(wo(e))*i;t.arc(n,o,1.5,0,2*Math.PI),t.fill()}Jn=!0}(eo),Jn&&Co()}ko();const Eo=class extends re{#Jt;#Qt;#te;#ee;#ie;#se;constructor(t,e={},i=""){if(super(t.editor),this.inst=t,this.ctx={wheelX:jn,wheelY:Xn,lightness:Zn,wheelPointerX:"50%",wheelPointerY:"50%",gradientPointerX:"calc(100% - 14px)",color:Wn},this.isOpen=!1,this.controlle=null,this.#Jt=null,this.#Qt=null,this.#te=null,this.#ee=null,this.#ie=null,this.#se=null,!e.isNewForm){const s=function({lang:t,icons:e},i){const s=xt.utils.createElement("DIV",{class:`se-controller ${i}`},`\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 s}(t.editor,i);this.circle=s.querySelector(".se-hue"),this.controller=new as(this,s,{position:"bottom",isWWTarget:!1,parents:[t.form],parentsHide:!0,...e.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 Kn}open(t){this.attach(),this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null})}close(){this.ctx={gradientPointerX:lo.style.left,wheelPointerX:no.style.left,wheelPointerY:no.style.top,wheelX:jn,wheelY:Xn,lightness:Zn,color:Un?.color||""},this.controller.close()}attach(t){Jn||ko(),this.init(),(t||this.circle).appendChild(Qn),Un=this.ctx,Un&&(jn=Un.wheelX,Xn=Un.wheelY,Zn=Un.lightness,no.style.left=Un.wheelPointerX,no.style.top=Un.wheelPointerY,lo.style.left=Un.gradientPointerX,vo(Un.color.hex),Co(),fo(bo())),Pn&&(this.#ie=this.eventManager.addGlobalEvent("touchstart",ho,{passive:!1,capture:!0}),this.#Qt=this.eventManager.addGlobalEvent("touchmove",co,!0),this.#se=this.eventManager.addGlobalEvent("touchend",(()=>{Gn=!1,Yn=!1}),!0)),this.#Jt=this.eventManager.addGlobalEvent("mousedown",uo,{passive:!1,capture:!0}),this.#ee=this.eventManager.addGlobalEvent("mousemove",po,!0),this.#te=this.eventManager.addGlobalEvent("mouseup",(()=>{Gn=!1,Yn=!1}),!0),this.isOpen=!0}init(){this.isOpen=!1,Gn=!1,Yn=!1,this.#Jt&&=this.eventManager.removeGlobalEvent(this.#Jt),this.#ee&&=this.eventManager.removeGlobalEvent(this.#ee),this.#te&&=this.eventManager.removeGlobalEvent(this.#te),this.#ie&&=this.eventManager.removeGlobalEvent(this.#ie),this.#Qt&&=this.eventManager.removeGlobalEvent(this.#Qt),this.#se&&=this.eventManager.removeGlobalEvent(this.#se)}},So=["#ff0000","#ff5e00","#ffe400","#abf200","#00d8ff","#0055ff","#6600ff","#ff00dd","#000000","#ffd8d8","#fae0d4","#faf4c0","#e4f7ba","#d4f4fa","#d9e5ff","#e8d9ff","#ffd9fa","#f1f1f1","#ffa7a7","#ffc19e","#faed7d","#cef279","#b2ebf4","#b2ccff","#d1b2ff","#ffb2f5","#bdbdbd","#f15f5f","#f29661","#e5d85c","#bce55c","#5cd1e5","#6699ff","#a366ff","#f261df","#8c8c8c","#980000","#993800","#998a00","#6b9900","#008299","#003399","#3d0099","#990085","#353535","#670000","#662500","#665c00","#476600","#005766","#002266","#290066","#660058","#222222"];function To(t,e){const i=`<ul class="se-color-pallet${e?" se-list-horizontal":""}">`;let s=i;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&&(s+=`</ul>${i}`),s+=`<li><button type="button" data-value="${o}" title="${l}" aria-label="${l}" style="background-color:${o};"></button></li>`;return s+="</ul>",s}const Ho=class extends re{constructor(t,e,i){const s=t.editor;super(s),this.kind=t.constructor.key||t.constructor.name,this.inst=t,this.form=i.form,this.target=function({lang:t,icons:e},{colorList:i,disableHEXInput:s,disableRemove:n,splitNum:o}){i||=So,o=i===So?9:o;let l="";for(let t,e=0,s=i.length,n=[];e<s;e++)t=i[e],t&&(("string"==typeof t||t.value)&&(n.push(t),e<s-1)||(n.length>0&&(l+=`<div class="se-selector-color">${To(n,o)}</div>`,n=[]),"object"==typeof t&&(l+=`<div class="se-selector-color">${To(t,o)}</div>`)));return l+=`\n\t\t<form class="se-form-group se-form-w0">\n\t\t\t${s?"":`<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" ${s?"readonly":""} placeholder="${t.color}" />\n\t\t\t${s?"":`<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>`,xt.utils.createElement("DIV",{class:"se-list-inner"},l)}(s,i),this.targetButton=null,this.inputElement=this.target.querySelector(".se-color-input"),this.styleProperties=e,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.icons.color_checked,"image/svg+xml");this.checkedIcon=n.documentElement,i.disableHEXInput||(this.hueSlider=new Eo(this,i.hueSliderOptions,"se-dropdown"),this.eventManager.addEvent(this.target.querySelector(".__se_hue"),"click",this.#ne.bind(this)),this.eventManager.addEvent(this.inputElement,"input",this.#oe.bind(this)),this.eventManager.addEvent(this.target.querySelector("form"),"submit",this.#le.bind(this))),i.disableRemove||this.eventManager.addEvent(this.target.querySelector(".__se_remove"),"click",this.#re.bind(this)),this.eventManager.addEvent(this.target,"click",this.#ae.bind(this)),this.form.appendChild(this.target)}init(t,e,i){this.targetButton=e,"function"!=typeof i&&(i=()=>!1);let s=("string"==typeof t?t:this.#he(t,i))||this.defaultColor;s=wt.isHexColor(s)?s:wt.rgb2hex(s)||s||"";const n=this.colorList;for(let t,e=0,i=n.length;e<i;e++)t=n[e],s.toLowerCase()===t.getAttribute("data-value").toLowerCase()?(t.appendChild(this.checkedIcon),xt.utils.addClass(t,"active")):(xt.utils.removeClass(t,"active"),t.contains(this.checkedIcon)&&xt.utils.removeItem(this.checkedIcon));this.#ce(this.#de(s))}setHexColor(t){this.currentColor=t,this.inputElement.style.borderColor=t}hueSliderClose(){this.hueSlider.close()}hueSliderAction(t){this.#ce(t.hex)}hueSliderCancelAction(){this.form.style.display="block",this.inst.colorPickerHueSliderClose?.()}#ce(t){t=!t||/^#/.test(t)?t:"#"+t,this.inputElement.value=t,this.setHexColor.call(this,t)}#he(t,e){let i="";const s=this.styleProperties;for(;t&&!e(t)&&!xt.check.isWysiwygFrame(t)&&0===i.length;)R(t)&&t.style[s]&&(i=t.style[s]),t=t.parentNode;return i}#de(t){if(!t||/^#/.test(t))return t;const e=xt.utils.createElement("div",{style:"display: none; color: "+t}),i=this._w.getComputedStyle(this._d.body.appendChild(e)).color.match(/\d+/g).map((function(t){return parseInt(t,10)}));return xt.utils.removeItem(e),i.length>=3?"#"+((1<<24)+(i[0]<<16)+(i[1]<<8)+i[2]).toString(16).substring(1):""}#ne(){this.hueSlider.open(this.targetButton),this.inst.colorPickerHueSliderOpen?.()}#le(t){t.preventDefault(),this.inst.colorPickerAction?.(this.currentColor)}#ae(t){const e=xt.query.getEventTarget(t).getAttribute("data-value");e&&this.inst.colorPickerAction?.(e)}#re(){this.inst.colorPickerAction?.(null)}#oe(t){const e=xt.query.getEventTarget(t);this.setHexColor(e.value)}},{_w:Lo}=_t,Mo={w:"ns-resize",h:"ew-resize",c:"nwse-resize",wRTL:"ns-resize",hRTL:"ew-resize",cRTL:"nesw-resize"};const No=class extends re{#ue;#pe;#ge;#me;#It;#Vt;#fe;#be;#ye;#ve;#i;#_e;#Ce;constructor(t,e){super(t.editor),this.ui=this.editor.ui,this.offset=this.editor.offset,this.inst=t,this.kind=t.constructor.key||t.constructor.name,this.form=e,this.isUpdate=!1,this.focusElement=e.querySelector("[data-focus]"),this.#ue=this.carrierWrapper.querySelector(".se-modal"),this.#pe=this.carrierWrapper.querySelector(".se-modal .se-modal-inner"),this.#me=[this.#we.bind(this),this.#xe.bind(this)],this.#It=null,this.#Vt=!1,this.#ge=null,this.#pe.appendChild(e),this.eventManager.addEvent(e.querySelector("form"),"submit",this.#p.bind(this)),this.#Vt=!this.eventManager.addEvent(e.querySelector('[data-command="close"]'),"click",this.close.bind(this)),(e.querySelector(".se-modal-resize-handle-w")||e.querySelector(".se-modal-resize-handle-h")||e.querySelector(".se-modal-resize-handle-c")||e.querySelector(".se-modal-resize-form"))&&!(this.#ge=e.querySelector(".se-modal-resize-form"))&&(this.#ge=e.querySelector(".se-modal-body"))&&(this.eventManager.addEvent(e.querySelector(".se-modal-resize-handle-w"),"mousedown",this.#ke.bind(this,"w")),this.eventManager.addEvent(e.querySelector(".se-modal-resize-handle-h"),"mousedown",this.#ke.bind(this,"h")),this.eventManager.addEvent(e.querySelector(".se-modal-resize-handle-c"),"mousedown",this.#ke.bind(this,"c")),this.#fe=null,this.#be="",this.#ye=0,this.#ve=0,this.#i={mousemove:this.#Ee.bind(this),mouseup:this.#Se.bind(this)},this.#_e=null,this.#Ce=null)}static CreateFileInput({icons:t,lang:e},{acceptedFormats:i,allowMultiple:s}){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="${i}"${s?' 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${xt.utils.createTooltipInner(e.remove)}\n\t\t\t</button>\n\t\t</div>`}static OnChangeFile(t,e){if(!t||!e)return;const i=t.querySelector(".se-input-file-cnt"),s=t.querySelector(".se-input-file-icon-up"),n=t.querySelector(".se-input-file-icon-files");e.length>1?(s.style.display="none",n.style.display="inline-block",i.style.display="",i.textContent=` ..${e.length}`):e.length>0?(s.style.display="none",n.style.display="none",i.style.display="block",i.textContent=e[0].name):(s.style.display="inline-block",n.style.display="none",i.style.display="",i.textContent="")}open(){if(this.ui._offCurrentModal(),this.#Te(!0),this.#Vt&&this.#pe.addEventListener("click",this.#me[1]),this.#It&&=this.eventManager.removeGlobalEvent(this.#It),this.#It=this.eventManager.addGlobalEvent("keydown",this.#me[0]),this.isUpdate=this.kind===this.editor.currentControllerName,this.editor.opendModal=this,this.isUpdate||this.inst.modalInit?.(),this.inst.modalOn?.(this.isUpdate),xt.utils.addClass(this.#ue,"se-backdrop-show"),xt.utils.addClass(this.form,"se-modal-show"),this.#ge){const t=this.#He(),{maxWidth:e,maxHeight:i}=Lo.getComputedStyle(this.form),s=this.form.offsetWidth-t.width+"px",n=`${this.form.offsetTop+(this.form.offsetHeight-this.#ge.offsetHeight)}px`;e&&"string"==typeof this.#be&&xt.utils.setStyle(this.#ge,"max-width",`calc(${e} - ${s})`),i&&xt.utils.setStyle(this.#ge,"max-height",`calc(${i} - ${n})`)}this.focusElement&&this.focusElement.focus()}close(){this.#_(),this.#Te(!1),Lo.setTimeout((()=>{this.editor.opendModal=null}),0),this.#Vt&&this.#pe.removeEventListener("click",this.#me[1]),this.#It&&=this.eventManager.removeGlobalEvent(this.#It),xt.utils.removeClass(this.#ue,"se-backdrop-show"),xt.utils.removeClass(this.form,"se-modal-show"),this.inst.modalInit?.(),this.inst.modalOff?.(this.isUpdate),this.isUpdate||this.editor.focus()}#Te(t){const e=this.editor.opendControllers;for(let i=0;i<e.length;i++)e[i].fixed=t,e[i].form.style.display=t?"none":"block"}#He(){const t=this.offset.getGlobal(this.#ge);return this.#ye=t.top,this.#ve=t.left,t}#f(t){this.#_(),this.ui.enableBackWrapper(Mo[t]),this.#_e=this.eventManager.addGlobalEvent("mousemove",this.#i.mousemove,!0),this.#Ce=this.eventManager.addGlobalEvent("mouseup",this.#i.mouseup,!0)}#_(){this.ui.disableBackWrapper(),this.#_e&&=this.eventManager.removeGlobalEvent(this.#_e),this.#Ce&&=this.eventManager.removeGlobalEvent(this.#Ce)}async#p(t){t.preventDefault(),t.stopPropagation(),this.ui.showLoading();try{const t=await this.inst.modalAction();!1===t?this.ui.hideLoading():void 0===t?this.close():(this.close(),this.ui.hideLoading())}catch(t){throw this.close(),this.ui.hideLoading(),Error(`[SUNEDITOR.Modal[${this.kind}].warn] ${t.message}`)}}#xe(t){const e=xt.query.getEventTarget(t);(/close/.test(e.getAttribute("data-command"))||e===this.#pe)&&this.close()}#we(t){Et.isEsc(t.code)&&this.close()}#ke(t,e){this.#fe=xt.query.getEventTarget(e),xt.utils.addClass(this.#fe,"active"),this.#f(this.#be=t+(this.options.get("_rtl")?"RTL":""))}#Ee(t){switch(this.#be){case"w":case"wRTL":{const e=t.clientY-this.#ye-this.#ge.offsetHeight;this.#ge.style.height=this.#ge.offsetHeight+e+"px";break}case"h":{const e=t.clientX-this.#ve-this.#ge.offsetWidth;this.#ge.style.width=this.#ge.offsetWidth+e+"px";break}case"hRTL":{const e=this.#ve-t.clientX;this.#ge.style.width=this.#ge.offsetWidth+e+"px";break}case"c":{const e=t.clientX-this.#ve-this.#ge.offsetWidth,i=t.clientY-this.#ye-this.#ge.offsetHeight;this.#ge.style.width=this.#ge.offsetWidth+e+"px",this.#ge.style.height=this.#ge.offsetHeight+i+"px";break}case"cRTL":{const e=this.#ve-t.clientX,i=t.clientY-this.#ye-this.#ge.offsetHeight;this.#ge.style.width=this.#ge.offsetWidth+e+"px",this.#ge.style.height=this.#ge.offsetHeight+i+"px";break}}this.#He(),this.inst.modalResize?.()}#Se(){xt.utils.removeClass(this.#fe,"active"),this.#fe=null,this.#_()}};function Ao(t,e){const i=t.getAttribute(`data-se-${e}`);if(i)return i;const s=t.getAttribute(`data-${e}`);return s?(t.removeAttribute(`data-${e}`),t.setAttribute(`data-se-${e}`,s),s):null}const Bo=class extends re{constructor(t,e){super(t.editor),this.ui=this.editor.ui,t.__fileManagement=this,this.kind=t.constructor.key||t.constructor.name,this.inst=t,this.query=e.query,this.loadEventName=e.loadEventName,this.actionEventName=e.actionEventName,this.infoList=[],this.infoIndex=0,this.uploadFileLength=0,this.__updateTags=[],this.apiManager=new Fn(this,null),this._resetInfo,this._checkInfo}upload(t,e,i,s,n){this.ui.showLoading();let o=null;if("length"in i){o=new FormData;for(let t=0,e=i.length;t<e;t++)o.append("file-"+t,i[t]);this.uploadFileLength=i.length}else o=i.formData,this.uploadFileLength=i.size;this.apiManager.call({method:"POST",url:t,headers:e,data:o,callBack:s,errorCallBack:n})}async asyncUpload(t,e,i){this.ui.showLoading();let s=null;if("length"in i){s=new FormData;for(let t=0,e=i.length;t<e;t++)s.append("file-"+t,i[t]);this.uploadFileLength=i.length}else s=i.formData,this.uploadFileLength=i.size;return await this.apiManager.asyncCall({method:"POST",url:t,headers:e,data:s})}setFileData(t,{name:e,size:i}){t&&(t.setAttribute("data-se-file-name",e),t.setAttribute("data-se-file-size",i+""))}getSize(){let t=0;for(let e=0,i=this.infoList.length;e<i;e++)t+=1*this.infoList[e].size;return t}_checkInfo(t){const e=[].slice.call(this.frameContext.get("wysiwyg").querySelectorAll(this.query)),i=this.infoList;if(e.length===i.length){if(this.editor._componentsInfoReset){for(let t=0,i=e.length;t<i;t++)this.#Le(e[t],null);return}{let t=!1;for(let s,n=0,o=i.length;n<o;n++)if(s=i[n],0===e.filter((function(t){return s.src===t.src&&s.index.toString()===Ao(t,"index")})).length){t=!0;break}if(!t)return}}const s=[],n=[];for(let t=0,e=i.length;t<e;t++)n[t]=i[t].index;for(this.__updateTags=e;e.length>0;){const t=e.shift();Ao(t,"index")&&n.includes(Number(Ao(t,"index")))?s.push(Number(Ao(t,"index"))):(s.push(this.infoIndex),t.removeAttribute("data-se-index"),this.#Le(t,null))}if(t&&this.loadEventName)this.triggerEvent(this.loadEventName,{infoList:i});else for(let t,e=0;e<i.length;e++){if(t=i[e].index,s.includes(t))continue;i.splice(e,1);const n={editor:this.editor,element:null,index:t,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind};this.actionEventName&&this.triggerEvent(this.actionEventName,n),this.triggerEvent("onFileManagerAction",{...n,pluginName:this.kind}),e--}}_resetInfo(){const t={editor:this.editor,element:null,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind};for(let e=0,i=this.infoList.length;e<i;e++)this.actionEventName&&this.triggerEvent(this.actionEventName,{...t,index:this.infoList[e].index,pluginName:this.kind}),this.triggerEvent("onFileManagerAction",{...t,index:this.infoList[e].index,pluginName:this.kind});this.infoList=[],this.infoIndex=0}#Me(t){if(t>=0)for(let e=0,i=this.infoList.length;e<i;e++)if(t===this.infoList[e].index)return this.infoList.splice(e,1),void(this.actionEventName&&this.triggerEvent(this.actionEventName,{editor:this.editor,element:null,index:t,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind}))}#Le(t,e){let i=Number(Ao(t,"index")),s=null,n="";if(e||={name:Ao(t,"file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:Number(Ao(t,"file-size"))||0},!i||this.editor._componentsInfoInit)n="create",i=this.infoIndex++,t.setAttribute("data-se-index",i+""),t.setAttribute("data-se-file-name",e.name),t.setAttribute("data-se-file-size",e.size+""),s={src:t.src,index:i,name:e.name,size:e.size},this.infoList.push(s);else{n="update",i*=1;for(let t=0,e=this.infoList.length;t<e;t++)if(i===this.infoList[t].index){s=this.infoList[t];break}s||(i=this.infoIndex++,s={index:i},this.infoList.push(s)),s.src=t.src,s.name=Ao(t,"file-name"),s.size=Number(Ao(t,"file-size"))}s.element=t,s.delete=function(t,e){this.inst.componentDestroy?.(e),t(Number(Ao(e,"index")))}.bind(this,this.#Me.bind(this),t),s.select=function(t){t.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"});const e=this.component.get(t);e?this.component.select(e.target,e.pluginName):this.inst.componentSelect?.(t)}.bind(this,t);const o={editor:this.editor,element:t,index:i,state:n,info:s,remainingFilesCount:--this.uploadFileLength<0?0:this.uploadFileLength,pluginName:this.kind};this.actionEventName&&this.triggerEvent(this.actionEventName,o),this.triggerEvent("onFileManagerAction",{...o,pluginName:this.kind})}},{_w:Vo,NO_EVENT:Io}=_t;const Oo=class extends re{#Ne;#Ae;#Be;#Ve;constructor(t,e,i){super(t.editor),this.selection=this.editor.selection,this.ui=this.editor.ui,this.openNewWindow=!!i.openNewWindow,this.relList=Array.isArray(i.relList)?i.relList:[],this.defaultRel=i.defaultRel||{},this.noAutoPrefix=!!i.noAutoPrefix,i.enableFileUpload&&(this.uploadUrl="string"==typeof i.uploadUrl?i.uploadUrl:null,this.uploadHeaders=i.uploadHeaders||null,this.uploadSizeLimit=kt.get(i.uploadSizeLimit,0)||null,this.uploadSingleSizeLimit=kt.get(i.uploadSingleSizeLimit,0)||null,this.input=xt.utils.createElement("input",{type:"file",accept:i.acceptedFormats||"*"}),this.eventManager.addEvent(this.input,"change",this.#Ie.bind(this)),this.fileManager=new Bo(this,{query:"a[download]:not([data-se-file-download])",loadEventName:"onFileLoad",actionEventName:"onFileAction"}));const s=function(t,e,i){const s=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>${s.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="${s.fileUpload}">\n\t\t\t\t\t\t\t\t\t${n.file_upload}\n\t\t\t\t\t\t\t\t\t${xt.utils.createTooltipInner(s.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="${s.link_modal_bookmark}">\n\t\t\t\t\t\t${n.bookmark}\n\t\t\t\t\t\t${xt.utils.createTooltipInner(s.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}>${s.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}>${s.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" /> ${s.link_modal_newWindowCheck}</label>\n\t\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_anchor_download" /> ${s.link_modal_downloadLinkCheck}</label>`;i.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="${s.link_modal_relAttribute}" aria-label="${s.link_modal_relAttribute}">\n\t\t\t\t\t${n.link_rel}\n\t\t\t\t\t${xt.utils.createTooltipInner(s.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>",xt.utils.createElement("DIV",null,r)}(t.editor,i,this.relList);if(this.kink=t.constructor.key||t.constructor.name,this.inst=t,this.host=(Vo.location.origin+Vo.location.pathname).replace(/\/$/,""),this.urlInput=s.querySelector(".se-input-url"),this.displayInput=s.querySelector("._se_display_text"),this.titleInput=s.querySelector("._se_title"),this.newWindowCheck=s.querySelector("._se_anchor_check"),this.downloadCheck=s.querySelector("._se_anchor_download"),this.download=s.querySelector("._se_anchor_download_icon"),this.preview=s.querySelector(".se-link-preview"),this.bookmark=s.querySelector("._se_anchor_bookmark_icon"),this.bookmarkButton=s.querySelector("._se_bookmark_button"),this.currentRel=[],this.currentTarget=null,this.linkValue="",this.#Ae=this.relList.length>0,this.#Ae){this.relButton=s.querySelector(".se-anchor-rel-btn"),this.relPreview=s.querySelector(".se-anchor-rel-preview");const t=this.relList,e=(this.defaultRel.default||"").split(" "),i=[];for(let s,n=0,o=t.length;n<o;n++)s=t[n],i.push(xt.utils.createElement("BUTTON",{type:"button",class:"se-btn-list"+(e.includes(s)?" se-checked":""),"data-command":s,title:s,"aria-label":s},s+'<span class="se-svg">'+this.icons.checked+"</span>"));this.#Be=new cs(this,{checkList:!0,position:"right-middle",dir:"ltr"}),this.#Be.on(this.relButton,this.#Oe.bind(this)),this.#Be.create(i),this.eventManager.addEvent(this.relButton,"click",this.#Re.bind(this))}this.#Ne=e,this.#Ne.querySelector(".se-anchor-editor").appendChild(s),this.#Ve=new cs(this,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.#Ve.on(this.urlInput,this.#Fe.bind(this)),this.eventManager.addEvent(this.newWindowCheck,"change",this.#ze.bind(this)),this.eventManager.addEvent(this.downloadCheck,"change",this.#$e.bind(this)),this.eventManager.addEvent(this.urlInput,"input",this.#Pe.bind(this)),this.eventManager.addEvent(this.urlInput,"focus",this.#De.bind(this)),this.eventManager.addEvent(this.bookmarkButton,"click",this.#qe.bind(this)),this.eventManager.addEvent(s.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.#We(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.selection.get().toString().trim(),this.newWindowCheck.checked=this.openNewWindow,this.titleInput.value="";this.#Ue(t&&this.currentTarget?this.currentTarget.rel:this.defaultRel.default||""),this.#Ze(this.linkValue)}create(t){if(0===this.linkValue.length)return null;const e=this.linkValue,i=0===this.displayInput.value.length?e:this.displayInput.value,s=this.currentTarget||xt.utils.createElement("A");return this.#Ge(s,e,i,this.titleInput.value,t),this.linkValue=this.preview.textContent=this.urlInput.value=this.displayInput.value="",s}init(){this.currentTarget=null,this.linkValue=this.preview.textContent=this.urlInput.value="",this.displayInput.value="",this.newWindowCheck.checked=!1,this.downloadCheck.checked=!1,this.#Ue(this.defaultRel.default||"")}#Ge(t,e,i,s,n){!this.#We(e)&&this.downloadCheck.checked?t.setAttribute("download",i||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,s?t.title=s:t.removeAttribute("title"),n?0===t.children.length&&(t.textContent=""):t.textContent=i}#We(t){const e=Vo.location.href.replace(/\/$/,"");return 0===t.indexOf("#")||0===t.indexOf(e)&&t.indexOf("#")===(e.includes("#")?e.substring(0,e.indexOf("#")).length:e.length)}#Ue(t){if(!this.#Ae)return;const e=this.currentRel=t?t.split(" "):[],i=this.#Be.form.querySelectorAll("button");for(let t,s=0,n=i.length;s<n;s++)t=i[s].getAttribute("data-command"),e.includes(t)?xt.utils.addClass(i[s],"se-checked"):xt.utils.removeClass(i[s],"se-checked");this.relPreview.title=this.relPreview.textContent=e.join(" "),e.length>0?xt.utils.addClass(this.relButton,"on"):xt.utils.removeClass(this.relButton,"on")}#Ye(t){const e=xt.query.getListChildren(this.frameContext.get("wysiwyg"),(t=>/h[1-6]/i.test(t.nodeName)||xt.check.isAnchor(t)&&!!t.id),null);if(0===e.length)return;const i=new RegExp(`^${t.replace(/^#/,"")}`,"i"),s=[],n=[];for(let t,o=0,l=e.length;o<l;o++)t=e[o],i.test(t.textContent)&&(s.push(t),n.push(xt.check.isAnchor(t)?`<div><span class="se-text-prefix-icon">${this.icons.bookmark_anchor}</span>${t.id}</div>`:`<div style="${t.style.cssText}">${t.textContent}</div>`));0===s.length?this.#Ve.close():(this.#Ve.create(s,n),this.#Ve.open(this.options.get("_rtl")?"bottom-right":""))}#Ze(t){const e=this.preview,i=this.options.get("defaultUrlProtocol"),s=this.noAutoPrefix,n=/^(mailto:|tel:|sms:|https*:\/\/|#)/.test(t)||0===t.indexOf(i),o=!!i&&RegExp("^"+Ct.escapeStringRegexp(t.substring(0,i.length))).test(i);t=this.linkValue=e.textContent=t?s?t:!i||n||o?n?t:/^www\./.test(t)?"http://"+t:this.host+(/^\//.test(t)?"":"/")+t:i+t:"",this.#We(t)?(this.bookmark.style.display="block",xt.utils.addClass(this.bookmarkButton,"active")):(this.bookmark.style.display="none",xt.utils.removeClass(this.bookmarkButton,"active")),!this.#We(t)&&this.downloadCheck.checked?this.download.style.display="block":this.download.style.display="none"}#je(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 i=t.split(" ");for(let t=0,s=i.length;t<s;t++)e.includes(i[t])||e.push(i[t]);return e.join(" ")}#Xe(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}#Ke(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#Je(t){const e=await this.triggerEvent("onFileUploadError",{error:t});if(!1===e)return;const i=e===Io?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.fileUpload.error]",i)}#Qe(t){const e=JSON.parse(t.responseText);e.errorMessage?this.#Je(e):this.#Ke(e)}async#Ie(t){const e=xt.query.getEventTarget(t).files;if(!e[0])return;const i={url:this.uploadUrl,uploadHeaders:this.uploadHeaders,files:e},s=async function(t,e,i){e=i||e;t(await this.fileManager.asyncUpload(e.url,e.uploadHeaders,e.files))}.bind(this,this.#Qe.bind(this),i),n=await this.triggerEvent("onFileUploadBefore",{info:i,handler:s});return void 0===n||!1!==n&&(null!==n&&"object"==typeof n&&s(n),void(!0!==n&&n!==Io||s(null)))}#Re(){this.#Be.open(this.options.get("_rtl")?"left-middle":"")}#Fe(t){const e=t.id||"h_"+Math.random().toString().replace(/.+\./,"");t.id=e,this.urlInput.value="#"+e,this.#Ze(this.urlInput.value),this.#Ve.close(),this.urlInput.focus()}#Oe(t){const e=t.getAttribute("data-command");if(!e)return;const i=this.currentRel,s=i.indexOf(e);-1===s?i.push(e):i.splice(s,1),this.relPreview.title=this.relPreview.textContent=i.join(", ")}#Pe(t){const e=xt.query.getEventTarget(t).value.trim();this.#Ze(e),this.#We(e)?this.#Ye(e):this.#Ve.close()}#De(){const t=this.urlInput.value;this.#We(t)&&this.#Ye(t)}#qe(){let t=this.urlInput.value;this.#We(t)?(t=t.substring(1),this.bookmark.style.display="none",xt.utils.removeClass(this.bookmarkButton,"active")):(t="#"+t,this.bookmark.style.display="block",xt.utils.addClass(this.bookmarkButton,"active"),this.downloadCheck.checked=!1,this.download.style.display="none",this.#Ye(t)),this.urlInput.value=t,this.#Ze(t),this.urlInput.focus()}#ze(t){if("string"!=typeof this.defaultRel.check_new_window)return;xt.query.getEventTarget(t).checked?this.#Ue(this.#je(this.defaultRel.check_new_window)):this.#Ue(this.#Xe(this.defaultRel.check_new_window))}#$e(t){xt.query.getEventTarget(t).checked?(this.download.style.display="block",this.bookmark.style.display="none",xt.utils.removeClass(this.bookmarkButton,"active"),this.linkValue=this.preview.textContent=this.urlInput.value=this.urlInput.value.replace(/^#+/,""),"string"==typeof this.defaultRel.check_bookmark&&this.#Ue(this.#je(this.defaultRel.check_bookmark))):(this.download.style.display="none","string"==typeof this.defaultRel.check_bookmark&&this.#Ue(this.#Xe(this.defaultRel.check_bookmark)))}},Ro={init(t){return{create:(e,i)=>this.create(e,i,t)}},create(t,e,i){if("object"!=typeof e&&(e={}),i&&(e=[i,e].reduce(((t,e)=>(Object.entries(e).forEach((([e,i])=>{if("plugins"===e&&i&&t[e]){const s=Array.isArray(t[e])?t[e]:Object.values(t[e]),n=Array.isArray(i)?i:Object.values(i);t[e]=[...n.filter((t=>!s.includes(t))),...s]}else t[e]=i})),t)),{})),!t)throw Error('[SUNEDITOR.create.fail] The first parameter "target" is missing.');const s=[];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.`);s.push({key:null,target:e})}else if(1===t.nodeType)s.push({key:null,target:t});else{let e;for(const i in t){if(e=t[i],!e.target||1!==e.target.nodeType)throw Error('[SUNEDITOR.create.fail] suneditor multi root requires textarea\'s element at the "target" property.');e.key=i,s.push(e)}}return new On(s,e)}};const Fo=function(t){this.editor,this.eventManager,this.instanceCheck,this.history,this.events,this.triggerEvent,this.carrierWrapper,this.plugins,this.status,this.frameContext=t.frameContext,this.frameOptions=t.frameOptions,this.context,this.options,this.icons,this.lang,this.frameRoots,this._w,this._d,this.toolbar,this.subToolbar,this.char,this.component,this.format,this.html,this.inline,this.listFormat,this.menu,this.nodeTransform,this.offset,this.selection,this.shortcuts,this.ui,this.viewer,re.call(this,t),Ki.call(this,t)};class zo extends Fo{static type="";static key="";static className="";static options={};constructor(t){super(t),this.title="",this.icon="",this.beforeItem=null,this.afterItem=null,this.replaceButton=null}}class $o extends zo{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 Po extends zo{static type="command";action(t){throw new Error(`[${this.constructor.name}] Abstract method 'action()' must be implemented`)}}class Do extends zo{static type="dropdown";on(t){}action(t){throw new Error(`[${this.constructor.name}] Abstract method 'action()' must be implemented`)}}class qo extends zo{static type="dropdown-free";on(t){}off(){}}class Wo extends zo{static type="field"}class Uo extends zo{static type="input";toolbarInputKeyDown(t){}toolbarInputChange(t){}}class Zo extends zo{static type="modal";open(t){throw new Error(`[${this.constructor.name}] Abstract method 'open()' must be implemented`)}}class Go extends zo{static type="popup";show(){throw new Error(`[${this.constructor.name}] Abstract method 'show()' must be implemented`)}}const Yo=class extends Po{static key="blockquote";static className="";constructor(t){super(t),this.title=this.lang.tag_blockquote,this.icon="blockquote",this.quoteTag=xt.utils.createElement("BLOCKQUOTE")}active(t,e){return/blockquote/i.test(t?.nodeName)?(xt.utils.addClass(e,"active"),!0):(xt.utils.removeClass(e,"active"),!1)}action(){const t=xt.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))}},{_w:jo,_d:Xo}=_t;const Ko=class extends Po{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 Fn(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"),i=xt.utils.createElement("div",{class:e.className},e.innerHTML);t=xt.utils.createElement("div",{style:"position: absolute; top: -10000px; left: -10000px; width: 21cm; columns: 21cm; height: auto;"},i);const s=jo.getComputedStyle(e).padding,n=xt.utils.applyInlineStylesAll(i,!0,this.options.get("allUsedStyles"));if(n.style.padding=n.style.paddingTop=n.style.paddingBottom=n.style.paddingLeft=n.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: ${s};\n\t\t\t\t\t}\n\t\t\t\t</style>\n\t\t\t\t${n.outerHTML}`,Xo.body.appendChild(t),!1===await this.triggerEvent("onExportPDFBefore",{target:t}))return;return void await this.#ti(t)}catch(t){console.error("[SUNEDITOR.plugins.exportPDF.error]",t.message)}finally{xt.utils.removeItem(t),this.ui.hideLoading()}}async#ti(t){const e={fileName:this.fileName,htmlContent:t.innerHTML},i=await this.apiManager.asyncCall({data:JSON.stringify(e)});if(200!==i.status){const t=i.responseText?JSON.parse(i.responseText):i;throw Error(`[SUNEDITOR.plugins.exportPDF.error] ${t.errorMessage}`)}const s=new Blob([i.response],{type:"application/pdf"}),n=i.getResponseHeader("Content-Disposition"),o=URL.createObjectURL(s),l=(n.match(/filename="([^"]+)/)||[])[1]||this.fileName+".pdf",r=xt.utils.createElement("A",{href:o,download:l,style:"display: none;"},null);try{Xo.body.appendChild(r),r.click()}finally{jo.setTimeout((()=>{xt.utils.removeItem(r),URL.revokeObjectURL(o)}),100)}}},{NO_EVENT:Jo}=_t;class Qo extends Po{static key="fileUpload";static className="";static options={eventIndex:1e4};static component(t){return xt.check.isAnchor(t)&&t.hasAttribute("data-se-file-download")?t:null}#ei;#ii;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=kt.get(e.uploadSizeLimit,0),this.uploadSingleSizeLimit=kt.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=xt.utils.createElement("input",{type:"file",accept:this.acceptedFormats}),this.allowMultiple&&this.input.setAttribute("multiple","multiple"),this.#ei=this.acceptedFormats.split(", "),this.#ii=null;const i={"custom-download":{command:"download",title:this.lang.download,icon:"download",action:t=>{const e=t.getAttribute("href");e&&xt.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)}}},s=(e.controls||[["custom-as","align","edit","custom-download","copy","remove"]]).map((t=>t.map((t=>t.startsWith("custom-")?i[t]:t))));if(this.figure=new ws(this,s,{}),this.fileManager=new Bo(this,{query:"a[download][data-se-file-download]",loadEventName:"onFileLoad",actionEventName:"onFileAction"}),/\bedit\b/.test(JSON.stringify(s))){const t=function({lang:t,icons:e}){const i=`\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 xt.utils.createElement("DIV",{class:"se-controller se-controller-simple-input"},i)}(this);this.controller=new as(this,t,{position:"bottom",disabled:!0},Qo.key),this.editInput=t.querySelector("input")}this.eventManager.addEvent(this.input,"change",this.#Ie.bind(this))}action(){this.editor._preventBlur=!0,this.input.click()}onFilePasteAndDrop({file:t}){const e=t.type;this.#ei.some((t=>!!t.startsWith("*")||(!!t.startsWith(e)||void 0)))&&(this.submitFile([t]),this.editor.focus())}controllerAction(t){const e=t.getAttribute("data-command");if(e){if("edit"===e){if(0===this.editInput.value.trim().length)return;this.#ii.textContent=this.editInput.value}this.controller.close(),this.component.select(this.#ii,Qo.key)}}componentSelect(t){this.#ii=t;const e=this.figure.controller.form.querySelector('[data-command="__c__as"]');if(e)return xt.check.isFigure(t.parentElement)?(e.innerHTML=this.icons.reduction+xt.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+xt.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:!xt.check.isFigure(t.parentElement),initMethod:null,addOffset:null}),this.editInput.focus()}async componentDestroy(t){if(!t)return;const e=ws.GetContainer(t),i=xt.query.getParentElement(t,".se-component")||t;if(!1===await this.triggerEvent("onFileDeleteBefore",{element:e.target,container:e,url:e.target.getAttribute("href")}))return;const s=this.component.isInline(i)?i.previousSibling||i.nextSibling:i.previousElementSibling||i.nextElementSibling;xt.utils.removeItem(i),this.ui._offCurrentController(),this.editor.focusEdge(s),this.history.push(!1)}async submitFile(t){if(0===t.length)return;let e=0;const i=[],s=this.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++){if(n=t[l],o=n.size,s>0&&o>s){const t="[SUNEDITOR.fileUpload.fail] Size of uploadable single file: "+s/1e3+"KB",e=await this.triggerEvent("onFileUploadError",{error:t,limitSize:s,uploadSize:o,file:n});return this.ui.alertOpen(e===Jo?t:e||t,"error"),!1}i.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",i=await this.triggerEvent("onFileUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.ui.alertOpen(i===Jo?t:i||t,"error"),!1}const l={url:this.uploadUrl,uploadHeaders:this.uploadHeaders,files:i},r=async function(t,e,i){e=i||e;t(await this.fileManager.asyncUpload(e.url,e.uploadHeaders,e.files))}.bind(this,this.#Qe.bind(this),l),a=await this.triggerEvent("onFileUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==Jo||r(null)))}convertFormat(t,e){if("link"===e){this.figure.close();const{container:e}=ws.GetContainer(t),i=e.nextElementSibling,s=e.parentElement;t.removeAttribute("data-se-non-focus"),t.setAttribute("contenteditable","false"),xt.utils.addClass(t,"se-component|se-inline-component");const n=xt.utils.createElement(this.options.get("defaultLine"),null,t);s.insertBefore(n,i),xt.utils.removeItem(e)}else{this.selection.setRange(t,0,t,1);const e=this.html.remove(),i=this.nodeTransform.split(e.container,e.offset,0);i?.previousElementSibling&&xt.check.isZeroWidth(i.previousElementSibling)&&xt.utils.removeItem(i.previousElementSibling),t.setAttribute("data-se-non-focus","true"),t.removeAttribute("contenteditable"),xt.utils.removeClass(t,"se-component|se-component-selected|se-inline-component");const s=ws.CreateContainer(t,"se-file-figure se-flex-component");(i||e.container).parentElement.insertBefore(s.container,i)}this.history.push(!1),this.component.select(t,Qo.key)}create(t,e,i){const s=e.name||t,n=xt.utils.createElement("A",{href:t,title:s,download:s,"data-se-file-download":"",contenteditable:"false","data-se-non-focus":"true","data-se-non-link":"true"},s);if(this.fileManager.setFileData(n,e),"link"===this.as)return n.className="se-component se-inline-component",void this.component.insert(n,{scrollTo:!!i,insertBehavior:i?this.insertBehavior:null});const o=ws.CreateContainer(n);if(xt.utils.addClass(o.container,"se-file-figure|se-flex-component"),this.component.insert(o.container,{scrollTo:!!i,insertBehavior:i?this.insertBehavior:null})){if(i)if(this.options.get("componentInsertBehavior"))this.component.select(n,Qo.key);else{const t=this.format.addLine(o.container,null);t&&this.selection.setRange(t,0,t,0)}}else this.editor.focus()}#Ke(t){t.result.forEach(((t,e,i)=>{this.create(t.url,{name:t.name,size:t.size},e===i.length-1)}))}async#Je(t){const e=await this.triggerEvent("onFileUploadError",{error:t});if(!1===e)return;const i=e===Jo?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.fileUpload.error]",i)}#Qe(t){const e=JSON.parse(t.responseText);e.errorMessage?this.#Je(e):this.#Ke(e)}async#Ie(t){const e=xt.query.getEventTarget(t);await this.submitFile(e.files)}}const tl=Qo;class el extends Po{static key="list_bulleted";static className="se-icon-flip-rtl";constructor(t){super(t),this.title=this.lang.bulletedList,this.icon="list_bulleted",this.afterItem=xt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":el.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 xt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.listItems=e.querySelectorAll("li button ul"),this.menu.initDropdownTarget({key:el.key,type:"dropdown"},e)}active(t,e){return xt.check.isListCell(t)&&/^UL$/i.test(t.parentElement.nodeName)?(xt.utils.addClass(e,"active"),!0):(xt.utils.removeClass(e,"active"),!1)}action(t){const e=this.format.getBlock(this.selection.getNode()),i=t?.querySelector("ul")?.style.listStyleType;xt.check.isList(e)&&i?e.style.listStyleType=i:this.submit(i),this.menu.dropdownOff()}on(){const t=this.listItems,e=this.format.getBlock(this.selection.getNode()),i=e?.style?e.style.listStyleType||"disc":"";for(let e,s=0,n=t.length;s<n;s++)e=t[s],i===e.style.listStyleType?xt.utils.addClass(e.parentElement,"active"):xt.utils.removeClass(e.parentElement,"active")}shortcut({range:t,info:e}){const{startContainer:i}=t;if(xt.check.isText(i)){const t=i.substringData(e.key.length,i.textContent.length-1);i.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.editor.focus(),this.history.push(!1)}}const il=el;class sl extends Po{static key="list_numbered";static className="se-icon-flip-rtl";constructor(t){super(t),this.title=this.lang.numberedList,this.icon="list_numbered",this.afterItem=xt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":sl.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${nl(["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${nl(["lower-latin","upper-latin","lower-greek"])}\n\t\t</ul>\n\t</div>`;return xt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.listItems=e.querySelectorAll("li button ol"),this.menu.initDropdownTarget({key:sl.key,type:"dropdown"},e)}active(t,e){return xt.check.isListCell(t)&&/^OL$/i.test(t.parentElement.nodeName)?(xt.utils.addClass(e,"active"),!0):(xt.utils.removeClass(e,"active"),!1)}action(t){const e=this.format.getBlock(this.selection.getNode()),i=t?.querySelector("ol")?.style.listStyleType;xt.check.isList(e)&&i?e.style.listStyleType=i:this.submit(i),this.menu.dropdownOff()}on(){const t=this.listItems,e=this.format.getBlock(this.selection.getNode()),i=e?.style?e.style.listStyleType||"decimal":"";for(let e,s=0,n=t.length;s<n;s++)e=t[s],i===e.style.listStyleType?xt.utils.addClass(e.parentElement,"active"):xt.utils.removeClass(e.parentElement,"active")}shortcut({range:t,info:e}){const{startContainer:i}=t;if(xt.check.isText(i)){const t=i.substringData(e.key.length,i.textContent.length-1);i.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.editor.focus(),this.history.push(!1)}}function nl(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 ol=sl,{debounce:ll}=wt;const rl=class extends Wo{static key="mention";static className="";#si;#ni;#oi;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 Fn(this,{headers:e.apiHeaders}),this.cachingData=e.useCachingData??1?new Map:null,this.cachingFieldData=e.useCachingFieldData??1?[]:null,this.#si=0,this.#ni=0,this.#oi=null;const i=xt.utils.createElement("DIV",{class:"se-controller se-empty-controller"},"<div></div>");this.selectMenu=new cs(this,{position:"right-bottom",dir:"ltr",closeMethod:()=>this.controller.close()}),this.controller=new as(this,i,{position:"bottom",initMethod:()=>{this.apiManager.cancel(),this.selectMenu.close()}},null),this.selectMenu.on(i.firstElementChild,this.#li.bind(this)),this.onInput=ll(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,i=t.anchorOffset,s=e.textContent.substring(0,i),n=s.lastIndexOf(this.triggerText);if(n>-1){const t=s.substring(n+1,i),o=s[n-1]?.trim();if(!/\s/.test(t)&&(!o||xt.check.isZeroWidth(o))){if(t.length<this.searchStartLength)return;const s=e.parentNode;if(xt.check.isAnchor(s)&&!s.getAttribute("data-se-mention"))return;try{return await this.#ri(t,e),this.#si=n,this.#oi=e,void(this.#ni=i)}catch(t){console.warn("[SUNEDITOR.mention.api.file] ",t)}}}this.selectMenu.close()}async#ri(t,e){const i=this.limitSize,s=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(s))).slice(0,i);else{const e=await this.apiManager.asyncCall({method:"GET",url:this.#ai(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(s)))).slice(0,i)}if(!n?.length)return this.selectMenu.close(),!1;const o=[],l=[];for(let t,e=0,i=n.length;e<i;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)}#ai(t){return this.apiUrl.replace(/\{key\}/i,t)}#li(t){if(!t)return!1;let e=null;const{key:i,name:s,url:n}=t,o=this.#oi.parentNode;if(xt.check.isAnchor(o))e=o,e.setAttribute("data-se-mention",i),e.setAttribute("href",n),e.setAttribute("title",s),e.textContent=this.triggerText+i;else if(this.selection.setRange(this.#oi,this.#si,this.#oi,this.#ni),e=xt.utils.createElement("A",{"data-se-mention":i,href:n,title:s,target:"_blank"},this.triggerText+i),!this.html.insertNode(e,{afterNode:null,skipCharCount:!1}))return!1;this.selectMenu.close();const l=xt.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 al extends Do{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 i=function({lang:t,icons:e,options:i},s){const n=Array.isArray(s)?s:i.get("_rtl")?["right","center","left","justify"]:["left","center","right","justify"];let o="";for(let i,s,l=0;l<n.length;l++)i=n[l],s=t["align"+i.charAt(0).toUpperCase()+i.slice(1)],o+=`\n\t\t<li>\n\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${i}" title="${s}" aria-label="${s}">\n\t\t\t\t<span class="se-list-icon">${e["align_"+i]}</span>${s}\n\t\t\t</button>\n\t\t</li>`;return xt.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>`)}(t,e.items),s=this._itemMenu=i.querySelector("ul");this.defaultDir="",this.alignIcons={justify:t.icons.align_justify,left:t.icons.align_left,right:t.icons.align_right,center:t.icons.align_center},this.alignList=s.querySelectorAll("li button"),this.menu.initDropdownTarget(al,i)}active(t,e){const i=e.firstElementChild;if(t){if(this.format.isLine(t)){const s=t.style.textAlign;return s?(xt.utils.changeElement(i,this.alignIcons[s]||this.alignIcons[this.defaultDir]),e.setAttribute("data-focus",s),!0):void 0}}else xt.utils.changeElement(i,this.alignIcons[this.defaultDir]),e.removeAttribute("data-focus");return!1}on(t){const e=t.getAttribute("data-focus")||this.defaultDir;if(!e)return;const i=this.alignList;for(let t=0,s=i.length;t<s;t++)e===i[t].getAttribute("data-command")?xt.utils.addClass(i[t],"active"):xt.utils.removeClass(i[t],"active")}action(t){const e=t.getAttribute("data-command");if(!e)return;const i=this.defaultDir,s=this.format.getLines();for(let t=0,n=s.length;t<n;t++)xt.utils.setStyle(s[t],"textAlign",e===i?"":e);this.editor.effectNode=null,this.menu.dropdownOff(),this.editor.focus(),this.history.push(!1)}setDir(){const t=this.#hi();if(this.defaultDir===t)return;this.defaultDir=t;const e=this._itemMenu.querySelector('[data-command="left"]'),i=this._itemMenu.querySelector('[data-command="right"]');if(e&&i){const t=e.parentElement,s=i.parentElement;t.appendChild(i),s.appendChild(e)}}init(){this.defaultDir=this.#hi()}#hi(){const t=this.frameContext.get("wwComputedStyle").getPropertyValue("text-align");return["left","center","right","justify"].includes(t)?t:this.options.get("_rtl")?"right":"left"}}const hl=al;class cl extends Do{static key="font";static className="se-btn-select se-btn-tool-font";#ci;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 i=e.items||["Arial","Comic Sans MS","Courier New","Impact","Georgia","tahoma","Trebuchet MS","Verdana"],s=function({lang:t},e){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,s,n=0,o=e.length;n<o;n++)t=e[n],s=t.split(",")[0],i+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${t}" data-txt="${s}" title="${s}" aria-label="${s}" style="font-family:${t};">${s}</button>\n\t\t\t</li>`;return i+="\n\t\t</ul>\n\t</div>",xt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-font-family"},i)}(t,i);this.currentFont="",this.fontList=s.querySelectorAll("ul li button"),this.fontArray=i,this.#ci=s.querySelector(".se-sub-list span"),this.menu.initDropdownTarget(cl,s)}active(t,e){const i=e.querySelector(".se-txt"),s=e.parentNode.querySelector(".se-tooltip-text");let n="";if(t){if(this.format.isLine(t))return;if(n=xt.utils.getStyle(t,"fontFamily")){const t=n.replace(/["']/g,"");return xt.utils.changeTxt(i,t),xt.utils.changeTxt(s,this.lang.font+" ("+t+")"),!0}}else{const t=this.status.hasFocus?this.frameContext.get("wwComputedStyle").fontFamily:this.lang.font;xt.utils.changeTxt(i,t),xt.utils.changeTxt(s,this.status.hasFocus?this.lang.font+(t?" ("+t+")":""):t)}return!1}on(t){const e=this.fontList,i=t.querySelector(".se-txt").textContent;if(i!==this.currentFont){let t=!1;for(let s=0,n=e.length;s<n;s++)i===(e[s].getAttribute("data-command")||"").replace(/'|"/g,"")?(xt.utils.addClass(e[s],"active"),t=!0):xt.utils.removeClass(e[s],"active");this.currentFont=i,t?this.#ci.style.display="none":(this.#ci.textContent=i,this.#ci.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.triggerEvent("onFontActionBefore",{value:e}))return;const t=xt.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 dl=cl;class ul extends qo{static key="fontColor";static className="";constructor(t,e){super(t),this.title=this.lang.fontColor,this.icon="font_color";const i=xt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new Ho(this,"color",{form:i,colorList:e.items,splitNum:e.splitNum,disableHEXInput:e.disableHEXInput,hueSliderOptions:{controllerOptions:{isOutsideForm:!0}}}),this.menu.initDropdownTarget(ul,i)}active(t,e){const i=e.querySelector(".se-svg-color-helper");if(!i)return;let s="";if(t){if(this.format.isLine(t))return;if(s=xt.utils.getStyle(t,"color"))return i.style.color=s,!0}else i.style.color=s;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=xt.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 pl=ul;class gl extends qo{static key="backgroundColor";static className="";constructor(t,e){super(t),this.title=this.lang.backgroundColor,this.icon="background_color";const i=xt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new Ho(this,"backgroundColor",{form:i,colorList:e.items,splitNum:e.splitNum,disableHEXInput:e.disableHEXInput,hueSliderOptions:{controllerOptions:{isOutsideForm:!0}}}),this.menu.initDropdownTarget(gl,i)}active(t,e){const i=e.querySelector("path.se-svg-color-helper");if(!i)return;let s="";if(t){if(this.format.isLine(t))return;if(s=xt.utils.getStyle(t,"backgroundColor"))return i.style.color=s,!0}else i.style.color=s;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=xt.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 ml=gl;class fl extends Do{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 i=function({lang:t},e){const i=e||[{name:t.hr_solid,class:"__se__solid"},{name:t.hr_dashed,class:"__se__dashed"},{name:t.hr_dotted,class:"__se__dotted"}];let s="";for(let t=0,e=i.length;t<e;t++)s+=`\n\t\t<li>\n\t\t\t<button type="button" class="se-btn se-btn-list" data-command="hr" title="${i[t].name}" aria-label="${i[t].name}">\n\t\t\t\t<hr${i[t].class?` class="${i[t].class}"`:""}${i[t].style?` style="${i[t].style}"`:""}/>\n\t\t\t</button>\n\t\t</li>`;return xt.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">${s}</ul>\n\t\t</div>`)}(t,e.items);this.list=i.querySelectorAll("button"),this.menu.initDropdownTarget(fl,i)}componentSelect(t){xt.utils.addClass(t,"on")}componentDeselect(t){xt.utils.removeClass(t,"on")}componentDestroy(t){if(!t)return;const e=t.previousElementSibling||t.nextElementSibling;xt.utils.removeItem(t),this.editor.focusEdge(e),this.history.push(!1)}shortcut({line:t,range:e}){const i=this.nodeTransform.split(e.endContainer,e.endOffset,0);this.submit("__se__solid"),xt.utils.removeItem(t),this.selection.setRange(i,0,i,0)}action(t){const e=this.submit(t.firstElementChild.className),i=this.format.addLine(e);this.selection.setRange(i,1,i,1),this.menu.dropdownOff()}submit(t){const e=xt.utils.createElement("hr",{class:t});return this.editor.focus(),this.component.insert(e,{insertBehavior:"line"}),e}}const bl=fl;class yl extends Do{static key="list";static className="se-icon-flip-rtl";constructor(t){super(t),this.title=this.lang.list,this.icon="list_numbered";const e=function({lang:t,icons:e}){const 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 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 xt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},i)}(t);this.listItems=e.querySelectorAll("li button"),this.icons={bulleted:t.icons.list_bulleted,numbered:t.icons.list_numbered},this.menu.initDropdownTarget(yl,e)}active(t,e){const i=e.firstElementChild;if(xt.check.isList(t)){const s=t.nodeName.toLowerCase();return e.setAttribute("data-focus",s),xt.utils.addClass(e,"active"),/^ul$/.test(s)?xt.utils.changeElement(i,this.icons.bulleted):xt.utils.changeElement(i,this.icons.numbered),!0}return e.removeAttribute("data-focus"),xt.utils.changeElement(i,this.icons.number),xt.utils.removeClass(e,"active"),!1}on(t){const e=t.getAttribute("data-focus")||"",i=this.listItems;for(let t=0,s=i.length;t<s;t++)e===i[t].getAttribute("data-command")?xt.utils.addClass(i[t],"active"):xt.utils.removeClass(i[t],"active")}action(t){const e=t.getAttribute("data-command"),i=t.getAttribute("data-value")||"",s=this.listFormat.apply(`${e}:${i}`,null,!1);s&&this.selection.setRange(s.sc,s.so,s.ec,s.eo),this.menu.dropdownOff(),this.history.push(!1)}}const vl=yl,{_w:_l,ON_OVER_COMPONENT:Cl}=_t,wl=".se-table-resize-line",xl=".se-table-resize-line-prev",kl=".se-table-resize-row",El=".se-table-resize-row-prev",Sl=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],Tl={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"},Hl=["all","inside","horizon","vertical"],Ll="borderLeft",Ml="borderTop",Nl="borderRight",Al="borderBottom",Bl=["#b0dbb0","#efef7e","#f2acac","#dcb0f6","#99bdff","#5dbd5d","#e7c301","#f64444","#e57ff4","#4387f1","#27836a","#f69915","#ba0808","#a90bed","#134299","#e4e4e4","#B3B3B3","#808080","#4D4D4D","#000000"];class Vl extends qo{static key="table";static className="";static options={isInputComponent:!0};static component(t){return xt.check.isTable(t)?t:null}#di;#ui;#pi;#gi;#mi;#fi;#bi;#yi;#vi;#_i;#Ci;#wi;#xi;#ki;#Ei;#Si;#Ti;#Hi;#Li;#Mi;#Ni;#Ai;#Bi;#Vi;#Ii;#Oi;#Ri;#Fi;#zi;#$i;#Pi;#Di;#qi;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 i=function(){const t='\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>';return xt.utils.createElement("DIV",{class:"se-dropdown se-selector-table"},t)}(),s=i.querySelector(".se-controller-table-picker"),n=function({lang:t,icons:e}){const i=`\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 xt.utils.createElement("DIV",{class:"se-controller se-controller-table"},i)}(t),o=function({lang:t,icons:e},i){const s=`\n\t<div class="se-arrow se-arrow-${i?"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=xt.utils.createElement("DIV",{class:"se-controller se-controller-table-cell"},s);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"]')}}(t,this.cellControllerTop),l=function({lang:t,icons:e,options:i}){const s=i.get("_rtl")?["right","center","left","justify"]:["left","center","right","justify"];let n="";for(let i,o,l=0;l<s.length;l++)i=s[l],o=t["align"+i.charAt(0).toUpperCase()+i.slice(1)],n+=`\n\t\t<button type="button" class="se-btn se-tooltip" data-command="props_align" data-value="${i}" title="${o}" aria-label="${o}">\n\t\t\t${e["align_"+i]}\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 i,s,n=0;n<o.length;n++)i=o[n],s=t["align"+i.charAt(0).toUpperCase()+i.slice(1)],l+=`\n\t\t<button type="button" class="se-btn se-tooltip" data-command="props_align_vertical" data-value="${i}" title="${s}" aria-label="${s}">\n\t\t\t${e["align_"+i]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${s}</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_props" 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[Tl.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=xt.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"]')}}(t);t.applyFrameRoots((t=>{t.get("wrapper").appendChild(xt.utils.createElement("DIV",{class:wl.replace(/^\./,"")})),t.get("wrapper").appendChild(xt.utils.createElement("DIV",{class:xl.replace(/^\./,"")})),t.get("wrapper").appendChild(xt.utils.createElement("DIV",{class:kl.replace(/^\./,"")})),t.get("wrapper").appendChild(xt.utils.createElement("DIV",{class:El.replace(/^\./,"")}))})),this.cellControllerTop?(this.controller_cell=new as(this,o.html,{position:"top"}),this.controller_table=new as(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 as(this,n,{position:"top"}),this.controller_cell=new as(this,o.html,{position:"bottom"}));const r=[this.controller_table,this.controller_cell];this.controller_props=new as(this,l.html,{position:"bottom",parents:r,isInsideForm:!0}),this.controller_props_title=l.controller_props_title;const a=xt.utils.createElement("DIV",{class:"se-controller se-list-layer"},null);this.controller_colorPicker=new as(this,a,{position:"bottom",parents:[this.controller_props].concat(r),isInsideForm:!0,isWWTarget:!1,initMethod:()=>{this.colorPicker.hueSlider.close(),xt.utils.removeClass(this.controller_colorPicker.currentTarget,"on")}}),this.colorPicker=new Ho(this,"",{form:a,colorList:e.colorList||Bl,splitNum:5,disableRemove:!0,hueSliderOptions:{controllerOptions:{isOutsideForm:!0,parents:[this.controller_colorPicker],parentsHide:!0}}}),this.figure=new ws(this,null,{}),this.sliderType="";const h=Dl.bind(this,!0),c=Dl.bind(this,!1),d=(u=this.lang,{items:["vertical","horizontal"],menus:xt.utils.createElement("DIV",null,`\n\t\t<div title="${u.verticalSplit}" aria-label="${u.verticalSplit}">\n\t\t\t${u.verticalSplit}\n\t\t</div>\n\t\t<div title="${u.horizontalSplit}" aria-label="${u.horizontalSplit}">\n\t\t\t${u.horizontalSplit}\n\t\t</div>`).querySelectorAll("div")});var u;this.splitButton=o.splitButton,this.selectMenu_split=new cs(this,{checkList:!1,position:"bottom-center",openMethod:h,closeMethod:c}),this.selectMenu_split.on(this.splitButton,this._OnSplitCells.bind(this)),this.selectMenu_split.create(d.items,d.menus);const p=function(t,e){const i=xt.utils.createElement("DIV",null,`\n\t\t<div title="${t.insertColumnBefore}" aria-label="${t.insertColumnBefore}">\n\t\t\t<span class="se-list-icon">${e.insert_column_left}</span><span class="se-txt">${t.insertColumnBefore}</span>\n\t\t</div>\n\t\t<div title="${t.insertColumnAfter}" aria-label="${t.insertColumnAfter}">\n\t\t\t<span class="se-list-icon">${e.insert_column_right}</span><span class="se-txt">${t.insertColumnAfter}</span>\n\t\t</div>\n\t\t<div title="${t.deleteColumn}" aria-label="${t.deleteColumn}">\n\t\t\t<span class="se-list-icon">${e.delete_column}</span><span class="se-txt">${t.deleteColumn}</span>\n\t\t</div>`);return{items:["insert-left","insert-right","delete"],menus:i.querySelectorAll("div")}}(this.lang,this.icons),g=o.columnButton;this.selectMenu_column=new cs(this,{checkList:!1,position:"bottom-center",openMethod:h,closeMethod:c}),this.selectMenu_column.on(g,this._OnColumnEdit.bind(this)),this.selectMenu_column.create(p.items,p.menus);const m=function(t,e){const i=xt.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>`);return{items:["insert-above","insert-below","delete"],menus:i.querySelectorAll("div")}}(this.lang,this.icons),f=o.rowButton;this.selectMenu_row=new cs(this,{checkList:!1,position:"bottom-center",openMethod:h,closeMethod:c}),this.selectMenu_row.on(f,this._OnRowEdit.bind(this)),this.selectMenu_row.create(m.items,m.menus);const b=function(){let t="";for(let e,i=0,s=Sl.length;i<s;i++)e=Sl[i],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=xt.utils.createElement("DIV",null,t);return{items:Sl,menus:e.querySelectorAll("div")}}(),y=l.borderButton;this.selectMenu_props_border=new cs(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_props_border.on(y,$l.bind(this)),this.selectMenu_props_border.create(b.items,b.menus);const v=ql(this.lang,this.icons,[]),_=l.borderFormatButton;this.selectMenu_props_border_format=new cs(this,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:5}),this.selectMenu_props_border_format.on(_,Pl.bind(this,"all")),this.selectMenu_props_border_format.create(v.items,v.menus);const C=ql(this.lang,this.icons,Hl);this.selectMenu_props_border_format_oneCell=new cs(this,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:6}),this.selectMenu_props_border_format_oneCell.on(_,Pl.bind(this,"outside")),this.selectMenu_props_border_format_oneCell.create(C.items,C.menus),this.maxText=this.lang.maxSize,this.minText=this.lang.minSize,this.propTargets={cell_alignment:l.cell_alignment,cell_alignment_vertical:l.cell_alignment_vertical,cell_alignment_table_text:l.cell_alignment_table_text,border_format:_,border_style:l.border_style,border_color:l.border_color,border_width:l.border_width,back_color:l.back_color,font_color:l.font_color,palette_border_button:l.palette_border_button,font_bold:l.font_bold,font_underline:l.font_underline,font_italic:l.font_italic,font_strike:l.font_strike},this._propsCache=[],this._currentFontStyles=[],this._propsAlignCache="",this._propsVerticalAlignCache="",this._typeCache="",this.tableMenu=i,this.tableHighlight=i.querySelector(".se-table-size-highlighted"),this.tableUnHighlight=i.querySelector(".se-table-size-unhighlighted"),this.tableDisplay=i.querySelector(".se-table-size-display"),this.resizeButton=n.querySelector("._se_table_resize"),this.resizeText=n.querySelector("._se_table_resize > span > span"),this.columnFixedButton=n.querySelector("._se_table_fixed_column"),this.headerButton=n.querySelector("._se_table_header"),this.captionButton=n.querySelector("._se_table_caption"),this.mergeButton=o.mergeButton,this.unmergeButton=o.unmergeButton,this._element=null,this.#vi=!1,this.#_i=null,this.#Ci=null,this.#di=null,this.#ui=null,this.#pi=null,this.#gi=null,this.#wi=[],this.#ki=!0,this.#Ei=!1,this.#Si=0,this.#Ti=0,this.#Hi=0,this.#Li=0,this.#Mi=0,this.#Ni=0,this.#Ai=0,this.#Bi=0,this.#Vi=0,this.#mi=null,this.#fi=null,this.#bi=null,this.#yi=null,this.#Ii=!1,this.#Oi=!1,this.#Ri=null,this.#Fi=null,this.#zi=this.#Wi.bind(this),this.#$i=this.#Ui.bind(this),this.#Pi=this.#Zi.bind(this),this.#Di=this.#Gi.bind(this),this.#qi={on:null,off:null,shiftOff:null,touchOff:null,resize:null,resizeStop:null,resizeKeyDown:null},this.menu.initDropdownTarget(Vl,i),this.eventManager.addEvent(s,"mousemove",this.#Yi.bind(this)),this.eventManager.addEvent(s,"click",this.#ji.bind(this))}off(){this.#Xi()}componentSelect(t){if(this.#Ki(t),this.#di||this.setTableInfo(t),this.#ki="100%"===this.#di?.style.width,this.#Ei=xt.utils.hasClass(t,"se-table-layout-fixed")||"fixed"===t.style.tableLayout,this.#Ji(this.#ki?"width|column":"width",!0),he.get("__overInfo")===Cl)return;if(!this.#ui)return;this.setCellInfo(this.#ui,!0);const e=this.#yi?.length>1,i=xt.query.getParentElement(t,xt.check.isFigure);this.controller_table.open(i,null,{isWWTarget:!1,initMethod:null,addOffset:null,disabled:e}),this.#fi&&(this.#Qi(),this.controller_cell.open(this.#ui,this.cellControllerTop?i:null,{isWWTarget:!1,initMethod:null,addOffset:null,disabled:e}))}componentDeselect(){this.resetSelectInfo()}componentDestroy(t){if(!t)return;const e=t.parentNode;xt.utils.removeItem(t),this.#ts(),e!==this.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(e,(function(t){return 0===t.childNodes.length}),null),this.editor.focus(),this.history.push(!1)}componentCopy({event:t,cloneContainer:e}){const i=e.querySelectorAll(".se-selected-table-cell");xt.utils.removeClass(i,"se-selected-table-cell|se-selected-cell-focus"),i.length>0&&(!function(t,e,i){t.preventDefault(),t.stopPropagation();const s=i[0].closest("table"),n=s.cloneNode(!1),o=xt.utils.createElement("tbody");n.appendChild(o);const l=new Map;i.forEach((t=>{l.set(t,!0)}));const r=s.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,e=0;t<a;t++,e++){const i=r[t].cells;for(let t=0,s=0,n=i.length;t<n;t++){for(;c[e][s];)s++;const n=i[t],o=n.rowSpan||1,l=n.colSpan||1;for(let t=0;t<o;t++)for(let i=0;i<l;i++)c[e+t][s+i]=n;s+=l}}for(let t=0;t<a;t++){let e;for(let i=0;i<h;i++){const s=c[t][i];if(!s||!l.has(s))continue;if(e||(e=xt.utils.createElement("tr"),o.appendChild(e)),e.lastChild&&c[t][i-1]===s)continue;if(t>0&&c[t-1][i]===s)continue;const n=s.cloneNode(!0);let r=1,d=1;for(;t+r<a&&c[t+r][i]===s;)r++;for(;i+d<h&&c[t][i+d]===s;)d++;r>1&&(n.rowSpan=r),d>1&&(n.colSpan=d),e.appendChild(n)}}const d=xt.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)}(t,e,i),this.editor.ui.showToast(this.lang.message_copy_success,550))}onPaste({event:t,doc:e}){const i=xt.query.getParentElement(xt.query.getEventTarget(t),xt.check.isTableCell);if(!i)return;const s=e.body;if(1!==s.childElementCount)return;const n=this.component.get(s.firstElementChild);if(n.pluginName!==Vl.key)return;const o=n.target;return this.pasteTableCellMatrix(o,i),!1}retainFormat(){return{query:"table",method:t=>{const e=t.querySelector("colgroup");let i=xt.check.isFigure(t.parentNode)?t.parentNode:null;if(!e){const e=t.rows,i=function(t){const e=t.rows;let i=0;for(let t=0,s=e.length;t<s;t++){const s=e[t].cells;let n=0;for(let t=0,e=s.length;t<e;t++)n+=s[t].colSpan;i=Math.max(i,n)}return i}(t),s=new Array(i).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(i).fill(!1);for(let e=0;e<t;e++){const t=o[e],n=t.style.width,a=t.colSpan||1;for(;l<i&&r[l];)l++;if(l>=i)break;n&&!s[l]&&(s[l]=n);for(let t=0;t<a;t++){if(l+t>=i||!n)continue;r[l+t]=!0;const e=parseFloat(n);for(let t=0;t<a;t++){const o=l+t;if(o>=i)continue;const r=s[o];if(null===r)s[o]=`width: ${n};`;else{const t=parseFloat(r.replace("width: ","").replace(";",""));1===a&&e!==t&&(s[o]=`width: ${n};`)}}}l+=a}if(t===i)break}const n=[];for(let t=0;t<i;t++){const e=s[t]?` style="${s[t]}"`:"";n.push(`<col${e}>`)}const o=xt.utils.createElement("colgroup",null,n.join(""));t.insertBefore(o,t.firstElementChild);for(let t=0;t<e.length;t++){const i=e[t].cells;for(let t=0;t<i.length;t++)xt.utils.setStyle(i[t],"width","")}}i?xt.utils.addClass(i,"se-flex-component|se-input-component"):(i=xt.utils.createElement("FIGURE",{class:"se-flex-component se-input-component"}),t.parentNode.insertBefore(i,t),i.appendChild(t));const s=t.style.width;if(s&&(i.style.width="auto"===s?"max-content":s,xt.utils.setStyle(t,"width","")),this.figureScroll){const t=`se-scroll-figure-${this.figureScroll}`;xt.utils.addClass(i,t),xt.utils.removeClass(i,this.figureScrollList.filter((e=>e!==t)).join("|"))}else xt.utils.removeClass(i,this.figureScrollList.join("|"))}}}setDir(){this.#Xi(),this.#es()}onMouseMove({event:t}){if(this.#vi)return;const e=xt.query.getEventTarget(t),i=xt.query.getParentElement(e,Il);if(!i||1===t.buttons)return void this.#is();const s=Ol(t,i);if(s.is)return this._element&&(this._element.style.cursor=""),this.#vt(),"block"===this.#_i?.style.display&&(this.#_i.style.display="none"),this.#_i=this.frameContext.get("wrapper").querySelector(wl),this.#ss(xt.query.getParentElement(i,xt.check.isTable),i,this.#_i,s.isLeft),void(this.#_i.style.display="block");if(Rl(t,i).is)return this.#vt(),this._element=xt.query.getParentElement(i,xt.check.isTable),this._element.style.cursor="ns-resize","block"===this.#_i?.style.display&&(this.#_i.style.display="none"),this.#_i=this.frameContext.get("wrapper").querySelector(kl),this.#ns(xt.query.getParentElement(i,xt.check.isTable),i,this.#_i),void(this.#_i.style.display="block");this._element&&(this._element.style.cursor=""),this.#is()}onScroll(){"block"===this.#_i?.style.display&&(this._element&&(this._element.style.cursor=""),this.#_i.style.display="none")}onMouseDown({event:t}){this.#Fi=this.#bi=null;const e=xt.query.getEventTarget(t),i=xt.query.getParentElement(e,Il);if(!i)return;this.cellControllerTop||this.controller_cell.hide();const s=Ol(t,i);if(s.is){try{this.#os(),this.setCellInfo(i,!0);const t=this.#Ai+this.#Bi-(s.isLeft?1:0);if(this.ui.enableBackWrapper("ew-resize"),this.#_i||=this.frameContext.get("wrapper").querySelector(wl),this.#Ci=this.frameContext.get("wrapper").querySelector(xl),t<0||t===this.#Ti-1)return this._startFigureResizing(s.startX,t<0),void this.#ls(!1);const e=this._element.querySelector("colgroup").querySelectorAll("col")[t<0?0:t];this._startCellResizing(e,s.startX,kt.get(_l.getComputedStyle(e).width,0),s.isLeft),this.#ls(!1)}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.#ls(!0),this.#vt()}finally{this.#fi=this.#bi=null,this.controller_table.hide(),this.controller_cell.hide()}return}const n=Rl(t,i);if(n.is)try{let t=xt.query.getParentElement(i,xt.check.isTableRow),e=i.rowSpan;if(e>1)for(;xt.check.isTableRow(t)&&e>1;)t=t.nextElementSibling,--e;this.#os(),this.setRowInfo(t),this.ui.enableBackWrapper("ns-resize"),this.#_i||=this.frameContext.get("wrapper").querySelector(kl),this.#Ci=this.frameContext.get("wrapper").querySelector(El),this._startRowResizing(t,n.startY,kt.get(_l.getComputedStyle(t).height,0)),this.#ls(!1)}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.#ls(!0),this.#vt()}finally{this.#fi=this.#bi=null,this.controller_table.hide(),this.controller_cell.hide()}else this.#Ii&&i!==this.#fi||(this.#os(),/^TR$/i.test(i.nodeName)||this.#rs(i,!1))}onMouseUp(){this.#Ii=!1}onMouseLeave(){this.#is()}onKeyDown({event:t,range:e,line:i}){this.#Fi=null;const s=t.code,n=Et.isTab(s);if(this.editor.selectMenuOn||this.#vi||!n&&this.#Oi||Et.isCtrl(t))return;if(this.cellControllerTop||this.controller_cell.hide(),this.#Oi=Et.isShift(t),n){this.#os();const s=xt.query.getParentElement(i,xt.check.isTableCell);if(s&&e.collapsed&&xt.check.isEdgePoint(e.startContainer,e.startOffset)){this.#as();const e=this.#Oi;this.#Ii=this.#Oi=!1;const i=xt.query.getParentElement(s,"table"),n=xt.query.getListChildren(i,xt.check.isTableCell,null),o=e?xt.utils.prevIndex(n,s):xt.utils.nextIndex(n,s);if(o===n.length&&!e){if(!xt.query.getParentElement(s,"thead")){const t=i.rows,e=this.insertBodyRow(i,t.length,this.#Hi).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(!Et.isShift(t)){if(o=xt.query.getParentElement(i,xt.check.isTableCell),!xt.utils.hasClass(o,"se-selected-cell-focus"))return;return this.#os(),this.#ls(!0),this.#vt(),void this.#as()}return this.#Ii||this.#Fi?void 0:(o||=xt.query.getParentElement(i,xt.check.isTableCell),o?(this.#Oi=!1,this.#fi=o,this.#as(),this.#rs(o,t.shiftKey),!1):void 0)}onKeyUp({line:t}){this.#Oi=!1,this.#Ii&&xt.query.getParentElement(t,xt.check.isTableCell)===this.#fi&&(this.#os(),this.#ls(!0),this.#vt()),this.#Ii=!1}colorPickerAction(t){const e=this.propTargets[`${this.sliderType}_color`];e.style.borderColor=e.value=t,this.controller_colorPicker.close()}controllerAction(t){const e=t.getAttribute("data-command");if(!e)return;const{back_color:i,font_color:s,border_color:n}=this.propTargets,o=t.getAttribute("data-value");switch(e){case"header":this.toggleHeader(),this._historyPush();break;case"caption":this.toggleCaption(),this._historyPush();break;case"onsplit":this.selectMenu_split.open();break;case"oncolumn":this.selectMenu_column.open();break;case"onrow":this.selectMenu_row.menus[0].style.display=this.selectMenu_row.menus[1].style.display=/^TH$/i.test(this.#ui?.nodeName)?"none":"",this.selectMenu_row.open();break;case"openTableProperties":this.controller_props.currentTarget===t&&"block"===this.controller_props.form?.style.display?this.controller_props.close():(this.controller_props_title.textContent=this.lang.tableProperties,this.#hs("table"),this.controller_props.open(t,this.controller_table.form,{isWWTarget:!1,initMethod:null,addOffset:null}));break;case"openCellProperties":this.controller_props.currentTarget===t&&"block"===this.controller_props.form?.style.display?this.controller_props.close():(this.controller_props_title.textContent=this.lang.cellProperties,this.#hs("cell"),this.controller_props.open(t,this.controller_cell.form,{isWWTarget:!1,initMethod:null,addOffset:null}));break;case"props_onborder_format":1===this._propsCache.length?this.selectMenu_props_border_format_oneCell.open():this.selectMenu_props_border_format.open();break;case"props_onborder_style":this.selectMenu_props_border.open();break;case"props_onpalette":this.#cs(t,o,"border"===o?n:"back"===o?i:s);break;case"props_font_style":xt.utils.toggleClass(this.propTargets[`font_${o}`],"on");break;case"props_submit":this._submitProps(t);break;case"revert":{const t=this._propsCache;for(let e=0,i=t.length;e<i;e++)t[e][0].style.cssText=t[e][1];this.#ds(this.propTargets.cell_alignment,this._propsAlignCache,!0),this.#ds(this.propTargets.cell_alignment_vertical,this._propsVerticalAlignCache,!0),xt.check.isTable(t[0][0])&&this.#di&&(this.#di.style.float=this._propsAlignCache);break}case"props_align":this.#ds(this.propTargets.cell_alignment,t.getAttribute("data-value"),!1);break;case"props_align_vertical":this.#ds(this.propTargets.cell_alignment_vertical,t.getAttribute("data-value"),!1);break;case"merge":this.mergeCells(this.#yi);break;case"unmerge":this.unmergeCells(this.#yi);break;case"resize":this.#ki=!this.#ki,this.#Ji("width",!1),this._historyPush(),_l.setTimeout((()=>{this.component.select(this._element,Vl.key,{isInput:!0})}),0);break;case"layout":this.#Ei=!this.#Ei,this.#Ji("column",!1),this._historyPush(),_l.setTimeout((()=>{this.component.select(this._element,Vl.key,{isInput:!0})}),0);break;case"copy":this.component.copy(this.#di);break;case"remove":this.componentDestroy(this.#di)}/(^props_|^revert|Properties$)/.test(e)||(this.controller_props.close(),this.controller_colorPicker.close()),/^(remove|props_|on|open|merge)/.test(e)||this._setCellControllerPosition(this.#ui,this.#Ii)}resetSelectInfo(){this.#vt(),this.#os(),this.#ls(!0),this._element=null,this.#di=null,this.#pi=null,this.#gi=null,this.#wi=[],this.#ki=!1,this.#Ei=!1,this.#Si=0,this.#Ti=0,this.#Li=0,this.#Mi=0,this.#Ni=0,this.#Ai=0,this.#Bi=0,this.#Vi=0,this.#Ii=!1,this.#yi=null,this.#mi=null,this.#Fi=null,this.#fi=null,this.#bi=null,this.#Ri=null;const{border_format:t,border_color:e,border_style:i,border_width:s,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;xt.utils.removeClass([t,e,i,s,n,o,l,r,a,h,c,d],"on")}selectCells(t){const e=t[0],i=xt.query.findVisualLastCell(t);this.#yi=t,this.#fi=e,this.#bi=i,this.#Ri=e.nodeName,this.#mi=xt.query.getParentElement(e,"TABLE"),this._setMultiCells(e,i)}setTableInfo(t){const e=this._element=this.#mi=xt.query.getParentElement(t,"TABLE");return this.#di=xt.query.getParentElement(e,xt.check.isFigure)||e,e}setCellInfo(t,e){const i=this.setTableInfo(t);if(i&&(this.#fi=t,this.#pi=t.parentNode,i.querySelector("thead")?xt.utils.addClass(this.headerButton,"active"):xt.utils.removeClass(this.headerButton,"active"),i.querySelector("caption")?xt.utils.addClass(this.captionButton,"active"):xt.utils.removeClass(this.captionButton,"active"),e||0===this.#Si)){this.#ui!==t&&(this.#ui=t,this.#pi=t.parentNode),this.#yi?.length||(this.#yi=[t]);const e=this.#gi=i.rows,s=t.cellIndex;let n=0;for(let t=0,i=e[0].cells,s=e[0].cells.length;t<s;t++)n+=i[t].colSpan;const o=this.#Mi=this.#pi.rowIndex;this.#Li=e.length,this.#Si=this.#pi.cells.length,this.#Ti=this.#Hi=n,this.#Ni=s,this.#Bi=this.#ui.colSpan-1,this.#Vi=this.#pi.cells[s].rowSpan-1;let l=[],r=[];for(let t,i,n=0;n<=o;n++){t=e[n].cells,i=0;for(let e,a,h,c,d=0,u=t.length;d<u;d++){if(e=t[d],a=e.colSpan-1,h=e.rowSpan-1,c=d+i,r.length>0)for(let t,e=0;e<r.length;e++)t=r[e],t.row>n||(c>=t.index?(i+=t.cs,c+=t.cs,t.rs-=1,t.row=n+1,t.rs<1&&(r.splice(e,1),e--)):d===u-1&&(t.rs-=1,t.row=n+1,t.rs<1&&(r.splice(e,1),e--)));if(n===o&&d===s){this.#Ai=c;break}h>0&&l.push({index:c,cs:a+1,rs:h,row:-1}),i+=a}r=r.concat(l).sort((function(t,e){return t.index-e.index})),l=[]}l=null,r=null}}setRowInfo(t){const e=this.setTableInfo(t),i=this.#gi=e.rows;this.#Li=i.length,this.#Mi=t.rowIndex}editTable(t,e){const i=this._element,s="row"===t;if(s){const t=this.#pi.parentElement;if(/^THEAD$/i.test(t.nodeName)){if("up"===e)return;if(!t.nextElementSibling||!/^TBODY$/i.test(t.nextElementSibling.nodeName))return void(e?i.innerHTML+="<tbody><tr>"+Fl("td",this.#Ti)+"</tr></tbody>":(xt.utils.removeItem(this.#di),this.#ts()))}}if(this.#Fi){const t=this.#ui,i=this.#yi;if(s)if(e)this.setCellInfo("up"===e?i[0]:i.at(-1),!0),this.editRow(e,null,t);else{let t=i[0].parentNode;const s=[i[0]];for(let e,n=1,o=i.length;n<o;n++)e=i[n],t!==e.parentNode&&(s.push(e),t=e.parentNode);for(let t=0,i=s.length;t<i;t++)this.setCellInfo(s[t],!0),this.editRow(e)}else{const s=i[0].parentNode;if(e){let n=null;for(let t=0,e=i.length-1;t<e;t++)if(s!==i[t+1].parentNode){n=i[t];break}this.setCellInfo("left"===e?i[0]:n||i[0],!0),this.editCell(e,null,t)}else{const t=[i[0]];for(let e,n=1,o=i.length;n<o&&(e=i[n],s===e.parentNode);n++)t.push(e);for(let i=0,s=t.length;i<s;i++)this.setCellInfo(t[i],!0),this.editCell(e)}}e||this.resetSelectInfo()}else this[s?"editRow":"editCell"](e);if(!e){const t=i.children;for(let e=0;e<t.length;e++)0===t[e].children.length&&(xt.utils.removeItem(t[e]),e--);0===i.children.length&&xt.utils.removeItem(i)}}editRow(t,e,i){this.#os(),e&&this.setCellInfo(e,!0);const s=!t,n="up"===t,o=this.#Mi,l=s||n?o:o+this.#Vi+1,r=s?-1:1,a=this.#gi;let h=this.#Ti;for(let t,e=0,i=o+(s?-1:0);e<=i;e++){if(t=a[e].cells,0===t.length)return;for(let i,s,n=0,o=t.length;n<o;n++)i=t[n].rowSpan,s=t[n].colSpan,i<2&&s<2||i+e>l&&l>e&&(t[n].rowSpan=i+r,h-=s)}if(s){const t=a[o+1];if(t){const e=[];let i=a[o].cells,s=0;for(let t,n,o=0,l=i.length;o<l;o++)t=i[o],n=o+s,s+=t.colSpan-1,t.rowSpan>1&&(t.rowSpan-=1,e.push({cell:t.cloneNode(!1),index:n}));if(e.length>0){let n=e.shift();i=t.cells,s=0;for(let o,l,r=0,a=i.length;r<a&&(o=i[r],l=r+s,s+=o.colSpan-1,!(l>=n.index)||(r--,s--,s+=n.cell.colSpan-1,t.insertBefore(n.cell,o),n=e.shift(),n));r++);if(n){t.appendChild(n.cell);for(let i=0,s=e.length;i<s;i++)t.appendChild(e[i].cell)}}}this._element.deleteRow(l)}else this.insertBodyRow(this._element,l,h);s?this.#as():this._setCellControllerPosition(i||this.#ui,!0)}editCell(t,e,i){e&&this.setCellInfo(e,!0);const s=!t,n="left"===t,o=this.#Bi,l=s||n?this.#Ai:this.#Ai+o+1,r=this.#gi;let a,h=[],c=[],d=0;const u=[],p=[];for(let t,e,i,n,g,m=0,f=this.#Li;m<f;m++){t=r[m],a=l,n=!1,e=t.cells,g=0;for(let t,i,r,f,b=0,y=e.length;b<y&&(t=e[b],t);b++)if(i=t.rowSpan-1,r=t.colSpan-1,s){if(f=b+g,c.length>0){const t=!e[b+1];for(let e,i=0;i<c.length;i++)e=c[i],e.row>m||(f>=e.index?(g+=e.cs,f=b+g,e.rs-=1,e.row=m+1,e.rs<1&&(c.splice(i,1),i--)):t&&(e.rs-=1,e.row=m+1,e.rs<1&&(c.splice(i,1),i--)))}i>0&&h.push({rs:i,cs:r+1,index:f,row:-1}),f>=a&&f+r<=a+o?u.push(t):f<=a+o&&f+r>=a?t.colSpan-=kt.getOverlapRangeAtIndex(l,l+o,f,f+r):i>0&&(f<a||f+r>a+o)&&p.push({cell:t,i:m,rs:m+i}),g+=r}else{if(b>=a)break;if(r>0){if(d<1&&r+b>=a){t.colSpan+=1,a=null,d=i+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=[],!s){if(d>0){d-=1;continue}null!==a&&e.length>0&&(i=zl(e[0].nodeName),i=t.insertBefore(i,e[a]))}}const g=this._element.querySelector("colgroup");if(g){const t=g.querySelectorAll("col");if(s)xt.utils.removeItem(t[a]);else{let e=0;for(let i,s=0,n=t.length;s<n;s++)i=kt.get(t[s].style.width),i-=Math.round(i*n*.1/2),e+=i,t[s].style.width=`${i}%`;const i=xt.utils.createElement("col",{style:`width:${100-e}%`});g.insertBefore(i,t[a])}}if(s){let t,e;for(let i,s=0,n=u.length;s<n;s++)i=u[s].parentNode,xt.utils.removeItem(u[s]),0===i.cells.length&&(t||=xt.utils.getArrayIndex(r,i),e=xt.utils.getArrayIndex(r,i),xt.utils.removeItem(i));for(let i,s=0,n=p.length;s<n;s++)i=p[s],i.cell.rowSpan=kt.getOverlapRangeAtIndex(t,e,i.i,i.rs);this.#as()}else this._setCellControllerPosition(i||this.#ui,!0);return i||this.#ui}pasteTableCellMatrix(t,e){if(!t||!e)return;const i=t.rows;let s=0;const n=[];for(let t=0;t<i.length;t++){const e=i[t].cells;let o=0;for(let i=0;i<e.length;i++){const l=e[i];for(;n[t]?.[o];)o++;const r=l.rowSpan||1,a=l.colSpan||1;0===o&&(s+=r);for(let e=0;e<r;e++)for(let i=0;i<a;i++)n[t+e]||(n[t+e]=[]),n[t+e][o+i]=!0;o+=a}}let o=0;for(let t=0,e=i[0].cells,s=e.length;t<s;t++){o+=e[t].colSpan||1}const l={rowCnt:s,logicalCellCnt:o};this.#os();const r=e.closest("table"),{cloneTable:a,clonedSelectedCells:h}=this._cloneTable(r,[e]),c=a;e=h[0];let d=c.rows;this.setTableInfo(c),this.setCellInfo(e,!0);const u={physicalCellCnt:this.#Si,logicalCellCnt:this.#Ti,rowCnt:this.#Li,rowInex:this.#Mi,physicalCellIndex:this.#Ni,logicalCellIndex:this.#Ai,currentColSpan:this.#Bi,currentRowSpan:this.#Vi},p=l.rowCnt-(u.rowCnt-(u.rowInex+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.editRow("down",e);for(let t=0;t<g;t++)this.editCell("right",e);d=this.#gi=c.rows}const m=u.rowInex,f=u.logicalCellIndex,b=f+l.logicalCellCnt-1,y=[],v=[];for(let t=0,e=m+l.rowCnt;t<e;t++){const e=d[t]?.cells;if(!e)continue;let i=0,s=0;for(let n=0;n<e.length;n++){for(;v[t]?.[i];)i++;const n=e[s++];if(!n)break;const o=n.colSpan||1,l=n.rowSpan||1,r=i,a=i+o-1;if(l>1||o>1)for(let e=1;e<l;e++){const s=t+e;v[s]||=[];for(let t=0;t<o;t++)v[s][i+t]=!0}r<=b&&a>=f&&(o>1||l>1)&&y.push(n),i+=o}}y.length>0&&(this.unmergeCells(y,!0),d=this.#gi=c.rows);const _=[],C=[],w=[];for(let t=0,e=l.rowCnt;t<e;t++){const e=i[t]?.cells;if(!e)break;let s=0;for(let i=0;i<e.length;i++){const n=e[i],o=n.colSpan||1,l=n.rowSpan||1;for(;C[t]?.[s];)s++;for(let e=1;e<l;e++){const i=t+e;C[i]||=[];for(let t=0;t<o;t++)C[i][s+t]=!0}if(o<=1&&l<=1){s+=o;continue}const r=s+u.logicalCellIndex,a=r+o-1,h=[];for(let e=u.rowInex+t,i=e+l,s=0;e<i;e++,s++){const t=d[e].cells;let i=0,s=0;for(;s<t.length&&i<=a;){for(;w[e]?.[i];)i++;const n=t[s++],o=n.colSpan||1,l=n.rowSpan||1,c=i,d=i+o-1;if(l>1)for(let t=1;t<l;t++){const s=e+t;w[s]||=[];for(let t=0;t<o;t++)w[s][i+t]=!0}d>=r&&c<=a&&h.push(n),i+=o}}h.length>0&&_.push(h),s+=o}}if(_.length>0){for(const t of _)this.#Fi=null,this.#gi=c.rows,this.mergeCells(t,!0);d=this.#gi=c.rows}const x=[],k=[];for(let t=0;t<l.rowCnt;t++){const e=d[u.rowInex+t],s=i[t];if(!e||!s)break;const n=e.cells,o=s.cells;let l=0,r=0,a=0;for(;r<n.length&&a<o.length&&l<=b;){for(;k[t]?.[l];)l++;const e=n[r++],i=o[a];if(!e||!i)break;const s=e.colSpan||1,h=e.rowSpan||1;if(h>1)for(let e=1;e<h;e++){const i=t+e;k[i]||=[];for(let t=0;t<s;t++)k[i][l+t]=!0}l>=f&&l+s-1<=b&&(e.innerHTML=i.innerHTML,x.push(e),a++),l+=s}}r.replaceWith(c),this.#ts(),this.setTableInfo(c),this.selectCells(x),this.#us(),this.#Qi(),this.#ps(x[0]),this._historyPush()}insertBodyRow(t,e,i){const s=t.insertRow(e);return s.innerHTML=Fl("td",i),s}mergeCells(t,e=!1){const i=t[0].closest("table"),{cloneTable:s,clonedSelectedCells:n}=e?{cloneTable:i,clonedSelectedCells:t}:this._cloneTable(i,t);this.setTableInfo(s),t=n,this.#Fi=null,this._setMultiCells(t[0],xt.query.findVisualLastCell(t));const o=this.#Fi,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,i,s=1,n=t.length;s<n;s++){e=t[s],u!==e.parentNode&&(u=e.parentNode),i=e.children;for(let t=0,e=i.length;t<e;t++)this.format.isLine(i[t])&&xt.check.isZeroWidth(i[t].textContent)&&xt.utils.removeItem(i[t]);d+=e.innerHTML,xt.utils.removeItem(e),0===u.cells.length&&(r?a=u:r=u,c-=1)}if(r){const t=this.#gi,e=xt.utils.getArrayIndex(t,r),i=xt.utils.getArrayIndex(t,a||r),s=[];for(let n,o=0;o<=i;o++)if(n=t[o].cells,0!==n.length)for(let t,s,l=0,r=n.length;l<r;l++)t=n[l],s=t.rowSpan-1,s>0&&o+s>=e&&(t.rowSpan-=kt.getOverlapRangeAtIndex(e,i,o,o+s));else s.push(t[o]);for(let t=0,e=s.length;t<e;t++)xt.utils.removeItem(s[t])}l.innerHTML+=d,l.colSpan=h,l.rowSpan=c,e||(i.replaceWith(s),this.#ts(),this.#us(),this._setController(l),this.#ps(l),this._historyPush())}unmergeCells(t,e=!1){if(!t?.length)return;const i=t[0].closest("table"),{cloneTable:s,clonedSelectedCells:n}=e?{cloneTable:i,clonedSelectedCells:t}:this._cloneTable(i,t);this.#Fi=null,this.setTableInfo(s);let o=(t=n)[0],l=xt.query.findVisualLastCell(t),r=null;const a=o.closest("table"),h=a.rows;for(const e of t){const t=e.parentElement.rowIndex,i=e.cellIndex,s=e.rowSpan,n=e.colSpan;if(1===s&&1===n)continue;this.setCellInfo(e,!0);const a=e.innerHTML;e.remove();for(let c=0;c<s;c++){const s=h[t+c];for(let t=0;t<n;t++){const n=zl("td");0===c&&0===t?(o===e&&(o=n),l===e&&(l=n),n.innerHTML=a,s.insertBefore(n,s.cells[i])):(s.insertBefore(n,s.cells[i+t]),r=n)}}}this.#yi=null,e||(i.replaceWith(s),this.#ts(),this.setTableInfo(s),o!==l?(l=!r||l.closest("tr").rowIndex>r.closest("tr").rowIndex||l.cellIndex>r.cellIndex?l:r,this._setMultiCells(o,l),this.#yi=Array.from(a.querySelectorAll(".se-selected-table-cell"))):this.setCellInfo(l,!0),this.#fi=o,this.#bi=l,xt.utils.addClass(l,"se-selected-cell-focus"),this.#Qi(),this.controller_cell.resetPosition(l),this._historyPush())}findMergedCells(t){const e=[];return t?.forEach((t=>{t&&(t.rowSpan>1||t.colSpan>1)&&e.push(t)})),e}toggleHeader(){const t=this.headerButton,e=xt.utils.hasClass(t,"active"),i=this._element;if(e)xt.utils.removeItem(i.querySelector("thead"));else{const t=xt.utils.createElement("THEAD");t.innerHTML="<tr>"+Fl("th",this.#Ti)+"</tr>",i.insertBefore(t,i.firstElementChild)}xt.utils.toggleClass(t,"active"),/TH/i.test(this.#ui.nodeName)?this.#as():this._setCellControllerPosition(this.#ui,!1)}toggleCaption(){const t=this.captionButton,e=xt.utils.hasClass(t,"active"),i=this._element;if(e)xt.utils.removeItem(i.querySelector("caption"));else{const t=xt.utils.createElement("CAPTION",{class:`se-table-caption-${this.captionPosition}`});t.innerHTML="<div><br></div>",i.insertBefore(t,i.firstElementChild)}xt.utils.toggleClass(t,"active"),this._setCellControllerPosition(this.#ui,!1)}#Ji(t,e){if(t.includes("width")){const t=this.#di;if(!t)return;let i,s;this.#ki?(i=this.icons.reduction,s=this.minText,e||(t.style.width="100%")):(i=this.icons.expansion,s=this.maxText,e||(t.style.width="max-content")),xt.utils.changeElement(this.resizeButton.firstElementChild,i),xt.utils.changeTxt(this.resizeText,s)}t.includes("column")&&(this.#Ei?(xt.utils.removeClass(this._element,"se-table-layout-auto"),xt.utils.addClass(this._element,"se-table-layout-fixed"),xt.utils.addClass(this.columnFixedButton,"active")):(xt.utils.removeClass(this._element,"se-table-layout-fixed"),xt.utils.addClass(this._element,"se-table-layout-auto"),xt.utils.removeClass(this.columnFixedButton,"active")))}#us(){this.#Fi?(this.splitButton.style.display="none",this.mergeButton.style.display="block"):(this.splitButton.style.display="block",this.mergeButton.style.display="none")}#Qi(){this.findMergedCells(this.#yi?.length?this.#yi:[this.#fi]).length>0?this.unmergeButton.disabled=!1:this.unmergeButton.disabled=!0}_setController(t){if(!this.selection.get().isCollapsed&&!this.#bi)return void this.#os();this.#Qi(),this.#ui=t,this.#fi===t&&xt.utils.addClass(t,"se-selected-cell-focus"),this.#yi?.length||(this.#yi=[t]);const e=this.#mi||this._element||xt.query.getParentElement(t,"TABLE");this.component.select(e,Vl.key,{isInput:!0})}_setCellControllerPosition(t,e){this.setCellInfo(t,e),this.cellControllerTop||this.controller_cell.resetPosition(t)}_historyPush(){this.#os(),this.history.push(!1),this.#gs()}#Ki(t){this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,infoOnly:!1})}#ms(t){const e=t.querySelector("colgroup").querySelectorAll("col"),i=t.offsetWidth;e.forEach((t=>{const e=t.style.width;if(!e.endsWith("%")){const s=(t.offsetWidth||kt.get(e,0))/i*100;t.style.width=s+"%"}}))}_startCellResizing(t,e,i,s){xt.utils.removeClass(this.#di,"se-component-selected"),this.#ms(this._element),this.#ss(this.#di,this.#ui,this.#Ci,s),this.#Ci.style.display="block";const n=t.style.width,o=t.nextElementSibling,l=o.style.width,r=xt.utils.hasClass(this._element,"se-table-layout-fixed")?l:wt.getWidthInPercentage(o||t);he.get("__dragHandler")&&(he.get("__dragHandler").style.display="none"),this.#fs(this.#bs.bind(this,t,o,this.#di,this.#ui,this.#_i,s,e,i,kt.get(n,0),kt.get(r,0),this._element.offsetWidth),(()=>{this.#vt(),this.#ms(this._element),this.history.push(!0),this.component.hoverSelect(this._element),this.#ls(!0)}),(e=>{this._stopResize(t,n,"width",e),this._stopResize(o,l,"width",e)}))}#bs(t,e,i,s,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.#ss(i,s,n,o)}}_startRowResizing(t,e,i){xt.utils.removeClass(this.#di,"se-component-selected"),this.#ns(this.#di,t,this.#Ci),this.#Ci.style.display="block";const s=t.style.height;he.get("__dragHandler")&&(he.get("__dragHandler").style.display="none"),this.#fs(this.#ys.bind(this,t,this.#di,this.#_i,e,i),(()=>{this.#vt(),this.history.push(!0),this.component.hoverSelect(this._element),this.#ls(!0)}),this._stopResize.bind(this,t,s,"height"))}#ys(t,e,i,s,n,o){const l=n+(o.clientY-s);t.style.height=`${l}px`,this.#ns(e,t,i)}_startFigureResizing(t,e){const i=this.#di;xt.utils.removeClass(i,"se-component-selected"),this.#ss(i,i,this.#Ci,e),this.#Ci.style.display="block";const s=wt.getWidthInPercentage(i);he.get("__dragHandler")&&(he.get("__dragHandler").style.display="none"),this.#fs(this.#vs.bind(this,i,this.#_i,e,t,i.offsetWidth,kt.get(s,0)),(()=>{this.#vt(),kt.get(i.style.width,0)>100&&(i.style.width="100%"),this.history.push(!0),this.component.hoverSelect(this._element),this.#ls(!0)}),this._stopResize.bind(this,i,i.style.width,"width"))}#vs(t,e,i,s,n,o,l){const r=(n+(i?s-l.clientX:l.clientX-s))/n*o;r>0&&(t.style.width=`${r}%`,this.#ss(t,t,e,i))}#ss(t,e,i,s){const n=this.offset.getLocal(e),o=this.offset.getLocal(t);i.style.left=`${n.left+(s?0:e.offsetWidth)}px`,i.style.top=`${o.top}px`,i.style.height=`${t.offsetHeight}px`}#ns(t,e,i){const s=this.offset.getLocal(e),n=this.offset.getLocal(t);i.style.top=`${s.top+e.offsetHeight}px`,i.style.left=`${n.left}px`,i.style.width=`${t.offsetWidth}px`}_stopResize(t,e,i,s){Et.isEsc(s.code)&&(this.#vt(),this.component.hoverSelect(this._element),this.#ls(!0),t.style[i]=e,"width"===i&&this.component.select(this._element,Vl.key,{isInput:!0}))}#os(){xt.utils.removeClass([this.#fi,this.#bi],"se-selected-cell-focus");const t=this.#fi?.closest("table");if(t){const e=t.querySelectorAll(".se-selected-table-cell");for(let t=0,i=e.length;t<i;t++)xt.utils.removeClass(e[t],"se-selected-table-cell")}}#gs(){if(this.#yi){const t=this.#yi;for(let e=0,i=t.length;e<i;e++)xt.utils.addClass(t[e],"se-selected-table-cell")}}#fs(t,e,i){this.#qi.resize=this.eventManager.addGlobalEvent("mousemove",t,!1),this.#qi.resizeStop=this.eventManager.addGlobalEvent("mouseup",e,!1),this.#qi.resizeKeyDown=this.eventManager.addGlobalEvent("keydown",i,!1),this.#vi=!0}#ls(t){const e=this.frameContext.get("wysiwyg");e.setAttribute("contenteditable",t.toString()),t?xt.utils.removeClass(e,"se-disabled"):xt.utils.addClass(e,"se-disabled")}#hs(t){this._typeCache=t;const e="table"===t,i=e?[this._element]:this.#yi;if(!i?.[0])return;const{border_format:s,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:b,color:y,textAlign:v,verticalAlign:_,fontWeight:C,textDecoration:w,fontStyle:x}=_l.getComputedStyle(i[0]),k=this.#_s(f);h.querySelector('[data-value="justify"]').style.display=e?"none":"",d.style.display=e?"":"none",c.style.display=e?"none":"";let E=wt.rgb2hex(k.c),S=k.s,T=k.w,H=wt.rgb2hex(b),L=wt.rgb2hex(y),M=/.+/.test(C),N=/underline/i.test(w),A=/line-through/i.test(w),B=/italic/i.test(x),V=e?this.#di?.style.float:v,I=_;this._propsCache=[];const O=_l.getComputedStyle(this.eventManager.__focusTemp);for(let t,s,n=0;t=i[n];n++){const{cssText:i,border:n,backgroundColor:o,color:l,textAlign:r,verticalAlign:a,fontWeight:h,textDecoration:c,fontStyle:d}=t.style;if(this._propsCache.push([t,i]),s)continue;const{c:u,s:p,w:g}=this.#_s(n);let m=o,f=l;m&&(this.eventManager.__focusTemp.style.backgroundColor=m,m=O.backgroundColor),f&&(this.eventManager.__focusTemp.style.color=f,f=O.color),E&&k.c!==u&&(E=""),S&&k.s!==p&&(S=""),T&&k.w!==g&&(T=""),H!==wt.rgb2hex(m)&&(H=""),L!==wt.rgb2hex(f)&&(L=""),V!==(e?this.#di?.style.float:r)&&(V=""),I&&I!==a&&(I=""),M&&M!==/.+/.test(h)&&(M=!1),N&&N!==/underline/i.test(c)&&(N=!1),A&&A!==/line-through/i.test(c)&&(A=!1),B&&B!==/italic/i.test(d)&&(B=!1),E&&S&&T&&H&&L||(s=!0)}s.firstElementChild.innerHTML=this.icons[Tl[1===i.length?"outside":"all"]],s.setAttribute("se-border-format","all"),xt.utils.removeClass(s,"active"),S||=Sl[0],o.textContent=S,n.style.borderColor=n.value=E,l.value=T,this._disableBorderProps(S===Sl[0]),r.value=r.style.borderColor=H,a.value=a.style.borderColor=L,M&&xt.utils.addClass(u,"on"),N&&xt.utils.addClass(p,"on"),A&&xt.utils.addClass(m,"on"),B&&xt.utils.addClass(g,"on"),this.#ds(h,this._propsAlignCache=V,!0),this.#ds(c,this._propsVerticalAlignCache=I,!0)}#ds(t,e,i){xt.utils.removeClass(t.querySelectorAll("button"),"on"),i||t.getAttribute("se-cell-align")!==e?(xt.utils.addClass(t.querySelector(`[data-value="${e}"]`),"on"),t.setAttribute("se-cell-align",e)):t.setAttribute("se-cell-align","")}_disableBorderProps(t){const{border_color:e,border_width:i,palette_border_button:s}=this.propTargets;t?(e.disabled=!0,i.disabled=!0,s.disabled=!0,i.disabled=!0):(e.disabled=!1,i.disabled=!1,s.disabled=!1,i.disabled=!1)}#_s(t){const e=t.split(/\s(?![^()]*\))/);let i="",s="",n="";return 3===e.length?(i=e[0],s=e[1],n=e[2]):2===e.length?/\d/.test(e[0])?(i=e[0],s=e[1]):(s=e[0],n=e[1]):1===e.length&&(/\d/.test(e[0])?i=e[0]:s=e[0]),{w:i,s,c:wt.rgb2hex(n)}}_submitProps(t){try{t.disabled=!0;const e=this.controller_table.form.contains(this.controller_props.currentTarget),i=e?[this._element]:this.#yi,s=i[0],n=_l.getComputedStyle(s),{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,b=d.getAttribute("se-cell-align")||"",y=u.getAttribute("se-cell-align")||"",v=f?"":l.value.trim()||n.borderColor;let _=f?"":a.value.trim()||n.borderWidth;_+=kt.is(_)?"px":"";const C=h.value.trim(),w=c.value.trim(),x=g&&!f&&_,k=`${_} ${m} ${v}`,E={left:[],top:[],right:[],bottom:[],middle:[],all:null};if(e){const t=s.style;this.#di&&(this.#di.style.float=b,this.#di.style.verticalAlign=y),t.backgroundColor=C,t.color=w,this.#Cs(t),x||(t.border=f?t.borderLeft=t.borderTop=t.borderRight=t.borderBottom="":k),E.left=E.top=E.right=E.bottom=i}else{const t=s.parentElement;let{rs:e,re:n,cs:o,ce:l}=this.#Fi||{rs:t.rowIndex||0,re:t.rowIndex||0,cs:s.cellIndex||0,ce:s.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,s,c,d,u,p=0,g=0,m=i.length,v=0;p<m;p++,g++){t=i[p],d=t.colSpan,u=t.rowSpan,c=t.cellIndex-a,h!==t.parentElement&&(v++,g=0,h=t.parentElement);let m=0;for(;m<=c;)c+=r[v][m]||0,m++;try{if(u>1){const t=u-1;for(let e=v;e<=v+t;e++)r[e][c]+=d-(v===e?1:0)}else d>1&&(r[v][c]+=d-1)}catch{}const _=v+u-1===n;v===e&&E.top.push(t),(v===n||_)&&E.bottom.push(t),c===o&&E.left.push(t),c!==l&&c+d-1!==l||E.right.push(t),_||v===e||v===n||c===o||c===l||E.middle.push(t),s=t.style,s.textAlign=b,s.verticalAlign=y,s.backgroundColor=C,s.color=w,this.#Cs(s),x||(s.border=f?s.borderLeft=s.borderTop=s.borderRight=s.borderBottom="":k)}0===E.middle.length&&(E.middle=i)}E.all=i,x&&this.#ws(E,p,k),this._historyPush(),this.controller_props.close(),this.#ui&&(this.#gs(),this.setCellInfo(this.#ui,!0),xt.utils.addClass(this.#ui,"se-selected-cell-focus"))}catch(t){console.warn("[SUNEDITOR.plugins.table.setProps.error]",t)}finally{t.disabled=!1}}#Cs(t){const{font_bold:e,font_italic:i,font_strike:s,font_underline:n}=this.propTargets;t.fontWeight=xt.utils.hasClass(e,"on")?"bold":"",t.fontStyle=xt.utils.hasClass(i,"on")?"italic":"",t.textDecoration=((xt.utils.hasClass(s,"on")?"line-through ":"")+(xt.utils.hasClass(n,"on")?"underline":"")).trim()}#ws(t,e,i){const{left:s,top:n,right:o,bottom:l,all:r}=t;switch(e){case"inside":if(1===r.length)return;xt.utils.setStyle(r.filter((t=>!l.includes(t))),Al,i),xt.utils.setStyle(r.filter((t=>!o.includes(t))),Nl,i);break;case"horizon":if(1===r.length)return;xt.utils.setStyle(r.filter((t=>!l.includes(t))),Al,i);break;case"vertical":if(1===r.length)return;xt.utils.setStyle(r.filter((t=>!o.includes(t))),Nl,i);break;case"outside":xt.utils.setStyle(s,Ll,i),xt.utils.setStyle(n,Ml,i),xt.utils.setStyle(o,Nl,i),xt.utils.setStyle(l,Al,i);break;case"left":xt.utils.setStyle(s,Ll,i);break;case"top":xt.utils.setStyle(n,Ml,i);break;case"right":xt.utils.setStyle(o,Nl,i);break;case"bottom":xt.utils.setStyle(l,Al,i)}}_setMultiCells(t,e){const i=this.#mi.rows;if(this.#os(),xt.utils.addClass(t,"se-selected-table-cell"),t===e&&!this.#Ii)return;let s=!0,n=[],o=[];const l=this.#Fi={_i:0,cs:null,ce:null,rs:null,re:null};for(let r,a,h=0,c=i.length;h<c;h++){r=i[h].cells,a=0;for(let i,c,d,u,p=0,g=r.length;p<g;p++){if(i=r[p],d=i.colSpan-1,u=i.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(s){if(i!==t&&i!==e||(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){s=!1,n=[],o=[],h=-1;break}}else if(kt.getOverlapRangeAtIndex(l.cs,l.ce,c,c+d)&&kt.getOverlapRangeAtIndex(l.rs,l.re,h,h+u)){const t=l.cs<c?l.cs:c,e=l.ce>c+d?l.ce:c+d,s=l.rs<h?l.rs:h,r=l.re>h+u?l.re:h+u;if(l.cs!==t||l.ce!==e||l.rs!==s||l.re!==r){l.cs=t,l.ce=e,l.rs=s,l.re=r,h=-1,n=[],o=[];break}xt.utils.addClass(i,"se-selected-table-cell")}u>0&&o.push({index:c,cs:d+1,rs:u,row:-1}),a+=i.colSpan-1}n=n.concat(o).sort(((t,e)=>t.index-e.index)),o=[]}}#Xi(){if(!this.tableHighlight)return;const t=this.tableHighlight.style,e=this.tableUnHighlight.style;t.width="1em",t.height="1em",e.width="5em",e.height="5em",xt.utils.changeTxt(this.tableDisplay,"1 x 1")}#es(){const{cell_alignment:t}=this.propTargets,e=t.querySelector('[data-value="left"]'),i=t.querySelector('[data-value="right"]'),s=e.parentElement,n=i.parentElement;s.appendChild(i),n.appendChild(e)}#cs(t,e,i){this.controller_colorPicker.isOpen&&e===this.sliderType?this.controller_colorPicker.close():(this.sliderType=e,xt.utils.addClass(t,"on"),this.colorPicker.init(i?.value||"",t),this.controller_colorPicker.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null}))}#as(){this.controller_table.close(),this.controller_cell.close()}#ts(){this.component.deselect(),this.#as()}#is(){this.#_i&&(this.#_i.style.display="none",this.#_i=null)}#vt(){this.#vi=!1,this.ui.disableBackWrapper(),this.#is(),this.#Ci&&(this.#Ci.style.display="none",this.#Ci=null);const t=this.#qi;for(const e in t)t[e]&&=this.eventManager.removeGlobalEvent(t[e])}_cloneTable(t,e){const i=xt.utils.clone(t,!0),s=Array.from(t.querySelectorAll("td, th")),n=Array.from(i.querySelectorAll("td, th"));return{cloneTable:i,clonedSelectedCells:e.map((t=>{const e=s.indexOf(t);return e>-1?n[e]:null})).filter((t=>null!==t))}}#rs(t,e){this.#Oi=e,this.#Ii||this.#Fi||this.#vt(),this.#Ii=e,this.#fi=t,this.#yi?.length||(this.#yi=[t]),this.#Ri=t.nodeName,this.#mi=xt.query.getParentElement(t,"TABLE"),this.#os(),xt.utils.addClass(t,"se-selected-cell-focus"),e?(this.#qi.shiftOff=this.eventManager.addGlobalEvent("keyup",this.#Pi,!1),this.#qi.on=this.eventManager.addGlobalEvent("mousedown",this.#zi,!1)):this.#qi.on=this.eventManager.addGlobalEvent("mousemove",this.#zi,!1),this.#qi.off=this.eventManager.addGlobalEvent("mouseup",this.#$i,!1),this.#qi.touchOff=this.eventManager.addGlobalEvent("touchmove",this.#Di,!1)}_OnSplitCells(t){const e="vertical"===t,i=this.#ui,s=this.#gi,n=this.#pi,o=this.#Ai,l=this.#Mi,r=zl(i.nodeName);if(e){const t=i.colSpan;if(r.rowSpan=i.rowSpan,t>1)r.colSpan=Math.floor(t/2),i.colSpan=t-r.colSpan,n.insertBefore(r,i.nextElementSibling);else{let e=[],l=[];for(let n,r,a=0,h=this.#Li;a<h;a++){n=s[a].cells,r=0;for(let s,h,c,d,u=0,p=n.length;u<p;u++){if(s=n[u],h=s.colSpan-1,c=s.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}),s!==i&&d<=o&&d+h>=o+t-1){s.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,i.nextElementSibling)}}else{const t=i.rowSpan;if(r.colSpan=i.colSpan,t>1){r.rowSpan=Math.floor(t/2);const e=t-r.rowSpan,l=[],a=xt.utils.getArrayIndex(s,n)+e;for(let t,e,i=0;i<a;i++){t=s[i].cells,e=0;for(let s,n,r,h=0,c=t.length;h<c&&(r=h+e,!(r>=o));h++)s=t[h],n=s.rowSpan-1,n>0&&n+i>=a&&r<o&&l.push({index:r,cs:s.colSpan}),e+=s.colSpan-1}const h=s[a],c=h.cells;let d=l.shift();for(let t,e,i,s,n=0,a=c.length,u=0;n<a;n++){if(i=n+u,t=c[n],e=t.colSpan-1,s=i+e+1,d&&s>=d.index&&(u+=d.cs,s+=d.cs,d=l.shift()),s>=o||n===a-1){h.insertBefore(r,t.nextElementSibling);break}u+=e}i.rowSpan=e}else{r.rowSpan=i.rowSpan;const t=xt.utils.createElement("TR");t.appendChild(r);for(let t,e=0;e<l;e++){if(t=s[e].cells,0===t.length)return;for(let i=0,s=t.length;i<s;i++)e+t[i].rowSpan-1>=l&&(t[i].rowSpan+=1)}const e=this.#Ni,o=n.cells;for(let t=0,i=o.length;t<i;t++)t!==e&&(o[t].rowSpan+=1);n.parentNode.insertBefore(t,n.nextElementSibling)}}this.selectMenu_split.close(),this.#ps(i),this.#os(),this.history.push(!1),this._setController(i),this.#bi=this.#fi=i,this.#yi?.length||(this.#yi=[i])}_OnColumnEdit(t){switch(t){case"insert-left":this.editTable("cell","left");break;case"insert-right":this.editTable("cell","right");break;case"delete":this.editTable("cell",null)}this._historyPush()}_OnRowEdit(t){switch(t){case"insert-above":this.editTable("row","up");break;case"insert-below":this.editTable("row","down");break;case"delete":this.editTable("row",null)}this._historyPush()}#Yi(t){t.stopPropagation();let e=Math.ceil(t.offsetX/18),i=Math.ceil(t.offsetY/18);e=e<1?1:e,i=i<1?1:i;const s=this.options.get("_rtl");s&&(e=11-e),this.tableHighlight.style.width=e+"em",this.tableHighlight.style.height=i+"em";const n=e<5?5:e>8?10:e+2,o=i<5?5:i>8?10:i+2;if(this.tableUnHighlight.style.width=n+"em",this.tableUnHighlight.style.height=o+"em",s){const t=n-(this.#xi||5);if(0!==t){const e=kt.get(this.tableMenu.style.left);this.tableMenu.style.left=e-18*t+"px",this.#xi=n}}xt.utils.changeTxt(this.tableDisplay,e+" x "+i),this.#wi=[e,i]}#ji(){const t=xt.utils.createElement("TABLE"),e=this.#wi[0],i=this.#wi[1],s=`<tbody>${`<tr>${Fl("td",e)}</tr>`.repeat(i)}</tbody>`,n=`<colgroup>${`<col style="width: ${kt.get(100/e,0)}%;">`.repeat(e)}</colgroup>`;t.innerHTML=n+s;let o="";this.figureScroll&&(o=` se-scroll-figure-${this.figureScroll}`);const l=xt.utils.createElement("FIGURE",{class:"se-flex-component se-input-component"+o,style:"width: 100%;"});if(l.appendChild(t),this.#ki=!0,this.component.insert(l,{insertBehavior:"none"})){this.#Xi(),this.menu.dropdownOff();const e=t.querySelector("td div");this.selection.setRange(e,0,e,0)}}#Wi(t){this.editor._preventBlur=!0;const e=xt.query.getParentElement(xt.query.getEventTarget(t),xt.check.isTableCell);if(this.#Ii){if(e===this.#fi)return this.#Ii=!1,this.#os(),this.#ls(!0),void this.#vt();this.#ls(!1)}else if(!this.#Fi){if(e===this.#fi)return;this.#ls(!1)}e&&e!==this.#bi&&this.#Ri===e.nodeName&&this.#mi===xt.query.getParentElement(e,"TABLE")&&this._setMultiCells(this.#fi,this.#bi=e)}#Ui(t){if(t.stopPropagation(),this.#Ii?this.#qi.touchOff&&=this.eventManager.removeGlobalEvent(this.#qi.touchOff):(this.#ls(!0),this.#vt()),!this.#fi||!this.#mi)return;if(this.#us(),this.#yi=Array.from(this.#mi.querySelectorAll(".se-selected-table-cell")),this.#Ii)return;this.#fi&&this.#bi&&(this.#ps(this.#fi),this.#fi===this.#bi&&xt.utils.removeClass(this.#fi,"se-selected-table-cell"));const e=this.#yi?.length>0?this.#bi:this.#fi;this._setController(e)}#Zi(){if(this.#Fi){this.#vt(),this.#ls(!0),this.#ps(this.#fi);const t=this.#yi?.length>0?this.#bi:this.#fi;this._setController(t)}else this.#as()}#Gi(){this.resetSelectInfo()}#ps(t){_t.isMobile||this.editor.focusEdge(t)}}function Il(t){return/^(TD|TH|TR)$/i.test(t?.nodeName)}function Ol(t,e){const i=t.clientX,s=kt.get(_l.getComputedStyle(e).width,0),n=e.getBoundingClientRect(),o=Math.round(i-n.left),l=o<=6;return{is:l||s-o<=6,isLeft:l,startX:i}}function Rl(t,e){const i=t.clientY,s=kt.get(_l.getComputedStyle(e).height,0),n=e.getBoundingClientRect();return{is:Math.ceil(s+n.top-i)<=6,startY:i}}function Fl(t,e){return`<${t=t.toLowerCase()}><div><br></div></${t}>`.repeat(e)}function zl(t){return t=t.toLowerCase(),xt.utils.createElement(t,null,"<div><br></div>")}function $l(t){this.propTargets.border_style.textContent=t,this._disableBorderProps(t===Sl[0]),this.selectMenu_props_border.close()}function Pl(t,e){const{border_format:i}=this.propTargets;i.setAttribute("se-border-format",e),i.firstElementChild.innerHTML=this.icons[Tl[e]],e!==t?xt.utils.addClass(i,"active"):xt.utils.removeClass(i,"active"),this.selectMenu_props_border_format.close(),this.selectMenu_props_border_format_oneCell.close()}function Dl(t){this.controller_cell.bringToTop(t)}function ql(t,e,i){const s=[];let n="";for(const o in Tl){if(i.includes(o))continue;const l=Tl[o];s.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:s,menus:xt.utils.createElement("DIV",null,n).querySelectorAll("button")}}const Wl=Vl;class Ul extends Do{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 i=function({lang:t},e){const i=["p","blockquote","pre","h1","h2","h3","h4","h5","h6"],s=e&&0!==e.length?e:i;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=s.length;d<u;d++)e=s[d],"string"==typeof e&&i.includes(e)?(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=""):(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>",xt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(t,e.items);this.formatList=i.querySelectorAll("li button"),this.currentFormat="",this.menu.initDropdownTarget(Ul,i)}active(t,e){let i=this.lang.formats;const s=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,s=0,l=e.length;s<l;s++)if(t=e[s],n===t.getAttribute("data-value")&&o===t.getAttribute("data-class")){i=t.title;break}return xt.utils.changeTxt(s,i),s.setAttribute("data-value",n),s.setAttribute("data-class",o),!0}}else xt.utils.changeTxt(s,i);return!1}on(t){const e=this.formatList,i=t.querySelector(".se-txt"),s=(i.getAttribute("data-value")||"")+(i.getAttribute("data-class")||"");if(s!==this.currentFormat){for(let t,i=0,n=e.length;i<n;i++)t=e[i],s===t.getAttribute("data-value")+t.getAttribute("data-class")?xt.utils.addClass(t,"active"):xt.utils.removeClass(t,"active");this.currentFormat=s}}action(t){const e=t.getAttribute("data-command"),i=t.firstElementChild;"block"===e?this.format.applyBlock(i):"br-line"===e?this.format.setBrLine(i):this.format.setLine(i),this.menu.dropdownOff()}applyHeaderByShortcut({keyCode:t}){const e=t.match(/\d+$/)?.[0],i=xt.utils.createElement(`H${e}`);this.format.setLine(i)}}const Zl=Ul;class Gl extends Do{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 i=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 i,s=0,n=(t||[]).length;s<n;s++)i=t[s],e+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-value="${s}" title="${i.name}" aria-label="${i.name}">\n\t\t\t\t\t${i.name}\n\t\t\t\t</button>\n\t\t\t</li>`;return e+="\n\t\t</ul>\n\t</div>",xt.utils.createElement("DIV",{class:"se-list-layer"},e)}(this.items);this.menu.initDropdownTarget(Gl,i)}action(t){const e=Number(t.getAttribute("data-value")),i=this.items[this.selectedIndex=e];if(!i.html)throw this.menu.dropdownOff(),Error('[SUNEDITOR.layout.fail] cause : "layouts[i].html not found"');this.html.set(i.html),this.menu.dropdownOff()}}const Yl=Gl;class jl extends Do{static key="lineHeight";static className="";#ci;constructor(t,e){super(t),this.title=this.lang.lineHeight,this.icon="line_height";const i=function({lang:t},e){const i=e||[{text:"1",value:"1em"},{text:"1.2",value:"1.2em"},{text:"1.7",value:"1.7em"},{text:"2",value:"2em"}];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,e=0,n=i.length;e<n;e++)t=i[e],s+=`\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 s+="\n\t\t</ul>\n\t</div>",xt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},s)}(t,e.items);this.sizeList=i.querySelectorAll("li button"),this.currentSize=null,this.#ci=i.querySelector(".se-sub-list span"),this.menu.initDropdownTarget(jl,i)}active(t,e){return this.format.isLine(t)&&t.style.lineHeight.length>0?(xt.utils.addClass(e,"active"),!0):(xt.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 i=this.sizeList;for(let s=0,n=i.length;s<n;s++)e===i[s].getAttribute("data-command")?(xt.utils.addClass(i[s],"active"),t=!0):xt.utils.removeClass(i[s],"active");this.currentSize=e,t?this.#ci.style.display="none":(this.#ci.textContent=e,this.#ci.style.display="block")}}action(t){const e=t.getAttribute("data-command")||"",i=this.format.getLines();for(let t=0,s=i.length;t<s;t++)i[t].style.lineHeight=e;this.menu.dropdownOff(),this.editor.effectNode=null,this.history.push(!1)}}const Xl=jl;class Kl extends Do{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 i=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 i,s=0,n=(t||[]).length;s<n;s++)i=t[s],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="${s}" \n\t\t\t\ttitle="${i.name}" \n\t\t\t\taria-label="${i.name}"\n\t\t\t>\n\t\t\t\t${i.name}\n\t\t\t</button>\n\t\t</li>`;return e+="</ul></div>",xt.utils.createElement("DIV",{class:"se-list-layer"},e)}(this.items);this.menu.initDropdownTarget(Kl,i)}action(t){const e=Number(t.getAttribute("data-value")),i=this.items[this.selectedIndex=e];if(!i.html)throw this.menu.dropdownOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.html.insert(i.html,{selectInserted:!1,skipCharCount:!1,skipCleaning:!1}),this.menu.dropdownOff()}}const Jl=Kl;class Ql extends Do{static key="paragraphStyle";static className="";constructor(t,e){super(t),this.title=this.lang.paragraphStyle,this.icon="paragraph_style";const i=function({lang:t},e){const i={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:""}},s=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=s.length;r<a;r++){if(t=s[r],"string"==typeof t){const e=i[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>",xt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(t,e.items);this.classList=i.querySelectorAll("li button"),this.menu.initDropdownTarget(Ql,i)}on(){const t=this.classList,e=this.format.getLine(this.selection.getNode());for(let i=0,s=t.length;i<s;i++)xt.utils.hasClass(e,t[i].getAttribute("data-command"))?xt.utils.addClass(t[i],"active"):xt.utils.removeClass(t[i],"active")}action(t){const e=t.getAttribute("data-command");let i=this.format.getLines();if(0===i.length&&(this.selection.getRangeAndAddLine(this.selection.getRange(),null),i=this.format.getLines(),0===i.length))return;const s=xt.utils.hasClass(t,"active")?xt.utils.removeClass:xt.utils.addClass;for(let t=0,n=i.length;t<n;t++)s(i[t],e);this.menu.dropdownOff(),this.history.push(!1)}}const tr=Ql;class er extends Do{static key="textStyle";static className="";constructor(t,e){super(t),this.title=this.lang.textStyle,this.icon="text_style";const i=function({lang:t},e){const i={code:{name:t.menu_code,class:"__se__t-code",tag:"code"},shadow:{name:t.menu_shadow,class:"__se__t-shadow",tag:"span"}},s=e||Object.keys(i);let n='<div class="se-list-inner"><ul class="se-list-basic">';for(let t,e,o,l,r,a,h=0,c=s.length;h<c;h++){if(t=s[h],l="",a="",r=[],"string"==typeof t){const e=i[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>",xt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(t,e.items);this.styleList=i.querySelectorAll("li button"),this.menu.initDropdownTarget(er,i)}on(){const t=this.styleList,e=this.selection.getNode();for(let i,s,n,o=0,l=t.length;o<l;o++){i=t[o],s=i.getAttribute("data-value").split(",");for(let t,o,l=0;l<s.length;l++){for(t=e,n=!1;t&&!this.format.isLine(t)&&!this.component.is(t);){if(t.nodeName.toLowerCase()===i.getAttribute("data-command").toLowerCase()&&(o=s[l],/^\./.test(o)?xt.utils.hasClass(t,o.replace(/^\./,"")):t.style[o])){n=!0;break}t=t.parentNode}if(!n)break}n?xt.utils.addClass(i,"active"):xt.utils.removeClass(i,"active")}}action(t){const e=t.firstElementChild,i=e.style.cssText.replace(/:.+(;|$)/g,",").split(",");i.pop();const s=e.classList;for(let t=0,e=s.length;t<e;t++)i.push("."+s[t]);const n=xt.utils.hasClass(t,"active")?null:e.cloneNode(!1),o=n?null:[e.nodeName];this.inline.apply(n,{stylesToModify:i,nodesToRemove:o,strictRemove:!0}),this.menu.dropdownOff()}}const ir=er;const sr=class extends Zo{static key="link";static className="se-icon-flip-rtl";#xs;constructor(t,e){super(t),this.title=this.lang.link,this.icon="link",e.textToDisplay=!0,e.title=!0;const i=function({lang:t,icons:e}){const i=`\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 xt.utils.createElement("DIV",{class:"se-modal-content"},i)}(t),s=function({lang:t,icons:e}){const i=`\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> </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 xt.utils.createElement("DIV",{class:"se-controller se-controller-link"},i)}(t),n="string"==typeof e.uploadUrl?e.uploadUrl:null;this.target=null,this.isUpdateState=!1,this.pluginOptions={...e,uploadUrl:n,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:kt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:kt.get(e.uploadSingleSizeLimit,0),acceptedFormats:"string"==typeof e.acceptedFormats?e.acceptedFormats.trim():null,enableFileUpload:!!n},this.anchor=new Oo(this,i,this.pluginOptions),this.modal=new No(this,i),this.controller=new as(this,s,{position:"bottom",disabled:!1}),this.#xs=this.controller.form.querySelector("a")}active(t){if(xt.check.isAnchor(t)&&!t.hasAttribute("data-se-non-link")){const e=this.#xs,i=t.getAttribute("href");return e.href=i,e.textContent=e.title=t.textContent,e.target=i?.startsWith("#")?t.target:"_blank",xt.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(xt.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=xt.query.getEdgeChild(this.controller.currentTarget,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!1),e=xt.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 xt.utils.removeItem(this.controller.currentTarget),this.controller.currentTarget=null,this.editor.focus(),this.history.push(!1)}controllerClose(){xt.utils.removeClass(this.controller.currentTarget,"on")}},{NO_EVENT:nr}=_t;class or extends Zo{static key="image";static className="";static component(t){const e=xt.check.isFigure(t)||/^span$/i.test(t.nodeName)&&xt.check.isComponentContainer(t)?t.firstElementChild:t;return/^IMG$/i.test(e?.nodeName)?e:xt.check.isAnchor(e)&&/^IMG$/i.test(e?.firstElementChild?.nodeName)?e?.firstElementChild:null}#ks;#Es;#Ss;#Ts;#Hs;#ii;#Ls;#Ms;#Ns;#As;#Bs;#Vs;#vi;#Is;#Os;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?kt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"auto",defaultHeight:e.defaultHeight?kt.is(e.defaultHeight)?e.defaultHeight+"px":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:kt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:kt.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?"image/*":e.acceptedFormats.trim()||"image/*",useFormatType:e.useFormatType??!0,defaultFormatType:["block","inline"].includes(e.defaultFormatType)?e.defaultFormatType:"block",keepFormatType:e.keepFormatType??!1,insertBehavior:e.insertBehavior};const i=this.pluginOptions.percentageOnlySize?"%":"px",s=function({lang:t,icons:e,plugins:i},s){const n=s.createFileInput?`\n\t\t<div class="se-modal-form">\n\t\t\t<label>${t.image_modal_file}</label>\n\t\t\t${No.CreateFileInput({icons:e,lang:t},s)}\n\t\t</div>`:"",o=s.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${i.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${xt.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=s.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"> </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/> ${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${xt.utils.createTooltipInner(t.revert)}\n\t\t\t</button>\n\t\t</div>`:"",r=s.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${xt.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${xt.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 style="border-bottom: 1px dashed #ccc;"></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" /> ${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=xt.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")}}(t,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=s.alignForm,o.some((t=>t.includes("align")))||(this.alignForm.style.display="none");const l=this.plugins.link?this.plugins.link.pluginOptions:{};this.anchor=new Oo(this,s.html,{...l,textToDisplay:!1,title:!0}),this.modal=new No(this,s.html),this.figure=new ws(this,o,{sizeUnit:i}),this.fileManager=new Bo(this,{query:"img",loadEventName:"onImageLoad",actionEventName:"onImageAction"}),this.fileModalWrapper=s.fileModalWrapper,this.imgInputFile=s.imgInputFile,this.imgUrlFile=s.imgUrlFile,this.focusElement=this.imgInputFile||this.imgUrlFile,this.altText=s.altText,this.captionCheckEl=s.captionCheckEl,this.captionEl=this.captionCheckEl?.parentElement,this.previewSrc=s.previewSrc,this.sizeUnit=i,this.as="block",this.proportion=null,this.inputX=null,this.inputY=null,this._base64RenderIndex=0,this.#ks=0,this.#Es=null,this.#Ss="",this.#Ts="none",this.#Hs="30%",this.#ii=null,this.#Ls=null,this.#Ms=null,this.#Ns=null,this.#As={w:0,h:0},this.#Bs="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.#Vs="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.#vi=this.pluginOptions.canResize,this.#Is=this.pluginOptions.percentageOnlySize,this.#Os=!this.#vi||!this.pluginOptions.showHeightInput||this.#Is,this.eventManager.addEvent(s.tabs,"click",this.#Rs.bind(this)),this.imgInputFile&&this.eventManager.addEvent(s.fileRemoveBtn,"click",this.#Fs.bind(this)),this.imgUrlFile&&this.eventManager.addEvent(this.imgUrlFile,"input",this.#zs.bind(this)),this.imgInputFile&&this.imgUrlFile&&this.eventManager.addEvent(this.imgInputFile,"change",this.#$s.bind(this));const r=s.galleryButton;if(r&&this.eventManager.addEvent(r,"click",this.#Ps.bind(this)),this.#vi){this.proportion=s.proportion,this.inputX=s.inputX,this.inputY=s.inputY,this.inputX.value=this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight;const t=this.#Ds.bind(this);this.eventManager.addEvent(this.inputX,"keyup",this.#qs.bind(this,"x")),this.eventManager.addEvent(this.inputY,"keyup",this.#qs.bind(this,"y")),this.eventManager.addEvent(this.inputX,"change",t),this.eventManager.addEvent(this.inputY,"change",t),this.eventManager.addEvent(this.proportion,"change",t),this.eventManager.addEvent(s.revertBtn,"click",this.#Ws.bind(this))}this.pluginOptions.useFormatType&&(this.as=this.pluginOptions.defaultFormatType,this.asBlock=s.asBlock,this.asInline=s.asInline,this.eventManager.addEvent([this.asBlock,this.asInline],"click",this.#Us.bind(this)))}open(){this.#ks=0,this.modal.open()}retainFormat(){return{query:"img",method:t=>{const e=ws.GetContainer(t);if(e&&e.container&&(e.cover||e.inlineCover))return;const{w:i,h:s}=this.#Zs(t,!0);this.#Gs(i,s)}}}onFilePasteAndDrop({file:t}){/^image/.test(t.type)&&(this.submitFile([t]),this.editor.focus())}modalOn(t){t?this.imgInputFile&&this.pluginOptions.allowMultiple&&this.imgInputFile.removeAttribute("multiple"):(this.#vi&&(this.inputX.value=this.#Bs="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.inputY.value=this.#Vs="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight),this.imgInputFile&&this.pluginOptions.allowMultiple&&this.imgInputFile.setAttribute("multiple","multiple")),this.anchor.on(t)}async modalAction(){return this.#Ts=this.modal.form.querySelector('input[name="suneditor_image_radio"]:checked').value,this.modal.isUpdate&&(this.#Ys(this.inputX?.value,this.inputY?.value),this.history.push(!1)),this.imgInputFile&&this.imgInputFile.files.length>0?await this.submitFile(this.imgInputFile.files):!!(this.imgUrlFile&&this.#Ss.length>0)&&await this.submitURL(this.#Ss)}modalInit(){No.OnChangeFile(this.fileModalWrapper,[]),this.imgInputFile&&(this.imgInputFile.value=""),this.imgUrlFile&&(this.#Ss=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.#ii=null,this.#As={w:0,h:0},this.#Rs("init"),this.#vi&&(this.inputX.value="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.inputY.value="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.proportion.checked=!0),this.pluginOptions.useFormatType&&this.#js("inline"===(this.pluginOptions.keepFormatType?this.as:this.pluginOptions.defaultFormatType)),this.anchor.init()}componentSelect(t){this.#Zs(t)}componentEdit(){this.modal.open()}async componentDestroy(t){const e=t||this.#ii,i=xt.query.getParentElement(e,ws.is)||e,s=i.previousElementSibling||i.nextElementSibling,n=i.parentNode;!1!==await this.triggerEvent("onImageDeleteBefore",{element:e,container:i,align:this.#Ts,alt:this.altText.value,url:this.#Ss})&&(xt.utils.removeItem(i),this.modalInit(),n!==this.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.editor.focusEdge(s),this.history.push(!1))}async submitFile(t){if(0===t.length)return!1;let e=0;const i=[],s=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,s>0&&o>s){const t="[SUNEDITOR.imageUpload.fail] Size of uploadable single file: "+s/1e3+"KB",e=await this.triggerEvent("onImageUploadError",{error:t,limitSize:s,uploadSize:o,file:n});return this.ui.alertOpen(e===nr?t:e||t,"error"),!1}i.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",i=await this.triggerEvent("onImageUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.ui.alertOpen(i===nr?t:i||t,"error"),!1}const l={files:i,...this.#Xs()},r=function(t,e,i){t(e=i||e,e.files)}.bind(this,this.#Ks.bind(this),l),a=await this.triggerEvent("onImageUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==nr||r(null)))}async submitURL(t){if(!(t||=this.#Ss))return!1;const e={name:t.split("/").pop(),size:0},i={url:t,files:e,...this.#Xs()},s=function(t,e,i){t(e=i||e)}.bind(this,this.#Js.bind(this),i),n=await this.triggerEvent("onImageUploadBefore",{info:i,handler:s});return void 0===n||!1!==n&&(null!==n&&"object"==typeof n&&s(n),!0!==n&&n!==nr||s(null),!0)}create(t,e,i,s,n,o,l,r){const a=xt.utils.createElement("IMG");a.src=t,a.alt=l,e=this.#Qs(a,e?e.cloneNode(!1):null);const h=ws.CreateContainer(e,"se-image-container"),c=h.cover,d=h.container;this.captionCheckEl.checked&&(this.#Ns=ws.CreateCaption(c,this.lang.caption)),this.#ii=a,this.#Ls=c,this.#Ms=d,this.figure.open(a,{nonResizing:this.#Os,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0}),this.#tn(i,s),this.figure.setAlign(a,n),this.fileManager.setFileData(a,o),this.#ks++,a.onload=this.#en.bind(this,a,this.#Hs,d),this.component.insert(d,{scrollTo:!!r,insertBehavior:r?null:"line"})}createInline(t,e,i,s,n,o,l){const r=xt.utils.createElement("IMG");r.src=t,r.alt=o,e=this.#Qs(r,e?e.cloneNode(!1):null);const a=ws.CreateInlineContainer(e,"se-image-container").container;this.#ii=r,this.#Ms=a,this.figure.open(r,{nonResizing:this.#Os,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0}),this.#tn(i,s),this.fileManager.setFileData(r,n),this.#ks++,r.onload=this.#en.bind(this,r,this.#Hs,a),this.component.insert(a,{scrollTo:!!l,insertBehavior:l?null:"line"})}#Zs(t,e=!1){if(!t)return;const i=this.figure.open(t,{nonResizing:this.#Os,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:e});this.anchor.set(xt.check.isAnchor(t.parentNode)?t.parentNode:null),this.#Es=this.anchor.currentTarget,this.#ii=t,this.#Ls=i.cover,this.#Ms=i.container,this.#Ns=i.caption,this.#Ts=i.align,t.style.float="",this.#Bs=String(i.originWidth||i.w||""),this.#Vs=String(i.originHeight||i.h||""),this.altText.value=this.#ii.alt,this.imgUrlFile&&(this.#Ss=this.previewSrc.textContent=this.imgUrlFile.value=this.#ii.src);(this.modal.form.querySelector('input[name="suneditor_image_radio"][value="'+this.#Ts+'"]')||this.modal.form.querySelector('input[name="suneditor_image_radio"][value="none"]')).checked=!0,this.captionCheckEl.checked=!!this.#Ns;const{dw:s,dh:n}=this.figure.getSize(t);if(!this.#vi)return{w:s,h:n};this.inputX.value="auto"===s?"":s,this.inputY.value="auto"===n?"":n;const o=this.#Is&&this.figure.isVertical;return this.proportion.checked=!0,this.inputX.disabled=!!o,this.inputY.disabled=!!o,this.proportion.disabled=!!o,this.#As=this.proportion.checked?i.ratio:{w:0,h:0},this.pluginOptions.useFormatType&&this.#js(this.component.isInline(i.container)),{w:s,h:n}}#Xs(){return{element:this.#ii,anchor:this.anchor.create(!0),inputWidth:this.inputX?.value||"",inputHeight:this.inputY?.value||"",align:this.#Ts,isUpdate:this.modal.isUpdate,alt:this.altText.value}}#js(t){t?(xt.utils.addClass(this.asInline,"on"),xt.utils.removeClass(this.asBlock,"on"),this.as="inline",this.alignForm&&(this.alignForm.style.display="none"),this.captionEl&&(this.captionEl.style.display="none")):(xt.utils.addClass(this.asBlock,"on"),xt.utils.removeClass(this.asInline,"on"),this.as="block",this.alignForm&&(this.alignForm.style.display=""),this.captionEl&&(this.captionEl.style.display=""))}#Ys(t,e){t||=this.inputX?.value||"auto",e||=this.inputY?.value||"auto";let i=this.#ii;("block"===this.as&&!this.#Ls||"inline"===this.as&&this.#Ls)&&(i=this.figure.convertAsFormat(i,this.as));const s=this.#Ls,n=this.#Ms===this.#Ls?null:this.#Ms;let o;const l=kt.is(t)?t+this.sizeUnit:t,r=kt.is(e)?e+this.sizeUnit:e;o=/%$/.test(i.style.width)?l!==n.style.width||r!==n.style.height:l!==i.style.width||r!==i.style.height,i.alt=this.altText.value;let a=!1;this.captionCheckEl.checked?this.#Ns||(this.#Ns=ws.CreateCaption(s,this.lang.caption),a=!0):this.#Ns&&(xt.utils.removeItem(this.#Ns),this.#Ns=null,a=!0);let h=!1;const c=this.anchor.create(!0);if(c)this.#Es===c&&n.contains(c)||(this.#Es=c.cloneNode(!1),s.insertBefore(this.#Qs(i,this.#Es),this.#Ns),h=!0);else if(null!==this.#Es&&s.contains(this.#Es)){const t=i.cloneNode(!0);s.removeChild(this.#Es),s.insertBefore(t,this.#Ns),i=t}h&&xt.utils.removeItem(c),this.#vi&&o&&this.#tn(t,e),(a||!this.#Is&&o)&&(/\d+/.test(i.style.height)||this.figure.isVertical&&this.captionCheckEl.checked)&&(/auto|%$/.test(t)||/auto|%$/.test(e)?this.figure.deleteTransform(i):this.#vi&&o&&this.figure.isVertical||this.figure.setTransform(i,t,e,0)),this.figure.setAlign(i,this.#Ts),i.onload=()=>{this.componentSelect(i)}}#Gs(t,e){t||=this.inputX?.value||"auto",e||=this.inputY?.value||"auto";let i=this.#ii,s=this.#Ls,n=null,o=this.#Ms===this.#Ls?null:this.#Ms,l=!1;if(!s||!o){l=!0,i=this.#ii.cloneNode(!0);const e=this.pluginOptions.useFormatType&&"auto"!==t&&(/^span$/i.test(this.#ii.parentElement?.nodeName)||this.format.isLine(this.#ii.parentElement))?ws.CreateInlineContainer(i,"se-image-container"):ws.CreateContainer(i,"se-image-container");s=e.cover,o=e.container,n=e.inlineCover,this.figure.open(i,{nonResizing:!0,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0})}i.alt=this.altText.value;let r=!1;n||(this.captionCheckEl.checked?this.#Ns&&!l||(this.#Ns=ws.CreateCaption(s,this.lang.caption),r=!0):this.#Ns&&(xt.utils.removeItem(this.#Ns),this.#Ns=null,r=!0));let a=null;const h=this.anchor.create(!0);if(h)(this.#Es!==h||l&&!o.contains(h))&&(this.#Es=h.cloneNode(!1),s.insertBefore(this.#Qs(i,this.#Es),this.#Ns),a=this.#ii);else if(null!==this.#Es&&s.contains(this.#Es)){const t=i.cloneNode(!0);s.removeChild(this.#Es),s.insertBefore(t,this.#Ns),i=t}l&&(i=this.#ii,this.figure.retainFigureFormat(o,this.#ii,a?h:null,this.fileManager),this.#ii=i=o.querySelector("img"),this.#Ls=s,this.#Ms=o),i.style.width="",i.style.height="",i.removeAttribute("width"),i.removeAttribute("height"),this.#tn(t,e),a&&(l?(xt.utils.removeItem(a),0===xt.query.getListChildren(h,(t=>/IMG/i.test(t.tagName)),null).length&&xt.utils.removeItem(h)):xt.utils.removeItem(h)),!r&&this.#Is||(/\d+/.test(i.style.height)||this.figure.isVertical&&this.captionCheckEl.checked)&&(/auto|%$/.test(t)||/auto|%$/.test(e)?this.figure.deleteTransform(i):this.figure.setTransform(i,t,e,0)),this.figure.setAlign(i,this.#Ts)}#in(t,e,i,s,n,o,l,r){"inline"!==this.as?this.create(t,e,i,s,n,o,l,r):this.createInline(t,e,i,s,o,l,r)}#tn(t,e){t||=this.inputX?.value||this.pluginOptions.defaultWidth,e||=this.inputY?.value||this.pluginOptions.defaultHeight,this.#Is&&(t?/%$/.test(t)&&(t+="%"):t="100%"),this.figure.setSize(t,e)}#sn(t,e,i){e.src=t,this.fileManager.setFileData(e,i),this.component.select(e,or.key)}#Ke(t,e){this.#ks=0;const i=e.result;for(let e,s=0,n=i.length;s<n;s++){if(e={name:i[s].name,size:i[s].size},t.isUpdate){this.#sn(i[s].url,t.element,e);break}this.#in(i[s].url,t.anchor,t.inputWidth,t.inputHeight,t.align,e,t.alt,s===n-1)}}#Ks(t,e){if(!e)return;const i=this.pluginOptions.uploadUrl;"string"==typeof i&&i.length>0?this.fileManager.upload(i,this.pluginOptions.uploadHeaders,e,this.#nn.bind(this,t),this.#Je.bind(this)):this.#on(e,t.anchor,t.inputWidth,t.inputHeight,t.align,t.alt,t.isUpdate)}#Js(t){this.#ks=0;const e=t.url;this.modal.isUpdate?this.#sn(e,t.element,t.files):this.#in(e,t.anchor,t.inputWidth,t.inputHeight,t.align,t.files,t.alt,!0)}#on(t,e,i,s,n,o,l){try{const r=this.modal.isUpdate?1:t.length;if(0===r)return this.ui.hideLoading(),void console.warn("[SUNEDITOR.image.base64.fail] cause : No applicable files");this._base64RenderIndex=r;const a=new Array(r);this.#vi&&(this.inputX.value=i,this.inputY.value=s);for(let h,c,d=0,u=this.#ln.bind(this);d<r;d++)h=new FileReader,c=t[d],h.onload=function(t,l,r,h,c,d){a[d]={result:l.result,file:c},0==--this._base64RenderIndex&&(t(r,a,h,e,i,s,n,o),this.ui.hideLoading())}.bind(this,u,h,l,this.#ii,c,d),h.readAsDataURL(c)}catch(t){throw this.ui.hideLoading(),Error(`[SUNEDITOR.plugins.image._setBase64.fail] ${t.message}`)}}#ln(t,e,i,s,n,o,l,r){this.#ks=0;for(let a=0,h=e.length;a<h;a++)t?this.#sn(e[a].result,i,e[a].file):this.#in(e[a].result,s,n,o,l,e[a].file,r,a===h-1)}#Qs(t,e){return e?(e.appendChild(t),e):t}async#Je(t){const e=await this.triggerEvent("onImageUploadError",{error:t}),i=e===nr?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.image.error]",i)}async#nn(t,e){if(await this.triggerEvent("imageUploadHandler",{xmlHttp:e,info:t})===nr){const i=JSON.parse(e.responseText);i.errorMessage?this.#Je(i):this.#Ke(t,i)}}#Rs(t){const e=this.modal.form,i="string"==typeof t?e.querySelector("._se_tab_link"):xt.query.getEventTarget(t);if(!/^BUTTON$/i.test(i.tagName))return!1;const s=i.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++)xt.utils.removeClass(l[n],"active");return e.querySelector("._se_tab_content_"+s).style.display="block",xt.utils.addClass(i,"active"),"init"!==t&&("image"===s?this.focusElement.focus():"url"===s&&this.anchor.urlInput.focus()),!1}#Fs(){this.imgInputFile.value="",this.imgUrlFile&&(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),No.OnChangeFile(this.fileModalWrapper,[])}#qs(t,e){if(Et.isSpace(e.code))e.preventDefault();else if("x"===t&&this.#Is&&e.target.value>100)e.target.value=100;else if(this.proportion.checked){const e=ws.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this.#As);"x"===t?this.inputY.value=String(e.h):this.inputX.value=String(e.w)}}#Ds(){this.#As=this.proportion.checked?ws.GetRatio(this.inputX.value,this.inputY.value,this.sizeUnit):{w:0,h:0}}#Ws(){this.#Is?this.inputX.value=Number(this.#Bs)>100?"100":this.#Bs:(this.inputX.value=this.#Bs,this.inputY.value=this.#Vs)}#Us({target:t}){this.#js("asInline"===t.getAttribute("data-command"))}#zs(t){const e=t.target.value.trim();this.#Ss=this.previewSrc.textContent=e?this.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#$s({target:t}){this.imgInputFile.value?(this.imgUrlFile.disabled=!0,this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),No.OnChangeFile(this.fileModalWrapper,t.files)}#Ps(){this.plugins.imageGallery.open(this.#rn.bind(this))}#rn(t){this.altText.value=t.getAttribute("data-value")||t.alt,this.#Ss=this.previewSrc.textContent=this.imgUrlFile.value=t.getAttribute("data-command")||t.src,this.imgUrlFile.focus()}#en(t,e,i){this.#ks--,delete t.onload,0===t.offsetWidth&&this.#tn(e,""),0===this.#ks&&(this.component.applyInsertBehavior(i,null,this.pluginOptions.insertBehavior||this.options.get("componentInsertBehavior")),this.editor._iframeAutoHeight(this.frameContext),this.history.push(!1))}}const lr=or,{_w:rr,NO_EVENT:ar}=_t;class hr extends Zo{static key="video";static className="";static component(t){return/^(VIDEO)$/i.test(t?.nodeName)||/^(IFRAME)$/i.test(t?.nodeName)&&this.checkContentType(t.src)?t:null}#Ss;#Ts;#an;#hn;#cn;#dn;#ii;#Ms;#As;#Bs;#Vs;#vi;#Is;#Os;#un;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&&kt.get(e.defaultWidth,0)?kt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight&&kt.get(e.defaultHeight,0)?kt.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:kt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:kt.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?"video/*":e.acceptedFormats.trim()||"video/*",defaultRatio:kt.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 i=this.pluginOptions.percentageOnlySize?"%":"px",s=function({lang:t,icons:e,plugins:i},s){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">`;s.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${No.CreateFileInput({lang:t,icons:e},s)}\n\t\t\t</div>`);s.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${i.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${xt.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>`);if(s.canResize){const i=s.ratioOptions||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285},{name:"9:16",value:1.78}],o=s.defaultRatio,l=s.percentageOnlySize,r=l?' style="display: none !important;"':"",a=s.showHeightInput?"":' style="display: none !important;"',h=s.showRatioOption?"":' style="display: none !important;"',c=l||s.showHeightInput||s.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"> </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*s.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${i.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" /> \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=xt.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")}}(t,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")))||(s.alignForm.style.display="none");const o=100*this.pluginOptions.defaultRatio+"%";this.modal=new No(this,s.html),this.figure=new ws(this,n,{sizeUnit:i,autoRatio:{current:o,default:o}}),this.fileManager=new Bo(this,{query:"iframe, video",loadEventName:"onVideoLoad",actionEventName:"onVideoAction"}),this.fileModalWrapper=s.fileModalWrapper,this.videoInputFile=s.videoInputFile,this.videoUrlFile=s.videoUrlFile,this.focusElement=this.videoUrlFile||this.videoInputFile,this.previewSrc=s.previewSrc,this.sizeUnit=i,this.proportion=null,this.frameRatioOption=null,this.inputX=null,this.inputY=null,this.#Ss="",this.#Ts="none",this.#an=o,this.#hn=o,this.#cn="100%",this.#dn=100*this.pluginOptions.defaultRatio+"%",this.#ii=null,this.#Ms=null,this.#As={w:0,h:0},this.#Bs="100%"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.#Vs=this.pluginOptions.defaultHeight===o?"":this.pluginOptions.defaultHeight,this.#vi=this.pluginOptions.canResize,this.#Is=this.pluginOptions.percentageOnlySize,this.#Os=!this.#vi||!this.pluginOptions.showHeightInput||this.#Is,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);this.extensions=[".mp4",".avi",".mov",".webm",".flv",".mkv",".m4v",".ogv"].concat(this.pluginOptions.extensions||[]),this.urlPatterns=l.concat([/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\//]).concat(e.urlPatterns||[]);const r=s.galleryButton;if(r&&this.eventManager.addEvent(r,"click",this.#Ps.bind(this)),this.videoInputFile&&this.eventManager.addEvent(s.fileRemoveBtn,"click",this.#Fs.bind(this)),this.videoUrlFile&&this.eventManager.addEvent(this.videoUrlFile,"input",this.#zs.bind(this)),this.videoInputFile&&this.videoUrlFile&&this.eventManager.addEvent(this.videoInputFile,"change",this.#$s.bind(this)),this.#vi){this.#un=null,this.proportion=s.proportion,this.frameRatioOption=s.frameRatioOption,this.inputX=s.inputX,this.inputY=s.inputY,this.inputX.value=this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight;const t=this.#Ds.bind(this);this.eventManager.addEvent(this.inputX,"keyup",this.#qs.bind(this,"x")),this.eventManager.addEvent(this.inputY,"keyup",this.#qs.bind(this,"y")),this.eventManager.addEvent(this.inputX,"change",t),this.eventManager.addEvent(this.inputY,"change",t),this.eventManager.addEvent(this.proportion,"change",t),this.eventManager.addEvent(this.frameRatioOption,"change",this.#pn.bind(this)),this.eventManager.addEvent(s.revertBtn,"click",this.#Ws.bind(this))}}open(){this.modal.open()}retainFormat(){return{query:"iframe, video",method:async t=>{if(/^(iframe)$/i.test(t?.nodeName)&&!this.checkContentType(t.src))return;const e=ws.GetContainer(t);if(e&&e.container&&e.cover)return;this.#Zs(t,!0);const i=this.format.getLine(t);i&&(this.#Ts=i.style.textAlign||i.style.float),this.#Ys(t)}}}onFilePasteAndDrop({file:t}){/^video/.test(t.type)&&(this.submitFile([t]),this.editor.focus())}modalOn(t){t?this.videoInputFile&&this.pluginOptions.allowMultiple&&this.videoInputFile.removeAttribute("multiple"):(this.#vi&&(this.inputX.value=this.#Bs=this.pluginOptions.defaultWidth===this.#cn?"":this.pluginOptions.defaultWidth,this.inputY.value=this.#Vs=this.pluginOptions.defaultHeight===this.#dn?"":this.pluginOptions.defaultHeight,this.proportion.disabled=!0),this.videoInputFile&&this.pluginOptions.allowMultiple&&this.videoInputFile.setAttribute("multiple","multiple")),this.#vi&&(this.#gn(this.figure.isVertical?"":this.#Vs||this.#hn),this.#un=this.frameRatioOption?.value)}async modalAction(){this.#Ts=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.#Ss.length>0&&(t=await this.submitURL(this.#Ss)),t&&rr.setTimeout(this.component.select.bind(this.component,this.#ii,hr.key),0),t}modalInit(){No.OnChangeFile(this.fileModalWrapper,[]),this.videoInputFile&&(this.videoInputFile.value=""),this.videoUrlFile&&(this.#Ss=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.#As={w:0,h:0},this.#Os=!1,this.#vi&&(this.inputX.value=this.pluginOptions.defaultWidth===this.#cn?"":this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight===this.#dn?"":this.pluginOptions.defaultHeight,this.proportion.checked=!1,this.proportion.disabled=!0,this.#gn(this.#hn))}componentSelect(t){this.#Zs(t)}componentEdit(){this.modal.open()}async componentDestroy(t){const e=t||this.#ii,i=xt.query.getParentElement(e,ws.is)||e,s=i.previousElementSibling||i.nextElementSibling,n=i.parentNode;!1!==await this.triggerEvent("onVideoDeleteBefore",{element:e,container:i,align:this.#Ts,url:this.#Ss})&&(xt.utils.removeItem(i),this.modalInit(),n!==this.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.editor.focusEdge(s),this.history.push(!1))}checkContentType(t){return t=t?.toLowerCase()||"",!(!this.extensions.some((e=>t.endsWith(e)))&&!this.urlPatterns.some((e=>e.test(t))))}findProcessUrl(t){const e=this.query;for(const i in e){const s=e[i];if(s.pattern.test(t))return{origin:t,url:s.action(t),tag:s.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 i=t.split("?");t=i[0]+"?"+e+"&"+i[1]}else t+="?"+e;return t}create(t,e,i,s,n,o,l,r){let a=null;if(o){if((t=this.#ii).src!==e){const i=this.findProcessUrl(e);if(/^iframe$/i.test(i?.tag)&&!/^iframe$/i.test(t.nodeName)){const i=this.createIframeTag();i.src=e,t.replaceWith(i),this.#ii=t=i}else if(/^video$/i.test(i?.tag)&&!/^video$/i.test(t.nodeName)){const i=this.createVideoTag();i.src=e,t.replaceWith(i),this.#ii=t=i}else t.src=e}a=this.#Ms}else{t.src=e,this.#ii=t;a=ws.CreateContainer(t,"se-video-container").container}this.#ii=t,this.#Ms=a,this.figure.open(t,{nonResizing:this.#Os,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0}),i||=this.#cn,s||=this.#an;const h=this.figure.getSize(t),c=h.w!==i||h.h!==s,d=!o||c;d&&(this.#un!==this.frameRatioOption?.value&&this.figure.deleteTransform(),this.#tn(i,s)),this.figure.setAlign(t,n),this.fileManager.setFileData(t,l),o?(this.#vi&&d&&this.figure.isVertical||this.figure.setTransform(t,i,s,0),this.history.push(!1)):this.component.insert(a,{scrollTo:!!r,insertBehavior:r?this.pluginOptions.insertBehavior:"line"})}createIframeTag(t){const e=xt.utils.createElement("IFRAME");if(t)for(const i in t)e[i]=t[i];return this.#mn(e),e}createVideoTag(t){const e=xt.utils.createElement("VIDEO");if(t)for(const i in t)e[i]=t[i];return this.#fn(e),e}async submitFile(t){if(0===t.length)return;let e=0;const i=[],s=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,s>0&&o>s){const t="[SUNEDITOR.videoUpload.fail] Size of uploadable single file: "+s/1e3+"KB",e=await this.triggerEvent("onVideoUploadError",{error:t,limitSize:s,uploadSize:o,file:n});return this.ui.alertOpen(e===ar?t:e||t,"error"),!1}i.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",i=await this.triggerEvent("onVideoUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.ui.alertOpen(i===ar?t:i||t,"error"),!1}const l={url:null,files:i,...this.#Xs()},r=function(t,e,i){t(e=i||e,e.files)}.bind(this,this.#Ks.bind(this),l),a=await this.triggerEvent("onVideoUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==ar||r(null)))}async submitURL(t){if(!(t=this.#Ss))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 i={name:t.split("/").pop(),size:0},s={url:t,files:i,...this.#Xs(),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,s),o=await this.triggerEvent("onVideoUploadBefore",{info:s,handler:n});return void 0===o||!1!==o&&(null!==o&&"object"==typeof o&&n(o),!0!==o&&o!==ar||n(null),!0)}#Zs(t,e=!1){if(!t)return;const i=this.figure.open(t,{nonResizing:this.#Os,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:e});this.#ii=t,this.#Ms=i.container,this.#Ts=i.align,t.style.float="",this.#Bs=String(i.width||i.originWidth||i.w||""),this.#Vs=String(i.height||i.originHeight||i.h||"");const s=i.height||i.h||this.#Vs||"";this.videoUrlFile&&(this.#Ss=this.previewSrc.textContent=this.videoUrlFile.value=this.#ii.src||this.#ii.querySelector("source")?.src||"");if((this.modal.form.querySelector('input[name="suneditor_video_radio"][value="'+this.#Ts+'"]')||this.modal.form.querySelector('input[name="suneditor_video_radio"][value="none"]')).checked=!0,!this.#vi)return;const n=this.#Is&&this.figure.isVertical,{dw:o,dh:l}=this.figure.getSize(t);this.inputX.value="auto"===o?"":o,this.inputY.value="auto"===l?"":l,this.#gn(s)||(this.inputY.value=String(this.#Is?kt.get(s,2):s)),this.proportion.checked=!0,this.inputX.disabled=!!n,this.inputY.disabled=!!n,this.proportion.disabled=!!n,i.isVertical&&(this.proportion.checked=!1),this.#As=this.proportion.checked?i.ratio:{w:0,h:0}}#tn(t,e){t||=this.inputX?.value||this.pluginOptions.defaultWidth,e||=this.inputY?.value||this.pluginOptions.defaultHeight,this.#Is&&(t?/%$/.test(t+"")&&(t+="%"):t="100%"),this.figure.setSize(t,e)}#Xs(){return{inputWidth:this.inputX?.value||"",inputHeight:this.inputY?.value||"",align:this.#Ts,isUpdate:this.modal.isUpdate,element:this.#ii}}#Ys(t){if(!t)return;/^video$/i.test(t.nodeName)?this.#fn(t):/^iframe$/i.test(t.nodeName)&&this.#mn(t);const e=t,i=t.cloneNode(!0),s=ws.CreateContainer(i,"se-video-container"),n=s.container,o=ws.GetContainer(e)?.container?.querySelector("figcaption");let l=null;o&&(l=xt.utils.createElement("figcaption"),l.innerHTML=o.innerHTML,xt.utils.removeItem(o),s.cover.appendChild(l)),this.figure.open(i,{nonResizing:this.#Os,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0});const r=(i.getAttribute("data-se-size")||",").split(","),a=r[0]||e.width||"",h=r[1]||e.height||this.#hn||"";this.#tn(a,h);const c=this.format.getLine(e);return c&&(this.#Ts=c.style.textAlign||c.style.float),this.figure.setAlign(i,this.#Ts),this.figure.retainFigureFormat(n,this.#ii,null,this.fileManager),i}#Ke(t,e){const i=e.result,s=this.createVideoTag();for(let e=0,n=i.length;e<n;e++){const o=t.isUpdate?t.element:s.cloneNode(!1);this.create(o,i[e].url,t.inputWidth,t.inputHeight,t.align,t.isUpdate,{name:i[e].name,size:i[e].size},e===n-1)}}#Ks(t,e){if(!e)return;const i=this.pluginOptions.uploadUrl;"string"==typeof i&&i.length>0&&this.fileManager.upload(i,this.pluginOptions.uploadHeaders,e,this.#nn.bind(this,t),this.#Je.bind(this))}#fn(t){t.setAttribute("controls","true");const e=this.pluginOptions.videoTagAttributes;if(e)for(const i in e)t.setAttribute(i,e[i])}#mn(t){t.frameBorder="0",t.allowFullscreen=!0;const e=this.pluginOptions.iframeTagAttributes;if(e)for(const i in e)t.setAttribute(i,e[i])}#gn(t){if(!this.frameRatioOption)return;let e=!1;const i=this.frameRatioOption.options;/%$/.test(t+"")||this.#Is?t=kt.get(t,2)/100+"":(!kt.is(t)||Number(t)>=1)&&(t=""),this.inputY.placeholder="";for(let s=0,n=i.length;s<n;s++)i[s].value===t?(e=i[s].selected=!0,this.inputY.placeholder=t?100*Number(t)+"%":""):i[s].selected=!1;return e}async#Je(t){const e=await this.triggerEvent("onVideoUploadError",{error:t}),i=e===ar?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.video.error]",e)}async#nn(t,e){if(await this.triggerEvent("videoUploadHandler",{xmlHttp:e,info:t})===ar){const i=JSON.parse(e.responseText);i.errorMessage?this.#Je(i):this.#Ke(t,i)}}#Fs(){this.videoInputFile.value="",this.videoUrlFile&&(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),No.OnChangeFile(this.fileModalWrapper,[])}#zs(t){const e=xt.query.getEventTarget(t).value.trim();/^<iframe.*\/iframe>$/.test(e)?(this.#Ss=e,this.previewSrc.textContent='<IFrame :src=".."></IFrame>'):this.#Ss=this.previewSrc.textContent=e?this.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#Ps(){this.plugins.videoGallery.open(this.#rn.bind(this))}#rn(t){this.#Ss=this.previewSrc.textContent=this.videoUrlFile.value=t.getAttribute("data-command")||t.src,this.videoUrlFile.focus()}#$s(t){this.videoInputFile.value?(this.videoUrlFile.disabled=!0,this.previewSrc.style.textDecoration="line-through"):(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration="");const e=xt.query.getEventTarget(t);No.OnChangeFile(this.fileModalWrapper,e.files)}#Ws(){this.#Is?this.inputX.value=Number(this.#Bs)>100?"100":this.#Bs:(this.inputX.value=this.#Bs,this.inputY.value=this.#Vs)}#pn(t){const e=xt.query.getEventTarget(t),i=e.options[e.selectedIndex].value;this.#dn=this.figure.autoRatio.current=this.#an=i?100*Number(i)+"%":this.#dn,this.inputY.placeholder=i?100*Number(i)+"%":"",this.inputY.value=""}#Ds(){this.#As=this.proportion.checked?ws.GetRatio(this.inputX.value,this.inputY.value,this.sizeUnit):{w:0,h:0}}#qs(t,e){if(Et.isSpace(e.code))return void e.preventDefault();const i=xt.query.getEventTarget(e);if("x"===t&&this.#Is&&Number(i.value)>100)i.value="100";else if(this.proportion.checked&&!this.frameRatioOption?.value){const e=ws.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this.#As);"x"===t?this.inputY.value=String(e.h):this.inputX.value=String(e.w)}"y"===t&&this.#gn(i.value||this.#hn)}}const cr=hr,{NO_EVENT:dr,ON_OVER_COMPONENT:ur}=_t;class pr extends Zo{static key="audio";static className="";static component(t){return/^AUDIO$/i.test(t?.nodeName)?t:null}#ii;#bn;#yn;#vn;constructor(t,e){super(t),this.title=this.lang.audio,this.icon="audio",this.pluginOptions={defaultWidth:e.defaultWidth?kt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight?kt.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:kt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:kt.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 i=function({lang:t,icons:e,plugins:i},s){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">`;s.createFileInput&&(n+=`\n <div class="se-modal-form">\n <label>${t.audio_modal_file}</label>\n ${No.CreateFileInput({lang:t,icons:e},s)}\n </div>`);s.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${i.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${xt.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>`,xt.utils.createElement("DIV",{class:"se-modal-content"},n)}(t,this.pluginOptions),s=function({lang:t,icons:e}){const i=`\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 xt.utils.createElement("DIV",{class:"se-controller"},i)}(t);this.modal=new No(this,i),this.controller=new as(this,s,{position:"bottom",disabled:!0}),this.fileManager=new Bo(this,{query:"audio",loadEventName:"onAudioLoad",actionEventName:"onAudioAction"}),this.figure=new ws(this,null,{}),this.fileModalWrapper=i.querySelector(".se-flex-input-wrapper"),this.audioInputFile=i.querySelector(".__se__file_input"),this.audioUrlFile=i.querySelector(".se-input-url"),this.preview=i.querySelector(".se-link-preview"),this.#ii=null,this.#bn=this.pluginOptions.defaultWidth,this.#yn=this.pluginOptions.defaultHeight,this.#vn="";const n=i.querySelector(".__se__gallery");n&&this.eventManager.addEvent(n,"click",this.#Ps.bind(this)),this.audioInputFile&&(this.eventManager.addEvent(i.querySelector(".se-modal-files-edge-button"),"click",this.#Fs.bind(this,this.audioUrlFile,this.preview)),this.audioUrlFile&&this.eventManager.addEvent(this.audioInputFile,"change",this.#_n.bind(this))),this.audioUrlFile&&this.eventManager.addEvent(this.audioUrlFile,"input",this.#zs.bind(this))}open(){this.modal.open()}retainFormat(){return{query:"audio",method:t=>{const e=ws.GetContainer(t);if(e&&e.container&&e.cover)return;this.#fn(t);const i=ws.CreateContainer(t.cloneNode(!0),"se-flex-component");this.figure.retainFigureFormat(i.container,t,null,this.fileManager)}}}onFilePasteAndDrop({file:t}){/^audio/.test(t.type)&&(this.submitFile([t]),this.editor.focus())}modalOn(t){t?this.#ii?(this.#vn=this.preview.textContent=this.audioUrlFile.value=this.#ii.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.#vn.length>0)&&await this.submitURL(this.#vn)}modalInit(){No.OnChangeFile(this.fileModalWrapper,[]),this.audioInputFile&&(this.audioInputFile.value=""),this.audioUrlFile&&(this.#vn=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.#vn=this.preview.textContent=this.audioUrlFile.value=this.#ii.src),this.open();break;case"copy":{const t=ws.GetContainer(this.#ii);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.#Zs(t)}async componentDestroy(t){const e=t||this.#ii,i=ws.GetContainer(e),s=i.container||e,n=s.previousElementSibling||s.nextElementSibling;if(!1===await this.triggerEvent("onAudioDeleteBefore",{element:e,container:i,url:e.getAttribute("src")}))return;const o=s.parentNode;xt.utils.removeItem(s),this.modalInit(),this.controller.close(),o!==this.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(o,(function(t){return 0===t.childNodes.length}),null),this.editor.focusEdge(n),this.history.push(!1)}async submitFile(t){if(0===t.length)return!1;let e=0;const i=[],s=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,s>0&&o>s){const t="[SUNEDITOR.audioUpload.fail] Size of uploadable single file: "+s/1e3+"KB",e=await this.triggerEvent("onAudioUploadError",{error:t,limitSize:s,uploadSize:o,file:n});return this.ui.alertOpen(e===dr?t:e||t,"error"),!1}i.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",i=await this.triggerEvent("onAudioUploadError",{error:t,limitSize:n,currentSize:this.fileManager.getSize(),uploadSize:e});return this.ui.alertOpen(i===dr?t:i||t,"error"),!1}const o={files:i,isUpdate:this.modal.isUpdate,element:this.#ii},l=function(t,e,i){t(i=e||i,i.files)}.bind(this,this.#Ks.bind(this),o),r=await this.triggerEvent("onAudioUploadBefore",{info:o,handler:l});return void 0===r||!!r&&(null!==r&&"object"==typeof r&&l(r),!0!==r&&r!==dr||l(null),!0)}async submitURL(t){if(0===t.length)return!1;const e={name:t.split("/").pop(),size:0},i={url:t,files:e,isUpdate:this.modal.isUpdate,element:this.#Cn()},s=function(t,e,i){t((i=e||i).element,i.url,i.files,i.isUpdate,!0)}.bind(this,this.create.bind(this),i),n=await this.triggerEvent("onAudioUploadBefore",{info:i,handler:s});return void 0===n||!!n&&(null!==n&&"object"==typeof n&&s(n),!0!==n&&n!==dr||s(null),!0)}create(t,e,i,s,n){if(s){if(this.#ii&&(t=this.#ii),this.fileManager.setFileData(t,i),!t||t.src===e)return void this.component.select(t,pr.key);t.src=e,this.component.select(t,pr.key)}else{this.fileManager.setFileData(t,i),t.src=e;const s=ws.CreateContainer(t,"se-flex-component");if(!this.component.insert(s.container,{scrollTo:!!n,insertBehavior:n?this.pluginOptions.insertBehavior:"line"}))return void(n&&this.editor.focus());if(!this.options.get("componentInsertBehavior")){const t=this.format.addLine(s.container,null);t&&this.selection.setRange(t,0,t,0)}}s&&this.history.push(!1)}#Zs(t){he.get("__overInfo")!==ur&&(this.#ii=t,this.controller.open(t,null,{isWWTarget:!1,addOffset:null}))}#Ke(t,e){const i=e.result;for(let e,s,n=0,o=i.length;n<o;n++)s=t.isUpdate?t.element:this.#Cn(),e={name:i[n].name,size:i[n].size},this.create(s,i[n].url,e,t.isUpdate,n===o-1)}#Cn(){const t=this.#bn,e=this.#yn,i=xt.utils.createElement("AUDIO",{style:(t?"width:"+t+"; ":"")+(e?"height:"+e+";":"")});return this.#fn(i),i}#fn(t){t.setAttribute("controls","true");const e=this.pluginOptions.audioTagAttributes;if(e)for(const i in e)t.setAttribute(i,e[i])}#Ks(t,e){if(!e)return;const i=this.modal.isUpdate?[e[0]]:e;this.fileManager.upload(this.pluginOptions.uploadUrl,this.pluginOptions.uploadHeaders,i,this.#nn.bind(this,t),this.#Je.bind(this))}async#Je(t){const e=await this.triggerEvent("onAudioUploadError",{error:t}),i=e===dr?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.audio.error]",i)}async#nn(t,e){if(await this.triggerEvent("audioUploadHandler",{xmlHttp:e,info:t})===dr){const i=JSON.parse(e.responseText);i.errorMessage?this.#Je(i):this.#Ke(t,i)}}#zs(t){const e=xt.query.getEventTarget(t).value.trim();this.#vn=this.preview.textContent=e?this.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#Ps(){this.plugins.audioGallery.open(this.#rn.bind(this))}#rn(t){this.#vn=this.preview.textContent=this.audioUrlFile.value=t.getAttribute("data-command")||t.src,this.audioUrlFile.focus()}#Fs(t,e){this.audioInputFile.value="",t&&(t.disabled=!1,e.style.textDecoration=""),No.OnChangeFile(this.fileModalWrapper,[])}#_n(t){const e=xt.query.getEventTarget(t);this.audioInputFile.value?(this.audioUrlFile.disabled=!0,this.preview.style.textDecoration="line-through"):(this.audioUrlFile.disabled=!1,this.preview.style.textDecoration=""),No.OnChangeFile(this.fileModalWrapper,e.files)}}const gr=pr,{_w:mr,NO_EVENT:fr}=_t;class br extends Zo{static key="embed";static className="";static component(t){const e=t.children;let i="",s=null;if(xt.check.isIFrame(t)&&(s=t,i=t.src),!i&&/^DIV$/i.test(t?.nodeName)&&xt.check.isIFrame(e[0])&&(s=e[0],i=s.src),!i&&xt.utils.hasClass(t,"se-embed-container")){s=xt.query.getChildNode(t,(t=>t.src||t.href)),i=s?.src||s?.href}return i?this.checkContentType(i)?s:null:s}#Ss;#Ts;#cn;#dn;#ii;#Ls;#Ms;#As;#Bs;#Vs;#vi;#Is;#Os;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&&kt.get(e.defaultWidth,0)?kt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight&&kt.get(e.defaultHeight,0)?kt.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"",percentageOnlySize:!!e.percentageOnlySize,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:kt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:kt.get(e.uploadSingleSizeLimit,0),iframeTagAttributes:e.iframeTagAttributes||null,query_youtube:e.query_youtube||"",query_vimeo:e.query_vimeo||"",insertBehavior:e.insertBehavior};const i=this.pluginOptions.percentageOnlySize?"%":"px",s=function({lang:t,icons:e},i){let s=`\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(i.canResize){const n=i.percentageOnlySize,o=n?' style="display: none !important;"':"",l=i.showHeightInput?"":' style="display: none !important;"',r=i.showRatioOption?"":' style="display: none !important;"',a=n||i.showHeightInput||i.showRatioOption?"":' style="display: none !important;"';s+=`\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"> </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" /> \n\t\t\t\t\t<span>${t.proportion}</span>\n\t\t\t\t</label>\n\t\t\t</div>`}s+=`\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=xt.utils.createElement("DIV",{class:"se-modal-content"},s);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")}}(t,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")))||(s.figureAlignBtn.style.display="none"),this.modal=new No(this,s.html),this.figure=new ws(this,n,{sizeUnit:i}),this.fileModalWrapper=s.fileModalWrapper,this.embedInput=s.embedInput,this.focusElement=this.embedInput,this.previewSrc=s.previewSrc,this.sizeUnit=i,this.proportion=null,this.inputX=null,this.inputY=null,this.#Ss="",this.#Ts="none",this.#cn=this.pluginOptions.defaultWidth,this.#dn=this.pluginOptions.defaultHeight,this.#ii=null,this.#Ls=null,this.#Ms=null,this.#As={w:0,h:0},this.#Bs="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.#Vs="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.#vi=this.pluginOptions.canResize,this.#Is=this.pluginOptions.percentageOnlySize,this.#Os=!this.#vi||!this.pluginOptions.showHeightInput||this.#Is,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,i]=t.match(this.query.codepen.pattern);return`https://codepen.io/${e}/embed/${i}`},tag:"iframe"},...e.embedQuery};const o=[];for(const t in this.query)o.push(this.query[t].pattern);this.urlPatterns=o.concat(e.urlPatterns||[]),this.eventManager.addEvent(this.embedInput,"input",this.#zs.bind(this)),this.#vi&&(this.proportion=s.proportion,this.inputX=s.inputX,this.inputY=s.inputY,this.inputX.value=this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight,this.eventManager.addEvent(this.inputX,"keyup",this.#qs.bind(this,"x")),this.eventManager.addEvent(this.inputY,"keyup",this.#qs.bind(this,"y")),this.eventManager.addEvent(s.revertBtn,"click",this.#Ws.bind(this)))}open(){this.modal.open()}retainFormat(){return{query:"iframe",method:async t=>{if(!this.checkContentType(t.src))return;const e=ws.GetContainer(t);if(e&&e.container&&e.cover)return;this.#Zs(t,!0);const i=this.format.getLine(t);i&&(this.#Ts=i.style.textAlign||i.style.float),this.#Ys(t)}}}modalOn(t){!t&&this.#vi?(this.inputX.value=this.#Bs="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.inputY.value=this.#Vs="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.proportion.disabled=!0):t&&(this.#Ss=this.previewSrc.textContent=this.embedInput.value=this.#Ls.getAttribute("data-se-origin")||"")}async modalAction(){this.#Ts=this.modal.form.querySelector('input[name="suneditor_embed_radio"]:checked').value;let t=!1;return this.#Ss.length>0&&(t=await this.submitSRC(this.#Ss)),t&&mr.setTimeout(this.component.select.bind(this.component,this.#ii,br.key),0),t}modalInit(){No.OnChangeFile(this.fileModalWrapper,[]),this.#Ss=this.previewSrc.textContent=this.embedInput.value="",this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="none"]').checked=!0,this.#As={w:0,h:0},this.#Os=!1,this.#vi&&(this.inputX.value=this.pluginOptions.defaultWidth===this.#cn?"":this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight===this.#dn?"":this.pluginOptions.defaultHeight,this.proportion.checked=!1,this.proportion.disabled=!0)}componentSelect(t){this.#Zs(t)}componentEdit(){this.modal.open()}async componentDestroy(t){const e=t||this.#ii,i=xt.query.getParentElement(e,ws.is)||e,s=i.previousElementSibling||i.nextElementSibling,n=i.parentNode;!1!==await this.triggerEvent("onEmbedDeleteBefore",{element:e,container:i,align:this.#Ts,url:this.#Ss})&&(xt.utils.removeItem(i),this.modalInit(),n!==this.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.editor.focusEdge(s),this.history.push(!1))}checkContentType(t){return t=t?.toLowerCase()||"",!!this.urlPatterns.some((e=>e.test(t)))}findProcessUrl(t){const e=this.query;for(const i in e){const s=e[i];if(s.pattern.test(t))return{origin:t,url:s.action(t),tag:s.tag}}return null}async submitSRC(t){if(!(t||=this.#Ss))return!1;let e=null;if(/^<iframe\s|^<blockquote\s/i.test(t)){const i=(new DOMParser).parseFromString(t,"text/html").body.children;if(0===i.length)return!1;e={children:i,...this.#Xs(),process:null}}else{const i=this.findProcessUrl(t);if(!i)return!1;e={url:t=i.url,...this.#Xs(),process:i}}const i=function(e,i,s){e(t,(i=s||i).process,i.url,i.children,i.inputWidth,i.inputHeight,i.align,i.isUpdate)}.bind(this,this.#wn.bind(this),e),s=await this.triggerEvent("onEmbedInputBefore",{...e,handler:i});return void 0===s||!1!==s&&(null!==s&&"object"==typeof s&&i(s),!0!==s&&s!==fr||i(null),!0)}#Zs(t,e=!1){if(!t)return;const i=this.figure.open(t,{nonResizing:this.#Os,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:e});this.#ii=t,this.#Ls=i.cover,this.#Ms=i.container,this._caption=i.caption,this.#Ts=i.align,t.style.float="",this.#Bs=String(i.originWidth||i.w||""),this.#Vs=String(i.originHeight||i.h||"");if((this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="'+this.#Ts+'"]')||this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="none"]')).checked=!0,!this.#vi)return;const s=this.#Is&&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=!!s,this.inputY.disabled=!!s,this.proportion.disabled=!!s,this.#As=this.proportion.checked?i.ratio:{w:0,h:0}}#xn(){const t=xt.utils.createElement("IFRAME");return this.#mn(t),t}#kn(){return xt.utils.createElement("BLOCKQUOTE")}#wn(t,e,i,s,n,o,l,r){let a=null,h=null,c=null,d=null;if(r){if(a=this.#ii,a.src!==i){const t=this.findProcessUrl(i);if(/^iframe$/i.test(t?.tag)&&!/^iframe$/i.test(a.nodeName)){const t=this.#xn();t.src=i,a.replaceWith(t),a=t}else if(/^blockquote$/i.test(t?.tag)&&!/^blockquote$/i.test(a.nodeName)){const t=this.#kn();t.setAttribute("src",i),a.replaceWith(t),a=t}else a.src=i}c=this.#Ms,h=xt.query.getParentElement(a,"FIGURE")}else if(e){a=this.#xn(),a.src=i;const t=ws.CreateContainer(a,"se-embed-container");h=t.cover,c=t.container}else{a=s[0];const t=ws.CreateContainer(a,"se-embed-container");h=t.cover,c=t.container;let e=null,i=0;for(;e=s[i];)/^script$/i.test(e.nodeName)?(d=xt.utils.createElement("script",{src:e.getAttribute("src"),async:"true"},null),i++):h.appendChild(e)}this.#ii=a,this.#Ls=h,this.#Ms=c,this.figure.open(a,{nonResizing:this.#Os,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0}),n||=this.#cn,o||=this.#dn;const u=this.figure.getSize(a),p=u.w!==n||u.h!==o,g=!r||p;if(g&&this.#tn(n,o),this.figure.setAlign(a,l),h.setAttribute("data-se-origin",t),r)this.#vi&&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=()=>{xt.utils.removeItem(d),d=null},h.appendChild(d);const t=new MutationObserver((e=>{for(const i of e)if("childList"===i.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)}}}#Ys(t){if(!t)return;this.#mn(t);const e=t;t=t.cloneNode(!0);const i=ws.CreateContainer(t,"se-embed-container").container;this.figure.open(t,{nonResizing:this.#Os,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0});const s=(t.getAttribute("data-se-size")||",").split(","),n=s[0]||e.width||"",o=s[1]||e.height||"";this.#tn(n,o);const l=this.format.getLine(e);return l&&(this.#Ts=l.style.textAlign||l.style.float),this.figure.setAlign(t,this.#Ts),this.figure.retainFigureFormat(i,this.#ii,null,null),t}#tn(t,e){t||=this.inputX?.value||this.pluginOptions.defaultWidth,e||=this.inputY?.value||this.pluginOptions.defaultHeight,this.#Is&&(t?/%$/.test(t+"")&&(t+="%"):t="100%"),this.figure.setSize(t,e)}#Xs(){return{inputWidth:this.inputX?.value||"",inputHeight:this.inputY?.value||"",align:this.#Ts,isUpdate:this.modal.isUpdate,element:this.#ii}}#mn(t){t.frameBorder="0",t.allowFullscreen=!0;const e=this.pluginOptions.iframeTagAttributes;if(e)for(const i in e)t.setAttribute(i,e[i])}#zs(t){const e=xt.query.getEventTarget(t).value.trim();/^<iframe.*\/iframe>$/.test(e)?(this.#Ss=e,this.previewSrc.textContent='<IFrame :src=".."></IFrame>'):this.#Ss=this.previewSrc.textContent=e?this.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#Ws(){this.#Is?this.inputX.value=Number(this.#Bs)>100?"100":this.#Bs:(this.inputX.value=this.#Bs,this.inputY.value=this.#Vs)}#qs(t,e){if(Et.isSpace(e.code))return void e.preventDefault();const i=xt.query.getEventTarget(e);if("x"===t&&this.#Is&&Number(i.value)>100)i.value="100";else if(this.proportion.checked){const e=ws.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this.#As);"x"===t?this.inputY.value=String(e.h):this.inputX.value=String(e.w)}}}const yr=br,{_w:vr,_d:_r}=_t;class Cr extends Zo{static key="math";static className="";static component(t){return xt.utils.hasClass(t,"se-math|katex")&&xt.check.isComponentContainer(t)?t:null}#ii;constructor(t,e){super(t),this.title=this.lang.math,this.icon="math",this.katex=null,this.mathjax=null,(this.katex=this.#En(t))||(this.mathjax=this.#Sn(t))||console.warn('[SUNEDITOR.plugins.math.warn] The math plugin must need either "KaTeX" or "MathJax" library. Please add the katex or mathjax option.'),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 i=function(t){const{lang:e,icons:i,pluginOptions:s,katex:n}=t,{formSize:o,fontSizeList:l,canResize:r,autoHeight:a}=s,{width:h,height:c,maxWidth:d,maxHeight:u,minWidth:p,minHeight:g}=o,m=r?a?"horizontal":"auto":"none";let f=l[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="${e.close}" aria-label="${e.close}">\n ${i.cancel}\n </button>\n <span class="se-modal-title">${e.math_modal_title}</span>\n </div>\n <div class="se-modal-body">\n <div class="se-modal-form">\n <label>${e.math_modal_inputLabel} ${n?`(<a href="${_t.KATEX_WEBSITE}" target="_blank">KaTeX</a>)`:`(<a href="${_t.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: ${h}; height: ${c}; min-width: ${p}; min-height: ${g}; resize: ${m};"></textarea>\n </div>\n <div class="se-modal-form">\n <label>${e.math_modal_fontSizeLabel}</label>\n <select class="se-input-select se-math-size">`;for(let t,e=0,i=l.length;e<i;e++)t=l[e],t.default&&(f=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>${e.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="${e.submitButton}" aria-label="${e.submitButton}">\n <span>${e.submitButton}</span>\n </button>\n </div>\n </form>`,t.defaultFontSize=f,xt.utils.createElement("DIV",{class:"se-modal-content se-modal-responsive",style:`max-width: ${d}; max-height: ${u};`},b)}(this),s=function({lang:t,icons:e}){const i=`\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 xt.utils.createElement("DIV",{class:"se-controller se-controller-link"},i)}(t);this.modal=new No(this,i),this.controller=new as(this,s,{position:"bottom",disabled:!0}),this.textArea=i.querySelector(".se-math-exp"),this.previewElement=i.querySelector(".se-math-preview"),this.fontSizeElement=i.querySelector(".se-math-size"),this.isUpdateState=!1,this.#ii=null,this.previewElement.style.fontSize=this.defaultFontSize,this.eventManager.addEvent(this.textArea,"input",this.#Tn.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=wr(t);if(!e)return;const i=_r.createRange().createContextualFragment(this.#Hn(wt.entityToHTML(this.#Ln(e,!0))));t.innerHTML=i.querySelector(".se-math, .katex").innerHTML,t.setAttribute("contenteditable","false"),xt.utils.addClass(t,"se-component|se-inline-component|se-disable-pointer|se-math"),this.katex?xt.utils.addClass(t,"katex"):xt.utils.removeClass(t,"katex"),this.mathjax&&this.#Mn(this.mathjax)}}}modalOn(t){if(this.isUpdateState=t,t){if(this.controller.currentTarget){const t=this.controller.currentTarget,e=wt.entityToHTML(this.#Ln(wr(t),!0)),i=function(t){const e=t.getAttribute("data-se-type");if(e)return e;const i=t.getAttribute("data-exp");return i?(t.removeAttribute("data-font-size"),t.setAttribute("data-se-type",i),i):null}(t)||"1em";this.textArea.value=e,this.fontSizeElement.value=i,this.previewElement.innerHTML=this.#Hn(e),this.previewElement.style.fontSize=i}}else this.modalInit()}async modalAction(){if(0===this.textArea.value.trim().length||xt.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(xt.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.#Ln(t,!1))),e.setAttribute("data-se-type",this.fontSizeElement.value),e.style.fontSize=this.fontSizeElement.value,this.katex?(xt.utils.addClass(e,"katex"),xt.utils.removeClass(e,"MathJax")):xt.utils.removeClass(e,"katex"),this.isUpdateState){xt.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 i=xt.utils.createElement(t[0].nodeName,null,e);this.component.insert(i,{insertBehavior:"none",scrollTo:!1})}else this.component.insert(e,{insertBehavior:"none",scrollTo:!1})}this.mathjax&&this.#Mn(this.mathjax);const i=this.selection.getNearRange(e);return i?this.selection.setRange(i.container,i.offset,i.container,i.offset):this.component.select(e,Cr.key),!0}modalInit(){this.textArea.value="",this.previewElement.innerHTML="",xt.utils.removeClass(this.textArea,"se-error")}controllerAction(t){switch(t.getAttribute("data-command")){case"update":this.modal.open();break;case"copy":this.#Nn(this.#ii);break;case"delete":this.componentDestroy(this.controller.currentTarget)}}controllerClose(){this.#ii=null}componentSelect(t){if(xt.utils.hasClass(t,"se-math|katex")&&wr(t))return this.#ii=t,void this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null})}async componentDestroy(t){xt.utils.removeItem(t),this.controller.close(),this.editor.focus(),this.history.push(!1)}#Hn(t){let e="";try{xt.utils.removeClass(this.textArea,"se-error"),this.katex?e=this.katex.src.renderToString(t,{throwOnError:!0,displayMode:!0}):this.mathjax&&(e=this.mathjax.convert(t).outerHTML,/<mjx-merror/.test(e)?(xt.utils.addClass(this.textArea,"se-error"),e=`<span class="se-math-error">${e}</span>`):e=`<span class="se-math">${e}</span>`)}catch(t){xt.utils.addClass(this.textArea,"se-error"),e=`<span class="se-math-error">Math syntax error. (Refer ${this.katex?`<a href="${_t.KATEX_WEBSITE}" target="_blank">KaTeX</a>`:`<a href="${_t.MATHJAX_WEBSITE}" target="_blank">MathJax</a>`})</span>`,console.warn("[SUNEDITOR.math.error] ",t.message)}return e}#Ln(t,e){return t.replace(/\\{2}/g,e?"\\":"\\\\")}async#Nn(t){if(navigator.clipboard&&t)try{const e=wr(t);await this.html.copy(e),xt.utils.addClass(t,"se-copy"),vr.setTimeout((()=>{xt.utils.removeClass(t,"se-copy")}),120)}catch(t){console.error("[SUNEDITOR.math.copy.fail]",t)}}#Tn(t){const e=xt.query.getEventTarget(t);this.pluginOptions.autoHeight&&(e.style.height="5px",e.style.height=e.scrollHeight+5+"px"),this.previewElement.innerHTML=this.#Hn(e.value),this.mathjax&&this.#Mn(this.mathjax)}#Mn(t){t.clear(),t.updateDocument()}#En(t){const e=t.options.get("externalLibs").katex;if(!e)return null;if(!e.src)return console.warn("[SUNEDITOR.math.katex.fail] The katex option is set incorrectly."),null;const i=[{throwOnError:!1},e.options||{}].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{});return e.options=i,e}#Sn(t){const e=t.options.get("externalLibs").mathjax;if(!e)return null;t.frameOptions.get("iframe")&&console.warn("[SUNEDITOR.math.mathjax.fail] The MathJax option is not supported in the iframe.");try{const t=e.browserAdaptor();e.RegisterHTMLHandler(t);const i=new e.TeX,s=new e.CHTML;return e.src.document(document,{InputJax:i,OutputJax:s})}catch(t){return console.warn("[SUNEDITOR.math.mathjax.fail] The MathJax option is set incorrectly.",t),null}}}function wr(t){const e=t.getAttribute("data-se-value");if(e)return e;const i=t.getAttribute("data-exp");return i?(t.removeAttribute("data-exp"),t.setAttribute("data-se-value",i),i):null}const xr=Cr,{_w:kr}=_t;const Er=class extends Zo{static key="drawing";static className="";#V;#An;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 i=function({lang:t,icons:e,pluginOptions:i}){const{width:s,height:n,maxWidth:o,maxHeight:l,minWidth:r,minHeight:a}=i.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: ${s}; height: ${n}; min-width: ${r}; min-height: ${a};">\n <canvas class="se-drawing-canvas" style="width: 100%; height: 100%;"></canvas>\n\t\t\t${i.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${i.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${xt.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${xt.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${xt.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 xt.utils.createElement("DIV",{class:"se-modal-content se-modal-responsive",style:`max-width: ${o}; max-height: ${l};`},h)}(this);this.modal=new No(this,i),this.as=this.pluginOptions.defaultFormatType,this.pluginOptions.useFormatType&&(this.asBlock=i.querySelector('[data-command="asBlock"]'),this.asInline=i.querySelector('[data-command="asInline"]'),this.eventManager.addEvent([this.asBlock,this.asInline],"click",this.#Us.bind(this))),this.canvas=null,this.ctx=null,this.isDrawing=!1,this.points=[],this.paths=[],this.resizeObserver=null,this.#V={touchstart:this.#Bn.bind(this),touchmove:this.#Vn.bind(this),mousedown:this.#In.bind(this),mousemove:this.#On.bind(this),mouseup:this.#Rn.bind(this),mouseleave:this.#Fn.bind(this),mouseenter:this.#zn.bind(this)},this.#An={touchstart:null,touchmove:null,mousedown:null,mousemove:null,mouseup:null,mouseleave:null,mouseenter:null},this.eventManager.addEvent(i.querySelector('[data-command="remove"]'),"click",this.#$n.bind(this))}open(){this.pluginOptions.useFormatType&&this.#js("inline"===(this.pluginOptions.keepFormatType?this.as:this.pluginOptions.defaultFormatType)),this.modal.open(),this.#Pn()}modalOff(){this.#Dn()}async modalAction(){if("svg"===this.pluginOptions.outputFormat){const t=this.#qn();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}#Pn(){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.#Wn(),this.#An.touchstart=this.eventManager.addEvent(t,"touchstart",this.#V.touchstart,{passive:!1,capture:!0}),this.#An.touchmove=this.eventManager.addEvent(t,"touchmove",this.#V.touchmove,!0),this.#An.mousedown=this.eventManager.addEvent(t,"mousedown",this.#V.mousedown,{passive:!1,capture:!0}),this.#An.mousemove=this.eventManager.addEvent(t,"mousemove",this.#V.mousemove,!0),this.#An.mouseup=this.eventManager.addEvent(t,"mouseup",this.#V.mouseup,!0),this.#An.mouseleave=this.eventManager.addEvent(t,"mouseleave",this.#V.mouseleave),this.#An.mouseenter=this.eventManager.addEvent(t,"mouseenter",this.#V.mouseenter),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),_t.isResizeObserverSupported&&(this.resizeObserver=new ResizeObserver((()=>{const e=t.width,i=t.height,s=t.offsetWidth,n=t.offsetHeight;t.width=s,t.height=n,e===t.width&&i===t.height||(this.pluginOptions.maintainRatio&&this.#Un(e,i,s,n),this.#Zn())})),this.resizeObserver.observe(t))}#Dn(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.canvas&&(this.eventManager.removeEvent(this.#An.mousedown),this.eventManager.removeEvent(this.#An.mousemove),this.eventManager.removeEvent(this.#An.mouseup),this.eventManager.removeEvent(this.#An.mouseleave),this.eventManager.removeEvent(this.#An.mouseenter)),this.canvas=null,this.ctx=null,this.points=[],this.paths=[],this.isDrawing=!1}#Wn(){this.ctx.lineWidth=this.pluginOptions.lineWidth,this.ctx.lineCap=this.pluginOptions.lineCap,this.ctx.strokeStyle=this.pluginOptions.lineColor||kr.getComputedStyle(this.carrierWrapper).color}#Gn(){this.#Wn(),this.ctx.beginPath(),this.points.forEach((([t,e],i)=>{0===i?this.ctx.moveTo(t,e):this.ctx.lineTo(t,e)})),this.ctx.stroke()}#Zn(){this.#Wn(),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.paths.forEach((t=>{this.points=t,this.#Gn()})),this.points=[]}#Un(t,e,i,s){const n=i/t,o=s/e;this.paths=this.paths.map((t=>t.map((([t,e])=>[t*n,e*o]))))}#Yn(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.points=[],this.paths=[]}#jn(){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((i=>{const s=i.reduce(((t,[e,i],s)=>t+(0===s?`M ${e} ${i}`:` L ${e} ${i}`)),""),n=document.createElementNS(t,"path");n.setAttribute("d",s),n.setAttribute("fill","none"),n.setAttribute("stroke",String(this.ctx.strokeStyle)),n.setAttribute("stroke-width",this.ctx.lineWidth+""),e.appendChild(n)})),e}#qn(){const t=this.#jn(),e=(new XMLSerializer).serializeToString(t),i=new Blob([e],{type:"image/svg+xml"}),s=new File([i],"drawing.svg",{type:"image/svg+xml"}),n=new DataTransfer;return n.items.add(s),n.files}#Xn(t){const{touches:e}=t,i=this.canvas.getBoundingClientRect();return{x:e[0].clientX-i.left,y:e[0].clientY-i.top}}#js(t){t?(xt.utils.addClass(this.asInline,"on"),xt.utils.removeClass(this.asBlock,"on"),this.as="inline"):(xt.utils.addClass(this.asBlock,"on"),xt.utils.removeClass(this.asInline,"on"),this.as="block")}#In(t){t.preventDefault(),this.isDrawing=!0,this.points.push([t.offsetX,t.offsetY]),this.#Gn()}#On(t){t.preventDefault(),this.isDrawing&&(this.points.push([t.offsetX,t.offsetY]),this.#Gn())}#Bn(t){t.preventDefault();const{x:e,y:i}=this.#Xn(t);this.isDrawing=!0,this.points.push([e,i]),this.#Gn()}#Vn(t){t.preventDefault();const{x:e,y:i}=this.#Xn(t);this.isDrawing&&(this.points.push([e,i]),this.#Gn())}#Rn(){this.isDrawing=!1,this.points.length>0&&(this.paths.push([...this.points]),this.points=[])}#Fn(){this.isDrawing&&(this.paths.push([...this.points]),this.pluginOptions.lineReconnect||(this.points=[],this.isDrawing=!1))}#zn(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.#Gn()}}#$n(){this.#Yn()}#Us(t){this.#js("asInline"===xt.query.getEventTarget(t).getAttribute("data-command"))}};const Sr=class extends $o{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 $n(this,{title:this.lang.imageGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Kn.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()}#Kn(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 Tr=class extends $o{static key="videoGallery";static className="";constructor(t,e){super(t),this.title=this.lang.videoGallery,this.icon="video_gallery",this.onSelectfunction=null;const i="string"==typeof e.thumbnail?e.thumbnail:this.icons.video_thumbnail;this.browser=new $n(this,{title:this.lang.videoGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Kn.bind(this),columnSize:4,className:"se-video-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>i,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()}#Kn(t){if(this.onSelectfunction)this.onSelectfunction(t);else{let e=t.getAttribute("data-command");const i=this.plugins.video.findProcessUrl(e);i&&(e=i.url);const s={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,s,!0)}}};const Hr=class extends $o{static key="audioGallery";static className="";constructor(t,e){super(t),this.title=this.lang.audioGallery,this.icon="audio_gallery",this.onSelectfunction=null;const i="string"==typeof e.thumbnail?e.thumbnail:this.icons.audio_thumbnail;this.browser=new $n(this,{title:this.lang.audioGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Kn.bind(this),columnSize:4,className:"se-audio-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>i})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Kn(t){this.onSelectfunction?this.onSelectfunction(t):(this.plugins.audio.modalInit(),this.plugins.audio.submitURL(t.getAttribute("data-command")))}};const Lr=class extends $o{static key="fileGallery";static className="";constructor(t,e){super(t),this.title=this.lang.fileGallery,this.icon="file_gallery",this.onSelectfunction=null;const i="string"==typeof e.thumbnail?e.thumbnail:this.icons.file_thumbnail;this.browser=new $n(this,{title:this.lang.fileGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Kn.bind(this),columnSize:4,className:"se-file-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>i})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Kn(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 Mr=class extends $o{static key="fileBrowser";static className="";constructor(t,e){super(t),this.title=this.lang.fileBrowser,this.icon="file_browser",this.onSelectfunction=null;const i={video:this.icons.video_thumbnail,audio:this.icons.audio_thumbnail,file:this.icons.file_thumbnail},s=this.icons.file_thumbnail;this.browser=new $n(this,{title:this.lang.fileBrowser,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Kn.bind(this),columnSize:4,className:"se-file-browser",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:t=>i[t.type]||s,props:[...new Set((e.props??[]).concat(["frame"]))]})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Kn(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)}}}},Nr={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 Ar extends Uo{static key="fontSize";static className="se-btn-select se-btn-input se-btn-tool-font-size";#Jn;constructor(t,e){super(t),this.unitMap={...Nr,...e.unitMap||{}},this.sizeUnit=/text/.test(e.sizeUnit)?"":e.sizeUnit||this.options.get("fontSizeUnits")[0];const i=function({lang:t},e,i,s){const n=e.list,o=e.default,l=s?t.default:"";let r='\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">';for(let t,e,s,a,h,c=0,d=n.length;c<d;c++)t=n[c],"object"==typeof t?(e=t.title,s=t.size):e=s=t+i,a=o===s?" 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="${s}" data-value="${e}" title="${h}" aria-label="${h}" style="font-size:${s};">${h}</button>\n\t\t\t</li>`;return r+="\n\t\t</ul>\n\t</div>",xt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-font-size"},r)}(t,this.unitMap[this.sizeUnit||"text"],this.sizeUnit,e.showDefaultSizeLabel),s=!!this.sizeUnit&&(e.showIncDecControls??!1),n=!this.sizeUnit||(e.disableInput??!1);this.title=this.lang.fontSize,this.inner=!(n&&!s)&&(n?`<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}" />`),s?(this.beforeItem=xt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-btn","data-command":Ar.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=xt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-btn","data-command":Ar.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>`)):n?n&&!s&&(this.replaceButton=xt.utils.createElement("button",{class:"se-btn se-tooltip se-btn-select se-btn-tool-font-size","data-command":Ar.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:Ar.key,type:"dropdown"},i)):(this.afterItem=xt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":Ar.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:Ar.key,type:"dropdown"},i)),this.currentSize="",this.sizeList=i.querySelectorAll("li button"),this.hasInputFocus=!1,this.isInputActive=!1,this.#Jn=n,this.menu.initDropdownTarget(Ar,i)}active(t,e){if(!xt.utils.hasClass(e,"__se__font_size"))return!1;let i="";if(t){if(this.format.isLine(t))return;if(i=xt.utils.getStyle(t,"fontSize"))return this.#Qn(e,i),!0}else this.#Qn(e,this.#to());return!1}toolbarInputKeyDown({target:t,event:e}){const i=e.code;if(this.#Jn||Et.isSpace(i))return void e.preventDefault();if(!/^(ArrowUp|ArrowDown|Enter)$/.test(i))return;const{value:s,unit:n}=this.#eo(t);if(!s)return;const o=kt.get(s),l=this.unitMap[n];let r=o;switch(i){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.#Qn(t,r+n);if(this.#Jn)return;const s=xt.utils.createElement("SPAN",{style:"font-size: "+e+";"});this.inline.apply(s,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null}),Et.isEnter(i)||t.focus()}finally{this.isInputActive=!1}}toolbarInputChange({target:t,value:e,event:i}){if(!this.#Jn)try{this.isInputActive=!0;let{value:i,unit:s}=this.#eo(e);const{max:n,min:o}=this.unitMap[s];i=i>n?n:i<o?o:i;const l=xt.utils.createElement("SPAN",{style:"font-size: "+this.#Qn(t,i+s)+";"});this.inline.apply(l,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}finally{this.isInputActive=!1,i.preventDefault(),this.editor.focus()}}on(t){const{value:e,unit:i}=this.#eo(t),s=e+i;if(s===this.currentSize)return;const n=this.sizeList;for(let t=0,e=n.length;t<e;t++)s===n[t].getAttribute("data-value")?xt.utils.addClass(n[t],"active"):xt.utils.removeClass(n[t],"active");this.currentSize=s}action(t){const e=t.getAttribute("data-command");if(e===Ar.key){const{value:e,unit:i}=this.#eo(t);let s=kt.get(e)+("inc"===t.getAttribute("data-value")?1:-1);const{min:n,max:o}=this.unitMap[i];s=s<n?n:s>o?o:s;const l=xt.utils.createElement("SPAN",{style:"font-size: "+s+i+";"});this.inline.apply(l,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}else if(e){const t=xt.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()}#to(){return this.frameContext.get("wwComputedStyle").fontSize}#eo(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:xt.check.isInputElement(t)?t.value:t.textContent,i=this.sizeUnit?e.split(/(\d+)/):[e,""];let s=(i.pop()||"").trim().toLowerCase();s=this.options.get("fontSizeUnits").includes(s)?s:this.sizeUnit;const n=i.pop();return{unit:s,value:s?Number(n):n}}#Qn(t,e){return(t=t.parentElement.querySelector(".__se__font_size"))?xt.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 Br=Ar;const Vr=class extends Uo{static key="pageNavigator";static className="se-btn-input se-btn-tool-pageNavigator";constructor(t){super(t),this.title=this.lang.pageNumber,this.inner=xt.utils.createElement("input",{type:"number",class:"se-not-arrow-text",placeholder:"1",value:"1",min:"1"},null),this.afterItem=xt.utils.createElement("span",{class:"se-btn se-sub-btn"},""),this.pageNum=1,this.totalPages=1,this.eventManager.addEvent(this.inner,"change",this.#io.bind(this))}display(t,e){this.pageNum=t,this.totalPages=e,this.inner.value=String(t),this.afterItem.textContent=this.inner.max=String(e)}#io(t){if(!this.frameContext.has("documentType_use_page"))return;const e=xt.query.getEventTarget(t),i=Number(e.value)||1;this.frameContext.get("documentType").pageGo(i)}},{_w:Ir}=_t;class Or extends Go{static key="anchor";static className="";static component(t){return xt.check.isAnchor(t)&&t.hasAttribute("id")&&t.hasAttribute("data-se-anchor")?t:null}#ii;#so;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 i=function({lang:t,icons:e}){const i=`\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 xt.utils.createElement("DIV",{class:"se-controller se-controller-link"},i)}(this);this.displayId=i.querySelector(".se-controller-display"),this.controllerSelect=new as(this,i,{position:"bottom",disabled:!0},Or.key);const s=function({lang:t,icons:e}){const i=`\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 xt.utils.createElement("DIV",{class:"se-controller se-controller-simple-input"},i)}(this);this.inputEl=s.querySelector("input"),this.controller=new as(this,s,{position:"bottom",disabled:!0,parents:[this.controllerSelect.form],parentsHide:!0},Or.key),this.#ii=null,this.#so=null}show(){this.controller.open(this.#so=this.selection.getRange()),Ir.setTimeout((()=>{this.inputEl.focus()}),0)}componentSelect(t){this.#ii=t,this.displayId.textContent=t.getAttribute("id"),this.controllerSelect.open(t)}componentDeselect(){this.#U()}controllerAction(t){const e=t.getAttribute("data-command");if(!e)return;const i=this.#ii;switch(e){case"submit":if(this.controller.close(),i)i.id=this.inputEl.value,this.component.select(i,Or.key);else{const t=this.inputEl.value.trim();if(!t)return void this.inputEl.focus();const e=xt.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 i=this.selection.getNearRange(e);i?this.selection.setRange(i.container,i.offset,i.container,i.offset):this.component.select(e,Or.key),this.#U()}break;case"cancel":this.controller.close(!i),this.#so&&this.selection.setRange(this.#so),this.#U(),i&&this.componentSelect(i);break;case"edit":this.inputEl.value=this.displayId.textContent,this.controllerSelect.hide(),this.controller.open(i),this.inputEl.focus();break;case"delete":{const t=this.selection.getNearRange(i);xt.utils.removeItem(i),this.controllerSelect.close(!0),t&&this.selection.setRange(t.container,t.offset,t.container,t.offset),this.#U();break}}}#U(){this.#ii=null,this.#so=null,this.inputEl.value="",this.displayId.textContent=""}}const Rr={blockquote:Yo,exportPDF:Ko,fileUpload:tl,list_bulleted:il,list_numbered:ol,mention:rl,align:hl,font:dl,fontColor:pl,backgroundColor:ml,list:vl,table:Wl,blockStyle:Zl,hr:bl,layout:Yl,lineHeight:Xl,template:Jl,paragraphStyle:tr,textStyle:ir,link:sr,image:lr,video:cr,audio:gr,embed:yr,math:xr,drawing:Er,imageGallery:Sr,videoGallery:Tr,audioGallery:Hr,fileGallery:Lr,fileBrowser:Mr,fontSize:Br,pageNavigator:Vr,anchor:Or};class Fr{async modalAction(){return!0}modalOn(t){}modalInit(){}modalOff(t){}modalResize(){}}class zr{controllerAction(t){}controllerOn(t,e){}controllerClose(){}}class $r{browserInit(){}}class Pr{colorPickerAction(t){}colorPickerHueSliderOpen(){}colorPickerHueSliderClose(){}}class Dr{hueSliderAction(){}hueSliderCancelAction(){}}class qr{componentSelect(t){}componentDeselect(t){}componentEdit(t){}async componentDestroy(t){}componentCopy(t){}}const Wr={contracts:t,utils:e};Object.defineProperty(window,"SUNEDITOR",{enumerable:!0,writable:!1,configurable:!1,value:{...Ro,plugins:Rr,editorInjector:Fo,modules:Wr,helper:Tt,interfaces:s}})})()})();
|
|
1
|
+
(()=>{var t={cfbI:function(t){var e,i;e="undefined"!=typeof window?window:this,i=function(t,e){const i={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",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",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",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:i})),i},"object"==typeof t.exports?t.exports=e.document?i(e,!0):function(t){if(!t.document)throw new Error("SUNEDITOR_LANG a window with a document");return i(t)}:i(e)}},e={};function i(s){var n=e[s];if(void 0!==n)return n.exports;var o=e[s]={exports:{}};return t[s].call(o.exports,o,o.exports,i),o.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";var t={};i.r(t),i.d(t,{Browser:()=>$n,ColorPicker:()=>Ho,Controller:()=>as,Figure:()=>ws,HueSlider:()=>Eo,Modal:()=>No});var e={};i.r(e),i.d(e,{ApiManager:()=>Fn,FileManager:()=>Bo,ModalAnchorEditor:()=>Oo,SelectMenu:()=>cs,_DragHandle:()=>he});var s={};i.r(s),i.d(s,{EditorComponent:()=>qr,ModuleBrowser:()=>$r,ModuleColorPicker:()=>Pr,ModuleController:()=>zr,ModuleHueSlider:()=>Dr,ModuleModal:()=>Fr,PluginBrowser:()=>$o,PluginCommand:()=>Po,PluginDropdown:()=>Do,PluginDropdownFree:()=>qo,PluginField:()=>Wo,PluginInput:()=>Uo,PluginModal:()=>Zo,PluginPopup:()=>Go});const n=window,o=document,l=Symbol("noEventHandler"),r=Symbol("onOverComponent"),a=navigator.userAgent.toLowerCase();const h="function"==typeof ResizeObserver,c="function"==typeof navigator.clipboard?.write,d=/Edg/.test(navigator.userAgent),u=/(Mac|iPhone|iPod|iPad)/.test(navigator.userAgent),p=a.includes("chrome/")&&!a.includes("edge/"),g=!!a.match(/gecko\/\d+/),m=!!n.chrome,f=a.includes("applewebkit/")&&!a.includes("chrome"),b=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(a),y=navigator.maxTouchPoints>0&&"ontouchstart"in n,v=a.includes("android"),_=u?"⌘":"CTRL",C=u?"⇧":"+SHIFT",w=n.devicePixelRatio,x={_w:n,_d:o,NO_EVENT:l,ON_OVER_COMPONENT:r,getXMLHttpRequest:function(){return new XMLHttpRequest},getPageStyle:function(t){let e="";const i=(t||o).styleSheets;for(let t,s=0,n=i.length;s<n;s++){try{t=i[s].cssRules}catch{continue}if(t)for(let i=0,s=t.length;i<s;i++)e+=t[i].cssText}return e},getIncludePath:function(t,e){let i="";const s=[],n="js"===e?"script":"link",l="js"===e?"src":"href";let r="(?:";for(let e=0,i=t.length;e<i;e++)r+=t[e]+(e<i-1?"|":")");const a=new RegExp(`(^|.*[\\/])${r}(\\.[^\\/]+)?.${e}(?:\\?.*|;.*)?$`,"i"),h=new RegExp(`.+\\.${e}(?:\\?.*|;.*)?$`,"i");for(let t=o.getElementsByTagName(n),e=0;e<t.length;e++)h.test(t[e][l])&&s.push(t[e]);for(let t=0;t<s.length;t++){const e=s[t][l].match(a);if(e){i=e[0];break}}if(""===i&&(i=s.length>0?s[0][l]:""),i.includes(":/")||"//"===i.slice(0,2)||(i=!1===i.includes("/")?location.href.match(/^.*?:\/\/[^/]*/)[0]+i:location.href.match(/^[^?]*\/(?:)/)[0]+i),!i)throw"[SUNEDITOR.helper.env.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (path: +"+i+", extension: "+e+")";return i},isResizeObserverSupported:h,isClipboardSupported:c,isEdge:d,isBlink:p,isGecko:g,isChromium:m,isSafari:f,isOSX_IOS:u,isAndroid:v,isMobile:b,isTouchDevice:y,cmdIcon:_,shiftIcon:C,DPI:w,KATEX_WEBSITE:"https://katex.org/docs/supported.html",MATHJAX_WEBSITE:"https://www.mathjax.org/"},k=8203,E=String.fromCharCode(k),S=new RegExp(String.fromCharCode(k),"g"),T=new RegExp("^"+String.fromCharCode(k)+"+$");const H={zeroWidthSpace:E,zeroWidthRegExp:S,onlyZeroWidthRegExp:T,escapeStringRegexp:function(t){if("string"!=typeof t)throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}},L={"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 M(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 i of t.attributes)e.attributes[i.name]=i.value;for(const i of t.childNodes){const t=M(i);t&&e.children.push(t)}return e}return null}function N(t){const e={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"};return t.replace(/&|\u00A0|'|"|<|>/g,(t=>"string"==typeof e[t]?e[t]:t))}function A(t){return"string"==typeof t?t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase())):t.map((function(t){return A(t)}))}function B(t){return/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(t)}const V={htmlToJson:function(t){return M((new DOMParser).parseFromString(t,"text/html").body)},jsonToHtml:function t(e){if(!e)return"";if("text"===e.type)return N(e.content||"");if("element"===e.type){const{tag:i,attributes:s={},children:n=[]}=e,o=Object.entries(s).map((([t,e])=>`${t}="${N(e)}"`)).join(" "),l=`</${i}>`;return`${o?`<${i} ${o}>`:`<${i}>`}${n.map(t).join("")}${l}`}return""},htmlToEntity:N,entityToHTML:function(t){const e={"&":"&"," ":" ","'":"'",""":'"',"<":"<",">":">"};return t.replace(/&| |'|"|\$lt;|\$gt;/g,(t=>"string"==typeof e[t]?e[t]:t))},debounce:function(t,e){let i;return function(...s){n.clearTimeout(i),i=n.setTimeout((()=>{n.clearTimeout(i),t(...s)}),e)}},syncMaps:function(t,e){e.forEach(((e,i)=>{t.set(i,e)})),t.forEach(((i,s)=>{e.has(s)||t.delete(s)}))},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:A,kebabToCamelCase:function(t){return"string"==typeof t?t.replace(/-[a-zA-Z]/g,(t=>t.replace("-","").toUpperCase())):t.map((function(t){return A(t)}))},toFontUnit:function(t,e){const i=e.match(/(\d+(?:\.\d+)?)(.+)/),s=i?Number(i[1]):L[e],n=i?i[2]:"rem";let o=s;switch(/em/.test(n)?o=Math.round(s/.0625):"pt"===n?o=Math.round(1.333*s):"%"===n&&(o=s/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={},i=Object.prototype.hasOwnProperty;for(const s in t)i.call(t,s)&&(e[t[s]]=s);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:B,rgb2hex:function(t){if(B(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 i=("0"+parseInt(e[1],10).toString(16)).slice(-2),s=("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+]?/i);e&&(o=("0"+Math.round(255*parseFloat(e[1])).toString(16)).slice(-2))}return`#${i}${s}${n}${o}`}return t},getWidthInPercentage:function(t,e){const i=e||t.parentElement,s=n.getComputedStyle(i),o=parseFloat(s.paddingLeft),l=parseFloat(s.paddingRight),r=i.offsetWidth-i.clientWidth,a=i.offsetWidth-o-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 i=t.textContent,s=o.createDocumentFragment();let n=0;return i.replace(e,((t,e)=>{e>0&&s.appendChild(o.createTextNode(i.slice(0,e)));const l=o.createElement("a");return l.href=t,l.target="_blank",l.textContent=t,s.appendChild(l),n=e+t.length,n<i.length&&s.appendChild(o.createTextNode(i.slice(n))),t})),t.parentNode.replaceChild(s,t),!0}return!1},spanToStyleNode:function(t,e){if(1===e.nodeType&&/^SPAN$/i.test(e.nodeName)&&e.hasAttribute("style")){const i=e.getAttribute("style"),s=[];if(Object.keys(t).forEach((e=>{if(t[e].regex.test(i)){const i=o.createElement(t[e].tag);s.push(i)}})),s.length>0){const t=o.createElement("span");let i=e.firstChild;s.forEach(((e,i)=>{0===i?t.appendChild(e):s[i-1].appendChild(e)}));const n=s[s.length-1];for(;i;){const t=i.nextSibling;n.appendChild(i),i=t}for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(t)}}},addUrlQuery:function(t,e){if(e.length>0)if(/\?/.test(t)){const i=t.split("?");t=i[0]+"?"+e+"&"+i[1]}else t+="?"+e;return t},_setDefaultOptionStyle:function(t,e){let i="";t.get("height")&&(i+="height:"+t.get("height")+";"),t.get("minHeight")&&(i+="min-height:"+t.get("minHeight")+";"),t.get("maxHeight")&&(i+="max-height:"+t.get("maxHeight")+";"),t.get("width")&&(i+="width:"+t.get("width")+";"),t.get("minWidth")&&(i+="min-width:"+t.get("minWidth")+";"),t.get("maxWidth")&&(i+="max-width:"+t.get("maxWidth")+";");let s="",n="",o="";const l=(e=i+e).split(";");for(let e,i=0,r=l.length;i<r;i++)e=l[i].trim(),e&&(/^(min-|max-)?width\s*:/.test(e)||/^(z-index|position|display)\s*:/.test(e)?s+=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:s,frame:n,editor:o}},_setIframeStyleLinks:function(t){let e="";if(t){const i=o.getElementsByTagName("link");for(let s,n=0,o=t.length;n<o;n++){s=[];const o=t[n];if("*"===o)for(let t=0,e=i.length;t<e;t++)"stylesheet"===i[t].rel&&i[t].href&&s.push(i[t].href);else if(/(^https?:\/\/)|(^data:text\/css,)/.test(o))s.push(o);else{const t=new RegExp(`(^|.*[\\/])${o}(\\..+)?.css((\\??.+?)|\\b)$`,"i");for(let e,n=0,o=i.length;n<o;n++)e=i[n].href.match(t),e&&s.push(e[0])}if(!s||0===s.length)throw'[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,i=s.length;t<i;t++)e+='<link href="'+s[t]+'" rel="stylesheet">'}}return e},_setAutoHeightStyle:function(t){return"auto"===t?"<style>\n/** Iframe height auto */\nbody{height: min-content; overflow: hidden;}\n</style>":""}},I=V;function O(t){if(null==t)return!1;if("string"!=typeof t){if(R(t)){const e=t.children;for(let t=0,i=e.length;t<i;t++){if(!P(e[t]))return!1}}t=t.textContent}return""===t||T.test(t)}function R(t){return 1===t?.nodeType}function F(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 $(t){return/^BR$/i.test("string"==typeof t?t:t?.nodeName)}function P(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 D(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 q(t){return t?.hasAttribute("data-important-disabled")}const W={isZeroWidth:O,isEdgePoint:function(t,e,i){return"end"!==i&&0===e||(!i||"front"!==i)&&!t.nodeValue&&e<=1||(!i||"end"===i)&&t.nodeValue&&e>=t.nodeValue.length},isText:function(t){return 3===t?.nodeType},isElement:R,isInputElement:function(t){return R(t)&&/^(INPUT|TEXTAREA|SELECT|OPTION)$/i.test(t.nodeName)},isButtonElement:function(t){return R(t)&&/^(BUTTON)$/i.test(t.nodeName)},isList:F,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:$,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:P,isEmptyLine:function(t){if(!t?.parentNode)return!0;const e=t;return!e.querySelector("IMG, IFRAME, AUDIO, VIDEO, CANVAS, TABLE")&&(e.children.length<=1||$(e.firstElementChild))&&O(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:D,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 i=t,s=e,n=i.style,o=s.style;let l=0;for(let t=0,e=n.length;t<e;t++)n[n[t]]===o[n[t]]&&l++;const r=i.classList,a=s.classList,h=RegExp;let c=0;for(let t=0,e=r.length;t<e;t++)h("(s|^)"+r[t]+"(s|$)").test(a.value)&&c++;return l===o.length&&l===n.length&&c===a.length&&c===r.length},isExcludeFormat:function(t){return/(\s|^)(katex|MathJax|se-exclude-format)(\s|$)/.test(t?.className)},isUneditable:function(t){return t?.classList.contains("__se__uneditable")},isImportantDisabled:q},U=W;function Z(t){const e=Object.prototype.toString.call(t);return"[object HTMLCollection]"===e||"[object NodeList]"===e||"[object Array]"===e}function G(t,e,i){const s=o.createElement(t);if(e)for(const t in e)void 0!==e[t]&&null!==e[t]&&s.setAttribute(t,e[t]);return i&&("string"==typeof i?s.innerHTML=i:"object"==typeof i&&s.appendChild(i)),s}function Y(t,e){let i=-1;for(let s=0,n=t.length;s<n;s++)if(t[s]===e){i=s;break}return i}function j(t,e,i){const s=t,n=e;if(n.style.length>0){const t=n.style;for(let e=0,i=t.length;e<i;e++)s.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(),i?.includes(t)||!o[e].value?s.removeAttribute(t):"style"!==t&&s.setAttribute(o[e].name,o[e].value)}function X(t,e){if(!t||1!==t.nodeType)return;return new RegExp(`(\\s|^)${e}(\\s|$)`).test(t.className)}function K(t,e){if(!t)return;const i=Z(t)?t:[t],s=e.split("|");for(let t=0,e=i.length;t<e;t++){const e=i[t];if(e&&1===e.nodeType)for(const t of s)t&&e.classList.add(t)}}function J(t,e){if(!t)return;const i=Z(t)?t:[t],s=e.split("|");for(let t=0,e=i.length;t<e;t++){const e=i[t];if(e&&1===e.nodeType)for(const t of s)t&&e.classList.remove(t)}}function Q(t=o){return{w:t.documentElement.clientWidth,h:t.documentElement.clientHeight}}const tt={clone:function(t,e=!1){return t.cloneNode(e)},createElement:G,createTextNode:function(t){return o.createTextNode(t||"")},getAttributesToString:function(t,e){const i=t.attributes;if(!i)return"";let s="";for(let t=0,n=i.length;t<n;t++)e?.includes(i[t].name)||(s+=i[t].name+'="'+i[t].value+'" ');return s},arrayFilter:function(t,e){if(!t||0===t.length)return null;e||=()=>!0;const i=[];for(let s,n=0,o=t.length;n<o;n++)s=t[n],e(s)&&i.push(s);return i},arrayFind:function(t,e){if(!t||0===t.length)return null;e||=()=>!0;for(let i,s=0,n=t.length;s<n;s++)if(i=t[s],e(i))return i;return null},arrayIncludes:function(t,e){for(let i=0;i<t.length;i++)if(t[i]===e)return!0;return!1},getArrayIndex:Y,nextIndex:function(t,e){const i=Y(t,e);return-1===i?-1:i+1},prevIndex:function(t,e){const i=Y(t,e);return-1===i?-1:i-1},copyTagAttributes:j,copyFormatAttributes:function(t,e){const i=e.cloneNode(!1);i.className=i.className.replace(/(\s|^)__se__format__[^\s]+/g,""),j(t,i)},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 i=G("DIV");i.innerHTML=e,t.parentNode.replaceChild(i.firstChild,t)}else 1===e?.nodeType&&t.parentNode.replaceChild(e,t)},changeTxt:function(t,e){t&&e&&(t.textContent=e)},setStyle:function(t,e,i){for(let s,n=0,o=(t=Array.isArray(t)?t:[t]).length;n<o;n++)s=t[n],s.style[e]=i,0===s.style.length&&s.removeAttribute("style")},getStyle:function(t,e){if(1===t?.nodeType)return t.style[e]},setDisabled:function(t,e,i){for(let s=0,n=t.length;s<n;s++){const n=t[s];!i&&q(n)||(n.disabled=e),i&&(e?n.setAttribute("data-important-disabled",""):n.removeAttribute("data-important-disabled"))}},hasClass:X,addClass:K,removeClass:J,toggleClass:function(t,e){if(!t||1!==t.nodeType)return;const i=t;let s=!1;const n=new RegExp(`(\\s|^)${e}(\\s|$)`);return n.test(i.className)?i.className=i.className.replace(n," ").trim():(i.className+=" "+e,s=!0),i.className.trim()||i.removeAttribute("class"),s},flashClass:function(t,e,i=120){K(t,e),n.setTimeout((()=>{J(t,e)}),i)},getClientSize:Q,getViewportSize:function(){return"visualViewport"in n?{top:n.visualViewport.pageTop,left:n.visualViewport.pageLeft,scale:n.visualViewport.scale}:{top:0,left:0,scale:1}},applyInlineStylesAll:function(t,e,i){if(!t)return console.warn('"parentTarget" is not exist'),null;let s=t;const l=o.createElement("DIV");if(l.style.display="none",/body/i.test(s.nodeName)){const t=o.createElement("DIV"),e=s.attributes;for(let i=0,s=e.length;i<s;i++)t.setAttribute(e[i].name,e[i].value);t.innerHTML=s.innerHTML,s=t}else s=s.cloneNode(!0);l.appendChild(s),o.body.appendChild(l);const r=Array.from(s.querySelectorAll("*")),a=e?[s].concat(r):r;for(let t,e=0;t=a[e];e++){if(1!==t.nodeType)continue;const e=n.getComputedStyle(t),s=t.style;for(const t of i)s.setProperty(t,e.getPropertyValue(t)||"")}return o.body.removeChild(l),s},waitForMediaLoad:function(t,e=5e3){const i=t||o;return new Promise((t=>{const s=["img","video","audio","iframe"].flatMap((t=>Array.from(i.querySelectorAll(t))));if(0===s.length)return void t();const o=s.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(o),new Promise((t=>n.setTimeout(t,e)))]).then((()=>{t()}))}))},getRootCssVar:function(t){return o.documentElement.style.getPropertyValue(t)},setRootCssVar:function(t,e){o.documentElement.style.setProperty(t,e)},createTooltipInner:function(t){return`<span class="se-tooltip-inner"><span class="se-tooltip-text">${t}</span></span>`}};function et(t){let e=0;for(;t=t.previousSibling;)e+=1;return e}function it(t,e,i){const s=[];let n=!0;return lt(t,(t=>{if(t===e&&(n=!1),n&&!U.isWysiwygFrame(t)){if(i&&3===t.nodeType){let e=null,s=null;i.s=i.e=0;let n=t.previousSibling;for(;3===n?.nodeType;)s=n.textContent.replace(S,""),i.s+=s.length,t.textContent=s+t.textContent,e=n,n=n.previousSibling,tt.removeItem(e);let o=t.nextSibling;for(;3===o?.nodeType;)s=o.textContent.replace(S,""),i.e+=s.length,t.textContent+=s,e=o,o=o.nextSibling,tt.removeItem(e)}s.push(t)}return!1})),s.map(et).reverse()}function st(t,e){let i,s=e;for(let e=0,n=t.length;e<n&&(i=s.childNodes,0!==i.length);e++)s=i.length<=t[e]?i[i.length-1]:i[t[e]];return s}function nt(t,e,i){const s=[];return i??=1/0,!t||i<=0||0===t.childNodes.length||(e||=()=>!0,function t(n,o){if(o>i)return;if(o>0&&e(n)&&s.push(n),o===i)return;const l=n.childNodes;for(let e=0,i=l.length;e<i;e++)t(l[e],o+1)}(t,0)),s}function ot(t){if(!t||U.isWysiwygFrame(t))return-1;let e=0;for(t=t.parentNode;t&&!U.isWysiwygFrame(t);)e+=1,t=t.parentNode;return e}function lt(t,e,i){let s;if("function"==typeof e)s=e;else if("object"==typeof e)s=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 i=new RegExp(e,"i");s=e=>i.test(e[t])}i||=1/0;let n=0;for(;t&&!s(t);){if(n>=i||U.isWysiwygFrame(t))return null;t=t.parentElement,n++}return t}const rt={getPositionIndex:et,getNodePath:it,getNodeFromPath:st,getChildNode:function(t,e){let i=null;if(!t)return i;const s=t;return s.children&&0!==s.children.length?(e||=()=>!0,function t(n){if(s!==n&&e(n))return i=n,!0;if(n.children)for(let e=0,i=n.children.length;e<i;e++)t(n.children[e])}(s),i):i},getListChildren:function(t,e,i){const s=[];if(i??=1/0,!t||i<=0)return s;const n=t;return n.children&&0!==n.children.length?(e||=()=>!0,function t(o,l){if(!(l>i)&&(l>0&&n!==o&&e(o)&&s.push(o),l!==i&&o.children))for(let e=0,i=o.children.length;e<i;e++)t(o.children[e],l+1)}(n,0),s):s},getListChildNodes:nt,getNodeDepth:ot,sortNodeByDepth:function(t,e){const i=e?1:-1,s=-1*i;t.sort((function(t,e){if(!U.isListCell(t)||!U.isListCell(e))return 0;const n=ot(t),o=ot(e);return n>o?i:n<o?s:0}))},compareElements:function(t,e){let i=t,s=e;for(;i&&s&&i.parentElement!==s.parentElement;)i=i.parentElement,s=s.parentElement;if(!i?.parentNode||!s?.parentNode)return{ancestor:null,a:t,b:e,result:0};const n=i.parentNode.childNodes,o=tt.getArrayIndex(n,i),l=tt.getArrayIndex(n,s);return{ancestor:i.parentElement,a:i,b:s,result:o>l?1:o<l?-1:0}},getParentElement:lt,getParentElements:function(t,e,i){let s;if("function"==typeof e)s=e;else if("object"==typeof e)s=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 i=new RegExp(e,"i");s=e=>i.test(e[t])}const n=[];i||=1/0;let o=0;for(;o<=i&&t&&!U.isWysiwygFrame(t);)s(t)&&n.push(t),t=t.parentElement,o++;return n},getCommandTarget:function(t){let e=t;for(;e&&!/^(UL)$/i.test(e.nodeName)&&!tt.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,i){let s;if("function"==typeof e)s=e;else if("object"==typeof e)s=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 i=new RegExp(e,"i");s=function(e){return i.test(e[t])}}const n=nt(t,(t=>s(t)),null);return n[i?n.length-1:0]},getEdgeChildNodes:function(t,e){if(t){for(e||=t;t&&1===t.nodeType&&t.childNodes.length>0&&!U.isBreak(t);)t=t.firstChild;for(;e&&1===e.nodeType&&e.childNodes.length>0&&!U.isBreak(e);)e=e.lastChild;return{sc:t,ec:e||t}}},getPreviousDeepestNode:function(t,e){let i=t.previousSibling;if(!i){for(let s=t.parentNode;s;s=s.parentNode){if(s===e)return null;if(s.previousSibling){i=s.previousSibling;break}}if(!i)return null}if(U.isNonEditable(i))return i;for(;i.lastChild;)i=i.lastChild;return i},getNextDeepestNode:function(t,e){let i=t.nextSibling;if(!i){for(let s=t.parentNode;s;s=s.parentNode){if(s===e)return null;if(s.nextSibling){i=s.nextSibling;break}}if(!i)return null}if(U.isNonEditable(i))return i;for(;i.firstChild;)i=i.firstChild;return i},findTextIndexOnLine:function(t,e,i,s){if(!t)return 0;s||=()=>!0;let n=0,o=!1;return function t(l){if(!o&&8!==l.nodeType&&!s(l))if(3===l.nodeType){if(l===e)return n+=i,void(o=!0);n+=l.textContent.length}else if(1===l.nodeType){const e=l.childNodes;for(let i=0,s=e.length;i<s;i++)if(t(e[i]),o)return}}(t),n},findTabEndIndex:function(t,e,i){if(!t)return 0;const s=t.textContent,n=new RegExp(`((\\u00A0|\\s){${i},})`,"g");let o;for(n.lastIndex=e;null!==(o=n.exec(s));)if(o.index>=e){const t=o.index+o[0].length-1;return t+(s.slice(0,t+1).match(/[^\u00A0\s]/g)||[]).length+i}return 0},findVisualLastCell:function(t){if(!t||0===t.length)return null;const e={};let i=null,s=-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 i=1;i<l;i++){const s=t+i;e[s]||=[];for(let t=0;t<r;t++)e[s][a+t]=!0}const c=t+l-1,d=a+r-1;(c>s||c===s&&d>n)&&(s=c,n=d,i=o)}return i},getScrollParents:function(t){const e=[];let i=t?.parentElement;for(;i&&!/^(body|html)$/i.test(i.nodeName);){const t=n.getComputedStyle(i),{overflow:s,overflowX:o,overflowY:l}=t;[s,o,l].some((t=>["auto","scroll","overlay"].includes(t)))&&e.push(i),i=i.parentElement}return e},getIframeDocument:function(t){return t.contentWindow?.document||t.contentDocument}},at={query:rt,check:U,utils:tt};function ht(t,e=0){if(!t)return 0;const i=(t+"").match(/-?\d+(\.\d+)?/);if(!i||!i[0])return 0;const s=Number(i[0]);return e<0?s:0===e?Math.round(s):Number(s.toFixed(e))}const ct={is:function(t){return/^-?\d+(\.\d+)?$/.test(t+"")},get:ht,getOverlapRangeAtIndex:function(t,e,i,s){if(t<=s?e<i:e>i)return 0;const n=(t>i?t:i)-(e<s?e:s);return(n<0?-1*n:n)+1},isEven:function(t){return!(1&t)},isOdd:function(t){return!(1&~t)}},dt="ArrowLeft|ArrowUp|ArrowRight|ArrowDown",ut="F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12",pt=dt.split("|"),gt="Backspace|Delete".split("|"),mt=`Backspace|Tab|Enter|ShiftLeft|ShiftRight|ControlLeft|ControlRight|AltLeft|AltRight|Pause|CapsLock|Escape|PageUp|PageDown|End|Home|${dt}|Insert|Delete|${ut}|NumLock|ScrollLock`.split("|"),ft="Backspace|Enter|Delete".split("|"),bt="Backspace|Enter|Delete".split("|"),yt=`ControlLeft|ControlRight|AltLeft|AltRight|Pause|CapsLock|Escape|Insert|${ut}|NumLock|ScrollLock`.split("|");const vt={write:async function(t){if(!c)return console.error("Clipboard is not supported in this browser."),!1;let e="",i="";"string"==typeof t?(e=t,i=t):R(t)?(t.querySelectorAll("iframe").forEach((t=>{const e=document.createElement("div"),i={};for(const e of Array.from(t.attributes))i[e.name]=e.value;e.setAttribute("data-se-iframe-holder","1"),e.setAttribute("data-se-iframe-holder-attrs",JSON.stringify(i)),e.innerText=`[iframe: ${t.src}]`,t.replaceWith(e)})),e=t.outerHTML,i=t.textContent):(e=t.textContent,i=t.textContent);try{await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([e],{type:"text/html"}),"text/plain":new Blob([i],{type:"text/plain"})})])}catch{console.warn("[SUNEDITOR.copy.warn] This browser is not supported Clipboard API");try{await navigator.clipboard.writeText(i||function(t){const e=document.createElement("div");return e.innerHTML=t,e.textContent||e.innerText||""}(e))}catch(t){console.error("[SUNEDITOR.copy.fail] "+t)}}}},_t=x,Ct=H,wt=I,xt=at,kt=ct,Et={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 pt.includes(t)},isRemoveKey:function(t){return gt.includes(t)},isNonTextKey:function(t){return mt.includes(t)},isHistoryRelevantKey:function(t){return ft.includes(t)},isDocumentTypeObserverKey:function(t){return bt.includes(t)},isNonResponseKey:function(t){return yt.includes(t)}},St=vt,Tt={env:_t,unicode:Ct,converter:wt,dom:xt,numbers:kt,keyCodeMap:Et,clipboard:St},Ht={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_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>',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 xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,11A4,4 0 0,1 6,7A4,4 0 0,1 10,3H18V5H16V21H14V5H12V21H10V11Z" /></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 xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 3C3.9 3 3 3.9 3 5S2.1 7 1 7V9C2.1 9 3 9.9 3 11S3.9 13 5 13H7V11H5V10C5 8.9 4.1 8 3 8C4.1 8 5 7.1 5 6V5H7V3M11 3C12.1 3 13 3.9 13 5S13.9 7 15 7V9C13.9 9 13 9.9 13 11S12.1 13 11 13H9V11H11V10C11 8.9 11.9 8 13 8C11.9 8 11 7.1 11 6V5H9V3H11M22 6V18C22 19.11 21.11 20 20 20H4C2.9 20 2 19.11 2 18V15H4V18H20V6H17.03V4H20C21.11 4 22 4.89 22 6Z" /></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>',find_replace:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,6C12.38,6 13.63,6.56 14.54,7.46L12,10H18V4L15.95,6.05C14.68,4.78 12.93,4 11,4C7.47,4 4.57,6.61 4.08,10H6.1C6.56,7.72 8.58,6 11,6M16.64,15.14C17.3,14.24 17.76,13.17 17.92,12H15.9C15.44,14.28 13.42,16 11,16C9.62,16 8.37,15.44 7.46,14.54L10,12H4V18L6.05,15.95C7.32,17.22 9.07,18 11,18C12.55,18 14,17.5 15.14,16.64L20,21.5L21.5,20L16.64,15.14Z" /></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>',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>',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 Lt=i("cfbI"),Mt=i.n(Lt);function Nt(t,e,i,s,n){const o=new Map([["menuTray",i],["toolbar_main",t],["toolbar_buttonTray",t.querySelector(".se-btn-tray")],["toolbar_arrow",t.querySelector(".se-arrow")]]);return s&&(o.set("toolbar_sub_main",s),o.set("toolbar_sub_buttonTray",s.querySelector(".se-btn-tray")),o.set("toolbar_sub_arrow",s.querySelector(".se-arrow")),o.set("toolbar_sub_wrapper",s.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 At(t,e,i,s,n,o,l,r){const a=new Map([["key",r],["options",t.options],["originElement",t.target],["topArea",e],["container",e.querySelector(".se-container")],["wrapper",e.querySelector(".se-wrapper")],["wysiwygFrame",i],["wysiwyg",i],["codeWrapper",s],["code",n],["codeNumbers",s?.querySelector(".se-code-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",ht(i.style.minHeight||"65",0)],["isCodeView",!1],["isFullScreen",!1],["isReadOnly",!1],["isDisabled",!1],["isChanged",-1],["historyIndex",-1],["savedIndex",-1],["documentTypeInner",l.inner],["documentTypePage",l.page],["documentTypePageMirror",l.pageMirror]]);o&&Bt(o,a);const h=e.querySelector(".se-placeholder");return h&&a.set("placeholder",h),a}function Bt(t,e){t?e.set("statusbar",t):e.delete("statusbar");const i=t?t.querySelector(".se-navigation"):null,s=t?t.querySelector(".se-char-counter-wrapper"):null,n=t?t.querySelector(".se-char-counter-wrapper .se-char-counter"):null;i?e.set("navigation",i):e.delete("navigation"),s?e.set("charWrapper",s):e.delete("charWrapper"),n?e.set("charCounter",n):e.delete("charCounter")}const Vt={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",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"]},It={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},Ot={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,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,__lineFormatFilter:!0,__pluginRetainFilter:!0,__listCommonStyle:"fixed",externalLibs:"fixed"};const Rt=_t._d;function Ft(t,e,i,s,n,o){if(!i||i.length<2)return;const l=e?.querySelector(".se-tooltip-text");for(let h,c,d,u,p,g,m,f,b,y,v,_,C,w,x=0;x<i.length;x+=2+w){if(w=0,h=i[x].split("+"),b=null,y=h.at(-1).trim?.(),y.startsWith("~"))b=t,y=h.pop().trim().substring(1);else if(y.startsWith("$~")){const t=h.pop().trim().substring(2).split(".");b=t[0],y=t[1]}else y.startsWith("$")?(w=1,y=i[x+2]):y="";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 i=0,l=c.length;i<l;i++)_=d?c[i]+(u?"1000":""):c[i],s.has(_)||(C=n.indexOf(t),C=-1===C?"":kt.isOdd(C)?n[C+1]:n[C-1],C&&o.add(_),s.set(_,{c:d,s:u,edge:p,space:g,enter:m,textTrigger:f,plugin:b,command:t,method:y,r:C,type:e?.getAttribute("data-type"),button:e,key:_}));(v=i[x+1])&&(l&&(r=u,a=v,l.appendChild(xt.utils.createElement("SPAN",{class:"se-shortcut"},_t.cmdIcon+(r?_t.shiftIcon:"")+'+<span class="se-shortcut-key">'+a+"</span>"))))}var r,a}function zt(t,e){return[t,e].reduce(((t,e)=>{for(const i in e)t[i]=(e[i]||"").toLowerCase();return t}),{})}function $t(t,e,i){const s=t.buttonList||Vt.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(s.toString().split(",")));const o=!1!==t.strictMode;n.set("strictMode",{tagFilter:o,formatFilter:o,classFilter:o,textStyleTagFilter:o,attrFilter:o,styleFilter:o,..."boolean"==typeof t.strictMode?{}:t.strictMode}),n.set("freeCodeViewMode",!!t.freeCodeViewMode),n.set("__lineFormatFilter",t.__lineFormatFilter??!0),n.set("__pluginRetainFilter",t.__pluginRetainFilter??!0),n.set("mode",t.mode||"classic"),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())):Vt.SIZE_UNITS),n.set("allowedClassName",new RegExp(`${t.allowedClassName&&"string"==typeof t.allowedClassName?t.allowedClassName+"|":""}${Vt.CLASS_NAME}`)),n.set("closeModalOutsideClick",!!t.closeModalOutsideClick),n.set("copyFormatKeepOn",!!t.copyFormatKeepOn),n.set("syncTabIndent",t.syncTabIndent??!0),n.set("autoLinkify",t.autoLinkify??!!i.link),n.set("autoStyleify",Array.isArray(t.autoStyleify)?t.autoStyleify:["bold","underline","italic","strike"]);let l=t.retainStyleMode;"string"!=typeof l||Vt.RETAIN_STYLE_MODE.includes(l)||(console.error(`Invalid retainStyleMode: ${l}. Valid options are ${Vt.RETAIN_STYLE_MODE.join(", ")}. Using default 'once'.`),l="repeat"),n.set("retainStyleMode",l);const r={...Vt.EXTRA_TAG_MAP,...t.allowedExtraTags,"-":!0},a=Object.keys(r),h=a.filter((t=>r[t])).join("|"),c=a.filter((t=>!r[t])).join("|");n.set("_allowedExtraTag",h),n.set("_disallowedExtraTag",c),n.set("events",t.events||{}),n.set("textStyleTags",("string"==typeof t.__textStyleTags?t.__textStyleTags:Vt.TEXT_STYLE_TAGS)+(t.textStyleTags?"|"+t.textStyleTags:""));const d=zt({bold:"strong",underline:"u",italic:"em",strike:"del",subscript:"sub",superscript:"sup"},t.convertTextTags||{});n.set("convertTextTags",d),n.set("_textStyleTags",Object.values(d).concat(["span","li"])),n.set("tagStyles",[{...Vt.TAG_STYLES,...t.__tagStyles||{}},t.tagStyles||{}].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{})),n.set("_textStylesRegExp",new RegExp(`\\s*[^-a-zA-Z](${Vt.SPAN_STYLES}${t.spanStyles?"|"+t.spanStyles:""})\\s*:[^;]+(?!;)*`,"gi")),n.set("_lineStylesRegExp",new RegExp(`\\s*[^-a-zA-Z](${Vt.LINE_STYLES}${t.lineStyles?"|"+t.lineStyles:""})\\s*:[^;]+(?!;)*`,"gi")),n.set("_defaultStyleTagMap",{strong:d.bold,b:d.bold,u:d.underline,ins:d.underline,em:d.italic,i:d.italic,del:d.strike,strike:d.strike,s:d.strike,sub:d.subscript,sup:d.superscript}),n.set("_styleCommandMap",zt(wt.swapKeyValue(d),{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:d.bold,underline:d.underline,italic:d.italic,strike:d.strike,subscript:d.sub,superscript:d.sup}),n.set("textDirection","string"!=typeof t.textDirection?"ltr":t.textDirection),n.set("_rtl","rtl"===n.get("textDirection")),n.set("reverseCommands",["indent-outdent"].concat(t.reverseButtons||[])),n.set("_reverseCommandArray",("-"+n.get("reverseCommands").join("-")).split("-")),kt.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("_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||Vt.SCOPE_SELECTION_TAGS);const u=("string"==typeof t.elementWhitelist?t.elementWhitelist:"").toLowerCase(),p=n.get("externalLibs").mathjax?Vt.CLASS_MJX+"|":"";n.set("elementWhitelist",u+(u?"|":"")+p+n.get("_allowedExtraTag"));const g=(m=("string"==typeof t.elementBlacklist?t.elementBlacklist:"").toLowerCase(),f=(f=n.get("defaultLine")).toLowerCase(),m.split("|").filter((function(t){return t!==f||(console.warn(`[SUNEDITOR.constructor.createBlacklist.warn] defaultLine("<${f}>") cannot be included in the blacklist and will be removed.`),!1)})).join("|"));var m,f;if(n.set("elementBlacklist",g+(g?"|":"")+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",Ut(t.formatClosureBrLine,(t.__defaultFormatClosureBrLine="string"==typeof t.__defaultFormatClosureBrLine?t.__defaultFormatClosureBrLine:Vt.FORMAT_CLOSURE_BR_LINE).toLowerCase(),n.get("elementBlacklist"))),n.set("formatBrLine",Ut((t.formatBrLine||"")+"|"+n.get("formatClosureBrLine").str,(t.__defaultFormatBrLine="string"==typeof t.__defaultFormatBrLine?t.__defaultFormatBrLine:Vt.FORMAT_BR_LINE).toLowerCase(),n.get("elementBlacklist"))),n.set("formatLine",Ut(Vt.REQUIRED_FORMAT_LINE+"|"+(t.formatLine||"")+"|"+n.get("formatBrLine").str,(t.__defaultFormatLine="string"==typeof t.__defaultFormatLine?t.__defaultFormatLine:Vt.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",Ut(t.formatClosureBlock,(t.__defaultFormatClosureBlock="string"==typeof t.__defaultFormatClosureBlock?t.__defaultFormatClosureBlock:Vt.FORMAT_CLOSURE_BLOCK).toLowerCase(),n.get("elementBlacklist"))),n.set("formatBlock",Ut((t.formatBlock||"")+"|"+n.get("formatClosureBlock").str,(t.__defaultFormatBlock="string"==typeof t.__defaultFormatBlock?t.__defaultFormatBlock:Vt.FORMAT_BLOCK).toLowerCase(),n.get("elementBlacklist"))),n.set("allowedEmptyTags",Vt.ALLOWED_EMPTY_NODE_LIST+(t.allowedEmptyTags?", "+t.allowedEmptyTags:"")),n.set("__defaultElementWhitelist",Vt.REQUIRED_ELEMENT_WHITELIST+"|"+("string"==typeof t.__defaultElementWhitelist?t.__defaultElementWhitelist:Vt.ELEMENT_WHITELIST).toLowerCase()),n.set("__defaultAttributeWhitelist",("string"==typeof t.__defaultAttributeWhitelist?t.__defaultAttributeWhitelist:Vt.ATTRIBUTE_WHITELIST).toLowerCase()),n.set("_editorElementWhitelist","*"===n.get("elementWhitelist")?"*":function(t){const e=t.get("elementBlacklist").split("|"),i=(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,i,s)=>t&&s.indexOf(t)===i&&!e.includes(t)));return i.join("|")}(n)),n.set("toolbar_width",t.toolbar_width?kt.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?Rt.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:kt.is(t.toolbar_sticky)?kt.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?kt.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 v=new Map;for(let i=0,s=e.length;i<s;i++)v.set(e[i].key,Dt(e[i].options||{},t));n.set("tabDisable",!!t.tabDisable),n.set("shortcutsHint",void 0===t.shortcutsHint||!!t.shortcutsHint);const _=void 0===t.shortcutsDisable||t.shortcutsDisable?[{selectAll:["c+KeyA","A"],bold:["c+KeyB","B"],strike:["c+s+KeyS","S"],underline:["c+KeyU","U"],italic:["c+KeyI","I"],redo:["c+KeyY","Y","c+s+KeyZ","Z"],undo:["c+KeyZ","Z"],indent:["c+BracketRight","]"],outdent:["c+BracketLeft","["],save:["c+KeyS","S"],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 i in e)t[i]=e[i];return t}),{}):{};n.set("shortcuts",_),n.set("fullScreenOffset",void 0===t.fullScreenOffset?0:kt.is(t.fullScreenOffset)?kt.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 C=n.get("externalLibs").codeMirror;C&&(n.set("codeMirror",C),C.EditorView?n.set("codeMirror6Editor",!0):C.src?n.set("codeMirror5Editor",!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 w=t.icons&&"object"==typeof t.icons?[Ht,t.icons].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{}):Ht;n.set("icons",w);const x=new Set(Vt.CONTENT_STYLES.split("|")),k=t.spanStyles?.split("|")||[],E=n.get("__listCommonStyle"),S=Vt.SPAN_STYLES.split("|");for(let t=0,e=S.length;t<e;t++)x.add(S[t]);for(const t of Object.values(n.get("tagStyles"))){const e=t.split("|");for(let t=0,i=e.length;t<i;t++)x.add(e[t])}for(let t=0,e=k.length;t<e;t++)x.add(k[t]);for(let t=0,e=E.length;t<e;t++)x.add(E[t]);const T=("string"==typeof t.allUsedStyles?t.allUsedStyles.split("|"):t.allUsedStyles)||[];for(let t=0,e=T.length;t<e;t++)x.add(T[t]);return n.set("allUsedStyles",x),n.set("toastMessageTime",{copy:1500,...t.toastMessageTime}),{o:n,i:w,l:t.lang||Mt(),v:t.value="string"==typeof t.value?t.value:null,buttons:n.get("_rtl")?s.reverse():s,subButtons:b,statusbarContainer:"string"==typeof t.statusbar_container?Rt.querySelector(t.statusbar_container):t.statusbar_container,frameMap:v}}function Pt(t,e){let i=null,s=null,n=null;if(t.get("statusbar")&&(e||=xt.utils.createElement("DIV",{class:"se-status-bar sun-editor-common"}),i=e.querySelector(".se-navigation")||xt.utils.createElement("DIV",{class:"se-navigation sun-editor-common"}),e.appendChild(i),t.get("charCounter"))){if(s=e.querySelector(".se-char-counter-wrapper")||xt.utils.createElement("DIV",{class:"se-char-counter-wrapper"}),t.get("charCounter_label")){const e=s.querySelector(".se-char-label")||xt.utils.createElement("SPAN",{class:"se-char-label"});e.textContent=t.get("charCounter_label"),s.appendChild(e)}if(n=s.querySelector(".se-char-counter")||xt.utils.createElement("SPAN",{class:"se-char-counter"}),n.textContent="0",s.appendChild(n),t.get("charCounter_max")>0){const e=s.querySelector(".se-char-max")||xt.utils.createElement("SPAN",{class:"se-char-max"});e.textContent=" / "+t.get("charCounter_max"),s.appendChild(e)}e.appendChild(s)}return{statusbar:e,navigation:i,charWrapper:s,charCounter:n}}function Dt(t,e){const i=new Map;i.set("_origin",t);const s=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,b=void 0===t.iframe_cssFileName?e.iframe_cssFileName:t.iframe_cssFileName,y=s||void 0===t.statusbar?e.statusbar:t.statusbar,v=s||void 0===t.statusbar_showPathLabel?e.statusbar_showPathLabel:t.statusbar_showPathLabel,_=!s&&(void 0===t.statusbar_resizeEnable?e.statusbar_resizeEnable:t.statusbar_resizeEnable),C=s||void 0===t.charCounter?e.charCounter:t.charCounter,w=s||void 0===t.charCounter_max?e.charCounter_max:t.charCounter_max,x=s||void 0===t.charCounter_label?e.charCounter_label:t.charCounter_label,k=s||void 0===t.charCounter_type?e.charCounter_type:t.charCounter_type;i.set("value",n),i.set("placeholder",o),i.set("editableFrameAttributes",{spellcheck:"false",...l}),i.set("width",r?kt.is(r)?r+"px":r:"100%"),i.set("minWidth",(kt.is(a)?a+"px":a)||""),i.set("maxWidth",(kt.is(h)?h+"px":h)||""),i.set("height",c?kt.is(c)?c+"px":c:"auto"),i.set("minHeight",(kt.is(d)?d+"px":d)||""),i.set("maxHeight",(kt.is(u)?u+"px":u)||""),i.set("editorStyle",p),i.set("_defaultStyles",wt._setDefaultOptionStyle(i,"string"==typeof p?p:"")),i.set("iframe",!(!m&&!g)),i.set("iframe_fullPage",!!m),i.set("iframe_attributes",f||{}),i.set("iframe_cssFileName",g?("string"==typeof b?[b]:b)||["suneditor"]:null);const E=void 0===y||!!y;return i.set("statusbar",E),i.set("statusbar_showPathLabel",!!E&&("boolean"!=typeof v||v)),i.set("statusbar_resizeEnable",!!E&&(void 0===_||!!_)),i.set("charCounter",w>0||"boolean"==typeof C&&C),i.set("charCounter_max",kt.is(w)&&w>-1?1*w:null),i.set("charCounter_label","string"==typeof x?x.trim():null),i.set("charCounter_type","string"==typeof k?k:"char"),i}function qt(t,e,i,s){const n=s.get("_defaultStyles");i.style.cssText=n.top;const o=xt.utils.createElement(s.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(s.get("iframe")){const t=o,e=s.get("iframe_attributes");let i=e.sandbox;if(i){const t=["allow-same-origin"],e=i.split(/\s+/),s=t.filter((t=>!e.includes(t)));s.length>0&&(i=e.concat(s).join(" "))}else i="allow-same-origin";t.setAttribute("sandbox",i),t.setAttribute("frameBorder","0");for(const i in e)"sandbox"!==i&&t.setAttribute(i,e[i]);t.allowFullscreen=!0,t.setAttribute("scrolling","auto"===s.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=xt.utils.createElement("TEXTAREA",{class:"se-wrapper-inner se-code-viewer",style:n.frame}),r=xt.utils.createElement("SPAN",{class:"se-placeholder"});return s.get("placeholder")&&(r.textContent=s.get("placeholder")),{bottomBar:Pt(s,null),wysiwygFrame:o,codeView:l,placeholder:r}}function Wt(t,e,i){let s=null,n=!1;if(t.get("codeMirror6Editor")){const o=t.get("codeMirror"),l=i.style.cssText,r=new o.EditorView({parent:i.parentElement,extensions:o.extensions,state:o.state});e.set("codeMirror6Editor",r),s=r.dom,s.style.cssText=l,n=!0}else if(t.get("codeMirror5Editor")){const o=t.get("codeMirror"),l=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!0},o.options||{}].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{});"auto"===e.get("height")&&(l.viewportMargin=1/0,l.height="auto");const r=i.style.cssText,a=o.src.fromTextArea(i,l);e.set("codeMirror5Editor",a),s=a.display.wrapper,s.style.cssText=r,n=!0}return t.set("hasCodeMirror",n),s?(xt.utils.removeItem(i),s.className+=" se-code-viewer-mirror",s):i}function Ut(t,e,i){const s=i.split("|"),n=(e+"|"+("string"==typeof t?t.toLowerCase():"")).replace(/^\||\|$/g,"").split("|").filter((t=>t&&!s.includes(t))).join("|");return{reg:new RegExp(`^(${n})$`,"i"),str:n}}function Zt(){const t=xt.utils.createElement("UL",{class:"se-menu-list"});return{div:xt.utils.createElement("DIV",{class:"se-btn-module se-btn-module-border"},t),ul:t}}function Gt(t,e,i,s,n,o,l){n||="";const r=xt.utils.createElement("LI"),a=e||"",h=/^INPUT|FIELD$/i.test(s),c="se-toolbar-separator-vertical"===t?xt.utils.createElement("DIV",{class:t,tabindex:"-1"},null):xt.utils.createElement(h?"DIV":"BUTTON",{class:"se-toolbar-btn se-btn se-tooltip"+(t?" "+t:""),"data-command":i,"data-type":s,"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(s)&&xt.utils.addClass(r,"se-toolbar-hidden-btn"),a&&(n+=xt.utils.createTooltipInner(a)),n&&(c.innerHTML=n),r.appendChild(c),{li:r,button:c}}function Yt(t,e,i,s){if(!t)return;const n=!1===e.inner;if(1===e.inner?.nodeType?t.appendChild(e.inner):t.innerHTML=n?"":(e.inner||i[e.icon]||e.icon||'<span class="se-icon-text">!</span>')+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+(s[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&&(xt.utils.addClass(e.afterItem,"se-toolbar-btn"),t.parentElement.appendChild(e.afterItem),xt.utils.addClass(t,"se-side-btn-a"),xt.utils.addClass(e.afterItem,"se-side-btn-after")),e.beforeItem&&(xt.utils.addClass(e.beforeItem,"se-toolbar-btn"),t.parentElement.insertBefore(e.beforeItem,t),e.afterItem?(xt.utils.addClass(t,"se-side-btn"),xt.utils.removeClass(t,"se-side-btn-a")):xt.utils.addClass(t,"se-side-btn-b"),xt.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&&(xt.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 jt(t,e,i,s,n,o){t=JSON.parse(JSON.stringify(t));const l=function(t,e,i){const s=t.get("_rtl");return{bold:["",i.bold,"bold","",e.bold],underline:["",i.underline,"underline","",e.underline],italic:["",i.italic,"italic","",e.italic],strike:["",i.strike,"strike","",e.strike],subscript:["",i.subscript,"subscript","",e.subscript],superscript:["",i.superscript,"superscript","",e.superscript],removeFormat:["",i.removeFormat,"removeFormat","",e.remove_format],copyFormat:["",i.copyFormat,"copyFormat","",e.format_paint],indent:["se-icon-flip-rtl",i.indent,"indent","",s?e.outdent:e.indent],outdent:["se-icon-flip-rtl",i.outdent,"outdent","",s?e.indent:e.outdent],fullScreen:["se-code-view-enabled se-component-enabled",i.fullScreen,"fullScreen","",e.expansion],showBlocks:["",i.showBlocks,"showBlocks","",e.show_blocks],codeView:["se-code-view-enabled se-component-enabled",i.codeView,"codeView","",e.code_view],undo:["se-component-enabled",i.undo,"undo","",e.undo],redo:["se-component-enabled",i.redo,"redo","",e.redo],preview:["se-component-enabled",i.preview,"preview","",e.preview],print:["se-component-enabled",i.print,"print","",e.print],copy:["",i.copy,"copy","",e.copy],dir:["",i[s?"dir_ltr":"dir_rtl"],"dir","",e[s?"dir_ltr":"dir_rtl"]],dir_ltr:["",i.dir_ltr,"dir_ltr","",e.dir_ltr],dir_rtl:["",i.dir_rtl,"dir_rtl","",e.dir_rtl],save:["se-component-enabled",i.save,"save","",e.save],newDocument:["se-component-enabled",i.newDocument,"newDocument","",e.new_document],selectAll:["se-component-enabled",i.selectAll,"selectAll","",e.select_all],pageBreak:["se-component-enabled",i.pageBreak,"pageBreak","",e.page_break],pageUp:["se-component-enabled",i.pageUp,"pageUp","",e.page_up],pageDown:["se-component-enabled",i.pageDown,"pageDown","",e.page_down],pageNavigator:["se-component-enabled","","pageNavigator","input",""]}}(i,s,n),r={},a=[],h=[];let c=null,d=null,u=null,p=null,g=null;const m=xt.utils.createElement("DIV",{class:"se-toolbar-more-layer"}),f=xt.utils.createElement("DIV",{class:"se-btn-tray"}),b=xt.utils.createElement("DIV",{class:"se-toolbar-separator-vertical"});t:for(let i,y,v,_,C,w=0;w<t.length;w++)if(i=!1,C="",_=t[w],p=Zt(),"object"==typeof _){for(let f,b=0;b<_.length;b++){if(d=_[b],f=!1,u=e[d],/^%\d+/.test(d)&&0===b){_[0]=d.replace(/[^\d]/g,""),a.push(_),t.splice(w--,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(/^:([^-]+)-([^-]+)/);v="__se__more_"+w;const e=t[1].trim(),i=t[2].trim();c=["se-btn-more",/^lang\./i.test(e)?n[e.replace(/^lang\./i,"")]:e,v,"MORE",i]}else"|"===d?c=["se-toolbar-separator-vertical","","","separator",""]:("copy"!==d||_t.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=Gt(c[0],c[1],c[2],c[3],c[4],c[5],s),(i?y: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&&(i=!0,y=xt.utils.createElement("DIV"),y.className="se-more-layer "+v,y.setAttribute("data-ref",v),y.innerHTML='<div class="se-more-form"><ul class="se-menu-list"'+(C?' style="float: '+C+';"':"")+"></ul></div>",m.appendChild(y),y=y.firstElementChild.firstElementChild)}f.appendChild(p.div)}else{if("|"===_){const t=b.cloneNode(!1);f.appendChild(t);continue}if(/^\/$/.test(_)){const t=xt.utils.createElement("DIV",{class:"se-btn-module-enter"});f.appendChild(t)}}switch(f.children.length){case 0:f.style.display="none";break;case 1:xt.utils.removeClass(f.firstElementChild,"se-btn-module-border")}m.children.length>0&&f.appendChild(m),a.length>0&&a.unshift(t);const y=xt.utils.createElement("DIV",{class:"se-toolbar sun-editor-common"+(i.get("shortcutsHint")?"":" se-shortcut-hide")},f);return i.get("toolbar_hide")&&(y.style.display="none"),{element:y,pluginCallButtons:r,responsiveButtons:a,buttonTray:f,updateButtons:h}}const Xt=function(t,e){"object"!=typeof e&&(e={});const i={};if(e.plugins){const t=e.excludedPlugins||[],s=e.plugins,n=(Array.isArray(s)?s:Object.keys(s)).filter((e=>!t.includes(e))).map((t=>s[t]));for(let t,e=0,s=n.length;e<s;e++)t=n[e].default||n[e],i[t.key]=t}const s=$t(e,t,i),n=s.o,o=s.i,l=s.l,r=xt.utils.createElement("DIV",{class:"se-loading-box sun-editor-common"},'<div class="se-loading-effect"></div>'),a=xt.utils.createElement("DIV",{class:"sun-editor sun-editor-carrier-wrapper sun-editor-common"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),h=xt.utils.createElement("DIV",{class:"se-menu-tray"});a.appendChild(h);const c=xt.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=xt.utils.createElement("DIV",{class:"se-modal se-modal-area sun-editor-common"}),u=xt.utils.createElement("DIV",{class:"se-modal-back"}),p=xt.utils.createElement("DIV",{class:"se-modal-inner"});d.appendChild(u),d.appendChild(p),a.appendChild(d);const g=xt.utils.createElement("DIV",{class:"se-alert se-modal-area sun-editor-common",style:"display: none;"}),m=xt.utils.createElement("DIV",{class:"se-modal-back"}),f=xt.utils.createElement("DIV",{class:"se-modal-inner"});g.appendChild(m),g.appendChild(f),a.appendChild(g),a.appendChild(xt.utils.createElement("DIV",{class:"se-back-wrapper"})),a.appendChild(r.cloneNode(!0));const b=xt.utils.createElement("DIV",{class:"se-drag-cursor"});a.appendChild(b),Rt.body.appendChild(a);let y=null,v=null;const _=jt(s.buttons,i,n,o,l,!1),C=_.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(xt.utils.createElement("DIV",{class:"se-arrow"}))),s.subButtons&&(v=jt(s.subButtons,i,n,o,l,!1),y=v.element,y.style.visibility="hidden",y.className+=" se-toolbar-balloon se-toolbar-sub",y.style.width=n.get("toolbar_sub_width"),y.appendChild(xt.utils.createElement("DIV",{class:"se-arrow"})));const w=t[0].key||null,x=[],k=new Map,E=s.statusbarContainer;let S=null;for(let e=0,i=t.length;e<i;e++){const i=t[e],a=s.frameMap.get(i.key),h=xt.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),c=xt.utils.createElement("DIV",{class:"se-container"}),d=xt.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(xt.utils.createElement("DIV",{class:"se-toolbar-shadow"}));const u=qt(i.key,n,h,a),p=u.bottomBar.statusbar,g=u.wysiwygFrame,m=u.placeholder;let f=u.codeView;const b=xt.utils.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-t",title:l.insertLine},o.line_break),y=xt.utils.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-b",title:l.insertLine},o.line_break);d.appendChild(b),d.appendChild(y),m&&d.appendChild(m),c.appendChild(xt.utils.createElement("DIV",{class:"se-toolbar-sticky-dummy"})),c.appendChild(d),p&&(E?S||(E.appendChild(xt.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")},p)),S=p):c.appendChild(p)),c.appendChild(r.cloneNode(!0));const v=i.key||null,_=xt.utils.createElement("DIV",{class:"se-code-wrapper"},f);_.style.setProperty("display","none","important"),d.appendChild(_);const C=Wt(n,a,f);if(f===C){const t=xt.utils.createElement("TEXTAREA",{class:"se-code-view-line",readonly:"true"},null);_.insertBefore(t,f)}else f=C;const w={inner:null,page:null,pageMirror:null};n.get("_type_options").includes("header")&&(w.inner=xt.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")&&(w.page=xt.utils.createElement("DIV",{class:"se-document-page"},null),w.pageMirror=xt.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(v),k.set(v,At({target:i.target,key:i.key,options:a},h,g,_,f,S||p,w,v))}const T=n.get("toolbar_container");if(T){const t=xt.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),e=xt.utils.createElement("DIV",{class:"se-container"});e.appendChild(C),y&&e.appendChild(y),t.appendChild(e),T.appendChild(t),T.appendChild(xt.utils.createElement("DIV",{class:"se-toolbar-sticky-dummy"}))}else{const t=k.get(w).get("container");t.insertBefore(C,t.firstElementChild),y&&t.insertBefore(y,t.firstElementChild)}return{context:Nt(C,T,h,y,E),carrierWrapper:a,options:n,plugins:i,icons:o,lang:l,value:s.v,rootId:w,rootKeys:x,frameRoots:k,pluginCallButtons:_.pluginCallButtons,responsiveButtons:_.responsiveButtons,pluginCallButtons_sub:v?v.pluginCallButtons:[],responsiveButtons_sub:v?v.responsiveButtons:[]}},{NO_EVENT:Kt}=_t,Jt={bold:["font-weight"],underline:["text-decoration"],italic:["font-style"],strike:["text-decoration"]};let Qt=null,te=null;const ee=function(t,e){return Qt=this.eventManager.removeGlobalEvent("keydown",Qt),te=this.eventManager.removeGlobalEvent("mousedown",te),this._onCopyFormatInfo=null,this._onCopyFormatInitMethod=null,xt.utils.removeClass(t,"se-copy-format-cursor"),xt.utils.removeClass(e,"on"),!0},ie=function(t){const e=xt.check.isContentLess;return{first:xt.query.getEdgeChild(xt.query.getEdgeChild(t,(t=>!e(t)),!1),(t=>0===t.childNodes.length||3===t.nodeType||z(t)||F(t)),!1)||t.firstChild,last:xt.query.getEdgeChild(t.lastChild,(t=>0===t.childNodes.length||3===t.nodeType||z(t)||F(t)),!0)||t.lastChild}},se=["bold","underline","italic","strike","subscript","superscript","indent","outdent"],ne=se.concat(["undo","redo","save","fullScreen","showBlocks","codeView","dir","dir_ltr","dir_rtl"]);function oe(t,e){if("function"==typeof t._onCopyFormatInitMethod)return void t._onCopyFormatInitMethod();const i=t.frameContext.get("wysiwyg");t._onCopyFormatInfo=[...t.eventManager.__cacheStyleNodes],t._onCopyFormatInitMethod=ee.bind(t,i,e),xt.utils.addClass(i,"se-copy-format-cursor"),xt.utils.addClass(e,"on"),Qt=t.eventManager.addGlobalEvent("keydown",(e=>{Et.isEsc(e.code)&&t._onCopyFormatInitMethod?.()})),te=t.eventManager.addGlobalEvent("mousedown",(s=>{i.contains(s.target)||s.target===e||t._onCopyFormatInitMethod?.()}))}function le(t){const e=t.frameRoots;let i,s,o,l,r=t.options.get("historyStackDelayTime"),a=null,h=!1,c=null;function d(e,i,s){s&&t.status.hasFocus&&t.eventManager.applyTagEffect(),t.history.resetButtons(e.get("key"),i),t.triggerEvent("onChange",{frameContext:e,data:e.get("wysiwyg").innerHTML}),"block"===t.context.get("toolbar_main").style.display?t.toolbar._showBalloon():t.isSubBalloon&&"block"===t.context.get("toolbar_sub_main").style.display&&t.subToolbar._showBalloon()}function u(n){const l=s[i],r=o[l],a=t.frameContext;i+=n;const h=n<0&&l!==s[i]&&r.index>0?l:s[i],c=o[h];c.index+=n;const u=c.value[c.index];e.get(h).get("wysiwyg").innerHTML=u.content,l!==h&&n<0&&1===i?i=0:l!==h&&n>0&&1===c.index?i++:(n<0&&c.index<1||n>0&&c.index>c.value.length)&&(i+=n);let p=h,g=u;if(n<0&&i>0&&0===c.index){const t=s[i+n];if(t!==h){const e=o[t];p=t,g=e.value[e.index]}}t.changeFrameContext(p),t.selection.setRange(st(g.s.path,g.frame),g.s.offset,st(g.e.path,g.frame),g.e.offset),t.focus(),i<0?i=0:i>=s.length&&(i=s.length-1),t.ui._offCurrentController(),t._checkComponents(!1),t.char.display(),t._resourcesStateChange(a),a.has("documentType_use_header")&&a.get("documentType").reHeader(),d(a,c.index,!0)}function p(t,n,l,r){let a,h;n?(a={path:it(n.startContainer,null,null),offset:n.startOffset},h={path:it(n.endContainer,null,null),offset:n.endOffset}):(a={path:[0,0],offset:[0,0]},h={path:0,offset:0}),i+=r,s[i]=l;const c=o[l];c.index+=r,c.value[c.index]={content:t,s:a,e:h,frame:e.get(l).get("wysiwyg")}}function g(t){o[t]={value:[],index:-1},l[t]=e.get(t).get("wysiwyg").innerHTML}function m(n,r){t._checkComponents(!1);const a=e.get(n),h=a.get("wysiwyg").innerHTML,c=o[n];!h||c.value[c.index]&&h===c.value[c.index].content||(s.length>i+1&&function(e){const n=[];for(let t=i+1,e=s.length;t<e;t++)n.includes(s[t])||n.push(s[t]);s=s.slice(0,i+1),e.value.splice(i+1),t.applyCommandTargets("redo",(t=>{t.disabled=!0}));for(let t=0,e=n.length;t<e;t++)s.includes(n[t])||g(n[t])}(c),0===c.value.length&&function(t){i++,s[i]=t;const n=o[t];n.index=0,n.value[0]={content:l[t],s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0},frame:e.get(t).get("wysiwyg")}}(n),p(h,r,n,1),1===i&&t.applyCommandTargets("undo",(t=>{t.disabled=!1})),t.char.display(),d(a,c.index,!1))}return{push(i,s){if(h)return;s=s||null===s?s:t.status.rootKey;const o=t.status._range;n.setTimeout(t._resourcesStateChange.bind(t,e.get(s)),0);const l="number"==typeof i?i>0?i:0:i?r:0;l&&!a||(n.clearTimeout(a),l)?a=n.setTimeout((()=>{n.clearTimeout(a),a=null,m(s,o)}),l):m(s,o)},check(t,e){a&&(n.clearTimeout(a),a=null,m(t,e))},undo(){i>0&&u(-1)},redo(){s.length-1>i&&u(1)},overwrite(i){p(e.get(i||t.status.rootKey).get("wysiwyg").innerHTML,null,t.status.rootKey,0)},pause(){h=!0,c&&(n.clearTimeout(c),c=null),c=n.setTimeout((()=>{h=!1}),5e3)},resume(){c&&(n.clearTimeout(c),c=null),h=!1},reset(){t.applyCommandTargets("undo",(t=>t.disabled=!0)),t.applyCommandTargets("redo",(t=>t.disabled=!0)),t.applyCommandTargets("save",(t=>t.disabled=!0)),t.applyFrameRoots((t=>t.set("historyIndex",-1))),t.applyFrameRoots((t=>t.set("isChanged",!1))),i=-1,s=[],o={},l={},h=!1;const e=t.rootKeys;for(let t=0,i=e.length;t<i;t++)g(e[t])},resetButtons(e,n){const l=!kt.is(n),r=o[void 0===e?s[i]:e];n=l?r.index:n;const a=t.frameRoots.get(e),h=r.value.length-1;t.applyCommandTargets("undo",(t=>{t.disabled=!(n>0&&n<=h)})),t.applyCommandTargets("redo",(t=>{t.disabled=!(n>-1&&n<h)}));const c=a.get("savedIndex"),d=a.get("historyIndex"),u=c>-1?c!==n:l?r.index>0:n>0&&d!==n;a.set("historyIndex",n),a.set("isChanged",u),t.applyCommandTargets("save",(t=>{t.disabled=!u})),t.triggerEvent("onResetButtons",{rootKey:e})},getRootStack:()=>o,resetDelayTime(t){r=t},destroy(){a&&n.clearTimeout(a),i=s=o=l=null}}}function re(t){this.editor=t,this.eventManager=t.eventManager,this.instanceCheck=t.instanceCheck,this.history=t.history,this.events=t.events,this.triggerEvent=t.triggerEvent,this.carrierWrapper=t.carrierWrapper,this.plugins=t.plugins,this.status=t.status,this.frameContext=t.frameContext,this.frameOptions=t.frameOptions,this.context=t.context,this.options=t.options,this.icons=t.icons,this.lang=t.lang,this.frameRoots=t.frameRoots,this._w=t._w,this._d=t._d}const ae=new Map([["__figureInst",null],["__dragInst",null],["__dragHandler",null],["__dragContainer",null],["__dragCover",null],["__dragMove",null],["__overInfo",null]]),he=ae,{isMobile:ce}=_t;function de(t){const e=xt.query.getEventTarget(t);let i=e;this.editor.isSubBalloon&&!this.context.get("toolbar_sub_main")?.contains(i)&&this._hideToolbar_sub();const s=xt.check.isInputElement(i);if(s?this.editor._preventBlur=!1:this.frameContext.get("wysiwyg").contains(this.selection.getNode())||this.editor.focus(),xt.query.getParentElement(i,".se-dropdown"))t.stopPropagation(),this.editor._notHideToolbar=!0;else{let n=i.getAttribute("data-command"),o=i.className;for(;i&&!n&&!/(se-menu-list|sun-editor-common|se-menu-tray)/.test(o);)i=i.parentElement,n=i.getAttribute("data-command"),o=i.className;if(s&&/^INPUT$/i.test(i?.getAttribute("data-type"))){if(this.editor._preventBlur=this._inputFocus=!0,this.status.hasFocus||this.applyTagEffect(),!xt.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.addEvent(e,"blur",(i=>{if(!t.isInputActive)try{const s=e.value.trim();"function"==typeof t.toolbarInputChange&&s!==this.__inputPlugin.value&&t.toolbarInputChange({target:e,value:s,event:i})}finally{this._w.setTimeout((()=>this._inputFocus=!1),0),this.__removeInput()}})),!t)return;"function"==typeof t.toolbarInputKeyDown&&(this.__inputKeyEvent=this.addEvent(e,"keydown",(i=>{t.toolbarInputKeyDown({target:e,event:i})})))}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")||(ce?this.editor._preventBlur=!0:(t.preventDefault(),_t.isGecko&&n&&this._injectActiveEvent(i)))}n!==this.menu.currentDropdownName&&n!==this.menu.currentContainerName||t.stopPropagation()}}function ue(t){const e=xt.query.getEventTarget(t),i=xt.query.getCommandTarget(e);if(!i)return;let s=i,n="";for(;s&&!/se-menu-tray/.test(s.className)&&!n;)s=s.parentElement,n=s?.getAttribute("data-key");if(!n)return;const o=this.plugins[n];o&&"function"==typeof o.action&&(t.stopPropagation(),o.action(i))}function pe(t){const e=xt.query.getEventTarget(t);this.editor.runFromTarget(e)}const{_w:ge}=_t;let me=null;function fe(){this.editor.status._onMousedown=!1,me=this.removeGlobalEvent(me)}async function be(t,e){const i=xt.query.getEventTarget(e);this.editor.status._onMousedown=!0,me&&fe.call(this),me=this.addGlobalEvent("mouseup",fe.bind(this)),t.get("isReadOnly")||xt.check.isNonEditable(t.get("wysiwyg"))||(this.format._isExcludeSelectionElement(i)?e.preventDefault():(this._setSelectionSync(),this._w.setTimeout(this.selection._init.bind(this.selection),0),!1!==await this.triggerEvent("onMouseDown",{frameContext:t,event:e})&&!1!==await this._callPluginEventAsync("onMouseDown",{frameContext:t,event:e})&&(this.editor.isBalloon?this._hideToolbar():this.editor.isSubBalloon&&this._hideToolbar_sub(),/FIGURE/i.test(i?.nodeName)&&e.preventDefault())))}async function ye(t,e){!1!==await this.triggerEvent("onMouseUp",{frameContext:t,event:e})&&await this._callPluginEventAsync("onMouseUp",{frameContext:t,event:e})}async function ve(t,e){const i=xt.query.getEventTarget(e);if(t.get("isReadOnly"))return e.preventDefault(),xt.check.isAnchor(i)&&ge.open(i.href,i.target),!1;if(xt.check.isNonEditable(t.get("wysiwyg")))return;if(!1===await this.triggerEvent("onClick",{frameContext:t,event:e}))return;if(!1===await this._callPluginEventAsync("onClick",{frameContext:t,event:e}))return;const s=this.component.get(i);if(s)return e.preventDefault(),void this.component.select(s.target,s.pluginName);if(this.selection._init(),3===e.detail){let t=this.selection.getRange();this.format.isLine(t.endContainer)&&0===t.endOffset&&(t=this.selection.setRange(t.startContainer,t.startOffset,t.startContainer,t.startContainer.textContent.length),this.selection._rangeInfo(t,this.selection.get()))}const n=this.selection.getNode(),o=this.format.getLine(n,null),l=this.format.getBlock(n,null);if(!o&&!xt.check.isNonEditable(i)&&!xt.check.isList(l)){const t=this.selection.getRange();if(this.format.getLine(t.startContainer)===this.format.getLine(t.endContainer))if(xt.check.isList(l)){e.preventDefault();const t=n.nextElementSibling,i=xt.utils.createElement("LI",null,n);l.insertBefore(i,t),this.editor.focus()}else xt.check.isWysiwygFrame(n)||this.component.is(n)||xt.check.isTableElements(n)&&!xt.check.isTableCell(n)||null===this._setDefaultLine(this.format.isBlock(l)?"DIV":this.options.get("defaultLine"))||(e.preventDefault(),this.editor.focus())}if(this.editor._onCopyFormatInfo)try{const t=[...this.editor._onCopyFormatInfo],e=t.pop();if(this.inline.remove(),e){const i=this.inline.apply(e,{stylesToModify:null,nodesToRemove:[e.nodeName],strictRemove:!1}),{parent:s,inner:n}=this.nodeTransform.createNestedNode(t);i.parentNode.insertBefore(s,i),n.appendChild(i),this.selection.setRange(i,xt.check.isZeroWidth(i)?1:0,i,1)}if(this.options.get("copyFormatKeepOn"))return;this.editor._onCopyFormatInitMethod()}catch(t){console.warn("[SUNEDITOR.copyFormat.error] ",t),this.editor._onCopyFormatInitMethod?.()||(this.editor._onCopyFormatInfo=null,this.editor._onCopyFormatInitMethod=null)}(this.editor.isBalloon||this.editor.isSubBalloon)&&this._w.setTimeout(this._toggleToolbarBalloon.bind(this),0)}function _e(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return!1;const i=xt.query.getEventTarget(e);!1!==he.get("__overInfo")&&this.component.hoverSelect(i),this._callPluginEvent("onMouseMove",{frameContext:t,event:e})}async function Ce(t,e){!1!==await this.triggerEvent("onMouseLeave",{frameContext:t,event:e})&&await this._callPluginEventAsync("onMouseLeave",{frameContext:t,event:e})}async function we(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;const i=(null===e.data?"":void 0===e.data?" ":e.data)||"";if(Et.isComposing(e))this._handledInBefore=!1;else{if(!this.char.test(i,!1))return e.preventDefault(),e.stopPropagation(),!1;this._handledInBefore=!0}!1!==await this.triggerEvent("onBeforeInput",{frameContext:t,event:e,data:i})&&await this._callPluginEventAsync("onBeforeInput",{frameContext:t,event:e,data:i})}async function xe(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;const i=this.selection.getRange(),s=this.selection.getNode(),n=this.format.getLine(s,null);if(!this.format.isNormalLine(n)&&!this.format.isBrLine(n)&&i.collapsed&&!this.component.is(s)&&!xt.check.isList(s)){const t=this.format.getBlock(s,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.triggerEvent("onInput",{frameContext:t,event:e,data:o})&&(await this._callPluginEventAsync("onInput",{frameContext:t,event:e,data:o}),this.history.push(!0))}const ke={"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),"editor._nativeFocus":({ports:t})=>t.editor._nativeFocus(),"history.push":({ports:t},e)=>t.history.push(e),"documentType.refreshHeader":({ctx:t})=>{n.setTimeout((()=>{t.fc.get("documentType").reHeader()}),0)},"component.deselect":({ports:t})=>t.component.deselect(),"selection.setRange":({ports:t},{sc:e,so:i,ec:s,eo:n})=>t.selection.setRange(e,i,s,n),"format.removeBlock":({ports:t},{rangeEl:e,selectedFormats:i,newBlockElement:s,shouldDelete:n,skipHistory:o})=>t.format.removeBlock(e,{selectedFormats:i,newBlockElement:s,shouldDelete:n,skipHistory:o}),"dom.utils.removeItem":(t,{item:e})=>xt.utils.removeItem(e),"select.component.fallback":({ports:t},{cmponentInfo:e})=>{!1===t.component.select(e.target,e.pluginName)&&t.editor.blur()}},Ee={"del.format.removeAndMove":({ports:t},{container:e,formatEl:i})=>{const s=t.html.remove();if(s.commonCon!==s.container&&i.parentElement)if(i.contains(e)){const e=function(t){const e=t.lastChild,i=t.nextElementSibling;if(!i)return e;if(xt.check.isZeroWidth(i))return xt.utils.removeItem(i),e;const s=i.childNodes;for(;s[0];)t.appendChild(s[0]);return xt.utils.removeItem(i),e}(i);t.selection.setRange(e,e.textContent.length,e,e.textContent.length)}else{const{focusNode:e,focusOffset:s}=function(t){const e=t.childNodes,i=t.previousElementSibling;let s=e[0],n=0;if(!i)return{focusNode:s,focusOffset:n};if(xt.check.isZeroWidth(i))return xt.utils.removeItem(i),{focusNode:s,focusOffset:n};if(e.length>1||e[0]?.textContent.length>0)for(;e[0];)i.appendChild(e[0]);else s=i.lastChild,n=s.textContent.length;return xt.utils.removeItem(t),{focusNode:s,focusOffset:n}}(i);t.selection.setRange(e,s,e,s)}},"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(xt.utils.createElement(t.options.get("defaultLine"),null,"<br>"),e)},"backspace.component.select":({ports:t},{selectionNode:e,range:i,fileComponentInfo:s})=>{let n=null;xt.check.isBreak(e)?xt.utils.removeItem(e):xt.check.isBreak(n=i.startContainer.childNodes?.[i.startOffset])&&xt.utils.removeItem(n),!1===t.component.select(s.target,s.pluginName)&&t.editor.blur()},"backspace.component.remove":({ports:t},{isList:e,sel:i,formatEl:s,fileComponentInfo:n})=>{e&&xt.utils.removeItem(i),0===s.textContent.length&&xt.utils.removeItem(s),!1===t.component.select(n.target,n.pluginName)&&t.editor.blur()},"backspace.list.mergePrev":({ports:t},{prev:e,formatEl:i,rangeEl:s})=>{let n=e===s.parentNode?s.previousSibling:e.lastChild;n||(n=xt.utils.createTextNode(Ct.zeroWidthSpace),s.parentNode.insertBefore(n,s.parentNode.firstChild));const o=3===n.nodeType?n.textContent.length:1,l=i.childNodes;let r=n,a=l[0];for(;a=l[0];)e.insertBefore(a,r.nextSibling),r=a;xt.utils.removeItem(i),0===s.children.length&&xt.utils.removeItem(s),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:i})=>{if(xt.check.isListCell(e)){const t=i.container.previousSibling;xt.check.isZeroWidth(t)&&xt.utils.removeItem(t)}else xt.check.isZeroWidth(e)&&xt.utils.removeItem(e);!1===t.component.select(i.target,i.pluginName)&&t.editor.blur()},"delete.component.selectNext":({ports:t,ctx:e},{formatEl:i,nextEl:s})=>{if(xt.check.isZeroWidth(i)&&(xt.utils.removeItem(i),xt.check.isTable(s))){let e=xt.query.getEdgeChild(s,xt.check.isTableCell,!1);return e=e.firstElementChild||e,void t.selection.setRange(e,0,e,0)}const n=t.component.get(s);n?(e.e.stopPropagation(),!1===t.component.select(n.target,n.pluginName)&&t.editor.blur()):t.component.is(s)&&(e.e.stopPropagation(),xt.utils.removeItem(s))},"delete.list.removeNested":({ports:t,ctx:e},{range:i,formatEl:s,rangeEl:n})=>{i.startContainer!==i.endContainer&&t.html.remove();const o=xt.utils.arrayFind(s.children,xt.check.isList)||s.nextElementSibling||n.parentElement.nextElementSibling;if(o&&(xt.check.isList(o)||xt.utils.arrayFind(o.children,xt.check.isList))){let i,n;if(e.e.preventDefault(),xt.check.isList(o)){const t=o.firstElementChild;for(n=t.childNodes,i=n[0];n[0];)s.insertBefore(n[0],o);xt.utils.removeItem(t)}else{for(i=o.firstChild,n=o.childNodes;n[0];)s.appendChild(n[0]);xt.utils.removeItem(o)}t.selection.setRange(i,0,i,0),t.history.push(!0)}},"tab.format.indent":({ports:t,ctx:e},{range:i,formatEl:s,shift:n})=>{const o=t.format.getLines(null),l=[],r=[],a=xt.check.isListCell(o[0]),h=xt.check.isListCell(o.at(-1));let c={sc:i.startContainer,so:i.startOffset,ec:i.endContainer,eo:i.endOffset};for(let t,e=0,i=o.length;e<i;e++)if(t=o[e],xt.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,i=0;i<=t;i++){e=r[i].childNodes;for(let t,i=0,s=e.length;i<s&&(t=e[i],t);i++)if(!xt.check.isZeroWidth(t)){/^\s{1,4}$/.test(t.textContent)?xt.utils.removeItem(t):/^\s{1,4}/.test(t.textContent)&&(t.textContent=t.textContent.replace(/^\s{1,4}/,""));break}}const e=xt.query.getEdgeChild(r[0],"text",!1),i=xt.query.getEdgeChild(r[t],"text",!0);!a&&e&&(c.sc=e,c.so=0),!h&&i&&(c.ec=i,c.eo=i.textContent.length)}else if(1===r.length){let n=e.status.tabSize+1;if(e.options.get("syncTabIndent")){const e=xt.query.findTextIndexOnLine(s,i.startContainer,i.startOffset,(e=>t.component.is(e))),o=t.format.isLine(s.previousElementSibling)?xt.query.findTabEndIndex(s.previousElementSibling,e,2):0;o>e&&(n=o-e)}const o=xt.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=xt.utils.createTextNode(new Array(e.status.tabSize+1).join(" ")),i=r.length-1;for(let e,s=0;s<=i;s++)e=r[s].firstChild,e&&(xt.check.isBreak(e)?r[s].insertBefore(t.cloneNode(!1),e):e.textContent=t.textContent+e.textContent);const s=xt.query.getEdgeChild(r[0],"text",!1),n=xt.query.getEdgeChild(r[i],"text",!0);!a&&s&&(c.sc=s,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:i})=>{const s=t.format.addLine(i,e.options.get("defaultLine")).firstChild;if(xt.check.isBreak(s)){const e=xt.utils.createTextNode(Ct.zeroWidthSpace);s.parentNode.insertBefore(e,s),t.selection.setRange(e,1,e,1)}else t.selection.setRange(s,0,s,0)},"enter.list.addItem":({ports:t},{formatEl:e,selectionNode:i})=>{const s=xt.utils.createElement("BR"),n=xt.utils.createElement("LI",null,s);e.parentNode.insertBefore(n,e.nextElementSibling),n.appendChild(i.nextSibling),t.selection.setRange(s,1,s,1)},"enter.format.exitEmpty":({ports:t,ctx:e},{formatEl:i,rangeEl:s})=>{let n=null;if(xt.check.isListCell(s.parentElement)){const t=i.parentNode.parentElement;s=t.parentElement;const o=xt.utils.createElement("LI");o.innerHTML="<br>",xt.utils.copyTagAttributes(o,i,e.options.get("lineAttrReset")),n=o,s.insertBefore(n,t.nextElementSibling)}else{let o;o=xt.check.isTableCell(s.parentElement)?"DIV":xt.check.isList(s.parentElement)?"LI":t.format.isLine(s.nextElementSibling)?s.nextElementSibling.nodeName:t.format.isLine(s.previousElementSibling)?s.previousElementSibling.nodeName:e.options.get("defaultLine"),n=xt.utils.createElement(o);const l=t.format.removeBlock(s,{selectedFormats:[i],newBlockElement:null,shouldDelete:!0,skipHistory:!0});l.cc.insertBefore(n,l.ec)}n.innerHTML="<br>",t.nodeTransform.removeAllParents(i,null,null),t.selection.setRange(n,1,n,1)},"enter.format.cleanBrAndZWS":({ports:t},{selectionNode:e,selectionFormat:i,brBlock:s,children:n,offset:o})=>{i?xt.utils.removeItem(n[o-1]):xt.utils.removeItem(e);const l=s.nextElementSibling,r=t.format.addLine(s,t.format.isLine(l)?l:null);xt.utils.copyFormatAttributes(r,s),t.selection.setRange(r,1,r,1)},"enter.format.insertBrHtml":({ports:t},{brBlock:e,range:i,wSelection:s,offset:n})=>{t.html.insert(i.collapsed&&xt.check.isBreak(i.startContainer.childNodes[i.startOffset-1])?"<br>":"<br><br>",{selectInserted:!1,skipCharCount:!0,skipCleaning:!0});let o=s.focusNode;const l=s.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 i=e.focusNode.nextSibling,s=xt.utils.createElement("BR");t.html.insertNode(s,{afterNode:null,skipCharCount:!0});const n=s.previousSibling,o=s.nextSibling;xt.check.isBreak(i)||xt.check.isBreak(n)||o&&!xt.check.isZeroWidth(o)?t.selection.setRange(o,0,o,0):(s.parentNode.insertBefore(s.cloneNode(!1),s),t.selection.setRange(s,1,s,1)),t.setOnShortcutKey(!0)},"enter.format.breakAtEdge":({ports:t,ctx:e},{formatEl:i,selectionNode:s,formatStartEdge:n,formatEndEdge:o})=>{const l=xt.utils.createElement("BR"),r=xt.utils.createElement(i.nodeName,null,l);xt.utils.copyTagAttributes(r,i,e.options.get("lineAttrReset"));let a=l,h=s;do{if(!xt.check.isBreak(h)&&1===h.nodeType){const t=h.cloneNode(!1);t.appendChild(a),a=t}h=h.parentElement}while(i!==h&&i.contains(h));if(r.appendChild(a),i.parentNode.insertBefore(r,n&&!o?i:i.nextElementSibling),o)t.selection.setRange(l,1,l,1);else{const e=i.firstChild||i;t.selection.setRange(e,0,e,0)}},"enter.format.breakWithSelection":({ports:t,ctx:e},{formatEl:i,range:s,formatStartEdge:n,formatEndEdge:o})=>{const l=t.format.getLine(s.startContainer,null)!==t.format.getLine(s.endContainer,null),r=i.cloneNode(!1);r.innerHTML="<br>";const a=s.commonAncestorContainer,h=a===s.startContainer&&a===s.endContainer&&xt.check.isZeroWidth(a)?{container:a,offset:s.endOffset,prevContainer:a.previousElementSibling,commonCon:a}:t.html.remove();let c=t.format.getLine(h.container,null),d=0;if(!c)return void(xt.check.isWysiwygFrame(h.container)&&(t.enterPrevent(e.e),e.fc.get("wysiwyg").appendChild(r),c=r,xt.utils.copyTagAttributes(c,i,e.options.get("lineAttrReset")),t.selection.setRange(c,d,c,d)));const u=t.format.getBlock(h.container);if(c=c.contains(u)?xt.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,xt.query.getNodeDepth(i));t.enterPrevent(e.e),xt.utils.copyTagAttributes(c,i,e.options.get("lineAttrReset")),t.selection.setRange(c,d,c,d)},"enter.format.breakAtCursor":({ports:t,ctx:e},{formatEl:i,range:s})=>{let n=null;n=xt.check.isZeroWidth(i)?t.format.addLine(i,i.cloneNode(!1)):t.nodeTransform.split(s.endContainer,s.endOffset,xt.query.getNodeDepth(i)),t.enterPrevent(e.e),xt.utils.copyTagAttributes(n,i,e.options.get("lineAttrReset")),t.selection.setRange(n,0,n,0)},"enter.figcaption.exitInList":({ports:t},{formatEl:e})=>{const i=t.format.addLine(e,null);t.selection.setRange(i,0,i,0)},"keydown.input.insertNbsp":({ports:t})=>{const e=t.html.insertNode(xt.utils.createTextNode(" "),{afterNode:null,skipCharCount:!0});e&&t.selection.setRange(e,e.length,e,e.length)},"keydown.input.insertZWS":({ports:t})=>{const e=xt.utils.createTextNode(Ct.zeroWidthSpace);t.html.insertNode(e,{afterNode:null,skipCharCount:!0}),t.selection.setRange(e,1,e,1)}};function Se(t){const e=t.selection.getRange(),i=e.startContainer,s=e.endContainer,n=t.format.getBlock(i),o=t.format.getBlock(s),l=xt.check.isTableCell(n),r=xt.check.isTableCell(o);if((l&&!n.previousElementSibling&&!n.parentElement.previousElementSibling||r&&!o.nextElementSibling&&!o.parentElement.nextElementSibling)&&n!==o){const i=xt.query.getParentElement(e.commonAncestorContainer,xt.check.isFigure)?.parentElement||e.commonAncestorContainer;if(l){if(r)return xt.utils.removeItem(xt.query.getParentElement(n,(t=>i===t.parentNode))),t.editor._nativeFocus(),!0;xt.utils.removeItem(xt.query.getParentElement(n,(t=>i===t.parentNode)))}else xt.utils.removeItem(xt.query.getParentElement(o,(t=>i===t.parentNode)))}const a=1===i.nodeType?xt.query.getParentElement(i,".se-component"):null,h=1===s.nodeType?xt.query.getParentElement(s,".se-component"):null;return a&&xt.utils.removeItem(a),h&&xt.utils.removeItem(h),!1}function Te(t,e,i){const s=i?e.startContainer:e.endContainer,n=i?e.startOffset:e.endOffset,o=i?"previousSibling":"nextSibling";let l;return 1===s.nodeType?(l=He(t,s.childNodes[n],o,s),xt.check.isComponentContainer(l)||xt.check.isNonEditable(l)?l:null):(l=He(t,s,o,s),xt.check.isEdgePoint(s,n,i?"front":"end")&&(xt.check.isComponentContainer(l)||xt.check.isNonEditable(l))?l:null)}function He(t,e,i,s){if(!e)return null;let n=e[i];if(!n){if(n=t.format.getLine(s),n=n?n[i]:null,!n||t.component.is(n))return null;n="previousSibling"===i?n.firstChild:n.lastChild}return n}const Le=()=>({t:"event.prevent"}),Me=()=>({t:"event.prevent.stop"}),Ne=()=>({t:"cache.styleNode"}),Ae=t=>({t:"cache.formatAttrsTemp",p:{attrs:t}}),Be=()=>({t:"component.deselect"}),Ve=()=>({t:"editor._nativeFocus"}),Ie=t=>({t:"history.push",p:t}),Oe=()=>({t:"documentType.refreshHeader"}),Re=(t,e,i,s,n)=>({t:"format.removeBlock",p:{rangeEl:t,selectedFormats:e,newBlockElement:i,shouldDelete:s,skipHistory:n}}),Fe=t=>({t:"dom.utils.removeItem",p:{item:t}}),ze=t=>({t:"select.component.fallback",p:{cmponentInfo:t}}),$e=(t,e)=>({t:"del.format.removeAndMove",p:{container:t,formatEl:e}}),Pe=t=>({t:"backspace.format.maintain",p:{formatEl:t}}),De=(t,e,i)=>({t:"backspace.component.select",p:{selectionNode:t,range:e,fileComponentInfo:i}}),qe=(t,e,i,s)=>({t:"backspace.component.remove",p:{isList:t,sel:e,formatEl:i,fileComponentInfo:s}}),We=(t,e,i)=>({t:"backspace.list.mergePrev",p:{prev:t,formatEl:e,rangeEl:i}}),Ue=t=>({t:"backspace.list.removeNested",p:{range:t}}),Ze=(t,e)=>({t:"delete.component.select",p:{formatEl:t,fileComponentInfo:e}}),Ge=(t,e)=>({t:"delete.component.selectNext",p:{formatEl:t,nextEl:e}}),Ye=(t,e,i)=>({t:"delete.list.removeNested",p:{range:t,formatEl:e,rangeEl:i}}),je=(t,e,i)=>({t:"tab.format.indent",p:{range:t,formatEl:e,shift:i}}),Xe=t=>({t:"enter.scrollTo",p:{range:t}}),Ke=t=>({t:"enter.line.addDefault",p:{formatEl:t}}),Je=(t,e)=>({t:"enter.list.addItem",p:{formatEl:t,selectionNode:e}}),Qe=(t,e)=>({t:"enter.format.exitEmpty",p:{formatEl:t,rangeEl:e}}),ti=(t,e,i,s,n)=>({t:"enter.format.cleanBrAndZWS",p:{selectionNode:t,selectionFormat:e,brBlock:i,children:s,offset:n}}),ei=(t,e,i,s)=>({t:"enter.format.insertBrHtml",p:{brBlock:t,range:e,wSelection:i,offset:s}}),ii=t=>({t:"enter.format.insertBrNode",p:{wSelection:t}}),si=(t,e,i,s)=>({t:"enter.format.breakAtEdge",p:{formatEl:t,selectionNode:e,formatStartEdge:i,formatEndEdge:s}}),ni=(t,e,i,s)=>({t:"enter.format.breakWithSelection",p:{formatEl:t,range:e,formatStartEdge:i,formatEndEdge:s}}),oi=(t,e)=>({t:"enter.format.breakAtCursor",p:{formatEl:t,range:e}}),li=t=>({t:"enter.figcaption.exitInList",p:{formatEl:t}}),ri=()=>({t:"keydown.input.insertNbsp"}),ai=()=>({t:"keydown.input.insertZWS"});function hi(t,e,i){const{format:s,component:n}=e,{fc:o,options:l,range:r,selectionNode:a}=i;let{formatEl:h}=i;const c=!r.collapsed||r.startContainer!==r.endContainer;if(t.push(Be()),t.push(Ne()),c&&Se(e))return t.push(Me()),!0;if(!(s.isNormalLine(h)||s.isBrLine(h)||o.get("wysiwyg").firstElementChild||n.is(a)||null===function(t,e){return t.setDefaultLine(e)}(e,l.get("defaultLine"))))return t.push(Me()),!1;if(s.isLine(h)&&c&&xt.check.isEdgePoint(r.startContainer,r.startOffset,"front")&&(!r.startContainer.previousSibling||xt.check.isZeroWidth(r.startContainer.previousSibling))&&s.getLine(r.startContainer)!==s.getLine(r.endContainer)&&(s.isLine(h.previousElementSibling)||xt.check.isListCell(h)))return t.push(Me()),t.push($e(r.startContainer,h)),t.push(Ie(!0)),!1;if(!c&&!h.previousElementSibling&&0===r.startOffset&&!a.previousSibling&&!xt.check.isListCell(h)&&s.isLine(h)&&(!s.isBrLine(h)||s.isClosureBrLine(h)))return s.isClosureBlock(h.parentNode)?(t.push(Me()),!1):(xt.check.isWysiwygFrame(h.parentNode)&&h.childNodes.length<=1&&(!h.firstChild||xt.check.isZeroWidth(h.textContent))&&(t.push(Me()),t.push(Pe(h))),t.push(Ve()),!1);const d=r.startContainer;if(h&&!h.previousElementSibling&&0===r.startOffset&&3===d.nodeType&&xt.check.isZeroWidth(d)&&!0===function(t,e,i){let s=e.parentNode.previousSibling;const n=e.parentNode.nextSibling;s||(n?s=n:(s=xt.utils.createElement("BR"),i.appendChild(s)));let o=e;for(;i.contains(o)&&!o.previousSibling;)o=o.parentNode;if(!i.contains(o))return e.textContent="",t.nodeTransform.removeAllParents(e,null,i),!0}(e,d,h))return!0;if(!c&&h&&(0===r.startOffset||a===h)){const i=a===h?Te(e,r,!0):xt.check.isElement(a.previousSibling)?a.previousSibling:xt.check.isEdgePoint(r.startContainer,r.startOffset)?xt.query.getPreviousDeepestNode(r.startContainer):null;if(n.is(i)){const e=n.get(i);if(e)return t.push(Me()),t.push(De(a,r,e)),!0}}if(Te(e,r,!0))return t.push(Me()),!0;!c&&s.isEdgeLine(r.startContainer,r.startOffset,"front")&&s.isLine(h.previousElementSibling)&&t.push(Ae(h.previousElementSibling.attributes)),h=s.getLine(r.startContainer,null);const u=s.getBlock(h,null),p=r.commonAncestorContainer;if(u&&h&&!xt.check.isTableCell(u)&&!/^FIGCAPTION$/i.test(u.nodeName)){if(xt.check.isListCell(h)&&xt.check.isList(u)&&(xt.check.isListCell(u.parentElement)||h.previousElementSibling)&&(a===h||3===a.nodeType&&(!a.previousSibling||xt.check.isList(a.previousSibling)))&&(s.getLine(r.startContainer,null)!==s.getLine(r.endContainer,null)?u.contains(r.startContainer):0===r.startOffset&&r.collapsed)){if(r.startContainer!==r.endContainer)t.push(Le()),t.push(Ue(r)),t.push(Ie(!0));else{let e=h.previousElementSibling||u.parentElement;if(xt.check.isListCell(e)){t.push(Le());let i=e;if(!e.contains(h)&&xt.check.isListCell(i)&&xt.check.isList(i.lastElementChild)){for(i=i.lastElementChild.lastElementChild;xt.check.isListCell(i)&&xt.check.isList(i.lastElementChild);)i=i.lastElementChild&&i.lastElementChild.lastElementChild;e=i}t.push(We(e,h,u)),t.push(Ie(!0))}}return!0}if(!c&&0===r.startOffset){let e=!0,i=p;for(;i&&i!==u&&!xt.check.isWysiwygFrame(i);){if(i.previousSibling&&(1===i.previousSibling.nodeType||!xt.check.isZeroWidth(i.previousSibling.textContent.trim()))){e=!1;break}i=i.parentNode}if(e&&u.parentNode)return t.push(Le()),t.push(Re(u,xt.check.isListCell(h)?[h]:null,null,!1,!1)),t.push(Ie(!0)),!0}}if(!c&&h&&(0===r.startOffset||a===h&&h.childNodes[r.startOffset])){const e=xt.check.isListCell(h),i=a===h?h.childNodes[r.startOffset]:a,s=(e?i:h).previousSibling,o=e||(3===p.nodeType||xt.check.isBreak(p))&&!p.previousSibling&&0===r.startOffset;if(i&&(e||!i.previousSibling)&&(p&&n.is(p.previousSibling)||o&&n.is(s))){const o=n.get(s);return o?(t.push(Me()),t.push(qe(e,i,h,o))):n.is(s)&&(t.push(Me()),t.push(Fe(s))),!0}if(i&&xt.check.isNonEditable(i.previousSibling))return t.push(Me()),t.push(Fe(i.previousSibling)),!0}return!0}const{isOSX_IOS:ci}=_t;async function di(t,e){const i=[];switch(e.keyCode){case"Backspace":if(!1===hi(i,t,e))return i;break;case"Delete":if(!1===function(t,e,i){const{format:s,component:n}=e,{range:o,selectionNode:l}=i;let{formatEl:r}=i;const a=!o.collapsed||o.startContainer!==o.endContainer;if(t.push(Be()),t.push(Ne()),a&&Se(e))return t.push(Me()),!0;if(!a&&s.isEdgeLine(o.endContainer,o.endOffset,"end")&&!r.nextSibling)return t.push(Me()),!1;if(s.isLine(r)&&a&&xt.check.isEdgePoint(o.endContainer,o.endOffset,"end")&&(!o.endContainer.nextSibling||xt.check.isZeroWidth(o.endContainer.nextSibling))&&s.getLine(o.startContainer)!==s.getLine(o.endContainer)&&(s.isLine(r.nextElementSibling)||xt.check.isListCell(r)))return t.push(Me()),t.push($e(o.endContainer,r)),t.push(Ie(!0)),!1;if(!a&&r&&(o.endOffset===o.endContainer.textContent.length||l===r)){const i=l===r?Te(e,o,!1):xt.check.isElement(l.nextSibling)?l.nextSibling:xt.check.isEdgePoint(o.endContainer,o.endOffset)?xt.query.getNextDeepestNode(o.endContainer,null):null;if(n.is(i)){const e=n.get(i);if(e)return t.push(Me()),t.push(Ze(r,e)),!0}}if(Te(e,o,!1))return t.push(Me()),!0;if((s.isLine(l)||null===l.nextSibling||xt.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(Le()),t.push(Ge(r,e)),!0}if(!a&&(xt.check.isEdgePoint(o.endContainer,o.endOffset)||l===r&&r.childNodes[o.startOffset])){const e=l===r&&r.childNodes[o.startOffset]||l;if(e&&xt.check.isNonEditable(e.nextSibling))return t.push(Me()),t.push(Fe(e.nextSibling)),!0;if(n.is(e))return t.push(Me()),t.push(Fe(e)),!0}!a&&s.isEdgeLine(o.endContainer,o.endOffset,"end")&&s.isLine(r.nextElementSibling)&&t.push(Ae(r.attributes)),r=s.getLine(o.startContainer,null);const h=s.getBlock(r,null);return!(xt.check.isListCell(r)&&xt.check.isList(h)&&(l===r||3===l.nodeType&&(!l.nextSibling||xt.check.isList(l.nextSibling))&&(s.getLine(o.startContainer,null)!==s.getLine(o.endContainer,null)?h.contains(o.endContainer):o.endOffset===l.textContent.length&&o.collapsed))&&(t.push(Ye(o,r,h)),0))}(i,t,e))return i;break;case"Tab":if(!1===function(t,e,i){const{options:s,selectionNode:n,range:o,formatEl:l,ctrl:r,alt:a,shift:h}=i;return!!s.get("tabDisable")||(t.push(Le()),r||a||xt.check.isWysiwygFrame(n)||(t.push(je(o,l,h)),t.push(Ie(!1))),!0)}(i,0,e))return i;break;case"Enter":if(!1===function(t,e,i){const{format:s,char:n,selection:o}=e,{frameOptions:l,range:r,formatEl:a,selectionNode:h,shift:c,e:d}=i,u=!r.collapsed||r.startContainer!==r.endContainer;t.push(Be());const p=s.getBrLine(h,null),g=s.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(Le()),!1}if(!c){const i=!r.endContainer.nextSibling&&s.isEdgeLine(r.endContainer,r.endOffset,"end"),n=!r.startContainer.previousSibling&&s.isEdgeLine(r.startContainer,r.startOffset,"front");if(i&&(/^H[1-6]$/i.test(a.nodeName)||/^HR$/i.test(a.nodeName)))return e.enterPrevent(d),t.push(Ke(a)),t.push(Xe(r)),!0;if(g&&a&&!xt.check.isTableCell(g)&&!/^FIGCAPTION$/i.test(g.nodeName)){const i=o.getRange();if(xt.check.isEdgePoint(i.endContainer,i.endOffset)&&xt.check.isList(h.nextSibling))return e.enterPrevent(d),t.push(Je(a,h)),t.push(Xe(r)),!0;if((3!==i.commonAncestorContainer.nodeType||!i.commonAncestorContainer.nextElementSibling)&&xt.check.isZeroWidth(a.innerText.trim())&&!xt.check.isListCell(a.nextElementSibling))return e.enterPrevent(d),t.push(Qe(a,g)),!0}if(p||g===a&&s.isClosureBlock(g)&&s.isLine(a)){e.enterPrevent(d);const i=h===p,n=o.get(),l=h.childNodes,a=n.focusOffset,c=h.previousElementSibling,u=h.nextSibling;return!s.isClosureBrLine(p)&&l&&(i&&r.collapsed&&l.length-1<=a+1&&xt.check.isBreak(l[a])&&(!l[a+1]||(!l[a+2]||xt.check.isZeroWidth(l[a+2].textContent))&&3===l[a+1].nodeType&&xt.check.isZeroWidth(l[a+1].textContent))&&a>0&&xt.check.isBreak(l[a-1])||!i&&xt.check.isZeroWidth(h.textContent)&&xt.check.isBreak(c)&&(xt.check.isBreak(c.previousSibling)||!xt.check.isZeroWidth(c.previousSibling?.textContent))&&(!u||!xt.check.isBreak(u)&&xt.check.isZeroWidth(u.textContent)))?(t.push(ti(h,i,p,l,a)),t.push(Xe(r)),!0):(i?t.push(ei(p,r,n,a)):t.push(ii(n)),t.push(Xe(r)),!0)}if(r.collapsed&&(n||i))return e.enterPrevent(d),t.push(si(a,h,n,i)),t.push(Xe(r)),!0;if(a)return t.push(Le()),u?t.push(ni(a,r,n,i)):t.push(oi(a,r)),t.push(Xe(r)),!0}return u?(t.push(Xe(r)),!0):(g&&xt.query.getParentElement(g,"FIGCAPTION")&&xt.query.getParentElement(g,xt.check.isList)&&(e.enterPrevent(d),t.push(li(a)),t.push(Xe(r))),!0)}(i,t,e))return i}const{fc:s,keyCode:n,shift:o,alt:l,ctrl:r,range:a}=e;if(o&&(ci?l:r)&&Et.isSpace(n))return i.push(Me()),i.push(ri()),i;const h=!a.collapsed||a.startContainer!==a.endContainer;return r||l||h||Et.isNonTextKey(n)||!xt.check.isBreak(a.commonAncestorContainer)?!s.has("documentType_use_header")||!h||r||l||o||Et.isDirectionKey(n)?(function(t,e,i){const{component:s}=e,{formatEl:n,range:o,selectionNode:l,keyCode:r}=i;let a=null;switch(r){case"ArrowUp":s.is(n.previousElementSibling)&&(a=s.get(n.previousElementSibling));break;case"ArrowLeft":if(xt.check.isEdgePoint(l,o.startOffset,"front")){const t=l.previousElementSibling||xt.query.getPreviousDeepestNode(l);t?s.is(t)&&(a=s.get(t)):s.is(n.previousElementSibling)&&(a=s.get(n.previousElementSibling))}break;case"ArrowDown":s.is(n.nextElementSibling)&&(a=s.get(n.nextElementSibling));break;case"ArrowRight":if(xt.check.isEdgePoint(l,o.endOffset,"end")){const t=l.nextElementSibling||xt.query.getNextDeepestNode(l);t?s.is(t)&&(a=s.get(t)):s.is(n.nextElementSibling)&&(a=s.get(n.nextElementSibling))}}a&&!a.options?.isInputComponent&&(t.push(Le()),t.push(ze(a)))}(i,t,e),i):(i.push(Oe()),i):(i.push(ai()),i)}const{_w:ui}=_t,pi=new RegExp(Ct.zeroWidthSpace+"+",""),gi={ctrl:!1,alt:!1},mi=Object.preventExtensions({value:[]});async function fi(t,e){if(this.isComposing=Et.isComposing(e))return!0;if(this.editor.selectMenuOn||!e.isTrusted)return;let i=this.selection.getNode();if(xt.check.isInputElement(i))return;if(this.menu.currentDropdownName)return;const s=e.code,n=Et.isShift(e),o=gi.ctrl=Et.isCtrl(e),l=gi.alt=Et.isAlt(e);if(!o&&t.get("isReadOnly")&&!Et.isDirectionKey(s))return e.preventDefault(),!1;if(this.menu.dropdownOff(),this.editor.isBalloon?this._hideToolbar():this.editor.isSubBalloon&&this._hideToolbar_sub(),!1===await this.triggerEvent("onKeyDown",{frameContext:t,event:e}))return;Et.isEnter(s)&&this.format.isLine(this.selection.getRange()?.startContainer)&&(this.selection._resetRangeToTextNode(),i=this.selection.getNode());const r=this.selection.getRange(),a=this.format.getLine(i,null)||i;if(o&&!Et.isNonTextKey(s)&&this.shortcuts.command(e,o,n,s,"",!1,null,null))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1;if(!o&&!Et.isNonTextKey(s)&&this.format.isLine(a)&&r.collapsed&&xt.check.isEdgePoint(r.startContainer,0,"front")){const t=r.startContainer.substringData?.(0,r.startOffset);if(t&&this.shortcuts.command(e,!1,n,s,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,status:this.status,options:this.options,frameOptions:this.frameOptions,range:r,selectionNode:i,formatEl:a,keyCode:s,ctrl:o,alt:l,shift:n},c=function(t,{_styleNodes:e}){const{selection:i,format:s,listFormat:n,component:o,html:l,nodeTransform:r,history:a,char:h,menu:c}=t;return{editor:{_nativeFocus:()=>t.editor._nativeFocus(),blur:()=>t.editor.blur()},selection:{getRange:()=>i.getRange(),getNode:()=>i.getNode(),setRange:(t,e,s,n)=>i.setRange(t,e,s,n),get:()=>i.get()},format:{isLine:t=>s.isLine(t),getLine:(t,e)=>s.getLine(t,e),getLines:t=>s.getLines(t),getBrLine:(t,e)=>s.getBrLine(t,e),getBlock:(t,e)=>s.getBlock(t,e),isNormalLine:t=>s.isNormalLine(t),isBrLine:t=>s.isBrLine(t),isClosureBrLine:t=>s.isClosureBrLine(t),isClosureBlock:t=>s.isClosureBlock(t),isEdgeLine:(t,e,i)=>s.isEdgeLine(t,e,i),removeBlock:(t,e)=>s.removeBlock(t,e),addLine:(t,e)=>s.addLine(t,e)},listFormat:{applyNested:(t,e)=>n.applyNested(t,e)},component:{deselect:()=>o.deselect(),is:t=>o.is(t),get:t=>o.get(t),select:(t,e)=>o.select(t,e)},html:{remove:()=>l.remove(),insert:(t,e)=>l.insert(t,e),insertNode:(t,e)=>l.insertNode(t,e)},history:{push:t=>a.push(!!t)},nodeTransform:{removeAllParents:(t,e,i)=>r.removeAllParents(t,e,i),split:(t,e,i)=>r.split(t,e,i)},char:{check:t=>h.check(t)},menu:{dropdownOff:()=>c.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){t.editor._iframeAutoHeight(t.frameContext),b&&t.scrollparents.length>0||t.selection.scrollTo(e,{behavior:"auto",block:"nearest",inline:"nearest"})},enterPrevent(e){e.preventDefault(),b&&(t.__focusTemp.focus({preventScroll:!0}),t.frameContext.get("wysiwyg").focus({preventScroll:!0}))}}}(this,{_styleNodes:mi}),d=await di(c,h);await async function(t,e){const i={...ke,...Ee};for(const s of t){if("action.stop"===s.t)return!1;const t=i[s.t];if(t&&!1===await t(e,s.p))return!1}}(d,{ports:c,ctx:h})}async function bi(t,e){if(this._onShortcutKey||this.menu.currentDropdownName)return;const i=e.code,s=Et.isCtrl(e),n=Et.isAlt(e);if(s&&(gi.ctrl=!1),n&&(gi.alt=!1),t.get("isReadOnly"))return;const o=this.selection.getRange();let l=this.selection.getNode();if((this.editor.isBalloon||this.editor.isSubBalloon)&&((this.editor.isBalloonAlways||this.editor.isSubBalloonAlways)&&!Et.isEsc(i)||!o.collapsed)){if(!this.editor.isBalloonAlways&&!this.editor.isSubBalloonAlways)return void(this.editor.isSubBalloon?this.subToolbar._showBalloon():this.toolbar._showBalloon());Et.isEsc(i)||this._showToolbarBalloonDelay()}if(Et.isBackspace(i)&&xt.check.isWysiwygFrame(l)&&""===l.textContent&&0===l.children.length){e.preventDefault(),e.stopPropagation(),l.innerHTML="";const s=xt.utils.createElement(this.format.isLine(this.status.currentNodes[0])&&!xt.check.isListCell(this.status.currentNodes[0])?this.status.currentNodes[0]:this.options.get("defaultLine"),null,"<br>");return l.appendChild(s),this.selection.setRange(s,0,s,0),this.applyTagEffect(),this.history.push(!1),void(t.has("documentType_use_header")&&Et.isDocumentTypeObserverKey(i)&&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++)Et.isEnter(i)&&/^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)||xt.check.isList(l)||null===this._setDefaultLine(this.format.isBlock(a)?"DIV":this.options.get("defaultLine"))||(l=this.selection.getNode());if(!gi.ctrl&&!gi.alt&&!Et.isNonTextKey(i)&&3===l.nodeType&&Ct.zeroWidthRegExp.test(l.textContent)&&!(void 0!==e.isComposing?e.isComposing:this.isComposing)){let t=o.startOffset,e=o.endOffset;const i=(l.textContent.substring(0,e).match(pi)||"").length;t=o.startOffset-i,e=o.endOffset-i,l.textContent=l.textContent.replace(Ct.zeroWidthRegExp,""),this.selection.setRange(l,t<0?0:t,l,e<0?0:e)}if(Et.isRemoveKey(i)&&xt.check.isZeroWidth(r?.textContent)&&!r.previousElementSibling&&!xt.check.isListCell(r)){const t=this.options.get("retainStyleMode");"none"!==t&&mi.value?.length>0?"repeat"===t?this.__retainTimer?(this.__retainTimer=ui.clearTimeout(this.__retainTimer),this._clearRetainStyleNodes(r)):(this.__retainTimer=ui.setTimeout((()=>{this.__retainTimer=null}),0),this._retainStyleNodes(r,mi.value)):(this.__retainTimer=null,this._retainStyleNodes(r,mi.value)):this._clearRetainStyleNodes(r)}if(t.has("documentType_use_header"))if(Et.isDocumentTypeObserverKey(i)){t.get("documentType").reHeader();const e=xt.query.getParentElement(this.selection.selectionNode,this.format.isLine.bind(this.format));t.get("documentType").on(e)}else{const e=xt.query.getParentElement(l,(t=>1===t.nodeType));t.get("documentType").onChangeText(e)}!1!==await this.triggerEvent("onKeyUp",{frameContext:t,event:e})&&!1!==await this._callPluginEventAsync("onKeyUp",{frameContext:t,event:e,range:o,line:r})&&Et.isHistoryRelevantKey(i)&&this.history.push(!0)}function yi(t,e){const i=e.clipboardData;return!i||this._dataTransferAction("paste",e,i,t)}async function vi(t,e){const i=e.clipboardData;if(!1===await this.triggerEvent("onCopy",{frameContext:t,event:e,clipboardData:i}))return e.preventDefault(),e.stopPropagation(),!1;const s=t.get("_ww").getSelection();this.__secopy=s.toString()}async function _i(t,e){const i=e.clipboardData;if(!1===await this.triggerEvent("onCut",{frameContext:t,event:e,clipboardData:i}))return e.preventDefault(),e.stopPropagation(),!1;const s=t.get("_ww").getSelection();this.__secopy=s.toString(),this._w.setTimeout((()=>{this.history.push(!1)}),0)}function Ci(t,e,i,s,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(i){const t=this.offset.getGlobal(i),e=s?this.context.get("toolbar_main").offsetHeight:0;c.y=t.top+e-this._w.scrollY,c.x=t.left-this._w.scrollX}const d=h.getBoundingClientRect();if(d.height>0){const i=t.get("wysiwygFrame");let s=0,n=0;/^iframe$/i.test(i.nodeName)&&(s=i.offsetLeft,n=i.offsetTop),e.style.left=`${d.right+this._w.scrollX+c.x+s}px`,e.style.top=`${d.top+this._w.scrollY+c.y-5+n}px`,e.style.height=`${d.height+10}px`,e.style.display="block"}else e.style.display="none"}function wi(t){t.style.display="none"}function xi(t,e,i){try{if(t.get("isReadOnly"))return i.preventDefault(),i.stopPropagation(),!1;const e=i.dataTransfer;if(!e)return!0;const{sc:s,so:n,ec:o,eo:l}=this.selection.getDragEventLocationRange(i);if(!s)return;if(xt.query.getParentElement(s,".se-disable-pointer"))return void i.preventDefault();if(he.get("__dragContainer")){if(i.preventDefault(),he.get("__dragContainer").contains(i.target))return void this.component.deselect();const e=he.get("__dragContainer");return this.component.deselect(),this.selection.setRange(s,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(s,n,o,l),this._dataTransferAction("drop",i,e,t)}finally{e.style.display="none"}}const{_w:ki,_d:Ei,isMobile:Si,isTouchDevice:Ti}=_t;function Hi(t){re.call(this,t),this.isComposing=!1,this.scrollparents=[],this._events=[],this._onButtonsCheck=new RegExp(`^(${Object.keys(t.options.get("_defaultStyleTagMap")).join("|")})$`,"i"),this._onShortcutKey=!1,this._handledInBefore=!1,this._balloonDelay=null,this._wwFrameObserver=null,this._toolbarObserver=null,this._lineBreakComp=null,this._formatAttrsTemp=null,this._resizeClientY=0,this.__resize_editor=null,this.__close_move=null,this.__geckoActiveEvent=null,this.__cacheStyleNodes=[],this.__selectionSyncEvent=null,this._inputFocus=!1,this.__inputPlugin=null,this.__inputBlurEvent=null,this.__inputKeyEvent=null,this.__focusTemp=this.carrierWrapper.querySelector(".__se__focus__temp__"),this.__retainTimer=null,this.__eventDoc=null,this.__secopy=null}function Li(t,e,i){this._moveContainer(e),this._scrollContainer(),this._callPluginEvent("onScroll",{frameContext:t,event:i}),t.has("documentType_use_page")&&t.get("documentType").scrollPage(),this.triggerEvent("onScroll",{frameContext:t,event:i})}function Mi(t,e){if(this.selection.__iframeFocus||t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),!1;this.status.hasFocus=!0,this.component.__prevent=!1,this.triggerEvent("onNativeFocus",{frameContext:t,event:e});const i=t.get("key");this._inputFocus?this.editor.isInline&&ki.setTimeout((()=>{this.toolbar._showInline()}),0):this.status.rootKey===i&&this.editor._preventBlur||this.editor._preventFocus||(this.editor._preventFocus=!0,xt.utils.removeClass(this.editor.commandTargets.get("codeView"),"active"),xt.utils.setDisabled(this.editor._codeViewDisabledButtons,!1),this.editor.changeFrameContext(i),this.history.resetButtons(i,null),ki.setTimeout((()=>{this.__postFocusEvent(t,e)}),0))}function Ni(t,e){t.get("isCodeView")||t.get("isReadOnly")||t.get("isDisabled")||(this.status.hasFocus=!1,this.editor.effectNode=null,this.triggerEvent("onNativeBlur",{frameContext:t,event:e}),this._inputFocus||this.editor._preventBlur||(this.editor._preventFocus=!1,this._setKeyEffect([]),this.status.currentNodes=[],this.status.currentNodesMap=[],this.ui._offCurrentController(),this.editor.applyFrameRoots((t=>{t.get("navigation")&&(t.get("navigation").textContent="")})),this.history.check(t.get("key"),this.status._range),this.__postBlurEvent(t,e)))}function Ai(t){t.stopPropagation(),this._resizeClientY=t.clientY,this.ui.enableBackWrapper("ns-resize"),this.__resize_editor=this.addGlobalEvent("mousemove",Bi.bind(this)),this.__close_move=this.addGlobalEvent("mouseup",Vi.bind(this))}function Bi(t){const e=this.frameContext,i=e.get("wrapper").offsetHeight+(t.clientY-this._resizeClientY),s=i<e.get("_minHeight")?e.get("_minHeight"):i;e.get("wysiwygFrame").style.height=e.get("code").style.height=s+"px",this._resizeClientY=t.clientY,_t.isResizeObserverSupported||this.editor.__callResizeFunction(e,s,null)}function Vi(){this.ui.disableBackWrapper(),this.__resize_editor&&=this.removeGlobalEvent(this.__resize_editor),this.__close_move&&=this.removeGlobalEvent(this.__close_move)}function Ii(t,e){e.preventDefault();const i=this._lineBreakComp;if(!i)return;const s=xt.check.isListCell(i.parentElement),n=xt.utils.createElement(s?"BR":xt.check.isTableCell(i.parentElement)?"DIV":this.options.get("defaultLine"));if(s||(n.innerHTML="<br>"),"byte-html"!==this.frameOptions.get("charCounter_type")||this.char.check(n.outerHTML)){i.parentNode.insertBefore(n,"t"===t?i:i.nextSibling),this.component.deselect();try{const t=s?n:n.firstChild;this.selection.setRange(t,1,t,1),this.history.push(!1)}catch(t){console.warn("[SUNEDITOR.lineBreaker.error]",t)}}}function Oi(){this.status.initViewportHeight=ki.visualViewport.height,Si||this.ui._offCurrentController(),this.editor.isBalloon?this.toolbar.hide():this.editor.isSubBalloon&&this.subToolbar.hide(),this._resetFrameStatus()}function Ri(){Si&&this.options.get("toolbar_sticky")>-1&&(this.toolbar._resetSticky(),this.editor.menu._restoreMenuPosition()),this._scrollContainer(),this.__setViewportSize()}function Fi(){this.options.get("toolbar_sticky")>-1&&this.toolbar._resetSticky(),this.editor.isBalloon&&"block"===this.context.get("toolbar_main").style.display?this.toolbar._setBalloonOffset("top"===this.toolbar._balloonOffset.position):this.editor.isSubBalloon&&"block"===this.context.get("toolbar_sub_main").style.display&&this.subToolbar._setBalloonOffset("top"===this.subToolbar._balloonOffset.position),this._scrollContainer(),this.frameContext.has("documentType_use_page")&&this.frameContext.get("documentType").scrollWindow()}function zi(){this.options.get("toolbar_sticky")>-1&&(this.toolbar._resetSticky(),this.editor.menu._restoreMenuPosition())}function $i(t){if(this.editor._preventSelection)return;let e=t.getSelection().anchorNode;this.editor.applyFrameRoots((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=xt.query.getParentElement(this.selection.selectionNode,this.format.isLine.bind(this.format));t.get("documentType").on(e)}}}))}function Pi(){this.menu.dropdownOff(),this._scrollContainer()}function Di(t){this.editor.changeFrameContext(t.get("key")),xt.utils.addClass(this.editor.commandTargets.get("codeView"),"active"),xt.utils.setDisabled(this.editor._codeViewDisabledButtons,!0)}Hi.prototype={addEvent(t,e,i,s){if(!t)return null;if((t===ki||t===Ei||"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,i,s),this._events.push({target:t[o],type:e,listener:i,useCapture:s});return{target:n>1?t:t[0],type:e,listener:i,useCapture:s}},removeEvent(t){if(!t)return;let e=t.target;const i=t.type,s=t.listener,n=t.useCapture;if(e&&((!kt.is(e.length)||e.nodeName||!Array.isArray(e)&&e.length<1)&&(e=[e]),0!==e.length)){for(let t=0,o=e.length;t<o;t++)e[t].removeEventListener(i,s,n);return null}},addGlobalEvent(t,e,i){return this.frameOptions.get("iframe")&&this.frameContext.get("_ww").addEventListener(t,e,i),ki.addEventListener(t,e,i),{type:t,listener:e,useCapture:i}},removeGlobalEvent(t,e,i){if(t)return"object"==typeof t&&(e=t.listener,i=t.useCapture,t=t.type),this.frameOptions.get("iframe")&&this.frameContext.get("_ww").removeEventListener(t,e,i),ki.removeEventListener(t,e,i),null},applyTagEffect(t){if(t||=this.selection.getNode(),t===this.editor.effectNode)return;this.editor.effectNode=t;const e=this.options.get("_rtl")?"marginRight":"marginLeft",i=this.plugins,s=this.editor.commandTargets,n=this._onButtonsCheck,o=this.options.get("_styleCommandMap"),l=[],r=[],a=this.options.get("_textStyleTags"),h=[],c=[],d=this.editor.activeCommands,u=d.length;let p="";if(this.component.is(t)&&!this.component.__selectionSelected){const e=this.component.get(t);if(!e)return;return this.editor.effectNode=null,void this.component.select(e.target,e.pluginName)}for(;t.firstChild;)t=t.firstChild;const g=this.frameContext,m=!g.get("isReadOnly");for(let g=t;!xt.check.isWysiwygFrame(g)&&g;g=g.parentElement)if(1===g.nodeType&&!xt.check.isBreak(g)){if(this._isNonFocusNode(g))return void this.editor.blur();if(p=g.nodeName.toLowerCase(),r.push(p),a.includes(p)&&!this.format.isLine(p)&&h.push(g),m)for(let t,e=0;e<u;e++)t=d[e],!l.includes(t)&&!c.includes(t)&&s.get(t)&&s.get(t).filter((e=>{const s=i[t]?.active(g,e);return void 0===s&&c.push(t),s})).length>0&&l.push(t);if(this.format.isLine(g)){if(!l.includes("outdent")&&s.has("outdent")&&(xt.check.isListCell(g)||g.style[e]&&kt.get(g.style[e],0)>0)&&s.get("outdent").filter((t=>!xt.check.isImportantDisabled(t)&&(t.disabled=!1,!0))).length>0&&l.push("outdent"),!l.includes("indent")&&s.has("indent")){const t=xt.check.isListCell(g)&&!g.previousElementSibling;s.get("indent").filter((e=>!xt.check.isImportantDisabled(e)&&(e.disabled=t,!0))).length>0&&l.push("indent")}}else n.test(p)&&(p=o[p]||p,l.push(p),xt.utils.addClass(s.get(p),"active"))}return this._setKeyEffect(l),this.__cacheStyleNodes=h.reverse(),this.status.currentNodes=r.reverse(),this.status.currentNodesMap=l,this.frameOptions.get("statusbar_showPathLabel")&&g.get("navigation")&&(g.get("navigation").textContent=this.options.get("_rtl")?this.status.currentNodes.reverse().join(" < "):this.status.currentNodes.join(" > ")),t},_injectActiveEvent(t){xt.utils.addClass(t,"__se__active"),this.__geckoActiveEvent=this.addGlobalEvent("mouseup",(()=>{xt.utils.removeClass(t,"__se__active"),this.__geckoActiveEvent=this.removeGlobalEvent(this.__geckoActiveEvent)}))},_setKeyEffect(t){const e=this.editor.activeCommands,i=this.editor.commandTargets,s=this.plugins;for(let n,o,l,r=0,a=e.length;r<a;r++)if(n=e[r],!t.includes(n)&&(o=i.get(n))){l=s[n];for(let t,e=0,i=o.length;e<i;e++)t=o[e],t&&(l?l.active(null,t):/^outdent$/i.test(n)?xt.check.isImportantDisabled(t)||(t.disabled=!0):/^indent$/i.test(n)?xt.check.isImportantDisabled(t)||(t.disabled=!1):xt.utils.removeClass(t,"active"))}},_showToolbarBalloonDelay(){this._balloonDelay&&ki.clearTimeout(this._balloonDelay),this._balloonDelay=ki.setTimeout((()=>{ki.clearTimeout(this._balloonDelay),this._balloonDelay=null,this.editor.isSubBalloon?this.subToolbar._showBalloon():this.toolbar._showBalloon()}),250)},_toggleToolbarBalloon(){this.selection._init();const t=this.selection.getRange(),e=this.options.has("_subMode");!(e?this.editor.isSubBalloonAlways:this.editor.isBalloonAlways)&&t.collapsed?e?this._hideToolbar_sub():this._hideToolbar():e?this.subToolbar._showBalloon(t):this.toolbar._showBalloon(t)},_hideToolbar(){this.editor._notHideToolbar||this.frameContext.get("isFullScreen")||this.toolbar.hide()},_hideToolbar_sub(){this.subToolbar&&!this.editor._notHideToolbar&&this.subToolbar.hide()},_isNonFocusNode:t=>xt.check.isElement(t)&&"true"===t.getAttribute("data-se-non-focus"),_setDefaultLine(t){if(!this.options.get("__lineFormatFilter"))return null;if(this.editor._fileManager.pluginRegExp.test(this.editor.currentControllerName))return;const e=this.selection.getRange(),i=e.commonAncestorContainer,s=e.startContainer,n=e.endOffset,o=this.format.getBlock(i,null);let l,r,a;if(o)return a=xt.utils.createElement(t||this.options.get("defaultLine")),a.innerHTML=o.innerHTML,0===a.childNodes.length&&(a.innerHTML=Ct.zeroWidthSpace),o.innerHTML=a.outerHTML,a=o.firstChild,l=a.childNodes[n]||xt.query.getEdgeChildNodes(a,null).sc,l||(l=xt.utils.createTextNode(Ct.zeroWidthSpace),a.insertBefore(l,a.firstChild)),r=l.textContent.length,void this.selection.setRange(l,r,l,r);if(3===i.nodeType&&this.component.is(i.parentElement)){const t=this.component.get(i.parentElement);if(!t)return;const e=t.container;if(i.parentElement===e){const t=i.nextElementSibling?e:e.nextElementSibling,s=xt.utils.createElement(this.options.get("defaultLine"),null,i);return e.parentElement.insertBefore(s,t),void this.editor.focusEdge(s)}return this.component.select(t.target,t.pluginName),null}if(1===i.nodeType&&"true"===i.getAttribute("data-se-embed")){let t=i.nextElementSibling;return this.format.isLine(t)||(t=this.format.addLine(i,this.options.get("defaultLine"))),void this.selection.setRange(t.firstChild,0,t.firstChild,0)}if(!this.format.isBlock(s)&&!xt.check.isWysiwygFrame(s)||!this.component.is(s.children[e.startOffset])&&!this.component.is(s.children[e.startOffset-1])){if(xt.query.getParentElement(i,xt.check.isExcludeFormat))return null;if(this.format.isBlock(i)&&i.childNodes.length<=1){let t=null;return 1===i.childNodes.length&&xt.check.isBreak(i.firstChild)?t=i.firstChild:(t=xt.utils.createTextNode(Ct.zeroWidthSpace),i.appendChild(t)),void this.selection.setRange(t,1,t,1)}try{if(3===i.nodeType&&(a=xt.utils.createElement(t||this.options.get("defaultLine")),i.parentNode.insertBefore(a,i),a.appendChild(i)),xt.check.isBreak(a.nextSibling)&&xt.utils.removeItem(a.nextSibling),xt.check.isBreak(a.previousSibling)&&xt.utils.removeItem(a.previousSibling),xt.check.isBreak(l)){const t=xt.utils.createTextNode(Ct.zeroWidthSpace);l.parentNode.insertBefore(t,l),l=t}}catch{return this.editor.execCommand("formatBlock",!1,t||this.options.get("defaultLine")),this.editor.effectNode=null,void this.selection._init()}if(a&&(xt.check.isBreak(a.nextSibling)&&xt.utils.removeItem(a.nextSibling),xt.check.isBreak(a.previousSibling)&&xt.utils.removeItem(a.previousSibling),xt.check.isBreak(l))){const t=xt.utils.createTextNode(Ct.zeroWidthSpace);l.parentNode.insertBefore(t,l),l=t}this.editor.effectNode=null,s?this.selection.setRange(s,1,s,1):this.editor._nativeFocus()}},async _dataTransferAction(t,e,i,s){try{return this.ui.showLoading(),await this._setClipboardData(t,e,i,s),e.preventDefault(),e.stopPropagation(),!1}catch(t){console.warn("[SUNEDITOR.paste.error]",t)}finally{this.ui.hideLoading()}},async _setClipboardData(t,e,i,s){e.preventDefault(),e.stopPropagation();let n=i.getData("text/plain"),o=i.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.options.get("autoLinkify")){const t=(new DOMParser).parseFromString(o,"text/html");xt.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.triggerEvent("onPaste",{frameContext:s,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.triggerEvent("onDrop",{frameContext:s,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=i.files;if(d.length>0&&!a){for(let t=0,i=d.length;t<i;t++)await this._callPluginEventAsync("onFilePasteAndDrop",{frameContext:s,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:s,event:e,data:o,doc:t})&&this.html.insert(o,{selectInserted:!1,skipCharCount:!0,skipCleaning:!0}),s.has("documentType_use_header")&&s.get("documentType").reHeader(),!1}},_addCommonEvents(){const t=de.bind(this),e=pe.bind(this);this.addEvent(this.context.get("menuTray"),"mousedown",t,!1),this.addEvent(this.context.get("menuTray"),"click",ue.bind(this),!0),this.addEvent(this.context.get("toolbar_main"),"mousedown",t,!1),this.addEvent(this.context.get("toolbar_main"),"click",e,!1),this.options.has("_subMode")&&(this.addEvent(this.context.get("toolbar_sub_main"),"mousedown",t,!1),this.addEvent(this.context.get("toolbar_sub_main"),"click",e,!1)),this.toolbar._setResponsive(),_t.isResizeObserverSupported&&(this._toolbarObserver=new ResizeObserver((()=>{ki.setTimeout((()=>{this.toolbar.resetResponsiveToolbar()}),0)})),this._wwFrameObserver=new ResizeObserver((t=>{ki.setTimeout((()=>{t.forEach((t=>{this.editor.__callResizeFunction(this.frameRoots.get(t.target.getAttribute("data-root-key")),-1,t)}))}),0)}))),this.options.get("closeModalOutsideClick")&&this.addEvent(this.carrierWrapper.querySelector(".se-modal .se-modal-inner"),"click",(t=>{t.target===this.carrierWrapper.querySelector(".se-modal .se-modal-inner")&&this.ui._offCurrentModal()}),!1),this.addEvent(ki,"resize",Oi.bind(this),!1),this.addEvent(ki.visualViewport,"resize",Ri.bind(this),!1),this.addEvent(ki,"scroll",Fi.bind(this),!1),Ti&&this.addEvent(ki.visualViewport,"scroll",zi.bind(this),!1)},_addFrameEvents(t){const e=t.get("options").get("iframe"),i=e?t.get("_ww"):t.get("wysiwyg");t.set("eventWysiwyg",i);const s=t.get("code"),n=this.editor.carrierWrapper.querySelector(".se-drag-cursor"),o=_e.bind(this,t);this.addEvent(i,"mousemove",o,!1),this.addEvent(i,"mouseleave",Ce.bind(this,t),!1),this.addEvent(i,"mousedown",be.bind(this,t),!1),this.addEvent(i,"mouseup",ye.bind(this,t),!1),this.addEvent(i,"click",ve.bind(this,t),!1),this.addEvent(i,"beforeinput",we.bind(this,t),!1),this.addEvent(i,"input",xe.bind(this,t),!1),this.addEvent(i,"keydown",fi.bind(this,t),!1),this.addEvent(i,"keyup",bi.bind(this,t),!1),this.addEvent(i,"paste",yi.bind(this,t),!1),this.addEvent(i,"copy",vi.bind(this,t),!1),this.addEvent(i,"cut",_i.bind(this,t),!1),this.addEvent(i,"dragover",Ci.bind(this,t,n,e?this.frameContext.get("topArea"):null,!this.options.get("toolbar_container")&&!this.editor.isBalloon&&!this.editor.isInline),!1),this.addEvent(i,"dragend",wi.bind(this,n),!1),this.addEvent(i,"drop",xi.bind(this,t,n),!1),this.addEvent(i,"scroll",Li.bind(this,t,i),{passive:!0,capture:!1}),this.addEvent(i,"focus",Mi.bind(this,t),!1),this.addEvent(i,"blur",Ni.bind(this,t),!1),this.addEvent(s,"mousedown",Di.bind(this,t),!1);const l=t.get("wrapper").querySelector(".se-drag-handle");if(this.addEvent(l,"wheel",(t=>{t.preventDefault(),this.component.deselect()}),!1),this.addEvent(t.get("lineBreaker_t"),"pointerdown",Ii.bind(this,"t"),!1),this.addEvent(t.get("lineBreaker_b"),"pointerdown",Ii.bind(this,"b"),!1),Ti&&this.addEvent(i,"touchstart",o,{passive:!0,capture:!1}),!this.options.get("hasCodeMirror")){const e=t.get("codeNumbers"),i=this.viewer._codeViewAutoHeight.bind(this.viewer,t.get("code"),e,"auto"===this.frameOptions.get("height"));this.addEvent(s,"keydown",i,!1),this.addEvent(s,"keyup",i,!1),this.addEvent(s,"paste",i,!1),e&&this.addEvent(s,"scroll",this.viewer._scrollLineNumbers.bind(s,e),!1)}t.has("statusbar")&&this.__addStatusbarEvent(t,t.get("options"));const r=Pi.bind(this),a=xt.query.getScrollParents(t.get("originElement"));for(const t of a)this.scrollparents.push(t),this.addEvent(t,"scroll",r,!1);this.addEvent(this.__focusTemp,"focus",(t=>t.preventDefault()),!1),this.__eventDoc!==t.get("_wd")&&(this.__eventDoc=t.get("_wd"),this.addEvent(this.__eventDoc,"selectionchange",$i.bind(this,this.__eventDoc),!1))},__addStatusbarEvent(t,e){/\d+/.test(e.get("height"))&&e.get("statusbar_resizeEnable")?e.set("__statusbarEvent",this.addEvent(t.get("statusbar"),"mousedown",Ai.bind(this),!1)):xt.utils.addClass(t.get("statusbar"),"se-resizing-none")},_removeAllEvents(){for(let t,e=0,i=this._events.length;e<i;e++)t=this._events[e],t.target.removeEventListener(t.type,t.listener,t.useCapture);this._events=[],this._wwFrameObserver&&(this._wwFrameObserver.disconnect(),this._wwFrameObserver=null),this._toolbarObserver&&(this._toolbarObserver.disconnect(),this._toolbarObserver=null)},_moveContainer(t){const e=t.scrollTop||t.scrollY||0,i=t.scrollLeft||t.scrollX||0;if(this.editor.isBalloon?(this.context.get("toolbar_main").style.top=this.toolbar._balloonOffset.top-e+"px",this.context.get("toolbar_main").style.left=this.toolbar._balloonOffset.left-i+"px"):this.editor.isSubBalloon&&(this.context.get("toolbar_sub_main").style.top=this.subToolbar._balloonOffset.top-e+"px",this.context.get("toolbar_sub_main").style.left=this.subToolbar._balloonOffset.left-i+"px"),this.editor._controllerTargetContext!==this.frameContext.get("topArea")&&this.ui._offCurrentController(),this.editor._lineBreaker_t){const t=this.editor._lineBreaker_t.style;if("none"!==t.display){const s=(this.editor._lineBreaker_t.getAttribute("data-offset")||",").split(",");t.top=kt.get(t.top,0)-(e-kt.get(s[0],0))+"px",t.left=kt.get(t.left,0)-(i-kt.get(s[1],0))+"px",this.editor._lineBreaker_t.setAttribute("data-offset",e+","+i)}}if(this.editor._lineBreaker_b){const t=this.editor._lineBreaker_b.style;if("none"!==t.display){const s=(this.editor._lineBreaker_b.getAttribute("data-offset")||",").split(",");t.top=kt.get(t.top,0)-(e-kt.get(s[0],0))+"px",t[s[1]]=kt.get(t[s[1]],0)-(i-kt.get(s[2],0))+"px",this.editor._lineBreaker_b.setAttribute("data-offset",e+","+s[1]+","+i)}}const s=this.editor.opendControllers;for(let t=0;t<s.length;t++)s[t].notInCarrier&&(s[t].form.style.top=s[t].inst.__offset.top-e+"px",s[t].form.style.left=s[t].inst.__offset.left-i+"px")},_scrollContainer(){this.menu.currentDropdownActiveButton&&this.menu.currentDropdown&&this.menu._resetMenuPosition(this.menu.currentDropdownActiveButton,this.menu.currentDropdown);const t=this.editor.opendControllers;0!==t.length&&this.__rePositionController(t)},__rePositionController(t){he.get("__dragMove")&&he.get("__dragMove")();for(let e=0;e<t.length;e++)t[e].notInCarrier||t[e].inst?._scrollReposition()},_resetFrameStatus(){_t.isResizeObserverSupported||(this.toolbar.resetResponsiveToolbar(),this.options.get("_subMode")&&this.subToolbar.resetResponsiveToolbar());const t=this.context.get("toolbar_main"),e="none"===t.style.display||this.editor.isInline&&!this.toolbar._inlineToolbarAttr.isShow;if(0===t.offsetWidth&&!e)return;const i=this.editor.opendBrowser;if(i&&"block"===i.area.style.display&&(i.body.style.maxHeight=xt.utils.getClientSize().h-i.header.offsetHeight-50+"px"),this.menu.currentDropdownActiveButton&&this.menu.currentDropdown&&this.menu._resetMenuPosition(this.menu.currentDropdownActiveButton,this.menu.currentDropdown),this.viewer._resetFullScreenHeight())return;const s=this.frameContext;s.get("isCodeView")&&this.editor.isInline?this.toolbar._showInline():(this.editor._iframeAutoHeight(s),this.toolbar.isSticky&&(this.context.get("toolbar_main").style.width=s.get("topArea").offsetWidth-2+"px",this.toolbar._resetSticky()))},_setSelectionSync(){this.removeGlobalEvent(this.__selectionSyncEvent),this.__selectionSyncEvent=this.addGlobalEvent("mouseup",(()=>{this.selection._init(),this.removeGlobalEvent(this.__selectionSyncEvent)}))},_retainStyleNodes(t,e){let i=e[0].cloneNode(!1);for(let t,s=1,n=e.length;s<n;s++)t=e[s].cloneNode(!1),i.appendChild(t),i=t;const{parent:s,inner:n}=this.nodeTransform.createNestedNode(e,null),o=xt.utils.createTextNode(Ct.zeroWidthSpace);n.appendChild(o),t.innerHTML="",t.appendChild(s),this.selection.setRange(o,1,o,1)},_clearRetainStyleNodes(t){t.innerHTML="<br>",this.selection.setRange(t,0,t,0)},_callPluginEvent(t,e){const i=this.editor._onPluginEvents.get(t);for(let t,s=0;s<i.length;s++)if(t=i[s](e),"boolean"==typeof t)return t},async _callPluginEventAsync(t,e){const i=this.editor._onPluginEvents.get(t);for(let t,s=0;s<i.length;s++)if(t=await i[s](e),"boolean"==typeof t)return t},__removeInput(){this._inputFocus=this.editor._preventBlur=!1,this.__inputBlurEvent=this.removeEvent(this.__inputBlurEvent),this.__inputKeyEvent=this.removeEvent(this.__inputKeyEvent),this.__inputPlugin=null},__postFocusEvent(t,e){(this.editor.isInline||this.editor.isBalloonAlways)&&this.toolbar.show(),this.editor.isSubBalloonAlways&&this.subToolbar.show(),this.triggerEvent("onFocus",{frameContext:t,event:e}),this._callPluginEvent("onFocus",{frameContext:t,event:e})},__postBlurEvent(t,e){(this.editor.isInline||this.editor.isBalloon)&&this._hideToolbar(),this.editor.isSubBalloon&&this._hideToolbar_sub(),this.triggerEvent("onBlur",{frameContext:t,event:e}),this._callPluginEvent("onBlur",{frameContext:t,event:e})},__setViewportSize(){this.status.currentViewportHeight=kt.get(ki.visualViewport.height,0)},constructor:Hi};const qi=Hi,{_w:Wi}=_t,Ui=Math.floor(96/72*841.89105);function Zi(t,e){this.editor=t,this.status=t.status,this.context=t.context,this.selection=t.selection,this.offset=t.offset,this.fc=e,this.ww=e.get("wysiwyg"),this.wwFrame=e.get("wysiwygFrame"),this.wwWidth=-1,this.wwHeight=-1,this.innerHeaders=[],this._wwHeaders=[],this.documentTypeInner=e.get("documentTypeInner"),this.inner=null,this.page=null,this.totalPages=0,this.pageNum=0,this.pageHeight=-1,this.pageBreaksCnt=0,this.pages=[],this.pages_line=[],this.prevScrollTop=0,this.useHeader=t.options.get("_type_options").includes("header"),this.usePage=t.options.get("_type_options").includes("page"),this.navigatorButtons=[],this.pageNavigator=null,this._mirror=e.get("documentTypePageMirror"),this._mirrorCache=0,this._positionCache=new Map,this._rePageTimeout=null;const i=Wi.getComputedStyle(this._mirror);if(this._paddingTop=kt.get(i.paddingTop),this._paddingBottom=kt.get(i.paddingBottom),this.useHeader){const t=this._getHeaders(),e=this.inner=this.documentTypeInner.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${kt.get(e.nodeName)}" title="${e.textContent}">${e.textContent}</div>`;e.innerHTML=i,this.innerHeaders=e.querySelectorAll("div"),this.editor.eventManager.addEvent(e,"click",Gi.bind(this,this.ww))}this.usePage&&(this.page=e.get("documentTypePage"),this.pageNavigator=t.plugins.pageNavigator)}function Gi(t,e){e.preventDefault();try{this.editor._preventBlur=!0;const t=xt.query.getEventTarget(e);if(xt.utils.hasClass(t,"se-doc-item")){const e=Array.prototype.indexOf.call(this.innerHeaders,t);if(-1===e)return;const i=this._wwHeaders[e];i&&this.selection.scrollTo(i)}}finally{this.editor._preventBlur=!1}}Zi.prototype={reHeader(){if(!this.useHeader)return;const t=this._getHeaders(),e=this.inner,i=this.innerHeaders;for(let s,n,o,l=0,r=t.length;l<r;l++)if(s=t[l],n=`se-doc-h${kt.get(s.nodeName)}`,o=i[l],l<i.length)o.classList.contains(n)&&o.textContent===s.textContent||(o.textContent=o.title=s.textContent,o.className=`se-doc-item ${n}`);else{const t=document.createElement("div");t.className=`se-doc-item ${n}`,t.textContent=t.title=s.textContent,e.appendChild(t)}if(i.length>t.length)for(let s=t.length;s<i.length;s++)e.removeChild(i[s]);this.innerHeaders=e.querySelectorAll("div")},async rePage(t){this.page&&(this._rePageTimeout&&Wi.clearTimeout(this._rePageTimeout),this._rePageTimeout=Wi.setTimeout((async()=>{await xt.utils.waitForMediaLoad(this._mirror,1500);const e=this.ww.scrollHeight>this._mirror.scrollHeight?this.ww.scrollHeight-this._mirror.scrollHeight:0,i=this._mirror.scrollHeight+e,s=this.ww.querySelectorAll(".se-page-break");if(!t&&this.pageHeight===i&&this.pageBreaksCnt===s.length)return;this.pageHeight=i,this.pageBreaksCnt=s.length;let n=0,o=0,l=0;if(s.length>0){n=s[0].offsetHeight;for(let t=0;t<s.length;t++){const e=s[t].offsetTop;(e-o)%Ui!=0&&l++,o=e}const t=i-o;t>0&&t%Ui!=0&&l++}const r=this.status.isScrollable(this.fc)?this._getWWScrollTop():0,a=Math.ceil(i/Ui)+l,h=this.wwFrame.offsetWidth+1,c=[];for(let t=0;t<s.length;t++)c.push({number:t,top:s[t].offsetTop+n/2-r});this._mirrorCache=0;const d=this.ww.children,u=this._mirror.children;this._initializeCache(u),c.push({number:0,top:0});for(let t=1,e=0;t<a;t++)if(e+=Ui+(1===t?this._paddingTop+this._paddingBottom:this._paddingTop),!c.some((t=>Math.abs(t.top-e)<3))){const i=this._calcPageBreakTop(e,d,u);if(null===i)break;c.push({number:t,top:i})}if(0===c.length)return this.pages_line=[],this.totalPages=1,void this._displayCurrentPage();c.sort(((t,e)=>t.top-e.top)),this.page.innerHTML="",this.pages=[];for(let t,e=0;e<a;e++){if(!c[e])continue;if(t=c[e].top,i<t)break;const s=xt.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.page.appendChild(s),this.pages.push(s)}this.pages_line=this.page.querySelectorAll(".se-document-page-line"),this.totalPages=this.pages.length,this._displayCurrentPage()}),400))},_getDisplayPage(){return this.status.isScrollable(this.fc)?this.fc.get("wysiwyg"):Wi},_calcPageBreakTop(t,e,i){const{ci:s}=this._getElementAtPosition(t,i),n=i[s],o=e[s];if(!n||!o)return null;const l=t+(o.offsetTop-n.offsetTop)+(o.offsetHeight-n.offsetHeight)/2;return Math.round(l)},_initializeCache(t){this._positionCache.clear();for(let e=0,i=t.length;e<i;e++){const i=t[e],s=i.offsetTop,n=i.offsetHeight,o=s+n;this._positionCache.set(e,{top:s,height:n,bottom:o})}},_getElementAtPosition(t,e){let i=this._mirrorCache,s=e.length-1;for(;i<=s;){const e=Math.floor((i+s)/2),{top:n,height:o,bottom:l}=this._positionCache.get(e);if(t>=n&&t<=l)return this._mirrorCache=e,{ci:e,cm:t-l,ch:o};t<n?s=e-1:i=e+1}const n=e[i]?i:s;this._mirrorCache=n;const o=this._positionCache.get(n);return{ci:n,cm:t-o.bottom,ch:o.height}},resizePage(){const t=this.wwFrame.offsetWidth+1,e=this.wwFrame.offsetHeight+1;let i=!1;if(t===this.wwWidth&&(i=e===this.wwHeight))return;t>800?xt.utils.removeClass(this.documentTypeInner,"se-document-responsible"):xt.utils.addClass(this.documentTypeInner,"se-document-responsible"),this.wwWidth=t,this.wwHeight=e;const s=this.pages_line;for(let e=0,i=s.length;e<i;e++)s[e].style.width=`${t}px`;i||this.rePage(!0),this._displayCurrentPage()},scrollPage(){const t=this.prevScrollTop,e=this._getWWScrollTop();if(t===e)return;const i=this.pages;for(let s=0,n=i.length;s<n;s++)i[s].style.top=kt.get(i[s].style.top)-(e-t)+"px";this.prevScrollTop=e,this._displayCurrentPage()},scrollWindow(){this.status.isScrollable(this.fc)||this._displayCurrentPage()},getCurrentPageNumber(){if(this.totalPages<=1)return 1;let t=0;if(this.status.isScrollable(this.fc))t=this.wwHeight/2;else{const e=this._getGlobalTop();if(t=Wi.scrollY-e+Ui/2,t<=0)return 1}const e=this.pages;for(let i=0,s=e.length;i<s;i++)if(e[i].offsetTop>=t)return this.pageNum=i;return this.pageNum=this.totalPages},pageUp(){const t=this.pageNum-1<=1?1:this.pageNum-1;this._movePage(t,!1)},pageDown(){const t=this.pageNum+1>this.pages.length?this.pages.length:this.pageNum+1;this._movePage(t,!1)},pageGo(t){t<1?t=1:t>this.pages.length&&(t=this.pages.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&&(xt.utils.removeClass(this.innerHeaders,"active"),xt.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.pageNavigator?.display(t,this.totalPages)},_getWWScrollTop(){const t=this._getDisplayPage();return t.scrollTop||t.scrollY||0},_movePage(t,e){const i=this._getGlobalTop(),s=this.status.isScrollable(this.fc),n=wt.nodeListToArray(this.ww.children),o=this.page.offsetTop+kt.get(this.pages[t-1].style.top)+(s?this._getWWScrollTop():0);for(let l,r=0,a=n.length;r<a;r++)if(l=n[r],l.offsetTop>=o){e||this.selection.setRange(l,0,l,0);const n=0===r&&s?0:l.offsetTop-this.page.offsetTop-l.offsetHeight+i;this._applyPageScroll(n,(()=>{this.editor.toolbar.isSticky&&this._getDisplayPage().scrollTo({top:n-this.context.get("toolbar_main").offsetHeight,behavior:"smooth"})})),this.pageNum=t;break}},_applyPageScroll(t,e){const i=this._getDisplayPage();i.scrollTo({top:t,behavior:"smooth"});const s=()=>{Math.abs((i.scrollY??i.scrollTop)-t)<1?e():Wi.requestAnimationFrame(s)};Wi.requestAnimationFrame(s)},_getGlobalTop(){return this.status.isScrollable(this.fc)?0:this.offset.getGlobal(this.wwFrame).top},_findItem(t){const e=this._wwHeaders,i=Array.prototype.indexOf.call(e,t);return-1!==i&&this.innerHeaders[i]?this.innerHeaders[i]:null},_findLinesHeader(t){for(;t&&t!==this.ww;){if(this._is(t))return t;t=t.previousElementSibling||t.parentElement}return null},_is:t=>/^h[1-6]$/i.test(t?.nodeName),_getHeaders(){return this._wwHeaders=this.ww.querySelectorAll("h1, h2, h3, h4, h5, h6")},constructor:Zi};const Yi=Zi;function ji(t){this.editor=t}ji.prototype={isNode(t){return t&&"number"==typeof t.nodeType||t instanceof this._getFrameWindow().Node},isElement(t){return t&&1===t.nodeType||t instanceof this._getFrameWindow().Element},isRange(t){return t&&"Range"===t.constructor?.name||t instanceof this._getFrameWindow().Range},isSelection(t){return t&&"Selection"===t.constructor?.name||t instanceof this._getFrameWindow().Selection},_getFrameWindow(){return this.editor.frameContext.get("_ww")},constructor:ji};const Xi=ji;const Ki=function(t){this.toolbar=t.toolbar,this.subToolbar=null,t.subToolbar&&(this.subToolbar=t.subToolbar),this.char=t.char,this.component=t.component,this.format=t.format,this.html=t.html,this.inline=t.inline,this.listFormat=t.listFormat,this.menu=t.menu,this.nodeTransform=t.nodeTransform,this.offset=t.offset,this.selection=t.selection,this.shortcuts=t.shortcuts,this.ui=t.ui,this.viewer=t.viewer};function Ji(t){re.call(this,t)}function Qi(t){t&&!X(t,"se-blink")&&(K(t,"se-blink"),n.setTimeout((()=>{J(t,"se-blink")}),600))}Ji.prototype={check(t){const e=this.frameOptions.get("charCounter_max");if(e){const i=this.getLength("string"==typeof t?t:"byte-html"===this.frameOptions.get("charCounter_type")&&1===t.nodeType?t.outerHTML:t.textContent);if(i>0&&i+this.getLength()>e)return Qi(this.frameContext.get("charWrapper")),!1}return!0},getLength(t){return"string"!=typeof t&&(t="byte-html"===this.frameOptions.get("charCounter_type")?this.frameContext.get("wysiwyg").innerHTML:this.frameContext.get("wysiwyg").textContent),/byte/.test(this.frameOptions.get("charCounter_type"))?this.getByteLength(t):t.length},getByteLength(t){if(!t||!t.toString)return 0;let e,i;return t=t.toString(),d?(i=decodeURIComponent(encodeURIComponent(t)).length,e=0,null!==encodeURIComponent(t).match(/(%0A|%0D)/gi)&&(e=encodeURIComponent(t).match(/(%0A|%0D)/gi).length),i+e):(i=(new TextEncoder).encode(t).length,e=0,null!==encodeURIComponent(t).match(/(%0A|%0D)/gi)&&(e=encodeURIComponent(t).match(/(%0A|%0D)/gi).length),i+e)},display(t){const e=(t||this.frameContext).get("charCounter");e&&n.setTimeout((()=>{e.textContent=this.getLength()}),0)},test(t,e){let i=0;t&&(i=this.getLength(t)),this.display();const s=this.frameOptions.get("charCounter_max");if(s>0){let t=!1;const n=this.getLength();if(n>s){if(t=!0,i>0&&e){this.selection._init();const t=this.selection.getRange(),e=t.endOffset-1,i=this.selection.getNode().textContent,s=t.endOffset-1;this.selection.getNode().textContent=i.slice(0,s<0?0:s)+i.slice(t.endOffset,i.length),this.selection.setRange(t.endContainer,e,t.endContainer,e)}}else n+i>s&&(t=!0);if(t&&(Qi(this.frameContext.get("charWrapper")),i>0))return!1}return!0},constructor:Ji};const ts=Ji,{_w:es,isMobile:is,ON_OVER_COMPONENT:ss}=_t,ns="2147483646",os="2147483645",ls="2147483642",rs="2147483641";const as=class extends re{#t;#e;#i;#s;#n;#o;#l;#r;#a;#h;#c;constructor(t,e,i,s){super(t.editor),this.toolbar=this.editor.toolbar,this.subToolbar=this.editor.subToolbar,this.component=this.editor.component,this.ui=this.editor.ui,this.selection=this.editor.selection,this.offset=this.editor.offset,this.kind=s||t.constructor.key||t.constructor.name,this.inst=t,this.form=e,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.#t=!1,this.#e="function"==typeof i.initMethod?i.initMethod:null,this.#i={keydown:this.#d.bind(this),mousedown:this.#u.bind(this)},this.#s=null,this.#n=null,this.#o={left:0,top:0},this.#l=null,this.#r=null,this.#a=!1,this.#h=[],this.#c=new Map;for(const t of this.parents)xt.check.isElement(t)?this.parentsForm.push(t):(t.#h.push(this),this.parentsForm.push(t.form));this.carrierWrapper.appendChild(e),this.eventManager.addEvent(e,"click",this.#p.bind(this)),this.eventManager.addEvent(e,"mouseenter",this.#g.bind(this)),this.eventManager.addEvent(e,"mouseleave",this.#m.bind(this))}open(t,e,{isWWTarget:i,initMethod:s,disabled:n,addOffset:o}={}){if(ae.get("__overInfo")===ss)return;if(!t)return void console.warn("[SUNEDITOR.Controller.open.fail] The target element is required.");this.form.removeAttribute("data-se-hidden-by-parent"),this.form.removeAttribute("data-se-hidden-by-children"),this.#c.clear(),this.editor.isBalloon?this.toolbar.hide():this.editor.isSubBalloon&&this.subToolbar.hide(),this.status.hasFocus||(n??this.disabled?this.ui.setControllerOnDisabledButtons(!0):this.ui.setControllerOnDisabledButtons(!1)),this.currentPositionTarget=e||t,this.isWWTarget=i??this.isWWTarget,"function"==typeof s&&(this.#e=s),this.editor.currentControllerName=this.kind,this.#o={left:0,top:0},o&&(this.#o={...this.#o,...o});const l=this.isOutsideForm?this.parentsForm:[];this.editor.opendControllers?.forEach((t=>{l.includes(t.form)||(t.form.style.zIndex=rs)})),this.parentsHide&&this.parentsForm.forEach((t=>{t.style.display="none",t.setAttribute("data-se-hidden-by-children","1")})),this.#f(),this.#b(this.form,this.currentPositionTarget,!1);const r=this.instanceCheck.isRange(t);this.currentTarget=r?null:t,this.#y(this.form,t,r),es.setTimeout((()=>ae.set("__overInfo",!1)),0)}close(t){(t||this.isOpen&&!this.#a)&&(this.form.removeAttribute("data-se-hidden-by-parent"),this.form.removeAttribute("data-se-hidden-by-children"),this.#c.clear(),this.#v("close"),this.toTop=!1,this.isOpen=!1,this.#a=!1,this.__offset={},this.#o={left:0,top:0},this.#_(),this.#e?.(),this.#C(),this.parentsHide&&!t&&this.parentsForm.forEach((t=>{t.style.display="block",t.removeAttribute("data-se-hidden-by-children")})),this.inst.controllerClose?.(),this.parentsForm.length>0||this.component.deselect())}hide(){this.#v("hide"),this.form.style.display="none"}show(){this.#b(this.form,this.currentPositionTarget,!1)}bringToTop(t){this.toTop=t,this.form.style.zIndex=t?ns:os}resetPosition(t){this.#b(this.form,t||this.currentPositionTarget,!0)}_scrollReposition(){this.form.hasAttribute("data-se-hidden-by-parent")||this.form.hasAttribute("data-se-hidden-by-children")||this.#b(this.form,this.currentPositionTarget,!1)&&es.setTimeout((()=>{this.#v("show")}),0)}#v(t){for(const e of this.#h)if("hide"===t&&"none"!==e.form.style.display){const t=this.#w(e);e.#c.set(this,!0);const i=this.#w(e);!t&&i&&(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.#v("show");continue}const t=this.#w(e);e.#c.set(this,!1);const i=this.#w(e);t&&!i&&(e.form.removeAttribute("data-se-hidden-by-parent"),e.show())}else e[t]?.(!0)}#w(t){for(const e of t.#c.values())if(!0===e)return!0;return!1}async#y(t,e,i){const s={position:this.position,inst:this,form:t,target:e,isRangeTarget:i,notInCarrier:!this.carrierWrapper.contains(t)};!1!==await this.triggerEvent("onBeforeShowController",{caller:this.kind,frameContext:this.frameContext,info:s})&&(t.style.display="block",this.editor._shadowRoot&&(this.#l=t,this.#r=t=>t.stopPropagation(),t.addEventListener("mousedown",this.#r)),this.editor._controllerTargetContext=this.frameContext.get("topArea"),this.isOpen||this.editor.opendControllers.push(s),this.isOpen=!0,this.editor._preventBlur=!0,this.editor.status.onSelected=!0,this.inst.controllerOn?.(t,e),this.triggerEvent("onShowController",{caller:this.kind,frameContext:this.frameContext,info:s}))}#C(){this.form.style.display="none",this.editor.opendControllers=this.editor.opendControllers.filter((t=>t.form!==this.form)),this.editor.currentControllerName!==this.kind&&this.editor.opendControllers.length>0||(this.ui.setControllerOnDisabledButtons(!1),this.frameContext.get("lineBreaker_t").style.display=this.frameContext.get("lineBreaker_b").style.display="none",this.editor.effectNode=null,this.editor.currentControllerName="",this.editor._preventBlur=!1,this.editor._controllerTargetContext=null,es.setTimeout((()=>{this.editor.status.onSelected=!1}),0),this.#l&&(this.#l.removeEventListener("mousedown",this.#r),this.#l=this.#r=null))}#b(t,e,i){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.selection.isRange(e)){if(!this.offset.setRangePosition(this.form,e,{position:"bottom"}))return this.hide(),!1}else{const s=this.offset.setAbsPosition(t,e,{addOffset:this.#o,position:this.position,isWWTarget:this.isWWTarget,inst:this,sibling:this.sibling});if(!s)return this.hide(),!1;if(i||!this.sibling||this.siblingMain)this.#t=!1;else{const e=t.offsetTop-this.#o.top;"bottom"===s.position?(this.#t=!0,t.style.top=e+this.sibling.offsetHeight-1+"px"):(this.#t=!1,t.style.top=e-this.sibling.offsetHeight+2+"px")}}return t.style.zIndex=this.toTop?os:this.#t?ls:rs,t.style.visibility="",!0}#f(){this.#_(),this.#s=this.eventManager.addGlobalEvent("keydown",this.#i.keydown,!0),this.#n=this.eventManager.addGlobalEvent(is?"click":"mousedown",this.#i.mousedown,!0)}#_(){this.component.__removeGlobalEvent(),this.#s&&=this.eventManager.removeGlobalEvent(this.#s),this.#n&&=this.eventManager.removeGlobalEvent(this.#n)}#x(){if(this.editor.selectMenuOn)return!0;const t=this.editor.opendControllers;for(let e=0;e<t.length;e++)if(t[e].inst===this&&t[e].fixed)return!0;return!1}#k(t){if(xt.check.isWysiwygFrame(t)||t.contains(this.form))return!1;if(xt.utils.hasClass(t,"se-drag-handle"))return!0;let e=!1;this.isInsideForm&&this.parentsForm?.length>0&&this.parentsForm.some((i=>{if(i.contains(t))return e=!0,!0}));const i=this.inst._element;return!e&&(!!xt.query.getParentElement(t,".se-controller")||(this.component.isInline(i)?t===i:t?.contains(i)))}#p(t){const e=xt.query.getEventTarget(t),i=xt.query.getCommandTarget(e);i&&(t.stopPropagation(),t.preventDefault(),this.inst.controllerAction(i))}#g(t){if(this.editor.currentControllerName=this.kind,this.parentsForm.length>0&&this.isInsideForm)return;xt.query.getEventTarget(t).style.zIndex=this.toTop?ns:os}#m(t){if(this.parentsForm.length>0&&this.isInsideForm)return;xt.query.getEventTarget(t).style.zIndex=this.toTop?os:this.#t?ls:rs}#d(t){if(this.#x())return;const e=t.code;if(Et.isCtrl(t)||!Et.isNonResponseKey(e))return;const i=xt.query.getEventTarget(t);if(Et.isEsc(e)){if(this.#h.some((({isOpen:t})=>t)))return}else{if(this.form.contains(i)||this.#k(i))return;if(this.editor._fileManager.pluginRegExp.test(this.kind))return}this.#E(i),this.close()}#u(t){const e=xt.query.getEventTarget(t);this.inst?._element?.contains(e)?this.#a=!0:(this.#a=!1,e===this.inst._element||e===this.currentTarget||this.#x()||this.form.contains(e)||this.#k(e)||xt.query.getParentElement(e,".se-line-breaker-component")||(this.#E(e),this.close(!0)))}#E(t){this.frameContext.get("wysiwyg").contains(t)||(this.component.__prevent=!1)}},{_w:hs}=_t;const cs=class extends re{#S;#T;#H;#L;#M;#N;#s;#A;#B;#V;#I;#i;constructor(t,e){super(t.editor),this.offset=this.editor.offset,this.kink=t.constructor.key||t.constructor.name,this.inst=t;const i=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=i[0],this.subPosition=i[1],this.splitNum=e.splitNum||0,this.horizontal=!!this.splitNum,this.openMethod=e.openMethod,this.closeMethod=e.closeMethod,this.#S=/^(left|right)$/.test(this.position)?"left"===this.position?"right":"left":this.position,this.#T=/^(left|right)$/.test(this.subPosition)?"left"===this.subPosition?"right":"left":this.subPosition,this.#H="ltr"!==e.dir&&("rtl"===e.dir||null),this.#L=null,this.#M=null,this.#N=null,this.#s=null,this.#A=null,this.#B=null,this.#V=null,this.#I={mousedown:this.#O.bind(this),mousemove:this.#R.bind(this),click:this.#F.bind(this),keydown:this.#z.bind(this)},this.#i={keydown:this.#$.bind(this),mousedown:this.#u.bind(this),click:this.#P.bind(this)}}create(t,e){this.form.firstElementChild.innerHTML="",e||=t;let i="";for(let t=0,s=e.length;t<s;t++)t>0&&t%this.splitNum==0&&(this.#D(i),i=""),i+=`<li class="se-select-item" data-index="${t}">${"string"==typeof e[t]?e[t]:e[t].outerHTML}</li>`;this.#D(i),this.items=t,this.menus=Array.from(this.form.querySelectorAll("li")),this.menuLen=this.menus.length}on(t,e,i={}){this.#L=t,this.#M=xt.check.isInputElement(t)?t:this.frameContext.get("_ww"),this.#N=e,this.form=xt.utils.createElement("DIV",{class:"se-select-menu"+(i.class?" "+i.class:""),style:i.style||""},'<div class="se-list-inner"></div>'),t.parentNode.insertBefore(this.form,t)}open(t,e){this.editor.selectMenuOn=!0,this.openMethod?.(),this.#q(),this.#f();const i=t?t.split("-"):[],s=i[0]||(null!==this.#H&&this.#H!==this.options.get("_rtl")?this.#S:this.position),n=i[1]||(null!==this.#H&&this.#H!==this.options.get("_rtl")?this.#T:this.subPosition);this.#W(s,n,e),this.isOpen=!0}close(){this.editor.selectMenuOn=!1,xt.utils.removeClass(this.#L,"on"),this.#U(),this.form?.removeAttribute("style"),this.isOpen=!1,this.closeMethod?.()}getItem(t){return this.items[t]}setItem(t){this.#Z(t)}#D(t){this.form.firstElementChild.innerHTML+=`<ul class="se-list-basic se-list-checked${this.horizontal?" se-list-horizontal":""}">${t}</ul>`}#U(){this.#G(),this.#_(),this.index=-1,this.item=null,this._onItem&&(xt.utils.removeClass(this._onItem,"se-select-on"),this._onItem=null)}#Y(t){t=this.index+t;const e=this.menuLen,i=this.index=t>=e?0:t<0?e-1:t;this.#Z(i)}#Z(t){xt.utils.removeClass(this.form,"se-select-menu-mouse-move");const e=this.menuLen;for(let i=0;i<e;i++)i===t?xt.utils.addClass(this.menus[i],"active"):xt.utils.removeClass(this.menus[i],"active");this.index=t,this.item=this.items[t]}#W(t,e,i,s){const n=t,o=this.form,l=this.#L;o.style.visibility="hidden",o.style.display="block",xt.utils.removeClass(o,"se-select-menu-scroll"),xt.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.offset.get(l),g=l.offsetTop,m=p.top,f=l.offsetHeight,b=xt.utils.getClientSize().h-(m-hs.scrollY+f),y=c?f:0;let v=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 i=this.offset.getGlobal(o).top;const s=t-(m-i)-b-f;s>0&&(u-=s+4,o.style.top=u+"px"),i=this.offset.getGlobal(o).top,i<0&&(t+=i-4,u-=i-4),o.style.height=t+"px";break}case"top":if(m<o.offsetHeight-y){if(!s){v=0;break}v=m-4+y,v>=38&&(o.style.height=v+"px")}u=g-o.offsetHeight+y;break;case"bottom":if(b<o.offsetHeight+y){if(!s){v=0;break}v=b-4+y,v>=38&&(o.style.height=v+"px")}u=g+(c?0:f)}if(v<38&&!s&&"middle"!==t)return void this.#W("top"===t?"bottpm":"top",e,i,!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 _=this.offset.getGlobal(o).left;let C=0;switch(c+"-"+(c?n:e)){case"true-left":C=p.left-hs.scrollX+_,C<0&&(d=d=h+a+1);break;case"true-right":C=hs.innerWidth-(_+r),C<0&&(d=h-r-1);break;case"false-center":{C=hs.innerWidth-(_+r),C<0&&(d+=C-4),o.style.left=d+"px";const t=this.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":_<0&&(d-=_-4)}if(i){const t=o.firstElementChild.querySelector(i);t&&(this._onItem=t,xt.utils.addClass(t,"se-select-on"))}o.style.left=d+"px",o.style.top=u+"px",o.style.visibility=""}#j(t){this.checkList&&xt.utils.toggleClass(this.menus[t],"se-checked"),this.#N(this.getItem(t))}#q(){this.#G(),this.#V=this.#I,this.form.addEventListener("mousedown",this.#V.mousedown),this.form.addEventListener("mousemove",this.#V.mousemove),this.form.addEventListener("click",this.#V.click),this.#M.addEventListener("keydown",this.#V.keydown)}#G(){this.#V&&(this.form.removeEventListener("mousedown",this.#V.mousedown),this.form.removeEventListener("mousemove",this.#V.mousemove),this.form.removeEventListener("click",this.#V.click),this.#M.removeEventListener("keydown",this.#V.keydown),this.#V=null)}#f(){this.#_(),this.#s=this.eventManager.addGlobalEvent("keydown",this.#i.keydown,!0),this.#A=this.eventManager.addGlobalEvent("mousedown",this.#i.mousedown,!0)}#_(){this.#s&&=this.eventManager.removeGlobalEvent(this.#s),this.#A&&=this.eventManager.removeGlobalEvent(this.#A),this.#B&&=this.eventManager.removeGlobalEvent(this.#B)}#z(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.#j(this.index)):this.close()}e&&this.#Y(e)}#O(t){if(_t.isGecko){const e=xt.query.getEventTarget(t),i=xt.query.getParentElement(e,".se-select-item");i&&this.eventManager._injectActiveEvent(i)}}#R(t){const e=xt.query.getEventTarget(t);xt.utils.addClass(this.form,"se-select-menu-mouse-move");const i=e.getAttribute("data-index");i&&(this.index=Number(i))}#F(t){let e=xt.query.getEventTarget(t),i=null;for(;!i&&!/UL/i.test(e.tagName)&&!xt.utils.hasClass(e,"se-select-menu");)i=e.getAttribute("data-index"),e=e.parentElement;i&&this.#j(Number(i))}#$(t){Et.isEsc(t.code)&&this.close()}#u(t){const e=xt.query.getEventTarget(t);this.form.contains(e)||(t.target!==this.#L?this.close():xt.check.isInputElement(e)||(this.#B=this.eventManager.addGlobalEvent("click",this.#i.click,!0)))}#P(t){this.#B=this.eventManager.removeGlobalEvent(this.#B),t.target===this.#L&&(t.stopPropagation(),this.close())}},{_w:ds,ON_OVER_COMPONENT:us}=_t,ps={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 gs=!1,ms=!1,fs=0,bs=0;class ys extends re{#X;#K;#J;#Q;#tt;#et;#it;#st;#nt;#ot;#lt;#rt;constructor(t,e,i){super(t.editor),this.kind=t.constructor.key||t.constructor.name,this._alignIcons={none:this.icons.format_float_none,left:this.icons.format_float_left,right:this.icons.format_float_right,center:this.icons.format_float_center},this.component=this.editor.component,this.ui=this.editor.ui,this.offset=this.editor.offset,this.selection=this.editor.selection,this.html=this.editor.html,this.format=this.editor.format,this.nodeTransform=this.editor.nodeTransform,this._action={};const s=function(t,e){let i=null;if(e?.length>0){const{lang:s,icons:n}=t;i='<div class="se-arrow se-arrow-up"></div>';for(let o,l=0;l<e.length;l++){o=e[l],i+='<div class="se-btn-group">';for(let e,l=0,r=o.length;l<r;l++){if(e=o[l],"function"==typeof e?.action){const i=e;e={c:`__c__${i.command}`,v:i.value||"",l:i.title,i:i.icon},t._action[e.c]=i.action}else if(e=Cs(e),!e)continue;i+=`\n\t\t\t\t\t<button type="button" data-command="${e.c}" data-value="${e.v}" class="se-btn se-tooltip">\n\t\t\t\t\t\t${n[e.i]||e.i}\n\t\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${s[e.l]||e.l}</span></span>\n\t\t\t\t\t</button>`}i+="</div>"}}return i?xt.utils.createElement("DIV",{class:"se-controller se-controller-resizing"},i):null}(this,e||[]);if(this.controller=s?new as(this,s,{position:"bottom",disabled:!0},this.kind):null,s){this.alignButton=s.querySelector('[data-command="onalign"]');const t=function(t,e){if(!e)return null;const i=[t._alignIcons.none,t._alignIcons.left,t._alignIcons.center,t._alignIcons.right],s=[t.lang.basic,t.lang.left,t.lang.center,t.lang.right],n=["none","left","center","right"],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${i[t]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${s[t]}</span>\n\t\t\t</span>\n\t\t</button>`),l.push(n[t]);return{html:o,items:l}}(this,this.alignButton);t&&(this.selectMenu_align=new cs(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_align.on(this.alignButton,this.#at.bind(this),{class:"se-figure-select-list"}),this.selectMenu_align.create(t.items,t.html)),this.asButton=s.querySelector('[data-command="onas"]');const e=function(t,e){if(!e)return null;const i=[t.icons.as_block,t.icons.as_inline],s=[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${i[t]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${s[t]}</span>\n\t\t\t</span>\n\t\t</button>`),l.push(n[t]);return{html:o,items:l}}(this,this.asButton);e&&(this.selectMenu_as=new cs(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_as.on(this.asButton,this.#ht.bind(this),{class:"se-figure-select-list"}),this.selectMenu_as.create(e.items,e.html)),this.resizeButton=s.querySelector('[data-command="onresize"]');const i=function(t,e){if(!e)return null;const i=e.getAttribute("data-value").split(","),s=[];for(let e,n,o,l,r=0;r<i.length;r++)o=i[r],e=kt.is(o),n=e?"resize_percent"+o:"auto",l=e?o+"%":t.lang.autoSize,s.push('<button type="button" class="se-btn-list" data-command="'+n+'" data-value="'+o+'"><span>'+l+"</span></button>");return{html:s,items:i}}(this,this.resizeButton);i&&(this.selectMenu_resize=new cs(this,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.selectMenu_resize.on(this.resizeButton,this.#ct.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=s?.querySelectorAll('[data-command="resize_percent"]')||[],this.captionButton=s?.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.#dt.bind(this),this.__containerResizing=this.#ut.bind(this),this.__onContainerEvent=null,this.__offContainerEvent=null,this.#X="",this.#K="",this.#J=0,this.#Q=0,this.#tt=0,this.#et=0,this.#it="__se__float-none|__se__float-left|__se__float-center|__se__float-right",this.#st=!1,this.#nt={w:"",h:""},this.#ot=this.#pt.bind(this),this.#lt=this.#gt.bind(this),this.#rt=null,this.eventManager.addEvent(this.alignButton,"click",this.#mt.bind(this)),this.eventManager.addEvent(this.asButton,"click",this.#ft.bind(this)),this.eventManager.addEvent(this.resizeButton,"click",this.#bt.bind(this)),this.editor.applyFrameRoots((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 xt.utils.createElement("DIV",{class:"se-controller se-resizing-container",style:"display: none;"},t)}(),i=e.querySelectorAll(".se-resize-dot > span");t.set("_figure",{main:e,border:e.querySelector(".se-resize-dot"),display:e.querySelector(".se-resize-display"),handles:i}),t.get("wrapper").appendChild(e),this.eventManager.addEvent(i,"mousedown",this.#yt.bind(this))}}))}static CreateContainer(t,e){return xt.utils.createElement("DIV",{class:"se-component"+(e?" "+e:"")},xt.utils.createElement("FIGURE",null,t)),ys.GetContainer(t)}static CreateInlineContainer(t,e){return xt.utils.createElement("SPAN",{class:"se-component se-inline-component"+(e?" "+e:"")},t),ys.GetContainer(t)}static CreateCaption(t,e){const i=xt.utils.createElement("FIGCAPTION",null,"<div>"+e+"</div>");return t.appendChild(i),i}static GetContainer(t){const e=xt.query.getParentElement(t,"FIGURE",2),i=xt.query.getParentElement(t,"SPAN",2),s=e||i,n=xt.query.getParentElement(t,(t=>t.parentElement===s),0)||t;return{target:n,container:xt.query.getParentElement(n,ys.is,3)||e,cover:e,inlineCover:xt.utils.hasClass(i,"se-inline-component")?i:null,caption:xt.query.getEdgeChild(n.parentElement,"FIGCAPTION",!1),isVertical:_s(n)}}static GetRatio(t,e,i){let s=0,n=0;if(/\d+/.test(t+"")&&/\d+/.test(e+"")){if((!kt.is(t)&&String(t).replace(/\d+|\./g,"")||i||"px")===(!kt.is(e)&&String(e).replace(/\d+|\./g,"")||i||"px")){const i=kt.get(t,4),o=kt.get(e,4);s=i/o,n=o/i}}return{w:kt.get(s,4),h:kt.get(n,4)}}static CalcRatio(t,e,i,s){if(s?.w&&s?.h&&/\d+/.test(t+"")&&/\d+/.test(e+"")){const n=!kt.is(t)&&String(t).replace(/\d+|\./g,"")||i||"px",o=!kt.is(e)&&String(e).replace(/\d+|\./g,"")||i||"px";if(n===o){const i="%"===n?2:0,l=t,r=e;e=kt.get(s.h*kt.get(l,i),i)+o,t=kt.get(s.w*kt.get(r,i),i)+n}}return{w:t,h:e}}static is(t){return xt.check.isComponentContainer(t)||/^(HR)$/.test(t?.nodeName)}close(){this.editor._preventBlur=!1,xt.utils.removeClass(this._cover,"se-figure-selected"),this.component._removeDragEvent(),this.#vt(),this.controller?.close()}open(t,{nonResizing:e,nonSizeInfo:i,nonBorder:s,figureTarget:n,infoOnly:o}){if(!t)return void console.warn('[SUNEDITOR.modules.Figure.open] The "targetNode" is null.');ae.get("__overInfo")===us&&(s=!0);const l=ys.GetContainer(t),r=l.target;let a=!1;if(!l.container){if(this.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}ae.set("__figureInst",this),this.#_t(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.offset.getLocal(h),f=(r.getAttribute("data-se-size")||"").split(",");let b=kt.get(r.style.width,2)||c,y=kt.get(r.style.height,2)||d;this.isVertical&&([b,y]=[y,b]);const v=ys.GetRatio(b,y,this.sizeUnit),_={container:l.container,cover:l.cover,caption:l.caption,align:this.align,ratio:v,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.#X=_.width,this.#K=_.height,o)return _;const C=this.frameContext.get("_figure");this.editor._figureContainer=C.main,this.editor.opendControllers=this.editor.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.editor.opendControllers.push({position:"none",form:C.main,target:h,inst:this,notInCarrier:!0});const w=/%$/.test(r.style.width)&&/%$/.test(l.container.style.width)?kt.get(l.container.style.width,0)/100+"":"";for(let t=0,e=this.percentageButtons.length;t<e;t++)this.percentageButtons[t].getAttribute("data-value")===w?xt.utils.addClass(this.percentageButtons[t],"active"):xt.utils.removeClass(this.percentageButtons[t],"active");if(this.captionButton&&(l.caption?xt.utils.addClass(this.captionButton,"active"):xt.utils.removeClass(this.captionButton,"active")),C.display.style.display=i||this._inlineCover?"none":"",C.border.style.display=s?"none":"",C.main.style.display="block",ae.get("__overInfo")!==us){const t=e?"none":"flex",i=C.handles;for(let e=0,s=i.length;e<s;e++)i[e].style.display=t;if(this.controller){const t=this.getSize(r);xt.utils.changeTxt(C.display,this.lang["none"===this.align?"basic":this.align]+" ("+t.dw+", "+t.dh+")"),this.#Ct(),this.#wt(),this.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"]'),i=this._inlineCover||a?"none":"";e?.forEach((t=>{t.style.display=i}));const s=this.controller.form.querySelector('[data-command="onas"]');s&&(s.style.display=a?"none":"")}xt.utils.removeClass(this._cover,"se-figure-over-selected"),this.controller?.open(C.main,null,{initMethod:this.#ot,isWWTarget:!1,addOffset:null}),ds.setTimeout((()=>ae.set("__overInfo",!1)),0)}else xt.utils.addClass(this._cover,"se-figure-over-selected");return xt.utils.addClass(this._cover,"se-figure-selected"),this.#tt=this.#J=c,this.#et=this.#Q=d,this._inlineCover||ae.get("__overInfo")===us&&!xt.utils.hasClass(l.container,"se-input-component")||this.#xt(C.main),_}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 i=this.isVertical;i&&([t,e]=[e,t]),this.setFigureSize(t,e),i&&this.setTransform(this._element,t,e,0)}getSize(t){t||=this._element;const e=_s(t);let i="",s="",n="",o="";if(!t)return{w:i,h:s,dw:n,dh:o};const l=ys.GetContainer(t),r=l.target;return l.container?(i=/%$/.test(r.style.width)?(l.container&&kt.get(l.container.style.width,2)||100)+"%":r.style.width,s=l.inlineCover?l.inlineCover.style.height||t.style.height||String(t.height||""):kt.get(l.cover?.style.paddingBottom,0)>0&&!e?l.cover?.style.height:/%$/.test(r.style.height)&&/%$/.test(r.style.width)?(l.container&&kt.get(l.container.style.height,2)||100)+"%":r.style.height,i||="auto",s||="auto"):this.options.get("strictMode").formatFilter?(i="",s=r.style.height):(i=r.style.width||"auto",s=r.style.height||"auto"),n=e?s:i,o=e?i:s,{w:i,h:s,dw:n,dh:o}}setAlign(t,e){t||=this._element,this.align=e||="none";const i=ys.GetContainer(t);if(!i.cover)return;const s=i.target,n=i.container,o=i.cover;if(/%$/.test(s.style.width)&&"center"===e&&!this.component.isInline(n)?(n.style.minWidth="100%",o.style.width=n.style.width):(n.style.minWidth="",o.style.width=this.isVertical?s.style.height||s.offsetHeight+"px":s.style.width&&"auto"!==s.style.width?s.style.width||"100%":""),xt.utils.hasClass(n,"__se__float-"+e)||(xt.utils.removeClass(n,this.#it),xt.utils.addClass(n,"__se__float-"+e)),this.autoRatio){const{w:t,h:e}=this.getSize(this._element);this.__setCoverPaddingBottom(t,e)}this.#Ct()}convertAsFormat(t,e){t||=this._element,this.as=e||"block";const{container:i,inlineCover:s,target:n}=ys.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(s)break;this.component.deselect();const t=i.nextElementSibling,e=i.parentElement,n=ys.CreateInlineContainer(r);xt.utils.addClass(n.container,i.className.split(" ").filter((t=>"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this.#kt(n,o,l);const a=xt.utils.createElement(this.options.get("defaultLine"),null,n.container);e.insertBefore(a,t),xt.utils.removeItem(i);break}case"block":{if(!s)break;this.component.deselect(),this.selection.setRange(i,0,i,1);const t=this.html.remove(),e=this.nodeTransform.split(t.container,t.offset,0);e?.previousElementSibling&&xt.check.isZeroWidth(e.previousElementSibling)&&xt.utils.removeItem(e.previousElementSibling);const n=ys.CreateContainer(r);xt.utils.addClass(n.container,i.className.split(" ").filter((t=>"se-inline-component"!==t&&"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this.#kt(n,o,l),(e||t.container).parentElement.insertBefore(n.container,e);break}}return r}controllerAction(t){const e=t.getAttribute("data-command"),i=t.getAttribute("data-value"),s=t.getAttribute("data-type"),n=this._element;if(!/^on.+/.test(e)&&"selectMenu"!==s){switch(e){case"mirror":{const t=vs(n);let e=t.x,s=t.y;"h"===i&&!this.isVertical||"v"===i&&this.isVertical?s=s?"":"180":e=e?"":"180",this._setRotate(n,t.r,e,s);break}case"rotate":this.setTransform(n,null,null,Number(i));break;case"caption":if(this._caption)xt.utils.removeItem(this._caption),ds.setTimeout(this.component.select.bind(this.component,n,this.kind),0);else{const t=ys.CreateCaption(this._cover,this.lang.caption),e=xt.query.getEdgeChild(t,(t=>3===t.nodeType),!1);e?this.selection.setRange(e,0,e,e.textContent.length):t.focus(),this.controller.close()}this._caption=!this._caption,(/\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.component.copy(this._container);break;case"remove":this.inst.componentDestroy(n),this.controller.close()}/^__c__/.test(e)?this._action[e](n,i,t):"edit"!==e&&(this.history.push(!1),/^remove|caption$/.test(e)||this.component.select(n,this.kind))}}retainFigureFormat(t,e,i,s){const n=this.component.isInline(t),o=e.parentNode;let l=this.format.isBlock(o)||xt.check.isWysiwygFrame(o)?e:ys.GetContainer(e)?.container||o||e;if(xt.query.getParentElement(e,xt.check.isExcludeFormat))l=i&&i!==e?i:e,l.parentNode.replaceChild(t,l);else if(n&&this.format.isLine(l)){const i=n&&/^SPAN$/i.test(e.parentElement.nodeName)?e.parentElement:e;i.parentElement.replaceChild(t,i)}else if(xt.check.isListCell(l)){const i=xt.query.getParentElement(e,(t=>t.parentNode===l));l.insertBefore(t,i),xt.utils.removeItem(e),this.nodeTransform.removeEmptyNode(i,null,!0)}else if(this.format.isLine(l)){const i=xt.query.getParentElement(e,(t=>t.parentNode===l));l=this.nodeTransform.split(l,i),l.parentNode.insertBefore(t,l),xt.utils.removeItem(e),this.nodeTransform.removeEmptyNode(l,null,!0)}else if(this.format.isLine(l.parentNode)){const e=l.parentNode;e.parentNode.insertBefore(t,l.previousSibling?e.nextElementSibling:e),(0===s?.__updateTags.map((t=>l.contains(t))).length||xt.check.isZeroWidth(l))&&xt.utils.removeItem(l)}else l=xt.check.isFigure(l.parentNode)?xt.query.getParentElement(l.parentNode,ys.is):l,l.parentNode.replaceChild(t,l)}deleteTransform(t){t||=this._element;const e=t,i=(e.getAttribute("data-se-size")||"").split(",");this.isVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",this.#Et(e),this._applySize(i[0]||"auto",i[1]||"","")}setTransform(t,e,i,s){try{this.#st=!0;const n=vs(t),o=n.r+1*(s||0);s=Math.abs(o)>=360?0:o;const l=this.isVertical=_s(s);e=kt.get(e,0),i=kt.get(i,0);const r=t,a=(r.getAttribute("data-se-size")||"auto,auto").split(",");l&&this._setRotate(r,s,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=ys.GetContainer(r),n=t.cover||t.inlineCover,o=e||r.offsetWidth,a=i||r.offsetHeight,c=(l?a:o)+"px",d=(l?o:a)+"px";if(this.#St(),this._applySize(o+"px",a+"px",""),n&&(n.style.width=c,n.style.height=t.caption||t.inlineCover?"":d),l){h=90===s||-270===s?a/2+"px "+a/2+"px 0":o/2+"px "+o/2+"px 0"}}r.style.transformOrigin=h,l||this._setRotate(r,s,n.x,n.y),r.style.maxWidth=l?"none":"",this.#Tt(r)}finally{this.#st=!1}}_displayResizeHandles(t){const e=t?"flex":"none";this.controller&&(this.controller.form.style.display=e);const i=this.frameContext.get("_figure"),s=i.handles;for(let t=0,i=s.length;t<i;t++)s[t].style.display=e;"none"===e?(xt.utils.addClass(i.main,"se-resize-ing"),this.#rt=this.eventManager.addGlobalEvent("keydown",this.#lt)):xt.utils.removeClass(i.main,"se-resize-ing")}#kt(t,e,i){const s=this.kind;t.target.onload=()=>this.component.select(t.target,s),this.#_t(t),t.inlineCover&&(this.setAlign(t.target,"none"),this.deleteTransform()),this.setFigureSize(e,i)}#_t(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=_s(t.target)}_setRotate(t,e,i,s){let n=(t.offsetWidth-t.offsetHeight)*(/^-/.test(e+"")?1:-1),o="";if(/[1-9]/.test(e+"")&&(i||s))switch(o=i?"Y":"X",e+""){case"90":o=i&&s?"X":s?o:"";break;case"270":n*=-1,o=i&&s?"Y":i?o:"";break;case"-90":o=i&&s?"Y":i?o:"";break;case"-270":n*=-1,o=i&&s?"X":s?o:"";break;default:o=""}e%180==0&&(t.style.maxWidth=""),t.style.transform="rotate("+e+"deg)"+(i?" rotateX("+i+"deg)":"")+(s?" rotateY("+s+"deg)":"")+(o?" translate"+o+"("+n+"px)":"")}_applySize(t,e,i){const s=/^(rw|lw)$/.test(i)&&/\d+/.test(this._element.style.height),n=/^(th|bh)$/.test(i)&&/\d+/.test(this._element.style.width);e=e||(this.autoRatio?this.autoRatio.current||this.autoRatio.default:e),t=kt.is(t)?t+this.sizeUnit:t,/%$/.test(t)||/%$/.test(e)||s||n||this.#St();const o=this._cover||this._element;this.autoRatio&&this._cover&&(this._cover.style.width=t),n||(o.style.width=this._element.style.width=t),s||(e=kt.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.#Ht()}__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)?kt.get(kt.get(e,2)/100*kt.get(t,2),2)+"%":e:this._cover.style.paddingBottom=e)}_setAutoSize(){this._caption&&(this._caption.style.marginTop=""),this.deleteTransform(),this.#St(),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.#Ht()}_setPercentSize(t,e){e||=this.autoRatio?/%$/.test(this.autoRatio.current)?this.autoRatio.current:this.autoRatio.default:e,e=!e||/%$/.test(e+"")||kt.get(e,0)?kt.is(e)?e+this.sizeUnit:e||(this.autoRatio?this.autoRatio.default:""):kt.is(e)?e+"%":e;const i=/%$/.test(e+"");this._container.style.width=String(kt.is(t)?t+"%":t),this._container.style.height="",this._element!==this._cover||this.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%":i?"":e),"center"===this.align&&this.setAlign(this._element,this.align),this.autoRatio&&this.__setCoverPaddingBottom(String(t),String(e)),this.#Tt(this._element),this.#Ht()):this.#Ht()}#St(){this._cover&&(this._cover.style.width="",this._cover.style.height=""),this._container.style.width="",this._container.style.height="",xt.utils.removeClass(this._container,this.#it),xt.utils.addClass(this._container,"__se__float-"+this.align),"center"===this.align&&this.setAlign(this._element,this.align)}_setRevert(){this.setFigureSize(this.#nt.w,this.#nt.h)}#Ct(){this.alignButton&&xt.utils.changeElement(this.alignButton.firstElementChild,this._alignIcons[this.align])}#wt(){this.asButton&&xt.utils.changeElement(this.asButton.firstElementChild,this.icons[`as_${this.as}`])}#Ht(){if(this.#st)return;const t=(this._element.getAttribute("data-se-size")||",").split(",");this.#nt.w=t[0],this.#nt.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:"")}#Tt(t){const e=xt.query.getEdgeChild(xt.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="")}#Et(t){const e=xt.query.getEdgeChild(xt.query.getParentElement(t,"FIGURE"),"FIGCAPTION",!1);e&&(e.style.marginTop="")}#Lt(){this.component._removeDragEvent(),this.#vt(),this._displayResizeHandles(!0),this.ui._offCurrentController(),this.ui.disableBackWrapper()}#vt(){this.eventManager.removeGlobalEvent(this.__onContainerEvent),this.eventManager.removeGlobalEvent(this.__offContainerEvent),this.eventManager.removeGlobalEvent(this.#rt)}#xt(t){const e=this.frameContext.get("wrapper").querySelector(".se-drag-handle");xt.utils.removeClass(e,"se-drag-handle-full"),e.style.opacity="",e.style.width="",e.style.height="",ae.set("__dragHandler",e),ae.set("__dragContainer",this._container),ae.set("__dragCover",this._cover),ae.set("__dragMove",this.#Mt.bind(this,e,t)),ae.get("__dragMove")(),e.style.display="block"}#Mt(t,e){t.style.display="block",t.style.left=e.offsetLeft+(this.options.get("_rtl")?t.offsetWidth:e.offsetWidth-1.5*t.offsetWidth)+"px",t.style.top=e.offsetTop-t.offsetHeight+.5+"px"}#yt(t){t.stopPropagation(),t.preventDefault();const e=ae.get("__figureInst");if(!e)return;const i=xt.query.getEventTarget(t),s=e._resize_direction=i.classList[0];e._resizeClientX=t.clientX,e._resizeClientY=t.clientY,e.frameContext.get("_figure").main.style.float=/l/.test(s)?"right":/r/.test(s)?"left":"none",this.ui.enableBackWrapper(ps[s]);const{w:n,h:o,dw:l,dh:r}=this.getSize(e._element);if(gs=ms=!1,fs=bs=0,!this.isVertical){const t=!n||/auto|%$/.test(n),i=!o||/auto|%$/.test(o);if("tl|bl|tr|br".includes(s)&&t&&i?gs=!0:"lw|rw".includes(s)&&t&&(ms=!0),gs||ms){const t=e._cover||e._element;bs=t.offsetWidth,fs=wt.getWidthInPercentage(t,this.frameContext.get("wysiwygFrame"))/100}}e.__onContainerEvent=e.eventManager.addGlobalEvent("mousemove",e.__containerResizing),e.__offContainerEvent=e.eventManager.addGlobalEvent("mouseup",e.__containerResizingOff),e._displayResizeHandles(!1);const a=this.frameContext.get("_figure").display;a.style.display="block",xt.utils.changeTxt(a,l+" * "+r)}#ut(t){const e=this._resize_direction,i=t.clientX,s=t.clientY,n=this.isVertical;let o=n?this.#et:this.#tt,l=n?this.#tt:this.#et;const r=o+(/r/.test(e)?i-this._resizeClientX:this._resizeClientX-i),a=l+(/b/.test(e)?s-this._resizeClientY:this._resizeClientY-s),h=l/o*r,c=this.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.#X:Math.round(o),u=!n&&/w$/.test(e)?this.#K:Math.round(l),p=fs?d/bs*fs*100:d;xt.utils.changeTxt(this.frameContext.get("_figure").display,fs?kt.get(p>100?100:p,2).toFixed(2)+"%":p+" * "+u),this.#J=d,this.#Q=u}#dt(){this.#Lt();let t=this.isVertical?this.#Q:this.#J,e=this.isVertical?this.#J:this.#Q;if(t=Math.round(t)||t,e=Math.round(e)||e,!this.isVertical&&!/%$/.test(t+"")){const i=this.frameContext.get("wysiwygFrame").clientWidth-kt.get(this.frameContext.get("wwComputedStyle").getPropertyValue("padding-left"))+kt.get(this.frameContext.get("wwComputedStyle").getPropertyValue("padding-right"))-2;kt.get(t,0)>i&&(e=Math.round(e/t*i),t=i)}if(gs||ms){t=t/(this._cover||this._element).offsetWidth*fs*100;const e=kt.get(t>100?100:t,2)+"%";this._setPercentSize(e,ms?this.getSize(this._element).h:"")}else this._applySize(t,e,this._resize_direction),this.isVertical&&this.setTransform(this._element,t,e,0);this.history.push(!1),this.component.select(this._element,this.kind)}#gt(t){Et.isEsc(t.code)&&(this.#Lt(),this.component.select(this._element,this.kind))}#at(t){this.setAlign(this._element,t),this.selectMenu_align.close(),this.component.select(this._element,this.kind)}#ht(t){this.convertAsFormat(this._element,t),this.selectMenu_as.close()}#ct(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!==kt.get(e,0)&&/%$/.test(e)?e:"")}this.selectMenu_resize.close(),this.component.select(this._element,this.kind)}#pt(){const t=this.frameContext.get("_figure");t.main.style.display="none",this.editor._figureContainer=null,this.editor.opendControllers=this.editor.opendControllers.filter((e=>e.form!==t.main))}#mt(){this.selectMenu_align.open("",'[data-command="'+this.align+'"]')}#ft(){this.selectMenu_as.open("",'[data-command="'+this.as+'"]')}#bt(){const t=this.getSize(this._element),e=t.w,i=t.h;let s="";if(this.autoRatio){if(i===this.autoRatio.default&&/%$/.test(e)){const t=kt.get(e);s=100===t?"auto":"resize_percent"+t}}else"auto"===i&&("auto"===e?s="auto":/%$/.test(e)&&(s="resize_percent"+kt.get(e)));this.selectMenu_resize.open("",'[data-command="'+s+'"]')}}function vs(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 _s(t){return/^(90|270)$/.test(Math.abs(kt.is(t)?t:vs(t).r).toString())}function Cs(t){const e=t.split("_"),i=e[0],s=e[1];let n,o,l,r;switch(i){case"resize":n="onresize",o=s,l="resize",r="resize";break;case"auto":n="auto",l="autoSize",r="auto_size";break;case"rotate":n="rotate",o="l"===s?-90:"r"===s?90:kt.get(s),l=o<0?"rotateLeft":"rotateRight",r=o<0?"rotate_left":"rotate_right";break;case"mirror":n="mirror",o=s,l="h"===s?"mirrorHorizontal":"mirrorVertical",r="h"===s?"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 ws=ys,{_w:xs,ON_OVER_COMPONENT:ks,isMobile:Es}=_t,Ss=/^Arrow(Left|Up|Right|Down)$/,Ts=/^Arrow(Left|Up)$/;function Hs(t){re.call(this,t),this.info=null,this.isSelected=!1,this.currentTarget=null,this.currentPlugin=null,this.currentPluginName="",this.currentInfo=null,this.__globalEvents={copy:Is.bind(this),cut:Os.bind(this),keydown:Rs.bind(this),mousedown:Vs.bind(this)},this._bindClose_copy=null,this._bindClose_cut=null,this._bindClose_keydown=null,this._bindClose_mousedown=null,this.__selectionSelected=!1,this.__prevent=!1,this.editor.applyFrameRoots((t=>{const e=xt.utils.createElement("DIV",{class:"se-drag-handle",draggable:"true"},this.icons.selection);t.get("wrapper").appendChild(e),this.eventManager.addEvent(e,"mouseenter",Ls.bind(this)),this.eventManager.addEvent(e,"mouseleave",Ms.bind(this)),this.eventManager.addEvent(e,"dragstart",Ns.bind(this)),this.eventManager.addEvent(e,"dragend",As.bind(this)),this.eventManager.addEvent(e,"click",Bs.bind(this))}))}function Ls(){this.editor._preventBlur=!0,this.ui._visibleControllers(!1,xt.utils.hasClass(he.get("__dragHandler"),"se-drag-handle-full")),xt.utils.addClass(he.get("__dragCover")||he.get("__dragContainer"),"se-drag-over")}function Ms(){this.editor._preventBlur=!1,xt.utils.hasClass(he.get("__dragHandler"),"se-drag-handle-full")||this.ui._visibleControllers(!0,!0),xt.utils.removeClass([he.get("__dragCover"),he.get("__dragContainer")],"se-drag-over")}function Ns(t){const e=he.get("__dragCover")||he.get("__dragContainer");e?(this.editor._preventBlur=!1,xt.utils.addClass(he.get("__dragHandler"),"se-dragging"),xt.utils.addClass(he.get("__dragContainer"),"se-dragging"),t.dataTransfer.setDragImage(e,this.options.get("_rtl")?e.offsetWidth:-5,-5)):t.preventDefault()}function As(){this.editor._preventBlur=!1,xt.utils.removeClass([he.get("__dragHandler"),he.get("__dragContainer")],"se-dragging"),this._removeDragEvent()}function Bs(t){const e=xt.query.getEventTarget(t);if(!xt.utils.hasClass(e,"se-drag-handle-full"))return;const i=he.get("__dragInst");i&&(this._removeDragEvent(),this.select(i.currentTarget,i.currentPluginName))}function Vs(t){const e=xt.query.getEventTarget(t);this.currentTarget?.contains(e)||xt.query.getParentElement(e,".se-controller")||xt.utils.hasClass(e,"se-drag-handle")||this.currentPluginName===this.editor.currentControllerName&&this.editor.opendControllers.some((({form:t})=>t.contains(e)))||this.deselect()}function Is(t){const e=xt.query.getEventTarget(t);if(xt.check.isInputElement(e)&&xt.query.getParentElement(e,".se-modal"))return;const i=this.info;if(!i)return;const s=i.container.cloneNode(!0);xt.utils.removeClass(s,"se-component-selected"),"function"==typeof this.plugins[i.pluginName]?.componentCopy&&!1!==this.plugins[i.pluginName].componentCopy({event:t,cloneContainer:s,info:i})||Fs(t,s,t.clipboardData),xt.utils.flashClass(i.container,"se-copy")}function Os(t){const e=this.info;if(!e)return;const i=e.container.cloneNode(!0);xt.utils.removeClass(i,"se-component-selected"),Fs(t,i,t.clipboardData),this.deselect(),xt.utils.removeItem(e.container)}async function Rs(t){if(this.editor.selectMenuOn)return;const e=t.code;if(Et.isCtrl(t)){if("ControlRight"!==e&&"ControlLeft"!==e){const i=this.editor.shortcutsKeyMap.get(e+(t.shiftKey?"1000":""));/^(redo|undo)$/.test(i?.command)&&(t.preventDefault(),t.stopPropagation(),this.editor.run(i.command,i.type,i.button))}}else if(!Et.isRemoveKey(e)||(t.preventDefault(),t.stopPropagation(),"function"!=typeof this.currentPlugin?.componentDestroy||this.info.isInputType&&this.status.hasFocus)){if(Et.isEnter(e)){t.preventDefault();const e=this.currentInfo||this.get(this.currentTarget),i=e.container||e.target,s=i.previousElementSibling||i.nextElementSibling;let n=null;n=xt.check.isListCell(i.parentNode)?xt.utils.createElement("BR"):xt.utils.createElement(this.format.isLine(s)?s.nodeName:this.options.get("defaultLine"),null,"<br>");const o=this.currentPluginName;return this.deselect(),i.parentNode.insertBefore(n,i),!1===this.select(e.target,o)&&this.editor.blur(),void this.history.push(!1)}if(Ss.lastIndex=0,Ss.test(e)){const{container:i}=this.get(this.currentTarget);let s=null,n=1;if(this.isInline(i||this.currentTarget))switch(e){case"ArrowLeft":s=i.previousSibling,n=3===s?.nodeType?s.textContent.length:1;break;case"ArrowRight":s=i.nextSibling,n=0;break;case"ArrowUp":{const t=this.format.getLine(i,null);s=t?.previousElementSibling,n=0;break}case"ArrowDown":{const t=this.format.getLine(i,null);s=t?.nextElementSibling;break}}else Ts.lastIndex=0,Ts.test(e)?s=i.previousElementSibling:(s=i.nextElementSibling,n=0);if(!s)return;this.deselect();const o=this.get(s);if(o?.container)t.stopPropagation(),t.preventDefault(),this.select(o.target,o.pluginName);else try{this.editor._preventBlur=!0,t.stopPropagation(),t.preventDefault(),this.selection.setRange(s,n,s,n)}finally{this.editor._preventBlur=!1}}else Et.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.selection.setRange(t,e,t,e)}else this.editor.focus()}}function Fs(t,e,i){t.preventDefault(),t.stopPropagation(),e.querySelectorAll(".se-figure-selected").forEach((t=>xt.utils.removeClass(t,"se-figure-selected"))),i.setData("text/html",e.outerHTML)}Hs.prototype={insert(t,{skipCharCount:e=!1,skipHistory:i=!1,scrollTo:s=!0,insertBehavior:n}={}){if(this.frameContext.get("isReadOnly")||!e&&!this.char.check(t))return null;void 0===n&&(n=this.options.get("componentInsertBehavior"));const o=this.html.remove(),l=this.isInline(t);this.selection.getRangeAndAddLine(this.selection.getRange(),o.container);const r=this.selection.getNode();let a=null,h=this.format.getLine(r,null);try{if(xt.check.isListCell(h))this.html.insertNode(t,{afterNode:l?null:xt.check.isZeroWidth(r)?(r||o.container||{}).nextSibling:null,skipCharCount:!0}),l||t.nextSibling||t.parentNode.appendChild(xt.utils.createElement("BR"));else{if(!l&&this.selection.getRange().collapsed&&(3===o.container?.nodeType||xt.check.isBreak(o.container))){const t=xt.query.getParentElement(o.container,this.format.isBlock.bind(this.format));a=this.nodeTransform.split(o.container,o.offset,t?xt.query.getNodeDepth(t)+1:0),a&&(h=a.previousSibling)}this.html.insertNode(t,{afterNode:l||this.format.isBlock(h)?null:h,skipCharCount:!0}),!l&&h&&xt.check.isZeroWidth(h)&&xt.utils.removeItem(h)}if(l){const e=xt.utils.createTextNode(Ct.zeroWidthSpace);t.parentNode.insertBefore(e,t.nextSibling)}}catch(t){console.error("Component insert error:",t)}i||this.history.push(!1),this.frameContext.has("documentType_use_header")&&this.frameContext.get("documentType").reHeader();const c=a||t;return s&&this.selection.scrollTo(c,{behavior:"auto"}),null!==n&&this.applyInsertBehavior(t,a,n),c},applyInsertBehavior(t,e,i){const s=this.get(t);if(this.isInline(t)){const e=this.selection.getNearRange(t);e?this.selection.setRange(e.container,e.offset,e.container,e.offset):this.select(s.target,s.pluginName)}else switch(i){case"auto":this.__moveToNextLineOrAdd(t)||this.select(s.target,s.pluginName);break;case"select":this.selection.setRange(t,0,t,0),s?this.select(s.target,s.pluginName):e&&(e=xt.query.getEdgeChildNodes(e,null).sc||e,this.selection.setRange(e,0,e,0));break;case"line":if(!this.__moveToNextLineOrAdd(t)){const e=this.format.addLine(t,null);e&&this.selection.setRange(e,0,e,0)}}},get(t){if(!t)return null;let e,i="",s={},n=!1,o=null;if(this.is(t)){if(xt.check.isComponentContainer(t)&&!xt.utils.hasClass(t,"se-inline-component")&&(t=t.firstElementChild||t),/^FIGURE$/i.test(t.nodeName)&&(t=t.firstElementChild),!t)return null;const n=this.editor._componentManager.map((e=>e(t))).find((t=>t));if(!n)return null;e=n.target,i=n.pluginName,s=n.options,o=n.launcher}if(!e&&t.nodeName){this.__isFiles(t)&&(n=!0);const l=this.editor._componentManager.map((e=>e(t))).find((t=>t));if(!l)return null;e=l.target,i=l.pluginName,s=l.options,o=l.launcher}if(!e)return null;const l=ws.GetContainer(e),r=l.container||l.cover||e;return this.info={target:l.target,pluginName:i,options:s,container:r,cover:l.cover,inlineCover:l.inlineCover,caption:l.caption,isFile:n,launcher:o,isInputType:xt.utils.hasClass(r,"se-input-component")}},select(t,e,{isInput:i=!1}={}){const s=this.get(t);if(!s||xt.check.isUneditable(xt.query.getParentElement(t,this.is.bind(this)))||xt.check.isUneditable(t))return!1;const n=s.launcher||this.plugins[e];if(!n)return;const o=he.get("__overInfo")!==ks;if(!i&&o){if(this.status._onMousedown)return;this.editor._preventBlur=!0,this.__selectionSelected=!0,this.isInline(s.container)&&this.selection.setRange(s.container,0,s.container,0),this.editor.blur(),xs.setTimeout((()=>{this.__selectionSelected=!1}))}let l;this.isSelected=!0,this.__prevent=!0,"function"==typeof n.componentSelect&&(l=n.componentSelect(t));const r=xt.utils.hasClass(s.target,"se-component-line-break");(r||!l&&!xt.utils.hasClass(s.container,"se-inline-component"))&&this._setComponentLineBreaker(s.container||s.cover||t),this.currentTarget=t,this.currentPlugin=n,this.currentPluginName=e,this.currentInfo=s,he.set("__dragInst",this);const a=he.get("__overInfo");if(xs.setTimeout((()=>{he.set("__overInfo",a===ks&&void 0),a!==ks&&this.__addGlobalEvent(),s.isFile||this.__addNotFileGlobalEvent()}),0),wt.debounce((()=>{xt.utils.addClass(s.container,"se-component-selected")}),0)(),!o||this.status.hasFocus||this.editor._preventFocus||(this.eventManager.__postFocusEvent(this.frameContext,null),this.editor._preventFocus=!0),r||a===ks){if(r||!xt.utils.hasClass(s.container,"se-input-component")){const t=this.frameContext.get("wrapper").querySelector(".se-drag-handle");xt.utils.addClass(t,"se-drag-handle-full"),this.ui._visibleControllers(!1,!1);const e=s.caption?s.target:s.cover||s.container||s.target,i=e.offsetWidth,n=e.offsetHeight,{top:o,left:l}=this.offset.getLocal(e);t.style.opacity=0,t.style.width=i+"px",t.style.height=n+"px",t.style.top=o+"px",t.style.left=l+"px",he.set("__dragHandler",t),he.set("__dragContainer",s.container),he.set("__dragCover",s.cover),t.style.display="block"}}else{if(!this.isInline(s.container))return;const t=s.container;let e=null;t.previousSibling&&!xt.check.isBreak(t.previousSibling)||(e=xt.utils.createTextNode(Ct.zeroWidthSpace),t.parentNode.insertBefore(e,t)),t.nextSibling&&!xt.check.isBreak(t.nextSibling)||(e=xt.utils.createTextNode(Ct.zeroWidthSpace),t.parentNode.insertBefore(e,t.nextSibling)),this.status.onSelected=!0}},deselect(){xs.setTimeout((()=>{this.status.onSelected=!1}),0),this.__deselect(),this.ui.setControllerOnDisabledButtons(!1),!this.editor._preventFocus||this.status.hasFocus||this.__prevent||(this.eventManager.__postBlurEvent(this.frameContext,null),this.editor._preventFocus=!1)},is(t){return!!t&&(!(!/^FIGURE$/i.test(t.nodeName)&&!xt.check.isComponentContainer(t))||!!this.editor._componentManager.find((e=>e(t))))},isInline(t){if(!t)return!1;if(/^FIGURE$/i.test(t.nodeName)&&(t=t.parentElement),xt.utils.hasClass(t,"se-inline-component"))return!0;return!(!this.editor._componentManager.find((e=>e(t)))||!xt.utils.hasClass(t,"se-inline-component")&&!xt.utils.hasClass(t.parentElement,"se-inline-component"))},isBasic(t){return this.is(t)&&!this.isInline(t)},async copy(t){const e=xt.utils.clone(t,!0);xt.utils.removeClass(e,"se-component-selected"),xt.utils.removeClass(e.querySelectorAll(".se-figure-selected"),"se-figure-selected"),xt.utils.removeClass(e.querySelectorAll(".se-selected-table-cell"),"se-selected-table-cell"),xt.utils.removeClass(e.querySelector(".se-selected-cell-focus"),"se-selected-cell-focus"),!1!==await this.html.copy(e)&&xt.utils.flashClass(t,"se-copy")},hoverSelect(t){const e=xt.query.getParentElement(t,xt.check.isFigure);let i=this.get(t);i||e?(i||=this.get(e),i&&!xt.utils.hasClass(i.container,"se-component-selected")&&(this.ui._offCurrentController(),he.set("__overInfo",ks),this.select(i.target,i.pluginName))):null===he.get("__overInfo")||xt.utils.hasClass(t,"se-drag-handle")||(this.__deselect(),he.set("__overInfo",null))},__isFiles(t){const e=t.nodeName.toLowerCase();return this.editor._fileManager.regExp.test(e)&&(!this.editor._fileManager.tagAttrs[e]||this.editor._fileManager.tagAttrs[e]?.every((e=>t.hasAttribute(e))))},__deselect(){if(this.editor._preventBlur=!1,he.set("__overInfo",null),this._removeDragEvent(),this.currentInfo){const t=this.currentInfo.container,e=this.currentInfo.cover;wt.debounce((()=>{xt.utils.removeClass(t,"se-component-selected"),xt.utils.removeClass(e,"se-figure-over-selected")}),0)()}const{frameContext:t}=this.editor;t.get("lineBreaker_t")&&(t.get("lineBreaker_t").style.display=t.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.ui.__offControllers()},__moveToNextLineOrAdd(t){const e=t.nextElementSibling;if(!e){const e=this.format.addLine(t,null);return e&&this.selection.setRange(e,0,e,0),!0}return!!this.format.isLine(e)&&(this.selection.setRange(e,0,e,0),!0)},_setComponentLineBreaker(t){const e=he.get("__overInfo")===ks;this.eventManager._lineBreakComp=null;const i=this.get(t);if(!i)return;const s=this.frameContext,n=i.container,o=xt.utils.hasClass(n,"se-flex-component"),l=s.get("lineBreaker_t"),r=s.get("lineBreaker_b"),a=l.style,h=r.style,c=n.offsetWidth<t.offsetWidth?n:t,d="block"===this.editor._figureContainer?.style.display?this.editor._figureContainer:c,u=xt.check.isListCell(n.parentNode);let p,g;const m=this.options.get("_rtl"),f=m?["right","left"]:["left","right"],{top:b,left:y,right:v,scrollX:_,scrollY:C}=this.offset.getLocal(c),w=m?v:y;if(u?!xt.check.isBreak(n.previousElementSibling)&&!n.previousSibling?.textContent?.trim()||this.is(n.previousElementSibling):!this.format.isLine(n.previousElementSibling)){const t=xs.getComputedStyle(l),i=kt.get(t.height,1),s=kt.get(t.width,1);this.eventManager._lineBreakComp=n,p=b,g=d.offsetWidth/2/2,a.top=p-i/2+"px",a[f[0]]=(o?w-s/2:w+g)+"px",a[f[1]]="",l.setAttribute("data-offset",C+","+_),e?xt.utils.removeClass(l,"se-on-selected"):xt.utils.addClass(l,"se-on-selected"),a.display="block",a.visibility=""}else a.display="none";if(u?!xt.check.isBreak(n.nextElementSibling)&&!n.nextSibling?.textContent?.trim()||this.is(n.nextElementSibling):!this.format.isLine(n.nextElementSibling)){const t=xs.getComputedStyle(r),i=kt.get(t.height,1),s=kt.get(t.width,1);p||(this.eventManager._lineBreakComp=n,p=b,g=d.offsetWidth/2/2),h.top=p+d.offsetHeight-i/2+"px",h[f[0]]=w+d.offsetWidth-(o?0:g)-(o?s/2:s)+"px",h[f[1]]="",r.setAttribute("data-offset",C+","+f[0]+","+_),e?xt.utils.removeClass(r,"se-on-selected"):xt.utils.addClass(r,"se-on-selected"),h.display="block",h.visibility=""}else h.display="none"},__addGlobalEvent(){this.__removeGlobalEvent(),this._bindClose_copy=this.eventManager.addGlobalEvent("copy",this.__globalEvents.copy),this._bindClose_cut=this.eventManager.addGlobalEvent("cut",this.__globalEvents.cut),this._bindClose_keydown=this.eventManager.addGlobalEvent("keydown",this.__globalEvents.keydown)},__removeGlobalEvent(){this.__removeNotFileGlobalEvent(),this._bindClose_copy&&=this.eventManager.removeGlobalEvent(this._bindClose_copy),this._bindClose_cut&&=this.eventManager.removeGlobalEvent(this._bindClose_cut),this._bindClose_keydown&&=this.eventManager.removeGlobalEvent(this._bindClose_keydown)},__addNotFileGlobalEvent(){this.__removeNotFileGlobalEvent(),this._bindClose_mousedown=this.eventManager.addGlobalEvent(Es?"click":"mousedown",this.__globalEvents.mousedown,!0)},__removeNotFileGlobalEvent(){this._bindClose_mousedown&&=this.eventManager.removeGlobalEvent(this._bindClose_mousedown)},_removeDragEvent(){this.carrierWrapper.querySelector(".se-drag-cursor").style.left="-10000px",he.get("__dragHandler")&&(he.get("__dragHandler").style.display="none"),xt.utils.removeClass([he.get("__dragHandler"),he.get("__dragContainer")],"se-dragging"),xt.utils.removeClass([he.get("__dragCover"),he.get("__dragContainer")],"se-drag-over"),he.set("__figureInst",null),he.set("__dragInst",null),he.set("__dragHandler",null),he.set("__dragContainer",null),he.set("__dragCover",null),he.set("__dragMove",null),he.set("__overInfo",null)},constructor:Hs};const zs=Hs;function $s(t){re.call(this,t),this._formatLineCheck=this.options.get("formatLine").reg,this._formatBrLineCheck=this.options.get("formatBrLine").reg,this._formatBlockCheck=this.options.get("formatBlock").reg,this._formatClosureBlockCheck=this.options.get("formatClosureBlock").reg,this._formatClosureBrLineCheck=this.options.get("formatClosureBrLine").reg,this._textStyleTagsCheck=new RegExp("^("+this.options.get("textStyleTags")+")$","i"),this._brLineBreak=null,this.__resetBrLineBreak(this.options.get("defaultLineBreakFormat"))}function Ps(t,e,i){const s=[];for(let n,o,l=0,r=t.length;l<r;l++)n=t[l],xt.check.isListCell(n)?(e<0||n.previousElementSibling)&&s.push(n):(o=/\d+/.test(n.style[i])?kt.get(n.style[i],0):0,o+=e,xt.utils.setStyle(n,i,o<=0?"":o+"px"));return s}$s.prototype={setLine(t){if(!this.isLine(t))throw new Error('[SUNEDITOR.format.setLine.fail] The "element" must satisfy "format.isLine()".');const e=this._lineWork(),i=e.lines,s=t.className,n=t.nodeName;let o=e.firstNode,l=e.lastNode;for(let e,r,a=0,h=i.length;a<h;a++)e=i[a],e.nodeName===n&&(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim()===s||this.component.is(e)||(r=t.cloneNode(!1),xt.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.selection.setRange(xt.query.getNodeFromPath(e.firstPath,o),e.startOffset,xt.query.getNodeFromPath(e.lastPath,l),e.endOffset),this.history.push(!1),this.frameContext.has("documentType_use_header")&&this.frameContext.get("documentType").reHeader()},getLine(t,e){if(!t)return null;for(e||=()=>!0;t;){if(xt.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._lineWork().lines,i=e.length-1;let s=e[i].parentNode,n=t.cloneNode(!1);const o=n;for(let o,l,r,a,h,c,d=i,u=!0;d>=0;d--)if(o=e[d],o!==(e[d+1]?e[d+1].parentNode:null)){if(c=this.component.is(o),l=c?"":o.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),r=xt.query.getParentElement(o,(t=>t.parentNode===s)),(s!==o.parentNode||c)&&(this.isLine(s)?(s.parentNode.insertBefore(n,s.nextSibling),s=s.parentNode):(s.insertBefore(n,r?r.nextSibling:null),s=o.parentNode),a=n.nextSibling,a&&n.nodeName===a.nodeName&&xt.check.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,xt.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){s.insertBefore(n,o),a=o.nextSibling,a&&n.nodeName===a.nodeName&&xt.check.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,xt.utils.removeItem(a));const t=n.previousSibling;t&&n.nodeName===t.nodeName&&xt.check.isSameAttributes(n,t)&&(t.innerHTML+="<BR>"+n.innerHTML,xt.utils.removeItem(n))}c||xt.utils.removeItem(o),l&&(u=!1)}this.selection.setRange(o,0,o,0),this.history.push(!1)},getBrLine(t,e){if(!t)return null;for(e||=()=>!0;t;){if(xt.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 i=this.getLine(this.selection.getNode(),null);let s=null;if(this.isBrLine(t)||!this.isBrLine(i||t.parentNode)||this.component.is(t)){const t=e?"string"==typeof e?e:e.nodeName:this.isNormalLine(i)?i.nodeName:this.options.get("defaultLine");s=xt.utils.createElement(t,null,"<br>"),(e&&"string"!=typeof e||!e&&this.isLine(i))&&xt.utils.copyTagAttributes(s,e||i,["id"])}else s=xt.utils.createElement("BR");return xt.check.isTableCell(t)?t.insertBefore(s,t.nextElementSibling):t.parentNode.insertBefore(s,t.nextElementSibling),s},getBlock(t,e){if(!t)return null;for(e||=()=>!0;t;){if(xt.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.selection.getRangeAndAddLine(this.selection.getRange(),null);const e=this.getLinesAndComponents(!1);if(!e||0===e.length)return;t:for(let t,i,s,n,o,l,r=0,a=e.length;r<a;r++)if(t=e[r],xt.check.isListCell(t))if(i=t.lastElementChild,i&&xt.check.isListCell(t.nextElementSibling)&&e.includes(t.nextElementSibling)&&(n=i.lastElementChild,e.includes(n))){let t=null;for(;t=n.lastElementChild;)if(xt.check.isList(t)){if(!e.includes(t.lastElementChild))continue t;n=t.lastElementChild}s=i.firstElementChild,o=e.indexOf(s),l=e.indexOf(n),e.splice(o,l-o+1),a=e.length}else;const i=e.at(-1);let s,n,o;s=this.isBlock(i)||this.isLine(i)?i:this.getBlock(i,null)||this.getLine(i,null),xt.check.isTableCell(s)?(n=null,o=s):(n=s.nextSibling,o=s.parentNode);const l=t.cloneNode(!1);let r=xt.query.getNodeDepth(s),a=null;const h=[],c=(t,e,i)=>{let s=null;if(t!==e&&!xt.check.isTableElements(e)){if(e&&xt.query.getNodeDepth(t)===xt.query.getNodeDepth(e))return i;s=this.nodeTransform.removeAllParents(e,null,t)}return s?s.ec:i};for(let t,i,s,d,u,p,g,m=0,f=e.length;m<f;m++)if(t=e[m],i=t.parentNode,i&&!l.contains(i))if(s=xt.query.getNodeDepth(t),xt.check.isList(i)){if(null===a&&(p?(a=p,g=!0,p=null):a=i.cloneNode(!1)),h.push(t),u=e[m+1],m===f-1||u?.parentNode!==i){t.contains(u?.parentNode)&&(p=u.parentNode.cloneNode(!1));let e,m=i.parentNode;for(;xt.check.isList(m);)e=xt.utils.createElement(m.nodeName),e.appendChild(a),a=e,m=m.parentNode;const f=this.removeBlock(i,{selectedFormats:h,newBlockElement:null,shouldDelete:!0,skipHistory:!0});r>=s?(r=s,o=f.cc,n=c(o,i,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>=s&&(r=s,o=i,n=t.nextSibling),l.appendChild(t),o!==i&&(d=c(o,i),void 0!==d&&(n=d));if(this.editor.effectNode=null,this.nodeTransform.mergeSameTags(l,null,!1),this.nodeTransform.mergeNestedTags(l,(t=>xt.check.isList(t))),n&&xt.query.getNodeDepth(n)>0&&(xt.check.isList(n.parentNode)||xt.check.isList(n.parentNode.parentNode))){const t=xt.query.getParentElement(n,(t=>this.isBlock(t)&&!xt.check.isList(t))),e=this.nodeTransform.split(n,null,t?xt.query.getNodeDepth(t)+1:0);e.parentNode.insertBefore(l,e)}else o.insertBefore(l,n),c(l,n);const d=xt.query.getEdgeChildNodes(l.firstElementChild,l.lastElementChild);e.length>1?this.selection.setRange(d.sc,0,d.ec,d.ec.textContent.length):this.selection.setRange(d.ec,d.ec.textContent.length,d.ec,d.ec.textContent.length),this.history.push(!1)},removeBlock(t,{selectedFormats:e,newBlockElement:i,shouldDelete:s,skipHistory:n}={}){const o=this.selection.getRange();let l=o.startOffset,r=o.endOffset,a=xt.query.getListChildNodes(t,null,1),h=t.parentNode,c=null,d=null,u=t.cloneNode(!1);const p=[],g=xt.check.isList(i);let m=!1,f=!1,b=!1;const y=(e,i,s,n)=>{if(1===i.childNodes.length&&xt.check.isZeroWidth(i)&&(i.innerHTML=Ct.zeroWidthSpace,l=r=1),3===i.nodeType)return e.insertBefore(i,s),i;const o=(b?i:n).childNodes;let a=i.cloneNode(!1),h=null,c=null;for(;o[0];)c=o[0],!this._notTextNode(c)||xt.check.isBreak(c)||xt.check.isListCell(a)?a.appendChild(c):(a.childNodes.length>0&&(h||=a,e.insertBefore(a,s),a=i.cloneNode(!1)),e.insertBefore(c,s),h||=c);if(a.childNodes.length>0){if(xt.check.isListCell(e)&&xt.check.isListCell(a)&&xt.check.isList(s))if(g){for(h=s;s;)a.appendChild(s),s=s.nextSibling;e.parentNode.insertBefore(a,e.nextElementSibling)}else{const e=n.nextElementSibling,i=this.listFormat.removeNested(n,!1);if(t!==i||e!==n.nextElementSibling){const e=a.childNodes;for(;e[0];)n.appendChild(e[0]);t=i,f=!0}}else e.insertBefore(a,s);h||=a}return h};for(let n,o,l,r=0,v=a.length;r<v;r++)if(n=a[r],3!==n.nodeType||!xt.check.isList(u))if(b=!1,s&&0===r&&(c=e&&e.length!==v&&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&&xt.check.isListCell(n))if(l&&xt.query.getNodeDepth(n)!==xt.query.getNodeDepth(l)&&(xt.check.isListCell(h)||xt.utils.arrayFind(n.children,xt.check.isList))){const e=n.nextElementSibling,i=this.listFormat.removeNested(n,!1);t===i&&e===n.nextElementSibling||(t=i,f=!0)}else{const e=n;n=xt.utils.createElement(s?e.nodeName:xt.check.isList(t.parentNode)||xt.check.isListCell(t.parentNode)?"LI":xt.check.isTableCell(t.parentNode)?"DIV":this.options.get("defaultLine"));const i=xt.check.isListCell(n),o=e.childNodes;for(;o[0]&&(!xt.check.isList(o[0])||i);)n.appendChild(o[0]);xt.utils.copyFormatAttributes(n,e),b=!0}else n=n.cloneNode(!1);if(!f&&(s?(p.push(n),xt.utils.removeItem(a[r])):(i?(m||(h.insertBefore(i,t),m=!0),n=y(i,n,null,a[r])):n=y(h,n,t,a[r]),f||(e?(d=n,c||=n):c||(c=d=n))),f)){f=b=!1,a=xt.query.getListChildNodes(t,null,1),u=t.cloneNode(!1),h=t.parentNode,r=-1,v=a.length;continue}}const v=t.parentNode;let _=t.nextSibling;u?.children.length>0&&v.insertBefore(u,_),i?c=i.previousSibling:c||=t.previousSibling,_=t.nextSibling!==u?t.nextSibling:u?u.nextSibling:null,0===t.children.length||0===t.textContent.length?xt.utils.removeItem(t):this.nodeTransform.removeEmptyNode(t,null,!1);let C=null;if(this.editor.effectNode=null,s)C={cc:v,sc:c,so:l,ec:_,eo:r,removeArray:p};else{c||=d,d||=c;const t=xt.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.editor.focus()}if(n)return C;!s&&C&&(e?this.selection.setRange(C.sc,l,C.ec,r):this.selection.setRange(C.sc,0,C.sc,0)),this.history.push(!1)},indent(){const t=this.selection.getRange(),e=t.startContainer,i=t.endContainer,s=t.startOffset,n=t.endOffset,o=Ps(this.getLines(null),this.status.indentSize,this.options.get("_rtl")?"marginRight":"marginLeft");o.length>0&&this.listFormat.applyNested(o,!1),this.editor.effectNode=null,this.selection.setRange(e,s,i,n),this.history.push(!1)},outdent(){const t=this.selection.getRange(),e=t.startContainer,i=t.endContainer,s=t.startOffset,n=t.endOffset,o=Ps(this.getLines(null),-1*this.status.indentSize,this.options.get("_rtl")?"marginRight":"marginLeft");o.length>0&&this.listFormat.applyNested(o,!0),this.editor.effectNode=null,this.selection.setRange(e,s,i,n),this.history.push(!1)},isEdgeLine(t,e,i){if(!xt.check.isEdgePoint(t,e,i))return!1;let s=!1;const n="front"===i?"previousSibling":"nextSibling";for(;t&&!this.isLine(t)&&!xt.check.isWysiwygFrame(t);){if(t[n]&&(!xt.check.isBreak(t[n])||t[n][n]))return!1;s=!0,t=t.parentNode}return s},isTextStyleNode(t){return"string"==typeof t?this._textStyleTagsCheck.test(t):1===t?.nodeType&&this._textStyleTagsCheck.test(t.nodeName)},isLine(t){return"string"==typeof t?this._formatLineCheck.test(t):1===t?.nodeType&&(this._formatLineCheck.test(t.nodeName)||xt.utils.hasClass(t,"__se__format__line_.+|__se__format__br_line_.+"))&&!this._nonFormat(t)},isNormalLine(t){return this.isLine(t)&&(this._brLineBreak||!this.isBrLine(t))&&!this.isBlock(t)},isBrLine(t){return this._brLineBreak&&this.isLine(t)||("string"==typeof t?this._formatBrLineCheck.test(t):1===t?.nodeType&&(this._formatBrLineCheck.test(t.nodeName)||xt.utils.hasClass(t,"__se__format__br_line_.+"))&&!this._nonFormat(t))},isBlock(t){return"string"==typeof t?this._formatBlockCheck.test(t):1===t?.nodeType&&(this._formatBlockCheck.test(t.nodeName)||xt.utils.hasClass(t,"__se__format__block_.+"))&&!this._nonFormat(t)},isClosureBlock(t){return"string"==typeof t?this._formatClosureBlockCheck.test(t):1===t?.nodeType&&(this._formatClosureBlockCheck.test(t.nodeName)||xt.utils.hasClass(t,"__se__format__block_closure_.+"))&&!this._nonFormat(t)},isClosureBrLine(t){return"string"==typeof t?this._formatClosureBrLineCheck.test(t):1===t?.nodeType&&(this._formatClosureBrLineCheck.test(t.nodeName)||xt.utils.hasClass(t,"__se__format__br_line__closure_.+"))&&!this._nonFormat(t)},getLines(t){if(!this.selection._resetRangeToTextNode())return[];let e=this.selection.getRange();if(xt.check.isWysiwygFrame(e.startContainer)){const t=this.frameContext.get("wysiwyg").children;if(0===t.length)return[];this.selection.setRange(t[0],0,t.at(-1),t.at(-1).textContent.trim().length),e=this.selection.getRange()}const i=e.startContainer,s=e.endContainer,n=e.commonAncestorContainer;t||=this.isLine.bind(this);const o=xt.query.getListChildren(n,(e=>t(e)),null);if(3!==n.nodeType&&(xt.check.isWysiwygFrame(n)||this.isBlock(n))||o.unshift(this.getLine(n,null)),i===s||1===o.length)return o;const l=this.getLine(i,null),r=this.getLine(s,null);let a=null,h=null;const c=function(t){return!xt.check.isTableElements(t)||/^TABLE$/i.test(t.nodeName)};let d=this.getBlock(l,c),u=this.getBlock(r,c);xt.check.isTableElements(d)&&xt.check.isListCell(d.parentNode)&&(d=d.parentNode),xt.check.isTableElements(u)&&xt.check.isListCell(u.parentNode)&&(u=u.parentNode);const p=d===u;for(let t,e=0,i=o.length;e<i;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.selection.getRange().commonAncestorContainer,i=xt.query.getParentElement(e,this.component.is.bind(this.component)),s=xt.check.isTableElements(e)?this.getLines(null):this.getLines((t=>{const e=xt.query.getParentElement(t,this.component.is.bind(this.component));return this.isLine(t)&&(!e||e===i)||xt.check.isComponentContainer(t)&&!this.getLine(t)}));if(t)for(let t=0,e=s.length;t<e;t++)for(let i=t-1;i>=0;i--)if(s[i].contains(s[t])){s.splice(t,1),t--,e--;break}return s},_isExcludeSelectionElement(t){return!/FIGCAPTION/i.test(t.nodeName)&&(this.component.is(t)||/FIGURE/i.test(t.nodeName))},_nonFormat(t){return xt.check.isExcludeFormat(t)||this.component.is(t)||xt.check.isWysiwygFrame(t)},_notTextNode(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.component.is(t)||e.test(t.nodeName))},_lineWork(){let t=this.selection.getRange(),e=this.getLinesAndComponents(!1);if(0===e.length&&(t=this.selection.getRangeAndAddLine(t,null),e=this.getLinesAndComponents(!1),0===e.length))return;const i=t.startOffset,s=t.endOffset;let n=e[0],o=e.at(-1);const l=xt.query.getNodePath(t.startContainer,n,null),r=xt.query.getNodePath(t.endContainer,o,null),a=this.listFormat.remove(e,!1);return a.sc&&(n=a.sc),a.ec&&(o=a.ec),this.selection.setRange(xt.query.getNodeFromPath(l,n),i,xt.query.getNodeFromPath(r,o),s),{lines:this.getLinesAndComponents(!1),firstNode:n,lastNode:o,firstPath:l,lastPath:r,startOffset:i,endOffset:s}},__resetBrLineBreak(t){this._brLineBreak="br"===t},constructor:$s};const Ds=$s;function qs(t){re.call(this,t);const e=this.options;this.fontSizeUnitRegExp=null,this._isAllowedClassName=function(t){return this.test(t)?t:""}.bind(e.get("allowedClassName")),this._allowHTMLComment=null,this._disallowedStyleNodesRegExp=null,this._htmlCheckWhitelistRegExp=null,this._htmlCheckBlacklistRegExp=null,this._elementWhitelistRegExp=null,this._elementBlacklistRegExp=null,this._attributeWhitelist=null,this._attributeBlacklist=null,this._attributeWhitelistRegExp=null,this._attributeBlacklistRegExp=null,this._cleanStyleTagKeyRegExp=null,this._cleanStyleRegExpMap=null,this._textStyleTags=e.get("_textStyleTags"),this._autoStyleify=null,this.__disallowedTagsRegExp=null,this.__disallowedTagNameRegExp=null,this.__allowedTagNameRegExp=null;const i=e.get("tagStyles"),s={};for(const t in i){const e=t.split("|");for(let n,o=0,l=e.length;o<l;o++)n=e[o],s[n]?s[n]+="|":s[n]="",s[n]+=i[t]}for(const t in s)s[t]=new RegExp(`\\s*[^-a-zA-Z](${s[t]})\\s*:[^;]+(?!;)*`,"gi");const n=new Map,o={...s,line:e.get("_lineStylesRegExp")};this._textStyleTags.forEach((t=>{o[t]=e.get("_textStylesRegExp")}));for(const t in o)n.set(new RegExp(`^(${t})$`),o[t]);this._cleanStyleTagKeyRegExp=new RegExp(`^(${Object.keys(o).join("|")})$`,"i"),this._cleanStyleRegExpMap=n,this.fontSizeUnitRegExp=new RegExp("\\d+("+e.get("fontSizeUnits").join("|")+")$","i");const l=e.get("_allowedExtraTag"),r=e.get("_disallowedExtraTag");this.__disallowedTagsRegExp=new RegExp(`<(${r})[^>]*>([\\s\\S]*?)<\\/\\1>|<(${r})[^>]*\\/?>`,"gi"),this.__disallowedTagNameRegExp=new RegExp(`^(${r})$`,"i"),this.__allowedTagNameRegExp=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._disallowedStyleNodesRegExp=0===a.length?null:new RegExp("(<\\/?)("+a.join("|")+")\\b\\s*([^>^<]+)?\\s*(?=>)","gi");const c=e.get("__defaultAttributeWhitelist");this._allowHTMLComment=e.get("_editorElementWhitelist").includes("//")||"*"===e.get("_editorElementWhitelist"),this._htmlCheckWhitelistRegExp=new RegExp("^("+Us(e.get("_editorElementWhitelist").replace("|//",""),"")+")$","i"),this._htmlCheckBlacklistRegExp=new RegExp("^("+(e.get("elementBlacklist")||"^")+")$","i"),this._elementWhitelistRegExp=wt.createElementWhitelist(Us(e.get("_editorElementWhitelist").replace("|//","|\x3c!--|--\x3e"),"")),this._elementBlacklistRegExp=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=Us(u[t],c):p[t]=new RegExp("\\s(?:"+Us(u[t],c)+")"+d,"ig"));this._attributeWhitelistRegExp=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._attributeWhitelist=p;const m=e.get("attributeBlacklist");if(p={},g="",m)for(const t in m)"*"===t?g=Us(m[t],""):p[t]=new RegExp("\\s(?:"+Us(m[t],"")+")"+d,"ig");this._attributeBlacklistRegExp=new RegExp("\\s(?:"+(g||"^")+")"+d,"ig"),this._attributeBlacklist=p,this.__resetAutoStyleify(e.get("autoStyleify"))}function Ws(t,e,i,s){if(/^<[a-z0-9]+:[a-z0-9]+/i.test(i))return i;let n=null;const o=s.match(/(?!<)[a-zA-Z0-9-]+/)[0].toLowerCase();if(t){const t=this._attributeBlacklist[o];i=i.replace(/\s(?:on[a-z]+)\s*=\s*(")[^"]*\1/gi,""),i=t?i.replace(t,""):i.replace(this._attributeBlacklistRegExp,"");const e=this._attributeWhitelist[o];n=e?i.match(e):i.match(this._attributeWhitelistRegExp)}if(!e)return i;if("a"===o){const t=i.match(/(?:(?:id|name)\s*=\s*(?:"|')[^"']*(?:"|'))/g);t&&(n||=[],n.push(t[0]))}else n&&/style=/i.test(n.toString())||(this._textStyleTags.includes(o)?n=this._cleanStyle(i,n,o):this.format.isLine(o)?n=this._cleanStyle(i,n,"line"):this._cleanStyleTagKeyRegExp.test(o)&&(n=this._cleanStyle(i,n,o)));if(xt.check.isMedia(o)||xt.check.isFigure(o)){const t=i.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/);n||=[],t&&n.push(t[0])}if(n)for(let t,e=0,i=n.length;e<i;e++)t=/^(?:href|src)\s*=\s*('|"|\s)*javascript\s*:/i.test(n[e].trim())?"":n[e],s+=(/^\s/.test(t)?"":" ")+t;return s}function Us(t,e){return t?"*"===t?"[a-z-]+":e?t+"|"+e:t:"^"}qs.prototype={filter(t,{tagWhitelist:e,tagBlacklist:i,validate:s,validateAll:n}){if(e&&(t=t.replace(wt.createElementWhitelist(e),"")),i&&(t=t.replace(wt.createElementBlacklist(i),"")),s){const e=(new DOMParser).parseFromString(t,"text/html");e.body.querySelectorAll("*").forEach((t=>{if(!t.closest(".se-component")&&!t.closest(".se-flex-component")){const e=s(t);null===e?t.remove():this.instanceCheck.isNode(e)?t.replaceWith(e):"string"==typeof e&&(t.outerHTML=e)}})),t=e.body.innerHTML}else if(n){const e=(new DOMParser).parseFromString(t,"text/html"),i=[".se-component",".se-flex-component"],n=t=>i.some((e=>t.closest(e)));e.body.querySelectorAll("*").forEach((t=>{if(!n(t)){const e=s(t);null===e?t.remove():this.instanceCheck.isNode(e)?t.replaceWith(e):"string"==typeof e&&(t.outerHTML=e)}})),t=e.body.innerHTML}return t},clean(t,{forceFormat:e,whitelist:i,blacklist:s,_freeCodeViewMode:n}={}){const{tagFilter:o,formatFilter:l,classFilter:r,textStyleTagFilter:a,attrFilter:h,styleFilter:c}=this.options.get("strictMode");let d="";if(t=this.compress(t),o&&(t=t.replace(this.__disallowedTagsRegExp,""),t=this._deleteDisallowedTags(t,this._elementWhitelistRegExp,this._elementBlacklistRegExp).replace(/<br\/?>$/i,"")),this._autoStyleify){const e=(new DOMParser).parseFromString(t,"text/html");xt.query.getListChildNodes(e.body,wt.spanToStyleNode.bind(null,this._autoStyleify),null),t=e.body.innerHTML}(h||c)&&(t=t.replace(/(<[a-zA-Z0-9-]+)[^>]*(?=>)/g,Ws.bind(this,h,c)));const u=this._d.createRange().createContextualFragment(t);if(o)try{this._consistencyCheckOfHTML(u,this._htmlCheckWhitelistRegExp,this._htmlCheckBlacklistRegExp,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=xt.utils.createElement("iframe"),i=JSON.parse(p[t].getAttribute("data-se-iframe-holder-attrs"));for(const[t,s]of Object.entries(i))e.setAttribute(t,s);p[t].replaceWith(e)}let g;if((g=this.options.get("__pluginRetainFilter"))&&this.editor._MELInfo.forEach(((t,e)=>{const i=u.querySelectorAll(e);for(let e=0,s=i.length;e<s;e++)!0!==g&&!1===g[t.key]||t.method(i[e])})),l){let t=u.childNodes;e||=this._isFormatData(t),e&&(t=this._editFormat(u).childNodes);for(let i,s=0,n=t.length;s<n;s++)i=t[s],this.__allowedTagNameRegExp.test(i.nodeName)?d+=i.outerHTML:d+=this._makeLine(i,e)}return d||=t,o&&(i&&(d=d.replace("string"==typeof i?wt.createElementWhitelist(i):i,"")),s&&(d=d.replace("string"==typeof s?wt.createElementBlacklist(s):s,""))),a&&(d=this._styleNodeConvertor(d)),d},insert(t,{selectInserted:e,skipCharCount:i,skipCleaning:s}={}){this.frameContext.get("wysiwyg").contains(this.selection.get().focusNode)||this.editor.focus(),this.remove(),this.editor.focus();let n=null;if("string"==typeof t){s||(t=this.clean(t,{forceFormat:!1,whitelist:null,blacklist:null}));try{if(xt.check.isListCell(this.format.getLine(this.selection.getNode(),null))){const e=this._d.createRange().createContextualFragment(t).childNodes;this._isFormatData(e)&&(t=this._convertListCell(e))}const s=this._d.createRange().createContextualFragment(t).childNodes;if(!i){const t="byte-html"===this.frameOptions.get("charCounter_type")?"outerHTML":"textContent";let e="";for(let i=0,n=s.length;i<n;i++)e+=s[i][t];if(!this.char.check(e))return}let o,l,r,a,h;for(;o=s[0];)3===a?.nodeType&&1===l?.nodeType&&xt.check.isBreak(o)?(a=o,xt.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.selection.setRange(h.container||h,h.startOffset||0,l,c):this.component.is(l)||this.selection.setRange(l,c,l,c)}catch(t){if(this.frameContext.get("isReadOnly")||this.frameContext.get("isDisabled"))return;throw Error(`[SUNEDITOR.html.insert.error] ${t.message}`)}}else if(this.component.is(t))this.component.insert(t,{skipCharCount:i,insertBehavior:"none"});else{let e=null;(this.format.isLine(t)||xt.check.isMedia(t))&&(e=this.format.getLine(this.selection.getNode(),null)),this.insertNode(t,{afterNode:e,skipCharCount:i})}if(this.editor.effectNode=null,n){const t=xt.query.getListChildNodes(n,null,null);if(t.length>0){n=t.at(-1);const e=3===n?.nodeType?n.textContent.length:1;this.selection.setRange(n,e,n,e)}else this.editor.focus()}else this.editor.focus();this.history.push(!1)},insertNode(t,{afterNode:e,skipCharCount:i}={}){let s=null;if(this.frameContext.get("isReadOnly")||!i&&!this.char.check(t))return s;let n=null,o=null;if(e){const t=this.format.isLine(e)||this.format.isBlock(e)||this.component.is(e)?this.format.addLine(e,null):e;o=this.selection.setRange(t,1,t,1)}else o=this.selection.getRange();let l,r,a,h=xt.check.isListCell(o.commonAncestorContainer)?o.commonAncestorContainer:this.format.getLine(this.selection.getNode(),null),c=xt.check.isListCell(h)&&(xt.check.isListCell(t)||xt.check.isList(t)),d=null;const u=this.format.isBrLine(h),p=this.format.isLine(t)||this.format.isBlock(t)||this.component.isBasic(t);if(c&&(a=e||xt.check.isList(t)?h.lastChild:h.nextElementSibling,d=xt.check.isList(t)?h:(a||h).parentNode),!e&&(p||this.component.isBasic(t)||xt.check.isMedia(t))){const t=xt.check.isEdgePoint(o.endContainer,o.endOffset,"end"),i=this.remove(),s=i.container,n=s===i.prevContainer&&o.collapsed?null:i.prevContainer;if(c&&n)if(d=3===n.nodeType?n.parentNode:n,d.contains(s)){let t=!0;for(a=s;a.parentNode&&a.parentNode!==d;)a=a.parentNode,t=!1;t&&s===n&&(a=a.nextSibling)}else a=null;else if(c&&xt.check.isListCell(s)&&!h.parentElement)h=xt.utils.createElement("LI"),d.appendChild(h),s.appendChild(d),a=null;else if(3===s.nodeType||xt.check.isBreak(s)||c){const n=xt.query.getParentElement(s,(t=>this.format.isBlock(t)||xt.check.isListCell(t)));if(e=this.nodeTransform.split(s,i.offset,n?xt.query.getNodeDepth(n)+1:0))if(c){if(h.contains(s)){const i=xt.check.isList(h.lastElementChild);let s=null;t||(s=h.cloneNode(!1),s.appendChild(e.textContent.trim()?e:xt.utils.createTextNode(Ct.zeroWidthSpace))),i&&(s||(s=h.cloneNode(!1),s.appendChild(xt.utils.createTextNode(Ct.zeroWidthSpace))),s.appendChild(h.lastElementChild)),s&&(h.parentNode.insertBefore(s,h.nextElementSibling),a=e=s)}}else e=e.previousSibling;else xt.check.isListCell(h)||(a=e=h)}}o=e||p?this.selection.getRange():this.selection.getRangeAndAddLine(this.selection.getRange(),null);const g=o.commonAncestorContainer,m=o.startOffset,f=o.endOffset,b=o.startContainer===g&&this.format.isLine(g),y=b&&(g.childNodes[m]||g.childNodes[0])||o.startContainer,v=b&&(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=y,3===y.nodeType&&(l=y.parentNode),o.collapsed)if(3===g.nodeType)e=g.textContent.length>f?g.splitText(f):g.nextSibling;else if(xt.check.isBreak(l))e=l,l=l.parentNode;else{const i=l.childNodes[m],s=3===i?.nodeType&&xt.check.isZeroWidth(i)&&xt.check.isBreak(i.nextSibling)?i.nextSibling:i;s?!s.nextSibling&&xt.check.isBreak(s)?(l.removeChild(s),e=null):e=xt.check.isBreak(s)&&!xt.check.isBreak(t)?s:s.nextSibling:e=null}else{if(y===v){e=xt.check.isEdgePoint(v,f)?v.nextSibling:v.splitText(f);let t=y;xt.check.isEdgePoint(y,m)||(t=y.splitText(m)),l.removeChild(t),0===l.childNodes.length&&p&&(l.innerHTML="<br>")}else{const i=this.remove(),s=i.container,n=i.prevContainer;if(0===s?.childNodes.length&&p&&(this.format.isLine(s)?s.innerHTML="<br>":this.format.isBlock(s)&&(s.innerHTML="<"+this.options.get("defaultLine")+"><br></"+this.options.get("defaultLine")+">")),xt.check.isListCell(s)&&3===t.nodeType)l=s,e=null;else if(!p&&n)if(l=3===n.nodeType?n.parentNode:n,l.contains(s)){let t=!0;for(e=s;e.parentNode&&e.parentNode!==l;)e=e.parentNode,t=!1;t&&s===n&&(e=e.nextSibling)}else e=null;else xt.check.isWysiwygFrame(s)&&!this.format.isLine(t)?(l=s.appendChild(xt.utils.createElement(this.options.get("defaultLine"))),e=null):l=(e=p?v:s===n?s.nextSibling:s)&&e.parentNode?e.parentNode:g;for(;e&&!this.format.isLine(e)&&e.parentNode!==g;)e=e.parentNode}}try{const i=this.frameContext.get("wysiwyg");if(!c){if((xt.check.isWysiwygFrame(e)||l===i.parentNode)&&(l=i,e=null),this.format.isLine(t)||this.format.isBlock(t)||!xt.check.isListCell(l)&&this.component.isBasic(t)){const t=l;if(xt.check.isListCell(e))l=e.previousElementSibling||e;else if(!r&&!e){const t=this.remove(),i=3===t.container.nodeType?xt.check.isListCell(this.format.getLine(t.container,null))?t.container:this.format.getLine(t.container,null)||t.container.parentNode:t.container,s=xt.check.isWysiwygFrame(i)||this.format.isBlock(i);l=s?i:i.parentNode,e=s?null:i.nextSibling}0===t.childNodes.length&&l!==t&&xt.utils.removeItem(t)}if(!p||u||this.format.isBlock(l)||xt.check.isListCell(l)||xt.check.isWysiwygFrame(l)||(e=l.nextElementSibling,l=l.parentNode),xt.check.isWysiwygFrame(l)&&(3===t.nodeType||xt.check.isBreak(t))){const e=xt.utils.createElement(this.options.get("defaultLine"),null,t);n=t,t=e}}if(c?d.parentNode?(l=d,e=a):(l=i,e=null):e=l===e?l.lastChild:e,xt.check.isListCell(t)&&!xt.check.isList(l)){if(xt.check.isListCell(l))e=l.nextElementSibling,l=l.parentNode;else{const t=xt.utils.createElement("ol");l.insertBefore(t,e),l=t,e=null}c=!0}if(this._checkDuplicateNode(t,l),l.insertBefore(t,e),c)if(xt.check.isZeroWidth(h.textContent.trim()))xt.utils.removeItem(h),t=t.lastChild;else{const e=xt.utils.arrayFind(h.children,xt.check.isList);e&&(t!==e?(t.appendChild(e),t=e.previousSibling):(l.appendChild(t),t=l),xt.check.isZeroWidth(h.textContent.trim())&&xt.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 i,s,n,o,l=0,r=e.length;l<r;l++){for(i=e[l],n=i.childNodes,o=i.parentNode;n[0];)s=n[0],o.insertBefore(s,i);i===t&&(t=s),xt.utils.removeItem(i)}if((this.format.isLine(t)||this.component.isBasic(t))&&y===v){const t=this.format.getLine(g,null);1===t?.nodeType&&xt.check.isEmptyLine(t)&&xt.utils.removeItem(t)}if(u&&!xt.check.isList(t)&&(this.format.isLine(t)||this.format.isBlock(t))&&(t=this._setIntoFreeFormat(t)),!this.component.isBasic(t)){let e=1;if(3===t.nodeType)e=t.textContent.length,this.selection.setRange(t,e,t,e);else if(!xt.check.isBreak(t)&&!xt.check.isListCell(t)&&this.format.isLine(l)){let i=null;t.previousSibling&&!xt.check.isBreak(t.previousSibling)||(i=xt.utils.createTextNode(Ct.zeroWidthSpace),t.parentNode.insertBefore(i,t)),t.nextSibling&&!xt.check.isBreak(t.nextSibling)||(i=xt.utils.createTextNode(Ct.zeroWidthSpace),t.parentNode.insertBefore(i,t.nextSibling)),this.inline._isIgnoreNodeChange(t)&&(t=t.nextSibling,e=0),this.selection.setRange(t,e,t,e)}}s=t}return s},remove(){this.selection._resetRangeToTextNode();const t=this.selection.getRange(),e=0===t.startOffset,i=xt.check.isEdgePoint(t.endContainer,t.endOffset,"end");let s=null,n=null,o=null;e&&(n=this.format.getLine(t.startContainer),s=n?n.previousElementSibling:null,n=n?s:n),i&&(o=this.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(xt.check.isWysiwygFrame(a)&&xt.check.isWysiwygFrame(h)){this.set("");return{container:this.selection.getNode(),offset:0,commonCon:u}}if(u===a&&u===h){if(this.component.isBasic(u)){const t=this.component.get(u).container,e=t.parentElement,i=t.nextSibling||t.previousSibling,s=i===t.previousSibling?i?.textContent?.length||1:0,n=e.nextElementSibling||e.previousElementSibling,o=n===e.previousElementSibling?n?.textContent?.length||1:0;return xt.utils.removeItem(t),this.format.isLine(e)?0===e.childNodes.length?(xt.utils.removeItem(e),{container:n,offset:o,commonCon:u}):{container:i,offset:s,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=xt.query.getNextDeepestNode(u,this.frameContext.get("wysiwyg")),e=xt.query.getPreviousDeepestNode(u,this.frameContext.get("wysiwyg")),i=this.format.getLine(u);xt.utils.removeItem(u);let s=t||e,n=t?0:3===s?.nodeType?s.textContent.length:1;const o=this.format.getLine(s)||this.component.get(s);return i!==o&&(s=o,n=0===n?0:1),xt.check.isZeroWidth(i)&&!i.contains(s)&&xt.utils.removeItem(i),{container:s,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&&xt.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=xt.query.getListChildNodes(u,null,null);let f=xt.utils.getArrayIndex(m,a),b=xt.utils.getArrayIndex(m,h);if(m.length>0&&f>-1&&b>-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=b-1,e=h;t>f;t--)m[t]===e.parentNode&&1===m[t].nodeType&&(m.splice(t,1),e=e.parentNode,--b)}else{if(0===m.length){if(this.format.isLine(u)||this.format.isBlock(u)||xt.check.isWysiwygFrame(u)||xt.check.isBreak(u)||xt.check.isMedia(u))return{container:u,offset:0,commonCon:u};if(xt.check.isText(u))return{container:u,offset:d,commonCon:u};m.push(u),a=h=u}else if(a=h=m[0],xt.check.isBreak(a)||xt.check.isZeroWidth(a))return{container:xt.check.isMedia(u)?u:a,offset:0,commonCon:u};f=b=0}const y=xt.check.isText,v=xt.check.isElement,_=f===b;let C=null;for(let t=f;t<=b;t++){const e=m[t];if(!y(e)||void 0!==e.data&&0!==e.length)if(e!==a)if(e!==h)C=this._nodeRemoveListItem(e,_);else{if(y(h))g=xt.utils.createTextNode(h.substringData(d,h.length-d));else{if(this.component.is(h))continue;g=xt.utils.createTextNode(h.textContent)}g.length>0?h.data=g.data:C=this._nodeRemoveListItem(h,_)}else{if(v(a)){if(this.component.is(a))continue;p=xt.utils.createTextNode(a.textContent)}else{const t=a,i=h;e===h?(p=xt.utils.createTextNode(t.substringData(0,c)+i.substringData(d,i.length-d)),r=c):p=xt.utils.createTextNode(t.substringData(0,c))}if(p.length>0?a.data=p.data:C=this._nodeRemoveListItem(a,_),e===h)break}else C=this._nodeRemoveListItem(e,_)}const w=xt.query.getParentElement(h,"ul"),x=xt.query.getParentElement(a,"li");if(w&&x&&x.contains(w)?(l=w.previousSibling,r=l.textContent.length):(l=h&&h.parentNode?h:a&&a.parentNode?a:t.endContainer||t.startContainer,(e||i)&&(i?1===l.nodeType&&0===l.childNodes.length?(l.appendChild(xt.utils.createElement("BR")),r=1):r=l.textContent.length:r=0)),this.format.getLine(l)||a&&a.parentNode||(o?(l=o,r=0):n&&(l=n,r=1)),!xt.check.isWysiwygFrame(l)&&0===l.childNodes.length){const t=this.nodeTransform.removeAllParents(l,null,null);t&&(l=t.sc||t.ec||this.frameContext.get("wysiwyg"))}return l&&(1!==l.nodeType||this.format.isLine(l)||xt.check.isBreak(l))||(l=C?.sc||C?.ec,r=3===l?.nodeType?l.textContent.length:1),this.selection.setRange(l,r,l,r),{container:l,offset:r,prevContainer:s,commonCon:u?.parentElement?u:null}},get({withFrame:t,includeFullPage:e,rootKey:i}={}){i?Array.isArray(i)||(i=[i]):i=[this.status.rootKey];const s=this.status.rootKey,n={};for(let s,o=0,l=i.length;o<l;o++){this.editor.changeFrameContext(i[o]);const l=this.frameContext,r=xt.utils.createElement("DIV",null,this._convertToCode(l.get("wysiwyg"),!0)),a=xt.check.isTableCell,h=xt.check.isEmptyLine,c=[],d=[];xt.query.getListChildren(r,(t=>{t.hasAttribute("contenteditable")&&c.push(t);const e=t.parentElement;return a(e)&&e.children.length<=1&&h(t)&&d.push(e),!1}),null);for(let t=0,e=c.length;t<e;t++)c[t].removeAttribute("contenteditable");for(let t=0,e=d.length;t<e;t++)d[t].innerHTML="<br>";const u=r.innerHTML;if(this.frameOptions.get("iframe_fullPage"))if(e){const t=xt.utils.getAttributesToString(l.get("_wd").body,["contenteditable"]);s=`<!DOCTYPE html><html>${l.get("_wd").head.outerHTML}<body ${t}>${u}</body></html>`}else s=u;else s=t?`<div class="${this.options.get("_editableClass")+""+(this.options.get("_rtl")?" se-rtl":"")}">${u}</div>`:r.innerHTML;n[i[o]]=s}return this.editor.changeFrameContext(s),i.length>1?n:n[i[0]]},set(t,{rootKey:e}={}){this.ui._offCurrentController(),this.selection.removeRange();const i=null==t?"":this.clean(t,{forceFormat:!0,whitelist:null,blacklist:null});e?Array.isArray(e)||(e=[e]):e=[this.status.rootKey];for(let t=0;t<e.length;t++)if(this.editor.changeFrameContext(e[t]),this.frameContext.get("isCodeView")){const t=this._convertToCode(i,!1);this.viewer._setCodeView(t)}else this.frameContext.get("wysiwyg").innerHTML=i,this.editor._resetComponents(),this.history.push(!1,e[t])},add(t,{rootKey:e}={}){this.ui._offCurrentController(),e?Array.isArray(e)||(e=[e]):e=[this.status.rootKey];for(let i=0;i<e.length;i++){this.editor.changeFrameContext(e[i]);const s=this.clean(t,{forceFormat:!0,whitelist:null,blacklist:null});if(this.frameContext.get("isCodeView"))this.viewer._setCodeView(this.viewer._getCodeView()+"\n"+this._convertToCode(s,!1));else{const t=xt.utils.createElement("DIV",null,s).children,n=t.length;for(let e=0;e<n;e++)t[e]&&this.frameContext.get("wysiwyg").appendChild(t[e]);this.history.push(!1,e[i]),this.selection.scrollTo(t[n-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&&!xt.check.isElement(t)&&!xt.check.isText(t))&&(!1===await St.write(t)?(this.ui.showToast(this.lang.message_copy_fail,this.options.get("toastMessageTime").copy,"error"),!1):(this.ui.showToast(this.lang.message_copy_success,this.options.get("toastMessageTime").copy),!0))}catch(t){return console.error("[SUNEDITOR.html.copy.fail] :",t),this.ui.showToast(this.lang.message_copy_fail,this.options.get("toastMessageTime").copy,"error"),!1}},setFullPage(t,{rootKey:e}={}){if(!this.frameOptions.get("iframe"))return!1;e?Array.isArray(e)||(e=[e]):e=[this.status.rootKey];for(let i=0;i<e.length;i++)this.editor.changeFrameContext(e[i]),t.head&&(this.frameContext.get("_wd").head.innerHTML=t.head.replace(this.__disallowedTagsRegExp,"")),t.body&&(this.frameContext.get("_wd").body.innerHTML=this.clean(t.body,{forceFormat:!0,whitelist:null,blacklist:null})),this.editor._resetComponents()},compress:t=>t.replace(/>\s+</g,"> <").replace(/\n/g,"").trim(),_convertToCode(t,e){let i="";const s=RegExp,n=new s("^(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?this._d.createRange().createContextualFragment(t):t,l=t=>this.format.isLine(t)||this.component.is(t),r=e?"":"\n",a=e?0:1*this.status.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,b,y=0,v=a.length;y<v;y++)u=a[y],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(),b=d||m?o:"",i+=(g||(c?"":p))+b+u.outerHTML.match(s("<"+f+"[^>]*>","i"))[0]+p,t(u,o+h+""),i+=(/\n$/.test(i)?b:"")+"</"+f+">"+(g||p||c||/^(TH|TD)$/i.test(u.nodeName)?r:"")):i+=(new XMLSerializer).serializeToString(u):i+=(/^HR$/i.test(u.nodeName)?r:"")+(/^PRE$/i.test(u.parentElement.nodeName)&&/^BR$/i.test(u.nodeName)?"":d)+u.outerHTML+p:xt.check.isList(u.parentElement)||(i+=wt.htmlToEntity(/^\n+$/.test(u.data)?"":u.data)):i+="\n\x3c!-- "+u.textContent.trim()+" --\x3e"+p}(o,""),i.trim()+r},_nodeRemoveListItem(t,e){const i=this.format.getLine(t,null);if(xt.utils.removeItem(t),!xt.check.isListCell(i)||e)return;const s=this.nodeTransform.removeAllParents(i,null,null);return xt.check.isList(i?.firstChild)&&i.insertBefore(xt.utils.createTextNode(Ct.zeroWidthSpace),i.firstChild),s?{sc:s.sc,ec:s.ec}:null},_setIntoFreeFormat(t){const e=t.parentNode;let i,s;for(;this.format.isLine(t)||this.format.isBlock(t);){for(i=t.childNodes,s=null;i[0];)if(s=i[0],this.format.isLine(s)||this.format.isBlock(s)){if(this._setIntoFreeFormat(s),!t.parentNode)break;i=t.childNodes}else e.insertBefore(s,t);0===t.childNodes.length&&xt.utils.removeItem(t),t=xt.utils.createElement("BR"),e.insertBefore(t,s.nextSibling)}return t},_makeLine(t,e){const i=this.options.get("defaultLine");if(1===t.nodeType){if(this.__disallowedTagNameRegExp.test(t.nodeName))return"";if(xt.check.isExcludeFormat(t))return t.outerHTML;const s=xt.query.getListChildNodes(t,(t=>xt.check.isSpanWithoutAttr(t)&&!xt.query.getParentElement(t,xt.check.isExcludeFormat)),null)||[];for(let t,e=s.length-1;e>=0;e--)t=s[e],t.outerHTML=t.innerHTML;if(!e||this.format.isLine(t)||this.format.isBlock(t)||this.component.is(t)||xt.check.isMedia(t)||xt.check.isFigure(t)||xt.check.isAnchor(t)&&xt.check.isMedia(t.firstElementChild)){const e=t;return xt.check.isSpanWithoutAttr(t)?e.innerHTML:e.outerHTML}{const e=t;return"<"+i+">"+(xt.check.isSpanWithoutAttr(t)?e.innerHTML:e.outerHTML)+"</"+i+">"}}if(3===t.nodeType){if(!e)return wt.htmlToEntity(t.textContent);const s=t.textContent.split(/\n/g);let n="";for(let t,e=0,o=s.length;e<o;e++)t=s[e].trim(),t.length>0&&(n+="<"+i+">"+wt.htmlToEntity(t)+"</"+i+">");return n}return 8===t.nodeType&&this._allowHTMLComment?"\x3c!--"+t.textContent.trim()+"--\x3e":""},_consistencyCheckOfHTML(t,e,i,s,n,o,l){const r=[],a=[],h=[],c=[],d=xt.query.getListChildNodes(t,(d=>{if(1!==d.nodeType)return n&&xt.check.isList(d.parentElement)&&r.push(d),3!==d.nodeType||d.textContent.trim()||r.push(d),!1;if(s&&(i.test(d.nodeName)||!e.test(d.nodeName)&&0===d.childNodes.length&&xt.check.isExcludeFormat(d)))return r.push(d),!1;const u=!xt.query.getParentElement(d,xt.check.isExcludeFormat);if(n){if(!xt.check.isTableElements(d)&&!xt.check.isListCell(d)&&!xt.check.isAnchor(d)&&(this.format.isLine(d)||this.format.isBlock(d)||this.format.isTextStyleNode(d))&&0===d.childNodes.length&&u)return a.push(d),!1;if(xt.check.isList(d.parentNode)&&!xt.check.isList(d)&&!xt.check.isListCell(d))return h.push(d),!1;if(xt.check.isTableCell(d)){const t=d.firstElementChild;if(!this.format.isLine(t)&&!this.format.isBlock(t)&&!this.component.is(t))return c.push(d),!1}}if(o&&u&&d.className){const t=new Array(d.classList).map(this._isAllowedClassName).join(" ").trim();t?d.className=t:d.removeAttribute("class")}if(!n)return!1;return!l&&d.parentNode!==t&&u&&(xt.check.isListCell(d)&&!xt.check.isList(d.parentNode)||(this.format.isLine(d)||this.component.is(d))&&!this.format.isBlock(d.parentNode)&&!xt.query.getParentElement(d,this.component.is.bind(this.component)))}),null);for(let t=0,e=r.length;t<e;t++)xt.utils.removeItem(r[t]);const u=[];for(let t,e,i=0,s=d.length;i<s;i++)if(t=d[i],e=t.parentNode,e&&e.parentNode)if(xt.query.getParentElement(t,xt.check.isListCell)){const i=t.childNodes;for(let n=i.length-1;s>=0;n--)e.insertBefore(t,i[n]);u.push(t)}else e.parentNode.insertBefore(t,e),u.push(e);for(let t,e=0,i=u.length;e<i;e++)t=u[e],xt.check.isZeroWidth(t.textContent.trim())&&xt.utils.removeItem(t);for(let t=0,e=a.length;t<e;t++)xt.utils.removeItem(a[t]);for(let t,e,i,s,n=0,o=h.length;n<o;n++)if(t=h[n],s=t.parentNode,s)if(e=xt.utils.createElement("LI"),this.format.isLine(t)){for(i=t.childNodes;i[0];)e.appendChild(i[0]);s.insertBefore(e,t),xt.utils.removeItem(t)}else t=t.nextSibling,e.appendChild(h[n]),s.insertBefore(e,t);for(let t,e,i=0,s=c.length;i<s;i++)t=c[i],e=xt.utils.createElement("DIV"),e.innerHTML=0===t.textContent.trim().length&&0===t.children.length?"<br>":t.innerHTML,t.innerHTML=e.outerHTML},_styleNodeConvertor(t){if(!this._disallowedStyleNodesRegExp)return t;const e=this.options.get("_defaultStyleTagMap");return t.replace(this._disallowedStyleNodesRegExp,((t,i,s,n)=>i+("string"==typeof e[s]?e[s]:s)+(n?" "+n:"")))},_editFormat(t){let e,i="";const s=t.childNodes;for(let t,n=0,o=s.length;n<o;n++)t=s[n],this.__allowedTagNameRegExp.test(t.nodeName)?i+=t.outerHTML:8===t.nodeType?i+="\x3c!-- "+t.textContent+" --\x3e":/meta/i.test(t.nodeName)||this.format.isLine(t)||this.format.isBlock(t)||this.component.is(t)||xt.check.isExcludeFormat(t)?(e&&(i+=e.outerHTML,e=null),i+=t.outerHTML):(e||=xt.utils.createElement(this.options.get("defaultLine")),this.format.isTextStyleNode(t)&&t.removeAttribute("style"),e.appendChild(t),n--,o--);return e&&(i+=e.outerHTML),this._d.createRange().createContextualFragment(i)},_convertListCell(t){let e="";for(let i,s=0,n=t.length;s<n;s++)i=t[s],1===i.nodeType?xt.check.isList(i)?e+=i.innerHTML:xt.check.isListCell(i)?e+=i.outerHTML:this.format.isLine(i)?e+="<li>"+(i.innerHTML.trim()||"<br>")+"</li>":this.format.isBlock(i)&&!xt.check.isTableElements(i)?e+=this._convertListCell(i.children):e+="<li>"+i.outerHTML+"</li>":e+="<li>"+(i.textContent||"<br>")+"</li>";return e},_isFormatData(t){let e=!1;for(let i,s=0,n=t.length;s<n;s++)if(i=t[s],1===i.nodeType&&!this.format.isTextStyleNode(i)&&!xt.check.isBreak(i)&&!this.__disallowedTagNameRegExp.test(i.nodeName)){e=!0;break}return e},_cleanStyle(t,e,i){let s=(t.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/)||[])[0];if(this._textStyleTags.includes(i)&&!s&&(t.match(/<[^\s]+\s(.+)/)||[])[1]){const e=(t.match(/\ssize="([^"]+)"/i)||[])[1],i=(t.match(/\sface="([^"]+)"/i)||[])[1],n=(t.match(/\scolor="([^"]+)"/i)||[])[1];(e||i||n)&&(s='style="'+(e?"font-size:"+kt.get(Number(e)/3.333,1)+"rem;":"")+(i?"font-family:"+i+";":"")+(n?"color:"+n+";":"")+'"')}if(s){let t;e||=[];for(const[e,s]of this._cleanStyleRegExpMap)if(e.test(i)){t=s;break}if(!t)return e;const n=s.replace(/"/g,"").match(t);if(!n)return e;const o=[];for(let t,e=0,i=n.length;e<i;e++)if(t=n[e].match(/([a-zA-Z0-9-]+)(:)([^"']+)/),t&&!/inherit|initial|revert|unset/i.test(t[3])){const e=wt.kebabToCamelCase(t[1].trim()),i=this.frameContext.get("wwComputedStyle")[e]?.replace(/"/g,""),s=t[3].trim();switch(e){case"fontFamily":if(!this.plugins.font||!this.plugins.font.fontArray.includes(s))continue;break;case"fontSize":if(!this.plugins.fontSize)continue;this.fontSizeUnitRegExp.test(t[0])||(t[0]=t[0].replace((t[0].match(/:\s*([^;]+)/)||[])[1],wt.toFontUnit.bind(null,this.options.get("fontSizeUnits")[0])));break;case"color":if(!this.plugins.fontColor||/rgba\(([0-9]+\s*,\s*){3}0\)|windowtext/i.test(s))continue;break;case"backgroundColor":if(!this.plugins.backgroundColor||/rgba\(([0-9]+\s*,\s*){3}0\)|windowtext/i.test(s))continue}i!==s&&o.push(t[0])}o.length>0&&e.push('style="'+o.join(";")+'"')}return e},_deleteDisallowedTags:(t,e,i)=>(e.test("<font>")&&(t=t.replace(/(<\/?)font(\s?)/gi,"$1span$2")),t.replace(e,"").replace(i,"")),_checkDuplicateNode(t,e){const i=this;!function t(s){i._dupleCheck(s,e);const n=s.childNodes;for(let e=0,i=n.length;e<i;e++)t(n[e])}(t)},_dupleCheck(t,e){if(!this.format.isTextStyleNode(t))return;const i=(t.style.cssText.match(/[^;]+;/g)||[]).map((function(t){return t.trim()})),s=t.nodeName;if(/^span$/i.test(s)&&0===i.length)return t;const n=this.format;let o=!1;return function e(l){if(!xt.check.isWysiwygFrame(l)&&n.isTextStyleNode(l)){if(l.nodeName===s){o=!0;const e=l.style.cssText.match(/[^;]+;/g)||[];for(let t,s=0,n=e.length;s<n;s++)(t=i.indexOf(e[s].trim()))>-1&&i.splice(t,1);for(let e=0,i=l.classList.length;e<i;e++)t.classList.remove(l.classList[e])}e(l.parentElement)}}(e),o&&((t.style.cssText=i.join(" "))||(t.setAttribute("style",""),t.removeAttribute("style")),0===t.attributes.length&&t.setAttribute("data-duple","true")),t},__resetAutoStyleify(t){if(t.length>0){const e=this.options.get("convertTextTags"),i={};t.forEach((t=>{switch(t){case"bold":i.bold={regex:/font-weight\s*:\s*bold/i,tag:e.bold};break;case"italic":i.italic={regex:/font-style\s*:\s*italic/i,tag:e.italic};break;case"underline":i.underline={regex:/text-decoration\s*:\s*underline/i,tag:e.underline};break;case"strike":i.strike={regex:/text-decoration\s*:\s*line-through/i,tag:e.strike}}})),this._autoStyleify=i}else this._autoStyleify=null},constructor:qs};const Zs=qs;function Gs(t){re.call(this,t),this._listCamel=this.options.get("__listCommonStyle"),this._listKebab=wt.camelToKebabCase(this.options.get("__listCommonStyle"))}function Ys(t){const e=t.parentNode;if(!t||3===t.nodeType||!e)return;const i=t.childNodes;for(;i[0];)e.insertBefore(i[0],t);e.removeChild(t)}Gs.prototype={apply(t,{stylesToModify:e,nodesToRemove:i,strictRemove:s}={}){if(xt.query.getParentElement(this.selection.getNode(),xt.check.isNonEditable))return;this.selection._resetRangeToTextNode();let n=this.selection.getRangeAndAddLine(this.selection.getRange(),null);e=e?.length>0?e:null,i=i?.length>0?i:null;const o=!t,l=o&&!i&&!e;let r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset;if(l&&n.collapsed&&this.format.isLine(r.parentNode)&&this.format.isLine(h.parentNode)||r===h&&1===r.nodeType&&xt.check.isNonEditable(r)){const t=r.parentNode;if(!xt.check.isListCell(t)||!wt.getValues(t.style).some((t=>this._listKebab.includes(t))))return}if(n.collapsed&&!l&&1===r.nodeType&&!xt.check.isBreak(r)&&!this.component.is(r)){let t=null;const e=r.childNodes[a];e&&(t=e.nextSibling?xt.check.isBreak(e)?e:e.nextSibling:null);const i=xt.utils.createTextNode(Ct.zeroWidthSpace);r.insertBefore(i,t),this.selection.setRange(i,1,i,1),n=this.selection.getRange(),r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset}this.format.isLine(r)&&(r=r.childNodes[a]||r.firstChild,a=0),this.format.isLine(h)&&(h=h.childNodes[c]||h.lastChild,c=h.textContent.length),o&&(t=xt.utils.createElement("DIV"));const d=RegExp,u=t.nodeName;if(!l&&r===h&&!i&&t){let e=r,i=0;const s=[],n=t.style;for(let t=0,e=n.length;t<e;t++)s.push(n[t]);const l=t.className,a=t.classList;for(let t=0,e=a.length;t<e;t++)s.push("."+a[t]);if(s.length>0){for(;!this.format.isLine(e)&&!xt.check.isWysiwygFrame(e);){for(let t=0;t<s.length;t++)if(1===e.nodeType){const r=s[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)&&i++}e=e.parentNode}if(i>=s.length)return}}let p,g,m={},f={},b="",y="";if(e){for(let t,i=0,s=e.length;i<s;i++)t=e[i],/^\./.test(t)?y+=(y?"|":"\\s*(?:")+t.replace(/^\./,""):b+=(b?"|":"(?:;|^|\\s)(?:")+t;b&&(b+=")\\s*:[^;]*\\s*(?:;|$)",b=new d(b,"ig")),y&&(y+=")(?=\\s+|$)",y=new d(y,"ig"))}if(i){g="^(?:"+i[0];for(let t=1;t<i.length;t++)g+="|"+i[t];g+=")$",g=new d(g,"i")}const v={v:!1},_=function(t){const e=t.cloneNode(!1);if(3===e.nodeType||xt.check.isBreak(e))return e;if(l)return null;const i=!g&&o||g?.test(e.nodeName);if(i&&!s)return v.v=!0,null;const n=e.style.cssText;let r="";b&&n.length>0&&(r=n.replace(b,"").trim(),r!==n&&(v.v=!0));const a=e.className;let h="";return y&&a.length>0&&(h=a.replace(y,"").trim(),h!==a&&(v.v=!0)),(!o||!y&&a||!b&&n||r||h||!i)&&(r||h||e.nodeName!==u||Boolean(b)!==Boolean(n)||Boolean(y)!==Boolean(a))?(b&&n.length>0&&(e.style.cssText=r),e.style.cssText||e.removeAttribute("style"),y&&a.length>0&&(e.className=h.trim()),e.className.trim()||e.removeAttribute("class"),e.style.cssText||e.className||e.nodeName!==u&&!i?e:(v.v=!0,null)):(v.v=!0,null)},C=this.format.getLines(null);if(0===C.length)return void console.warn("[SUNEDITOR.inline.apply.warn] There is no line to apply.");n=this.selection.getRange(),r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset,this.format.getLine(r,null)||(r=xt.query.getEdgeChild(C[0],(function(t){return 3===t.nodeType}),!1),a=0),this.format.getLine(h,null)||(h=xt.query.getEdgeChild(C.at(-1),(function(t){return 3===t.nodeType}),!1),c=h.textContent.length);const w=this.format.getLine(r,null)===this.format.getLine(h,null),x=C.length-(w?0:1);p=t.cloneNode(!1);const k=l||o&&function(t,e){for(let i=0,s=e.length;i<s;i++)if(t._isNonSplitNode(e[i]))return!0;return!1}(this,i),E=o||this._sn_isSizeNode(p),S=this._sn_getMaintainedNode.bind(this,k,E),T=this._sn_isMaintainedNode.bind(this,k,E);if(w){this._sn_resetCommonListCell(C[0],e)&&(n=this.selection.setRange(r,a,h,c));const t=this._setNode_oneLine(C[0],p,_,r,a,h,c,l,o,n.collapsed,v,S,T);m.container=t.startContainer,m.offset=t.startOffset,f.container=t.endContainer,f.offset=t.endOffset,m.container===f.container&&xt.check.isZeroWidth(m.container)&&(m.offset=f.offset=1),this._sn_setCommonListStyle(t.ancestor,null)}else{let i=!1;x>0&&this._sn_resetCommonListCell(C[x],e)&&(i=!0),this._sn_resetCommonListCell(C[0],e)&&(i=!0),i&&this.selection.setRange(r,a,h,c),x>0&&(p=t.cloneNode(!1),f=this._setNode_endLine(C[x],p,_,h,c,l,o,v,S,T));for(let i,s=x-1;s>0;s--)this._sn_resetCommonListCell(C[s],e),p=t.cloneNode(!1),i=this._setNode_middleLine(C[s],p,_,l,o,v,f.container),i.endContainer&&i.ancestor.contains(i.endContainer)&&(f.ancestor=null,f.container=i.endContainer),this._sn_setCommonListStyle(i.ancestor,null);p=t.cloneNode(!1),m=this._setNode_startLine(C[0],p,_,r,a,l,o,v,S,T,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._sn_setCommonListStyle(m.ancestor,null),this._sn_setCommonListStyle(f.ancestor||this.format.getLine(f.container),null)}return this.ui._offCurrentController(),this.selection.setRange(m.container,m.offset,f.container,f.offset),this.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&&(xt.check.isNonEditable(t)||!this.format.isTextStyleNode(t)||this.component.is(t))},_setNode_oneLine(t,e,i,s,n,o,l,r,a,h,c,d,u){let p=s.parentNode;for(;!(p.nextSibling||p.previousSibling||this.format.isLine(p.parentNode)||xt.check.isWysiwygFrame(p.parentNode))&&p.nodeName!==e.nodeName;)p=p.parentNode;if(!a&&p===o.parentNode&&p.nodeName===e.nodeName&&xt.check.isZeroWidth(s.textContent.slice(0,n))&&xt.check.isZeroWidth(o.textContent.slice(l))){const i=p.childNodes;let r=!1;for(let t,e,n,l,a=0,h=i.length;a<h;a++)if(t=i[a],l=!xt.check.isZeroWidth(t),t!==s)if(t!==o){if(!e&&l||e&&n&&l){r=!1;break}}else n=!0;else e=!0;if(r)return xt.utils.copyTagAttributes(p,e),{ancestor:t,startContainer:s,startOffset:n,endContainer:o,endOffset:l}}c.v=!1;const g=this,m=t,f=[e],b=t.cloneNode(!1),y=s===o;let v,_,C,w,x,k=s,E=n,S=o,T=l,H=!1,L=!1;const M=RegExp;function N(t){const e=new M("(?:;|^|\\s)(?:"+w+"null)\\s*:[^;]*\\s*(?:;|$)","ig");let i=!1;return e&&t.style.cssText.length>0&&(i=e.test(t.style.cssText)),!i}if(function t(s,n){const o=s.childNodes;for(let s,l=0,a=o.length;l<a;l++){const a=o[l];if(!a)continue;let c,p=n;if(!H&&a===k){let t=b;x=d(a);let o="",l="";if(3===k.nodeType){const t=k;o=t.substringData(0,E),l=t.substringData(E,y&&T>=E?T-E:t.data.length-E)}const r=xt.utils.createTextNode(o),h=xt.utils.createTextNode(l);if(x){const e=d(n);if(e.parentNode!==t){let i=e,s=null;for(;i.parentNode!==t;){for(n=s=i.parentNode.cloneNode(!1);i.childNodes[0];)s.appendChild(i.childNodes[0]);i.appendChild(s),i=i.parentNode}i.parentNode.appendChild(e)}x=x.cloneNode(!1)}xt.check.isZeroWidth(r)||n.appendChild(r);const c=d(n);for(c&&(x=c),x&&(t=x),_=a,v=[],w="";_!==t&&_!==m&&null!==_;)s=u(_)?null:i(_),s&&1===_.nodeType&&N(_)&&(v.push(s),w+=_.style.cssText.substring(0,_.style.cssText.indexOf(":"))+"|"),_=_.parentElement;const p=v.pop()||h;for(C=_=p;v.length>0;)_=v.pop(),C.appendChild(_),C=_;if(e.appendChild(p),t.appendChild(e),x&&!d(S)&&(e=e.cloneNode(!1),b.appendChild(e),f.push(e)),k=h,E=0,H=!0,_!==h&&_.appendChild(k),!y)continue}if(L||a!==S){if(H){if(1===a.nodeType&&!xt.check.isBreak(a)){g._isIgnoreNodeChange(a)?(b.appendChild(a.cloneNode(!0)),h||(e=e.cloneNode(!1),b.appendChild(e),f.push(e))):t(a,a);continue}_=a,v=[],w="";const o=[];for(;null!==_.parentNode&&_!==m&&_!==e;)s=L?_.cloneNode(!1):i(_),1===_.nodeType&&!xt.check.isBreak(a)&&s&&N(_)&&(u(_)?x||o.push(s):v.push(s),w+=_.style.cssText.substring(0,_.style.cssText.indexOf(":"))+"|"),_=_.parentElement;v=v.concat(o);const l=v.pop()||a;for(C=_=l;v.length>0;)_=v.pop(),C.appendChild(_),C=_;if(!u(e.parentNode)||u(l)||xt.check.isZeroWidth(e)||(e=e.cloneNode(!1),b.appendChild(e),f.push(e)),L||x||!u(l))l===a?n=L?b:e:L?(b.appendChild(l),n=_):(e.appendChild(l),n=_);else{e=e.cloneNode(!1);const t=l.childNodes;for(let i=0,s=t.length;i<s;i++)e.appendChild(t[i]);l.appendChild(e),b.appendChild(l),f.push(e),n=e.children.length>0?_:e}if(x&&3===a.nodeType)if(d(a)){const t=xt.query.getParentElement(n,(t=>g._isNonSplitNode(t.parentNode)||t.parentNode===b));x.appendChild(t),e=t.cloneNode(!1),f.push(e),b.appendChild(e)}else x=null}c=a.cloneNode(!1),n.appendChild(c),1!==a.nodeType||xt.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(T,e.length-T),n=y?"":e.substringData(0,T)}const o=xt.utils.createTextNode(t),l=xt.utils.createTextNode(n);if(x?x=x.cloneNode(!1):u(e.parentNode)&&!x&&(e=e.cloneNode(!1),b.appendChild(e),f.push(e)),!xt.check.isZeroWidth(o)){_=a,w="",v=[];const t=[];for(;_!==b&&_!==m&&null!==_;)1===_.nodeType&&N(_)&&(u(_)?t.push(_.cloneNode(!1)):v.push(_.cloneNode(!1)),w+=_.style.cssText.substring(0,_.style.cssText.indexOf(":"))+"|"),_=_.parentElement;for(v=v.concat(t),c=C=_=v.pop()||o;v.length>0;)_=v.pop(),C.appendChild(_),C=_;b.appendChild(c),_.textContent=o.data}if(x&&c){const t=d(c);t&&(x=t)}for(_=a,v=[],w="";_!==b&&_!==m&&null!==_;)s=u(_)?null:i(_),s&&1===_.nodeType&&N(_)&&(v.push(s),w+=_.style.cssText.substring(0,_.style.cssText.indexOf(":"))+"|"),_=_.parentElement;const p=v.pop()||l;for(C=_=p;v.length>0;)_=v.pop(),C.appendChild(_),C=_;x?((e=e.cloneNode(!1)).appendChild(p),x.insertBefore(e,x.firstChild),b.appendChild(x),f.push(e),x=null):e.appendChild(p),S=l,T=l.data.length,L=!0,!r&&h&&(e=l,l.textContent=Ct.zeroWidthSpace),_!==l&&_.appendChild(S)}}}(t,b),a&&!r&&!c.v)return{ancestor:t,startContainer:s,startOffset:n,endContainer:o,endOffset:l};if(r&&=a,r)for(let t=0;t<f.length;t++){const e=f[t];let i,s,n;if(h)i=xt.utils.createTextNode(Ct.zeroWidthSpace),b.replaceChild(i,e);else{const t=e.childNodes;for(s=t[0];t[0];)n=t[0],b.insertBefore(n,e);xt.utils.removeItem(e)}0===t&&(h?k=S=i:(k=s,S=n))}else{if(a)for(let t=0;t<f.length;t++)Ys(f[t]);h&&(k=S=e)}this.nodeTransform.removeEmptyNode(b,e,!1),h&&(E=k.textContent.length,T=S.textContent.length);const A=r||0===S.textContent.length;xt.check.isBreak(S)||0!==S.textContent.length||(xt.utils.removeItem(S),S=k),T=A?S.textContent.length:T;const B={s:0,e:0},V=xt.query.getNodePath(k,b,B),I=!S.parentNode;I&&(S=k);const O={s:0,e:0},R=xt.query.getNodePath(S,b,I||A?null:O);E+=B.s,T=h?E:I?k.textContent.length:A?T+B.s:T+O.s;const F=this.nodeTransform.mergeSameTags(b,[V,R],!0);return t.parentNode.replaceChild(b,t),k=xt.query.getNodeFromPath(V,b),S=xt.query.getNodeFromPath(R,b),{ancestor:b,startContainer:k,startOffset:E+F[0],endContainer:S,endOffset:T+F[1]}},_setNode_startLine(t,e,i,s,n,o,l,r,a,h,c){let d=s.parentNode;for(;!(d.nextSibling||d.previousSibling||this.format.isLine(d.parentNode)||xt.check.isWysiwygFrame(d.parentNode))&&d.nodeName!==e.nodeName;)d=d.parentNode;if(!l&&d.nodeName===e.nodeName&&!this.format.isLine(d)&&!d.nextSibling&&xt.check.isZeroWidth(s.textContent.slice(0,n))){let i=!1,o=s.previousSibling;for(;o;){if(!xt.check.isZeroWidth(o)){i=!1;break}o=o.previousSibling}if(i)return xt.utils.copyTagAttributes(d,e),{ancestor:t,container:s,offset:n}}r.v=!1;const u=this,p=t,g=[e],m=t.cloneNode(!1);let f,b,y,v,_=s,C=n,w=!1;if(function t(s,n){const o=s.childNodes;for(let s,l,r=0,d=o.length;r<d;r++){const d=o[r];if(!d)continue;let x=n;if(w&&!xt.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=xt.query.getNodePath(c,d);c=xt.query.getNodeFromPath(t,l)}}else t(d,d);continue}b=d,f=[];const o=[];for(;null!==b.parentNode&&b!==p&&b!==e;)s=i(b),1===b.nodeType&&s&&(h(b)?v||o.push(s):f.push(s)),b=b.parentNode;f=f.concat(o);const r=f.length>0,_=f.pop()||d;for(y=b=_;f.length>0;)b=f.pop(),y.appendChild(b),y=b;if(h(e.parentNode)&&!h(_)&&(e=e.cloneNode(!1),m.appendChild(e),g.push(e)),!v&&h(_)){e=e.cloneNode(!1);const t=_.childNodes;for(let i=0,s=t.length;i<s;i++)e.appendChild(t[i]);_.appendChild(e),m.appendChild(_),n=h(b)?e:b,g.push(e)}else r?(e.appendChild(_),n=b):n=e;if(v&&3===d.nodeType)if(a(d)){const t=xt.query.getParentElement(n,(t=>u._isNonSplitNode(t.parentNode)||t.parentNode===m));v.appendChild(t),e=t.cloneNode(!1),g.push(e),m.appendChild(e)}else v=null}if(w||d!==_)s=w?i(d):d.cloneNode(!1),s&&(n.appendChild(s),1!==d.nodeType||xt.check.isBreak(d)||(x=s)),t(d,x);else{let t=m;v=a(d);let o="",l="";if(3===_.nodeType){const t=_;o=t.substringData(0,C),l=t.substringData(C,t.length-C)}const r=xt.utils.createTextNode(o),h=xt.utils.createTextNode(l);if(v){const e=a(n);if(e&&e.parentNode!==t){let i=e,s=null;for(;i.parentNode!==t;){for(n=s=i.parentNode.cloneNode(!1);i.childNodes[0];)s.appendChild(i.childNodes[0]);i.appendChild(s),i=i.parentNode}i.parentNode.appendChild(e)}v=v.cloneNode(!1)}xt.check.isZeroWidth(r)||n.appendChild(r);const c=a(n);for(c&&(v=c),v&&(t=v),b=n,f=[];b!==t&&null!==b;)s=i(b),1===b.nodeType&&s&&f.push(s),b=b.parentNode;const u=f.pop()||n;for(y=b=u;f.length>0;)b=f.pop(),y.appendChild(b),y=b;u!==n?(e.appendChild(u),n=b):n=e,xt.check.isBreak(d)&&e.appendChild(d.cloneNode(!1)),t.appendChild(e),_=h,C=0,w=!0,n.appendChild(_)}}}(t,m),l&&!o&&!r.v)return{ancestor:t,container:s,offset:n,endContainer:c};if(o&&=l,o)for(let t=0;t<g.length;t++){const e=g[t],i=e.childNodes,s=i[0];for(;i[0];)m.insertBefore(i[0],e);xt.utils.removeItem(e),0===t&&(_=s)}else if(l){e=e.firstChild;for(let t=0;t<g.length;t++)Ys(g[t])}if(o||0!==m.childNodes.length){this.nodeTransform.removeEmptyNode(m,e,!1),xt.check.isZeroWidth(m.textContent)&&(_=m.firstChild,C=0);const i={s:0,e:0},s=xt.query.getNodePath(_,m,i);C+=i.s;const n=this.nodeTransform.mergeSameTags(m,[s],!0);t.parentNode.replaceChild(m,t),_=xt.query.getNodeFromPath(s,m),C+=n[0]}else t.childNodes?_=t.childNodes[0]:(_=xt.utils.createTextNode(Ct.zeroWidthSpace),t.appendChild(_));return{ancestor:m,container:_,offset:C,endContainer:c}},_setNode_middleLine(t,e,i,s,n,o,l){if(!n){let i=null;l&&t.contains(l)&&(i=xt.query.getNodePath(l,t));const s=t.cloneNode(!0),n=e.nodeName,o=e.style.cssText,r=e.className;let a=s.childNodes,h=0,c=a.length;for(let t;h<c&&(t=a[h],3!==t.nodeType);h++){if(t.nodeName!==n){if(!xt.check.isBreak(t)&&this._isIgnoreNodeChange(t))continue;if(1===c){a=t.childNodes,c=a.length,h=-1;continue}break}t.style.cssText+=o,xt.utils.addClass(t,r)}if(c>0&&h===c)return t.innerHTML=s.innerHTML,{ancestor:t,endContainer:i?xt.query.getNodeFromPath(i,t):null}}o.v=!1;const r=this,a=t.cloneNode(!1),h=[e];let c=!0;if(function t(s,n){const o=s.childNodes;for(let s,d,u=0,p=o.length;u<p;u++){const p=o[u];if(!p)continue;let g=n;if(xt.check.isBreak(p)||!r._isIgnoreNodeChange(p))s=i(p),s&&(c=!1,n.appendChild(s),1===p.nodeType&&(g=s)),xt.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=xt.query.getNodePath(l,p);l=xt.query.getNodeFromPath(t,d)}}}(t,e),c||n&&!s&&!o.v)return{ancestor:t,endContainer:l};if(a.appendChild(e),s&&n)for(let t=0;t<h.length;t++){const e=h[t],i=e.childNodes;for(;i[0];)a.insertBefore(i[0],e);xt.utils.removeItem(e)}else if(n){e=e.firstChild;for(let t=0;t<h.length;t++)Ys(h[t])}return this.nodeTransform.removeEmptyNode(a,e,!1),this.nodeTransform.mergeSameTags(a,null,!0),t.parentNode.replaceChild(a,t),{ancestor:a,endContainer:l}},_setNode_endLine(t,e,i,s,n,o,l,r,a,h){let c=s.parentNode;for(;!(c.nextSibling||c.previousSibling||this.format.isLine(c.parentNode)||xt.check.isWysiwygFrame(c.parentNode))&&c.nodeName!==e.nodeName;)c=c.parentNode;if(!l&&c.nodeName===e.nodeName&&!this.format.isLine(c)&&!c.previousSibling&&xt.check.isZeroWidth(s.textContent.slice(n))){let i=!1,o=s.nextSibling;for(;o;){if(!xt.check.isZeroWidth(o)){i=!1;break}o=o.nextSibling}if(i)return xt.utils.copyTagAttributes(c,e),{ancestor:t,container:s,offset:n}}r.v=!1;const d=this,u=t,p=[e],g=t.cloneNode(!1);let m,f,b,y,v=s,_=n,C=!1;if(function t(s,n){const o=s.childNodes;for(let s,l=o.length-1;0<=l;l--){const r=o[l];if(!r)continue;let c=n;if(C&&!xt.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;)s=i(f),s&&1===f.nodeType&&(h(f)?y||o.push(s):m.push(s)),f=f.parentNode;m=m.concat(o);const l=m.length>0,c=m.pop()||r;for(b=f=c;m.length>0;)f=m.pop(),b.appendChild(f),b=f;if(h(e.parentNode)&&!h(c)&&(e=e.cloneNode(!1),g.insertBefore(e,g.firstChild),p.push(e)),!y&&h(c)){e=e.cloneNode(!1);const t=c.childNodes;for(let i=0,s=t.length;i<s;i++)e.appendChild(t[i]);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(y&&3===r.nodeType)if(a(r)){const t=xt.query.getParentElement(n,(t=>d._isNonSplitNode(t.parentNode)||t.parentNode===g));y.appendChild(t),e=t.cloneNode(!1),p.push(e),g.insertBefore(e,g.firstChild)}else y=null}if(C||r!==v)s=C?i(r):r.cloneNode(!1),s&&(n.insertBefore(s,n.firstChild),1!==r.nodeType||xt.check.isBreak(r)||(c=s)),t(r,c);else{y=a(r);let t="",o="";if(3===v.nodeType){const e=v;t=e.substringData(_,e.length-_),o=e.substringData(0,_)}const l=xt.utils.createTextNode(t),c=xt.utils.createTextNode(o);if(y){y=y.cloneNode(!1);const t=a(n);if(t.parentNode!==g){let e=t,i=null;for(;e.parentNode!==g;){for(n=i=e.parentNode.cloneNode(!1);e.childNodes[0];)i.appendChild(e.childNodes[0]);e.appendChild(i),e=e.parentNode}e.parentNode.insertBefore(t,e.parentNode.firstChild)}y=y.cloneNode(!1)}else h(e.parentNode)&&!y&&(e=e.cloneNode(!1),g.appendChild(e),p.push(e));for(xt.check.isZeroWidth(l)||n.insertBefore(l,n.firstChild),f=n,m=[];f!==g&&null!==f;)s=h(f)?null:i(f),s&&1===f.nodeType&&m.push(s),f=f.parentNode;const d=m.pop()||n;for(b=f=d;m.length>0;)f=m.pop(),b.appendChild(f),b=f;d!==n?(e.insertBefore(d,e.firstChild),n=f):n=e,xt.check.isBreak(r)&&e.appendChild(r.cloneNode(!1)),y?(y.insertBefore(e,y.firstChild),g.insertBefore(y,g.firstChild),y=null):g.insertBefore(e,g.firstChild),v=c,_=c.data.length,C=!0,n.insertBefore(v,n.firstChild)}}}(t,g),l&&!o&&!r.v)return{ancestor:t,container:s,offset:n};if(o&&=l,o)for(let t=0;t<p.length;t++){const e=p[t],i=e.childNodes;let s=null;for(;i[0];)s=i[0],g.insertBefore(s,e);xt.utils.removeItem(e),t===p.length-1&&(v=s,_=s.textContent.length)}else if(l){e=e.firstChild;for(let t=0;t<p.length;t++)Ys(p[t])}if(o||0!==g.childNodes.length){if(!l&&0===e.textContent.length)return this.nodeTransform.removeEmptyNode(g,null,!1),{ancestor:null,container:null,offset:0};this.nodeTransform.removeEmptyNode(g,e,!1),xt.check.isZeroWidth(g.textContent)?(v=g.firstChild,_=v.textContent.length):xt.check.isZeroWidth(v)&&(v=e,_=1);const i={s:0,e:0},s=xt.query.getNodePath(v,g,i);_+=i.s;const n=this.nodeTransform.mergeSameTags(g,[s],!0);t.parentNode.replaceChild(g,t),v=xt.query.getNodeFromPath(s,g),_+=n[0]}else t.childNodes?v=t.childNodes[0]:(v=xt.utils.createTextNode(Ct.zeroWidthSpace),t.appendChild(v));return{ancestor:g,container:v,offset:1===v.nodeType&&1===_?v.childNodes.length:_}},_sn_isSizeNode(t){return t&&"string"!=typeof t&&3!==t.nodeType&&this.format.isTextStyleNode(t)&&!!t.style.fontSize},_sn_getMaintainedNode(t,e,i){return!i||t?null:xt.query.getParentElement(i,this._isNonSplitNode.bind(this))||(e?null:xt.query.getParentElement(i,this._sn_isSizeNode.bind(this)))},_sn_isMaintainedNode(t,e,i){if(!i||t||1!==i.nodeType)return!1;const s=this._isNonSplitNode(i);return xt.query.getParentElement(i,this._isNonSplitNode.bind(this))?s:s||!e&&this._sn_isSizeNode(i)},_sn_setCommonListStyle(t,e){if(!xt.check.isListCell(t))return;const i=xt.utils.arrayFilter((e||t).childNodes,(t=>!xt.check.isBreak(t)));if(e=i[0],!xt.check.isElement(e)||i.length>1)return;const s=e.style,n=t.style,o=e.nodeName.toLowerCase();let l=!1;this.options.get("_defaultStyleTagMap")[o]===this.options.get("_defaultTagCommand").bold.toLowerCase()&&(n.fontWeight="bold"),this.options.get("_defaultStyleTagMap")[o]===this.options.get("_defaultTagCommand").italic.toLowerCase()&&(n.fontStyle="italic");const r=wt.getValues(s);if(r.length>0)for(let t=0,e=this._listCamel.length;t<e;t++)r.includes(this._listKebab[t])&&(n[this._listCamel[t]]=s[this._listCamel[t]],s.removeProperty(this._listKebab[t]),l=!0);if(this._sn_setCommonListStyle(t,e),l&&0===s.length){const t=e.childNodes,i=e.parentNode,s=e.nextSibling;for(;t.length>0;)i.insertBefore(t[0],s);xt.utils.removeItem(e)}},_sn_resetCommonListCell(t,e){if(!xt.check.isListCell(t))return;e||=this._listKebab;const i=xt.utils.arrayFilter(t.childNodes,(t=>!xt.check.isBreak(t))),s=t.style,n=[],o=[],l=wt.getValues(s);for(let t=0,i=this._listKebab.length;t<i;t++)l.includes(this._listKebab[t])&&e.includes(this._listKebab[t])&&(n.push(this._listCamel[t]),o.push(this._listKebab[t]));if(0===n.length)return;const r=xt.utils.createElement("SPAN");for(let t=0,e=n.length;t<e;t++)r.style[n[t]]=s[o[t]],s.removeProperty(o[t]);let a=r.cloneNode(!1),h=null,c=!1;for(let e,s,o=0,l=i.length;o<l;o++)e=i[o],this.options.get("_defaultStyleTagMap")[e.nodeName.toLowerCase()]||(s=wt.getValues(e.style),0===s.length||n.some((function(t){return!s.includes(t)}))&&s.some((function(t){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===s.length&&t.removeAttribute("style"),c},constructor:Gs};const js=Gs;function Xs(t){re.call(this,t)}function Ks(t){const e=t.parentNode;let i,s,n,o,l,r=e.parentNode,a=e;for(;xt.check.isListCell(r);){for(o=xt.query.getPositionIndex(t),i=r.nextElementSibling,s=r.parentNode,n=a;n;){if(a=a.nextSibling,xt.check.isList(n)){for(l=n.childNodes;l[o];)s.insertBefore(l[o],i);0===l.length&&xt.utils.removeItem(n)}else s.appendChild(n);n=a}r=s.parentNode}return 0===e.children.length&&xt.utils.removeItem(e),s}Xs.prototype={apply(t,e,i){const s=(t.split(":")[0]||"ol").toUpperCase(),n=t.split(":")[1]||"";let o=this.selection.getRange(),l=e||this.format.getLinesAndComponents(!1);if(0===l.length){if(e)return;if(o=this.selection.getRangeAndAddLine(o,null),l=this.format.getLinesAndComponents(!1),0===l.length)return}xt.query.sortNodeByDepth(l,!0);const r=l[0],a=l.at(-1);let h=!xt.check.isListCell(r)&&!this.component.is(r)||r.previousElementSibling?r.previousElementSibling:r.parentElement.previousElementSibling,c=!xt.check.isListCell(a)&&!this.component.is(a)||a.nextElementSibling?a.nextElementSibling:a.parentElement.nextElementSibling;const d=o.collapsed,u={sc:o.startContainer,so:o.startContainer===o.endContainer&&xt.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(!xt.check.isList(this.format.getBlock(l[t],(e=>this.format.getBlock(e)&&e!==l[t])))){g=!1;break}if(!g||h&&r.tagName===h.tagName&&s===h.tagName.toUpperCase()||c&&a.tagName===c.tagName&&s===c.tagName.toUpperCase()){const t=h?h.parentNode:h,e=c?c.parentNode:c;h=t&&!xt.check.isWysiwygFrame(t)&&t.nodeName===s?t:h,c=e&&!xt.check.isWysiwygFrame(e)&&e.nodeName===s?e:c;const i=h?.tagName===s,o=c?.tagName===s;let r=i?h:xt.utils.createElement(s,{style:"list-style-type: "+n}),a=null,d=null;const u=t=>!xt.check.isComponentContainer(t)&&!xt.check.isList(t);for(let t,e,o,h,c,p,g,m,f,b=0,y=l.length;b<y;b++)if(e=l[b],0!==e.childNodes.length||this.inline._isIgnoreNodeChange(e)){if(h=l[b+1],c=e.parentNode,p=h?h.parentNode:null,o=xt.check.isListCell(e),f=this.format.isBlock(c)?c:null,g=o&&!xt.check.isWysiwygFrame(c)?c.parentNode:c,m=o&&!xt.check.isWysiwygFrame(c)?!h||xt.check.isListCell(g)?c:c.nextSibling:e.nextSibling,t=xt.utils.createElement("LI"),this.component.is(e)){const i=/^HR$/i.test(e.nodeName);i||(t.innerHTML="<br>"),t.innerHTML+=e.outerHTML,i&&(t.innerHTML+="<br>")}else{xt.utils.copyFormatAttributes(t,e);const i=e.childNodes;for(;i[0];)t.appendChild(i[0])}r.appendChild(t),h&&g===p&&!this.format.isBlock(m)||(a||=r,i&&h&&g===p||h&&xt.check.isList(p)&&p===c||r.parentNode!==g&&g.insertBefore(r,m)),xt.utils.removeItem(e),i&&null===d&&(d=r.children.length-1),h&&(this.format.getBlock(p,u)!==this.format.getBlock(c,u)||xt.check.isList(p)&&xt.check.isList(c)&&xt.query.getNodeDepth(p)!==xt.query.getNodeDepth(c))&&(r=xt.utils.createElement(s,{style:"list-style-type: "+n})),0===f?.children.length&&xt.utils.removeItem(f)}else xt.utils.removeItem(e);d&&(a=a.children[d]),o&&(r.innerHTML+=c.innerHTML,xt.utils.removeItem(c))}else{if(i)for(let t=0,e=l.length;t<e;t++)for(let i=t-1;i>=0;i--)if(l[i].contains(l[t])){l.splice(t,1),t--,e--;break}const t=this.format.getBlock(r),e=t?.tagName===s;let o,a;const h=t=>!xt.check.isComponentContainer(t);e||(a=xt.utils.createElement(s,{style:"list-style-type: "+n}));for(let t,r,c=0,d=l.length;c<d;c++)r=this.format.getBlock(l[c],h),r&&xt.check.isList(r)&&(t?t!==r?(i&&xt.check.isListCell(r.parentNode)?this._detachNested(o.f):p=this.format.removeBlock(o.f[0].parentElement,{selectedFormats:o.f,newBlockElement:a,shouldDelete:!1,skipHistory:!0}),r=l[c].parentNode,e||(a=xt.utils.createElement(s,{style:"list-style-type: "+n})),t=r,o={r:t,f:[xt.query.getParentElement(l[c],"LI")]}):o.f.push(xt.query.getParentElement(l[c],"LI")):(t=r,o={r:t,f:[xt.query.getParentElement(l[c],"LI")]}),c===d-1&&(i&&xt.check.isListCell(r.parentNode)?this._detachNested(o.f):p=this.format.removeBlock(o.f[0].parentElement,{selectedFormats:o.f,newBlockElement:a,shouldDelete:!1,skipHistory:!0})))}return this.editor.effectNode=null,g&&d&&p||u},remove(t,e){let i={},s=!1,n=!1,o=null,l=null;const r=t=>!xt.check.isComponentContainer(t);for(let a,h,c,d,u=0,p=t.length;u<p;u++){if(c=u===p-1,h=this.format.getBlock(t[u],r),d=xt.check.isList(h),!a&&d)a=h,i={r:a,f:[xt.query.getParentElement(t[u],"LI")]},0===u&&(s=!0);else if(a&&d)if(a!==h){const r=this.format.removeBlock(i.f[0].parentNode,{selectedFormats:i.f,newBlockElement:null,shouldDelete:e,skipHistory:!0});h=t[u].parentNode,s&&(o=r.sc,s=!1),c&&(l=r.ec),d?(a=h,i={r:a,f:[xt.query.getParentElement(t[u],"LI")]},c&&(n=!0)):a=null}else i.f.push(xt.query.getParentElement(t[u],"LI")),c&&(n=!0);if(c&&xt.check.isList(a)){const t=this.format.removeBlock(i.f[0].parentNode,{selectedFormats:i.f,newBlockElement:null,shouldDelete:e,skipHistory:!0});(n||1===p)&&(l=t.ec),s&&(o=t.sc||l)}}return{sc:o,ec:l}},applyNested(t,e){const i=(t=t||this.format.getLines().filter((function(t){return xt.check.isListCell(t)}))).length;if(0===i||!e&&!xt.check.isListCell(t[0].previousElementSibling)&&!xt.check.isListCell(t.at(-1).nextElementSibling))return{sc:t[0],so:0,ec:t.at(-1),eo:1};let s=t[0].parentElement,n=t.at(-1),o=null;if(e){if(s!==n.parentElement&&xt.check.isList(n.parentElement.parentElement)&&n.nextElementSibling)for(n=n.nextElementSibling;n;)t.push(n),n=n.nextElementSibling;o=this.apply(s.nodeName+":"+s.style.listStyleType,t,!0)}else{let e=xt.utils.createElement(s.nodeName),l=t[0].previousElementSibling,r=n.nextElementSibling;const a={s:null,e:null,sl:s,el:s},{startContainer:h,startOffset:c,endContainer:d,endOffset:u}=this.selection.getRange();for(let n,o=0,h=i;o<h;o++)n=t[o],n.parentElement!==s&&(this._attachNested(s,e,l,r,a),s=n.parentElement,e=xt.utils.createElement(s.nodeName)),l=n.previousElementSibling,r=n.nextElementSibling,e.appendChild(n);if(this._attachNested(s,e,l,r,a),i>1){const t=xt.query.getNodeFromPath(a.s,a.sl),e=xt.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 i=Ks(t);let s,n,o;if(i){s=i.cloneNode(!1),n=i.childNodes;const e=xt.query.getPositionIndex(t);for(;n[e];)s.appendChild(n[e])}else s=t;if(e)o=xt.query.getListChildren(s,(t=>xt.check.isListCell(t)&&!t.previousElementSibling),null);else{const e=xt.query.getNodeDepth(t)+2;o=xt.query.getListChildren(t,(t=>xt.check.isListCell(t)&&!t.previousElementSibling&&xt.query.getNodeDepth(t)===e),null)}for(let t=0,e=o.length;t<e;t++)Ks(o[t]);return i&&(i.parentNode.insertBefore(s,i.nextSibling),0===n?.length&&xt.utils.removeItem(i)),s===t?s.parentNode:s},_attachNested(t,e,i,s,n){let o=!1;if(e.tagName===i?.tagName){const t=e.children;for(;t[0];)i.appendChild(t[0]);e=i,o=!0}if(e.tagName===s?.tagName){const t=s.children;for(;t[0];)e.appendChild(t[0]);const i=s.nextElementSibling;s.parentNode.removeChild(s),s=i}if(!o){xt.check.isListCell(i)&&(t=i,s=null),t.insertBefore(e,s),n.s||(n.s=xt.query.getNodePath(e.firstElementChild.firstChild,t,null),n.sl=t);const o=t.contains(n.sl)?xt.query.getNodePath(n.sl,t):null;n.e=xt.query.getNodePath(e.lastElementChild.firstChild,t,null),n.el=t,this.nodeTransform.mergeSameTags(t,[n.s,n.e,o],!1),this.nodeTransform.mergeNestedTags(t),o&&(n.sl=xt.query.getNodeFromPath(o,t))}return e},_detachNested(t){const e=t[0],i=t.at(-1),s=i.nextElementSibling,n=e.parentElement,o=n.parentElement.nextElementSibling,l=n.parentElement.parentElement;for(let e=0,i=t.length;e<i;e++)l.insertBefore(t[e],o);if(s&&n.children.length>0){const t=n.cloneNode(!1),e=n.childNodes,o=xt.query.getPositionIndex(s);for(;e[o];)t.appendChild(e[o]);i.appendChild(t)}0===n.children.length&&xt.utils.removeItem(n),this.nodeTransform.mergeSameTags(l);const r=xt.query.getEdgeChildNodes(e,i);return{cc:e.parentNode,sc:r.sc,ec:r.ec}},constructor:Xs};const Js=Xs;function Qs(t){re.call(this,t),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._dropdownCommands=[],this.__globalEventHandler={mousedown:tn.bind(this),containerDown:this.containerOff.bind(this),keydown:sn.bind(this),mousemove:nn.bind(this),mouseout:en.bind(this)},this._bindClose_dropdown_mouse=null,this._bindClose_dropdown_key=null,this._bindClose_cons_mouse=null,this.currentDropdownPlugin=null,this.__menuBtn=null,this.__menuContainer=null}function tn(t){const e=xt.query.getEventTarget(t);xt.query.getParentElement(e,".se-dropdown")||this.dropdownOff()}function en(){this.index=-1}function sn(t){switch(t.code){case"ArrowUp":case"ArrowLeft":t.preventDefault(),t.stopPropagation(),this._moveItem(-1);break;case"ArrowDown":case"ArrowRight":t.preventDefault(),t.stopPropagation(),this._moveItem(1);break;case"Enter":case"Space":{if(this.index<0)break;const e=this.menus[this.index];if(!e||"function"!=typeof this.plugins[this.currentDropdownName].action)return;t.preventDefault(),t.stopPropagation(),this.plugins[this.currentDropdownName].action(e),this.dropdownOff();break}}}function nn(t){xt.utils.addClass(this.currentDropdown,"se-select-menu-mouse-move"),xt.utils.removeClass(this.currentDropdown,"se-select-menu-key-action");const e=this.menus.indexOf(t.target);-1!==e&&(this.index=1*e)}function on(t){return/free$/.test(t)}Qs.prototype={initDropdownTarget({key:t,type:e},i){if(!t)throw Error("[SUNEDITOR.init.fail] The plugin's key is not added.");on(e)||(i.setAttribute("data-key",t),this._dropdownCommands.push(t)),this.context.get("menuTray").appendChild(i),this.targetMap[t]=i},dropdownOn(t){this.__removeGlobalEvent();const e=this._checkMoreLayer(t);if(e){const i=xt.query.getParentElement(e,".se-btn-tray").querySelector('[data-command="'+e.getAttribute("data-ref")+'"]');if(i)return this.editor.runFromTarget(i),void this.dropdownOn(t)}const i=this.currentButton=t,s=this.currentDropdownName=i.getAttribute("data-command");this.currentDropdownType=i.getAttribute("data-type");const n=this.currentDropdown=this.targetMap[s];this.currentDropdownActiveButton=i,this._setMenuPosition(i,n),this._bindClose_dropdown_mouse=this.eventManager.addGlobalEvent("mousedown",this.__globalEventHandler.mousedown,!1),this._dropdownCommands.includes(s)&&(this.menus=wt.nodeListToArray(n.querySelectorAll("[data-command]")),this.menus.length>0&&(this._bindClose_dropdown_key=this.eventManager.addGlobalEvent("keydown",this.__globalEventHandler.keydown,!1),n.addEventListener("mousemove",this.__globalEventHandler.mousemove,!1),n.addEventListener("mouseout",this.__globalEventHandler.mouseout,!1))),this.currentDropdownPlugin=this.plugins[s],this.currentDropdownPlugin?.on(i),this.editor._preventBlur=!0},dropdownOff(){this.__removeGlobalEvent(),on(this.currentDropdownType)&&this.currentDropdownPlugin?.off?.(),this.index=-1,this.menus=[],this.__menuBtn=null,this.__menuContainer=null,this.currentButton=null,this.currentDropdown&&(this.currentDropdownName="",this.currentDropdownType="",this.currentDropdown.style.display="none",this.currentDropdown=null,this.currentDropdownActiveButton&&xt.utils.removeClass(this.currentDropdownActiveButton.parentElement.children,"on"),this.currentDropdownActiveButton=null,this.editor._notHideToolbar=!1),this.editor._preventBlur=!1,this.currentDropdownPlugin=null},dropdownShow(){this.currentButton&&this.dropdownOn(this.currentButton)},dropdownHide(){this.currentDropdown&&(this.currentDropdown.style.display="none")},containerOn(t){this.__removeGlobalEvent(),this.currentContainerActiveButton=t;const e=this.currentContainerName=this.currentContainerActiveButton.getAttribute("data-command");this._setMenuPosition(t,this.currentContainer=this.targetMap[e]),this._bindClose_cons_mouse=this.eventManager.addGlobalEvent("mousedown",this.__globalEventHandler.containerDown,!1),this.plugins[e].on&&this.plugins[e].on(t),this.editor._preventBlur=!0},containerOff(){this.__removeGlobalEvent(),this.currentContainer&&(this.currentContainerName="",this.currentContainer.style.display="none",this.currentContainer=null,xt.utils.removeClass(this.currentContainerActiveButton,"on"),this.currentContainerActiveButton=null,this.editor._notHideToolbar=!1),this.editor._preventBlur=!1},_setMenuPosition(t,e){e.style.visibility="hidden",e.style.display="block",e.style.height="",xt.utils.addClass(t.parentElement.children,"on"),this.offset.setRelPosition(e,this.carrierWrapper,t.parentElement,xt.query.getParentElement(t,".se-toolbar")),e.style.visibility="",this.__menuBtn=t,this.__menuContainer=e},_resetMenuPosition(t,e){this.offset.setRelPosition(e,this.carrierWrapper,t.parentElement,xt.query.getParentElement(t,".se-toolbar"))},_restoreMenuPosition(){this.__menuBtn&&this.__menuContainer&&this._setMenuPosition(this.__menuBtn,this.__menuContainer)},_checkMoreLayer(t){const e=xt.query.getParentElement(t,".se-more-layer");return e&&"block"!==e.style.display&&e.getAttribute("data-ref")?e:null},_moveItem(t){xt.utils.removeClass(this.currentDropdown,"se-select-menu-mouse-move"),xt.utils.addClass(this.currentDropdown,"se-select-menu-key-action"),t=this.index+t;const e=this.menus.length,i=this.index=t>=e?0:t<0?e-1:t;for(let t=0;t<e;t++)t===i?xt.utils.addClass(this.menus[t],"on"):xt.utils.removeClass(this.menus[t],"on")},__removeGlobalEvent(){this._bindClose_dropdown_mouse&&=this.eventManager.removeGlobalEvent(this._bindClose_dropdown_mouse),this._bindClose_cons_mouse&&=this.eventManager.removeGlobalEvent(this._bindClose_cons_mouse),this._bindClose_dropdown_key&&(this._bindClose_dropdown_key=this.eventManager.removeGlobalEvent(this._bindClose_dropdown_key),xt.utils.removeClass(this.menus,"on"),xt.utils.removeClass(this.currentDropdown,"se-select-menu-key-action|se-select-menu-mouse-move"),this.currentDropdown.removeEventListener("mousemove",this.__globalEventHandler.mousemove,!1),this.currentDropdown.removeEventListener("mouseout",this.__globalEventHandler.mouseout,!1))},constructor:Qs};const ln=Qs;function rn(t){re.call(this,t)}rn.prototype={split(t,e,i){if(xt.check.isWysiwygFrame(t)||this.component.is(t)||!t)return t;if(e&&!kt.is(e)){const i=t.childNodes;let s=xt.query.getPositionIndex(e);const n=t.cloneNode(!1),o=t.cloneNode(!1);for(let t=0,e=i.length;t<e;t++){if(t<s)n.appendChild(i[t]);else{if(!(t>s))continue;o.appendChild(i[t])}t--,e--,s--}return n.childNodes.length>0&&t.parentNode.insertBefore(n,t),o.childNodes.length>0&&t.parentNode.insertBefore(o,t.nextElementSibling),t}const s=t.parentNode;let n,o,l,r=0,a=1,h=!0;if((!i||i<0)&&(i=0),xt.check.isText(t)){if(r=xt.query.getPositionIndex(t),(e=Number(e))>=0&&t.length!==e){t.splitText(e);const i=xt.query.getNodeFromPath([r+1],s);xt.check.isZeroWidth(i)&&(i.data=Ct.zeroWidthSpace)}}else if(1===t.nodeType){if(0===e){for(;t.firstChild;)t=t.firstChild;if(3===t.nodeType){const e=xt.utils.createTextNode(Ct.zeroWidthSpace);t.parentNode.insertBefore(e,t),t=e}}t.previousSibling?t=t.previousSibling:xt.query.getNodeDepth(t)===i&&(h=!1)}1===t.nodeType&&(a=0);let c=t;for(;xt.query.getNodeDepth(c)>i;)for(r=xt.query.getPositionIndex(c)+a,c=c.parentNode,l=n,n=c.cloneNode(!1),o=c.childNodes,l&&(xt.check.isListCell(n)&&xt.check.isList(l)&&l.firstElementChild?(n.innerHTML=l.firstElementChild.innerHTML,xt.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,xt.check.isList),n.childNodes.length>0?d.insertBefore(n,c):n=c,xt.check.isListCell(n)&&n.children&&xt.check.isList(n.children[0])&&n.insertBefore(xt.utils.createElement("BR"),n.children[0]),0===s.childNodes.length&&xt.utils.removeItem(s),n):c},mergeSameTags(t,e,i){const s=this,n=e?e.length:0;let o=null;return n&&(o=Array.apply(null,new Array(n)).map(Number.prototype.valueOf,0)),function t(l,r,a){const h=l.childNodes;for(let c,d,u=0,p=h.length;u<p&&(c=h[u],d=h[u+1],c);u++)if(!(xt.check.isBreak(c)||xt.check.isMedia(c)||xt.check.isInputElement(c)))if(i&&s.inline._isIgnoreNodeChange(c)||!i&&(xt.check.isTableElements(c)||xt.check.isListCell(c)||s.format.isLine(c)&&!s.format.isBrLine(c)))(xt.check.isTableElements(c)||xt.check.isListCell(c))&&t(c,r+1,u);else{if(1===p&&l.nodeName===c.nodeName&&l.parentNode){if(n){let t,i,s,o,a;for(let h=0;h<n;h++)if(t=e[h],t&&t[r]===u){for(i=c,s=l,o=r,a=!0;o>=0;){if(xt.utils.getArrayIndex(s.childNodes,i)!==t[o]){a=!1;break}i=c.parentNode,s=i.parentNode,o--}a&&(t.splice(r,1),t[r]=u)}}xt.utils.copyTagAttributes(c,l),l.parentNode.insertBefore(c,l),xt.utils.removeItem(l)}if(!d){1===c.nodeType&&t(c,r+1,u);break}if(c.nodeName===d.nodeName&&xt.check.isSameAttributes(c,d)&&c.getAttribute?.("href")===d.getAttribute?.("href")){const t=c.childNodes;let i=0;for(let e=0,s=t.length;e<s;e++)t[e].textContent.length>0&&i++;const s=c.lastChild,l=d.firstChild;let h=0;if(s&&l){const t=3===s.nodeType&&3===l.nodeType;h=s.textContent.length;let c=s.previousSibling;for(;c&&3===c.nodeType;)h+=c.textContent.length,c=c.previousSibling;if(i>0&&3===s.nodeType&&3===l.nodeType&&(s.textContent.length>0||l.textContent.length>0)&&i--,n){let c=null;for(let d=0;d<n;d++)if(c=e[d],c&&c[r]>u){if(r>0&&c[r-1]!==a)continue;c[r]-=1,c[r+1]>=0&&c[r]===u&&(c[r+1]+=i,t&&s&&3===s.nodeType&&l&&3===l.nodeType&&(o[d]+=h))}}}if(3===c.nodeType){if(h=c.textContent.length,c.textContent+=d.textContent,n){let t=null;for(let s=0;s<n;s++)if(t=e[s],t&&t[r]>u){if(r>0&&t[r-1]!==a)continue;t[r]-=1,t[r+1]>=0&&t[r]===u&&(t[r+1]+=i,o[s]+=h)}}}else c.innerHTML+=d.innerHTML;xt.utils.removeItem(d),u--}else 1===c.nodeType&&t(c,r+1,u)}}(t,0,0),o},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(i){let s=i.children;if(1===s.length&&s[0].nodeName===i.nodeName&&e(i)){const t=s[0];for(s=t.children;s[0];)i.appendChild(s[0]);i.removeChild(t)}for(let e=0,s=i.children.length;e<s;e++)t(i.children[e])}(t)},removeAllParents(t,e,i){if(!t)return null;let s=null;return e||=t=>{if(t===i||this.component.is(t))return!1;const e=t.textContent.trim();return 0===e.length||/^(\n|\u200B)+$/.test(e)},function t(i){if(!xt.check.isWysiwygFrame(i)){const n=i.parentNode;n&&e(i)&&(s={sc:i.previousElementSibling,ec:i.nextElementSibling},xt.utils.removeItem(i),t(n))}}(t),s},removeEmptyNode(t,e,i){const s=this,n=this.options.get("allowedEmptyTags");e&&=xt.query.getParentElement(e,(e=>t===e.parentElement)),function i(o){if(s.format._notTextNode(o)||o===e||xt.check.isNonEditable(o))return 0;if(o===t||!xt.check.isZeroWidth(o.textContent)||o.firstChild&&xt.check.isBreak(o.firstChild)||o.querySelector(n)){const t=o.children;for(let e=0,n=t.length,o=0;e<n;e++)t[e+o]&&!s.component.is(t[e+o])&&(o+=i(t[e+o]))}else if(o.parentNode)return o.parentNode.removeChild(o),-1;return 0}(t),0===t.childNodes.length&&(i?xt.utils.removeItem(t):t.innerHTML="<br>")},createNestedNode(t,e){"function"!=typeof e&&(e=()=>!0);const i=t[0].cloneNode(!1);let s=i;for(let i,n=1,o=t.length;n<o;n++)e(t[n])&&(i=t[n].cloneNode(!1),s.appendChild(i),s=i);return s.innerHTML="",{parent:i,inner:s}},constructor:rn};const an=rn;function hn(t){re.call(this,t)}hn.prototype={get(t){const e=this.frameContext.get("wysiwygFrame"),i=/iframe/i.test(e?.nodeName),s=this.getLocal(t);return{left:s.left+(i?e.parentElement.offsetLeft:0),top:s.top+(i?e.parentElement.offsetTop:0)}},getLocal(t){const e=t;let i=0,s=0,n=0,o=0,l=0,r=3===e.nodeType?e.parentElement:e;const a=e.offsetWidth,h=lt(e,D.bind(this)),c=r;for(;r&&!X(r,"se-wrapper")&&r!==h;)i+=r.offsetLeft-(c!==r?r.scrollLeft:0),s+=r.offsetTop+(c!==r?r.scrollTop:0),r=r.offsetParent;const d=this.frameContext.get("wysiwygFrame");this.frameContext.get("wysiwyg").contains(e)&&(n=d.offsetLeft,o=d.offsetTop,l=d.parentElement.offsetWidth-(d.offsetLeft+d.offsetWidth));const u=this.frameContext.get("eventWysiwyg");return i+=n-(h?h.scrollLeft:0),s+=o-(h?h.scrollTop:0),{left:i,top:s,right:r?.offsetWidth?r.offsetWidth-(i-n+a)+l:0,scrollX:u.scrollLeft||u.scrollX||0,scrollY:u.scrollTop||u.scrollY||0,scrollH:this.frameContext.get("wysiwyg").scrollHeight||0}},getGlobal(t){const e=this.frameContext.get("topArea"),i=this.frameContext.get("wysiwygFrame");if(t||=e,!R(t))return{top:0,left:0,fixedTop:0,fixedLeft:0,width:0,height:0};const s=t,o=s.getBoundingClientRect();let l=o.top,r=o.left;if(/^iframe$/i.test(i.nodeName)&&i.contentDocument.contains(s)){const t=i.getBoundingClientRect();l+=t.top,r+=t.left}let a=0,h=0;return this.frameContext.get("isFullScreen")||(a+=n.scrollY,h+=n.scrollX),{top:l+a,left:r+h,fixedTop:l,fixedLeft:r,width:s.offsetWidth,height:s.offsetHeight}},getGlobalScroll(t){const e=this.frameContext.get("topArea");let i=!1,s=!1;t||=e,t===e&&(i=!0),!i&&R(t)&&(s="absolute"===n.getComputedStyle(t).position);let o=0,l=0,r=0,a=0,h=0,c=0,d=0,u=0,p=null,g=null,m=null,f=null,b=t;for(;b;)o+=b.scrollTop,l+=b.scrollLeft,r+=b.scrollHeight,a+=b.scrollWidth,b.scrollTop>0&&(c+=b.offsetTop),b.scrollHeight>=b.clientHeight&&(d=/^html$/i.test(b.nodeName)?d||b.clientHeight:b.clientHeight+(m?-m.clientTop:0),p=m||p||b,m=b),b.scrollLeft>0&&(h+=b.offsetLeft),b.scrollWidth>=b.clientWidth&&(u=/^html$/i.test(b.nodeName)?u||b.clientWidth:b.clientWidth+(f?-f.clientLeft:0),g=f||g||b,f=b),b=b.parentElement;if(!s&&!i&&/^iframe$/i.test(this.frameContext.get("wysiwygFrame").nodeName))for(b=this.frameContext.get("wrapper"),p=g=e;b;)o+=b.scrollTop,l+=b.scrollLeft,r+=b.scrollHeight,a+=b.scrollWidth,b.scrollTop>0&&(c+=b.offsetTop),b.scrollHeight>=b.clientHeight&&(d=/^html$/i.test(b.nodeName)?d||b.clientHeight:b.clientHeight+(m?-m.clientTop:0),m=b),b.scrollLeft>0&&(h+=b.offsetLeft),b.scrollWidth>=b.clientWidth&&(u=/^html$/i.test(b.nodeName)?u||b.clientWidth:b.clientWidth+(f?-f.clientLeft:0),f=b),b=b.parentElement;for(b=this.editor._shadowRoot?.host,b&&(p=g=e);b;)o+=b.scrollTop,l+=b.scrollLeft,r+=b.scrollHeight,a+=b.scrollWidth,b.scrollTop>0&&(c+=b.offsetTop),b.scrollHeight>=b.clientHeight&&(d=/^html$/i.test(b.nodeName)?d||b.clientHeight:b.clientHeight+(m?-m.clientTop:0),m=b),b.scrollLeft>0&&(h+=b.offsetLeft),b.scrollWidth>=b.clientWidth&&(u=/^html$/i.test(b.nodeName)?u||b.clientWidth:b.clientWidth+(f?-f.clientLeft:0),f=b),b=b.parentElement;const y=e.contains(p),v=e.contains(g);p=y?e:p,g=v?e:g;const _=p?p.getBoundingClientRect().top+(!p.parentElement||/^html$/i.test(p.parentElement.nodeName)?n.scrollY:0):0,C=g?g.getBoundingClientRect().left+(!g.parentElement||/^html$/i.test(g.parentElement.nodeName)?n.scrollX:0):0;d=y?e.clientHeight:d,u=v?e.clientWidth:u;const w=Q(this.frameContext.get("_wd"));return{top:o,left:l,ts:_,ls:C,width:a,height:r,x:h,y:c,ohOffsetEl:s?window:p,owOffsetEl:s?window:g,oh:s?w.h:d,ow:s?w.w:u,heightEditorRefer:y,widthEditorRefer:v}},getWWScroll(){const t=this.frameContext.get("wysiwyg"),e=t.scrollTop||t.scrollY||0,i=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:i,bottom:e+i}},setRelPosition(t,e,i,s){const l=/^fixed$/i.test(n.getComputedStyle(s).position),r=this.getGlobal(i);if(l)t.style.position="fixed",t.style.top=`${r.fixedTop+r.height}px`;else{t.style.position="";const n=s.contains(t)?this.getGlobal(e).top:0,l=t.offsetHeight,a=this.getGlobalScroll().top,h=r.top,c=Q(o).h-(n-a+h+i.offsetHeight);if(c<l){let e=-1*(l-h+3);const s=n-a+e,o=l+(s<0?s:0);o>c?(t.style.height=`${o}px`,e=-1*(o-h+3)):(t.style.height=`${c}px`,e=h+i.offsetHeight),t.style.top=`${e}px`}else t.style.top=`${h+i.offsetHeight}px`}const a=t.offsetWidth,h=i.offsetWidth,c=r.left,d=this.getGlobal(s).left;if(this.options.get("_rtl")){const e=a>h?a-h:0,i=e>0?0:h-a;t.style.left=`${c-e+i}px`,d>this.getGlobal(t).left&&(t.style.left=d+"px")}else{const e=s.offsetWidth+d,i=e<=a?0:e-(c+a);t.style.left=i<0?`${c+i}px`:`${c}px`}},setAbsPosition(t,e,i){const s={left:0,top:0,...i.addOffset},l=i.position||"bottom",r=i.inst,a=!this.options.get("_rtl");a||(s.left*=-1);const h=this.frameOptions.get("iframe"),c=this.frameContext.get("wrapper").contains(e)||i.isWWTarget||!!h&&this.frameContext.get("wysiwyg").contains(e),d=Boolean(lt(e,".se-toolbar")),u=1===e.nodeType,p=c&&!u,g=u&&/inline/.test(n.getComputedStyle(e).display),m=Q(o),f=p?this.getWWScroll():this._getWindowScroll(),b=!c||!h&&u?e.getBoundingClientRect():this.selection.getRects(e,"start").rects,y=this.getGlobal(e),v=X(t.firstElementChild,"se-arrow")?t.firstElementChild:null,_=i.sibling?.offsetHeight||0,C=v?v.offsetHeight:0,w=t.offsetHeight,x=e.offsetHeight,k=b.top,E=m.h-b.bottom,S=this.getGlobal(this.frameContext.get("topArea")).top,T=n.scrollY,H=this.context.get("toolbar_main").offsetHeight,L=this.options.get("toolbar_container"),M=this.editor.isBalloon||this.editor.isInline||L,N=L&&S-T-H>0||!this.toolbar.isSticky&&M?0:H+(this.toolbar.isSticky?this.options.get("toolbar_sticky"):0),A=this.frameContext.get("statusbar")?.offsetHeight||0,{rmt:B,rmb:V,bMargin:I,rt:O}=this._getVMargin(k,E,N,m,b,p,d);if(c&&(V-A+x<=0||B+O+x-(this.toolbar.isSticky&&g?N:0)<=0)||B+x<0)return;const R=this.toolbar.isSticky&&"none"!==this.context.get("toolbar_main").style.display&&(!M||this.frameContext.get("topArea").getBoundingClientRect().top<=H);let F=s.top,z=0,$="";"bottom"===l?($="up",F+=b.bottom+C+T,z=V-(w+C),z-_<0&&($="down",F-=x+w+2*C,z=B-(w+C),z-_<0&&($="",F-=z-_-Math.max(1,z+w+C)))):($="down",F+=b.top-w-C+T,z=(R?b.top-N:B)-w-C,z-_<0&&($="up",F+=x+w+2*C,z=(V>0?I:V)-(w+C)-A,z-_<0&&($="",F+=z-2))),this._setArrow(v,$),t.style.top=`${F}px`;const P=(1===t.nodeType?kt.get(n.getComputedStyle(t).borderRadius):0)||0,D=y.width,q=t.offsetWidth,W=v?v.offsetWidth:0,U=b.left,Z=m.w-b.right;let G,Y;if(this.frameContext.get("isFullScreen")?(G=U,Y=Z):(G=b.left,Y=m.w-b.right),c&&(G+D<=0||Y+D<=0))return;v&&(v.style.left="",v.style.right="");let j=s.left,K=0,J=0,tt=0;return a?(j+=b.left+n.scrollX-(G<0?G:0),K=D+G,K<W&&(tt=W/2-1+(P<=2?0:P-2),J=tt),K=D+Y-q,K<0&&(j+=K,tt=q-1-(W/2+(P<=2?0:P-2)),J=-(K-W/2),J=J>tt?tt:J),v&&J>0&&(v.style.left=J+"px")):(j+=b.right-q+n.scrollX+(Y<0?Y:0),K=D+Y,K<W&&(tt=W/2-1+(P<=2?0:P-2),J=tt),K=D+G-q,K<0&&(j-=K,tt=W/2-1+(P<=2?0:P-2),J=-(K-W/2),J=J<tt?tt:J>q-tt?q-tt:J),v&&J>0&&(v.style.right=J+"px")),t.style.left=`${j}px`,r.__offset={left:t.offsetLeft+f.left,top:t.offsetTop+f.top,addOffset:s},{position:"up"===$?"bottom":"top"}},setRangePosition(t,e,{position:i,addTop:s}={}){t.style.top="-10000px",t.style.visibility="hidden",t.style.display="block";let n="top"===i;e||=this.selection.getRange();const l=this.selection.getRects(e,n?"start":"end");n="start"===l.position;const r=this.frameContext.get("isFullScreen"),a=this.frameContext.get("topArea"),h=l.rects,c=r?0:l.scrollLeft,d=r?0:l.scrollTop,u=a.offsetWidth,p=this.getGlobal(a),g=p.left,m=t.offsetWidth,f=t.offsetHeight;this._setOffsetOnRange(n,h,t,g,u,c,d,s),this.getGlobal(t).top-p.top<0&&(n=!n,this._setOffsetOnRange(n,h,t,g,u,c,d,s)),m===t.offsetWidth&&f===t.offsetHeight||this._setOffsetOnRange(n,h,t,g,u,c,d,s);const b=!this.carrierWrapper.contains(t),y=Q(o),v=h.height,_=h.top,C=y.h-h.bottom,w=this.toolbar.isSticky||!this.editor.isBalloon&&!this.editor.isInline?this.context.get("toolbar_main").offsetHeight:0,{rmt:x,rmb:k,rt:E}=this._getVMargin(_,C,w,y,h,b,!1);if(!(k+v<=0||x+E+v<=0))return t.style.visibility="",!0},_setOffsetOnRange(t,e,i,s,n,l,r,a=0){const h=i.querySelector(".se-arrow "),c=Math.round(h.offsetWidth/2),d=i.offsetWidth,u=e.noText&&!t?0:i.offsetHeight,p=(t?e.left:e.right)-s-d/2+l,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 b=!1;const y=m+(t?this.getGlobal(this.frameContext.get("topArea")).top:i.offsetHeight-this.frameContext.get("wysiwyg").offsetHeight);!t&&y>0&&this._getPageBottomSpace()<y?(t=!0,b=!0):t&&o.documentElement.offsetTop>y&&(t=!1,b=!0),b&&(m=(t?e.top-u-c:e.bottom+c)-(e.noText?0:a)+r),i.style.left=Math.floor(f)+"px",i.style.top=Math.floor(m)+"px",t?(J(h,"se-arrow-up"),K(h,"se-arrow-down")):(J(h,"se-arrow-down"),K(h,"se-arrow-up"));const v=Math.floor(d/2+(p-f));h.style.left=(v+c>i.offsetWidth?i.offsetWidth-c:v<c?c:v)+"px"},_getPageBottomSpace(){const t=this.frameContext.get("topArea");return o.documentElement.scrollHeight-(this.getGlobal(t).top+t.offsetHeight)},_getVMargin(t,e,i,s,o,l,r){const a=this.selection.getRects(this.frameContext.get("wysiwyg"),"start").rects;let h=0,c=0,d=0,u=0,p=0;if(this.frameContext.get("isFullScreen"))h=t-i,c=e;else{const t=this.frameOptions.get("iframe");u=o.top,p=s.h-o.bottom;const e=this.getGlobal();if(l){d=r||this.toolbar.isSticky||this.options.get("toolbar_container")?0:i;const s=t?0:e.top-n.scrollY+d,l=t?0:this.status.currentViewportHeight-(e.top+e.height-n.scrollY);let u=s;i>s?u=this.toolbar.isSticky?i:s+i:this.options.get("toolbar_container")&&!this.toolbar.isSticky?i=0:u=s+i,h=o.top-a.top-u+i,c=a.bottom-o.bottom-l,h=h>0?h:h-i}else{const t=e.fixedTop>0?e.fixedTop:0,s=n.innerHeight-(e.fixedTop+e.height);d=r||!this.toolbar.isSticky&&this.toolbar._isBalloon?0:i,h=u-(r?0:t)-d,c=p-(s>0?s:0)}}return{rmt:h,rmb:c,rt:d,tMargin:u,bMargin:p}},_setArrow(t,e){"up"===e?(t&&(t.style.visibility=""),K(t,"se-arrow-up"),J(t,"se-arrow-down")):"down"===e?(t&&(t.style.visibility=""),K(t,"se-arrow-down"),J(t,"se-arrow-up")):t&&(t.style.visibility="hidden")},_getWindowScroll(){const t=Q(o);return{top:n.scrollY,left:n.scrollX,width:t.w,height:t.h,bottom:n.scrollY+t.h,rects:{left:0,top:0,right:n.innerWidth,bottom:this.status.currentViewportHeight||n.innerHeight,noText:!0}}},constructor:hn};const cn=hn,{_w:dn}=_t;function un(t){re.call(this,t),this.range=null,this.selectionNode=null,this.__iframeFocus=!1,this.__hasScrollParents=!1,this._scrollMargin=0}un.prototype={get(){let t=null;return t="function"==typeof this.editor._shadowRoot?.getSelection?this.editor._shadowRoot.getSelection():this.frameContext.get("_ww").getSelection(),t?(this.status._range||this.frameContext.get("wysiwyg").contains(t.focusNode)||(t.removeAllRanges(),t.addRange(this._createDefaultRange())),t):null},isRange(t){return this.instanceCheck.isRange(t)},getRange(){const t=this.status._range||this._createDefaultRange(),e=this.get();if(t.collapsed===e.isCollapsed||!this.frameContext.get("wysiwyg").contains(e.focusNode)){if(this.component.is(t.startContainer)){const e=this.component.get(t.startContainer),i=e?.container;return i?this.setRange(i,0,i,1):t}return t}if(e.rangeCount>0)return this.status._range=e.getRangeAt(0),this.status._range;{const t=e.anchorNode,i=e.focusNode,s=e.anchorOffset,n=e.focusOffset,o=xt.query.compareElements(t,i),l=o.ancestor&&(0===o.result?s<=n:o.result>1);return this.setRange(l?t:i,l?s:n,l?i:t,l?n:s)}},setRange(t,e,i,s){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=i,r=s;if(!n||!l)return;(xt.check.isBreak(n)||3===n.nodeType)&&o>n.textContent.length&&(o=n.textContent.length),(xt.check.isBreak(l)||3===l.nodeType)&&r>l.textContent.length&&(r=l.textContent.length),this.format.isLine(n)&&(n=n.childNodes[o>0?n.childNodes.length-1:0]||n,o=o>0?1!==n.nodeType||xt.check.isBreak(n)?n.textContent?n.textContent.length:0:1:0),this.format.isLine(l)&&(l=l.childNodes[r>0?l.childNodes.length-1:0]||l,r=r>0?1!==l.nodeType||xt.check.isBreak(l)?l.textContent?l.textContent.length:0:1:0);const a=this.frameContext.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.status.hasFocus=!0}catch(t){return console.warn("[SUNEDITOR.selection.focus.warn]",t.message),void this.editor._nativeFocus()}const h=this.get();return h.removeAllRanges&&h.removeAllRanges(),h.addRange(a),this.status._range=a,this._rangeInfo(a,this.get()),this.frameOptions.get("iframe")&&this.__focus(),a},removeRange(){this.status._range=null,this.selectionNode=null,this.editor.effectNode=null,this.status.hasFocus&&this.get().removeAllRanges(),this.eventManager._setKeyEffect([])},getNearRange(t){const e=t.nextSibling,i=t.previousSibling;return e?{container:e,offset:0}:i?{container:i,offset:1}:null},getRangeAndAddLine(t,e){if(this._isNone(t)){const i=e?.parentElement||this.frameContext.get("wysiwyg"),s=xt.utils.createElement(this.options.get("defaultLine"),null,"<br>");i.insertBefore(s,e&&e!==i?e.previousElementSibling?e.nextElementSibling:e:i.firstElementChild),this.setRange(s.firstElementChild,0,s.firstElementChild,1),t=this.status._range}return t},getNode(){if(this.frameContext.get("wysiwyg").contains(this.selectionNode)||this._init(),!this.selectionNode){const t=xt.query.getEdgeChild(this.frameContext.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 i=!!xt.check.isElement(t)&&"absolute"===dn.getComputedStyle(t).position;t=!t||xt.check.isText(t)?this.getRange():t;const s=this.offset.getGlobalScroll();let n="start"===e,o=s.left,l=s.top,r=t.getClientRects();if(r=r[n?0:r.length-1],!r){const t=this.getNode();if(this.format.isLine(t)){const t=xt.utils.createTextNode(Ct.zeroWidthSpace);this.html.insertNode(t,{afterNode:null,skipCharCount:!0}),this.setRange(t,1,t,1),this._init(),r=this.getRange().getClientRects(),r=r[n?0:r.length-1]}if(!r){const e=this.offset.get(t);r={left:e.left,top:e.top,right:e.left+t.offsetWidth,bottom:e.top+t.offsetHeight,noText:!0},o=0,l=0}n=!0}const a=/^iframe$/i.test(this.frameContext.get("wysiwygFrame").nodeName)?this.frameContext.get("wysiwygFrame").getClientRects()[0]:null;return!i&&a&&(r={left:r.left+a.left,top:r.top+a.top,right:r.right+a.right-a.width,bottom:r.bottom+a.bottom-a.height}),{rects:r,position:n?"start":"end",scrollLeft:o,scrollTop:l}},getDragEventLocationRange(t){const e=this.frameContext.get("_wd");let i,s,n,o,l;return e.caretPositionFromPoint?(i=e.caretPositionFromPoint(t.clientX,t.clientY),s=i.offsetNode,n=i.offset,o=i.offsetNode,l=i.offset):e.caretRangeFromPoint&&(i=e.caretRangeFromPoint(t.clientX,t.clientY),s=i.startContainer,n=i.startOffset,o=i.endContainer,l=i.endOffset),{sc:s,so:n,ec:o,eo:l}},scrollTo(t,e){this.instanceCheck.isSelection(t)?t=t.getRangeAt(0):this.instanceCheck.isNode(t)?t=this.setRange(t,1,t,1):void 0===t?.startContainer&&console.warn('[SUNEDITOR.html.scrollTo.warn] "selectionRange" must be Selection or Range or Node object.',t),e={behavior:"smooth",block:"nearest",inline:"nearest",...e};const i=xt.query.getParentElement(t.startContainer,(t=>1===t.nodeType)),{frameContext:s,frameOptions:n}=this.editor,o=s.get("_ww"),l=s.get("wysiwygFrame"),r=n.get("iframe"),a=!this.status.isScrollable(),h=this.status.currentViewportHeight,c=a?dn.scrollY:r?o.scrollY:l.scrollTop,d=this.context.get("toolbar_main").offsetHeight,u=this.toolbar.isSticky?d:0,p=this.toolbar.isSticky?u+this.options.get("toolbar_sticky"):u,g=s.get("statusbar")?.offsetHeight||0;if(this.__hasScrollParents)return i?.scrollIntoView(e),void("auto"===e?.behavior&&c!==dn.scrollY&&(p&&c>dn.scrollY?dn.scrollBy(0,-p):a&&dn.scrollBy(0,g)));const m=this._scrollMargin,f=a?h:l.offsetHeight,b=i.offsetHeight||0,y=e?.behavior;if(a)if(r){const e=this.getRects(t,"end").rects,i=e.top+b-p,s=f-m-(e.top+b);if(i>=0&&s>=0)return;const n=c-(i<0?-(i-m):s);dn.scrollTo({top:n<c?n-p:n,behavior:y})}else{const t=f+c-this.offset.getGlobal(i).top-b;if(t-m>0&&f>t+m+p)return;const e=t<=m?c-t+m+g:c-t+(f-b-m);dn.scrollTo({top:e<c?e-p:e,behavior:y})}else{const{rects:t}=this.getRects(i,"start"),{top:e}=this.offset.getLocal(i),s=e<0&&t.top<0?e:t.top,n=s-m>0&&s+m<=f;let a=c+(s-m>0?s+m-f:s-(u+b));const p=dn.scrollY,v=this.offset.getGlobal(),_=p-v.top+d,C=v.top+v.height-(p+h)+d;if(_>0){const t=(n?s:s+c-a)-b-m-_;t<0&&(a+=d,dn.scrollTo({top:p+t,behavior:"smooth"}))}if(C>0){const t=(n?s:s+c-a)+b+m-(v.height-C);t>0&&(a+=g,dn.scrollTo({top:p+t,behavior:"smooth"}))}n||(r?o:l).scrollTo({top:a,behavior:y})}},_isNone(t){const e=t.commonAncestorContainer;return xt.check.isWysiwygFrame(t.startContainer)&&xt.check.isWysiwygFrame(t.endContainer)||/FIGURE/i.test(e.nodeName)||this.editor._fileManager.regExp.test(e.nodeName)&&(!this.editor._fileManager.tagAttrs[e.nodeName]||this.editor._fileManager.tagAttrs[e.nodeName]?.every((t=>e.hasAttribute(t))))||this.component.is(e)},_createDefaultRange(){const t=this.frameContext.get("wysiwyg"),e=this.frameContext.get("_wd").createRange();let i=t.firstElementChild,s=null;return i?(s=i.firstChild,s||(s=xt.utils.createElement("BR"),i.appendChild(s))):(s=xt.utils.createElement("BR"),i=xt.utils.createElement(this.options.get("defaultLine"),null,s),t.appendChild(i)),e.setStart(s,0),e.setEnd(s,0),e},_rangeInfo(t,e){let i=null;this.status._range=t,i=t.collapsed?xt.check.isWysiwygFrame(t.commonAncestorContainer)&&t.commonAncestorContainer.children[t.startOffset]||t.commonAncestorContainer:e.anchorNode,this.selectionNode=i},_init(){const t=this.frameContext.get("_wd").activeElement;if(xt.check.isInputElement(t))return this.selectionNode=t,t;const e=this.get();if(!e)return null;let i=null;i=e.rangeCount>0?e.getRangeAt(0):this._createDefaultRange(),this._rangeInfo(i,e)},__focus(){try{this.__iframeFocus=!0;const t=xt.query.getParentElement(this.getNode(),"figcaption");t?t.focus():this.frameContext.get("wysiwyg").focus()}finally{dn.setTimeout((()=>this.__iframeFocus=!1),0)}},_resetRangeToTextNode(){let t=this.getRange();if(this._isNone(t)){if(!xt.check.isWysiwygFrame(t.startContainer)||!xt.check.isWysiwygFrame(t.endContainer))return!1;const e=t.commonAncestorContainer,i=e.children[t.startOffset],s=e.children[t.endOffset];if(!(t=this.setRange(i,0,s,i===s?0:1)))return!1}const e=t,i=e.collapsed;let s,n,o,l=e.startContainer,r=e.startOffset,a=e.endContainer,h=e.endOffset;if(this.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.format.isLine(a)){for(a=a.childNodes[h]||a.lastChild||a;1===a?.nodeType&&a.lastChild;)a=a.lastChild;i?h=0:h>0&&(h=a.textContent.length)}if(s=xt.check.isWysiwygFrame(l)?this.frameContext.get("wysiwyg").firstChild:l,n=r,xt.check.isBreak(s)||1===s.nodeType&&s.childNodes.length>0){const t=xt.check.isBreak(s);if(!t){const t=s;for(;s&&!xt.check.isBreak(s)&&1===s.nodeType&&(o=s.childNodes,0!==o.length);)s=o[n>0?n-1:n]||!/FIGURE/i.test(o[0].nodeName)?o[0]:s.previousElementSibling||s.previousSibling||l,n=n>0?s.textContent.length:n;let e=this.format.getLine(s,null);e===this.format.getBlock(e,null)&&(s||=t,e=xt.utils.createElement(xt.query.getParentElement(s,xt.check.isTableCell)?"DIV":this.options.get("defaultLine")),s.parentNode.insertBefore(e,s),s!==t&&e.appendChild(s))}if(xt.check.isBreak(s)||this.component.is(s)){const e=xt.utils.createTextNode(Ct.zeroWidthSpace);s.parentNode.insertBefore(e,s),s=e,t&&l===a&&(a=s,h=1)}}if(l=s,r=n,s=xt.check.isWysiwygFrame(a)?this.frameContext.get("wysiwyg").lastChild:a,n=h,xt.check.isBreak(s)||1===s.nodeType&&s.childNodes.length>0){const t=xt.check.isBreak(s);if(!t){for(;s&&!xt.check.isBreak(s)&&1===s.nodeType&&(o=s.childNodes,0!==o.length);)s=o[n>0?n-1:n]||!/FIGURE/i.test(o[0].nodeName)?o[0]:s.previousElementSibling||s.previousSibling||l,n=n>0?s.textContent.length:n;let t=this.format.getLine(s,null);t===this.format.getBlock(t,null)&&(t=xt.utils.createElement(xt.check.isTableCell(t)?"DIV":this.options.get("defaultLine")),s.parentNode.insertBefore(t,s),t.appendChild(s))}if(xt.check.isBreak(s)){const e=xt.utils.createTextNode(Ct.zeroWidthSpace);s.parentNode.insertBefore(e,s),s=e,n=1,t&&!s.previousSibling&&xt.utils.removeItem(a)}}return a=s,h=n,this.setRange(l,r,a,h),!0},__init(){this.__hasScrollParents=this.eventManager?.scrollparents.length>0,this._scrollMargin=this.frameContext?.get("wysiwyg")?(kt.get(dn.getComputedStyle(this.frameContext.get("wysiwyg")).scrollMargin,0)||40)+kt.get(dn.getComputedStyle(this.frameContext.get("wrapper")).paddingBottom,0):40},constructor:un};const pn=un;function gn(t){this.editor=t,this.isDisabled=!1}gn.prototype={command(t,e,i,s,n,o,l,r){if(this.isDisabled)return!1;let a=null;return a=e?this.editor.shortcutsKeyMap.get(s+(i?"1000":"")):this.editor.shortcutsKeyMap.get(n)||this.editor.shortcutsKeyMap.get(n+t.key),!(!a||!i&&a.s||a.space&&!Et.isSpace(s)||a.enter&&!Et.isEnter(s)||a.textTrigger&&!t.key.trim()||a.edge&&!o)&&(a.plugin&&"string"==typeof a.method?this.editor.plugins[a.plugin][a.method]?.({range:r,line:l,info:a,event:t,keyCode:s}):"function"==typeof a.method?a.method({range:r,line:l,info:a,event:t,keyCode:s,editor:this.editor}):this.editor.run(a.command,a.type,a.button),!0)},disable(){this.isDisabled=!0},enable(){this.isDisabled=!1},constructor:gn};const mn=gn,{_w:fn}=_t;function bn(t,{keyName:e,balloon:i,inline:s,balloonAlways:n,res:o}){re.call(this,t),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.isSticky=!1,this._isBalloon=i,this._isInline=s,this._isBalloonAlways=n,this._responsiveCurrentSize="default",this._originRes=o,this._rButtonArray=o,this._rButtonsInfo=null,this._rButtonsize=null,this._isViewPortSize="visualViewport"in fn,this._inlineToolbarAttr={top:"",width:"",isShow:!1},this._balloonOffset={top:0,left:0},this._setResponsive()}bn.prototype={disable(){this._moreLayerOff(),this.menu.dropdownOff(),this.menu.containerOff(),xt.utils.setDisabled(this.context.get(this.keyName.buttonTray).querySelectorAll(".se-menu-list .se-toolbar-btn[data-type]"),!0)},enable(){xt.utils.setDisabled(this.context.get(this.keyName.buttonTray).querySelectorAll(".se-menu-list .se-toolbar-btn[data-type]"),!1)},show(){this._isInline?this._showInline():this._isBalloon?this._showBalloon():(this.context.get(this.keyName.main).style.display="",this.isSub||(this.frameContext.get("_stickyDummy").style.display="")),this.isSub||this.resetResponsiveToolbar()},hide(){this._isInline?(this.context.get(this.keyName.main).style.display="none",this.context.get(this.keyName.main).style.top="0px",this._inlineToolbarAttr.isShow=!1):(this.context.get(this.keyName.main).style.display="none",this.isSub||(this.frameContext.get("_stickyDummy").style.display="none"),this._isBalloon&&(this._balloonOffset={top:0,left:0}))},resetResponsiveToolbar(){this.menu.containerOff();const t=this._rButtonsize;if(t){let e=0;e=(this._isBalloon||this._isInline)&&"auto"===this.options.get("toolbar_width")||this.editor.isSubBalloon&&"auto"===this.options.get("toolbar_sub_width")?this.frameContext.get("topArea").offsetWidth:this.context.get(this.keyName.main).offsetWidth;let i="default";for(let s=1,n=t.length;s<n;s++)if(e<t[s]){i=t[s]+"";break}this._responsiveCurrentSize!==i&&(this._responsiveCurrentSize=i,this.setButtons(this._rButtonsInfo[i]))}},setButtons(t){this._moreLayerOff(),this.menu.dropdownOff(),this.menu.containerOff();const{icons:e,lang:i}=this,s=jt(t,this.plugins,this.editor.__options,e,i,!0);s.updateButtons.forEach((t=>Yt(t.button,t.plugin,this.icons,this.lang))),this.context.get(this.keyName.main).replaceChild(s.buttonTray,this.context.get(this.keyName.buttonTray)),this.context.set(this.keyName.buttonTray,s.buttonTray),this._resetButtonInfo(),this.triggerEvent("onSetToolbarButtons",{buttonTray:s.buttonTray,frameContext:this.frameContext})},_resetButtonInfo(){this.editor.allCommandButtons=new Map,this.editor.subAllCommandButtons=new Map,this.editor.commandTargets=new Map,this.editor.shortcutsKeyMap=new Map,this.editor.__cachingButtons(),this.editor.__cachingShortcuts(),this.history.resetButtons(this.frameContext.get("key"),null),this._resetSticky(),this.editor.effectNode=null,this.viewer._setButtonsActive(),this.status.hasFocus&&this.eventManager.applyTagEffect(),this.frameContext.get("isReadOnly")&&this.ui.setControllerOnDisabledButtons(!0)},_resetSticky(){const t=this.frameContext.get("wrapper");if(!t)return;const e=this.context.get(this.keyName.main),i=this.options.get("toolbar_sticky");if(this.frameContext.get("isFullScreen")||0===e.offsetWidth||i<0)return;const s=this._isViewPortSize?fn.visualViewport.pageTop:fn.scrollY,n=this.frameContext.get("_minHeight"),o=t.offsetHeight,l=this.offset.getGlobal(this.frameContext.get("topArea")),r=s+i,a=(this._isBalloon||this._isInline?l.top:this.offset.getGlobal(this.options.get("toolbar_container")).top)-(this._isInline?e.offsetHeight:0),h=this.options.get("toolbar_container")?l.top-s+o-n-i-e.offsetHeight:o+a+i-r-n;r<a?this._offSticky():h<0?(this.isSticky||this._onSticky(1),e.style.top=1+h+this.__getViewportTop()+"px"):this._onSticky(1)},_onSticky(t){const e=this.context.get(this.keyName.main);if(!this._isInline){const t=this.options.get("toolbar_container")?this.context.get("_stickyDummy"):this.frameContext.get("_stickyDummy");t.style.height=e.offsetHeight+"px",t.style.display="block"}const i=this.options.get("toolbar_sticky")+t+this.__getViewportTop();e.style.top=`${i}px`,e.style.width=this._isInline?this._inlineToolbarAttr.width:e.offsetWidth+"px",xt.utils.addClass(e,"se-toolbar-sticky"),this.isSticky=!0},__getViewportTop(){return this._isViewPortSize?fn.visualViewport.offsetTop:0},_offSticky(){(this.options.get("toolbar_container")?this.context.get("_stickyDummy"):this.frameContext.get("_stickyDummy")).style.display="none";const t=this.context.get(this.keyName.main);t.style.top=this._isInline?this._inlineToolbarAttr.top:"",t.style.width=this._isInline?this._inlineToolbarAttr.width:"",this.frameContext.get("wrapper").style.marginTop="",xt.utils.removeClass(t,"se-toolbar-sticky"),this.isSticky=!1},_setResponsive(){if(0===this._rButtonArray?.length)return void(this._rButtonArray=null);this._responsiveCurrentSize="default";const t=this._rButtonsize=[],e=this._originRes,i=this._rButtonsInfo={default:e[0]};for(let s,n,o=1,l=e.length;o<l;o++)n=e[o],s=1*n[0],t.push(s),i[s]=n[1];t.sort(((t,e)=>t-e)).unshift("default")},_showBalloon(t){if(!this._isBalloon)return;this.isSub&&this.resetResponsiveToolbar();const e=t||this.selection.getRange(),i=this.context.get(this.keyName.main),s=this.selection.get();let n;if(this._isBalloonAlways&&e.collapsed)n=!0;else if(s.focusNode===s.anchorNode)n=s.focusOffset<s.anchorOffset;else{const t=xt.query.getListChildNodes(e.commonAncestorContainer,null,null);n=xt.utils.getArrayIndex(t,s.focusNode)<xt.utils.getArrayIndex(t,s.anchorNode)}this._setBalloonOffset(n,e),this.triggerEvent("onShowToolbar",{toolbar:i,mode:"balloon",frameContext:this.frameContext})},_setBalloonOffset(t,e){const i=this.context.get(this.keyName.main),s=this.frameContext.get("topArea"),n=this.offset.getGlobal(s).top;if(!this.offset.setRangePosition(i,e,{position:t?"top":"bottom",addTop:n}))return void this.hide();if(this.options.get("toolbar_container")){const t=s.parentElement;let e=this.options.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;i.style.left=i.offsetLeft-n+s.offsetLeft+"px",i.style.top=i.offsetTop-o+s.offsetTop+"px"}const o=this.offset.getWWScroll();this._balloonOffset={top:i.offsetTop+o.top,left:i.offsetLeft+o.left,position:t?"top":"bottom"}},_showInline(){if(!this._isInline)return;const t=this.context.get(this.keyName.main);t.style.visibility="hidden",this._offSticky(),t.style.display="block",t.style.top="0px",this._inlineToolbarAttr.width=t.style.width=this.options.get(this.keyName.width),this._inlineToolbarAttr.top=t.style.top=this.offset.getGlobal(this.frameContext.get("topArea")).top-this.offset.getGlobal(t).top-t.offsetHeight-1+"px",this._resetSticky(),this._inlineToolbarAttr.isShow=!0,this.triggerEvent("onShowToolbar",{toolbar:t,mode:"inline",frameContext:this.frameContext}),t.style.visibility=""},_moreLayerOn(t,e){this._moreLayerOff(),this.currentMoreLayerActiveButton=t,e.style.display="block"},_moreLayerOff(){if(this.currentMoreLayerActiveButton){this.context.get(this.keyName.main).querySelector("."+this.currentMoreLayerActiveButton.getAttribute("data-command")).style.display="none",xt.utils.removeClass(this.currentMoreLayerActiveButton,"on"),this.currentMoreLayerActiveButton=null}},constructor:bn};const yn=bn,{_w:vn}=_t;function _n(t){re.call(this,t),this._controllerOnBtnDisabled=!1;const e=function({lang:t,icons:e}){const i='<div><button class="close" data-command="close" title="'+t.close+'">'+e.cancel+"</button></div><div><span></span></div>";return xt.utils.createElement("DIV",{class:"se-alert-content"},i)}(t);this.alertModal=e,this.alertMessage=e.querySelector("span"),this._alertArea=this.carrierWrapper.querySelector(".se-alert"),this._alertInner=this.carrierWrapper.querySelector(".se-alert .se-modal-inner"),this._alertInner.appendChild(e),this._closeListener=[wn.bind(this),Cn.bind(this)],this._closeSignal=!this.eventManager.addEvent(e.querySelector('[data-command="close"]'),"click",this.alertClose.bind(this)),this._bindClose=null,this._backWrapper=this.carrierWrapper.querySelector(".se-back-wrapper");const i=function(){const t='<div class="se-toast-container"><span></span></div>';return xt.utils.createElement("DIV",{class:"se-toast"},t)}();this.toastPopup=i,this.toastContainer=i.querySelector(".se-toast-container"),this.toastMessage=i.querySelector("span"),this.carrierWrapper.appendChild(i),this._toastToggle=null}function Cn(t){const e=xt.query.getEventTarget(t);(/close/.test(e.getAttribute("data-command"))||e===this._alertInner)&&this.alertClose()}function wn(t){Et.isEsc(t.code)&&this.alertClose()}_n.prototype={setEditorStyle(t,e){e||=this.frameContext;const i=e.get("options");i.set("editorStyle",t);const s=wt._setDefaultOptionStyle(i,t);i.set("_defaultStyles",s),e.get("topArea").style.cssText=s.top;const n=e.get("code");n.style.cssText=i.get("_defaultStyles").frame,n.style.display="none",i.get("iframe")?(e.get("wysiwygFrame").style.cssText=s.frame,e.get("wysiwyg").style.cssText=s.editor):e.get("wysiwygFrame").style.cssText=s.frame+s.editor},setTheme(t){if("string"!=typeof t)return;const e=this.options,i=e.get("_themeClass").trim();e.set("theme",t||""),e.set("_themeClass",t?` se-theme-${t}`:""),t=e.get("_themeClass").trim();const s=e=>{e&&(i&&xt.utils.removeClass(e,i),t&&xt.utils.addClass(e,t))};s(this.carrierWrapper),this.editor.applyFrameRoots((t=>{s(t.get("topArea")),s(t.get("wysiwyg"))})),s(this.context.get("statusbar_wrapper")),s(this.context.get("toolbar_wrapper"))},readOnly(t,e){const i=e?this.frameRoots.get(e):this.frameContext;i.set("isReadOnly",!!t),xt.utils.setDisabled(this.editor._controllerOnDisabledButtons,!!t),t?(this._offCurrentController(),this._offCurrentModal(),this.toolbar?.currentMoreLayerActiveButton?.disabled&&this.toolbar._moreLayerOff(),this.subToolbar?.currentMoreLayerActiveButton?.disabled&&this.subToolbar._moreLayerOff(),this.menu?.currentDropdownActiveButton?.disabled&&this.menu.dropdownOff(),this.menu?.currentContainerActiveButton?.disabled&&this.menu.containerOff(),i.get("code").setAttribute("readOnly","true"),xt.utils.addClass(i.get("wysiwyg"),"se-read-only")):(i.get("code").removeAttribute("readOnly"),xt.utils.removeClass(i.get("wysiwyg"),"se-read-only")),this.options.get("hasCodeMirror")&&this.viewer._codeMirrorEditor("readonly",!!t,e)},disable(t){const e=t?this.frameRoots.get(t):this.frameContext;this.toolbar.disable(),this._offCurrentController(),this._offCurrentModal(),e.get("wysiwyg").setAttribute("contenteditable",!1),e.set("isDisabled",!0),this.options.get("hasCodeMirror")?this.viewer._codeMirrorEditor("readonly",!0,t):e.get("code").disabled=!0},enable(t){const e=t?this.frameRoots.get(t):this.frameContext;this.toolbar.enable(),e.get("wysiwyg").setAttribute("contenteditable",!0),e.set("isDisabled",!1),this.options.get("hasCodeMirror")?this.viewer._codeMirrorEditor("readonly",!1,t):e.get("code").disabled=!1},show(t){const e=(t?this.frameRoots.get(t):this.frameContext).get("topArea").style;"none"===e.display&&(e.display="block")},hide(t){(t?this.frameRoots.get(t):this.frameContext).get("topArea").style.display="none"},showLoading(t){(t?this.frameRoots.get(t).get("container"):this.carrierWrapper).querySelector(".se-loading-box").style.display="block"},hideLoading(t){(t?this.frameRoots.get(t).get("container"):this.carrierWrapper).querySelector(".se-loading-box").style.display="none"},setControllerOnDisabledButtons(t){t&&!this._controllerOnBtnDisabled?(xt.utils.setDisabled(this.editor._controllerOnDisabledButtons,!0),this._controllerOnBtnDisabled=!0):!t&&this._controllerOnBtnDisabled&&(xt.utils.setDisabled(this.editor._controllerOnDisabledButtons,!1),this._controllerOnBtnDisabled=!1)},enableBackWrapper(t){this._backWrapper.style.cursor=t,this._backWrapper.style.display="block"},disableBackWrapper(){this._backWrapper.style.display="none",this._backWrapper.style.cursor="default"},alertOpen(t,e){this.alertMessage.textContent=t,xt.utils.removeClass(this.alertModal,"se-alert-error|se-alert-success"),e&&xt.utils.addClass(this.alertModal,`se-alert-${e}`),this._closeSignal&&this._alertInner.addEventListener("click",this._closeListener[1]),this._bindClose&&=this.eventManager.removeGlobalEvent(this._bindClose),this._bindClose=this.eventManager.addGlobalEvent("keydown",this._closeListener[0]),this._alertArea.style.display="block",xt.utils.addClass(this.alertModal,"se-modal-show")},alertClose(){xt.utils.removeClass(this.alertModal,"se-modal-show"),xt.utils.removeClass(this.alertModal,"se-alert-*"),this._alertArea.style.display="none",this._closeSignal&&this._alertInner.removeEventListener("click",this._closeListener[1]),this._bindClose&&=this.eventManager.removeGlobalEvent(this._bindClose)},showToast(t,e=1e3,i){xt.utils.hasClass(this.toastContainer,"se-toast-show")&&this.closeToast(),xt.utils.removeClass(this.toastPopup,"se-toast-error|se-toast-success"),i&&xt.utils.addClass(this.toastPopup,`se-toast-${i}`),this.toastPopup.style.display="block",this.toastMessage.textContent=t,xt.utils.addClass(this.toastContainer,"se-toast-show"),this._toastToggle=vn.setTimeout((()=>{this.closeToast()}),e)},closeToast(){this._toastToggle&&vn.clearTimeout(this._toastToggle),this._toastToggle=null,xt.utils.removeClass(this.toastContainer,"se-toast-show"),this.toastPopup.style.display="none"},_visibleControllers(t,e){const i=t?"":"hidden",s=e??i?"":"hidden",n=this.editor.opendControllers;for(let t,e=0;e<n.length;e++)t=n[e],t.form&&(t.form.style.visibility=i);this.editor._lineBreaker_t.style.visibility=s,this.editor._lineBreaker_b.style.visibility=s},_offCurrentController(){this.component.__deselect()},__offControllers(){const t=this.editor.opendControllers,e=[];for(let i,s=0;s<t.length;s++)i=t[s],i.fixed?e.push(i):(i.inst.controllerClose?.(),i.form&&(i.form.style.display="none"));this.editor.opendControllers=e,this.editor.currentControllerName="",this.editor._preventBlur=!1},_offCurrentModal(){this.editor.opendModal&&this.editor.opendModal.close()},constructor:_n};const xn=_n,{_w:kn,_d:En}=_t;function Sn(t){re.call(this,t),this.bodyOverflow="",this.editorAreaOriginCssText="",this.wysiwygOriginCssText="",this.codeWrapperOriginCssText="",this.codeOriginCssText="",this.codeNumberOriginCssText="",this.toolbarOriginCssText="",this.arrowOriginCssText="",this.fullScreenInnerHeight=0,this.fullScreenSticky=!1,this.fullScreenBalloon=!1,this.fullScreenInline=!1,this.toolbarParent=null}function Tn(t){const e=_t._w.getComputedStyle(t).lineHeight;let i;if(kt.is(e))i=kt.get(e);else{const e=_t._w.getComputedStyle(t).fontSize;i=1.2*kt.get(e)}return i}Sn.prototype={codeView(t){const e=this.frameContext;if(void 0===t&&(t=!e.get("isCodeView")),t===e.get("isCodeView"))return;e.set("isCodeView",t),this.ui._offCurrentController(),this.ui._offCurrentModal();const i=e.get("codeWrapper"),s=e.get("code"),n=e.get("wysiwygFrame"),o=e.get("wrapper");t?(this._setEditorDataToCodeView(),i.style.setProperty("display","flex","important"),n.style.display="none",e.get("isFullScreen")?s.style.height="100%":"auto"!==this.frameOptions.get("height")||this.options.get("hasCodeMirror")||(s.style.height=s.scrollHeight>0?s.scrollHeight+"px":"auto"),this.options.get("hasCodeMirror")&&this._codeMirrorEditor("refresh",null,null),e.get("isFullScreen")||(this.editor._notHideToolbar=!0,this.editor.isBalloon&&(this.context.get("toolbar_arrow").style.display="none",this.context.get("toolbar_main").style.left="",this.editor.isInline=this.toolbar._isInline=!0,this.editor.isBalloon=this.toolbar._isBalloon=!1,this.toolbar._showInline())),this.editor.isSubBalloon&&this.subToolbar.hide(),function(t){const e=t.get("codeNumbers");if(!e)return;const i=Tn(e),s=t.get("code").scrollHeight/i;let n="";for(let t=1;t<=s;t++)n+=`${t}\n`;const{padding:o,margin:l}=_t._w.getComputedStyle(t.get("code"));e.value=n,e.style.padding=o||"",e.style.margin=l||""}(e),this.status._range=null,s.focus(),xt.utils.addClass(this.editor.commandTargets.get("codeView"),"active"),xt.utils.addClass(o,"se-code-view-status")):(xt.check.isNonEditable(n)||this._setCodeDataToEditor(),n.scrollTop=0,i.style.setProperty("display","none","important"),n.style.display="block","auto"!==this.frameOptions.get("height")||this.options.get("hasCodeMirror")||(e.get("code").style.height="0px"),e.get("isFullScreen")||(this.editor._notHideToolbar=!1,/balloon/.test(this.options.get("mode"))&&(this.context.get("toolbar_arrow").style.display="",this.editor.isInline=this.toolbar._isInline=!1,this.editor.isBalloon=this.toolbar._isBalloon=!0,this.eventManager._hideToolbar())),this.editor._nativeFocus(),xt.utils.removeClass(this.editor.commandTargets.get("codeView"),"active"),xt.check.isNonEditable(n)||(this.history.push(!1),this.history.resetButtons(e.get("key"),null)),xt.utils.removeClass(o,"se-code-view-status")),this.editor._checkPlaceholder(e),xt.utils.setDisabled(this.editor._codeViewDisabledButtons,t),e.has("documentType_use_header")&&(t?e.get("documentTypeInner").style.display="none":(e.get("documentTypeInner").style.display="",e.get("documentType").reHeader())),this.triggerEvent("onToggleCodeView",{frameContext:e,is:e.get("isCodeView")})},fullScreen(t){const e=this.frameContext;if(void 0===t&&(t=!e.get("isFullScreen")),t===e.get("isFullScreen"))return;e.set("isFullScreen",t);const i=e.get("topArea"),s=this.context.get("toolbar_main"),n=e.get("wrapper"),o=e.get("wysiwygFrame"),l=e.get("codeWrapper"),r=e.get("code"),a=e.get("codeNumbers"),h=this.frameContext.get("isCodeView"),c=this.context.get("toolbar_arrow");this.ui._offCurrentController();const d="none"===s.style.display||this.editor.isInline&&!this.toolbar._inlineToolbarAttr.isShow;if(t){this._originCssText=i.style.cssText,this.editorAreaOriginCssText=n.style.cssText,this.wysiwygOriginCssText=o.style.cssText,this.codeWrapperOriginCssText=l.style.cssText,this.codeOriginCssText=r.style.cssText,this.codeNumberOriginCssText=a?.style.cssText,this.toolbarOriginCssText=s.style.cssText,c&&(this.arrowOriginCssText=c.style.cssText),(this.editor.isBalloon||this.editor.isInline)&&(c&&(c.style.display="none"),this.fullScreenInline=this.editor.isInline,this.fullScreenBalloon=this.editor.isBalloon,this.editor.isInline=this.toolbar._isInline=!1,this.editor.isBalloon=this.toolbar._isBalloon=!1),this.options.get("toolbar_container")&&(this.toolbarParent=s.parentElement,e.get("container").insertBefore(s,n)),i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.width="100%",i.style.maxWidth="100%",i.style.height="100%",i.style.zIndex="2147483639","none"!==e.get("_stickyDummy").style.display&&""!==e.get("_stickyDummy").style.display&&(this.fullScreenSticky=!0,e.get("_stickyDummy").style.display="none",xt.utils.removeClass(s,"se-toolbar-sticky")),this.bodyOverflow=En.body.style.overflow,En.body.style.overflow="hidden",n.style.cssText=s.style.cssText="",o.style.cssText=(o.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+this.frameOptions.get("_defaultStyles").editor+(h?"display: none;":""),l.style.cssText=(l.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+`display: ${h?"flex":"none"} !important;`,l.style.overflow="auto",l.style.height="100%",r.style.height="",s.style.width=o.style.height="100%",s.style.position="relative",s.style.display="block",this.fullScreenInnerHeight=kn.innerHeight-s.offsetHeight,n.style.height=this.fullScreenInnerHeight-(e.has("statusbar")?e.get("statusbar").offsetHeight:0)-this.options.get("fullScreenOffset")+"px",this.frameOptions.get("iframe")&&"auto"===this.frameOptions.get("height")&&(n.style.overflow="auto",this.editor._iframeAutoHeight(e)),e.get("topArea").style.marginTop=this.options.get("fullScreenOffset")+"px";const t=this.icons.reduction;this.editor.applyCommandTargets("fullScreen",(e=>{xt.utils.changeElement(e.firstElementChild,t),xt.utils.addClass(e,"active")}))}else{o.style.cssText=this.wysiwygOriginCssText.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+(h?"display: none;":""),l.style.cssText=this.codeWrapperOriginCssText.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+`display: ${h?"flex":"none"} !important;`,r.style.cssText=this.codeOriginCssText,a&&(a.style.cssText=this.codeNumberOriginCssText),s.style.cssText=this.toolbarOriginCssText,n.style.cssText=this.editorAreaOriginCssText,i.style.cssText=this._originCssText,c&&(c.style.cssText=this.arrowOriginCssText),En.body.style.overflow=this.bodyOverflow,"auto"!==this.frameOptions.get("height")||this.options.get("hasCodeMirror")||this._codeViewAutoHeight(e.get("code"),e.get("codeNumbers"),!0),this.toolbarParent&&(this.toolbarParent.appendChild(s),this.toolbarParent=null),this.options.get("toolbar_sticky")>-1&&xt.utils.removeClass(s,"se-toolbar-sticky"),this.fullScreenSticky&&!this.options.get("toolbar_container")&&(this.fullScreenSticky=!1,e.get("_stickyDummy").style.display="block",xt.utils.addClass(s,"se-toolbar-sticky")),this.editor.isInline=this.toolbar._isInline=this.fullScreenInline,this.editor.isBalloon=this.toolbar._isBalloon=this.fullScreenBalloon,e.get("isCodeView")||(this.editor.isInline?this.toolbar._showInline():this.editor.isBalloon&&this.toolbar._showBalloon()),this.toolbar._resetSticky(),e.get("topArea").style.marginTop="";const t=this.icons.expansion;this.editor.applyCommandTargets("fullScreen",(e=>{xt.utils.changeElement(e.firstElementChild,t),xt.utils.removeClass(e,"active")}))}d&&!e.get("isCodeView")&&this.toolbar.hide(),this.triggerEvent("onToggleFullScreen",{frameContext:e,is:e.get("isFullScreen")})},showBlocks(t){const e=this.frameContext;void 0===t&&(t=!e.get("isShowBlocks")),e.set("isShowBlocks",!!t),t?(xt.utils.addClass(e.get("wysiwyg"),"se-show-block"),xt.utils.addClass(this.editor.commandTargets.get("showBlocks"),"active")):(xt.utils.removeClass(e.get("wysiwyg"),"se-show-block"),xt.utils.removeClass(this.editor.commandTargets.get("showBlocks"),"active")),this.editor._resourcesStateChange(e)},_setButtonsActive(){const t=this.frameContext;if(t.get("isCodeView")?xt.utils.addClass(this.editor.commandTargets.get("codeView"),"active"):xt.utils.removeClass(this.editor.commandTargets.get("codeView"),"active"),t.get("isFullScreen")){const t=this.icons.reduction;this.editor.applyCommandTargets("fullScreen",(e=>{xt.utils.changeElement(e.firstElementChild,t),xt.utils.addClass(e,"active")}))}else{const t=this.icons.expansion;this.editor.applyCommandTargets("fullScreen",(e=>{xt.utils.changeElement(e.firstElementChild,t),xt.utils.removeClass(e,"active")}))}t.get("isShowBlocks")?xt.utils.addClass(this.editor.commandTargets.get("showBlocks"),"active"):xt.utils.removeClass(this.editor.commandTargets.get("showBlocks"),"active")},print(){const t=xt.utils.createElement("IFRAME",{style:"display: none;"});En.body.appendChild(t);const e=kn.getComputedStyle(this.frameContext.get("wysiwyg")).padding,i=this.options.get("printTemplate")?this.options.get("printTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.html.get()):this.html.get(),s=xt.query.getIframeDocument(t),n=this.frameContext.get("_wd"),o=this.options.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.frameOptions.get("iframe")){const t=this.options.get("printClass")?'class="'+this.options.get("printClass")+o+'"':this.frameOptions.get("iframe_fullPage")?xt.utils.getAttributesToString(n.body,["contenteditable"]):'class="'+this.options.get("_editableClass")+o+'"';s.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${i}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}else{const t=En.head.getElementsByTagName("link"),e=En.head.getElementsByTagName("style");let n="";for(let e=0,i=t.length;e<i;e++)n+=t[e].outerHTML;for(let t=0,i=e.length;t<i;t++)n+=e[t].outerHTML;s.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.options.get("printClass")||this.options.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${i}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}this.ui.showLoading(),kn.setTimeout((()=>{try{if(t.focus(),_t.isEdge||_t.isChromium||"StyleMedia"in _t._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.ui.hideLoading(),xt.utils.removeItem(t)}}),1e3)},preview(){this.menu.dropdownOff(),this.menu.containerOff(),this.ui._offCurrentController(),this.ui._offCurrentModal();const t=this.options.get("previewTemplate")?this.options.get("previewTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.html.get({withFrame:!0})):this.html.get({withFrame:!0}),e=kn.open("","_blank"),i=this.frameContext.get("_wd"),s=this.options.get("_rtl")?" se-rtl":"";if(this.frameOptions.get("iframe")){const n=this.options.get("printClass")?'class="'+this.options.get("printClass")+s+'"':this.frameOptions.get("iframe_fullPage")?xt.utils.getAttributesToString(i.body,["contenteditable"]):'class="'+this.options.get("_editableClass")+s+'"';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${i.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 i=En.head.getElementsByTagName("link"),n=En.head.getElementsByTagName("style");let o="";for(let t=0,e=i.length;t<e;t++)o+=i[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.lang.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.options.get("printClass")?this.options.get("printClass"):this.options.get("_editableClass"))+s}" 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.frameContext.get("isFullScreen"))return this.fullScreenInnerHeight+=kn.innerHeight-this.context.get("toolbar_main").offsetHeight-(this.frameContext.has("statusbar")?this.frameContext.get("statusbar").offsetHeight:0)-this.fullScreenInnerHeight,this.frameContext.get("wrapper").style.height=this.fullScreenInnerHeight+"px",!0},_codeMirrorEditor(t,e,i){const s=i?this.frameRoots.get(i).get("options"):this.frameOptions;switch(t){case"set":s.has("codeMirror5Editor")?s.get("codeMirror5Editor").getDoc().setValue(e):s.has("codeMirror6Editor")&&s.get("codeMirror6Editor").dispatch({changes:{from:0,to:s.get("codeMirror6Editor").state.doc.length,insert:e}});break;case"get":if(s.has("codeMirror5Editor"))return s.get("codeMirror5Editor").getDoc().getValue();if(s.has("codeMirror6Editor"))return s.get("codeMirror6Editor").state.doc.toString();break;case"readonly":s.has("codeMirror5Editor")?s.get("codeMirror5Editor").setOption("readOnly",e):s.has("codeMirror6Editor")&&(e?s.get("codeMirror6Editor").contentDOM.removeAttribute("contenteditable"):s.get("codeMirror6Editor").contentDOM.setAttribute("contenteditable",!0));break;case"refresh":s.has("codeMirror5Editor")&&s.get("codeMirror5Editor").refresh()}},_setCodeView(t){this.options.get("hasCodeMirror")?this._codeMirrorEditor("set",t,null):this.frameContext.get("code").value=t},_getCodeView(){return this.options.get("hasCodeMirror")?this._codeMirrorEditor("get",null,null):this.frameContext.get("code").value},_setCodeDataToEditor(){const t=this._getCodeView();if(this.frameOptions.get("iframe_fullPage")){const e=this.frameContext.get("_wd"),i=(new DOMParser).parseFromString(t,"text/html");if(!this.html.__disallowedTagNameRegExp.test("script")){const t=i.head.children;for(let e=0,s=t.length;e<s;e++)/^script$/i.test(t[e].tagName)&&(i.head.removeChild(t[e]),e--,s--)}let s=i.head.innerHTML;i.head.querySelector('link[rel="stylesheet"]')&&("auto"!==this.frameOptions.get("height")||i.head.querySelector("style"))||(s+=wt._setIframeStyleLinks(this.frameOptions.get("iframe_cssFileName"))+wt._setAutoHeightStyle(this.frameOptions.get("height"))),e.head.innerHTML=s,e.body.innerHTML=this.html.clean(i.body.innerHTML,{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.options.get("freeCodeViewMode")});const n=i.body.attributes;for(let t=0,i=n.length;t<i;t++)"contenteditable"!==n[t].name&&e.body.setAttribute(n[t].name,n[t].value);if(!xt.utils.hasClass(e.body,"sun-editor-editable")){const t=this.options.get("_editableClass").split(" ");for(let i=0;i<t.length;i++)xt.utils.addClass(e.body,this.options.get("_editableClass")[i])}}else this.frameContext.get("wysiwyg").innerHTML=t.length>0?this.html.clean(t,{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.options.get("freeCodeViewMode")}):"<"+this.options.get("defaultLine")+"><br></"+this.options.get("defaultLine")+">"},_setEditorDataToCodeView(){const t=this.html._convertToCode(this.frameContext.get("wysiwyg"),!1);let e="";if(this.frameOptions.get("iframe_fullPage")){const i=xt.utils.getAttributesToString(this.frameContext.get("_wd").body,null);e="<!DOCTYPE html>\n<html>\n"+this.frameContext.get("_wd").head.outerHTML.replace(/>(?!\n)/g,">\n")+"<body "+i+">\n"+t+"</body>\n</html>"}else e=t;this._setCodeView(e)},_codeViewAutoHeight(t,e,i){i&&(t.style.height=t.scrollHeight+"px"),this._updateLineNumbers(e,t)},_updateLineNumbers(t,e){if(!t)return;const i=Tn(t),s=Math.ceil(e.scrollHeight/i),n=(t.value.match(/\n/g)||[]).length;if(s>n){let e="";for(let t=n+1;t<=s;t++)e+=`${t}\n`;t.value+=e}},_scrollLineNumbers(t){t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft},constructor:Sn};const Hn=Sn,Ln=".se-menu-list .se-toolbar-btn[data-command]",Mn=`${Ln}:not([class~="se-code-view-enabled"]):not([data-type="MORE"])`,Nn=`${Ln}:not([class~="se-component-enabled"]):not([data-type="MORE"])`;function An(t,e){const i=t[0].target.ownerDocument||_t._d,s=i.defaultView||_t._w,n=Xt(t,e);this.rootKeys=n.rootKeys,this.frameRoots=n.frameRoots,this._d=i,this._w=s,this.carrierWrapper=n.carrierWrapper,this.__context=n.context,this.context=function(t){const e=t.__context;return{get:t=>e.get(t),set:(t,i)=>e.set(t,i),has:t=>e.has(t),delete:t=>e.delete(t),getAll:()=>Object.fromEntries(e.entries()),clear(){e.clear()}}}(this),this.__frameContext=new Map,this.frameContext=function(t){let e=t.__frameContext;return{get:t=>e.get(t),set:(t,i)=>e.set(t,i),has:t=>e.has(t),delete:t=>e.delete(t),getAll:()=>Object.fromEntries(e.entries()),reset(i){e=t.__options=i},clear(){e.clear()}}}(this),this.__frameOptions=new Map,this.frameOptions=function(t){let e=t.__frameOptions;return{get:t=>e.get(t),set:(t,i)=>e.set(t,i),has:t=>e.has(t),getAll:()=>Object.fromEntries(e.entries()),setMany(t){Object.entries(t).forEach((([t,i])=>e.set(t,i)))},reset(i){e=t.__frameOptions=i},clear(){e.clear()}}}(this),this.__options=n.options,this.options=function(t){let e=t.__options;return{get:t=>e.get(t),set:(t,i)=>e.set(t,i),has:t=>e.has(t),getAll:()=>Object.fromEntries(e.entries()),setMany(t){Object.entries(t).forEach((([t,i])=>e.set(t,i)))},reset(i){e=t.__options=i},clear(){e.clear()}}}(this),this.plugins=n.plugins||{},this.events=null,this.triggerEvent=null,this.icons=n.icons,this.lang=n.lang,this.status={hasFocus:!1,tabSize:4,indentSize:25,codeIndentSize:2,currentNodes:[],currentNodesMap:[],initViewportHeight:0,currentViewportHeight:0,onSelected:!1,rootKey:n.rootId,isScrollable:t=>{t||=this.frameContext;const e=t.get("options"),i=e.get("height"),s=e.get("maxHeight");return"auto"!==i||!!s&&t.get("wysiwyg").offsetHeight>=kt.get(s)},_range:null,_onMousedown:!1},this.isClassic=!1,this.isInline=!1,this.isBalloon=!1,this.isBalloonAlways=!1,this.isSubBalloon=!1,this.isSubBalloonAlways=!1,this.allCommandButtons=new Map,this.subAllCommandButtons=new Map,this.shortcutsKeyMap=new Map,this.reverseKeys=new Set,this.commandTargets=new Map,this.activeCommands=null,this.effectNode=null,this.opendModal=null,this.opendControllers=[],this.currentControllerName="",this.opendBrowser=null,this.selectMenuOn=!1,this.history=null,this.eventManager=null,this.instanceCheck=null,this.toolbar=null,this.subToolbar=null,this.char=null,this.component=null,this.format=null,this.html=null,this.inline=null,this.listFormat=null,this.menu=null,this.nodeTransform=null,this.offset=null,this.selection=null,this.shortcuts=null,this.ui=null,this.viewer=null,this._lineBreaker_t=null,this._lineBreaker_b=null,this._shadowRoot=null,this._onPluginEvents=null,this._onCopyFormatInfo=null,this._onCopyFormatInitMethod=null,this._controllerTargetContext=null,this._controllerOnDisabledButtons=[],this._codeViewDisabledButtons=[],this._pluginCallButtons=n.pluginCallButtons,this._pluginCallButtons_sub=n.pluginCallButtons_sub,this._responsiveButtons=n.responsiveButtons,this._responsiveButtons_sub=n.responsiveButtons_sub,this._notHideToolbar=!1,this._preventBlur=!1,this._preventFocus=!1,this._preventSelection=!1,this._componentsInfoInit=!0,this._componentsInfoReset=!1,this._MELInfo=null,this._fileInfoPluginsCheck=null,this._fileInfoPluginsReset=null,this._fileManager={tags:null,regExp:null,pluginRegExp:null,pluginMap:null},this._componentManager=[],this._figureContainer=null,this._originOptions=e;try{this.__Create(e)}catch(t){throw console.error("[SUNEDITOR:E_CREATE_FAIL] Failed to create editor instance.",t),t}}function Bn(t,e,i,s,n,o){const l=e[t],r=Object.keys(l);if(In(r,null,t+"."),0===r.length)return!1;const a=t||null;s.set(a,new Map);const h=i.get(a).get("options").get("_origin"),c={},d=Object.prototype.hasOwnProperty;for(const t in l){if(!d.call(It,t))continue;const e=l[t];r.includes(t)&&h[t]!==e&&(s.get(a).set(Vn(t),!0),c[t]=e)}const u={...h,...c};n.set(a,new Map(Object.entries(u))),o.push({key:a,options:u})}function Vn(t){return/^statusbar|^charCounter/.test(t)?"statusbar-changed":t}function In(t,e,i){for(let s,n=0,o=t.length;n<o;n++)s=t[n],("fixed"===Ot[s]||"fixed"===It[s]||e&&e[s])&&(console.warn(`[SUNEDITOR.warn.resetOptions] The "[${i+s}]" option cannot be changed after the editor is created.`),t.splice(n--,1),o--)}An.prototype={registerPlugin(t,e,i){let s=this.plugins[t];if(!s)throw Error(`[SUNEDITOR.registerPlugin.fail] The called plugin does not exist or is in an invalid format. (pluginName: "${t}")`);if("function"==typeof this.plugins[t]&&(s=this.plugins[t]=new this.plugins[t](this,i||{})),e){for(let t=0,i=e.length;t<i;t++)Yt(e[t],s,this.icons,this.lang);this.activeCommands.includes(t)||"function"!=typeof this.plugins[t].active||this.activeCommands.push(t)}},run(t,e,i){if(e){if(/more/i.test(e)){const e=xt.query.getParentElement(i,".se-toolbar"),s=xt.utils.hasClass(e,"se-toolbar-sub")?this.subToolbar:this.toolbar;if(i!==s.currentMoreLayerActiveButton){const n=e.querySelector("."+t);n&&(s._moreLayerOn(i,n),s._showBalloon(),s._showInline()),xt.utils.addClass(i,"on")}else s.currentMoreLayerActiveButton&&(s._moreLayerOff(),s._showBalloon(),s._showInline());return void this.viewer._resetFullScreenHeight()}if(/container/.test(e)&&(null===this.menu.targetMap[t]||i!==this.menu.currentContainerActiveButton))return void this.menu.containerOn(i);if(this.frameContext.get("isReadOnly")&&xt.utils.arrayIncludes(this._controllerOnDisabledButtons,i))return;if(/dropdown/.test(e)&&(null===this.menu.targetMap[t]||i!==this.menu.currentDropdownActiveButton))return void this.menu.dropdownOn(i);if(/modal/.test(e))return void this.plugins[t].open(i);/command/.test(e)?this.plugins[t].action(i):/browser/.test(e)?this.plugins[t].open(null):/popup/.test(e)&&this.plugins[t].show()}else t&&this.commandHandler(t,i);/dropdown/.test(e)?this.menu.dropdownOff():/command/.test(e)||(this.menu.dropdownOff(),this.menu.containerOff())},async commandHandler(t,e){if(!this.frameContext.get("isReadOnly")||/copy|cut|selectAll|codeView|fullScreen|print|preview|showBlocks/.test(t))switch(t){case"selectAll":!function(t){t.ui._offCurrentController(),t.menu.containerOff();const e=t.frameContext.get("wysiwyg");let i=null,s="";const n=t.options.get("scopeSelectionTags"),o=t.selection.getRange();if(!o.collapsed){let t=i=o.commonAncestorContainer,l=s=t.nodeName?.toLowerCase();if(0===o.startOffset&&o.endOffset===o.endContainer.textContent?.length){const e=t.parentElement;(xt.check.isList(e)||xt.check.isListCell(e))&&e.firstChild.contains?.(o.startContainer)&&e.lastChild?.contains(o.endContainer)&&(i=t=e.parentElement,s=t.nodeName?.toLowerCase())}for(l=t.nodeName?.toLowerCase();t&&(!t.nextSibling&&!t.previousSibling&&!n.includes(l)||xt.check.isContentLess(l))&&t!==e;)t=t.parentElement,l=t.nodeName?.toLowerCase();n.includes(l)&&(i=t,s=l)}const l=n.filter((t=>t!==s));let r=xt.query.getParentElement(i||t.selection.getNode(),(t=>l.includes(t.nodeName?.toLowerCase())))||e,{first:a,last:h}=ie(r);if(!a||!h)return;const c=xt.check.isZeroWidth;for(;c(a)&&c(h)&&r!==e;)r=r.parentElement,({first:a,last:h}=ie(xt.query.getParentElement(r,(t=>l.includes(t.nodeName?.toLowerCase())))||e));if(!a||!h)return;let d=null;if(xt.check.isMedia(a)||(d=t.component.get(a))||xt.check.isTableElements(a)){d||=t.component.get(a);const e=xt.utils.createElement("BR"),i=xt.utils.createElement(t.options.get("defaultLine"),null,e);a=d?d.container||d.cover:a,a.parentElement.insertBefore(i,a),a=e}if(xt.check.isMedia(h)||(d=t.component.get(h))||xt.check.isTableElements(h)){d||=t.component.get(h);const e=xt.utils.createElement("BR"),i=xt.utils.createElement(t.options.get("defaultLine"),null,e);h=d?d.container||d.cover:h,h.parentElement.appendChild(i),h=e}t.toolbar._showBalloon(t.selection.setRange(a,0,h,h.textContent.length))}(this);break;case"copy":{const t=this.selection.getRange();if(t.collapsed)break;const e=xt.utils.createElement("div",null,t.cloneContents());await this.html.copy(e.innerHTML);break}case"newDocument":this.html.set(`<${this.options.get("defaultLine")}><br></${this.options.get("defaultLine")}>`),this.focus(),this.history.push(!1),this.frameContext.has("documentType_use_header")&&this.frameContext.get("documentType").reHeader();break;case"codeView":this.viewer.codeView(!this.frameContext.get("isCodeView"));break;case"fullScreen":this.viewer.fullScreen(!this.frameContext.get("isFullScreen"));break;case"indent":this.format.indent();break;case"outdent":this.format.outdent();break;case"undo":this.history.undo();break;case"redo":this.history.redo();break;case"removeFormat":this.inline.remove(),this.focus();break;case"print":this.viewer.print();break;case"preview":this.viewer.preview();break;case"showBlocks":this.viewer.showBlocks(!this.frameContext.get("isShowBlocks"));break;case"dir":this.setDir(this.options.get("_rtl")?"ltr":"rtl");break;case"dir_ltr":this.setDir("ltr");break;case"dir_rtl":this.setDir("rtl");break;case"save":await async function(t){const e=t.frameContext;if(!e.get("isChanged"))return;const i=t.html.get(),s=await t.triggerEvent("onSave",{frameContext:e,data:i});if(s===Kt){const t=e.get("originElement");/^TEXTAREA$/i.test(t.nodeName)?t.value=i:t.innerHTML=i}else if(!1===s)return;e.set("isChanged",!1),e.set("savedIndex",t.history.getRootStack()[t.status.rootKey].index),t.applyCommandTargets("save",(t=>{t.disabled=!0}))}(this);break;case"copyFormat":oe(this,e);break;case"pageBreak":!function(t){const e=xt.utils.createElement("DIV",{class:"se-component se-component-line-break se-page-break"});t.component.insert(e,{skipCharCount:!0,insertBehavior:"line"});const i=e.nextElementSibling||t.format.addLine(e);t.selection.setRange(i,1,i,1),t.history.push(!1)}(this);break;case"pageUp":this.frameContext.get("documentType").pageUp();break;case"pageDown":this.frameContext.get("documentType").pageDown();break;default:!function(t,e){e=t.options.get("_defaultTagCommand")[e.toLowerCase()]||e;let i=t.options.get("convertTextTags")[e]||e;const s=t.status.currentNodesMap,n=s.includes(t.options.get("_styleCommandMap")[i])?null:xt.utils.createElement(i);/^sub$/i.test(i)&&s.includes("superscript")?i="sup":/^sup$/i.test(i)&&s.includes("subscript")&&(i="sub"),t.inline.apply(n,{stylesToModify:Jt[e]||null,nodesToRemove:[i],strictRemove:!1}),t.focus()}(this,t)}},runFromTarget(t){if(xt.check.isInputElement(t))return;const e=xt.query.getCommandTarget(t);if(!e)return;const i=e.getAttribute("data-command"),s=e.getAttribute("data-type");(i||s)&&(e.disabled||this.run(i,s,t))},applyCommandTargets(t,e){this.commandTargets.has(t)&&this.commandTargets.get(t).forEach(e)},applyFrameRoots(t){this.frameRoots.forEach(t)},isEmpty(t){const e=(t||this.frameContext).get("wysiwyg");return xt.check.isZeroWidth(e.textContent)&&!e.querySelector(this.options.get("allowedEmptyTags"))&&(e.innerText.match(/\n/g)||"").length<=1},setDir(t){const e="rtl"===t;if(this.options.get("_rtl")!==e){try{this.options.set("_rtl",e),this.ui._offCurrentController();const i=this.frameContext,s=this.plugins;for(const e in s)s[e].setDir?.(t);const n=this.context.get("toolbar_wrapper"),o=this.context.get("statusbar_wrapper");e?(this.applyFrameRoots((t=>{xt.utils.addClass([t.get("topArea"),t.get("wysiwyg"),t.get("documentTypePageMirror")],"se-rtl")})),xt.utils.addClass([this.carrierWrapper,n,o],"se-rtl")):(this.applyFrameRoots((t=>{xt.utils.removeClass([t.get("topArea"),t.get("wysiwyg"),t.get("documentTypePageMirror")],"se-rtl")})),xt.utils.removeClass([this.carrierWrapper,n,o],"se-rtl"));const l=xt.query.getListChildren(i.get("wysiwyg"),(t=>this.format.isLine(t)&&!!(t.style.marginRight||t.style.marginLeft||t.style.textAlign)),null);for(let t,e,i,s=0;t=l[s];s++)t=l[s],i=t.style.marginRight,e=t.style.marginLeft,(i||e)&&(t.style.marginRight=e,t.style.marginLeft=i),i=t.style.textAlign,"left"===i?t.style.textAlign="right":"right"===i&&(t.style.textAlign="left");!function(t,e){const i=t.icons,s=t.commandTargets,n=t.shortcutsKeyMap;t.reverseKeys.forEach((t=>{const e=n.get(t);e&&([e.command,e.r]=[e.r,e.command])})),t.applyCommandTargets("dir",(s=>{xt.utils.changeTxt(s.querySelector(".se-tooltip-text"),t.lang[e?"dir_ltr":"dir_rtl"]),xt.utils.changeElement(s.firstElementChild,i[e?"dir_ltr":"dir_rtl"])})),e?(xt.utils.addClass(s.get("dir_rtl"),"active"),xt.utils.removeClass(s.get("dir_ltr"),"active")):(xt.utils.addClass(s.get("dir_ltr"),"active"),xt.utils.removeClass(s.get("dir_rtl"),"active"))}(this,e),i.has("documentType_use_header")&&(e?i.get("wrapper").appendChild(i.get("documentTypeInner")):i.get("wrapper").insertBefore(i.get("documentTypeInner"),i.get("wysiwygFrame"))),i.has("documentType_use_page")&&(e?i.get("wrapper").insertBefore(i.get("documentTypePage"),i.get("wysiwygFrame")):i.get("wrapper").appendChild(i.get("documentTypePage"))),this.isBalloon?this.toolbar._showBalloon():this.isSubBalloon&&this.subToolbar._showBalloon()}catch(t){this.options.set("_rtl",!e),console.warn(`[SUNEDITOR.setDir.fail] ${t.toString()}`)}this.effectNode=null,this.eventManager.applyTagEffect()}},resetOptions(t){this.viewer.codeView(!1),this.viewer.showBlocks(!1);const e=new Map,i=this.frameRoots,s=[],n=new Map,o={};for(const e in t)void 0!==It[e]&&(o[e]=t[e],delete t[e]);for(const e of i.keys())t[e||""]={...o,...t[e||""]};const l=Object.keys(t);if(In(l,this.plugins,""),0===l.length)return;1===i.size&&l.unshift(null);const r=[this._originOptions,t].reduce(((t,o)=>{for(const l in o)i.has(l||null)?Bn(l,o,i,e,n,s):t[l]=o[l];return t}),{}),a=this.options,h=$t(r,s,this.plugins),c=h.o,d=h.frameMap;for(let t,s=0,o=l.length;s<o;s++)if(t=l[s]||null,n.has(t)){const s=e.get(t),n=i.get(t),o=n.get("options"),l=d.get(t);if(n.set("options",l),s.has("statusbar-changed")){if(xt.utils.removeItem(n.get("statusbar")),l.get("statusbar")){const t=Pt(l,null).statusbar;n.get("container").appendChild(t),Bt(t,n),this.eventManager.__addStatusbarEvent(n,l)}else this.eventManager.removeEvent(o.get("__statusbarEvent")),l.set("__statusbarEvent",null),Bt(null,n);n.get("statusbar")&&this.char.display(n)}if(s.has("iframe_attributes")){const t=n.get("wysiwygFrame"),e=o.get("iframe_attributes"),i=l.get("iframe_attributes");for(const i in e)t.removeAttribute(i,e[i]);for(const e in i)t.setAttribute(e,i[e])}if(s.has("iframe_cssFileName")){const t=n.get("_wd").head,e=t.getElementsByTagName("link");for(;e[0];)t.removeChild(e[0]);const i=(new DOMParser).parseFromString(wt._setIframeStyleLinks(l.get("iframe_cssFileName")),"text/html").head.children,s=t.querySelector("style");for(;i[0];)t.insertBefore(i[0],s)}s.has("placeholder")&&(n.get("placeholder").textContent=l.get("placeholder")),this.ui.setEditorStyle(l.get("editorStyle"),n);const r=n.get("wysiwyg"),a=o.get("editableFrameAttributes"),h=l.get("editableFrameAttributes");for(const t in a)r.removeAttribute(t,a[t]);for(const t in h)r.setAttribute(t,h[t])}else switch(a.set(t,c.get(t)),t){case"theme":this.ui.setTheme(a.get("theme"));break;case"events":{const t=a.get("events");for(const e in t)this.events[e]=t[e];break}case"autoStyleify":this.html.__resetAutoStyleify(a.get("autoStyleify"));break;case"textDirection":this.setDir(a.get("_rtl")?"ltr":"rtl");break;case"historyStackDelayTime":this.history.resetDelayTime(a.get("historyStackDelayTime"));break;case"defaultLineBreakFormat":this.format.__resetBrLineBreak(a.get("defaultLineBreakFormat"))}this._originOptions=r;const u=this.context.get("toolbar_main");/inline|balloon/i.test(a.get("mode"))&&l.includes("toolbar_width")&&(u.style.width=a.get("toolbar_width")),a.get("toolbar_hide")?u.style.display="none":u.style.display="",a.get("shortcutsHint")?xt.utils.removeClass(u,"se-shortcut-hide"):xt.utils.addClass(u,"se-shortcut-hide"),this.effectNode=null,this._setFrameInfo(this.frameRoots.get(this.status.rootKey));for(const t of Object.values(this.plugins))t.init?.()},changeFrameContext(t){t!==this.status.rootKey&&(this.status.rootKey=t,this._setFrameInfo(this.frameRoots.get(t)),this.toolbar._resetSticky())},execCommand(t,e,i){this.frameContext.get("_wd").execCommand(t,e,"formatBlock"===t?"<"+i+">":i),this.history.push(!0)},focus(t){if(t&&this.changeFrameContext(t),"none"!==this.frameContext.get("wysiwygFrame").style.display){if(this._preventBlur=!1,this.frameOptions.get("iframe")||!this.frameContext.get("wysiwyg").contains(this.selection.getNode()))this._nativeFocus();else try{const t=this.selection.getRange();if(t.startContainer===t.endContainer&&xt.check.isWysiwygFrame(t.startContainer)){const e=t.commonAncestorContainer.children[t.startOffset];if(!this.format.isLine(e)&&!this.component.is(e)){const t=xt.utils.createElement("BR"),i=xt.utils.createElement(this.options.get("defaultLine"),null,t);return this.frameContext.get("wysiwyg").insertBefore(i,e),void this.selection.setRange(t,0,t,0)}}this.selection.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}catch(t){console.warn("[SUNEDITOR.focus.warn] ",t),this._nativeFocus()}this.isBalloon&&this.eventManager._toggleToolbarBalloon()}},focusEdge(t){this._preventBlur=!1,t||=this.frameContext.get("wysiwyg").lastElementChild;const e=this.component.get(t);e?this.component.select(e.target,e.pluginName):t?(3!==t.nodeType&&(t=xt.query.getEdgeChild(t,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!0)),t?this.selection.setRange(t,t.textContent.length,t,t.textContent.length):this._nativeFocus()):this.focus()},blur(){this.frameOptions.get("iframe")?this.frameContext.get("wysiwygFrame").blur():this.frameContext.get("wysiwyg").blur()},destroy(){let t=this.plugins;for(const e in t){const i=t[e];i._destroy?.();for(const t in i)delete i[t];delete t[e]}this.history.destroy(),this.eventManager._removeAllEvents(),this.options.get("codeMirror6Editor")&&this.options.get("codeMirror6Editor").destroy(),xt.utils.removeItem(this.carrierWrapper),xt.utils.removeItem(this.context.get("toolbar_wrapper")),xt.utils.removeItem(this.context.get("toolbar_sub_wrapper")),xt.utils.removeItem(this.context.get("statusbar_wrapper")),this.applyFrameRoots((t=>{xt.utils.removeItem(t.get("topArea")),t.get("options").clear(),t.clear()})),this.allCommandButtons.clear(),this.subAllCommandButtons.clear(),this.shortcutsKeyMap.clear(),this.reverseKeys.clear(),this.commandTargets.clear(),this.__frameContext.clear(),this.__frameOptions.clear(),this._MELInfo&&this._MELInfo.clear(),this._onPluginEvents&&this._onPluginEvents.clear(),this.options.clear(),this.context.clear(),this.frameRoots.clear(),t=this.events;for(const e in t)delete t[e];t=["eventManager","instanceCheck","char","component","format","html","inline","listFormat","menu","nodeTransform","offset","selection","shortcuts","ui","viewer","toolbar","subToolbar"];for(let e,i=0,s=t.length;i<s;i++){e=this[t[i]];for(const t in e)delete e[t]}t=null;for(const t in this)delete this[t];return null},_setFrameInfo(t){this.frameContext.reset(t),this.frameOptions.reset(t.get("options")),t.set("_editorHeight",t.get("wysiwygFrame").offsetHeight),this._lineBreaker_t=t.get("lineBreaker_t"),this._lineBreaker_b=t.get("lineBreaker_b")},_nativeFocus(){this.selection.__focus(),this.selection._init()},_checkComponents(t){for(let e=0,i=this._fileInfoPluginsCheck.length;e<i;e++)this._fileInfoPluginsCheck[e](t)},_resetComponents(){for(let t=0,e=this._fileInfoPluginsReset.length;t<e;t++)this._fileInfoPluginsReset[t]()},_initWysiwygArea(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=this.char.getLength()),"document"===this.options.get("type")&&(t.set("documentType",new Yi(this,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))},_resourcesStateChange(t){this._iframeAutoHeight(t),this._checkPlaceholder(t),t.has("documentType_use_page")&&(t.get("documentTypePageMirror").innerHTML=t.get("wysiwyg").innerHTML,t.get("documentType").rePage(!0))},_iframeAutoHeight(t){const e=t.get("_iframeAuto");e?this._w.setTimeout((()=>{const i=e.offsetHeight,s=t.get("wysiwygFrame");s.style.height=i+"px";const n=t.get("options");if(n.get("iframe")){const t=n.get("maxHeight");t&&s.setAttribute("scrolling",i>kt.get(t)?"auto":"no")}_t.isResizeObserverSupported||this.__callResizeFunction(t,i,null)}),0):_t.isResizeObserverSupported||this.__callResizeFunction(t,t.get("wysiwygFrame").offsetHeight,null)},__callResizeFunction(t,e,i){e=-1===e?i?.borderBoxSize&&i.borderBoxSize[0]?i.borderBoxSize[0].blockSize:i.contentRect.height+kt.get(t.get("wwComputedStyle").getPropertyValue("padding-left"))+kt.get(t.get("wwComputedStyle").getPropertyValue("padding-right")):e,t.get("_editorHeight")!==e&&(this.triggerEvent("onResizeEditor",{height:e,prevHeight:t.get("_editorHeight"),frameContext:t,observerEntry:i}),t.set("_editorHeight",e)),t.has("documentType_use_page")&&t.get("documentType").resizePage()},_checkPlaceholder(t){t||=this.frameContext;const e=t.get("placeholder");if(e){if(t.get("isCodeView"))return void(e.style.display="none");this.isEmpty(t)?e.style.display="block":e.style.display="none"}},__editorInit(t){this.status.initViewportHeight=this._w.visualViewport.height,this.eventManager.__setViewportSize(),this.applyFrameRoots((t=>{this.__setEditorParams(t)})),this._setFrameInfo(this.frameRoots.get(this.status.rootKey)),this.__init(t);for(const t of this._onPluginEvents.values())t.sort(((t,e)=>t.index-e.index));this.applyFrameRoots((t=>{this.eventManager._addFrameEvents(t),this._initWysiwygArea(t,t.get("options").get("value")),t.get("options").get("iframe")&&"auto"===t.get("options").get("height")&&this.__callResizeFunction(t,t.get("wysiwygFrame").offsetHeight,null)})),this.eventManager.__eventDoc=null,this._componentsInfoInit=!1,this._componentsInfoReset=!1,this._checkComponents(!0),this._w.setTimeout(function(){if(this.context){this.context.get("toolbar_main").style.visibility="",this.applyFrameRoots((t=>{this.eventManager._wwFrameObserver&&this.eventManager._wwFrameObserver.observe(t.get("wysiwygFrame")),this.eventManager._toolbarObserver&&this.eventManager._toolbarObserver.observe(t.get("_toolbarShadow")),this._resourcesStateChange(t)})),this.history.reset();for(const t of Object.values(this.plugins))t.init?.();this.selection.__init(),this.triggerEvent("onload",{})}else console.warn("[SUNEDITOR:E_INIT_FAIL] Editor instance was destroyed before initialization completed. Check if destroy() was called.")}.bind(this),0)},__init(t){this._fileInfoPluginsCheck=[],this._fileInfoPluginsReset=[],this._MELInfo=new Map,this.activeCommands=se,this._onPluginEvents=new Map([["onMouseMove",[]],["onMouseLeave",[]],["onMouseDown",[]],["onMouseUp",[]],["onScroll",[]],["onClick",[]],["onBeforeInput",[]],["onInput",[]],["onKeyDown",[]],["onKeyUp",[]],["onFocus",[]],["onBlur",[]],["onPaste",[]],["onFilePasteAndDrop",[]]]),this._fileManager.tags=[],this._fileManager.pluginMap={},this._fileManager.tagAttrs={};const e=this.plugins,i=[];let s;for(const n in e){if(this.registerPlugin(n,this._pluginCallButtons[n],t[n]),this.registerPlugin(n,this._pluginCallButtons_sub[n],t[n]),s=this.plugins[n],"object"==typeof s.__fileManagement){const t=s.__fileManagement;if(this._fileInfoPluginsCheck.push(t._checkInfo.bind(t)),this._fileInfoPluginsReset.push(t._resetInfo.bind(t)),Array.isArray(t.tagNames)){const e=t.tagNames;this._fileManager.tags=this._fileManager.tags.concat(e),i.push(n);for(let i,s=0,o=e.length;s<o;s++)i=e[s].toLowerCase(),this._fileManager.pluginMap[i]=n,t.tagAttrs&&(this._fileManager.tagAttrs[i]=t.tagAttrs)}}"function"==typeof s.constructor.component&&this._componentManager.push(function(t,e){return e&&(e=t.component?.call(this,e))?{target:e,pluginName:t.key,options:t.options}:null}.bind(s,s.constructor));const e=s.constructor.options||{};if(this._onPluginEvents.forEach(((t,i)=>{if("function"==typeof s[i]){const n=s[i].bind(s);n.index=e[`eventIndex_${i}`]||e.eventIndex||0,t.push(n)}})),s.retainFormat){const t=s.retainFormat();this._MELInfo.set(t.query,{key:s.constructor.key,method:t.method})}}(this.options.get("buttons").has("pageBreak")||this.options.get("buttons_sub")?.has("pageBreak"))&&this._componentManager.push((t=>t&&xt.utils.hasClass(t,"se-page-break")?{target:t,launcher:{destroy:t=>{const e=t.previousElementSibling||t.nextElementSibling;xt.utils.removeItem(t),this.focusEdge(e),this.history.push(!1)}}}:null)),this._fileManager.regExp=new RegExp(`^(${this._fileManager.tags.join("|")||"\\^"})$`,"i"),this._fileManager.pluginRegExp=new RegExp(`^(${0===i.length?"\\^":i.join("|")})$`,"i"),delete this._pluginCallButtons,delete this._pluginCallButtons_sub,this.__cachingButtons(),this.__cachingShortcuts()},__cachingButtons(){const t=this.context;this.__setDisabledButtons(),this.__saveCommandButtons(this.allCommandButtons,t.get("toolbar_buttonTray")),this.__saveCommandButtons(this.subAllCommandButtons,t.get("toolbar_sub_buttonTray"))},__setDisabledButtons(){const t=this.context;this._codeViewDisabledButtons=wt.nodeListToArray(t.get("toolbar_buttonTray").querySelectorAll(Mn)),this._controllerOnDisabledButtons=wt.nodeListToArray(t.get("toolbar_buttonTray").querySelectorAll(Nn)),this.options.has("_subMode")&&(this._codeViewDisabledButtons=this._codeViewDisabledButtons.concat(wt.nodeListToArray(t.get("toolbar_sub_buttonTray").querySelectorAll(Mn))),this._controllerOnDisabledButtons=this._controllerOnDisabledButtons.concat(wt.nodeListToArray(t.get("toolbar_sub_buttonTray").querySelectorAll(Nn))))},__saveCommandButtons(t,e){if(!e)return;const i=e.querySelectorAll(Ln),s=this.options.get("shortcuts"),n=this.options.get("_reverseCommandArray"),o=this.shortcutsKeyMap,l=this.reverseKeys;for(let e,r,a=0,h=i.length;a<h;a++)e=i[a],r=e.getAttribute("data-command"),t.set(r,e),this.__setCommandTargets(r,e),Ft(r,e,s[r],o,n,l)},__cachingShortcuts(){const t=this.options.get("shortcuts"),e=this.options.get("_reverseCommandArray"),i=this.shortcutsKeyMap,s=this.reverseKeys;for(const n of Object.keys(t))n.startsWith("_")&&Ft("",null,t[n],i,e,s)},__setCommandTargets(t,e){if(!t||!e)return;(ne.includes(t)||this.plugins[t])&&(this.commandTargets.get(t)?this.commandTargets.get(t).includes(e)||this.commandTargets.get(t).push(e):this.commandTargets.set(t,[e]))},__setIframeDocument(t,e,i){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(i.get("iframe_cssFileName"))+wt._setAutoHeightStyle(i.get("height")),t.contentDocument.body.className=e.get("_editableClass"),t.contentDocument.body.setAttribute("contenteditable","true")},__setEditorParams(t){const e=t.get("options"),i=this._w;if(t.set("wwComputedStyle",i.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",i),t.set("_wd",this._d));const s=e.get("editableFrameAttributes");for(const e in s)t.get("wysiwyg").setAttribute(e,s[e])},__registerClass(){this.events=this.options.get("events")||{},this.triggerEvent=async(t,e)=>{if(xt.check.isNonEditable(e?.frameContext?.get("wysiwyg")))return!1;const i=this.events[t];return"function"==typeof i?await i({editor:this,...e}):_t.NO_EVENT},this.history=le(this),this.eventManager=new qi(this),this.instanceCheck=new Xi(this),this.offset=new cn(this),this.shortcuts=new mn(this),this.toolbar=new yn(this,{keyName:"toolbar",balloon:this.isBalloon,balloonAlways:this.isBalloonAlways,inline:this.isInline,res:this._responsiveButtons}),this.options.has("_subMode")&&(this.subToolbar=new yn(this,{keyName:"toolbar_sub",balloon:this.isSubBalloon,balloonAlways:this.isSubBalloonAlways,inline:!1,res:this._responsiveButtons_sub})),this.selection=new pn(this),this.html=new Zs(this),this.nodeTransform=new an(this),this.component=new zs(this),this.format=new Ds(this),this.inline=new js(this),this.listFormat=new Js(this),this.menu=new ln(this),this.char=new ts(this),this.ui=new xn(this),this.viewer=new Hn(this),Ki.call(this.eventManager,this),Ki.call(this.char,this),Ki.call(this.component,this),Ki.call(this.format,this),Ki.call(this.html,this),Ki.call(this.inline,this),Ki.call(this.listFormat,this),Ki.call(this.menu,this),Ki.call(this.nodeTransform,this),Ki.call(this.offset,this),Ki.call(this.selection,this),Ki.call(this.shortcuts,this),Ki.call(this.toolbar,this),Ki.call(this.ui,this),Ki.call(this.viewer,this),this.options.has("_subMode")&&Ki.call(this.subToolbar,this),delete this.eventManager.eventManager,delete this.char.char,delete this.component.component,delete this.format.format,delete this.html.html,delete this.inline.inline,delete this.listFormat.listFormat,delete this.menu.menu,delete this.nodeTransform.nodeTransform,delete this.offset.offset,delete this.selection.selection,delete this.shortcuts.shortcuts,delete this.toolbar.toolbar,delete this.ui.ui,delete this.viewer.viewer,this.subToolbar&&delete this.subToolbar.subToolbar,this._responsiveButtons=this._responsiveButtons_sub=null},async __Create(t){this.isInline=/inline/i.test(this.options.get("mode")),this.isBalloon=/balloon/i.test(this.options.get("mode")),this.isBalloonAlways=/balloon-always/i.test(this.options.get("mode")),this.isClassic=/classic/i.test(this.options.get("mode")),this.isSubBalloon=/balloon/i.test(this.options.get("_subMode")),this.isSubBalloonAlways=/balloon-always/i.test(this.options.get("_subMode")),this.__registerClass(),this.eventManager._addCommonEvents();const e=[];this.applyFrameRoots((t=>{const i=t.get("originElement"),s=t.get("topArea");if(i.style.display="none",s.style.display="block",i.parentNode.insertBefore(s,i.nextElementSibling),t.get("options").get("iframe")){const i=new Promise((e=>{this.eventManager.addEvent(t.get("wysiwygFrame"),"load",(({target:i})=>{this.__setIframeDocument(i,this.__options,t.get("options")),e()}))}));e.push(i)}})),this.applyFrameRoots((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.__editorInit(t)},Constructor:An};const On=An;async function Rn(t,e,i){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.ui.hideLoading()}else{console.error(`[SUNEDITOR.ApiManager[${this.kind}].upload.serverException]`,t);try{const e=t.responseText?JSON.parse(t.responseText):t;let s="";"function"==typeof i&&(s=await i(e,t));const n=`[SUNEDITOR.ApiManager[${this.kind}].upload.serverException] status: ${t.status}, response: ${s||e.errorMessage||t.responseText}`;this.ui.alertOpen(n,"error")}catch(t){throw Error(`[SUNEDITOR.ApiManager[${this.kind}].upload.errorCallBack.fail] ${t.message}`)}finally{this.ui.hideLoading()}}}const Fn=class extends re{#Nt;constructor(t,e){super(t.editor),this.ui=this.editor.ui,this.kind=t.constructor.key||t.constructor.name,this.#Nt=_t.getXMLHttpRequest(),this.method=e?.method,this.url=e?.url,this.headers=e?.headers,this.data=e?.data,this.callBack=e?.callBack,this.errorCallBack=e?.errorCallBack,this.responseType=e?.responseType}call({method:t,url:e,headers:i,data:s,callBack:n,errorCallBack:o,responseType:l}){if(this.cancel(),t||=this.method,e=this.#At(e||this.url),i||=this.headers,s||=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.#Nt;if(l&&(r.responseType=l),r.onreadystatechange=Rn.bind(this,r,n,o),r.open(t,e,!0),null!==i&&"object"==typeof i&&Object.keys(i).length>0)for(const t in i)r.setRequestHeader(t,i[t]);r.send(s)}asyncCall({method:t,url:e,headers:i,data:s,responseType:n}){this.cancel(),t||=this.method,e=this.#At(e||this.url),i||=this.headers,s||=this.data,n||=this.responseType;const o=this.#Nt;return n&&(o.responseType=n),new Promise(((n,l)=>{if(o.open(t,e,!0),null!==i&&"object"==typeof i&&Object.keys(i).length>0)for(const t in i)o.setRequestHeader(t,i[t]);o.onload=()=>{if(200===o.status)try{n(o)}finally{this.ui.hideLoading()}else try{const t=o.responseText?JSON.parse(o.responseText):o;l(t)}finally{this.ui.hideLoading()}},o.onerror=()=>{this.ui.hideLoading(),l(new Error("Network error"))},o.send(s)}))}cancel(){this.#Nt&&this.#Nt.abort()}#At(t){return t.replace(/([^:])\/+/g,"$1/").replace(/\/(\?|#|$)/,"$1")}};function zn(t){const e=t.src.split("/").pop(),i=t.thumbnail||"",s=i||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="${i}" data-extension="${t.src.split(".").pop()}" ${n}`,l=`class="${i||"se-browser-empty-image"}" src="${s}" alt="${t.alt||e}" ${o}`;return`\n\t\t<div class="se-file-item-img">\n\t\t\t${this.thumbnail&&!i&&"image"!==t.type?`<div class="se-browser-empty-thumbnail" ${l}>${this.thumbnail(t)}</div>`:`<img class="${i||"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 $n=class extends re{#Bt;#Vt;#It;#Ot;constructor(t,e){super(t.editor),this.offset=this.editor.offset,this.useSearch=e.useSearch??!0;const i=xt.utils.createElement("DIV",{class:"se-browser sun-editor-common"+(e.className?` ${e.className}`:"")}),s=function(t,e){const i=t.lang,s=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="${i.close}" aria-label="${i.close}">\n\t\t\t\t\t${s.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">${s.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="${i.search}" aria-label="${i.search}">\n\t\t\t\t\t\t\t\t\t\t\t<button type="submit" class="se-btn" title="${i.search}" aria-label="${i.search}">${s.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=xt.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")}}(t.editor,this.useSearch),n=s.html;this.kind=t.constructor.key||t.constructor.name,this.inst=t,this.area=i,this.header=s.header,this.titleArea=s.titleArea,this.tagArea=s.tagArea,this.body=s.body,this.list=s.list,this.side=s.side,this.wrapper=s.wrapper,this.#Bt=s._loading,this.title=e.title,this.listClass=e.listClass||"se-preview-list",this.directData=e.data,this.url=e.url,this.urlHeader=e.headers,this.searchUrl=e.searchUrl,this.searchUrlHeader=e.searchUrlHeader,this.drawItemHandler=(e.drawItemHandler||zn).bind({thumbnail:e.thumbnail,props:e.props||[]}),this.selectorHandler=e.selectorHandler,this.columnSize=e.columnSize||4,this.folderDefaultPath="",this.closeArrow=this.icons.menu_arrow_right,this.openArrow=this.icons.menu_arrow_down,this.icon_folder=this.icons.side_menu_folder_item,this.icon_folder_item=this.icons.side_menu_folder,this.icon_item=this.icons.side_menu_item,this.items=[],this.folders={},this.tree={},this.data={},this.selectedTags=[],this.keyword="",this.sideInner=null,this.apiManager=new Fn(this,{method:"GET"}),this.#Vt=!1,this.#It=null,this.#Ot=t=>{Et.isEsc(t.code)&&this.close()},i.appendChild(xt.utils.createElement("DIV",{class:"se-browser-back"})),i.appendChild(n),this.carrierWrapper.appendChild(i),this.eventManager.addEvent(this.tagArea,"click",this.#Rt.bind(this)),this.eventManager.addEvent(this.list,"click",this.#Ft.bind(this)),this.eventManager.addEvent(this.side,"click",this.#zt.bind(this)),this.eventManager.addEvent(n,"mousedown",this.#$t.bind(this)),this.eventManager.addEvent(n,"click",this.#Pt.bind(this)),this.eventManager.addEvent(i.querySelector("form.se-browser-search-form"),"submit",this.#Dt.bind(this)),this.eventManager.addEvent(this.sideOpenBtn=i.querySelector(".se-side-open-btn"),"click",this.#qt.bind(this)),this.eventManager.addEvent([this.header,i.querySelector(".se-browser-main")],"mousedown",this.#Wt.bind(this))}open(t={}){this.#f();const e=t.listClass||this.listClass;xt.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.editor.opendBrowser=this,this.closeArrow=this.options.get("_rtl")?this.icons.menu_arrow_left:this.icons.menu_arrow_right,this.directData?this.#Ut(this.directData):this.#Zt(t.url||this.url,t.urlHeader||this.urlHeader,!1),this.body.style.maxHeight=xt.utils.getClientSize().h-(this.offset.getGlobal(this.body).top-n.scrollY)-20+"px"}close(){this.#_(),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.editor.opendBrowser=null,this.sideInner=null,this.inst.browserInit?.()}search(t){this.searchUrl?(this.keyword=t,this.#Zt(this.searchUrl+"?keyword="+t,this.searchUrlHeader,!1)):(this.keyword=t.toLowerCase(),this.#Gt(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.#Bt.style.display="block"}closeBrowserLoading(){this.#Bt.style.display="none"}#Zt(t,e,i){this.apiManager.call({method:"GET",url:t,headers:e,callBack:this.#Yt.bind(this),errorCallBack:this.#jt.bind(this)}),i||(this.sideOpenBtn.style.display="none",this.showBrowserLoading())}#Gt(t,e){const i=this.keyword,s=[],n=(t=this.tagfilter(t).filter((t=>t.name.toLowerCase().indexOf(i)>-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 i,d,u=0;u<n;u++)if(i=t[u],d=i.tag?"string"==typeof i.tag?i.tag.split(","):i.tag:[],d=i.tag=d.map((t=>t.trim())),h+=r(i),(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,i=d.length;e<i;e++)t=d[e],t&&!s.includes(t)&&(s.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)}#f(){this.#_(),this.#It=this.eventManager.addGlobalEvent("keydown",this.#Ot,!0)}#_(){this.#It&&=this.eventManager.removeGlobalEvent(this.#It)}#Ut(t){if(Array.isArray(t))return t.length>0&&this.#Gt(t,!0),!0;if("object"==typeof t){this.sideOpenBtn.style.display="",this.#Xt(t),this.side.innerHTML="";const e=this.sideInner=xt.utils.createElement("div",null);if(this.#Kt(this.tree,e),this.side.appendChild(e),this.folderDefaultPath){const t=e.querySelector(`[data-command="${this.folderDefaultPath}"]`);t.click(),this.folderDefaultPath.includes("/")&&(xt.utils.removeClass(t.parentElement,"se-menu-hidden"),t.parentElement.previousElementSibling.querySelector("button").innerHTML=this.openArrow)}return!0}return!1}#Xt(t,e){let i=this.tree;if(t._data){this.data[e]=t._data,this.folderDefaultPath&&!t.default||(this.folderDefaultPath=e);const s=e.split("/"),n=s.length-1;s.forEach(((t,s)=>{i[t]||={children:{}},s===n?(i[t].key=e,i[t].name=this.folders[e].name):i=i[t].children}))}else e&&(i[e]={name:this.folders[e].name,children:{}});Object.entries(t).forEach((([t,i])=>{if("_data"===t||!i||"object"!=typeof i)return;const s=i,n=e?`${e}/${t}`:t;this.folders[n]={name:s.name||t,meta:s.meta||{}},this.#Xt(s,n)}))}#Kt(t,e){for(const i in t){const s=t[i];if(s)if(Object.keys(s.children).length>0){const t=xt.utils.createElement("div",s.key?{"data-command":s.key,"aria-label":s.name}:null,`<span class="se-menu-icon">${s.key?this.icon_folder:this.icon_folder_item}</span><span>${s.name}</span>`),i=xt.utils.createElement("div",{class:"se-menu-folder"},t);t.insertBefore(xt.utils.createElement("button",null,this.closeArrow),t.firstElementChild);const n=document.createElement("div");xt.utils.addClass(n,"se-menu-child|se-menu-hidden"),this.#Kt(s.children,n),i.appendChild(n),e.appendChild(i)}else{const t=xt.utils.createElement("div",{"data-command":s.key,"aria-label":s.name,class:"se-menu-folder-item"},`<span class="se-menu-icon">${this.icon_item}</span><span>${s.name}</span>`);if(e===this.sideInner){const i=xt.utils.createElement("div",{class:"se-menu-folder"},t);e.appendChild(i)}else e.appendChild(t)}}}#Yt(t){try{const e=JSON.parse(t.responseText),i=e.result;if(this.#Ut(i))return;e.nullMessage&&(this.list.innerHTML=e.nullMessage)}catch(t){throw Error(`[SUNEDITOR.browser.drawList.fail] cause: "${t.message}"`)}finally{this.closeBrowserLoading()}}#jt(t,e){throw this.closeBrowserLoading(),Error(`[SUNEDITOR.browser.get.serverException] status: ${e.status}, response: ${t.errorMessage||e.responseText}`)}#Rt(t){const e=xt.query.getEventTarget(t);if(!xt.check.isAnchor(e))return;const i=e.textContent,s=this.tagArea.querySelector('a[title="'+i+'"]'),n=this.selectedTags.indexOf(i);n>-1?(this.selectedTags.splice(n,1),xt.utils.removeClass(s,"on")):(this.selectedTags.push(i),xt.utils.addClass(s,"on")),this.#Gt(this.items,!1)}#Ft(t){const e=xt.query.getEventTarget(t);if(t.preventDefault(),t.stopPropagation(),e===this.list)return;const i=xt.query.getCommandTarget(e);i&&(this.close(),this.selectorHandler(i))}#zt(t){const e=xt.query.getEventTarget(t);if(t.stopPropagation(),/^button$/i.test(e.nodeName)){const t=e.parentElement.parentElement.querySelector(".se-menu-child");return void(xt.utils.hasClass(t,"se-menu-hidden")?(xt.utils.removeClass(t,"se-menu-hidden"),e.innerHTML=this.openArrow):(xt.utils.addClass(t,"se-menu-hidden"),e.innerHTML=this.closeArrow))}const i=xt.query.getCommandTarget(e);if(!i||xt.utils.hasClass(i,"active"))return;const s=this.data[i.getAttribute("data-command")];xt.utils.removeClass(this.side.querySelectorAll(".active"),"active"),xt.utils.addClass([i,xt.query.getParentElement(i,".se-menu-folder")],"active"),this.tagArea.innerHTML="","string"==typeof s?this.#Zt(s,this.urlHeader,!0):this.#Gt(s,!1)}#$t(t){const e=xt.query.getEventTarget(t);/se-browser-inner/.test(e.className)?this.#Vt=!0:this.#Vt=!1}#Pt(t){const e=xt.query.getEventTarget(t);t.stopPropagation(),(/close/.test(e.getAttribute("data-command"))||this.#Vt)&&this.close()}#Dt(t){const e=t.currentTarget;t.preventDefault(),this.search(e.querySelector('input[type="text"]').value)}#qt(t){const e=xt.query.getEventTarget(t);xt.utils.hasClass(e,"active")?(xt.utils.removeClass(this.side,"se-side-show"),xt.utils.removeClass(e,"active")):(xt.utils.addClass(this.side,"se-side-show"),xt.utils.addClass(e,"active"))}#Wt({target:t}){t!==this.sideOpenBtn&&xt.utils.hasClass(this.sideOpenBtn,"active")&&(xt.utils.removeClass(this.side,"se-side-show"),xt.utils.removeClass(this.sideOpenBtn,"active"))}},{isTouchDevice:Pn}=_t,Dn=240,qn=120,Wn={hex:"#FFFFFF",r:255,g:255,b:255,h:0,s:1,l:1};let Un,Zn=0,Gn=!1,Yn=!1,jn=120,Xn=120,Kn=Wn,Jn=!1;const{slider:Qn,offscreenCanvas:to,offscreenCtx:eo,wheel:io,wheelCtx:so,wheelPointer:no,gradientBar:oo,gradientPointer:lo,fanalColorHex:ro,fanalColorBackground:ao}=function(){const t=document.createElement("canvas");t.width=Dn,t.height=Dn;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;">${Wn.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`,i=xt.utils.createElement("DIV",{class:"se-hue-slider"},e),s=i.querySelector(".se-hue-wheel"),n=i.querySelector(".se-hue-gradient"),o=i.querySelector(".se-hue-final-hex").children;return{slider:i,offscreenCanvas:t,offscreenCtx:t.getContext("2d"),wheel:s,wheelCtx:s.getContext("2d"),wheelPointer:i.querySelector(".se-hue-wheel-pointer"),gradientBar:n,gradientPointer:i.querySelector(".se-hue-gradient-pointer"),fanalColorHex:o[0],fanalColorBackground:o[1]}}();function ho(t){const{target:e,touches:i}=t,s=i[0].clientX,n=i[0].clientY;e===io?(t.preventDefault(),Yn=!1,Gn=!0,go(s,n)):e===oo&&(t.preventDefault(),Yn=!0,Gn=!1,mo(s))}function co(t){t.preventDefault();const{touches:e}=t,i=e[0].clientX,s=e[0].clientY;Gn?go(i,s):Yn&&mo(i)}function uo({target:t,clientX:e,clientY:i}){t===io?(Yn=!1,Gn=!0,go(e,i)):t===oo&&(Yn=!0,Gn=!1,mo(e))}function po({clientX:t,clientY:e}){Gn?go(t,e):Yn&&mo(t)}function go(t,e){const i=io.getBoundingClientRect();t=t-i.left-qn,e=e-i.top-qn;const s=180*Math.atan2(e,t)/Math.PI,n=Math.min(Math.sqrt(t*t+e*e),qn),o=qn+n*Math.cos(s*Math.PI/180),l=qn+n*Math.sin(s*Math.PI/180);no.style.left=`${o}px`,no.style.top=`${l}px`,function(t,e){jn=t,Xn=e,fo(bo())}(o,l),yo()}function mo(t){const e=oo.getBoundingClientRect();let i=t-e.left;i=Math.max(14,Math.min(i,e.width-14)),lo.style.left=`${i}px`,function(t){const e=oo.getBoundingClientRect();let i=t-e.left;i<0&&(i=0);i>e.width&&(i=e.width);const s=14;i>=oo.width-s?i=oo.width:i<=s&&(i=0);const n=1-i/e.width;Zn=n,Co()}(t),yo()}function fo(t){const e=oo.getContext("2d"),i=e.createLinearGradient(0,0,oo.width,0);i.addColorStop(0,"black"),i.addColorStop(1,t.hex),e.fillStyle=i,e.fillRect(0,0,oo.width,oo.height)}function bo(){return _o(eo)}function yo(){Un.color=Kn=_o(so),vo(Kn.hex)}function vo(t){ao.style.backgroundColor=ro.textContent=t}function _o(t){const e=t.getImageData(jn,Xn,1,1).data;let[i,s,n]=function([t,e,i]){t/=255,e/=255,i/=255;const s=Math.max(t,e,i),n=Math.min(t,e,i);let o,l;const r=(s+n)/2;if(s===n)o=l=0;else{const a=s-n;switch(l=r>.5?a/(2-s-n):a/(s+n),s){case t:o=(e-i)/a+(e<i?6:0);break;case e:o=(i-t)/a+2;break;case i:o=(t-e)/a+4}o/=6}return[xo(o),xo(l),xo(r)]}(e);const o=jn-qn,l=Xn-qn;Math.sqrt(o*o+l*l)<3&&(n=1-Zn),n>1&&(n=1),n<0&&(n=0);const{r,g:a,b:h}=function([t,e,i]){let s,n,o;if(0===e)s=n=o=i;else{const l=function(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t},r=i<.5?i*(1+e):i+e-i*e,a=2*i-r;s=l(a,r,t+1/3),n=l(a,r,t),o=l(a,r,t-1/3)}return{r:Math.round(255*s),g:Math.round(255*n),b:Math.round(255*o)}}([i,s,n]),c=`#${function({r:t,g:e,b:i}){let s=Math.floor(t).toString(16);t<16&&(s=`0${s}`);let n=Math.floor(e).toString(16);e<16&&(n=`0${n}`);let o=Math.floor(i).toString(16);i<16&&(o=`0${o}`);return`${s}${n}${o}`.toUpperCase()}({r,g:a,b:h})}`;return{hex:c,r,g:a,b:h,h:i,s,l:xo(n)}}function Co(){so.clearRect(0,0,Dn,Dn),so.drawImage(to,0,0),so.globalAlpha=Zn,so.fillStyle="black",so.beginPath(),so.arc(qn,qn,qn,0,2*Math.PI),so.fill(),so.globalAlpha=1}function wo(t){return t*Math.PI/180}function xo(t){const e=Math.pow(10,10);return Math.round(t*e)/e}function ko(){!function(t){if(!t)return void console.warn("[HueSlider.fail] Context not found.");for(let e=0;e<=360;e+=.5)for(let i=0;i<=qn;i+=1){t.beginPath();const s=50+(qn-i)/qn*50;t.fillStyle=`hsl(${e}, 100%, ${s}%)`;const n=qn+Math.cos(wo(e))*i,o=qn-Math.sin(wo(e))*i;t.arc(n,o,1.5,0,2*Math.PI),t.fill()}Jn=!0}(eo),Jn&&Co()}ko();const Eo=class extends re{#Jt;#Qt;#te;#ee;#ie;#se;constructor(t,e={},i=""){if(super(t.editor),this.inst=t,this.ctx={wheelX:jn,wheelY:Xn,lightness:Zn,wheelPointerX:"50%",wheelPointerY:"50%",gradientPointerX:"calc(100% - 14px)",color:Wn},this.isOpen=!1,this.controlle=null,this.#Jt=null,this.#Qt=null,this.#te=null,this.#ee=null,this.#ie=null,this.#se=null,!e.isNewForm){const s=function({lang:t,icons:e},i){const s=xt.utils.createElement("DIV",{class:`se-controller ${i}`},`\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 s}(t.editor,i);this.circle=s.querySelector(".se-hue"),this.controller=new as(this,s,{position:"bottom",isWWTarget:!1,parents:[t.form],parentsHide:!0,...e.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 Kn}open(t){this.attach(),this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null})}close(){this.ctx={gradientPointerX:lo.style.left,wheelPointerX:no.style.left,wheelPointerY:no.style.top,wheelX:jn,wheelY:Xn,lightness:Zn,color:Un?.color||""},this.controller.close()}attach(t){Jn||ko(),this.init(),(t||this.circle).appendChild(Qn),Un=this.ctx,Un&&(jn=Un.wheelX,Xn=Un.wheelY,Zn=Un.lightness,no.style.left=Un.wheelPointerX,no.style.top=Un.wheelPointerY,lo.style.left=Un.gradientPointerX,vo(Un.color.hex),Co(),fo(bo())),Pn&&(this.#ie=this.eventManager.addGlobalEvent("touchstart",ho,{passive:!1,capture:!0}),this.#Qt=this.eventManager.addGlobalEvent("touchmove",co,!0),this.#se=this.eventManager.addGlobalEvent("touchend",(()=>{Gn=!1,Yn=!1}),!0)),this.#Jt=this.eventManager.addGlobalEvent("mousedown",uo,{passive:!1,capture:!0}),this.#ee=this.eventManager.addGlobalEvent("mousemove",po,!0),this.#te=this.eventManager.addGlobalEvent("mouseup",(()=>{Gn=!1,Yn=!1}),!0),this.isOpen=!0}init(){this.isOpen=!1,Gn=!1,Yn=!1,this.#Jt&&=this.eventManager.removeGlobalEvent(this.#Jt),this.#ee&&=this.eventManager.removeGlobalEvent(this.#ee),this.#te&&=this.eventManager.removeGlobalEvent(this.#te),this.#ie&&=this.eventManager.removeGlobalEvent(this.#ie),this.#Qt&&=this.eventManager.removeGlobalEvent(this.#Qt),this.#se&&=this.eventManager.removeGlobalEvent(this.#se)}},So=["#ff0000","#ff5e00","#ffe400","#abf200","#00d8ff","#0055ff","#6600ff","#ff00dd","#000000","#ffd8d8","#fae0d4","#faf4c0","#e4f7ba","#d4f4fa","#d9e5ff","#e8d9ff","#ffd9fa","#f1f1f1","#ffa7a7","#ffc19e","#faed7d","#cef279","#b2ebf4","#b2ccff","#d1b2ff","#ffb2f5","#bdbdbd","#f15f5f","#f29661","#e5d85c","#bce55c","#5cd1e5","#6699ff","#a366ff","#f261df","#8c8c8c","#980000","#993800","#998a00","#6b9900","#008299","#003399","#3d0099","#990085","#353535","#670000","#662500","#665c00","#476600","#005766","#002266","#290066","#660058","#222222"];function To(t,e){const i=`<ul class="se-color-pallet${e?" se-list-horizontal":""}">`;let s=i;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&&(s+=`</ul>${i}`),s+=`<li><button type="button" data-value="${o}" title="${l}" aria-label="${l}" style="background-color:${o};"></button></li>`;return s+="</ul>",s}const Ho=class extends re{constructor(t,e,i){const s=t.editor;super(s),this.kind=t.constructor.key||t.constructor.name,this.inst=t,this.form=i.form,this.target=function({lang:t,icons:e},{colorList:i,disableHEXInput:s,disableRemove:n,splitNum:o}){i||=So,o=i===So?9:o;let l="";for(let t,e=0,s=i.length,n=[];e<s;e++)t=i[e],t&&(("string"==typeof t||t.value)&&(n.push(t),e<s-1)||(n.length>0&&(l+=`<div class="se-selector-color">${To(n,o)}</div>`,n=[]),"object"==typeof t&&(l+=`<div class="se-selector-color">${To(t,o)}</div>`)));return l+=`\n\t\t<form class="se-form-group se-form-w0">\n\t\t\t${s?"":`<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" ${s?"readonly":""} placeholder="${t.color}" />\n\t\t\t${s?"":`<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>`,xt.utils.createElement("DIV",{class:"se-list-inner"},l)}(s,i),this.targetButton=null,this.inputElement=this.target.querySelector(".se-color-input"),this.styleProperties=e,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.icons.color_checked,"image/svg+xml");this.checkedIcon=n.documentElement,i.disableHEXInput||(this.hueSlider=new Eo(this,i.hueSliderOptions,"se-dropdown"),this.eventManager.addEvent(this.target.querySelector(".__se_hue"),"click",this.#ne.bind(this)),this.eventManager.addEvent(this.inputElement,"input",this.#oe.bind(this)),this.eventManager.addEvent(this.target.querySelector("form"),"submit",this.#le.bind(this))),i.disableRemove||this.eventManager.addEvent(this.target.querySelector(".__se_remove"),"click",this.#re.bind(this)),this.eventManager.addEvent(this.target,"click",this.#ae.bind(this)),this.form.appendChild(this.target)}init(t,e,i){this.targetButton=e,"function"!=typeof i&&(i=()=>!1);let s=("string"==typeof t?t:this.#he(t,i))||this.defaultColor;s=wt.isHexColor(s)?s:wt.rgb2hex(s)||s||"";const n=this.colorList;for(let t,e=0,i=n.length;e<i;e++)t=n[e],s.toLowerCase()===t.getAttribute("data-value").toLowerCase()?(t.appendChild(this.checkedIcon),xt.utils.addClass(t,"active")):(xt.utils.removeClass(t,"active"),t.contains(this.checkedIcon)&&xt.utils.removeItem(this.checkedIcon));this.#ce(this.#de(s))}setHexColor(t){this.currentColor=t,this.inputElement.style.borderColor=t}hueSliderClose(){this.hueSlider.close()}hueSliderAction(t){this.#ce(t.hex)}hueSliderCancelAction(){this.form.style.display="block",this.inst.colorPickerHueSliderClose?.()}#ce(t){t=!t||/^#/.test(t)?t:"#"+t,this.inputElement.value=t,this.setHexColor.call(this,t)}#he(t,e){let i="";const s=this.styleProperties;for(;t&&!e(t)&&!xt.check.isWysiwygFrame(t)&&0===i.length;)R(t)&&t.style[s]&&(i=t.style[s]),t=t.parentNode;return i}#de(t){if(!t||/^#/.test(t))return t;const e=xt.utils.createElement("div",{style:"display: none; color: "+t}),i=this._w.getComputedStyle(this._d.body.appendChild(e)).color.match(/\d+/g).map((function(t){return parseInt(t,10)}));return xt.utils.removeItem(e),i.length>=3?"#"+((1<<24)+(i[0]<<16)+(i[1]<<8)+i[2]).toString(16).substring(1):""}#ne(){this.hueSlider.open(this.targetButton),this.inst.colorPickerHueSliderOpen?.()}#le(t){t.preventDefault(),this.inst.colorPickerAction?.(this.currentColor)}#ae(t){const e=xt.query.getEventTarget(t).getAttribute("data-value");e&&this.inst.colorPickerAction?.(e)}#re(){this.inst.colorPickerAction?.(null)}#oe(t){const e=xt.query.getEventTarget(t);this.setHexColor(e.value)}},{_w:Lo}=_t,Mo={w:"ns-resize",h:"ew-resize",c:"nwse-resize",wRTL:"ns-resize",hRTL:"ew-resize",cRTL:"nesw-resize"};const No=class extends re{#ue;#pe;#ge;#me;#It;#Vt;#fe;#be;#ye;#ve;#i;#_e;#Ce;constructor(t,e){super(t.editor),this.ui=this.editor.ui,this.offset=this.editor.offset,this.inst=t,this.kind=t.constructor.key||t.constructor.name,this.form=e,this.isUpdate=!1,this.focusElement=e.querySelector("[data-focus]"),this.#ue=this.carrierWrapper.querySelector(".se-modal"),this.#pe=this.carrierWrapper.querySelector(".se-modal .se-modal-inner"),this.#me=[this.#we.bind(this),this.#xe.bind(this)],this.#It=null,this.#Vt=!1,this.#ge=null,this.#pe.appendChild(e),this.eventManager.addEvent(e.querySelector("form"),"submit",this.#p.bind(this)),this.#Vt=!this.eventManager.addEvent(e.querySelector('[data-command="close"]'),"click",this.close.bind(this)),(e.querySelector(".se-modal-resize-handle-w")||e.querySelector(".se-modal-resize-handle-h")||e.querySelector(".se-modal-resize-handle-c")||e.querySelector(".se-modal-resize-form"))&&!(this.#ge=e.querySelector(".se-modal-resize-form"))&&(this.#ge=e.querySelector(".se-modal-body"))&&(this.eventManager.addEvent(e.querySelector(".se-modal-resize-handle-w"),"mousedown",this.#ke.bind(this,"w")),this.eventManager.addEvent(e.querySelector(".se-modal-resize-handle-h"),"mousedown",this.#ke.bind(this,"h")),this.eventManager.addEvent(e.querySelector(".se-modal-resize-handle-c"),"mousedown",this.#ke.bind(this,"c")),this.#fe=null,this.#be="",this.#ye=0,this.#ve=0,this.#i={mousemove:this.#Ee.bind(this),mouseup:this.#Se.bind(this)},this.#_e=null,this.#Ce=null)}static CreateFileInput({icons:t,lang:e},{acceptedFormats:i,allowMultiple:s}){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="${i}"${s?' 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${xt.utils.createTooltipInner(e.remove)}\n\t\t\t</button>\n\t\t</div>`}static OnChangeFile(t,e){if(!t||!e)return;const i=t.querySelector(".se-input-file-cnt"),s=t.querySelector(".se-input-file-icon-up"),n=t.querySelector(".se-input-file-icon-files");e.length>1?(s.style.display="none",n.style.display="inline-block",i.style.display="",i.textContent=` ..${e.length}`):e.length>0?(s.style.display="none",n.style.display="none",i.style.display="block",i.textContent=e[0].name):(s.style.display="inline-block",n.style.display="none",i.style.display="",i.textContent="")}open(){if(this.ui._offCurrentModal(),this.#Te(!0),this.#Vt&&this.#pe.addEventListener("click",this.#me[1]),this.#It&&=this.eventManager.removeGlobalEvent(this.#It),this.#It=this.eventManager.addGlobalEvent("keydown",this.#me[0]),this.isUpdate=this.kind===this.editor.currentControllerName,this.editor.opendModal=this,this.isUpdate||this.inst.modalInit?.(),this.inst.modalOn?.(this.isUpdate),xt.utils.addClass(this.#ue,"se-backdrop-show"),xt.utils.addClass(this.form,"se-modal-show"),this.#ge){const t=this.#He(),{maxWidth:e,maxHeight:i}=Lo.getComputedStyle(this.form),s=this.form.offsetWidth-t.width+"px",n=`${this.form.offsetTop+(this.form.offsetHeight-this.#ge.offsetHeight)}px`;e&&"string"==typeof this.#be&&xt.utils.setStyle(this.#ge,"max-width",`calc(${e} - ${s})`),i&&xt.utils.setStyle(this.#ge,"max-height",`calc(${i} - ${n})`)}this.focusElement&&this.focusElement.focus()}close(){this.#_(),this.#Te(!1),Lo.setTimeout((()=>{this.editor.opendModal=null}),0),this.#Vt&&this.#pe.removeEventListener("click",this.#me[1]),this.#It&&=this.eventManager.removeGlobalEvent(this.#It),xt.utils.removeClass(this.#ue,"se-backdrop-show"),xt.utils.removeClass(this.form,"se-modal-show"),this.inst.modalInit?.(),this.inst.modalOff?.(this.isUpdate),this.isUpdate||this.editor.focus()}#Te(t){const e=this.editor.opendControllers;for(let i=0;i<e.length;i++)e[i].fixed=t,e[i].form.style.display=t?"none":"block"}#He(){const t=this.offset.getGlobal(this.#ge);return this.#ye=t.top,this.#ve=t.left,t}#f(t){this.#_(),this.ui.enableBackWrapper(Mo[t]),this.#_e=this.eventManager.addGlobalEvent("mousemove",this.#i.mousemove,!0),this.#Ce=this.eventManager.addGlobalEvent("mouseup",this.#i.mouseup,!0)}#_(){this.ui.disableBackWrapper(),this.#_e&&=this.eventManager.removeGlobalEvent(this.#_e),this.#Ce&&=this.eventManager.removeGlobalEvent(this.#Ce)}async#p(t){t.preventDefault(),t.stopPropagation(),this.ui.showLoading();try{const t=await this.inst.modalAction();!1===t?this.ui.hideLoading():void 0===t?this.close():(this.close(),this.ui.hideLoading())}catch(t){throw this.close(),this.ui.hideLoading(),Error(`[SUNEDITOR.Modal[${this.kind}].warn] ${t.message}`)}}#xe(t){const e=xt.query.getEventTarget(t);(/close/.test(e.getAttribute("data-command"))||e===this.#pe)&&this.close()}#we(t){Et.isEsc(t.code)&&this.close()}#ke(t,e){this.#fe=xt.query.getEventTarget(e),xt.utils.addClass(this.#fe,"active"),this.#f(this.#be=t+(this.options.get("_rtl")?"RTL":""))}#Ee(t){switch(this.#be){case"w":case"wRTL":{const e=t.clientY-this.#ye-this.#ge.offsetHeight;this.#ge.style.height=this.#ge.offsetHeight+e+"px";break}case"h":{const e=t.clientX-this.#ve-this.#ge.offsetWidth;this.#ge.style.width=this.#ge.offsetWidth+e+"px";break}case"hRTL":{const e=this.#ve-t.clientX;this.#ge.style.width=this.#ge.offsetWidth+e+"px";break}case"c":{const e=t.clientX-this.#ve-this.#ge.offsetWidth,i=t.clientY-this.#ye-this.#ge.offsetHeight;this.#ge.style.width=this.#ge.offsetWidth+e+"px",this.#ge.style.height=this.#ge.offsetHeight+i+"px";break}case"cRTL":{const e=this.#ve-t.clientX,i=t.clientY-this.#ye-this.#ge.offsetHeight;this.#ge.style.width=this.#ge.offsetWidth+e+"px",this.#ge.style.height=this.#ge.offsetHeight+i+"px";break}}this.#He(),this.inst.modalResize?.()}#Se(){xt.utils.removeClass(this.#fe,"active"),this.#fe=null,this.#_()}};function Ao(t,e){const i=t.getAttribute(`data-se-${e}`);if(i)return i;const s=t.getAttribute(`data-${e}`);return s?(t.removeAttribute(`data-${e}`),t.setAttribute(`data-se-${e}`,s),s):null}const Bo=class extends re{constructor(t,e){super(t.editor),this.ui=this.editor.ui,t.__fileManagement=this,this.kind=t.constructor.key||t.constructor.name,this.inst=t,this.query=e.query,this.loadEventName=e.loadEventName,this.actionEventName=e.actionEventName,this.infoList=[],this.infoIndex=0,this.uploadFileLength=0,this.__updateTags=[],this.apiManager=new Fn(this,null),this._resetInfo,this._checkInfo}upload(t,e,i,s,n){this.ui.showLoading();let o=null;if("length"in i){o=new FormData;for(let t=0,e=i.length;t<e;t++)o.append("file-"+t,i[t]);this.uploadFileLength=i.length}else o=i.formData,this.uploadFileLength=i.size;this.apiManager.call({method:"POST",url:t,headers:e,data:o,callBack:s,errorCallBack:n})}async asyncUpload(t,e,i){this.ui.showLoading();let s=null;if("length"in i){s=new FormData;for(let t=0,e=i.length;t<e;t++)s.append("file-"+t,i[t]);this.uploadFileLength=i.length}else s=i.formData,this.uploadFileLength=i.size;return await this.apiManager.asyncCall({method:"POST",url:t,headers:e,data:s})}setFileData(t,{name:e,size:i}){t&&(t.setAttribute("data-se-file-name",e),t.setAttribute("data-se-file-size",i+""))}getSize(){let t=0;for(let e=0,i=this.infoList.length;e<i;e++)t+=1*this.infoList[e].size;return t}_checkInfo(t){const e=[].slice.call(this.frameContext.get("wysiwyg").querySelectorAll(this.query)),i=this.infoList;if(e.length===i.length){if(this.editor._componentsInfoReset){for(let t=0,i=e.length;t<i;t++)this.#Le(e[t],null);return}{let t=!1;for(let s,n=0,o=i.length;n<o;n++)if(s=i[n],0===e.filter((function(t){return s.src===t.src&&s.index.toString()===Ao(t,"index")})).length){t=!0;break}if(!t)return}}const s=[],n=[];for(let t=0,e=i.length;t<e;t++)n[t]=i[t].index;for(this.__updateTags=e;e.length>0;){const t=e.shift();Ao(t,"index")&&n.includes(Number(Ao(t,"index")))?s.push(Number(Ao(t,"index"))):(s.push(this.infoIndex),t.removeAttribute("data-se-index"),this.#Le(t,null))}if(t&&this.loadEventName)this.triggerEvent(this.loadEventName,{infoList:i});else for(let t,e=0;e<i.length;e++){if(t=i[e].index,s.includes(t))continue;i.splice(e,1);const n={editor:this.editor,element:null,index:t,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind};this.actionEventName&&this.triggerEvent(this.actionEventName,n),this.triggerEvent("onFileManagerAction",{...n,pluginName:this.kind}),e--}}_resetInfo(){const t={editor:this.editor,element:null,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind};for(let e=0,i=this.infoList.length;e<i;e++)this.actionEventName&&this.triggerEvent(this.actionEventName,{...t,index:this.infoList[e].index,pluginName:this.kind}),this.triggerEvent("onFileManagerAction",{...t,index:this.infoList[e].index,pluginName:this.kind});this.infoList=[],this.infoIndex=0}#Me(t){if(t>=0)for(let e=0,i=this.infoList.length;e<i;e++)if(t===this.infoList[e].index)return this.infoList.splice(e,1),void(this.actionEventName&&this.triggerEvent(this.actionEventName,{editor:this.editor,element:null,index:t,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind}))}#Le(t,e){let i=Number(Ao(t,"index")),s=null,n="";if(e||={name:Ao(t,"file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:Number(Ao(t,"file-size"))||0},!i||this.editor._componentsInfoInit)n="create",i=this.infoIndex++,t.setAttribute("data-se-index",i+""),t.setAttribute("data-se-file-name",e.name),t.setAttribute("data-se-file-size",e.size+""),s={src:t.src,index:i,name:e.name,size:e.size},this.infoList.push(s);else{n="update",i*=1;for(let t=0,e=this.infoList.length;t<e;t++)if(i===this.infoList[t].index){s=this.infoList[t];break}s||(i=this.infoIndex++,s={index:i},this.infoList.push(s)),s.src=t.src,s.name=Ao(t,"file-name"),s.size=Number(Ao(t,"file-size"))}s.element=t,s.delete=function(t,e){this.inst.componentDestroy?.(e),t(Number(Ao(e,"index")))}.bind(this,this.#Me.bind(this),t),s.select=function(t){t.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"});const e=this.component.get(t);e?this.component.select(e.target,e.pluginName):this.inst.componentSelect?.(t)}.bind(this,t);const o={editor:this.editor,element:t,index:i,state:n,info:s,remainingFilesCount:--this.uploadFileLength<0?0:this.uploadFileLength,pluginName:this.kind};this.actionEventName&&this.triggerEvent(this.actionEventName,o),this.triggerEvent("onFileManagerAction",{...o,pluginName:this.kind})}},{_w:Vo,NO_EVENT:Io}=_t;const Oo=class extends re{#Ne;#Ae;#Be;#Ve;constructor(t,e,i){super(t.editor),this.selection=this.editor.selection,this.ui=this.editor.ui,this.openNewWindow=!!i.openNewWindow,this.relList=Array.isArray(i.relList)?i.relList:[],this.defaultRel=i.defaultRel||{},this.noAutoPrefix=!!i.noAutoPrefix,i.enableFileUpload&&(this.uploadUrl="string"==typeof i.uploadUrl?i.uploadUrl:null,this.uploadHeaders=i.uploadHeaders||null,this.uploadSizeLimit=kt.get(i.uploadSizeLimit,0)||null,this.uploadSingleSizeLimit=kt.get(i.uploadSingleSizeLimit,0)||null,this.input=xt.utils.createElement("input",{type:"file",accept:i.acceptedFormats||"*"}),this.eventManager.addEvent(this.input,"change",this.#Ie.bind(this)),this.fileManager=new Bo(this,{query:"a[download]:not([data-se-file-download])",loadEventName:"onFileLoad",actionEventName:"onFileAction"}));const s=function(t,e,i){const s=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>${s.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="${s.fileUpload}">\n\t\t\t\t\t\t\t\t\t${n.file_upload}\n\t\t\t\t\t\t\t\t\t${xt.utils.createTooltipInner(s.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="${s.link_modal_bookmark}">\n\t\t\t\t\t\t${n.bookmark}\n\t\t\t\t\t\t${xt.utils.createTooltipInner(s.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}>${s.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}>${s.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" /> ${s.link_modal_newWindowCheck}</label>\n\t\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_anchor_download" /> ${s.link_modal_downloadLinkCheck}</label>`;i.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="${s.link_modal_relAttribute}" aria-label="${s.link_modal_relAttribute}">\n\t\t\t\t\t${n.link_rel}\n\t\t\t\t\t${xt.utils.createTooltipInner(s.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>",xt.utils.createElement("DIV",null,r)}(t.editor,i,this.relList);if(this.kink=t.constructor.key||t.constructor.name,this.inst=t,this.host=(Vo.location.origin+Vo.location.pathname).replace(/\/$/,""),this.urlInput=s.querySelector(".se-input-url"),this.displayInput=s.querySelector("._se_display_text"),this.titleInput=s.querySelector("._se_title"),this.newWindowCheck=s.querySelector("._se_anchor_check"),this.downloadCheck=s.querySelector("._se_anchor_download"),this.download=s.querySelector("._se_anchor_download_icon"),this.preview=s.querySelector(".se-link-preview"),this.bookmark=s.querySelector("._se_anchor_bookmark_icon"),this.bookmarkButton=s.querySelector("._se_bookmark_button"),this.currentRel=[],this.currentTarget=null,this.linkValue="",this.#Ae=this.relList.length>0,this.#Ae){this.relButton=s.querySelector(".se-anchor-rel-btn"),this.relPreview=s.querySelector(".se-anchor-rel-preview");const t=this.relList,e=(this.defaultRel.default||"").split(" "),i=[];for(let s,n=0,o=t.length;n<o;n++)s=t[n],i.push(xt.utils.createElement("BUTTON",{type:"button",class:"se-btn-list"+(e.includes(s)?" se-checked":""),"data-command":s,title:s,"aria-label":s},s+'<span class="se-svg">'+this.icons.checked+"</span>"));this.#Be=new cs(this,{checkList:!0,position:"right-middle",dir:"ltr"}),this.#Be.on(this.relButton,this.#Oe.bind(this)),this.#Be.create(i),this.eventManager.addEvent(this.relButton,"click",this.#Re.bind(this))}this.#Ne=e,this.#Ne.querySelector(".se-anchor-editor").appendChild(s),this.#Ve=new cs(this,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.#Ve.on(this.urlInput,this.#Fe.bind(this)),this.eventManager.addEvent(this.newWindowCheck,"change",this.#ze.bind(this)),this.eventManager.addEvent(this.downloadCheck,"change",this.#$e.bind(this)),this.eventManager.addEvent(this.urlInput,"input",this.#Pe.bind(this)),this.eventManager.addEvent(this.urlInput,"focus",this.#De.bind(this)),this.eventManager.addEvent(this.bookmarkButton,"click",this.#qe.bind(this)),this.eventManager.addEvent(s.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.#We(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.selection.get().toString().trim(),this.newWindowCheck.checked=this.openNewWindow,this.titleInput.value="";this.#Ue(t&&this.currentTarget?this.currentTarget.rel:this.defaultRel.default||""),this.#Ze(this.linkValue)}create(t){if(0===this.linkValue.length)return null;const e=this.linkValue,i=0===this.displayInput.value.length?e:this.displayInput.value,s=this.currentTarget||xt.utils.createElement("A");return this.#Ge(s,e,i,this.titleInput.value,t),this.linkValue=this.preview.textContent=this.urlInput.value=this.displayInput.value="",s}init(){this.currentTarget=null,this.linkValue=this.preview.textContent=this.urlInput.value="",this.displayInput.value="",this.newWindowCheck.checked=!1,this.downloadCheck.checked=!1,this.#Ue(this.defaultRel.default||"")}#Ge(t,e,i,s,n){!this.#We(e)&&this.downloadCheck.checked?t.setAttribute("download",i||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,s?t.title=s:t.removeAttribute("title"),n?0===t.children.length&&(t.textContent=""):t.textContent=i}#We(t){const e=Vo.location.href.replace(/\/$/,"");return 0===t.indexOf("#")||0===t.indexOf(e)&&t.indexOf("#")===(e.includes("#")?e.substring(0,e.indexOf("#")).length:e.length)}#Ue(t){if(!this.#Ae)return;const e=this.currentRel=t?t.split(" "):[],i=this.#Be.form.querySelectorAll("button");for(let t,s=0,n=i.length;s<n;s++)t=i[s].getAttribute("data-command"),e.includes(t)?xt.utils.addClass(i[s],"se-checked"):xt.utils.removeClass(i[s],"se-checked");this.relPreview.title=this.relPreview.textContent=e.join(" "),e.length>0?xt.utils.addClass(this.relButton,"on"):xt.utils.removeClass(this.relButton,"on")}#Ye(t){const e=xt.query.getListChildren(this.frameContext.get("wysiwyg"),(t=>/h[1-6]/i.test(t.nodeName)||xt.check.isAnchor(t)&&!!t.id),null);if(0===e.length)return;const i=new RegExp(`^${t.replace(/^#/,"")}`,"i"),s=[],n=[];for(let t,o=0,l=e.length;o<l;o++)t=e[o],i.test(t.textContent)&&(s.push(t),n.push(xt.check.isAnchor(t)?`<div><span class="se-text-prefix-icon">${this.icons.bookmark_anchor}</span>${t.id}</div>`:`<div style="${t.style.cssText}">${t.textContent}</div>`));0===s.length?this.#Ve.close():(this.#Ve.create(s,n),this.#Ve.open(this.options.get("_rtl")?"bottom-right":""))}#Ze(t){const e=this.preview,i=this.options.get("defaultUrlProtocol"),s=this.noAutoPrefix,n=/^(mailto:|tel:|sms:|https*:\/\/|#)/.test(t)||0===t.indexOf(i),o=!!i&&RegExp("^"+Ct.escapeStringRegexp(t.substring(0,i.length))).test(i);t=this.linkValue=e.textContent=t?s?t:!i||n||o?n?t:/^www\./.test(t)?"http://"+t:this.host+(/^\//.test(t)?"":"/")+t:i+t:"",this.#We(t)?(this.bookmark.style.display="block",xt.utils.addClass(this.bookmarkButton,"active")):(this.bookmark.style.display="none",xt.utils.removeClass(this.bookmarkButton,"active")),!this.#We(t)&&this.downloadCheck.checked?this.download.style.display="block":this.download.style.display="none"}#je(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 i=t.split(" ");for(let t=0,s=i.length;t<s;t++)e.includes(i[t])||e.push(i[t]);return e.join(" ")}#Xe(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}#Ke(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#Je(t){const e=await this.triggerEvent("onFileUploadError",{error:t});if(!1===e)return;const i=e===Io?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.fileUpload.error]",i)}#Qe(t){const e=JSON.parse(t.responseText);e.errorMessage?this.#Je(e):this.#Ke(e)}async#Ie(t){const e=xt.query.getEventTarget(t).files;if(!e[0])return;const i={url:this.uploadUrl,uploadHeaders:this.uploadHeaders,files:e},s=async function(t,e,i){e=i||e;t(await this.fileManager.asyncUpload(e.url,e.uploadHeaders,e.files))}.bind(this,this.#Qe.bind(this),i),n=await this.triggerEvent("onFileUploadBefore",{info:i,handler:s});return void 0===n||!1!==n&&(null!==n&&"object"==typeof n&&s(n),void(!0!==n&&n!==Io||s(null)))}#Re(){this.#Be.open(this.options.get("_rtl")?"left-middle":"")}#Fe(t){const e=t.id||"h_"+Math.random().toString().replace(/.+\./,"");t.id=e,this.urlInput.value="#"+e,this.#Ze(this.urlInput.value),this.#Ve.close(),this.urlInput.focus()}#Oe(t){const e=t.getAttribute("data-command");if(!e)return;const i=this.currentRel,s=i.indexOf(e);-1===s?i.push(e):i.splice(s,1),this.relPreview.title=this.relPreview.textContent=i.join(", ")}#Pe(t){const e=xt.query.getEventTarget(t).value.trim();this.#Ze(e),this.#We(e)?this.#Ye(e):this.#Ve.close()}#De(){const t=this.urlInput.value;this.#We(t)&&this.#Ye(t)}#qe(){let t=this.urlInput.value;this.#We(t)?(t=t.substring(1),this.bookmark.style.display="none",xt.utils.removeClass(this.bookmarkButton,"active")):(t="#"+t,this.bookmark.style.display="block",xt.utils.addClass(this.bookmarkButton,"active"),this.downloadCheck.checked=!1,this.download.style.display="none",this.#Ye(t)),this.urlInput.value=t,this.#Ze(t),this.urlInput.focus()}#ze(t){if("string"!=typeof this.defaultRel.check_new_window)return;xt.query.getEventTarget(t).checked?this.#Ue(this.#je(this.defaultRel.check_new_window)):this.#Ue(this.#Xe(this.defaultRel.check_new_window))}#$e(t){xt.query.getEventTarget(t).checked?(this.download.style.display="block",this.bookmark.style.display="none",xt.utils.removeClass(this.bookmarkButton,"active"),this.linkValue=this.preview.textContent=this.urlInput.value=this.urlInput.value.replace(/^#+/,""),"string"==typeof this.defaultRel.check_bookmark&&this.#Ue(this.#je(this.defaultRel.check_bookmark))):(this.download.style.display="none","string"==typeof this.defaultRel.check_bookmark&&this.#Ue(this.#Xe(this.defaultRel.check_bookmark)))}},Ro={init(t){return{create:(e,i)=>this.create(e,i,t)}},create(t,e,i){if("object"!=typeof e&&(e={}),i&&(e=[i,e].reduce(((t,e)=>(Object.entries(e).forEach((([e,i])=>{if("plugins"===e&&i&&t[e]){const s=Array.isArray(t[e])?t[e]:Object.values(t[e]),n=Array.isArray(i)?i:Object.values(i);t[e]=[...n.filter((t=>!s.includes(t))),...s]}else t[e]=i})),t)),{})),!t)throw Error('[SUNEDITOR.create.fail] The first parameter "target" is missing.');const s=[];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.`);s.push({key:null,target:e})}else if(1===t.nodeType)s.push({key:null,target:t});else{let e;for(const i in t){if(e=t[i],!e.target||1!==e.target.nodeType)throw Error('[SUNEDITOR.create.fail] suneditor multi root requires textarea\'s element at the "target" property.');e.key=i,s.push(e)}}return new On(s,e)}};const Fo=function(t){this.editor,this.eventManager,this.instanceCheck,this.history,this.events,this.triggerEvent,this.carrierWrapper,this.plugins,this.status,this.frameContext=t.frameContext,this.frameOptions=t.frameOptions,this.context,this.options,this.icons,this.lang,this.frameRoots,this._w,this._d,this.toolbar,this.subToolbar,this.char,this.component,this.format,this.html,this.inline,this.listFormat,this.menu,this.nodeTransform,this.offset,this.selection,this.shortcuts,this.ui,this.viewer,re.call(this,t),Ki.call(this,t)};class zo extends Fo{static type="";static key="";static className="";static options={};constructor(t){super(t),this.title="",this.icon="",this.beforeItem=null,this.afterItem=null,this.replaceButton=null}}class $o extends zo{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 Po extends zo{static type="command";action(t){throw new Error(`[${this.constructor.name}] Abstract method 'action()' must be implemented`)}}class Do extends zo{static type="dropdown";on(t){}action(t){throw new Error(`[${this.constructor.name}] Abstract method 'action()' must be implemented`)}}class qo extends zo{static type="dropdown-free";on(t){}off(){}}class Wo extends zo{static type="field"}class Uo extends zo{static type="input";toolbarInputKeyDown(t){}toolbarInputChange(t){}}class Zo extends zo{static type="modal";open(t){throw new Error(`[${this.constructor.name}] Abstract method 'open()' must be implemented`)}}class Go extends zo{static type="popup";show(){throw new Error(`[${this.constructor.name}] Abstract method 'show()' must be implemented`)}}const Yo=class extends Po{static key="blockquote";static className="";constructor(t){super(t),this.title=this.lang.tag_blockquote,this.icon="blockquote",this.quoteTag=xt.utils.createElement("BLOCKQUOTE")}active(t,e){return/blockquote/i.test(t?.nodeName)?(xt.utils.addClass(e,"active"),!0):(xt.utils.removeClass(e,"active"),!1)}action(){const t=xt.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))}},{_w:jo,_d:Xo}=_t;const Ko=class extends Po{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 Fn(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"),i=xt.utils.createElement("div",{class:e.className},e.innerHTML);t=xt.utils.createElement("div",{style:"position: absolute; top: -10000px; left: -10000px; width: 21cm; columns: 21cm; height: auto;"},i);const s=jo.getComputedStyle(e).padding,n=xt.utils.applyInlineStylesAll(i,!0,this.options.get("allUsedStyles"));if(n.style.padding=n.style.paddingTop=n.style.paddingBottom=n.style.paddingLeft=n.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: ${s};\n\t\t\t\t\t}\n\t\t\t\t</style>\n\t\t\t\t${n.outerHTML}`,Xo.body.appendChild(t),!1===await this.triggerEvent("onExportPDFBefore",{target:t}))return;return void await this.#ti(t)}catch(t){console.error("[SUNEDITOR.plugins.exportPDF.error]",t.message)}finally{xt.utils.removeItem(t),this.ui.hideLoading()}}async#ti(t){const e={fileName:this.fileName,htmlContent:t.innerHTML},i=await this.apiManager.asyncCall({data:JSON.stringify(e)});if(200!==i.status){const t=i.responseText?JSON.parse(i.responseText):i;throw Error(`[SUNEDITOR.plugins.exportPDF.error] ${t.errorMessage}`)}const s=new Blob([i.response],{type:"application/pdf"}),n=i.getResponseHeader("Content-Disposition"),o=URL.createObjectURL(s),l=(n.match(/filename="([^"]+)/)||[])[1]||this.fileName+".pdf",r=xt.utils.createElement("A",{href:o,download:l,style:"display: none;"},null);try{Xo.body.appendChild(r),r.click()}finally{jo.setTimeout((()=>{xt.utils.removeItem(r),URL.revokeObjectURL(o)}),100)}}},{NO_EVENT:Jo}=_t;class Qo extends Po{static key="fileUpload";static className="";static options={eventIndex:1e4};static component(t){return xt.check.isAnchor(t)&&t.hasAttribute("data-se-file-download")?t:null}#ei;#ii;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=kt.get(e.uploadSizeLimit,0),this.uploadSingleSizeLimit=kt.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=xt.utils.createElement("input",{type:"file",accept:this.acceptedFormats}),this.allowMultiple&&this.input.setAttribute("multiple","multiple"),this.#ei=this.acceptedFormats.split(", "),this.#ii=null;const i={"custom-download":{command:"download",title:this.lang.download,icon:"download",action:t=>{const e=t.getAttribute("href");e&&xt.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)}}},s=(e.controls||[["custom-as","align","edit","custom-download","copy","remove"]]).map((t=>t.map((t=>t.startsWith("custom-")?i[t]:t))));if(this.figure=new ws(this,s,{}),this.fileManager=new Bo(this,{query:"a[download][data-se-file-download]",loadEventName:"onFileLoad",actionEventName:"onFileAction"}),/\bedit\b/.test(JSON.stringify(s))){const t=function({lang:t,icons:e}){const i=`\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 xt.utils.createElement("DIV",{class:"se-controller se-controller-simple-input"},i)}(this);this.controller=new as(this,t,{position:"bottom",disabled:!0},Qo.key),this.editInput=t.querySelector("input")}this.eventManager.addEvent(this.input,"change",this.#Ie.bind(this))}action(){this.editor._preventBlur=!0,this.input.click()}onFilePasteAndDrop({file:t}){const e=t.type;this.#ei.some((t=>!!t.startsWith("*")||(!!t.startsWith(e)||void 0)))&&(this.submitFile([t]),this.editor.focus())}controllerAction(t){const e=t.getAttribute("data-command");if(e){if("edit"===e){if(0===this.editInput.value.trim().length)return;this.#ii.textContent=this.editInput.value}this.controller.close(),this.component.select(this.#ii,Qo.key)}}componentSelect(t){this.#ii=t;const e=this.figure.controller.form.querySelector('[data-command="__c__as"]');if(e)return xt.check.isFigure(t.parentElement)?(e.innerHTML=this.icons.reduction+xt.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+xt.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:!xt.check.isFigure(t.parentElement),initMethod:null,addOffset:null}),this.editInput.focus()}async componentDestroy(t){if(!t)return;const e=ws.GetContainer(t),i=xt.query.getParentElement(t,".se-component")||t;if(!1===await this.triggerEvent("onFileDeleteBefore",{element:e.target,container:e,url:e.target.getAttribute("href")}))return;const s=this.component.isInline(i)?i.previousSibling||i.nextSibling:i.previousElementSibling||i.nextElementSibling;xt.utils.removeItem(i),this.ui._offCurrentController(),this.editor.focusEdge(s),this.history.push(!1)}async submitFile(t){if(0===t.length)return;let e=0;const i=[],s=this.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++){if(n=t[l],o=n.size,s>0&&o>s){const t="[SUNEDITOR.fileUpload.fail] Size of uploadable single file: "+s/1e3+"KB",e=await this.triggerEvent("onFileUploadError",{error:t,limitSize:s,uploadSize:o,file:n});return this.ui.alertOpen(e===Jo?t:e||t,"error"),!1}i.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",i=await this.triggerEvent("onFileUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.ui.alertOpen(i===Jo?t:i||t,"error"),!1}const l={url:this.uploadUrl,uploadHeaders:this.uploadHeaders,files:i},r=async function(t,e,i){e=i||e;t(await this.fileManager.asyncUpload(e.url,e.uploadHeaders,e.files))}.bind(this,this.#Qe.bind(this),l),a=await this.triggerEvent("onFileUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==Jo||r(null)))}convertFormat(t,e){if("link"===e){this.figure.close();const{container:e}=ws.GetContainer(t),i=e.nextElementSibling,s=e.parentElement;t.removeAttribute("data-se-non-focus"),t.setAttribute("contenteditable","false"),xt.utils.addClass(t,"se-component|se-inline-component");const n=xt.utils.createElement(this.options.get("defaultLine"),null,t);s.insertBefore(n,i),xt.utils.removeItem(e)}else{this.selection.setRange(t,0,t,1);const e=this.html.remove(),i=this.nodeTransform.split(e.container,e.offset,0);i?.previousElementSibling&&xt.check.isZeroWidth(i.previousElementSibling)&&xt.utils.removeItem(i.previousElementSibling),t.setAttribute("data-se-non-focus","true"),t.removeAttribute("contenteditable"),xt.utils.removeClass(t,"se-component|se-component-selected|se-inline-component");const s=ws.CreateContainer(t,"se-file-figure se-flex-component");(i||e.container).parentElement.insertBefore(s.container,i)}this.history.push(!1),this.component.select(t,Qo.key)}create(t,e,i){const s=e.name||t,n=xt.utils.createElement("A",{href:t,title:s,download:s,"data-se-file-download":"",contenteditable:"false","data-se-non-focus":"true","data-se-non-link":"true"},s);if(this.fileManager.setFileData(n,e),"link"===this.as)return n.className="se-component se-inline-component",void this.component.insert(n,{scrollTo:!!i,insertBehavior:i?this.insertBehavior:null});const o=ws.CreateContainer(n);if(xt.utils.addClass(o.container,"se-file-figure|se-flex-component"),this.component.insert(o.container,{scrollTo:!!i,insertBehavior:i?this.insertBehavior:null})){if(i)if(this.options.get("componentInsertBehavior"))this.component.select(n,Qo.key);else{const t=this.format.addLine(o.container,null);t&&this.selection.setRange(t,0,t,0)}}else this.editor.focus()}#Ke(t){t.result.forEach(((t,e,i)=>{this.create(t.url,{name:t.name,size:t.size},e===i.length-1)}))}async#Je(t){const e=await this.triggerEvent("onFileUploadError",{error:t});if(!1===e)return;const i=e===Jo?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.fileUpload.error]",i)}#Qe(t){const e=JSON.parse(t.responseText);e.errorMessage?this.#Je(e):this.#Ke(e)}async#Ie(t){const e=xt.query.getEventTarget(t);await this.submitFile(e.files)}}const tl=Qo;class el extends Po{static key="list_bulleted";static className="se-icon-flip-rtl";constructor(t){super(t),this.title=this.lang.bulletedList,this.icon="list_bulleted",this.afterItem=xt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":el.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 xt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.listItems=e.querySelectorAll("li button ul"),this.menu.initDropdownTarget({key:el.key,type:"dropdown"},e)}active(t,e){return xt.check.isListCell(t)&&/^UL$/i.test(t.parentElement.nodeName)?(xt.utils.addClass(e,"active"),!0):(xt.utils.removeClass(e,"active"),!1)}action(t){const e=this.format.getBlock(this.selection.getNode()),i=t?.querySelector("ul")?.style.listStyleType;xt.check.isList(e)&&i?e.style.listStyleType=i:this.submit(i),this.menu.dropdownOff()}on(){const t=this.listItems,e=this.format.getBlock(this.selection.getNode()),i=e?.style?e.style.listStyleType||"disc":"";for(let e,s=0,n=t.length;s<n;s++)e=t[s],i===e.style.listStyleType?xt.utils.addClass(e.parentElement,"active"):xt.utils.removeClass(e.parentElement,"active")}shortcut({range:t,info:e}){const{startContainer:i}=t;if(xt.check.isText(i)){const t=i.substringData(e.key.length,i.textContent.length-1);i.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.editor.focus(),this.history.push(!1)}}const il=el;class sl extends Po{static key="list_numbered";static className="se-icon-flip-rtl";constructor(t){super(t),this.title=this.lang.numberedList,this.icon="list_numbered",this.afterItem=xt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":sl.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${nl(["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${nl(["lower-latin","upper-latin","lower-greek"])}\n\t\t</ul>\n\t</div>`;return xt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.listItems=e.querySelectorAll("li button ol"),this.menu.initDropdownTarget({key:sl.key,type:"dropdown"},e)}active(t,e){return xt.check.isListCell(t)&&/^OL$/i.test(t.parentElement.nodeName)?(xt.utils.addClass(e,"active"),!0):(xt.utils.removeClass(e,"active"),!1)}action(t){const e=this.format.getBlock(this.selection.getNode()),i=t?.querySelector("ol")?.style.listStyleType;xt.check.isList(e)&&i?e.style.listStyleType=i:this.submit(i),this.menu.dropdownOff()}on(){const t=this.listItems,e=this.format.getBlock(this.selection.getNode()),i=e?.style?e.style.listStyleType||"decimal":"";for(let e,s=0,n=t.length;s<n;s++)e=t[s],i===e.style.listStyleType?xt.utils.addClass(e.parentElement,"active"):xt.utils.removeClass(e.parentElement,"active")}shortcut({range:t,info:e}){const{startContainer:i}=t;if(xt.check.isText(i)){const t=i.substringData(e.key.length,i.textContent.length-1);i.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.editor.focus(),this.history.push(!1)}}function nl(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 ol=sl,{debounce:ll}=wt;const rl=class extends Wo{static key="mention";static className="";#si;#ni;#oi;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 Fn(this,{headers:e.apiHeaders}),this.cachingData=e.useCachingData??1?new Map:null,this.cachingFieldData=e.useCachingFieldData??1?[]:null,this.#si=0,this.#ni=0,this.#oi=null;const i=xt.utils.createElement("DIV",{class:"se-controller se-empty-controller"},"<div></div>");this.selectMenu=new cs(this,{position:"right-bottom",dir:"ltr",closeMethod:()=>this.controller.close()}),this.controller=new as(this,i,{position:"bottom",initMethod:()=>{this.apiManager.cancel(),this.selectMenu.close()}},null),this.selectMenu.on(i.firstElementChild,this.#li.bind(this)),this.onInput=ll(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,i=t.anchorOffset,s=e.textContent.substring(0,i),n=s.lastIndexOf(this.triggerText);if(n>-1){const t=s.substring(n+1,i),o=s[n-1]?.trim();if(!/\s/.test(t)&&(!o||xt.check.isZeroWidth(o))){if(t.length<this.searchStartLength)return;const s=e.parentNode;if(xt.check.isAnchor(s)&&!s.getAttribute("data-se-mention"))return;try{return await this.#ri(t,e),this.#si=n,this.#oi=e,void(this.#ni=i)}catch(t){console.warn("[SUNEDITOR.mention.api.file] ",t)}}}this.selectMenu.close()}async#ri(t,e){const i=this.limitSize,s=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(s))).slice(0,i);else{const e=await this.apiManager.asyncCall({method:"GET",url:this.#ai(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(s)))).slice(0,i)}if(!n?.length)return this.selectMenu.close(),!1;const o=[],l=[];for(let t,e=0,i=n.length;e<i;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)}#ai(t){return this.apiUrl.replace(/\{key\}/i,t)}#li(t){if(!t)return!1;let e=null;const{key:i,name:s,url:n}=t,o=this.#oi.parentNode;if(xt.check.isAnchor(o))e=o,e.setAttribute("data-se-mention",i),e.setAttribute("href",n),e.setAttribute("title",s),e.textContent=this.triggerText+i;else if(this.selection.setRange(this.#oi,this.#si,this.#oi,this.#ni),e=xt.utils.createElement("A",{"data-se-mention":i,href:n,title:s,target:"_blank"},this.triggerText+i),!this.html.insertNode(e,{afterNode:null,skipCharCount:!1}))return!1;this.selectMenu.close();const l=xt.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 al extends Do{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 i=function({lang:t,icons:e,options:i},s){const n=Array.isArray(s)?s:i.get("_rtl")?["right","center","left","justify"]:["left","center","right","justify"];let o="";for(let i,s,l=0;l<n.length;l++)i=n[l],s=t["align"+i.charAt(0).toUpperCase()+i.slice(1)],o+=`\n\t\t<li>\n\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${i}" title="${s}" aria-label="${s}">\n\t\t\t\t<span class="se-list-icon">${e["align_"+i]}</span>${s}\n\t\t\t</button>\n\t\t</li>`;return xt.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>`)}(t,e.items),s=this._itemMenu=i.querySelector("ul");this.defaultDir="",this.alignIcons={justify:t.icons.align_justify,left:t.icons.align_left,right:t.icons.align_right,center:t.icons.align_center},this.alignList=s.querySelectorAll("li button"),this.menu.initDropdownTarget(al,i)}active(t,e){const i=e.firstElementChild;if(t){if(this.format.isLine(t)){const s=t.style.textAlign;return s?(xt.utils.changeElement(i,this.alignIcons[s]||this.alignIcons[this.defaultDir]),e.setAttribute("data-focus",s),!0):void 0}}else xt.utils.changeElement(i,this.alignIcons[this.defaultDir]),e.removeAttribute("data-focus");return!1}on(t){const e=t.getAttribute("data-focus")||this.defaultDir;if(!e)return;const i=this.alignList;for(let t=0,s=i.length;t<s;t++)e===i[t].getAttribute("data-command")?xt.utils.addClass(i[t],"active"):xt.utils.removeClass(i[t],"active")}action(t){const e=t.getAttribute("data-command");if(!e)return;const i=this.defaultDir,s=this.format.getLines();for(let t=0,n=s.length;t<n;t++)xt.utils.setStyle(s[t],"textAlign",e===i?"":e);this.editor.effectNode=null,this.menu.dropdownOff(),this.editor.focus(),this.history.push(!1)}setDir(){const t=this.#hi();if(this.defaultDir===t)return;this.defaultDir=t;const e=this._itemMenu.querySelector('[data-command="left"]'),i=this._itemMenu.querySelector('[data-command="right"]');if(e&&i){const t=e.parentElement,s=i.parentElement;t.appendChild(i),s.appendChild(e)}}init(){this.defaultDir=this.#hi()}#hi(){const t=this.frameContext.get("wwComputedStyle").getPropertyValue("text-align");return["left","center","right","justify"].includes(t)?t:this.options.get("_rtl")?"right":"left"}}const hl=al;class cl extends Do{static key="font";static className="se-btn-select se-btn-tool-font";#ci;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 i=e.items||["Arial","Comic Sans MS","Courier New","Impact","Georgia","tahoma","Trebuchet MS","Verdana"],s=function({lang:t},e){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,s,n=0,o=e.length;n<o;n++)t=e[n],s=t.split(",")[0],i+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${t}" data-txt="${s}" title="${s}" aria-label="${s}" style="font-family:${t};">${s}</button>\n\t\t\t</li>`;return i+="\n\t\t</ul>\n\t</div>",xt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-font-family"},i)}(t,i);this.currentFont="",this.fontList=s.querySelectorAll("ul li button"),this.fontArray=i,this.#ci=s.querySelector(".se-sub-list span"),this.menu.initDropdownTarget(cl,s)}active(t,e){const i=e.querySelector(".se-txt"),s=e.parentNode.querySelector(".se-tooltip-text");let n="";if(t){if(this.format.isLine(t))return;if(n=xt.utils.getStyle(t,"fontFamily")){const t=n.replace(/["']/g,"");return xt.utils.changeTxt(i,t),xt.utils.changeTxt(s,this.lang.font+" ("+t+")"),!0}}else{const t=this.status.hasFocus?this.frameContext.get("wwComputedStyle").fontFamily:this.lang.font;xt.utils.changeTxt(i,t),xt.utils.changeTxt(s,this.status.hasFocus?this.lang.font+(t?" ("+t+")":""):t)}return!1}on(t){const e=this.fontList,i=t.querySelector(".se-txt").textContent;if(i!==this.currentFont){let t=!1;for(let s=0,n=e.length;s<n;s++)i===(e[s].getAttribute("data-command")||"").replace(/'|"/g,"")?(xt.utils.addClass(e[s],"active"),t=!0):xt.utils.removeClass(e[s],"active");this.currentFont=i,t?this.#ci.style.display="none":(this.#ci.textContent=i,this.#ci.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.triggerEvent("onFontActionBefore",{value:e}))return;const t=xt.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 dl=cl;class ul extends qo{static key="fontColor";static className="";constructor(t,e){super(t),this.title=this.lang.fontColor,this.icon="font_color";const i=xt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new Ho(this,"color",{form:i,colorList:e.items,splitNum:e.splitNum,disableHEXInput:e.disableHEXInput,hueSliderOptions:{controllerOptions:{isOutsideForm:!0}}}),this.menu.initDropdownTarget(ul,i)}active(t,e){const i=e.querySelector(".se-svg-color-helper");if(!i)return;let s="";if(t){if(this.format.isLine(t))return;if(s=xt.utils.getStyle(t,"color"))return i.style.color=s,!0}else i.style.color=s;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=xt.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 pl=ul;class gl extends qo{static key="backgroundColor";static className="";constructor(t,e){super(t),this.title=this.lang.backgroundColor,this.icon="background_color";const i=xt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new Ho(this,"backgroundColor",{form:i,colorList:e.items,splitNum:e.splitNum,disableHEXInput:e.disableHEXInput,hueSliderOptions:{controllerOptions:{isOutsideForm:!0}}}),this.menu.initDropdownTarget(gl,i)}active(t,e){const i=e.querySelector("path.se-svg-color-helper");if(!i)return;let s="";if(t){if(this.format.isLine(t))return;if(s=xt.utils.getStyle(t,"backgroundColor"))return i.style.color=s,!0}else i.style.color=s;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=xt.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 ml=gl;class fl extends Do{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 i=function({lang:t},e){const i=e||[{name:t.hr_solid,class:"__se__solid"},{name:t.hr_dashed,class:"__se__dashed"},{name:t.hr_dotted,class:"__se__dotted"}];let s="";for(let t=0,e=i.length;t<e;t++)s+=`\n\t\t<li>\n\t\t\t<button type="button" class="se-btn se-btn-list" data-command="hr" title="${i[t].name}" aria-label="${i[t].name}">\n\t\t\t\t<hr${i[t].class?` class="${i[t].class}"`:""}${i[t].style?` style="${i[t].style}"`:""}/>\n\t\t\t</button>\n\t\t</li>`;return xt.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">${s}</ul>\n\t\t</div>`)}(t,e.items);this.list=i.querySelectorAll("button"),this.menu.initDropdownTarget(fl,i)}componentSelect(t){xt.utils.addClass(t,"on")}componentDeselect(t){xt.utils.removeClass(t,"on")}componentDestroy(t){if(!t)return;const e=t.previousElementSibling||t.nextElementSibling;xt.utils.removeItem(t),this.editor.focusEdge(e),this.history.push(!1)}shortcut({line:t,range:e}){const i=this.nodeTransform.split(e.endContainer,e.endOffset,0);this.submit("__se__solid"),xt.utils.removeItem(t),this.selection.setRange(i,0,i,0)}action(t){const e=this.submit(t.firstElementChild.className),i=this.format.addLine(e);this.selection.setRange(i,1,i,1),this.menu.dropdownOff()}submit(t){const e=xt.utils.createElement("hr",{class:t});return this.editor.focus(),this.component.insert(e,{insertBehavior:"line"}),e}}const bl=fl;class yl extends Do{static key="list";static className="se-icon-flip-rtl";constructor(t){super(t),this.title=this.lang.list,this.icon="list_numbered";const e=function({lang:t,icons:e}){const 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 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 xt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},i)}(t);this.listItems=e.querySelectorAll("li button"),this.icons={bulleted:t.icons.list_bulleted,numbered:t.icons.list_numbered},this.menu.initDropdownTarget(yl,e)}active(t,e){const i=e.firstElementChild;if(xt.check.isList(t)){const s=t.nodeName.toLowerCase();return e.setAttribute("data-focus",s),xt.utils.addClass(e,"active"),/^ul$/.test(s)?xt.utils.changeElement(i,this.icons.bulleted):xt.utils.changeElement(i,this.icons.numbered),!0}return e.removeAttribute("data-focus"),xt.utils.changeElement(i,this.icons.number),xt.utils.removeClass(e,"active"),!1}on(t){const e=t.getAttribute("data-focus")||"",i=this.listItems;for(let t=0,s=i.length;t<s;t++)e===i[t].getAttribute("data-command")?xt.utils.addClass(i[t],"active"):xt.utils.removeClass(i[t],"active")}action(t){const e=t.getAttribute("data-command"),i=t.getAttribute("data-value")||"",s=this.listFormat.apply(`${e}:${i}`,null,!1);s&&this.selection.setRange(s.sc,s.so,s.ec,s.eo),this.menu.dropdownOff(),this.history.push(!1)}}const vl=yl,{_w:_l,ON_OVER_COMPONENT:Cl}=_t,wl=".se-table-resize-line",xl=".se-table-resize-line-prev",kl=".se-table-resize-row",El=".se-table-resize-row-prev",Sl=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],Tl={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"},Hl=["all","inside","horizon","vertical"],Ll="borderLeft",Ml="borderTop",Nl="borderRight",Al="borderBottom",Bl=["#b0dbb0","#efef7e","#f2acac","#dcb0f6","#99bdff","#5dbd5d","#e7c301","#f64444","#e57ff4","#4387f1","#27836a","#f69915","#ba0808","#a90bed","#134299","#e4e4e4","#B3B3B3","#808080","#4D4D4D","#000000"];class Vl extends qo{static key="table";static className="";static options={isInputComponent:!0};static component(t){return xt.check.isTable(t)?t:null}#di;#ui;#pi;#gi;#mi;#fi;#bi;#yi;#vi;#_i;#Ci;#wi;#xi;#ki;#Ei;#Si;#Ti;#Hi;#Li;#Mi;#Ni;#Ai;#Bi;#Vi;#Ii;#Oi;#Ri;#Fi;#zi;#$i;#Pi;#Di;#qi;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 i=function(){const t='\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>';return xt.utils.createElement("DIV",{class:"se-dropdown se-selector-table"},t)}(),s=i.querySelector(".se-controller-table-picker"),n=function({lang:t,icons:e}){const i=`\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 xt.utils.createElement("DIV",{class:"se-controller se-controller-table"},i)}(t),o=function({lang:t,icons:e},i){const s=`\n\t<div class="se-arrow se-arrow-${i?"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=xt.utils.createElement("DIV",{class:"se-controller se-controller-table-cell"},s);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"]')}}(t,this.cellControllerTop),l=function({lang:t,icons:e,options:i}){const s=i.get("_rtl")?["right","center","left","justify"]:["left","center","right","justify"];let n="";for(let i,o,l=0;l<s.length;l++)i=s[l],o=t["align"+i.charAt(0).toUpperCase()+i.slice(1)],n+=`\n\t\t<button type="button" class="se-btn se-tooltip" data-command="props_align" data-value="${i}" title="${o}" aria-label="${o}">\n\t\t\t${e["align_"+i]}\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 i,s,n=0;n<o.length;n++)i=o[n],s=t["align"+i.charAt(0).toUpperCase()+i.slice(1)],l+=`\n\t\t<button type="button" class="se-btn se-tooltip" data-command="props_align_vertical" data-value="${i}" title="${s}" aria-label="${s}">\n\t\t\t${e["align_"+i]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${s}</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_props" 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[Tl.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=xt.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"]')}}(t);t.applyFrameRoots((t=>{t.get("wrapper").appendChild(xt.utils.createElement("DIV",{class:wl.replace(/^\./,"")})),t.get("wrapper").appendChild(xt.utils.createElement("DIV",{class:xl.replace(/^\./,"")})),t.get("wrapper").appendChild(xt.utils.createElement("DIV",{class:kl.replace(/^\./,"")})),t.get("wrapper").appendChild(xt.utils.createElement("DIV",{class:El.replace(/^\./,"")}))})),this.cellControllerTop?(this.controller_cell=new as(this,o.html,{position:"top"}),this.controller_table=new as(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 as(this,n,{position:"top"}),this.controller_cell=new as(this,o.html,{position:"bottom"}));const r=[this.controller_table,this.controller_cell];this.controller_props=new as(this,l.html,{position:"bottom",parents:r,isInsideForm:!0}),this.controller_props_title=l.controller_props_title;const a=xt.utils.createElement("DIV",{class:"se-controller se-list-layer"},null);this.controller_colorPicker=new as(this,a,{position:"bottom",parents:[this.controller_props].concat(r),isInsideForm:!0,isWWTarget:!1,initMethod:()=>{this.colorPicker.hueSlider.close(),xt.utils.removeClass(this.controller_colorPicker.currentTarget,"on")}}),this.colorPicker=new Ho(this,"",{form:a,colorList:e.colorList||Bl,splitNum:5,disableRemove:!0,hueSliderOptions:{controllerOptions:{isOutsideForm:!0,parents:[this.controller_colorPicker],parentsHide:!0}}}),this.figure=new ws(this,null,{}),this.sliderType="";const h=Dl.bind(this,!0),c=Dl.bind(this,!1),d=(u=this.lang,{items:["vertical","horizontal"],menus:xt.utils.createElement("DIV",null,`\n\t\t<div title="${u.verticalSplit}" aria-label="${u.verticalSplit}">\n\t\t\t${u.verticalSplit}\n\t\t</div>\n\t\t<div title="${u.horizontalSplit}" aria-label="${u.horizontalSplit}">\n\t\t\t${u.horizontalSplit}\n\t\t</div>`).querySelectorAll("div")});var u;this.splitButton=o.splitButton,this.selectMenu_split=new cs(this,{checkList:!1,position:"bottom-center",openMethod:h,closeMethod:c}),this.selectMenu_split.on(this.splitButton,this._OnSplitCells.bind(this)),this.selectMenu_split.create(d.items,d.menus);const p=function(t,e){const i=xt.utils.createElement("DIV",null,`\n\t\t<div title="${t.insertColumnBefore}" aria-label="${t.insertColumnBefore}">\n\t\t\t<span class="se-list-icon">${e.insert_column_left}</span><span class="se-txt">${t.insertColumnBefore}</span>\n\t\t</div>\n\t\t<div title="${t.insertColumnAfter}" aria-label="${t.insertColumnAfter}">\n\t\t\t<span class="se-list-icon">${e.insert_column_right}</span><span class="se-txt">${t.insertColumnAfter}</span>\n\t\t</div>\n\t\t<div title="${t.deleteColumn}" aria-label="${t.deleteColumn}">\n\t\t\t<span class="se-list-icon">${e.delete_column}</span><span class="se-txt">${t.deleteColumn}</span>\n\t\t</div>`);return{items:["insert-left","insert-right","delete"],menus:i.querySelectorAll("div")}}(this.lang,this.icons),g=o.columnButton;this.selectMenu_column=new cs(this,{checkList:!1,position:"bottom-center",openMethod:h,closeMethod:c}),this.selectMenu_column.on(g,this._OnColumnEdit.bind(this)),this.selectMenu_column.create(p.items,p.menus);const m=function(t,e){const i=xt.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>`);return{items:["insert-above","insert-below","delete"],menus:i.querySelectorAll("div")}}(this.lang,this.icons),f=o.rowButton;this.selectMenu_row=new cs(this,{checkList:!1,position:"bottom-center",openMethod:h,closeMethod:c}),this.selectMenu_row.on(f,this._OnRowEdit.bind(this)),this.selectMenu_row.create(m.items,m.menus);const b=function(){let t="";for(let e,i=0,s=Sl.length;i<s;i++)e=Sl[i],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=xt.utils.createElement("DIV",null,t);return{items:Sl,menus:e.querySelectorAll("div")}}(),y=l.borderButton;this.selectMenu_props_border=new cs(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_props_border.on(y,$l.bind(this)),this.selectMenu_props_border.create(b.items,b.menus);const v=ql(this.lang,this.icons,[]),_=l.borderFormatButton;this.selectMenu_props_border_format=new cs(this,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:5}),this.selectMenu_props_border_format.on(_,Pl.bind(this,"all")),this.selectMenu_props_border_format.create(v.items,v.menus);const C=ql(this.lang,this.icons,Hl);this.selectMenu_props_border_format_oneCell=new cs(this,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:6}),this.selectMenu_props_border_format_oneCell.on(_,Pl.bind(this,"outside")),this.selectMenu_props_border_format_oneCell.create(C.items,C.menus),this.maxText=this.lang.maxSize,this.minText=this.lang.minSize,this.propTargets={cell_alignment:l.cell_alignment,cell_alignment_vertical:l.cell_alignment_vertical,cell_alignment_table_text:l.cell_alignment_table_text,border_format:_,border_style:l.border_style,border_color:l.border_color,border_width:l.border_width,back_color:l.back_color,font_color:l.font_color,palette_border_button:l.palette_border_button,font_bold:l.font_bold,font_underline:l.font_underline,font_italic:l.font_italic,font_strike:l.font_strike},this._propsCache=[],this._currentFontStyles=[],this._propsAlignCache="",this._propsVerticalAlignCache="",this._typeCache="",this.tableMenu=i,this.tableHighlight=i.querySelector(".se-table-size-highlighted"),this.tableUnHighlight=i.querySelector(".se-table-size-unhighlighted"),this.tableDisplay=i.querySelector(".se-table-size-display"),this.resizeButton=n.querySelector("._se_table_resize"),this.resizeText=n.querySelector("._se_table_resize > span > span"),this.columnFixedButton=n.querySelector("._se_table_fixed_column"),this.headerButton=n.querySelector("._se_table_header"),this.captionButton=n.querySelector("._se_table_caption"),this.mergeButton=o.mergeButton,this.unmergeButton=o.unmergeButton,this._element=null,this.#vi=!1,this.#_i=null,this.#Ci=null,this.#di=null,this.#ui=null,this.#pi=null,this.#gi=null,this.#wi=[],this.#ki=!0,this.#Ei=!1,this.#Si=0,this.#Ti=0,this.#Hi=0,this.#Li=0,this.#Mi=0,this.#Ni=0,this.#Ai=0,this.#Bi=0,this.#Vi=0,this.#mi=null,this.#fi=null,this.#bi=null,this.#yi=null,this.#Ii=!1,this.#Oi=!1,this.#Ri=null,this.#Fi=null,this.#zi=this.#Wi.bind(this),this.#$i=this.#Ui.bind(this),this.#Pi=this.#Zi.bind(this),this.#Di=this.#Gi.bind(this),this.#qi={on:null,off:null,shiftOff:null,touchOff:null,resize:null,resizeStop:null,resizeKeyDown:null},this.menu.initDropdownTarget(Vl,i),this.eventManager.addEvent(s,"mousemove",this.#Yi.bind(this)),this.eventManager.addEvent(s,"click",this.#ji.bind(this))}off(){this.#Xi()}componentSelect(t){if(this.#Ki(t),this.#di||this.setTableInfo(t),this.#ki="100%"===this.#di?.style.width,this.#Ei=xt.utils.hasClass(t,"se-table-layout-fixed")||"fixed"===t.style.tableLayout,this.#Ji(this.#ki?"width|column":"width",!0),he.get("__overInfo")===Cl)return;if(!this.#ui)return;this.setCellInfo(this.#ui,!0);const e=this.#yi?.length>1,i=xt.query.getParentElement(t,xt.check.isFigure);this.controller_table.open(i,null,{isWWTarget:!1,initMethod:null,addOffset:null,disabled:e}),this.#fi&&(this.#Qi(),this.controller_cell.open(this.#ui,this.cellControllerTop?i:null,{isWWTarget:!1,initMethod:null,addOffset:null,disabled:e}))}componentDeselect(){this.resetSelectInfo()}componentDestroy(t){if(!t)return;const e=t.parentNode;xt.utils.removeItem(t),this.#ts(),e!==this.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(e,(function(t){return 0===t.childNodes.length}),null),this.editor.focus(),this.history.push(!1)}componentCopy({event:t,cloneContainer:e}){const i=e.querySelectorAll(".se-selected-table-cell");xt.utils.removeClass(i,"se-selected-table-cell|se-selected-cell-focus"),i.length>0&&(!function(t,e,i){t.preventDefault(),t.stopPropagation();const s=i[0].closest("table"),n=s.cloneNode(!1),o=xt.utils.createElement("tbody");n.appendChild(o);const l=new Map;i.forEach((t=>{l.set(t,!0)}));const r=s.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,e=0;t<a;t++,e++){const i=r[t].cells;for(let t=0,s=0,n=i.length;t<n;t++){for(;c[e][s];)s++;const n=i[t],o=n.rowSpan||1,l=n.colSpan||1;for(let t=0;t<o;t++)for(let i=0;i<l;i++)c[e+t][s+i]=n;s+=l}}for(let t=0;t<a;t++){let e;for(let i=0;i<h;i++){const s=c[t][i];if(!s||!l.has(s))continue;if(e||(e=xt.utils.createElement("tr"),o.appendChild(e)),e.lastChild&&c[t][i-1]===s)continue;if(t>0&&c[t-1][i]===s)continue;const n=s.cloneNode(!0);let r=1,d=1;for(;t+r<a&&c[t+r][i]===s;)r++;for(;i+d<h&&c[t][i+d]===s;)d++;r>1&&(n.rowSpan=r),d>1&&(n.colSpan=d),e.appendChild(n)}}const d=xt.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)}(t,e,i),this.editor.ui.showToast(this.lang.message_copy_success,550))}onPaste({event:t,doc:e}){const i=xt.query.getParentElement(xt.query.getEventTarget(t),xt.check.isTableCell);if(!i)return;const s=e.body;if(1!==s.childElementCount)return;const n=this.component.get(s.firstElementChild);if(n.pluginName!==Vl.key)return;const o=n.target;return this.pasteTableCellMatrix(o,i),!1}retainFormat(){return{query:"table",method:t=>{const e=t.querySelector("colgroup");let i=xt.check.isFigure(t.parentNode)?t.parentNode:null;if(!e){const e=t.rows,i=function(t){const e=t.rows;let i=0;for(let t=0,s=e.length;t<s;t++){const s=e[t].cells;let n=0;for(let t=0,e=s.length;t<e;t++)n+=s[t].colSpan;i=Math.max(i,n)}return i}(t),s=new Array(i).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(i).fill(!1);for(let e=0;e<t;e++){const t=o[e],n=t.style.width,a=t.colSpan||1;for(;l<i&&r[l];)l++;if(l>=i)break;n&&!s[l]&&(s[l]=n);for(let t=0;t<a;t++){if(l+t>=i||!n)continue;r[l+t]=!0;const e=parseFloat(n);for(let t=0;t<a;t++){const o=l+t;if(o>=i)continue;const r=s[o];if(null===r)s[o]=`width: ${n};`;else{const t=parseFloat(r.replace("width: ","").replace(";",""));1===a&&e!==t&&(s[o]=`width: ${n};`)}}}l+=a}if(t===i)break}const n=[];for(let t=0;t<i;t++){const e=s[t]?` style="${s[t]}"`:"";n.push(`<col${e}>`)}const o=xt.utils.createElement("colgroup",null,n.join(""));t.insertBefore(o,t.firstElementChild);for(let t=0;t<e.length;t++){const i=e[t].cells;for(let t=0;t<i.length;t++)xt.utils.setStyle(i[t],"width","")}}i?xt.utils.addClass(i,"se-flex-component|se-input-component"):(i=xt.utils.createElement("FIGURE",{class:"se-flex-component se-input-component"}),t.parentNode.insertBefore(i,t),i.appendChild(t));const s=t.style.width;if(s&&(i.style.width="auto"===s?"max-content":s,xt.utils.setStyle(t,"width","")),this.figureScroll){const t=`se-scroll-figure-${this.figureScroll}`;xt.utils.addClass(i,t),xt.utils.removeClass(i,this.figureScrollList.filter((e=>e!==t)).join("|"))}else xt.utils.removeClass(i,this.figureScrollList.join("|"))}}}setDir(){this.#Xi(),this.#es()}onMouseMove({event:t}){if(this.#vi)return;const e=xt.query.getEventTarget(t),i=xt.query.getParentElement(e,Il);if(!i||1===t.buttons)return void this.#is();const s=Ol(t,i);if(s.is)return this._element&&(this._element.style.cursor=""),this.#vt(),"block"===this.#_i?.style.display&&(this.#_i.style.display="none"),this.#_i=this.frameContext.get("wrapper").querySelector(wl),this.#ss(xt.query.getParentElement(i,xt.check.isTable),i,this.#_i,s.isLeft),void(this.#_i.style.display="block");if(Rl(t,i).is)return this.#vt(),this._element=xt.query.getParentElement(i,xt.check.isTable),this._element.style.cursor="ns-resize","block"===this.#_i?.style.display&&(this.#_i.style.display="none"),this.#_i=this.frameContext.get("wrapper").querySelector(kl),this.#ns(xt.query.getParentElement(i,xt.check.isTable),i,this.#_i),void(this.#_i.style.display="block");this._element&&(this._element.style.cursor=""),this.#is()}onScroll(){"block"===this.#_i?.style.display&&(this._element&&(this._element.style.cursor=""),this.#_i.style.display="none")}onMouseDown({event:t}){this.#Fi=this.#bi=null;const e=xt.query.getEventTarget(t),i=xt.query.getParentElement(e,Il);if(!i)return;this.cellControllerTop||this.controller_cell.hide();const s=Ol(t,i);if(s.is){try{this.#os(),this.setCellInfo(i,!0);const t=this.#Ai+this.#Bi-(s.isLeft?1:0);if(this.ui.enableBackWrapper("ew-resize"),this.#_i||=this.frameContext.get("wrapper").querySelector(wl),this.#Ci=this.frameContext.get("wrapper").querySelector(xl),t<0||t===this.#Ti-1)return this._startFigureResizing(s.startX,t<0),void this.#ls(!1);const e=this._element.querySelector("colgroup").querySelectorAll("col")[t<0?0:t];this._startCellResizing(e,s.startX,kt.get(_l.getComputedStyle(e).width,0),s.isLeft),this.#ls(!1)}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.#ls(!0),this.#vt()}finally{this.#fi=this.#bi=null,this.controller_table.hide(),this.controller_cell.hide()}return}const n=Rl(t,i);if(n.is)try{let t=xt.query.getParentElement(i,xt.check.isTableRow),e=i.rowSpan;if(e>1)for(;xt.check.isTableRow(t)&&e>1;)t=t.nextElementSibling,--e;this.#os(),this.setRowInfo(t),this.ui.enableBackWrapper("ns-resize"),this.#_i||=this.frameContext.get("wrapper").querySelector(kl),this.#Ci=this.frameContext.get("wrapper").querySelector(El),this._startRowResizing(t,n.startY,kt.get(_l.getComputedStyle(t).height,0)),this.#ls(!1)}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.#ls(!0),this.#vt()}finally{this.#fi=this.#bi=null,this.controller_table.hide(),this.controller_cell.hide()}else this.#Ii&&i!==this.#fi||(this.#os(),/^TR$/i.test(i.nodeName)||this.#rs(i,!1))}onMouseUp(){this.#Ii=!1}onMouseLeave(){this.#is()}onKeyDown({event:t,range:e,line:i}){this.#Fi=null;const s=t.code,n=Et.isTab(s);if(this.editor.selectMenuOn||this.#vi||!n&&this.#Oi||Et.isCtrl(t))return;if(this.cellControllerTop||this.controller_cell.hide(),this.#Oi=Et.isShift(t),n){this.#os();const s=xt.query.getParentElement(i,xt.check.isTableCell);if(s&&e.collapsed&&xt.check.isEdgePoint(e.startContainer,e.startOffset)){this.#as();const e=this.#Oi;this.#Ii=this.#Oi=!1;const i=xt.query.getParentElement(s,"table"),n=xt.query.getListChildren(i,xt.check.isTableCell,null),o=e?xt.utils.prevIndex(n,s):xt.utils.nextIndex(n,s);if(o===n.length&&!e){if(!xt.query.getParentElement(s,"thead")){const t=i.rows,e=this.insertBodyRow(i,t.length,this.#Hi).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(!Et.isShift(t)){if(o=xt.query.getParentElement(i,xt.check.isTableCell),!xt.utils.hasClass(o,"se-selected-cell-focus"))return;return this.#os(),this.#ls(!0),this.#vt(),void this.#as()}return this.#Ii||this.#Fi?void 0:(o||=xt.query.getParentElement(i,xt.check.isTableCell),o?(this.#Oi=!1,this.#fi=o,this.#as(),this.#rs(o,t.shiftKey),!1):void 0)}onKeyUp({line:t}){this.#Oi=!1,this.#Ii&&xt.query.getParentElement(t,xt.check.isTableCell)===this.#fi&&(this.#os(),this.#ls(!0),this.#vt()),this.#Ii=!1}colorPickerAction(t){const e=this.propTargets[`${this.sliderType}_color`];e.style.borderColor=e.value=t,this.controller_colorPicker.close()}controllerAction(t){const e=t.getAttribute("data-command");if(!e)return;const{back_color:i,font_color:s,border_color:n}=this.propTargets,o=t.getAttribute("data-value");switch(e){case"header":this.toggleHeader(),this._historyPush();break;case"caption":this.toggleCaption(),this._historyPush();break;case"onsplit":this.selectMenu_split.open();break;case"oncolumn":this.selectMenu_column.open();break;case"onrow":this.selectMenu_row.menus[0].style.display=this.selectMenu_row.menus[1].style.display=/^TH$/i.test(this.#ui?.nodeName)?"none":"",this.selectMenu_row.open();break;case"openTableProperties":this.controller_props.currentTarget===t&&"block"===this.controller_props.form?.style.display?this.controller_props.close():(this.controller_props_title.textContent=this.lang.tableProperties,this.#hs("table"),this.controller_props.open(t,this.controller_table.form,{isWWTarget:!1,initMethod:null,addOffset:null}));break;case"openCellProperties":this.controller_props.currentTarget===t&&"block"===this.controller_props.form?.style.display?this.controller_props.close():(this.controller_props_title.textContent=this.lang.cellProperties,this.#hs("cell"),this.controller_props.open(t,this.controller_cell.form,{isWWTarget:!1,initMethod:null,addOffset:null}));break;case"props_onborder_format":1===this._propsCache.length?this.selectMenu_props_border_format_oneCell.open():this.selectMenu_props_border_format.open();break;case"props_onborder_style":this.selectMenu_props_border.open();break;case"props_onpalette":this.#cs(t,o,"border"===o?n:"back"===o?i:s);break;case"props_font_style":xt.utils.toggleClass(this.propTargets[`font_${o}`],"on");break;case"props_submit":this._submitProps(t);break;case"revert":{const t=this._propsCache;for(let e=0,i=t.length;e<i;e++)t[e][0].style.cssText=t[e][1];this.#ds(this.propTargets.cell_alignment,this._propsAlignCache,!0),this.#ds(this.propTargets.cell_alignment_vertical,this._propsVerticalAlignCache,!0),xt.check.isTable(t[0][0])&&this.#di&&(this.#di.style.float=this._propsAlignCache);break}case"props_align":this.#ds(this.propTargets.cell_alignment,t.getAttribute("data-value"),!1);break;case"props_align_vertical":this.#ds(this.propTargets.cell_alignment_vertical,t.getAttribute("data-value"),!1);break;case"merge":this.mergeCells(this.#yi);break;case"unmerge":this.unmergeCells(this.#yi);break;case"resize":this.#ki=!this.#ki,this.#Ji("width",!1),this._historyPush(),_l.setTimeout((()=>{this.component.select(this._element,Vl.key,{isInput:!0})}),0);break;case"layout":this.#Ei=!this.#Ei,this.#Ji("column",!1),this._historyPush(),_l.setTimeout((()=>{this.component.select(this._element,Vl.key,{isInput:!0})}),0);break;case"copy":this.component.copy(this.#di);break;case"remove":this.componentDestroy(this.#di)}/(^props_|^revert|Properties$)/.test(e)||(this.controller_props.close(),this.controller_colorPicker.close()),/^(remove|props_|on|open|merge)/.test(e)||this._setCellControllerPosition(this.#ui,this.#Ii)}resetSelectInfo(){this.#vt(),this.#os(),this.#ls(!0),this._element=null,this.#di=null,this.#pi=null,this.#gi=null,this.#wi=[],this.#ki=!1,this.#Ei=!1,this.#Si=0,this.#Ti=0,this.#Li=0,this.#Mi=0,this.#Ni=0,this.#Ai=0,this.#Bi=0,this.#Vi=0,this.#Ii=!1,this.#yi=null,this.#mi=null,this.#Fi=null,this.#fi=null,this.#bi=null,this.#Ri=null;const{border_format:t,border_color:e,border_style:i,border_width:s,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;xt.utils.removeClass([t,e,i,s,n,o,l,r,a,h,c,d],"on")}selectCells(t){const e=t[0],i=xt.query.findVisualLastCell(t);this.#yi=t,this.#fi=e,this.#bi=i,this.#Ri=e.nodeName,this.#mi=xt.query.getParentElement(e,"TABLE"),this._setMultiCells(e,i)}setTableInfo(t){const e=this._element=this.#mi=xt.query.getParentElement(t,"TABLE");return this.#di=xt.query.getParentElement(e,xt.check.isFigure)||e,e}setCellInfo(t,e){const i=this.setTableInfo(t);if(i&&(this.#fi=t,this.#pi=t.parentNode,i.querySelector("thead")?xt.utils.addClass(this.headerButton,"active"):xt.utils.removeClass(this.headerButton,"active"),i.querySelector("caption")?xt.utils.addClass(this.captionButton,"active"):xt.utils.removeClass(this.captionButton,"active"),e||0===this.#Si)){this.#ui!==t&&(this.#ui=t,this.#pi=t.parentNode),this.#yi?.length||(this.#yi=[t]);const e=this.#gi=i.rows,s=t.cellIndex;let n=0;for(let t=0,i=e[0].cells,s=e[0].cells.length;t<s;t++)n+=i[t].colSpan;const o=this.#Mi=this.#pi.rowIndex;this.#Li=e.length,this.#Si=this.#pi.cells.length,this.#Ti=this.#Hi=n,this.#Ni=s,this.#Bi=this.#ui.colSpan-1,this.#Vi=this.#pi.cells[s].rowSpan-1;let l=[],r=[];for(let t,i,n=0;n<=o;n++){t=e[n].cells,i=0;for(let e,a,h,c,d=0,u=t.length;d<u;d++){if(e=t[d],a=e.colSpan-1,h=e.rowSpan-1,c=d+i,r.length>0)for(let t,e=0;e<r.length;e++)t=r[e],t.row>n||(c>=t.index?(i+=t.cs,c+=t.cs,t.rs-=1,t.row=n+1,t.rs<1&&(r.splice(e,1),e--)):d===u-1&&(t.rs-=1,t.row=n+1,t.rs<1&&(r.splice(e,1),e--)));if(n===o&&d===s){this.#Ai=c;break}h>0&&l.push({index:c,cs:a+1,rs:h,row:-1}),i+=a}r=r.concat(l).sort((function(t,e){return t.index-e.index})),l=[]}l=null,r=null}}setRowInfo(t){const e=this.setTableInfo(t),i=this.#gi=e.rows;this.#Li=i.length,this.#Mi=t.rowIndex}editTable(t,e){const i=this._element,s="row"===t;if(s){const t=this.#pi.parentElement;if(/^THEAD$/i.test(t.nodeName)){if("up"===e)return;if(!t.nextElementSibling||!/^TBODY$/i.test(t.nextElementSibling.nodeName))return void(e?i.innerHTML+="<tbody><tr>"+Fl("td",this.#Ti)+"</tr></tbody>":(xt.utils.removeItem(this.#di),this.#ts()))}}if(this.#Fi){const t=this.#ui,i=this.#yi;if(s)if(e)this.setCellInfo("up"===e?i[0]:i.at(-1),!0),this.editRow(e,null,t);else{let t=i[0].parentNode;const s=[i[0]];for(let e,n=1,o=i.length;n<o;n++)e=i[n],t!==e.parentNode&&(s.push(e),t=e.parentNode);for(let t=0,i=s.length;t<i;t++)this.setCellInfo(s[t],!0),this.editRow(e)}else{const s=i[0].parentNode;if(e){let n=null;for(let t=0,e=i.length-1;t<e;t++)if(s!==i[t+1].parentNode){n=i[t];break}this.setCellInfo("left"===e?i[0]:n||i[0],!0),this.editCell(e,null,t)}else{const t=[i[0]];for(let e,n=1,o=i.length;n<o&&(e=i[n],s===e.parentNode);n++)t.push(e);for(let i=0,s=t.length;i<s;i++)this.setCellInfo(t[i],!0),this.editCell(e)}}e||this.resetSelectInfo()}else this[s?"editRow":"editCell"](e);if(!e){const t=i.children;for(let e=0;e<t.length;e++)0===t[e].children.length&&(xt.utils.removeItem(t[e]),e--);0===i.children.length&&xt.utils.removeItem(i)}}editRow(t,e,i){this.#os(),e&&this.setCellInfo(e,!0);const s=!t,n="up"===t,o=this.#Mi,l=s||n?o:o+this.#Vi+1,r=s?-1:1,a=this.#gi;let h=this.#Ti;for(let t,e=0,i=o+(s?-1:0);e<=i;e++){if(t=a[e].cells,0===t.length)return;for(let i,s,n=0,o=t.length;n<o;n++)i=t[n].rowSpan,s=t[n].colSpan,i<2&&s<2||i+e>l&&l>e&&(t[n].rowSpan=i+r,h-=s)}if(s){const t=a[o+1];if(t){const e=[];let i=a[o].cells,s=0;for(let t,n,o=0,l=i.length;o<l;o++)t=i[o],n=o+s,s+=t.colSpan-1,t.rowSpan>1&&(t.rowSpan-=1,e.push({cell:t.cloneNode(!1),index:n}));if(e.length>0){let n=e.shift();i=t.cells,s=0;for(let o,l,r=0,a=i.length;r<a&&(o=i[r],l=r+s,s+=o.colSpan-1,!(l>=n.index)||(r--,s--,s+=n.cell.colSpan-1,t.insertBefore(n.cell,o),n=e.shift(),n));r++);if(n){t.appendChild(n.cell);for(let i=0,s=e.length;i<s;i++)t.appendChild(e[i].cell)}}}this._element.deleteRow(l)}else this.insertBodyRow(this._element,l,h);s?this.#as():this._setCellControllerPosition(i||this.#ui,!0)}editCell(t,e,i){e&&this.setCellInfo(e,!0);const s=!t,n="left"===t,o=this.#Bi,l=s||n?this.#Ai:this.#Ai+o+1,r=this.#gi;let a,h=[],c=[],d=0;const u=[],p=[];for(let t,e,i,n,g,m=0,f=this.#Li;m<f;m++){t=r[m],a=l,n=!1,e=t.cells,g=0;for(let t,i,r,f,b=0,y=e.length;b<y&&(t=e[b],t);b++)if(i=t.rowSpan-1,r=t.colSpan-1,s){if(f=b+g,c.length>0){const t=!e[b+1];for(let e,i=0;i<c.length;i++)e=c[i],e.row>m||(f>=e.index?(g+=e.cs,f=b+g,e.rs-=1,e.row=m+1,e.rs<1&&(c.splice(i,1),i--)):t&&(e.rs-=1,e.row=m+1,e.rs<1&&(c.splice(i,1),i--)))}i>0&&h.push({rs:i,cs:r+1,index:f,row:-1}),f>=a&&f+r<=a+o?u.push(t):f<=a+o&&f+r>=a?t.colSpan-=kt.getOverlapRangeAtIndex(l,l+o,f,f+r):i>0&&(f<a||f+r>a+o)&&p.push({cell:t,i:m,rs:m+i}),g+=r}else{if(b>=a)break;if(r>0){if(d<1&&r+b>=a){t.colSpan+=1,a=null,d=i+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=[],!s){if(d>0){d-=1;continue}null!==a&&e.length>0&&(i=zl(e[0].nodeName),i=t.insertBefore(i,e[a]))}}const g=this._element.querySelector("colgroup");if(g){const t=g.querySelectorAll("col");if(s)xt.utils.removeItem(t[a]);else{let e=0;for(let i,s=0,n=t.length;s<n;s++)i=kt.get(t[s].style.width),i-=Math.round(i*n*.1/2),e+=i,t[s].style.width=`${i}%`;const i=xt.utils.createElement("col",{style:`width:${100-e}%`});g.insertBefore(i,t[a])}}if(s){let t,e;for(let i,s=0,n=u.length;s<n;s++)i=u[s].parentNode,xt.utils.removeItem(u[s]),0===i.cells.length&&(t||=xt.utils.getArrayIndex(r,i),e=xt.utils.getArrayIndex(r,i),xt.utils.removeItem(i));for(let i,s=0,n=p.length;s<n;s++)i=p[s],i.cell.rowSpan=kt.getOverlapRangeAtIndex(t,e,i.i,i.rs);this.#as()}else this._setCellControllerPosition(i||this.#ui,!0);return i||this.#ui}pasteTableCellMatrix(t,e){if(!t||!e)return;const i=t.rows;let s=0;const n=[];for(let t=0;t<i.length;t++){const e=i[t].cells;let o=0;for(let i=0;i<e.length;i++){const l=e[i];for(;n[t]?.[o];)o++;const r=l.rowSpan||1,a=l.colSpan||1;0===o&&(s+=r);for(let e=0;e<r;e++)for(let i=0;i<a;i++)n[t+e]||(n[t+e]=[]),n[t+e][o+i]=!0;o+=a}}let o=0;for(let t=0,e=i[0].cells,s=e.length;t<s;t++){o+=e[t].colSpan||1}const l={rowCnt:s,logicalCellCnt:o};this.#os();const r=e.closest("table"),{cloneTable:a,clonedSelectedCells:h}=this._cloneTable(r,[e]),c=a;e=h[0];let d=c.rows;this.setTableInfo(c),this.setCellInfo(e,!0);const u={physicalCellCnt:this.#Si,logicalCellCnt:this.#Ti,rowCnt:this.#Li,rowInex:this.#Mi,physicalCellIndex:this.#Ni,logicalCellIndex:this.#Ai,currentColSpan:this.#Bi,currentRowSpan:this.#Vi},p=l.rowCnt-(u.rowCnt-(u.rowInex+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.editRow("down",e);for(let t=0;t<g;t++)this.editCell("right",e);d=this.#gi=c.rows}const m=u.rowInex,f=u.logicalCellIndex,b=f+l.logicalCellCnt-1,y=[],v=[];for(let t=0,e=m+l.rowCnt;t<e;t++){const e=d[t]?.cells;if(!e)continue;let i=0,s=0;for(let n=0;n<e.length;n++){for(;v[t]?.[i];)i++;const n=e[s++];if(!n)break;const o=n.colSpan||1,l=n.rowSpan||1,r=i,a=i+o-1;if(l>1||o>1)for(let e=1;e<l;e++){const s=t+e;v[s]||=[];for(let t=0;t<o;t++)v[s][i+t]=!0}r<=b&&a>=f&&(o>1||l>1)&&y.push(n),i+=o}}y.length>0&&(this.unmergeCells(y,!0),d=this.#gi=c.rows);const _=[],C=[],w=[];for(let t=0,e=l.rowCnt;t<e;t++){const e=i[t]?.cells;if(!e)break;let s=0;for(let i=0;i<e.length;i++){const n=e[i],o=n.colSpan||1,l=n.rowSpan||1;for(;C[t]?.[s];)s++;for(let e=1;e<l;e++){const i=t+e;C[i]||=[];for(let t=0;t<o;t++)C[i][s+t]=!0}if(o<=1&&l<=1){s+=o;continue}const r=s+u.logicalCellIndex,a=r+o-1,h=[];for(let e=u.rowInex+t,i=e+l,s=0;e<i;e++,s++){const t=d[e].cells;let i=0,s=0;for(;s<t.length&&i<=a;){for(;w[e]?.[i];)i++;const n=t[s++],o=n.colSpan||1,l=n.rowSpan||1,c=i,d=i+o-1;if(l>1)for(let t=1;t<l;t++){const s=e+t;w[s]||=[];for(let t=0;t<o;t++)w[s][i+t]=!0}d>=r&&c<=a&&h.push(n),i+=o}}h.length>0&&_.push(h),s+=o}}if(_.length>0){for(const t of _)this.#Fi=null,this.#gi=c.rows,this.mergeCells(t,!0);d=this.#gi=c.rows}const x=[],k=[];for(let t=0;t<l.rowCnt;t++){const e=d[u.rowInex+t],s=i[t];if(!e||!s)break;const n=e.cells,o=s.cells;let l=0,r=0,a=0;for(;r<n.length&&a<o.length&&l<=b;){for(;k[t]?.[l];)l++;const e=n[r++],i=o[a];if(!e||!i)break;const s=e.colSpan||1,h=e.rowSpan||1;if(h>1)for(let e=1;e<h;e++){const i=t+e;k[i]||=[];for(let t=0;t<s;t++)k[i][l+t]=!0}l>=f&&l+s-1<=b&&(e.innerHTML=i.innerHTML,x.push(e),a++),l+=s}}r.replaceWith(c),this.#ts(),this.setTableInfo(c),this.selectCells(x),this.#us(),this.#Qi(),this.#ps(x[0]),this._historyPush()}insertBodyRow(t,e,i){const s=t.insertRow(e);return s.innerHTML=Fl("td",i),s}mergeCells(t,e=!1){const i=t[0].closest("table"),{cloneTable:s,clonedSelectedCells:n}=e?{cloneTable:i,clonedSelectedCells:t}:this._cloneTable(i,t);this.setTableInfo(s),t=n,this.#Fi=null,this._setMultiCells(t[0],xt.query.findVisualLastCell(t));const o=this.#Fi,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,i,s=1,n=t.length;s<n;s++){e=t[s],u!==e.parentNode&&(u=e.parentNode),i=e.children;for(let t=0,e=i.length;t<e;t++)this.format.isLine(i[t])&&xt.check.isZeroWidth(i[t].textContent)&&xt.utils.removeItem(i[t]);d+=e.innerHTML,xt.utils.removeItem(e),0===u.cells.length&&(r?a=u:r=u,c-=1)}if(r){const t=this.#gi,e=xt.utils.getArrayIndex(t,r),i=xt.utils.getArrayIndex(t,a||r),s=[];for(let n,o=0;o<=i;o++)if(n=t[o].cells,0!==n.length)for(let t,s,l=0,r=n.length;l<r;l++)t=n[l],s=t.rowSpan-1,s>0&&o+s>=e&&(t.rowSpan-=kt.getOverlapRangeAtIndex(e,i,o,o+s));else s.push(t[o]);for(let t=0,e=s.length;t<e;t++)xt.utils.removeItem(s[t])}l.innerHTML+=d,l.colSpan=h,l.rowSpan=c,e||(i.replaceWith(s),this.#ts(),this.#us(),this._setController(l),this.#ps(l),this._historyPush())}unmergeCells(t,e=!1){if(!t?.length)return;const i=t[0].closest("table"),{cloneTable:s,clonedSelectedCells:n}=e?{cloneTable:i,clonedSelectedCells:t}:this._cloneTable(i,t);this.#Fi=null,this.setTableInfo(s);let o=(t=n)[0],l=xt.query.findVisualLastCell(t),r=null;const a=o.closest("table"),h=a.rows;for(const e of t){const t=e.parentElement.rowIndex,i=e.cellIndex,s=e.rowSpan,n=e.colSpan;if(1===s&&1===n)continue;this.setCellInfo(e,!0);const a=e.innerHTML;e.remove();for(let c=0;c<s;c++){const s=h[t+c];for(let t=0;t<n;t++){const n=zl("td");0===c&&0===t?(o===e&&(o=n),l===e&&(l=n),n.innerHTML=a,s.insertBefore(n,s.cells[i])):(s.insertBefore(n,s.cells[i+t]),r=n)}}}this.#yi=null,e||(i.replaceWith(s),this.#ts(),this.setTableInfo(s),o!==l?(l=!r||l.closest("tr").rowIndex>r.closest("tr").rowIndex||l.cellIndex>r.cellIndex?l:r,this._setMultiCells(o,l),this.#yi=Array.from(a.querySelectorAll(".se-selected-table-cell"))):this.setCellInfo(l,!0),this.#fi=o,this.#bi=l,xt.utils.addClass(l,"se-selected-cell-focus"),this.#Qi(),this.controller_cell.resetPosition(l),this._historyPush())}findMergedCells(t){const e=[];return t?.forEach((t=>{t&&(t.rowSpan>1||t.colSpan>1)&&e.push(t)})),e}toggleHeader(){const t=this.headerButton,e=xt.utils.hasClass(t,"active"),i=this._element;if(e)xt.utils.removeItem(i.querySelector("thead"));else{const t=xt.utils.createElement("THEAD");t.innerHTML="<tr>"+Fl("th",this.#Ti)+"</tr>",i.insertBefore(t,i.firstElementChild)}xt.utils.toggleClass(t,"active"),/TH/i.test(this.#ui.nodeName)?this.#as():this._setCellControllerPosition(this.#ui,!1)}toggleCaption(){const t=this.captionButton,e=xt.utils.hasClass(t,"active"),i=this._element;if(e)xt.utils.removeItem(i.querySelector("caption"));else{const t=xt.utils.createElement("CAPTION",{class:`se-table-caption-${this.captionPosition}`});t.innerHTML="<div><br></div>",i.insertBefore(t,i.firstElementChild)}xt.utils.toggleClass(t,"active"),this._setCellControllerPosition(this.#ui,!1)}#Ji(t,e){if(t.includes("width")){const t=this.#di;if(!t)return;let i,s;this.#ki?(i=this.icons.reduction,s=this.minText,e||(t.style.width="100%")):(i=this.icons.expansion,s=this.maxText,e||(t.style.width="max-content")),xt.utils.changeElement(this.resizeButton.firstElementChild,i),xt.utils.changeTxt(this.resizeText,s)}t.includes("column")&&(this.#Ei?(xt.utils.removeClass(this._element,"se-table-layout-auto"),xt.utils.addClass(this._element,"se-table-layout-fixed"),xt.utils.addClass(this.columnFixedButton,"active")):(xt.utils.removeClass(this._element,"se-table-layout-fixed"),xt.utils.addClass(this._element,"se-table-layout-auto"),xt.utils.removeClass(this.columnFixedButton,"active")))}#us(){this.#Fi?(this.splitButton.style.display="none",this.mergeButton.style.display="block"):(this.splitButton.style.display="block",this.mergeButton.style.display="none")}#Qi(){this.findMergedCells(this.#yi?.length?this.#yi:[this.#fi]).length>0?this.unmergeButton.disabled=!1:this.unmergeButton.disabled=!0}_setController(t){if(!this.selection.get().isCollapsed&&!this.#bi)return void this.#os();this.#Qi(),this.#ui=t,this.#fi===t&&xt.utils.addClass(t,"se-selected-cell-focus"),this.#yi?.length||(this.#yi=[t]);const e=this.#mi||this._element||xt.query.getParentElement(t,"TABLE");this.component.select(e,Vl.key,{isInput:!0})}_setCellControllerPosition(t,e){this.setCellInfo(t,e),this.cellControllerTop||this.controller_cell.resetPosition(t)}_historyPush(){this.#os(),this.history.push(!1),this.#gs()}#Ki(t){this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,infoOnly:!1})}#ms(t){const e=t.querySelector("colgroup").querySelectorAll("col"),i=t.offsetWidth;e.forEach((t=>{const e=t.style.width;if(!e.endsWith("%")){const s=(t.offsetWidth||kt.get(e,0))/i*100;t.style.width=s+"%"}}))}_startCellResizing(t,e,i,s){xt.utils.removeClass(this.#di,"se-component-selected"),this.#ms(this._element),this.#ss(this.#di,this.#ui,this.#Ci,s),this.#Ci.style.display="block";const n=t.style.width,o=t.nextElementSibling,l=o.style.width,r=xt.utils.hasClass(this._element,"se-table-layout-fixed")?l:wt.getWidthInPercentage(o||t);he.get("__dragHandler")&&(he.get("__dragHandler").style.display="none"),this.#fs(this.#bs.bind(this,t,o,this.#di,this.#ui,this.#_i,s,e,i,kt.get(n,0),kt.get(r,0),this._element.offsetWidth),(()=>{this.#vt(),this.#ms(this._element),this.history.push(!0),this.component.hoverSelect(this._element),this.#ls(!0)}),(e=>{this._stopResize(t,n,"width",e),this._stopResize(o,l,"width",e)}))}#bs(t,e,i,s,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.#ss(i,s,n,o)}}_startRowResizing(t,e,i){xt.utils.removeClass(this.#di,"se-component-selected"),this.#ns(this.#di,t,this.#Ci),this.#Ci.style.display="block";const s=t.style.height;he.get("__dragHandler")&&(he.get("__dragHandler").style.display="none"),this.#fs(this.#ys.bind(this,t,this.#di,this.#_i,e,i),(()=>{this.#vt(),this.history.push(!0),this.component.hoverSelect(this._element),this.#ls(!0)}),this._stopResize.bind(this,t,s,"height"))}#ys(t,e,i,s,n,o){const l=n+(o.clientY-s);t.style.height=`${l}px`,this.#ns(e,t,i)}_startFigureResizing(t,e){const i=this.#di;xt.utils.removeClass(i,"se-component-selected"),this.#ss(i,i,this.#Ci,e),this.#Ci.style.display="block";const s=wt.getWidthInPercentage(i);he.get("__dragHandler")&&(he.get("__dragHandler").style.display="none"),this.#fs(this.#vs.bind(this,i,this.#_i,e,t,i.offsetWidth,kt.get(s,0)),(()=>{this.#vt(),kt.get(i.style.width,0)>100&&(i.style.width="100%"),this.history.push(!0),this.component.hoverSelect(this._element),this.#ls(!0)}),this._stopResize.bind(this,i,i.style.width,"width"))}#vs(t,e,i,s,n,o,l){const r=(n+(i?s-l.clientX:l.clientX-s))/n*o;r>0&&(t.style.width=`${r}%`,this.#ss(t,t,e,i))}#ss(t,e,i,s){const n=this.offset.getLocal(e),o=this.offset.getLocal(t);i.style.left=`${n.left+(s?0:e.offsetWidth)}px`,i.style.top=`${o.top}px`,i.style.height=`${t.offsetHeight}px`}#ns(t,e,i){const s=this.offset.getLocal(e),n=this.offset.getLocal(t);i.style.top=`${s.top+e.offsetHeight}px`,i.style.left=`${n.left}px`,i.style.width=`${t.offsetWidth}px`}_stopResize(t,e,i,s){Et.isEsc(s.code)&&(this.#vt(),this.component.hoverSelect(this._element),this.#ls(!0),t.style[i]=e,"width"===i&&this.component.select(this._element,Vl.key,{isInput:!0}))}#os(){xt.utils.removeClass([this.#fi,this.#bi],"se-selected-cell-focus");const t=this.#fi?.closest("table");if(t){const e=t.querySelectorAll(".se-selected-table-cell");for(let t=0,i=e.length;t<i;t++)xt.utils.removeClass(e[t],"se-selected-table-cell")}}#gs(){if(this.#yi){const t=this.#yi;for(let e=0,i=t.length;e<i;e++)xt.utils.addClass(t[e],"se-selected-table-cell")}}#fs(t,e,i){this.#qi.resize=this.eventManager.addGlobalEvent("mousemove",t,!1),this.#qi.resizeStop=this.eventManager.addGlobalEvent("mouseup",e,!1),this.#qi.resizeKeyDown=this.eventManager.addGlobalEvent("keydown",i,!1),this.#vi=!0}#ls(t){const e=this.frameContext.get("wysiwyg");e.setAttribute("contenteditable",t.toString()),t?xt.utils.removeClass(e,"se-disabled"):xt.utils.addClass(e,"se-disabled")}#hs(t){this._typeCache=t;const e="table"===t,i=e?[this._element]:this.#yi;if(!i?.[0])return;const{border_format:s,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:b,color:y,textAlign:v,verticalAlign:_,fontWeight:C,textDecoration:w,fontStyle:x}=_l.getComputedStyle(i[0]),k=this.#_s(f);h.querySelector('[data-value="justify"]').style.display=e?"none":"",d.style.display=e?"":"none",c.style.display=e?"none":"";let E=wt.rgb2hex(k.c),S=k.s,T=k.w,H=wt.rgb2hex(b),L=wt.rgb2hex(y),M=/.+/.test(C),N=/underline/i.test(w),A=/line-through/i.test(w),B=/italic/i.test(x),V=e?this.#di?.style.float:v,I=_;this._propsCache=[];const O=_l.getComputedStyle(this.eventManager.__focusTemp);for(let t,s,n=0;t=i[n];n++){const{cssText:i,border:n,backgroundColor:o,color:l,textAlign:r,verticalAlign:a,fontWeight:h,textDecoration:c,fontStyle:d}=t.style;if(this._propsCache.push([t,i]),s)continue;const{c:u,s:p,w:g}=this.#_s(n);let m=o,f=l;m&&(this.eventManager.__focusTemp.style.backgroundColor=m,m=O.backgroundColor),f&&(this.eventManager.__focusTemp.style.color=f,f=O.color),E&&k.c!==u&&(E=""),S&&k.s!==p&&(S=""),T&&k.w!==g&&(T=""),H!==wt.rgb2hex(m)&&(H=""),L!==wt.rgb2hex(f)&&(L=""),V!==(e?this.#di?.style.float:r)&&(V=""),I&&I!==a&&(I=""),M&&M!==/.+/.test(h)&&(M=!1),N&&N!==/underline/i.test(c)&&(N=!1),A&&A!==/line-through/i.test(c)&&(A=!1),B&&B!==/italic/i.test(d)&&(B=!1),E&&S&&T&&H&&L||(s=!0)}s.firstElementChild.innerHTML=this.icons[Tl[1===i.length?"outside":"all"]],s.setAttribute("se-border-format","all"),xt.utils.removeClass(s,"active"),S||=Sl[0],o.textContent=S,n.style.borderColor=n.value=E,l.value=T,this._disableBorderProps(S===Sl[0]),r.value=r.style.borderColor=H,a.value=a.style.borderColor=L,M&&xt.utils.addClass(u,"on"),N&&xt.utils.addClass(p,"on"),A&&xt.utils.addClass(m,"on"),B&&xt.utils.addClass(g,"on"),this.#ds(h,this._propsAlignCache=V,!0),this.#ds(c,this._propsVerticalAlignCache=I,!0)}#ds(t,e,i){xt.utils.removeClass(t.querySelectorAll("button"),"on"),i||t.getAttribute("se-cell-align")!==e?(xt.utils.addClass(t.querySelector(`[data-value="${e}"]`),"on"),t.setAttribute("se-cell-align",e)):t.setAttribute("se-cell-align","")}_disableBorderProps(t){const{border_color:e,border_width:i,palette_border_button:s}=this.propTargets;t?(e.disabled=!0,i.disabled=!0,s.disabled=!0,i.disabled=!0):(e.disabled=!1,i.disabled=!1,s.disabled=!1,i.disabled=!1)}#_s(t){const e=t.split(/\s(?![^()]*\))/);let i="",s="",n="";return 3===e.length?(i=e[0],s=e[1],n=e[2]):2===e.length?/\d/.test(e[0])?(i=e[0],s=e[1]):(s=e[0],n=e[1]):1===e.length&&(/\d/.test(e[0])?i=e[0]:s=e[0]),{w:i,s,c:wt.rgb2hex(n)}}_submitProps(t){try{t.disabled=!0;const e=this.controller_table.form.contains(this.controller_props.currentTarget),i=e?[this._element]:this.#yi,s=i[0],n=_l.getComputedStyle(s),{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,b=d.getAttribute("se-cell-align")||"",y=u.getAttribute("se-cell-align")||"",v=f?"":l.value.trim()||n.borderColor;let _=f?"":a.value.trim()||n.borderWidth;_+=kt.is(_)?"px":"";const C=h.value.trim(),w=c.value.trim(),x=g&&!f&&_,k=`${_} ${m} ${v}`,E={left:[],top:[],right:[],bottom:[],middle:[],all:null};if(e){const t=s.style;this.#di&&(this.#di.style.float=b,this.#di.style.verticalAlign=y),t.backgroundColor=C,t.color=w,this.#Cs(t),x||(t.border=f?t.borderLeft=t.borderTop=t.borderRight=t.borderBottom="":k),E.left=E.top=E.right=E.bottom=i}else{const t=s.parentElement;let{rs:e,re:n,cs:o,ce:l}=this.#Fi||{rs:t.rowIndex||0,re:t.rowIndex||0,cs:s.cellIndex||0,ce:s.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,s,c,d,u,p=0,g=0,m=i.length,v=0;p<m;p++,g++){t=i[p],d=t.colSpan,u=t.rowSpan,c=t.cellIndex-a,h!==t.parentElement&&(v++,g=0,h=t.parentElement);let m=0;for(;m<=c;)c+=r[v][m]||0,m++;try{if(u>1){const t=u-1;for(let e=v;e<=v+t;e++)r[e][c]+=d-(v===e?1:0)}else d>1&&(r[v][c]+=d-1)}catch{}const _=v+u-1===n;v===e&&E.top.push(t),(v===n||_)&&E.bottom.push(t),c===o&&E.left.push(t),c!==l&&c+d-1!==l||E.right.push(t),_||v===e||v===n||c===o||c===l||E.middle.push(t),s=t.style,s.textAlign=b,s.verticalAlign=y,s.backgroundColor=C,s.color=w,this.#Cs(s),x||(s.border=f?s.borderLeft=s.borderTop=s.borderRight=s.borderBottom="":k)}0===E.middle.length&&(E.middle=i)}E.all=i,x&&this.#ws(E,p,k),this._historyPush(),this.controller_props.close(),this.#ui&&(this.#gs(),this.setCellInfo(this.#ui,!0),xt.utils.addClass(this.#ui,"se-selected-cell-focus"))}catch(t){console.warn("[SUNEDITOR.plugins.table.setProps.error]",t)}finally{t.disabled=!1}}#Cs(t){const{font_bold:e,font_italic:i,font_strike:s,font_underline:n}=this.propTargets;t.fontWeight=xt.utils.hasClass(e,"on")?"bold":"",t.fontStyle=xt.utils.hasClass(i,"on")?"italic":"",t.textDecoration=((xt.utils.hasClass(s,"on")?"line-through ":"")+(xt.utils.hasClass(n,"on")?"underline":"")).trim()}#ws(t,e,i){const{left:s,top:n,right:o,bottom:l,all:r}=t;switch(e){case"inside":if(1===r.length)return;xt.utils.setStyle(r.filter((t=>!l.includes(t))),Al,i),xt.utils.setStyle(r.filter((t=>!o.includes(t))),Nl,i);break;case"horizon":if(1===r.length)return;xt.utils.setStyle(r.filter((t=>!l.includes(t))),Al,i);break;case"vertical":if(1===r.length)return;xt.utils.setStyle(r.filter((t=>!o.includes(t))),Nl,i);break;case"outside":xt.utils.setStyle(s,Ll,i),xt.utils.setStyle(n,Ml,i),xt.utils.setStyle(o,Nl,i),xt.utils.setStyle(l,Al,i);break;case"left":xt.utils.setStyle(s,Ll,i);break;case"top":xt.utils.setStyle(n,Ml,i);break;case"right":xt.utils.setStyle(o,Nl,i);break;case"bottom":xt.utils.setStyle(l,Al,i)}}_setMultiCells(t,e){const i=this.#mi.rows;if(this.#os(),xt.utils.addClass(t,"se-selected-table-cell"),t===e&&!this.#Ii)return;let s=!0,n=[],o=[];const l=this.#Fi={_i:0,cs:null,ce:null,rs:null,re:null};for(let r,a,h=0,c=i.length;h<c;h++){r=i[h].cells,a=0;for(let i,c,d,u,p=0,g=r.length;p<g;p++){if(i=r[p],d=i.colSpan-1,u=i.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(s){if(i!==t&&i!==e||(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){s=!1,n=[],o=[],h=-1;break}}else if(kt.getOverlapRangeAtIndex(l.cs,l.ce,c,c+d)&&kt.getOverlapRangeAtIndex(l.rs,l.re,h,h+u)){const t=l.cs<c?l.cs:c,e=l.ce>c+d?l.ce:c+d,s=l.rs<h?l.rs:h,r=l.re>h+u?l.re:h+u;if(l.cs!==t||l.ce!==e||l.rs!==s||l.re!==r){l.cs=t,l.ce=e,l.rs=s,l.re=r,h=-1,n=[],o=[];break}xt.utils.addClass(i,"se-selected-table-cell")}u>0&&o.push({index:c,cs:d+1,rs:u,row:-1}),a+=i.colSpan-1}n=n.concat(o).sort(((t,e)=>t.index-e.index)),o=[]}}#Xi(){if(!this.tableHighlight)return;const t=this.tableHighlight.style,e=this.tableUnHighlight.style;t.width="1em",t.height="1em",e.width="5em",e.height="5em",xt.utils.changeTxt(this.tableDisplay,"1 x 1")}#es(){const{cell_alignment:t}=this.propTargets,e=t.querySelector('[data-value="left"]'),i=t.querySelector('[data-value="right"]'),s=e.parentElement,n=i.parentElement;s.appendChild(i),n.appendChild(e)}#cs(t,e,i){this.controller_colorPicker.isOpen&&e===this.sliderType?this.controller_colorPicker.close():(this.sliderType=e,xt.utils.addClass(t,"on"),this.colorPicker.init(i?.value||"",t),this.controller_colorPicker.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null}))}#as(){this.controller_table.close(),this.controller_cell.close()}#ts(){this.component.deselect(),this.#as()}#is(){this.#_i&&(this.#_i.style.display="none",this.#_i=null)}#vt(){this.#vi=!1,this.ui.disableBackWrapper(),this.#is(),this.#Ci&&(this.#Ci.style.display="none",this.#Ci=null);const t=this.#qi;for(const e in t)t[e]&&=this.eventManager.removeGlobalEvent(t[e])}_cloneTable(t,e){const i=xt.utils.clone(t,!0),s=Array.from(t.querySelectorAll("td, th")),n=Array.from(i.querySelectorAll("td, th"));return{cloneTable:i,clonedSelectedCells:e.map((t=>{const e=s.indexOf(t);return e>-1?n[e]:null})).filter((t=>null!==t))}}#rs(t,e){this.#Oi=e,this.#Ii||this.#Fi||this.#vt(),this.#Ii=e,this.#fi=t,this.#yi?.length||(this.#yi=[t]),this.#Ri=t.nodeName,this.#mi=xt.query.getParentElement(t,"TABLE"),this.#os(),xt.utils.addClass(t,"se-selected-cell-focus"),e?(this.#qi.shiftOff=this.eventManager.addGlobalEvent("keyup",this.#Pi,!1),this.#qi.on=this.eventManager.addGlobalEvent("mousedown",this.#zi,!1)):this.#qi.on=this.eventManager.addGlobalEvent("mousemove",this.#zi,!1),this.#qi.off=this.eventManager.addGlobalEvent("mouseup",this.#$i,!1),this.#qi.touchOff=this.eventManager.addGlobalEvent("touchmove",this.#Di,!1)}_OnSplitCells(t){const e="vertical"===t,i=this.#ui,s=this.#gi,n=this.#pi,o=this.#Ai,l=this.#Mi,r=zl(i.nodeName);if(e){const t=i.colSpan;if(r.rowSpan=i.rowSpan,t>1)r.colSpan=Math.floor(t/2),i.colSpan=t-r.colSpan,n.insertBefore(r,i.nextElementSibling);else{let e=[],l=[];for(let n,r,a=0,h=this.#Li;a<h;a++){n=s[a].cells,r=0;for(let s,h,c,d,u=0,p=n.length;u<p;u++){if(s=n[u],h=s.colSpan-1,c=s.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}),s!==i&&d<=o&&d+h>=o+t-1){s.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,i.nextElementSibling)}}else{const t=i.rowSpan;if(r.colSpan=i.colSpan,t>1){r.rowSpan=Math.floor(t/2);const e=t-r.rowSpan,l=[],a=xt.utils.getArrayIndex(s,n)+e;for(let t,e,i=0;i<a;i++){t=s[i].cells,e=0;for(let s,n,r,h=0,c=t.length;h<c&&(r=h+e,!(r>=o));h++)s=t[h],n=s.rowSpan-1,n>0&&n+i>=a&&r<o&&l.push({index:r,cs:s.colSpan}),e+=s.colSpan-1}const h=s[a],c=h.cells;let d=l.shift();for(let t,e,i,s,n=0,a=c.length,u=0;n<a;n++){if(i=n+u,t=c[n],e=t.colSpan-1,s=i+e+1,d&&s>=d.index&&(u+=d.cs,s+=d.cs,d=l.shift()),s>=o||n===a-1){h.insertBefore(r,t.nextElementSibling);break}u+=e}i.rowSpan=e}else{r.rowSpan=i.rowSpan;const t=xt.utils.createElement("TR");t.appendChild(r);for(let t,e=0;e<l;e++){if(t=s[e].cells,0===t.length)return;for(let i=0,s=t.length;i<s;i++)e+t[i].rowSpan-1>=l&&(t[i].rowSpan+=1)}const e=this.#Ni,o=n.cells;for(let t=0,i=o.length;t<i;t++)t!==e&&(o[t].rowSpan+=1);n.parentNode.insertBefore(t,n.nextElementSibling)}}this.selectMenu_split.close(),this.#ps(i),this.#os(),this.history.push(!1),this._setController(i),this.#bi=this.#fi=i,this.#yi?.length||(this.#yi=[i])}_OnColumnEdit(t){switch(t){case"insert-left":this.editTable("cell","left");break;case"insert-right":this.editTable("cell","right");break;case"delete":this.editTable("cell",null)}this._historyPush()}_OnRowEdit(t){switch(t){case"insert-above":this.editTable("row","up");break;case"insert-below":this.editTable("row","down");break;case"delete":this.editTable("row",null)}this._historyPush()}#Yi(t){t.stopPropagation();let e=Math.ceil(t.offsetX/18),i=Math.ceil(t.offsetY/18);e=e<1?1:e,i=i<1?1:i;const s=this.options.get("_rtl");s&&(e=11-e),this.tableHighlight.style.width=e+"em",this.tableHighlight.style.height=i+"em";const n=e<5?5:e>8?10:e+2,o=i<5?5:i>8?10:i+2;if(this.tableUnHighlight.style.width=n+"em",this.tableUnHighlight.style.height=o+"em",s){const t=n-(this.#xi||5);if(0!==t){const e=kt.get(this.tableMenu.style.left);this.tableMenu.style.left=e-18*t+"px",this.#xi=n}}xt.utils.changeTxt(this.tableDisplay,e+" x "+i),this.#wi=[e,i]}#ji(){const t=xt.utils.createElement("TABLE"),e=this.#wi[0],i=this.#wi[1],s=`<tbody>${`<tr>${Fl("td",e)}</tr>`.repeat(i)}</tbody>`,n=`<colgroup>${`<col style="width: ${kt.get(100/e,0)}%;">`.repeat(e)}</colgroup>`;t.innerHTML=n+s;let o="";this.figureScroll&&(o=` se-scroll-figure-${this.figureScroll}`);const l=xt.utils.createElement("FIGURE",{class:"se-flex-component se-input-component"+o,style:"width: 100%;"});if(l.appendChild(t),this.#ki=!0,this.component.insert(l,{insertBehavior:"none"})){this.#Xi(),this.menu.dropdownOff();const e=t.querySelector("td div");this.selection.setRange(e,0,e,0)}}#Wi(t){this.editor._preventBlur=!0;const e=xt.query.getParentElement(xt.query.getEventTarget(t),xt.check.isTableCell);if(this.#Ii){if(e===this.#fi)return this.#Ii=!1,this.#os(),this.#ls(!0),void this.#vt();this.#ls(!1)}else if(!this.#Fi){if(e===this.#fi)return;this.#ls(!1)}e&&e!==this.#bi&&this.#Ri===e.nodeName&&this.#mi===xt.query.getParentElement(e,"TABLE")&&this._setMultiCells(this.#fi,this.#bi=e)}#Ui(t){if(t.stopPropagation(),this.#Ii?this.#qi.touchOff&&=this.eventManager.removeGlobalEvent(this.#qi.touchOff):(this.#ls(!0),this.#vt()),!this.#fi||!this.#mi)return;if(this.#us(),this.#yi=Array.from(this.#mi.querySelectorAll(".se-selected-table-cell")),this.#Ii)return;this.#fi&&this.#bi&&(this.#ps(this.#fi),this.#fi===this.#bi&&xt.utils.removeClass(this.#fi,"se-selected-table-cell"));const e=this.#yi?.length>0?this.#bi:this.#fi;this._setController(e)}#Zi(){if(this.#Fi){this.#vt(),this.#ls(!0),this.#ps(this.#fi);const t=this.#yi?.length>0?this.#bi:this.#fi;this._setController(t)}else this.#as()}#Gi(){this.resetSelectInfo()}#ps(t){_t.isMobile||this.editor.focusEdge(t)}}function Il(t){return/^(TD|TH|TR)$/i.test(t?.nodeName)}function Ol(t,e){const i=t.clientX,s=kt.get(_l.getComputedStyle(e).width,0),n=e.getBoundingClientRect(),o=Math.round(i-n.left),l=o<=6;return{is:l||s-o<=6,isLeft:l,startX:i}}function Rl(t,e){const i=t.clientY,s=kt.get(_l.getComputedStyle(e).height,0),n=e.getBoundingClientRect();return{is:Math.ceil(s+n.top-i)<=6,startY:i}}function Fl(t,e){return`<${t=t.toLowerCase()}><div><br></div></${t}>`.repeat(e)}function zl(t){return t=t.toLowerCase(),xt.utils.createElement(t,null,"<div><br></div>")}function $l(t){this.propTargets.border_style.textContent=t,this._disableBorderProps(t===Sl[0]),this.selectMenu_props_border.close()}function Pl(t,e){const{border_format:i}=this.propTargets;i.setAttribute("se-border-format",e),i.firstElementChild.innerHTML=this.icons[Tl[e]],e!==t?xt.utils.addClass(i,"active"):xt.utils.removeClass(i,"active"),this.selectMenu_props_border_format.close(),this.selectMenu_props_border_format_oneCell.close()}function Dl(t){this.controller_cell.bringToTop(t)}function ql(t,e,i){const s=[];let n="";for(const o in Tl){if(i.includes(o))continue;const l=Tl[o];s.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:s,menus:xt.utils.createElement("DIV",null,n).querySelectorAll("button")}}const Wl=Vl;class Ul extends Do{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 i=function({lang:t},e){const i=["p","blockquote","pre","h1","h2","h3","h4","h5","h6"],s=e&&0!==e.length?e:i;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=s.length;d<u;d++)e=s[d],"string"==typeof e&&i.includes(e)?(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=""):(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>",xt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(t,e.items);this.formatList=i.querySelectorAll("li button"),this.currentFormat="",this.menu.initDropdownTarget(Ul,i)}active(t,e){let i=this.lang.formats;const s=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,s=0,l=e.length;s<l;s++)if(t=e[s],n===t.getAttribute("data-value")&&o===t.getAttribute("data-class")){i=t.title;break}return xt.utils.changeTxt(s,i),s.setAttribute("data-value",n),s.setAttribute("data-class",o),!0}}else xt.utils.changeTxt(s,i);return!1}on(t){const e=this.formatList,i=t.querySelector(".se-txt"),s=(i.getAttribute("data-value")||"")+(i.getAttribute("data-class")||"");if(s!==this.currentFormat){for(let t,i=0,n=e.length;i<n;i++)t=e[i],s===t.getAttribute("data-value")+t.getAttribute("data-class")?xt.utils.addClass(t,"active"):xt.utils.removeClass(t,"active");this.currentFormat=s}}action(t){const e=t.getAttribute("data-command"),i=t.firstElementChild;"block"===e?this.format.applyBlock(i):"br-line"===e?this.format.setBrLine(i):this.format.setLine(i),this.menu.dropdownOff()}applyHeaderByShortcut({keyCode:t}){const e=t.match(/\d+$/)?.[0],i=xt.utils.createElement(`H${e}`);this.format.setLine(i)}}const Zl=Ul;class Gl extends Do{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 i=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 i,s=0,n=(t||[]).length;s<n;s++)i=t[s],e+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-value="${s}" title="${i.name}" aria-label="${i.name}">\n\t\t\t\t\t${i.name}\n\t\t\t\t</button>\n\t\t\t</li>`;return e+="\n\t\t</ul>\n\t</div>",xt.utils.createElement("DIV",{class:"se-list-layer"},e)}(this.items);this.menu.initDropdownTarget(Gl,i)}action(t){const e=Number(t.getAttribute("data-value")),i=this.items[this.selectedIndex=e];if(!i.html)throw this.menu.dropdownOff(),Error('[SUNEDITOR.layout.fail] cause : "layouts[i].html not found"');this.html.set(i.html),this.menu.dropdownOff()}}const Yl=Gl;class jl extends Do{static key="lineHeight";static className="";#ci;constructor(t,e){super(t),this.title=this.lang.lineHeight,this.icon="line_height";const i=function({lang:t},e){const i=e||[{text:"1",value:"1em"},{text:"1.2",value:"1.2em"},{text:"1.7",value:"1.7em"},{text:"2",value:"2em"}];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,e=0,n=i.length;e<n;e++)t=i[e],s+=`\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 s+="\n\t\t</ul>\n\t</div>",xt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},s)}(t,e.items);this.sizeList=i.querySelectorAll("li button"),this.currentSize=null,this.#ci=i.querySelector(".se-sub-list span"),this.menu.initDropdownTarget(jl,i)}active(t,e){return this.format.isLine(t)&&t.style.lineHeight.length>0?(xt.utils.addClass(e,"active"),!0):(xt.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 i=this.sizeList;for(let s=0,n=i.length;s<n;s++)e===i[s].getAttribute("data-command")?(xt.utils.addClass(i[s],"active"),t=!0):xt.utils.removeClass(i[s],"active");this.currentSize=e,t?this.#ci.style.display="none":(this.#ci.textContent=e,this.#ci.style.display="block")}}action(t){const e=t.getAttribute("data-command")||"",i=this.format.getLines();for(let t=0,s=i.length;t<s;t++)i[t].style.lineHeight=e;this.menu.dropdownOff(),this.editor.effectNode=null,this.history.push(!1)}}const Xl=jl;class Kl extends Do{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 i=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 i,s=0,n=(t||[]).length;s<n;s++)i=t[s],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="${s}" \n\t\t\t\ttitle="${i.name}" \n\t\t\t\taria-label="${i.name}"\n\t\t\t>\n\t\t\t\t${i.name}\n\t\t\t</button>\n\t\t</li>`;return e+="</ul></div>",xt.utils.createElement("DIV",{class:"se-list-layer"},e)}(this.items);this.menu.initDropdownTarget(Kl,i)}action(t){const e=Number(t.getAttribute("data-value")),i=this.items[this.selectedIndex=e];if(!i.html)throw this.menu.dropdownOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.html.insert(i.html,{selectInserted:!1,skipCharCount:!1,skipCleaning:!1}),this.menu.dropdownOff()}}const Jl=Kl;class Ql extends Do{static key="paragraphStyle";static className="";constructor(t,e){super(t),this.title=this.lang.paragraphStyle,this.icon="paragraph_style";const i=function({lang:t},e){const i={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:""}},s=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=s.length;r<a;r++){if(t=s[r],"string"==typeof t){const e=i[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>",xt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(t,e.items);this.classList=i.querySelectorAll("li button"),this.menu.initDropdownTarget(Ql,i)}on(){const t=this.classList,e=this.format.getLine(this.selection.getNode());for(let i=0,s=t.length;i<s;i++)xt.utils.hasClass(e,t[i].getAttribute("data-command"))?xt.utils.addClass(t[i],"active"):xt.utils.removeClass(t[i],"active")}action(t){const e=t.getAttribute("data-command");let i=this.format.getLines();if(0===i.length&&(this.selection.getRangeAndAddLine(this.selection.getRange(),null),i=this.format.getLines(),0===i.length))return;const s=xt.utils.hasClass(t,"active")?xt.utils.removeClass:xt.utils.addClass;for(let t=0,n=i.length;t<n;t++)s(i[t],e);this.menu.dropdownOff(),this.history.push(!1)}}const tr=Ql;class er extends Do{static key="textStyle";static className="";constructor(t,e){super(t),this.title=this.lang.textStyle,this.icon="text_style";const i=function({lang:t},e){const i={code:{name:t.menu_code,class:"__se__t-code",tag:"code"},shadow:{name:t.menu_shadow,class:"__se__t-shadow",tag:"span"}},s=e||Object.keys(i);let n='<div class="se-list-inner"><ul class="se-list-basic">';for(let t,e,o,l,r,a,h=0,c=s.length;h<c;h++){if(t=s[h],l="",a="",r=[],"string"==typeof t){const e=i[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>",xt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(t,e.items);this.styleList=i.querySelectorAll("li button"),this.menu.initDropdownTarget(er,i)}on(){const t=this.styleList,e=this.selection.getNode();for(let i,s,n,o=0,l=t.length;o<l;o++){i=t[o],s=i.getAttribute("data-value").split(",");for(let t,o,l=0;l<s.length;l++){for(t=e,n=!1;t&&!this.format.isLine(t)&&!this.component.is(t);){if(t.nodeName.toLowerCase()===i.getAttribute("data-command").toLowerCase()&&(o=s[l],/^\./.test(o)?xt.utils.hasClass(t,o.replace(/^\./,"")):t.style[o])){n=!0;break}t=t.parentNode}if(!n)break}n?xt.utils.addClass(i,"active"):xt.utils.removeClass(i,"active")}}action(t){const e=t.firstElementChild,i=e.style.cssText.replace(/:.+(;|$)/g,",").split(",");i.pop();const s=e.classList;for(let t=0,e=s.length;t<e;t++)i.push("."+s[t]);const n=xt.utils.hasClass(t,"active")?null:e.cloneNode(!1),o=n?null:[e.nodeName];this.inline.apply(n,{stylesToModify:i,nodesToRemove:o,strictRemove:!0}),this.menu.dropdownOff()}}const ir=er;const sr=class extends Zo{static key="link";static className="se-icon-flip-rtl";#xs;constructor(t,e){super(t),this.title=this.lang.link,this.icon="link",e.textToDisplay=!0,e.title=!0;const i=function({lang:t,icons:e}){const i=`\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 xt.utils.createElement("DIV",{class:"se-modal-content"},i)}(t),s=function({lang:t,icons:e}){const i=`\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> </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 xt.utils.createElement("DIV",{class:"se-controller se-controller-link"},i)}(t),n="string"==typeof e.uploadUrl?e.uploadUrl:null;this.target=null,this.isUpdateState=!1,this.pluginOptions={...e,uploadUrl:n,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:kt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:kt.get(e.uploadSingleSizeLimit,0),acceptedFormats:"string"==typeof e.acceptedFormats?e.acceptedFormats.trim():null,enableFileUpload:!!n},this.anchor=new Oo(this,i,this.pluginOptions),this.modal=new No(this,i),this.controller=new as(this,s,{position:"bottom",disabled:!1}),this.#xs=this.controller.form.querySelector("a")}active(t){if(xt.check.isAnchor(t)&&!t.hasAttribute("data-se-non-link")){const e=this.#xs,i=t.getAttribute("href");return e.href=i,e.textContent=e.title=t.textContent,e.target=i?.startsWith("#")?t.target:"_blank",xt.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(xt.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=xt.query.getEdgeChild(this.controller.currentTarget,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!1),e=xt.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 xt.utils.removeItem(this.controller.currentTarget),this.controller.currentTarget=null,this.editor.focus(),this.history.push(!1)}controllerClose(){xt.utils.removeClass(this.controller.currentTarget,"on")}},{NO_EVENT:nr}=_t;class or extends Zo{static key="image";static className="";static component(t){const e=xt.check.isFigure(t)||/^span$/i.test(t.nodeName)&&xt.check.isComponentContainer(t)?t.firstElementChild:t;return/^IMG$/i.test(e?.nodeName)?e:xt.check.isAnchor(e)&&/^IMG$/i.test(e?.firstElementChild?.nodeName)?e?.firstElementChild:null}#ks;#Es;#Ss;#Ts;#Hs;#ii;#Ls;#Ms;#Ns;#As;#Bs;#Vs;#vi;#Is;#Os;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?kt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"auto",defaultHeight:e.defaultHeight?kt.is(e.defaultHeight)?e.defaultHeight+"px":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:kt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:kt.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?"image/*":e.acceptedFormats.trim()||"image/*",useFormatType:e.useFormatType??!0,defaultFormatType:["block","inline"].includes(e.defaultFormatType)?e.defaultFormatType:"block",keepFormatType:e.keepFormatType??!1,insertBehavior:e.insertBehavior};const i=this.pluginOptions.percentageOnlySize?"%":"px",s=function({lang:t,icons:e,plugins:i},s){const n=s.createFileInput?`\n\t\t<div class="se-modal-form">\n\t\t\t<label>${t.image_modal_file}</label>\n\t\t\t${No.CreateFileInput({icons:e,lang:t},s)}\n\t\t</div>`:"",o=s.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${i.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${xt.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=s.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"> </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/> ${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${xt.utils.createTooltipInner(t.revert)}\n\t\t\t</button>\n\t\t</div>`:"",r=s.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${xt.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${xt.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 style="border-bottom: 1px dashed #ccc;"></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" /> ${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=xt.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")}}(t,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=s.alignForm,o.some((t=>t.includes("align")))||(this.alignForm.style.display="none");const l=this.plugins.link?this.plugins.link.pluginOptions:{};this.anchor=new Oo(this,s.html,{...l,textToDisplay:!1,title:!0}),this.modal=new No(this,s.html),this.figure=new ws(this,o,{sizeUnit:i}),this.fileManager=new Bo(this,{query:"img",loadEventName:"onImageLoad",actionEventName:"onImageAction"}),this.fileModalWrapper=s.fileModalWrapper,this.imgInputFile=s.imgInputFile,this.imgUrlFile=s.imgUrlFile,this.focusElement=this.imgInputFile||this.imgUrlFile,this.altText=s.altText,this.captionCheckEl=s.captionCheckEl,this.captionEl=this.captionCheckEl?.parentElement,this.previewSrc=s.previewSrc,this.sizeUnit=i,this.as="block",this.proportion=null,this.inputX=null,this.inputY=null,this._base64RenderIndex=0,this.#ks=0,this.#Es=null,this.#Ss="",this.#Ts="none",this.#Hs="30%",this.#ii=null,this.#Ls=null,this.#Ms=null,this.#Ns=null,this.#As={w:0,h:0},this.#Bs="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.#Vs="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.#vi=this.pluginOptions.canResize,this.#Is=this.pluginOptions.percentageOnlySize,this.#Os=!this.#vi||!this.pluginOptions.showHeightInput||this.#Is,this.eventManager.addEvent(s.tabs,"click",this.#Rs.bind(this)),this.imgInputFile&&this.eventManager.addEvent(s.fileRemoveBtn,"click",this.#Fs.bind(this)),this.imgUrlFile&&this.eventManager.addEvent(this.imgUrlFile,"input",this.#zs.bind(this)),this.imgInputFile&&this.imgUrlFile&&this.eventManager.addEvent(this.imgInputFile,"change",this.#$s.bind(this));const r=s.galleryButton;if(r&&this.eventManager.addEvent(r,"click",this.#Ps.bind(this)),this.#vi){this.proportion=s.proportion,this.inputX=s.inputX,this.inputY=s.inputY,this.inputX.value=this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight;const t=this.#Ds.bind(this);this.eventManager.addEvent(this.inputX,"keyup",this.#qs.bind(this,"x")),this.eventManager.addEvent(this.inputY,"keyup",this.#qs.bind(this,"y")),this.eventManager.addEvent(this.inputX,"change",t),this.eventManager.addEvent(this.inputY,"change",t),this.eventManager.addEvent(this.proportion,"change",t),this.eventManager.addEvent(s.revertBtn,"click",this.#Ws.bind(this))}this.pluginOptions.useFormatType&&(this.as=this.pluginOptions.defaultFormatType,this.asBlock=s.asBlock,this.asInline=s.asInline,this.eventManager.addEvent([this.asBlock,this.asInline],"click",this.#Us.bind(this)))}open(){this.#ks=0,this.modal.open()}retainFormat(){return{query:"img",method:t=>{const e=ws.GetContainer(t);if(e&&e.container&&(e.cover||e.inlineCover))return;const{w:i,h:s}=this.#Zs(t,!0);this.#Gs(i,s)}}}onFilePasteAndDrop({file:t}){/^image/.test(t.type)&&(this.submitFile([t]),this.editor.focus())}modalOn(t){t?this.imgInputFile&&this.pluginOptions.allowMultiple&&this.imgInputFile.removeAttribute("multiple"):(this.#vi&&(this.inputX.value=this.#Bs="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.inputY.value=this.#Vs="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight),this.imgInputFile&&this.pluginOptions.allowMultiple&&this.imgInputFile.setAttribute("multiple","multiple")),this.anchor.on(t)}async modalAction(){return this.#Ts=this.modal.form.querySelector('input[name="suneditor_image_radio"]:checked').value,this.modal.isUpdate&&(this.#Ys(this.inputX?.value,this.inputY?.value),this.history.push(!1)),this.imgInputFile&&this.imgInputFile.files.length>0?await this.submitFile(this.imgInputFile.files):!!(this.imgUrlFile&&this.#Ss.length>0)&&await this.submitURL(this.#Ss)}modalInit(){No.OnChangeFile(this.fileModalWrapper,[]),this.imgInputFile&&(this.imgInputFile.value=""),this.imgUrlFile&&(this.#Ss=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.#ii=null,this.#As={w:0,h:0},this.#Rs("init"),this.#vi&&(this.inputX.value="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.inputY.value="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.proportion.checked=!0),this.pluginOptions.useFormatType&&this.#js("inline"===(this.pluginOptions.keepFormatType?this.as:this.pluginOptions.defaultFormatType)),this.anchor.init()}componentSelect(t){this.#Zs(t)}componentEdit(){this.modal.open()}async componentDestroy(t){const e=t||this.#ii,i=xt.query.getParentElement(e,ws.is)||e,s=i.previousElementSibling||i.nextElementSibling,n=i.parentNode;!1!==await this.triggerEvent("onImageDeleteBefore",{element:e,container:i,align:this.#Ts,alt:this.altText.value,url:this.#Ss})&&(xt.utils.removeItem(i),this.modalInit(),n!==this.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.editor.focusEdge(s),this.history.push(!1))}async submitFile(t){if(0===t.length)return!1;let e=0;const i=[],s=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,s>0&&o>s){const t="[SUNEDITOR.imageUpload.fail] Size of uploadable single file: "+s/1e3+"KB",e=await this.triggerEvent("onImageUploadError",{error:t,limitSize:s,uploadSize:o,file:n});return this.ui.alertOpen(e===nr?t:e||t,"error"),!1}i.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",i=await this.triggerEvent("onImageUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.ui.alertOpen(i===nr?t:i||t,"error"),!1}const l={files:i,...this.#Xs()},r=function(t,e,i){t(e=i||e,e.files)}.bind(this,this.#Ks.bind(this),l),a=await this.triggerEvent("onImageUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==nr||r(null)))}async submitURL(t){if(!(t||=this.#Ss))return!1;const e={name:t.split("/").pop(),size:0},i={url:t,files:e,...this.#Xs()},s=function(t,e,i){t(e=i||e)}.bind(this,this.#Js.bind(this),i),n=await this.triggerEvent("onImageUploadBefore",{info:i,handler:s});return void 0===n||!1!==n&&(null!==n&&"object"==typeof n&&s(n),!0!==n&&n!==nr||s(null),!0)}create(t,e,i,s,n,o,l,r){const a=xt.utils.createElement("IMG");a.src=t,a.alt=l,e=this.#Qs(a,e?e.cloneNode(!1):null);const h=ws.CreateContainer(e,"se-image-container"),c=h.cover,d=h.container;this.captionCheckEl.checked&&(this.#Ns=ws.CreateCaption(c,this.lang.caption)),this.#ii=a,this.#Ls=c,this.#Ms=d,this.figure.open(a,{nonResizing:this.#Os,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0}),this.#tn(i,s),this.figure.setAlign(a,n),this.fileManager.setFileData(a,o),this.#ks++,a.onload=this.#en.bind(this,a,this.#Hs,d),this.component.insert(d,{scrollTo:!!r,insertBehavior:r?null:"line"})}createInline(t,e,i,s,n,o,l){const r=xt.utils.createElement("IMG");r.src=t,r.alt=o,e=this.#Qs(r,e?e.cloneNode(!1):null);const a=ws.CreateInlineContainer(e,"se-image-container").container;this.#ii=r,this.#Ms=a,this.figure.open(r,{nonResizing:this.#Os,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0}),this.#tn(i,s),this.fileManager.setFileData(r,n),this.#ks++,r.onload=this.#en.bind(this,r,this.#Hs,a),this.component.insert(a,{scrollTo:!!l,insertBehavior:l?null:"line"})}#Zs(t,e=!1){if(!t)return;const i=this.figure.open(t,{nonResizing:this.#Os,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:e});this.anchor.set(xt.check.isAnchor(t.parentNode)?t.parentNode:null),this.#Es=this.anchor.currentTarget,this.#ii=t,this.#Ls=i.cover,this.#Ms=i.container,this.#Ns=i.caption,this.#Ts=i.align,t.style.float="",this.#Bs=String(i.originWidth||i.w||""),this.#Vs=String(i.originHeight||i.h||""),this.altText.value=this.#ii.alt,this.imgUrlFile&&(this.#Ss=this.previewSrc.textContent=this.imgUrlFile.value=this.#ii.src);(this.modal.form.querySelector('input[name="suneditor_image_radio"][value="'+this.#Ts+'"]')||this.modal.form.querySelector('input[name="suneditor_image_radio"][value="none"]')).checked=!0,this.captionCheckEl.checked=!!this.#Ns;const{dw:s,dh:n}=this.figure.getSize(t);if(!this.#vi)return{w:s,h:n};this.inputX.value="auto"===s?"":s,this.inputY.value="auto"===n?"":n;const o=this.#Is&&this.figure.isVertical;return this.proportion.checked=!0,this.inputX.disabled=!!o,this.inputY.disabled=!!o,this.proportion.disabled=!!o,this.#As=this.proportion.checked?i.ratio:{w:0,h:0},this.pluginOptions.useFormatType&&this.#js(this.component.isInline(i.container)),{w:s,h:n}}#Xs(){return{element:this.#ii,anchor:this.anchor.create(!0),inputWidth:this.inputX?.value||"",inputHeight:this.inputY?.value||"",align:this.#Ts,isUpdate:this.modal.isUpdate,alt:this.altText.value}}#js(t){t?(xt.utils.addClass(this.asInline,"on"),xt.utils.removeClass(this.asBlock,"on"),this.as="inline",this.alignForm&&(this.alignForm.style.display="none"),this.captionEl&&(this.captionEl.style.display="none")):(xt.utils.addClass(this.asBlock,"on"),xt.utils.removeClass(this.asInline,"on"),this.as="block",this.alignForm&&(this.alignForm.style.display=""),this.captionEl&&(this.captionEl.style.display=""))}#Ys(t,e){t||=this.inputX?.value||"auto",e||=this.inputY?.value||"auto";let i=this.#ii;("block"===this.as&&!this.#Ls||"inline"===this.as&&this.#Ls)&&(i=this.figure.convertAsFormat(i,this.as));const s=this.#Ls,n=this.#Ms===this.#Ls?null:this.#Ms;let o;const l=kt.is(t)?t+this.sizeUnit:t,r=kt.is(e)?e+this.sizeUnit:e;o=/%$/.test(i.style.width)?l!==n.style.width||r!==n.style.height:l!==i.style.width||r!==i.style.height,i.alt=this.altText.value;let a=!1;this.captionCheckEl.checked?this.#Ns||(this.#Ns=ws.CreateCaption(s,this.lang.caption),a=!0):this.#Ns&&(xt.utils.removeItem(this.#Ns),this.#Ns=null,a=!0);let h=!1;const c=this.anchor.create(!0);if(c)this.#Es===c&&n.contains(c)||(this.#Es=c.cloneNode(!1),s.insertBefore(this.#Qs(i,this.#Es),this.#Ns),h=!0);else if(null!==this.#Es&&s.contains(this.#Es)){const t=i.cloneNode(!0);s.removeChild(this.#Es),s.insertBefore(t,this.#Ns),i=t}h&&xt.utils.removeItem(c),this.#vi&&o&&this.#tn(t,e),(a||!this.#Is&&o)&&(/\d+/.test(i.style.height)||this.figure.isVertical&&this.captionCheckEl.checked)&&(/auto|%$/.test(t)||/auto|%$/.test(e)?this.figure.deleteTransform(i):this.#vi&&o&&this.figure.isVertical||this.figure.setTransform(i,t,e,0)),this.figure.setAlign(i,this.#Ts),i.onload=()=>{this.componentSelect(i)}}#Gs(t,e){t||=this.inputX?.value||"auto",e||=this.inputY?.value||"auto";let i=this.#ii,s=this.#Ls,n=null,o=this.#Ms===this.#Ls?null:this.#Ms,l=!1;if(!s||!o){l=!0,i=this.#ii.cloneNode(!0);const e=this.pluginOptions.useFormatType&&"auto"!==t&&(/^span$/i.test(this.#ii.parentElement?.nodeName)||this.format.isLine(this.#ii.parentElement))?ws.CreateInlineContainer(i,"se-image-container"):ws.CreateContainer(i,"se-image-container");s=e.cover,o=e.container,n=e.inlineCover,this.figure.open(i,{nonResizing:!0,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0})}i.alt=this.altText.value;let r=!1;n||(this.captionCheckEl.checked?this.#Ns&&!l||(this.#Ns=ws.CreateCaption(s,this.lang.caption),r=!0):this.#Ns&&(xt.utils.removeItem(this.#Ns),this.#Ns=null,r=!0));let a=null;const h=this.anchor.create(!0);if(h)(this.#Es!==h||l&&!o.contains(h))&&(this.#Es=h.cloneNode(!1),s.insertBefore(this.#Qs(i,this.#Es),this.#Ns),a=this.#ii);else if(null!==this.#Es&&s.contains(this.#Es)){const t=i.cloneNode(!0);s.removeChild(this.#Es),s.insertBefore(t,this.#Ns),i=t}l&&(i=this.#ii,this.figure.retainFigureFormat(o,this.#ii,a?h:null,this.fileManager),this.#ii=i=o.querySelector("img"),this.#Ls=s,this.#Ms=o),i.style.width="",i.style.height="",i.removeAttribute("width"),i.removeAttribute("height"),this.#tn(t,e),a&&(l?(xt.utils.removeItem(a),0===xt.query.getListChildren(h,(t=>/IMG/i.test(t.tagName)),null).length&&xt.utils.removeItem(h)):xt.utils.removeItem(h)),!r&&this.#Is||(/\d+/.test(i.style.height)||this.figure.isVertical&&this.captionCheckEl.checked)&&(/auto|%$/.test(t)||/auto|%$/.test(e)?this.figure.deleteTransform(i):this.figure.setTransform(i,t,e,0)),this.figure.setAlign(i,this.#Ts)}#in(t,e,i,s,n,o,l,r){"inline"!==this.as?this.create(t,e,i,s,n,o,l,r):this.createInline(t,e,i,s,o,l,r)}#tn(t,e){t||=this.inputX?.value||this.pluginOptions.defaultWidth,e||=this.inputY?.value||this.pluginOptions.defaultHeight,this.#Is&&(t?/%$/.test(t)&&(t+="%"):t="100%"),this.figure.setSize(t,e)}#sn(t,e,i){e.src=t,this.fileManager.setFileData(e,i),this.component.select(e,or.key)}#Ke(t,e){this.#ks=0;const i=e.result;for(let e,s=0,n=i.length;s<n;s++){if(e={name:i[s].name,size:i[s].size},t.isUpdate){this.#sn(i[s].url,t.element,e);break}this.#in(i[s].url,t.anchor,t.inputWidth,t.inputHeight,t.align,e,t.alt,s===n-1)}}#Ks(t,e){if(!e)return;const i=this.pluginOptions.uploadUrl;"string"==typeof i&&i.length>0?this.fileManager.upload(i,this.pluginOptions.uploadHeaders,e,this.#nn.bind(this,t),this.#Je.bind(this)):this.#on(e,t.anchor,t.inputWidth,t.inputHeight,t.align,t.alt,t.isUpdate)}#Js(t){this.#ks=0;const e=t.url;this.modal.isUpdate?this.#sn(e,t.element,t.files):this.#in(e,t.anchor,t.inputWidth,t.inputHeight,t.align,t.files,t.alt,!0)}#on(t,e,i,s,n,o,l){try{const r=this.modal.isUpdate?1:t.length;if(0===r)return this.ui.hideLoading(),void console.warn("[SUNEDITOR.image.base64.fail] cause : No applicable files");this._base64RenderIndex=r;const a=new Array(r);this.#vi&&(this.inputX.value=i,this.inputY.value=s);for(let h,c,d=0,u=this.#ln.bind(this);d<r;d++)h=new FileReader,c=t[d],h.onload=function(t,l,r,h,c,d){a[d]={result:l.result,file:c},0==--this._base64RenderIndex&&(t(r,a,h,e,i,s,n,o),this.ui.hideLoading())}.bind(this,u,h,l,this.#ii,c,d),h.readAsDataURL(c)}catch(t){throw this.ui.hideLoading(),Error(`[SUNEDITOR.plugins.image._setBase64.fail] ${t.message}`)}}#ln(t,e,i,s,n,o,l,r){this.#ks=0;for(let a=0,h=e.length;a<h;a++)t?this.#sn(e[a].result,i,e[a].file):this.#in(e[a].result,s,n,o,l,e[a].file,r,a===h-1)}#Qs(t,e){return e?(e.appendChild(t),e):t}async#Je(t){const e=await this.triggerEvent("onImageUploadError",{error:t}),i=e===nr?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.image.error]",i)}async#nn(t,e){if(await this.triggerEvent("imageUploadHandler",{xmlHttp:e,info:t})===nr){const i=JSON.parse(e.responseText);i.errorMessage?this.#Je(i):this.#Ke(t,i)}}#Rs(t){const e=this.modal.form,i="string"==typeof t?e.querySelector("._se_tab_link"):xt.query.getEventTarget(t);if(!/^BUTTON$/i.test(i.tagName))return!1;const s=i.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++)xt.utils.removeClass(l[n],"active");return e.querySelector("._se_tab_content_"+s).style.display="block",xt.utils.addClass(i,"active"),"init"!==t&&("image"===s?this.focusElement.focus():"url"===s&&this.anchor.urlInput.focus()),!1}#Fs(){this.imgInputFile.value="",this.imgUrlFile&&(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),No.OnChangeFile(this.fileModalWrapper,[])}#qs(t,e){if(Et.isSpace(e.code))e.preventDefault();else if("x"===t&&this.#Is&&e.target.value>100)e.target.value=100;else if(this.proportion.checked){const e=ws.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this.#As);"x"===t?this.inputY.value=String(e.h):this.inputX.value=String(e.w)}}#Ds(){this.#As=this.proportion.checked?ws.GetRatio(this.inputX.value,this.inputY.value,this.sizeUnit):{w:0,h:0}}#Ws(){this.#Is?this.inputX.value=Number(this.#Bs)>100?"100":this.#Bs:(this.inputX.value=this.#Bs,this.inputY.value=this.#Vs)}#Us({target:t}){this.#js("asInline"===t.getAttribute("data-command"))}#zs(t){const e=t.target.value.trim();this.#Ss=this.previewSrc.textContent=e?this.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#$s({target:t}){this.imgInputFile.value?(this.imgUrlFile.disabled=!0,this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),No.OnChangeFile(this.fileModalWrapper,t.files)}#Ps(){this.plugins.imageGallery.open(this.#rn.bind(this))}#rn(t){this.altText.value=t.getAttribute("data-value")||t.alt,this.#Ss=this.previewSrc.textContent=this.imgUrlFile.value=t.getAttribute("data-command")||t.src,this.imgUrlFile.focus()}#en(t,e,i){this.#ks--,delete t.onload,0===t.offsetWidth&&this.#tn(e,""),0===this.#ks&&(this.component.applyInsertBehavior(i,null,this.pluginOptions.insertBehavior||this.options.get("componentInsertBehavior")),this.editor._iframeAutoHeight(this.frameContext),this.history.push(!1))}}const lr=or,{_w:rr,NO_EVENT:ar}=_t;class hr extends Zo{static key="video";static className="";static component(t){return/^(VIDEO)$/i.test(t?.nodeName)||/^(IFRAME)$/i.test(t?.nodeName)&&this.checkContentType(t.src)?t:null}#Ss;#Ts;#an;#hn;#cn;#dn;#ii;#Ms;#As;#Bs;#Vs;#vi;#Is;#Os;#un;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&&kt.get(e.defaultWidth,0)?kt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight&&kt.get(e.defaultHeight,0)?kt.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:kt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:kt.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?"video/*":e.acceptedFormats.trim()||"video/*",defaultRatio:kt.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 i=this.pluginOptions.percentageOnlySize?"%":"px",s=function({lang:t,icons:e,plugins:i},s){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">`;s.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${No.CreateFileInput({lang:t,icons:e},s)}\n\t\t\t</div>`);s.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${i.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${xt.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>`);if(s.canResize){const i=s.ratioOptions||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285},{name:"9:16",value:1.78}],o=s.defaultRatio,l=s.percentageOnlySize,r=l?' style="display: none !important;"':"",a=s.showHeightInput?"":' style="display: none !important;"',h=s.showRatioOption?"":' style="display: none !important;"',c=l||s.showHeightInput||s.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"> </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*s.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${i.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" /> \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=xt.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")}}(t,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")))||(s.alignForm.style.display="none");const o=100*this.pluginOptions.defaultRatio+"%";this.modal=new No(this,s.html),this.figure=new ws(this,n,{sizeUnit:i,autoRatio:{current:o,default:o}}),this.fileManager=new Bo(this,{query:"iframe, video",loadEventName:"onVideoLoad",actionEventName:"onVideoAction"}),this.fileModalWrapper=s.fileModalWrapper,this.videoInputFile=s.videoInputFile,this.videoUrlFile=s.videoUrlFile,this.focusElement=this.videoUrlFile||this.videoInputFile,this.previewSrc=s.previewSrc,this.sizeUnit=i,this.proportion=null,this.frameRatioOption=null,this.inputX=null,this.inputY=null,this.#Ss="",this.#Ts="none",this.#an=o,this.#hn=o,this.#cn="100%",this.#dn=100*this.pluginOptions.defaultRatio+"%",this.#ii=null,this.#Ms=null,this.#As={w:0,h:0},this.#Bs="100%"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.#Vs=this.pluginOptions.defaultHeight===o?"":this.pluginOptions.defaultHeight,this.#vi=this.pluginOptions.canResize,this.#Is=this.pluginOptions.percentageOnlySize,this.#Os=!this.#vi||!this.pluginOptions.showHeightInput||this.#Is,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);this.extensions=[".mp4",".avi",".mov",".webm",".flv",".mkv",".m4v",".ogv"].concat(this.pluginOptions.extensions||[]),this.urlPatterns=l.concat([/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\//]).concat(e.urlPatterns||[]);const r=s.galleryButton;if(r&&this.eventManager.addEvent(r,"click",this.#Ps.bind(this)),this.videoInputFile&&this.eventManager.addEvent(s.fileRemoveBtn,"click",this.#Fs.bind(this)),this.videoUrlFile&&this.eventManager.addEvent(this.videoUrlFile,"input",this.#zs.bind(this)),this.videoInputFile&&this.videoUrlFile&&this.eventManager.addEvent(this.videoInputFile,"change",this.#$s.bind(this)),this.#vi){this.#un=null,this.proportion=s.proportion,this.frameRatioOption=s.frameRatioOption,this.inputX=s.inputX,this.inputY=s.inputY,this.inputX.value=this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight;const t=this.#Ds.bind(this);this.eventManager.addEvent(this.inputX,"keyup",this.#qs.bind(this,"x")),this.eventManager.addEvent(this.inputY,"keyup",this.#qs.bind(this,"y")),this.eventManager.addEvent(this.inputX,"change",t),this.eventManager.addEvent(this.inputY,"change",t),this.eventManager.addEvent(this.proportion,"change",t),this.eventManager.addEvent(this.frameRatioOption,"change",this.#pn.bind(this)),this.eventManager.addEvent(s.revertBtn,"click",this.#Ws.bind(this))}}open(){this.modal.open()}retainFormat(){return{query:"iframe, video",method:async t=>{if(/^(iframe)$/i.test(t?.nodeName)&&!this.checkContentType(t.src))return;const e=ws.GetContainer(t);if(e&&e.container&&e.cover)return;this.#Zs(t,!0);const i=this.format.getLine(t);i&&(this.#Ts=i.style.textAlign||i.style.float),this.#Ys(t)}}}onFilePasteAndDrop({file:t}){/^video/.test(t.type)&&(this.submitFile([t]),this.editor.focus())}modalOn(t){t?this.videoInputFile&&this.pluginOptions.allowMultiple&&this.videoInputFile.removeAttribute("multiple"):(this.#vi&&(this.inputX.value=this.#Bs=this.pluginOptions.defaultWidth===this.#cn?"":this.pluginOptions.defaultWidth,this.inputY.value=this.#Vs=this.pluginOptions.defaultHeight===this.#dn?"":this.pluginOptions.defaultHeight,this.proportion.disabled=!0),this.videoInputFile&&this.pluginOptions.allowMultiple&&this.videoInputFile.setAttribute("multiple","multiple")),this.#vi&&(this.#gn(this.figure.isVertical?"":this.#Vs||this.#hn),this.#un=this.frameRatioOption?.value)}async modalAction(){this.#Ts=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.#Ss.length>0&&(t=await this.submitURL(this.#Ss)),t&&rr.setTimeout(this.component.select.bind(this.component,this.#ii,hr.key),0),t}modalInit(){No.OnChangeFile(this.fileModalWrapper,[]),this.videoInputFile&&(this.videoInputFile.value=""),this.videoUrlFile&&(this.#Ss=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.#As={w:0,h:0},this.#Os=!1,this.#vi&&(this.inputX.value=this.pluginOptions.defaultWidth===this.#cn?"":this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight===this.#dn?"":this.pluginOptions.defaultHeight,this.proportion.checked=!1,this.proportion.disabled=!0,this.#gn(this.#hn))}componentSelect(t){this.#Zs(t)}componentEdit(){this.modal.open()}async componentDestroy(t){const e=t||this.#ii,i=xt.query.getParentElement(e,ws.is)||e,s=i.previousElementSibling||i.nextElementSibling,n=i.parentNode;!1!==await this.triggerEvent("onVideoDeleteBefore",{element:e,container:i,align:this.#Ts,url:this.#Ss})&&(xt.utils.removeItem(i),this.modalInit(),n!==this.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.editor.focusEdge(s),this.history.push(!1))}checkContentType(t){return t=t?.toLowerCase()||"",!(!this.extensions.some((e=>t.endsWith(e)))&&!this.urlPatterns.some((e=>e.test(t))))}findProcessUrl(t){const e=this.query;for(const i in e){const s=e[i];if(s.pattern.test(t))return{origin:t,url:s.action(t),tag:s.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 i=t.split("?");t=i[0]+"?"+e+"&"+i[1]}else t+="?"+e;return t}create(t,e,i,s,n,o,l,r){let a=null;if(o){if((t=this.#ii).src!==e){const i=this.findProcessUrl(e);if(/^iframe$/i.test(i?.tag)&&!/^iframe$/i.test(t.nodeName)){const i=this.createIframeTag();i.src=e,t.replaceWith(i),this.#ii=t=i}else if(/^video$/i.test(i?.tag)&&!/^video$/i.test(t.nodeName)){const i=this.createVideoTag();i.src=e,t.replaceWith(i),this.#ii=t=i}else t.src=e}a=this.#Ms}else{t.src=e,this.#ii=t;a=ws.CreateContainer(t,"se-video-container").container}this.#ii=t,this.#Ms=a,this.figure.open(t,{nonResizing:this.#Os,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0}),i||=this.#cn,s||=this.#an;const h=this.figure.getSize(t),c=h.w!==i||h.h!==s,d=!o||c;d&&(this.#un!==this.frameRatioOption?.value&&this.figure.deleteTransform(),this.#tn(i,s)),this.figure.setAlign(t,n),this.fileManager.setFileData(t,l),o?(this.#vi&&d&&this.figure.isVertical||this.figure.setTransform(t,i,s,0),this.history.push(!1)):this.component.insert(a,{scrollTo:!!r,insertBehavior:r?this.pluginOptions.insertBehavior:"line"})}createIframeTag(t){const e=xt.utils.createElement("IFRAME");if(t)for(const i in t)e[i]=t[i];return this.#mn(e),e}createVideoTag(t){const e=xt.utils.createElement("VIDEO");if(t)for(const i in t)e[i]=t[i];return this.#fn(e),e}async submitFile(t){if(0===t.length)return;let e=0;const i=[],s=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,s>0&&o>s){const t="[SUNEDITOR.videoUpload.fail] Size of uploadable single file: "+s/1e3+"KB",e=await this.triggerEvent("onVideoUploadError",{error:t,limitSize:s,uploadSize:o,file:n});return this.ui.alertOpen(e===ar?t:e||t,"error"),!1}i.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",i=await this.triggerEvent("onVideoUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.ui.alertOpen(i===ar?t:i||t,"error"),!1}const l={url:null,files:i,...this.#Xs()},r=function(t,e,i){t(e=i||e,e.files)}.bind(this,this.#Ks.bind(this),l),a=await this.triggerEvent("onVideoUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==ar||r(null)))}async submitURL(t){if(!(t=this.#Ss))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 i={name:t.split("/").pop(),size:0},s={url:t,files:i,...this.#Xs(),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,s),o=await this.triggerEvent("onVideoUploadBefore",{info:s,handler:n});return void 0===o||!1!==o&&(null!==o&&"object"==typeof o&&n(o),!0!==o&&o!==ar||n(null),!0)}#Zs(t,e=!1){if(!t)return;const i=this.figure.open(t,{nonResizing:this.#Os,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:e});this.#ii=t,this.#Ms=i.container,this.#Ts=i.align,t.style.float="",this.#Bs=String(i.width||i.originWidth||i.w||""),this.#Vs=String(i.height||i.originHeight||i.h||"");const s=i.height||i.h||this.#Vs||"";this.videoUrlFile&&(this.#Ss=this.previewSrc.textContent=this.videoUrlFile.value=this.#ii.src||this.#ii.querySelector("source")?.src||"");if((this.modal.form.querySelector('input[name="suneditor_video_radio"][value="'+this.#Ts+'"]')||this.modal.form.querySelector('input[name="suneditor_video_radio"][value="none"]')).checked=!0,!this.#vi)return;const n=this.#Is&&this.figure.isVertical,{dw:o,dh:l}=this.figure.getSize(t);this.inputX.value="auto"===o?"":o,this.inputY.value="auto"===l?"":l,this.#gn(s)||(this.inputY.value=String(this.#Is?kt.get(s,2):s)),this.proportion.checked=!0,this.inputX.disabled=!!n,this.inputY.disabled=!!n,this.proportion.disabled=!!n,i.isVertical&&(this.proportion.checked=!1),this.#As=this.proportion.checked?i.ratio:{w:0,h:0}}#tn(t,e){t||=this.inputX?.value||this.pluginOptions.defaultWidth,e||=this.inputY?.value||this.pluginOptions.defaultHeight,this.#Is&&(t?/%$/.test(t+"")&&(t+="%"):t="100%"),this.figure.setSize(t,e)}#Xs(){return{inputWidth:this.inputX?.value||"",inputHeight:this.inputY?.value||"",align:this.#Ts,isUpdate:this.modal.isUpdate,element:this.#ii}}#Ys(t){if(!t)return;/^video$/i.test(t.nodeName)?this.#fn(t):/^iframe$/i.test(t.nodeName)&&this.#mn(t);const e=t,i=t.cloneNode(!0),s=ws.CreateContainer(i,"se-video-container"),n=s.container,o=ws.GetContainer(e)?.container?.querySelector("figcaption");let l=null;o&&(l=xt.utils.createElement("figcaption"),l.innerHTML=o.innerHTML,xt.utils.removeItem(o),s.cover.appendChild(l)),this.figure.open(i,{nonResizing:this.#Os,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0});const r=(i.getAttribute("data-se-size")||",").split(","),a=r[0]||e.width||"",h=r[1]||e.height||this.#hn||"";this.#tn(a,h);const c=this.format.getLine(e);return c&&(this.#Ts=c.style.textAlign||c.style.float),this.figure.setAlign(i,this.#Ts),this.figure.retainFigureFormat(n,this.#ii,null,this.fileManager),i}#Ke(t,e){const i=e.result,s=this.createVideoTag();for(let e=0,n=i.length;e<n;e++){const o=t.isUpdate?t.element:s.cloneNode(!1);this.create(o,i[e].url,t.inputWidth,t.inputHeight,t.align,t.isUpdate,{name:i[e].name,size:i[e].size},e===n-1)}}#Ks(t,e){if(!e)return;const i=this.pluginOptions.uploadUrl;"string"==typeof i&&i.length>0&&this.fileManager.upload(i,this.pluginOptions.uploadHeaders,e,this.#nn.bind(this,t),this.#Je.bind(this))}#fn(t){t.setAttribute("controls","true");const e=this.pluginOptions.videoTagAttributes;if(e)for(const i in e)t.setAttribute(i,e[i])}#mn(t){t.frameBorder="0",t.allowFullscreen=!0;const e=this.pluginOptions.iframeTagAttributes;if(e)for(const i in e)t.setAttribute(i,e[i])}#gn(t){if(!this.frameRatioOption)return;let e=!1;const i=this.frameRatioOption.options;/%$/.test(t+"")||this.#Is?t=kt.get(t,2)/100+"":(!kt.is(t)||Number(t)>=1)&&(t=""),this.inputY.placeholder="";for(let s=0,n=i.length;s<n;s++)i[s].value===t?(e=i[s].selected=!0,this.inputY.placeholder=t?100*Number(t)+"%":""):i[s].selected=!1;return e}async#Je(t){const e=await this.triggerEvent("onVideoUploadError",{error:t}),i=e===ar?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.video.error]",e)}async#nn(t,e){if(await this.triggerEvent("videoUploadHandler",{xmlHttp:e,info:t})===ar){const i=JSON.parse(e.responseText);i.errorMessage?this.#Je(i):this.#Ke(t,i)}}#Fs(){this.videoInputFile.value="",this.videoUrlFile&&(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),No.OnChangeFile(this.fileModalWrapper,[])}#zs(t){const e=xt.query.getEventTarget(t).value.trim();/^<iframe.*\/iframe>$/.test(e)?(this.#Ss=e,this.previewSrc.textContent='<IFrame :src=".."></IFrame>'):this.#Ss=this.previewSrc.textContent=e?this.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#Ps(){this.plugins.videoGallery.open(this.#rn.bind(this))}#rn(t){this.#Ss=this.previewSrc.textContent=this.videoUrlFile.value=t.getAttribute("data-command")||t.src,this.videoUrlFile.focus()}#$s(t){this.videoInputFile.value?(this.videoUrlFile.disabled=!0,this.previewSrc.style.textDecoration="line-through"):(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration="");const e=xt.query.getEventTarget(t);No.OnChangeFile(this.fileModalWrapper,e.files)}#Ws(){this.#Is?this.inputX.value=Number(this.#Bs)>100?"100":this.#Bs:(this.inputX.value=this.#Bs,this.inputY.value=this.#Vs)}#pn(t){const e=xt.query.getEventTarget(t),i=e.options[e.selectedIndex].value;this.#dn=this.figure.autoRatio.current=this.#an=i?100*Number(i)+"%":this.#dn,this.inputY.placeholder=i?100*Number(i)+"%":"",this.inputY.value=""}#Ds(){this.#As=this.proportion.checked?ws.GetRatio(this.inputX.value,this.inputY.value,this.sizeUnit):{w:0,h:0}}#qs(t,e){if(Et.isSpace(e.code))return void e.preventDefault();const i=xt.query.getEventTarget(e);if("x"===t&&this.#Is&&Number(i.value)>100)i.value="100";else if(this.proportion.checked&&!this.frameRatioOption?.value){const e=ws.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this.#As);"x"===t?this.inputY.value=String(e.h):this.inputX.value=String(e.w)}"y"===t&&this.#gn(i.value||this.#hn)}}const cr=hr,{NO_EVENT:dr,ON_OVER_COMPONENT:ur}=_t;class pr extends Zo{static key="audio";static className="";static component(t){return/^AUDIO$/i.test(t?.nodeName)?t:null}#ii;#bn;#yn;#vn;constructor(t,e){super(t),this.title=this.lang.audio,this.icon="audio",this.pluginOptions={defaultWidth:e.defaultWidth?kt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight?kt.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:kt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:kt.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 i=function({lang:t,icons:e,plugins:i},s){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">`;s.createFileInput&&(n+=`\n <div class="se-modal-form">\n <label>${t.audio_modal_file}</label>\n ${No.CreateFileInput({lang:t,icons:e},s)}\n </div>`);s.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${i.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${xt.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>`,xt.utils.createElement("DIV",{class:"se-modal-content"},n)}(t,this.pluginOptions),s=function({lang:t,icons:e}){const i=`\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 xt.utils.createElement("DIV",{class:"se-controller"},i)}(t);this.modal=new No(this,i),this.controller=new as(this,s,{position:"bottom",disabled:!0}),this.fileManager=new Bo(this,{query:"audio",loadEventName:"onAudioLoad",actionEventName:"onAudioAction"}),this.figure=new ws(this,null,{}),this.fileModalWrapper=i.querySelector(".se-flex-input-wrapper"),this.audioInputFile=i.querySelector(".__se__file_input"),this.audioUrlFile=i.querySelector(".se-input-url"),this.preview=i.querySelector(".se-link-preview"),this.#ii=null,this.#bn=this.pluginOptions.defaultWidth,this.#yn=this.pluginOptions.defaultHeight,this.#vn="";const n=i.querySelector(".__se__gallery");n&&this.eventManager.addEvent(n,"click",this.#Ps.bind(this)),this.audioInputFile&&(this.eventManager.addEvent(i.querySelector(".se-modal-files-edge-button"),"click",this.#Fs.bind(this,this.audioUrlFile,this.preview)),this.audioUrlFile&&this.eventManager.addEvent(this.audioInputFile,"change",this.#_n.bind(this))),this.audioUrlFile&&this.eventManager.addEvent(this.audioUrlFile,"input",this.#zs.bind(this))}open(){this.modal.open()}retainFormat(){return{query:"audio",method:t=>{const e=ws.GetContainer(t);if(e&&e.container&&e.cover)return;this.#fn(t);const i=ws.CreateContainer(t.cloneNode(!0),"se-flex-component");this.figure.retainFigureFormat(i.container,t,null,this.fileManager)}}}onFilePasteAndDrop({file:t}){/^audio/.test(t.type)&&(this.submitFile([t]),this.editor.focus())}modalOn(t){t?this.#ii?(this.#vn=this.preview.textContent=this.audioUrlFile.value=this.#ii.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.#vn.length>0)&&await this.submitURL(this.#vn)}modalInit(){No.OnChangeFile(this.fileModalWrapper,[]),this.audioInputFile&&(this.audioInputFile.value=""),this.audioUrlFile&&(this.#vn=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.#vn=this.preview.textContent=this.audioUrlFile.value=this.#ii.src),this.open();break;case"copy":{const t=ws.GetContainer(this.#ii);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.#Zs(t)}async componentDestroy(t){const e=t||this.#ii,i=ws.GetContainer(e),s=i.container||e,n=s.previousElementSibling||s.nextElementSibling;if(!1===await this.triggerEvent("onAudioDeleteBefore",{element:e,container:i,url:e.getAttribute("src")}))return;const o=s.parentNode;xt.utils.removeItem(s),this.modalInit(),this.controller.close(),o!==this.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(o,(function(t){return 0===t.childNodes.length}),null),this.editor.focusEdge(n),this.history.push(!1)}async submitFile(t){if(0===t.length)return!1;let e=0;const i=[],s=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,s>0&&o>s){const t="[SUNEDITOR.audioUpload.fail] Size of uploadable single file: "+s/1e3+"KB",e=await this.triggerEvent("onAudioUploadError",{error:t,limitSize:s,uploadSize:o,file:n});return this.ui.alertOpen(e===dr?t:e||t,"error"),!1}i.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",i=await this.triggerEvent("onAudioUploadError",{error:t,limitSize:n,currentSize:this.fileManager.getSize(),uploadSize:e});return this.ui.alertOpen(i===dr?t:i||t,"error"),!1}const o={files:i,isUpdate:this.modal.isUpdate,element:this.#ii},l=function(t,e,i){t(i=e||i,i.files)}.bind(this,this.#Ks.bind(this),o),r=await this.triggerEvent("onAudioUploadBefore",{info:o,handler:l});return void 0===r||!!r&&(null!==r&&"object"==typeof r&&l(r),!0!==r&&r!==dr||l(null),!0)}async submitURL(t){if(0===t.length)return!1;const e={name:t.split("/").pop(),size:0},i={url:t,files:e,isUpdate:this.modal.isUpdate,element:this.#Cn()},s=function(t,e,i){t((i=e||i).element,i.url,i.files,i.isUpdate,!0)}.bind(this,this.create.bind(this),i),n=await this.triggerEvent("onAudioUploadBefore",{info:i,handler:s});return void 0===n||!!n&&(null!==n&&"object"==typeof n&&s(n),!0!==n&&n!==dr||s(null),!0)}create(t,e,i,s,n){if(s){if(this.#ii&&(t=this.#ii),this.fileManager.setFileData(t,i),!t||t.src===e)return void this.component.select(t,pr.key);t.src=e,this.component.select(t,pr.key)}else{this.fileManager.setFileData(t,i),t.src=e;const s=ws.CreateContainer(t,"se-flex-component");if(!this.component.insert(s.container,{scrollTo:!!n,insertBehavior:n?this.pluginOptions.insertBehavior:"line"}))return void(n&&this.editor.focus());if(!this.options.get("componentInsertBehavior")){const t=this.format.addLine(s.container,null);t&&this.selection.setRange(t,0,t,0)}}s&&this.history.push(!1)}#Zs(t){he.get("__overInfo")!==ur&&(this.#ii=t,this.controller.open(t,null,{isWWTarget:!1,addOffset:null}))}#Ke(t,e){const i=e.result;for(let e,s,n=0,o=i.length;n<o;n++)s=t.isUpdate?t.element:this.#Cn(),e={name:i[n].name,size:i[n].size},this.create(s,i[n].url,e,t.isUpdate,n===o-1)}#Cn(){const t=this.#bn,e=this.#yn,i=xt.utils.createElement("AUDIO",{style:(t?"width:"+t+"; ":"")+(e?"height:"+e+";":"")});return this.#fn(i),i}#fn(t){t.setAttribute("controls","true");const e=this.pluginOptions.audioTagAttributes;if(e)for(const i in e)t.setAttribute(i,e[i])}#Ks(t,e){if(!e)return;const i=this.modal.isUpdate?[e[0]]:e;this.fileManager.upload(this.pluginOptions.uploadUrl,this.pluginOptions.uploadHeaders,i,this.#nn.bind(this,t),this.#Je.bind(this))}async#Je(t){const e=await this.triggerEvent("onAudioUploadError",{error:t}),i=e===dr?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.audio.error]",i)}async#nn(t,e){if(await this.triggerEvent("audioUploadHandler",{xmlHttp:e,info:t})===dr){const i=JSON.parse(e.responseText);i.errorMessage?this.#Je(i):this.#Ke(t,i)}}#zs(t){const e=xt.query.getEventTarget(t).value.trim();this.#vn=this.preview.textContent=e?this.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#Ps(){this.plugins.audioGallery.open(this.#rn.bind(this))}#rn(t){this.#vn=this.preview.textContent=this.audioUrlFile.value=t.getAttribute("data-command")||t.src,this.audioUrlFile.focus()}#Fs(t,e){this.audioInputFile.value="",t&&(t.disabled=!1,e.style.textDecoration=""),No.OnChangeFile(this.fileModalWrapper,[])}#_n(t){const e=xt.query.getEventTarget(t);this.audioInputFile.value?(this.audioUrlFile.disabled=!0,this.preview.style.textDecoration="line-through"):(this.audioUrlFile.disabled=!1,this.preview.style.textDecoration=""),No.OnChangeFile(this.fileModalWrapper,e.files)}}const gr=pr,{_w:mr,NO_EVENT:fr}=_t;class br extends Zo{static key="embed";static className="";static component(t){const e=t.children;let i="",s=null;if(xt.check.isIFrame(t)&&(s=t,i=t.src),!i&&/^DIV$/i.test(t?.nodeName)&&xt.check.isIFrame(e[0])&&(s=e[0],i=s.src),!i&&xt.utils.hasClass(t,"se-embed-container")){s=xt.query.getChildNode(t,(t=>t.src||t.href)),i=s?.src||s?.href}return i?this.checkContentType(i)?s:null:s}#Ss;#Ts;#cn;#dn;#ii;#Ls;#Ms;#As;#Bs;#Vs;#vi;#Is;#Os;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&&kt.get(e.defaultWidth,0)?kt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight&&kt.get(e.defaultHeight,0)?kt.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"",percentageOnlySize:!!e.percentageOnlySize,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:kt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:kt.get(e.uploadSingleSizeLimit,0),iframeTagAttributes:e.iframeTagAttributes||null,query_youtube:e.query_youtube||"",query_vimeo:e.query_vimeo||"",insertBehavior:e.insertBehavior};const i=this.pluginOptions.percentageOnlySize?"%":"px",s=function({lang:t,icons:e},i){let s=`\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(i.canResize){const n=i.percentageOnlySize,o=n?' style="display: none !important;"':"",l=i.showHeightInput?"":' style="display: none !important;"',r=i.showRatioOption?"":' style="display: none !important;"',a=n||i.showHeightInput||i.showRatioOption?"":' style="display: none !important;"';s+=`\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"> </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" /> \n\t\t\t\t\t<span>${t.proportion}</span>\n\t\t\t\t</label>\n\t\t\t</div>`}s+=`\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=xt.utils.createElement("DIV",{class:"se-modal-content"},s);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")}}(t,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")))||(s.figureAlignBtn.style.display="none"),this.modal=new No(this,s.html),this.figure=new ws(this,n,{sizeUnit:i}),this.fileModalWrapper=s.fileModalWrapper,this.embedInput=s.embedInput,this.focusElement=this.embedInput,this.previewSrc=s.previewSrc,this.sizeUnit=i,this.proportion=null,this.inputX=null,this.inputY=null,this.#Ss="",this.#Ts="none",this.#cn=this.pluginOptions.defaultWidth,this.#dn=this.pluginOptions.defaultHeight,this.#ii=null,this.#Ls=null,this.#Ms=null,this.#As={w:0,h:0},this.#Bs="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.#Vs="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.#vi=this.pluginOptions.canResize,this.#Is=this.pluginOptions.percentageOnlySize,this.#Os=!this.#vi||!this.pluginOptions.showHeightInput||this.#Is,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,i]=t.match(this.query.codepen.pattern);return`https://codepen.io/${e}/embed/${i}`},tag:"iframe"},...e.embedQuery};const o=[];for(const t in this.query)o.push(this.query[t].pattern);this.urlPatterns=o.concat(e.urlPatterns||[]),this.eventManager.addEvent(this.embedInput,"input",this.#zs.bind(this)),this.#vi&&(this.proportion=s.proportion,this.inputX=s.inputX,this.inputY=s.inputY,this.inputX.value=this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight,this.eventManager.addEvent(this.inputX,"keyup",this.#qs.bind(this,"x")),this.eventManager.addEvent(this.inputY,"keyup",this.#qs.bind(this,"y")),this.eventManager.addEvent(s.revertBtn,"click",this.#Ws.bind(this)))}open(){this.modal.open()}retainFormat(){return{query:"iframe",method:async t=>{if(!this.checkContentType(t.src))return;const e=ws.GetContainer(t);if(e&&e.container&&e.cover)return;this.#Zs(t,!0);const i=this.format.getLine(t);i&&(this.#Ts=i.style.textAlign||i.style.float),this.#Ys(t)}}}modalOn(t){!t&&this.#vi?(this.inputX.value=this.#Bs="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.inputY.value=this.#Vs="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.proportion.disabled=!0):t&&(this.#Ss=this.previewSrc.textContent=this.embedInput.value=this.#Ls.getAttribute("data-se-origin")||"")}async modalAction(){this.#Ts=this.modal.form.querySelector('input[name="suneditor_embed_radio"]:checked').value;let t=!1;return this.#Ss.length>0&&(t=await this.submitSRC(this.#Ss)),t&&mr.setTimeout(this.component.select.bind(this.component,this.#ii,br.key),0),t}modalInit(){No.OnChangeFile(this.fileModalWrapper,[]),this.#Ss=this.previewSrc.textContent=this.embedInput.value="",this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="none"]').checked=!0,this.#As={w:0,h:0},this.#Os=!1,this.#vi&&(this.inputX.value=this.pluginOptions.defaultWidth===this.#cn?"":this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight===this.#dn?"":this.pluginOptions.defaultHeight,this.proportion.checked=!1,this.proportion.disabled=!0)}componentSelect(t){this.#Zs(t)}componentEdit(){this.modal.open()}async componentDestroy(t){const e=t||this.#ii,i=xt.query.getParentElement(e,ws.is)||e,s=i.previousElementSibling||i.nextElementSibling,n=i.parentNode;!1!==await this.triggerEvent("onEmbedDeleteBefore",{element:e,container:i,align:this.#Ts,url:this.#Ss})&&(xt.utils.removeItem(i),this.modalInit(),n!==this.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.editor.focusEdge(s),this.history.push(!1))}checkContentType(t){return t=t?.toLowerCase()||"",!!this.urlPatterns.some((e=>e.test(t)))}findProcessUrl(t){const e=this.query;for(const i in e){const s=e[i];if(s.pattern.test(t))return{origin:t,url:s.action(t),tag:s.tag}}return null}async submitSRC(t){if(!(t||=this.#Ss))return!1;let e=null;if(/^<iframe\s|^<blockquote\s/i.test(t)){const i=(new DOMParser).parseFromString(t,"text/html").body.children;if(0===i.length)return!1;e={children:i,...this.#Xs(),process:null}}else{const i=this.findProcessUrl(t);if(!i)return!1;e={url:t=i.url,...this.#Xs(),process:i}}const i=function(e,i,s){e(t,(i=s||i).process,i.url,i.children,i.inputWidth,i.inputHeight,i.align,i.isUpdate)}.bind(this,this.#wn.bind(this),e),s=await this.triggerEvent("onEmbedInputBefore",{...e,handler:i});return void 0===s||!1!==s&&(null!==s&&"object"==typeof s&&i(s),!0!==s&&s!==fr||i(null),!0)}#Zs(t,e=!1){if(!t)return;const i=this.figure.open(t,{nonResizing:this.#Os,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:e});this.#ii=t,this.#Ls=i.cover,this.#Ms=i.container,this._caption=i.caption,this.#Ts=i.align,t.style.float="",this.#Bs=String(i.originWidth||i.w||""),this.#Vs=String(i.originHeight||i.h||"");if((this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="'+this.#Ts+'"]')||this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="none"]')).checked=!0,!this.#vi)return;const s=this.#Is&&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=!!s,this.inputY.disabled=!!s,this.proportion.disabled=!!s,this.#As=this.proportion.checked?i.ratio:{w:0,h:0}}#xn(){const t=xt.utils.createElement("IFRAME");return this.#mn(t),t}#kn(){return xt.utils.createElement("BLOCKQUOTE")}#wn(t,e,i,s,n,o,l,r){let a=null,h=null,c=null,d=null;if(r){if(a=this.#ii,a.src!==i){const t=this.findProcessUrl(i);if(/^iframe$/i.test(t?.tag)&&!/^iframe$/i.test(a.nodeName)){const t=this.#xn();t.src=i,a.replaceWith(t),a=t}else if(/^blockquote$/i.test(t?.tag)&&!/^blockquote$/i.test(a.nodeName)){const t=this.#kn();t.setAttribute("src",i),a.replaceWith(t),a=t}else a.src=i}c=this.#Ms,h=xt.query.getParentElement(a,"FIGURE")}else if(e){a=this.#xn(),a.src=i;const t=ws.CreateContainer(a,"se-embed-container");h=t.cover,c=t.container}else{a=s[0];const t=ws.CreateContainer(a,"se-embed-container");h=t.cover,c=t.container;let e=null,i=0;for(;e=s[i];)/^script$/i.test(e.nodeName)?(d=xt.utils.createElement("script",{src:e.getAttribute("src"),async:"true"},null),i++):h.appendChild(e)}this.#ii=a,this.#Ls=h,this.#Ms=c,this.figure.open(a,{nonResizing:this.#Os,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0}),n||=this.#cn,o||=this.#dn;const u=this.figure.getSize(a),p=u.w!==n||u.h!==o,g=!r||p;if(g&&this.#tn(n,o),this.figure.setAlign(a,l),h.setAttribute("data-se-origin",t),r)this.#vi&&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=()=>{xt.utils.removeItem(d),d=null},h.appendChild(d);const t=new MutationObserver((e=>{for(const i of e)if("childList"===i.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)}}}#Ys(t){if(!t)return;this.#mn(t);const e=t;t=t.cloneNode(!0);const i=ws.CreateContainer(t,"se-embed-container").container;this.figure.open(t,{nonResizing:this.#Os,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0});const s=(t.getAttribute("data-se-size")||",").split(","),n=s[0]||e.width||"",o=s[1]||e.height||"";this.#tn(n,o);const l=this.format.getLine(e);return l&&(this.#Ts=l.style.textAlign||l.style.float),this.figure.setAlign(t,this.#Ts),this.figure.retainFigureFormat(i,this.#ii,null,null),t}#tn(t,e){t||=this.inputX?.value||this.pluginOptions.defaultWidth,e||=this.inputY?.value||this.pluginOptions.defaultHeight,this.#Is&&(t?/%$/.test(t+"")&&(t+="%"):t="100%"),this.figure.setSize(t,e)}#Xs(){return{inputWidth:this.inputX?.value||"",inputHeight:this.inputY?.value||"",align:this.#Ts,isUpdate:this.modal.isUpdate,element:this.#ii}}#mn(t){t.frameBorder="0",t.allowFullscreen=!0;const e=this.pluginOptions.iframeTagAttributes;if(e)for(const i in e)t.setAttribute(i,e[i])}#zs(t){const e=xt.query.getEventTarget(t).value.trim();/^<iframe.*\/iframe>$/.test(e)?(this.#Ss=e,this.previewSrc.textContent='<IFrame :src=".."></IFrame>'):this.#Ss=this.previewSrc.textContent=e?this.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#Ws(){this.#Is?this.inputX.value=Number(this.#Bs)>100?"100":this.#Bs:(this.inputX.value=this.#Bs,this.inputY.value=this.#Vs)}#qs(t,e){if(Et.isSpace(e.code))return void e.preventDefault();const i=xt.query.getEventTarget(e);if("x"===t&&this.#Is&&Number(i.value)>100)i.value="100";else if(this.proportion.checked){const e=ws.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this.#As);"x"===t?this.inputY.value=String(e.h):this.inputX.value=String(e.w)}}}const yr=br,{_w:vr,_d:_r}=_t;class Cr extends Zo{static key="math";static className="";static component(t){return xt.utils.hasClass(t,"se-math|katex")&&xt.check.isComponentContainer(t)?t:null}#ii;constructor(t,e){super(t),this.title=this.lang.math,this.icon="math",this.katex=null,this.mathjax=null,(this.katex=this.#En(t))||(this.mathjax=this.#Sn(t))||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 i=function(t){const{lang:e,icons:i,pluginOptions:s,katex:n}=t,{formSize:o,fontSizeList:l,canResize:r,autoHeight:a}=s,{width:h,height:c,maxWidth:d,maxHeight:u,minWidth:p,minHeight:g}=o,m=r?a?"horizontal":"auto":"none";let f=l[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="${e.close}" aria-label="${e.close}">\n ${i.cancel}\n </button>\n <span class="se-modal-title">${e.math_modal_title}</span>\n </div>\n <div class="se-modal-body">\n <div class="se-modal-form">\n <label>${e.math_modal_inputLabel} ${n?`(<a href="${_t.KATEX_WEBSITE}" target="_blank">KaTeX</a>)`:`(<a href="${_t.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: ${h}; height: ${c}; min-width: ${p}; min-height: ${g}; resize: ${m};"></textarea>\n </div>\n <div class="se-modal-form">\n <label>${e.math_modal_fontSizeLabel}</label>\n <select class="se-input-select se-math-size">`;for(let t,e=0,i=l.length;e<i;e++)t=l[e],t.default&&(f=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>${e.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="${e.submitButton}" aria-label="${e.submitButton}">\n <span>${e.submitButton}</span>\n </button>\n </div>\n </form>`,t.defaultFontSize=f,xt.utils.createElement("DIV",{class:"se-modal-content se-modal-responsive",style:`max-width: ${d}; max-height: ${u};`},b)}(this),s=function({lang:t,icons:e}){const i=`\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 xt.utils.createElement("DIV",{class:"se-controller se-controller-link"},i)}(t);this.modal=new No(this,i),this.controller=new as(this,s,{position:"bottom",disabled:!0}),this.textArea=i.querySelector(".se-math-exp"),this.previewElement=i.querySelector(".se-math-preview"),this.fontSizeElement=i.querySelector(".se-math-size"),this.isUpdateState=!1,this.#ii=null,this.previewElement.style.fontSize=this.defaultFontSize,this.eventManager.addEvent(this.textArea,"input",this.#Tn.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=wr(t);if(!e)return;const i=_r.createRange().createContextualFragment(this.#Hn(wt.entityToHTML(this.#Ln(e,!0))));t.innerHTML=i.querySelector(".se-math, .katex").innerHTML,t.setAttribute("contenteditable","false"),xt.utils.addClass(t,"se-component|se-inline-component|se-disable-pointer|se-math"),this.katex?xt.utils.addClass(t,"katex"):xt.utils.removeClass(t,"katex"),this.mathjax&&this.#Mn(this.mathjax)}}}modalOn(t){if(this.isUpdateState=t,t){if(this.controller.currentTarget){const t=this.controller.currentTarget,e=wt.entityToHTML(this.#Ln(wr(t),!0)),i=function(t){const e=t.getAttribute("data-se-type");if(e)return e;const i=t.getAttribute("data-exp");return i?(t.removeAttribute("data-font-size"),t.setAttribute("data-se-type",i),i):null}(t)||"1em";this.textArea.value=e,this.fontSizeElement.value=i,this.previewElement.innerHTML=this.#Hn(e),this.previewElement.style.fontSize=i}}else this.modalInit()}async modalAction(){if(0===this.textArea.value.trim().length||xt.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(xt.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.#Ln(t,!1))),e.setAttribute("data-se-type",this.fontSizeElement.value),e.style.fontSize=this.fontSizeElement.value,this.katex?(xt.utils.addClass(e,"katex"),xt.utils.removeClass(e,"MathJax")):xt.utils.removeClass(e,"katex"),this.isUpdateState){xt.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 i=xt.utils.createElement(t[0].nodeName,null,e);this.component.insert(i,{insertBehavior:"none",scrollTo:!1})}else this.component.insert(e,{insertBehavior:"none",scrollTo:!1})}this.mathjax&&this.#Mn(this.mathjax);const i=this.selection.getNearRange(e);return i?this.selection.setRange(i.container,i.offset,i.container,i.offset):this.component.select(e,Cr.key),!0}modalInit(){this.textArea.value="",this.previewElement.innerHTML="",xt.utils.removeClass(this.textArea,"se-error")}controllerAction(t){switch(t.getAttribute("data-command")){case"update":this.modal.open();break;case"copy":this.#Nn(this.#ii);break;case"delete":this.componentDestroy(this.controller.currentTarget)}}controllerClose(){this.#ii=null}componentSelect(t){if(xt.utils.hasClass(t,"se-math|katex")&&wr(t))return this.#ii=t,void this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null})}async componentDestroy(t){xt.utils.removeItem(t),this.controller.close(),this.editor.focus(),this.history.push(!1)}#Hn(t){let e="";try{xt.utils.removeClass(this.textArea,"se-error"),this.katex?e=this.katex.src.renderToString(t,{throwOnError:!0,displayMode:!0}):this.mathjax&&(e=this.mathjax.convert(t).outerHTML,/<mjx-merror/.test(e)?(xt.utils.addClass(this.textArea,"se-error"),e=`<span class="se-math-error">${e}</span>`):e=`<span class="se-math">${e}</span>`)}catch(t){xt.utils.addClass(this.textArea,"se-error"),e=`<span class="se-math-error">Math syntax error. (Refer ${this.katex?`<a href="${_t.KATEX_WEBSITE}" target="_blank">KaTeX</a>`:`<a href="${_t.MATHJAX_WEBSITE}" target="_blank">MathJax</a>`})</span>`,console.warn("[SUNEDITOR.math.error] ",t.message)}return e}#Ln(t,e){return t.replace(/\\{2}/g,e?"\\":"\\\\")}async#Nn(t){if(navigator.clipboard&&t)try{const e=wr(t);await this.html.copy(e),xt.utils.addClass(t,"se-copy"),vr.setTimeout((()=>{xt.utils.removeClass(t,"se-copy")}),120)}catch(t){console.error("[SUNEDITOR.math.copy.fail]",t)}}#Tn(t){const e=xt.query.getEventTarget(t);this.pluginOptions.autoHeight&&(e.style.height="5px",e.style.height=e.scrollHeight+5+"px"),this.previewElement.innerHTML=this.#Hn(e.value),this.mathjax&&this.#Mn(this.mathjax)}#Mn(t){t.clear(),t.updateDocument()}#En(t){const e=t.options.get("externalLibs").katex;if(!e)return null;if(!e.src)return console.warn("[SUNEDITOR.math.katex.fail] The katex option is set incorrectly."),null;const i=[{throwOnError:!1},e.options||{}].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{});return e.options=i,e}#Sn(t){const e=t.options.get("externalLibs").mathjax;if(!e)return null;t.frameOptions.get("iframe")&&console.warn("[SUNEDITOR.math.mathjax.fail] The MathJax option is not supported in the iframe.");try{const t=e.browserAdaptor();e.RegisterHTMLHandler(t);const i=new e.TeX,s=new e.CHTML;return e.src.document(document,{InputJax:i,OutputJax:s})}catch(t){return console.warn("[SUNEDITOR.math.mathjax.fail] The MathJax option is set incorrectly.",t),null}}}function wr(t){const e=t.getAttribute("data-se-value");if(e)return e;const i=t.getAttribute("data-exp");return i?(t.removeAttribute("data-exp"),t.setAttribute("data-se-value",i),i):null}const xr=Cr,{_w:kr}=_t;const Er=class extends Zo{static key="drawing";static className="";#V;#An;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 i=function({lang:t,icons:e,pluginOptions:i}){const{width:s,height:n,maxWidth:o,maxHeight:l,minWidth:r,minHeight:a}=i.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: ${s}; height: ${n}; min-width: ${r}; min-height: ${a};">\n <canvas class="se-drawing-canvas" style="width: 100%; height: 100%;"></canvas>\n\t\t\t${i.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${i.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${xt.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${xt.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${xt.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 xt.utils.createElement("DIV",{class:"se-modal-content se-modal-responsive",style:`max-width: ${o}; max-height: ${l};`},h)}(this);this.modal=new No(this,i),this.as=this.pluginOptions.defaultFormatType,this.pluginOptions.useFormatType&&(this.asBlock=i.querySelector('[data-command="asBlock"]'),this.asInline=i.querySelector('[data-command="asInline"]'),this.eventManager.addEvent([this.asBlock,this.asInline],"click",this.#Us.bind(this))),this.canvas=null,this.ctx=null,this.isDrawing=!1,this.points=[],this.paths=[],this.resizeObserver=null,this.#V={touchstart:this.#Bn.bind(this),touchmove:this.#Vn.bind(this),mousedown:this.#In.bind(this),mousemove:this.#On.bind(this),mouseup:this.#Rn.bind(this),mouseleave:this.#Fn.bind(this),mouseenter:this.#zn.bind(this)},this.#An={touchstart:null,touchmove:null,mousedown:null,mousemove:null,mouseup:null,mouseleave:null,mouseenter:null},this.eventManager.addEvent(i.querySelector('[data-command="remove"]'),"click",this.#$n.bind(this))}open(){this.pluginOptions.useFormatType&&this.#js("inline"===(this.pluginOptions.keepFormatType?this.as:this.pluginOptions.defaultFormatType)),this.modal.open(),this.#Pn()}modalOff(){this.#Dn()}async modalAction(){if("svg"===this.pluginOptions.outputFormat){const t=this.#qn();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}#Pn(){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.#Wn(),this.#An.touchstart=this.eventManager.addEvent(t,"touchstart",this.#V.touchstart,{passive:!1,capture:!0}),this.#An.touchmove=this.eventManager.addEvent(t,"touchmove",this.#V.touchmove,!0),this.#An.mousedown=this.eventManager.addEvent(t,"mousedown",this.#V.mousedown,{passive:!1,capture:!0}),this.#An.mousemove=this.eventManager.addEvent(t,"mousemove",this.#V.mousemove,!0),this.#An.mouseup=this.eventManager.addEvent(t,"mouseup",this.#V.mouseup,!0),this.#An.mouseleave=this.eventManager.addEvent(t,"mouseleave",this.#V.mouseleave),this.#An.mouseenter=this.eventManager.addEvent(t,"mouseenter",this.#V.mouseenter),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),_t.isResizeObserverSupported&&(this.resizeObserver=new ResizeObserver((()=>{const e=t.width,i=t.height,s=t.offsetWidth,n=t.offsetHeight;t.width=s,t.height=n,e===t.width&&i===t.height||(this.pluginOptions.maintainRatio&&this.#Un(e,i,s,n),this.#Zn())})),this.resizeObserver.observe(t))}#Dn(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.canvas&&(this.eventManager.removeEvent(this.#An.mousedown),this.eventManager.removeEvent(this.#An.mousemove),this.eventManager.removeEvent(this.#An.mouseup),this.eventManager.removeEvent(this.#An.mouseleave),this.eventManager.removeEvent(this.#An.mouseenter)),this.canvas=null,this.ctx=null,this.points=[],this.paths=[],this.isDrawing=!1}#Wn(){this.ctx.lineWidth=this.pluginOptions.lineWidth,this.ctx.lineCap=this.pluginOptions.lineCap,this.ctx.strokeStyle=this.pluginOptions.lineColor||kr.getComputedStyle(this.carrierWrapper).color}#Gn(){this.#Wn(),this.ctx.beginPath(),this.points.forEach((([t,e],i)=>{0===i?this.ctx.moveTo(t,e):this.ctx.lineTo(t,e)})),this.ctx.stroke()}#Zn(){this.#Wn(),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.paths.forEach((t=>{this.points=t,this.#Gn()})),this.points=[]}#Un(t,e,i,s){const n=i/t,o=s/e;this.paths=this.paths.map((t=>t.map((([t,e])=>[t*n,e*o]))))}#Yn(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.points=[],this.paths=[]}#jn(){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((i=>{const s=i.reduce(((t,[e,i],s)=>t+(0===s?`M ${e} ${i}`:` L ${e} ${i}`)),""),n=document.createElementNS(t,"path");n.setAttribute("d",s),n.setAttribute("fill","none"),n.setAttribute("stroke",String(this.ctx.strokeStyle)),n.setAttribute("stroke-width",this.ctx.lineWidth+""),e.appendChild(n)})),e}#qn(){const t=this.#jn(),e=(new XMLSerializer).serializeToString(t),i=new Blob([e],{type:"image/svg+xml"}),s=new File([i],"drawing.svg",{type:"image/svg+xml"}),n=new DataTransfer;return n.items.add(s),n.files}#Xn(t){const{touches:e}=t,i=this.canvas.getBoundingClientRect();return{x:e[0].clientX-i.left,y:e[0].clientY-i.top}}#js(t){t?(xt.utils.addClass(this.asInline,"on"),xt.utils.removeClass(this.asBlock,"on"),this.as="inline"):(xt.utils.addClass(this.asBlock,"on"),xt.utils.removeClass(this.asInline,"on"),this.as="block")}#In(t){t.preventDefault(),this.isDrawing=!0,this.points.push([t.offsetX,t.offsetY]),this.#Gn()}#On(t){t.preventDefault(),this.isDrawing&&(this.points.push([t.offsetX,t.offsetY]),this.#Gn())}#Bn(t){t.preventDefault();const{x:e,y:i}=this.#Xn(t);this.isDrawing=!0,this.points.push([e,i]),this.#Gn()}#Vn(t){t.preventDefault();const{x:e,y:i}=this.#Xn(t);this.isDrawing&&(this.points.push([e,i]),this.#Gn())}#Rn(){this.isDrawing=!1,this.points.length>0&&(this.paths.push([...this.points]),this.points=[])}#Fn(){this.isDrawing&&(this.paths.push([...this.points]),this.pluginOptions.lineReconnect||(this.points=[],this.isDrawing=!1))}#zn(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.#Gn()}}#$n(){this.#Yn()}#Us(t){this.#js("asInline"===xt.query.getEventTarget(t).getAttribute("data-command"))}};const Sr=class extends $o{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 $n(this,{title:this.lang.imageGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Kn.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()}#Kn(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 Tr=class extends $o{static key="videoGallery";static className="";constructor(t,e){super(t),this.title=this.lang.videoGallery,this.icon="video_gallery",this.onSelectfunction=null;const i="string"==typeof e.thumbnail?e.thumbnail:this.icons.video_thumbnail;this.browser=new $n(this,{title:this.lang.videoGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Kn.bind(this),columnSize:4,className:"se-video-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>i,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()}#Kn(t){if(this.onSelectfunction)this.onSelectfunction(t);else{let e=t.getAttribute("data-command");const i=this.plugins.video.findProcessUrl(e);i&&(e=i.url);const s={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,s,!0)}}};const Hr=class extends $o{static key="audioGallery";static className="";constructor(t,e){super(t),this.title=this.lang.audioGallery,this.icon="audio_gallery",this.onSelectfunction=null;const i="string"==typeof e.thumbnail?e.thumbnail:this.icons.audio_thumbnail;this.browser=new $n(this,{title:this.lang.audioGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Kn.bind(this),columnSize:4,className:"se-audio-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>i})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Kn(t){this.onSelectfunction?this.onSelectfunction(t):(this.plugins.audio.modalInit(),this.plugins.audio.submitURL(t.getAttribute("data-command")))}};const Lr=class extends $o{static key="fileGallery";static className="";constructor(t,e){super(t),this.title=this.lang.fileGallery,this.icon="file_gallery",this.onSelectfunction=null;const i="string"==typeof e.thumbnail?e.thumbnail:this.icons.file_thumbnail;this.browser=new $n(this,{title:this.lang.fileGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Kn.bind(this),columnSize:4,className:"se-file-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>i})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Kn(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 Mr=class extends $o{static key="fileBrowser";static className="";constructor(t,e){super(t),this.title=this.lang.fileBrowser,this.icon="file_browser",this.onSelectfunction=null;const i={video:this.icons.video_thumbnail,audio:this.icons.audio_thumbnail,file:this.icons.file_thumbnail},s=this.icons.file_thumbnail;this.browser=new $n(this,{title:this.lang.fileBrowser,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Kn.bind(this),columnSize:4,className:"se-file-browser",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:t=>i[t.type]||s,props:[...new Set((e.props??[]).concat(["frame"]))]})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Kn(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)}}}},Nr={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 Ar extends Uo{static key="fontSize";static className="se-btn-select se-btn-input se-btn-tool-font-size";#Jn;constructor(t,e){super(t),this.unitMap={...Nr,...e.unitMap||{}},this.sizeUnit=/text/.test(e.sizeUnit)?"":e.sizeUnit||this.options.get("fontSizeUnits")[0];const i=function({lang:t},e,i,s){const n=e.list,o=e.default,l=s?t.default:"";let r='\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">';for(let t,e,s,a,h,c=0,d=n.length;c<d;c++)t=n[c],"object"==typeof t?(e=t.title,s=t.size):e=s=t+i,a=o===s?" 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="${s}" data-value="${e}" title="${h}" aria-label="${h}" style="font-size:${s};">${h}</button>\n\t\t\t</li>`;return r+="\n\t\t</ul>\n\t</div>",xt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-font-size"},r)}(t,this.unitMap[this.sizeUnit||"text"],this.sizeUnit,e.showDefaultSizeLabel),s=!!this.sizeUnit&&(e.showIncDecControls??!1),n=!this.sizeUnit||(e.disableInput??!1);this.title=this.lang.fontSize,this.inner=!(n&&!s)&&(n?`<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}" />`),s?(this.beforeItem=xt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-btn","data-command":Ar.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=xt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-btn","data-command":Ar.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>`)):n?n&&!s&&(this.replaceButton=xt.utils.createElement("button",{class:"se-btn se-tooltip se-btn-select se-btn-tool-font-size","data-command":Ar.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:Ar.key,type:"dropdown"},i)):(this.afterItem=xt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":Ar.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:Ar.key,type:"dropdown"},i)),this.currentSize="",this.sizeList=i.querySelectorAll("li button"),this.hasInputFocus=!1,this.isInputActive=!1,this.#Jn=n,this.menu.initDropdownTarget(Ar,i)}active(t,e){if(!xt.utils.hasClass(e,"__se__font_size"))return!1;let i="";if(t){if(this.format.isLine(t))return;if(i=xt.utils.getStyle(t,"fontSize"))return this.#Qn(e,i),!0}else this.#Qn(e,this.#to());return!1}toolbarInputKeyDown({target:t,event:e}){const i=e.code;if(this.#Jn||Et.isSpace(i))return void e.preventDefault();if(!/^(ArrowUp|ArrowDown|Enter)$/.test(i))return;const{value:s,unit:n}=this.#eo(t);if(!s)return;const o=kt.get(s),l=this.unitMap[n];let r=o;switch(i){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.#Qn(t,r+n);if(this.#Jn)return;const s=xt.utils.createElement("SPAN",{style:"font-size: "+e+";"});this.inline.apply(s,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null}),Et.isEnter(i)||t.focus()}finally{this.isInputActive=!1}}toolbarInputChange({target:t,value:e,event:i}){if(!this.#Jn)try{this.isInputActive=!0;let{value:i,unit:s}=this.#eo(e);const{max:n,min:o}=this.unitMap[s];i=i>n?n:i<o?o:i;const l=xt.utils.createElement("SPAN",{style:"font-size: "+this.#Qn(t,i+s)+";"});this.inline.apply(l,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}finally{this.isInputActive=!1,i.preventDefault(),this.editor.focus()}}on(t){const{value:e,unit:i}=this.#eo(t),s=e+i;if(s===this.currentSize)return;const n=this.sizeList;for(let t=0,e=n.length;t<e;t++)s===n[t].getAttribute("data-value")?xt.utils.addClass(n[t],"active"):xt.utils.removeClass(n[t],"active");this.currentSize=s}action(t){const e=t.getAttribute("data-command");if(e===Ar.key){const{value:e,unit:i}=this.#eo(t);let s=kt.get(e)+("inc"===t.getAttribute("data-value")?1:-1);const{min:n,max:o}=this.unitMap[i];s=s<n?n:s>o?o:s;const l=xt.utils.createElement("SPAN",{style:"font-size: "+s+i+";"});this.inline.apply(l,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}else if(e){const t=xt.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()}#to(){return this.frameContext.get("wwComputedStyle").fontSize}#eo(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:xt.check.isInputElement(t)?t.value:t.textContent,i=this.sizeUnit?e.split(/(\d+)/):[e,""];let s=(i.pop()||"").trim().toLowerCase();s=this.options.get("fontSizeUnits").includes(s)?s:this.sizeUnit;const n=i.pop();return{unit:s,value:s?Number(n):n}}#Qn(t,e){return(t=t.parentElement.querySelector(".__se__font_size"))?xt.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 Br=Ar;const Vr=class extends Uo{static key="pageNavigator";static className="se-btn-input se-btn-tool-pageNavigator";constructor(t){super(t),this.title=this.lang.pageNumber,this.inner=xt.utils.createElement("input",{type:"number",class:"se-not-arrow-text",placeholder:"1",value:"1",min:"1"},null),this.afterItem=xt.utils.createElement("span",{class:"se-btn se-sub-btn"},""),this.pageNum=1,this.totalPages=1,this.eventManager.addEvent(this.inner,"change",this.#io.bind(this))}display(t,e){this.pageNum=t,this.totalPages=e,this.inner.value=String(t),this.afterItem.textContent=this.inner.max=String(e)}#io(t){if(!this.frameContext.has("documentType_use_page"))return;const e=xt.query.getEventTarget(t),i=Number(e.value)||1;this.frameContext.get("documentType").pageGo(i)}},{_w:Ir}=_t;class Or extends Go{static key="anchor";static className="";static component(t){return xt.check.isAnchor(t)&&t.hasAttribute("id")&&t.hasAttribute("data-se-anchor")?t:null}#ii;#so;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 i=function({lang:t,icons:e}){const i=`\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 xt.utils.createElement("DIV",{class:"se-controller se-controller-link"},i)}(this);this.displayId=i.querySelector(".se-controller-display"),this.controllerSelect=new as(this,i,{position:"bottom",disabled:!0},Or.key);const s=function({lang:t,icons:e}){const i=`\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 xt.utils.createElement("DIV",{class:"se-controller se-controller-simple-input"},i)}(this);this.inputEl=s.querySelector("input"),this.controller=new as(this,s,{position:"bottom",disabled:!0,parents:[this.controllerSelect.form],parentsHide:!0},Or.key),this.#ii=null,this.#so=null}show(){this.controller.open(this.#so=this.selection.getRange()),Ir.setTimeout((()=>{this.inputEl.focus()}),0)}componentSelect(t){this.#ii=t,this.displayId.textContent=t.getAttribute("id"),this.controllerSelect.open(t)}componentDeselect(){this.#U()}controllerAction(t){const e=t.getAttribute("data-command");if(!e)return;const i=this.#ii;switch(e){case"submit":if(this.controller.close(),i)i.id=this.inputEl.value,this.component.select(i,Or.key);else{const t=this.inputEl.value.trim();if(!t)return void this.inputEl.focus();const e=xt.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 i=this.selection.getNearRange(e);i?this.selection.setRange(i.container,i.offset,i.container,i.offset):this.component.select(e,Or.key),this.#U()}break;case"cancel":this.controller.close(!i),this.#so&&this.selection.setRange(this.#so),this.#U(),i&&this.componentSelect(i);break;case"edit":this.inputEl.value=this.displayId.textContent,this.controllerSelect.hide(),this.controller.open(i),this.inputEl.focus();break;case"delete":{const t=this.selection.getNearRange(i);xt.utils.removeItem(i),this.controllerSelect.close(!0),t&&this.selection.setRange(t.container,t.offset,t.container,t.offset),this.#U();break}}}#U(){this.#ii=null,this.#so=null,this.inputEl.value="",this.displayId.textContent=""}}const Rr={blockquote:Yo,exportPDF:Ko,fileUpload:tl,list_bulleted:il,list_numbered:ol,mention:rl,align:hl,font:dl,fontColor:pl,backgroundColor:ml,list:vl,table:Wl,blockStyle:Zl,hr:bl,layout:Yl,lineHeight:Xl,template:Jl,paragraphStyle:tr,textStyle:ir,link:sr,image:lr,video:cr,audio:gr,embed:yr,math:xr,drawing:Er,imageGallery:Sr,videoGallery:Tr,audioGallery:Hr,fileGallery:Lr,fileBrowser:Mr,fontSize:Br,pageNavigator:Vr,anchor:Or};class Fr{async modalAction(){return!0}modalOn(t){}modalInit(){}modalOff(t){}modalResize(){}}class zr{controllerAction(t){}controllerOn(t,e){}controllerClose(){}}class $r{browserInit(){}}class Pr{colorPickerAction(t){}colorPickerHueSliderOpen(){}colorPickerHueSliderClose(){}}class Dr{hueSliderAction(){}hueSliderCancelAction(){}}class qr{componentSelect(t){}componentDeselect(t){}componentEdit(t){}async componentDestroy(t){}componentCopy(t){}}const Wr={contracts:t,utils:e};Object.defineProperty(window,"SUNEDITOR",{enumerable:!0,writable:!1,configurable:!1,value:{...Ro,plugins:Rr,editorInjector:Fo,modules:Wr,helper:Tt,interfaces:s}})})()})();
|